summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Champagne <tchamp@users.sourceforge.net>2003-05-16 19:08:59 +0000
committerTim Champagne <tchamp@users.sourceforge.net>2003-05-16 19:08:59 +0000
commite467a07a8d36a76e66e009cbb2794e2106e6434f (patch)
tree4f6e919454fba554db9e15f81d8015071632f50e
parent19b954f40ce05dbb781810206de6ca38fa47eb76 (diff)
downloadxine-lib-e467a07a8d36a76e66e009cbb2794e2106e6434f.tar.gz
xine-lib-e467a07a8d36a76e66e009cbb2794e2106e6434f.tar.bz2
The cdda input plugin now builds in the Win32 env. I still need to test this but I'm not quite sure how it is suppose to work
CVS patchset: 4868 CVS date: 2003/05/16 19:08:59
-rw-r--r--src/input/input_cdda.c4
-rw-r--r--win32/contrib/timer/timer.c243
-rw-r--r--win32/contrib/timer/timer.h79
-rwxr-xr-xwin32/include/sys/socket.h7
-rw-r--r--win32/libxinesupport.def1
-rwxr-xr-xwin32/xineplug_inp_cdda.plg40
6 files changed, 191 insertions, 183 deletions
diff --git a/src/input/input_cdda.c b/src/input/input_cdda.c
index 5e2573fe3..9f573244e 100644
--- a/src/input/input_cdda.c
+++ b/src/input/input_cdda.c
@@ -20,7 +20,7 @@
* Compact Disc Digital Audio (CDDA) Input Plugin
* by Mike Melanson (melanson@pcisys.net)
*
- * $Id: input_cdda.c,v 1.21 2003/05/16 15:07:35 tchamp Exp $
+ * $Id: input_cdda.c,v 1.22 2003/05/16 19:08:59 tchamp Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -40,6 +40,8 @@
#ifndef _MSC_VER
#include <sys/ioctl.h>
#include <netdb.h>
+#else
+#include <timer.h> /* alarm() */
#endif /* _MSC_VER */
#include <signal.h>
diff --git a/win32/contrib/timer/timer.c b/win32/contrib/timer/timer.c
index 64c5362be..179b7e18f 100644
--- a/win32/contrib/timer/timer.c
+++ b/win32/contrib/timer/timer.c
@@ -1,102 +1,141 @@
-/*
- * Copyright (C) 2000-2001 the xine project
- *
- * This file is part of xine, a unix video player.
- *
- * xine is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * xine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- *
- * WIN32 PORT,
- * by Matthew Grooms <elon@altavista.com>
- *
- * timer.c - Missing unix timer functions
- *
- */
-
-#include "stdio.h"
-#include "timer.h"
-
-/*
- this function returns somewhat
- accurate unix time with the data
- accurate to the first call to get
- of day and the resolution accurate
- to ~ miliseconds.
-*/
-
-static time_t startseconds = 0;
-
-int gettimeofday( struct timeval *tp, struct timezone *tzp )
-{
- MMTIME mmtime;
-
- // clock() returns time in miliseconds
-
- if( !startseconds )
- startseconds = time( 0 );
-
- timeGetSystemTime( &mmtime, sizeof( mmtime ) );
-
- tp->tv_sec = ( mmtime.u.ms / 1000 ) + startseconds;
- tp->tv_usec = ( mmtime.u.ms % 1000 ) * 1000;
-
- return 0;
-};
-
-/*
- These functions are designed to mimick
- a subset of itimer for use with the
- alarm signal on win32. This is just
- enough for xine to work.
-*/
-
-static HANDLE sigalarm = 0;
-
-int setitimer( int which, struct itimerval * value, struct itimerval *ovalue )
-{
- long int miliseconds;
-
- if( !sigalarm )
- sigalarm = CreateEvent( 0, FALSE, TRUE, "SIGALARM" );
-
- miliseconds = value->it_value.tv_usec / 1000;
-
- timeSetEvent( miliseconds, 0, ( LPTIMECALLBACK ) sigalarm, 0, TIME_PERIODIC | TIME_CALLBACK_EVENT_PULSE );
-
- return 0;
-}
-
-/*
- Wait for sigalarm to wake the thread
-*/
-
-int pause( void )
-{
- WaitForSingleObject( sigalarm, INFINITE );
-
- return 0;
-}
-
-int nanosleep( const struct timespec * rqtp, struct timespec * rmtp )
-{
- Sleep( rqtp->tv_nsec / 1000000 );
-
- return 0;
-}
-
-unsigned int sleep( unsigned int seconds )
-{
- Sleep( seconds * 1000 );
- return 0;
-} \ No newline at end of file
+/*
+ * Copyright (C) 2000-2001 the xine project
+ *
+ * This file is part of xine, a unix video player.
+ *
+ * xine is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * xine is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ *
+ * WIN32 PORT,
+ * by Matthew Grooms <elon@altavista.com>
+ *
+ * timer.c - Missing unix timer functions
+ *
+ */
+
+#include "stdio.h"
+#include "timer.h"
+
+#include <signal.h>
+
+#ifndef SIGALRM
+#define SIGALRM 14
+#endif
+
+ /*
+ this function returns somewhat
+ accurate unix time with the data
+ accurate to the first call to get
+ of day and the resolution accurate
+ to ~ miliseconds.
+*/
+
+static time_t startseconds = 0;
+
+int gettimeofday( struct timeval *tp, struct timezone *tzp )
+{
+ MMTIME mmtime;
+
+ // clock() returns time in miliseconds
+
+ if( !startseconds )
+ startseconds = time( 0 );
+
+ timeGetSystemTime( &mmtime, sizeof( mmtime ) );
+
+ tp->tv_sec = ( mmtime.u.ms / 1000 ) + startseconds;
+ tp->tv_usec = ( mmtime.u.ms % 1000 ) * 1000;
+
+ return 0;
+};
+
+/*
+ These functions are designed to mimick
+ a subset of itimer for use with the
+ alarm signal on win32. This is just
+ enough for xine to work.
+*/
+
+static HANDLE sigalarm = 0;
+
+int setitimer( int which, struct itimerval * value, struct itimerval *ovalue )
+{
+ long int miliseconds;
+
+ if( !sigalarm )
+ sigalarm = CreateEvent( 0, FALSE, TRUE, "SIGALARM" );
+
+ miliseconds = value->it_value.tv_usec / 1000;
+
+ timeSetEvent( miliseconds, 0, ( LPTIMECALLBACK ) sigalarm, 0, TIME_PERIODIC | TIME_CALLBACK_EVENT_PULSE );
+
+ return 0;
+}
+
+/*
+ Wait for sigalarm to wake the thread
+*/
+
+int pause( void )
+{
+ WaitForSingleObject( sigalarm, INFINITE );
+
+ return 0;
+}
+
+int nanosleep( const struct timespec * rqtp, struct timespec * rmtp )
+{
+ Sleep( rqtp->tv_nsec / 1000000 );
+
+ return 0;
+}
+
+unsigned int sleep( unsigned int seconds )
+{
+ Sleep( seconds * 1000 );
+ return 0;
+}
+
+static UINT alarmid = 0;
+void CALLBACK AlarmCallback(UINT wTimerID,
+ UINT msg,
+ DWORD dwUser,
+ DWORD dw1,
+ DWORD dw2)
+{
+ if (alarmid) {
+ alarmid = 0;
+ raise(SIGALRM);
+ }
+}
+
+int alarm( int sec )
+{
+ long int miliseconds;
+
+ if (sec) {
+ if (!alarmid) {
+ miliseconds = sec * 1000;
+ timeSetEvent( miliseconds, 0, ( LPTIMECALLBACK ) AlarmCallback, 0, TIME_ONESHOT | TIME_CALLBACK_FUNCTION );
+ }
+ }
+ else {
+ if (alarmid) {
+ timeKillEvent(alarmid);
+ alarmid = 0;
+ }
+ }
+
+ return 0;
+}
diff --git a/win32/contrib/timer/timer.h b/win32/contrib/timer/timer.h
index 9be9d0557..cbb89bf97 100644
--- a/win32/contrib/timer/timer.h
+++ b/win32/contrib/timer/timer.h
@@ -1,39 +1,42 @@
-#include <time.h>
-#include <winsock.h>
-#include "pthread.h"
-
-#ifndef _ITIMER_
-#define _ITIMER_
-
-#define ITIMER_REAL 0
-#define ITIMER_VIRTUAL 1
-
-// time reference
-// ----------------------------------
-//
-// 1,000 milliseconds / sec
-// 1,000,000 microseconds / sec
-// 1,000,000,000 nanoseconds / sec
-//
-// timeval.time_sec = seconds
-// timeval.time_usec = microseconds
-
-struct itimerval
-{
- struct timeval it_interval; /* timer interval */
- struct timeval it_value; /* current value */
-};
-
-struct timezone {
- int tz_minuteswest; /* minutes west of Greenwich */
- int tz_dsttime; /* type of dst correction */
-};
-
-int gettimeofday( struct timeval *tp, struct timezone *tzp );
-int setitimer( int which, struct itimerval * value, struct itimerval *ovalue );
-int pause( void );
-
-unsigned int sleep( unsigned int seconds );
-int nanosleep( const struct timespec *rqtp, struct timespec *rmtp );
-
+#include <time.h>
+#include <winsock.h>
+#include "pthread.h"
+
+#ifndef _ITIMER_
+#define _ITIMER_
+
+#define ITIMER_REAL 0
+#define ITIMER_VIRTUAL 1
+
+// time reference
+// ----------------------------------
+//
+// 1,000 milliseconds / sec
+// 1,000,000 microseconds / sec
+// 1,000,000,000 nanoseconds / sec
+//
+// timeval.time_sec = seconds
+// timeval.time_usec = microseconds
+
+struct itimerval
+{
+ struct timeval it_interval; /* timer interval */
+ struct timeval it_value; /* current value */
+};
+
+struct timezone {
+ int tz_minuteswest; /* minutes west of Greenwich */
+ int tz_dsttime; /* type of dst correction */
+};
+
+int gettimeofday( struct timeval *tp, struct timezone *tzp );
+int setitimer( int which, struct itimerval * value, struct itimerval *ovalue );
+int pause( void );
+
+unsigned int sleep( unsigned int seconds );
+int nanosleep( const struct timespec *rqtp, struct timespec *rmtp );
+int alarm( int sec );
+
+
+
#endif \ No newline at end of file
diff --git a/win32/include/sys/socket.h b/win32/include/sys/socket.h
index 65f04ef64..6552cb5ee 100755
--- a/win32/include/sys/socket.h
+++ b/win32/include/sys/socket.h
@@ -25,8 +25,11 @@
#include <io.h> /* open, close, ... */
#include <winsock.h>
-#define SIGPIPE 3
-#define SIGALRM 13
+#define SIGPIPE 13
+
+#ifndef SIGALRM
+#define SIGALRM 14
+#endif
/* Some real good hacks! */
#undef errno
diff --git a/win32/libxinesupport.def b/win32/libxinesupport.def
index 12e50ab43..09e83398e 100644
--- a/win32/libxinesupport.def
+++ b/win32/libxinesupport.def
@@ -217,6 +217,7 @@ setitimer
pause
sleep
nanosleep
+alarm
;------------------------------------------------------------
; other exports
diff --git a/win32/xineplug_inp_cdda.plg b/win32/xineplug_inp_cdda.plg
deleted file mode 100755
index 39756f044..000000000
--- a/win32/xineplug_inp_cdda.plg
+++ /dev/null
@@ -1,40 +0,0 @@
-<html>
-<body>
-<pre>
-<h1>Build Log</h1>
-<h3>
---------------------Configuration: xineplug_inp_cdda - Win32 Debug--------------------
-</h3>
-<h3>Command Lines</h3>
-Creating temporary file "C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSP184.tmp" with contents
-[
-libdvdnav.lib /nologo /dll /incremental:yes /pdb:"Debug/xineplug_inp_cdda.pdb" /debug /machine:I386 /def:".\xineplug_inp.def" /out:"Debug/bin/plugins/xineplug_inp_cdda.so" /implib:"Debug/xineplug_inp_cdda.lib" /pdbtype:sept /libpath:"lib"
-".\Debug\media_helper.obj"
-".\Debug\input_cdda.obj"
-".\Debug\libxine\libxine.lib"
-".\Debug\libxinesuppt\libxinesuppt.lib"
-".\Debug\libxineutils\libxineutils.lib"
-]
-Creating command line "link.exe @C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSP184.tmp"
-<h3>Output Window</h3>
-Linking...
- Creating library Debug/xineplug_inp_cdda.lib and object Debug/xineplug_inp_cdda.exp
-input_cdda.obj : error LNK2001: unresolved external symbol _gethostbyname@4
-input_cdda.obj : error LNK2001: unresolved external symbol _WSAGetLastError@0
-input_cdda.obj : error LNK2001: unresolved external symbol _connect@12
-input_cdda.obj : error LNK2001: unresolved external symbol _htons@4
-input_cdda.obj : error LNK2001: unresolved external symbol _socket@12
-input_cdda.obj : error LNK2001: unresolved external symbol _select@20
-input_cdda.obj : error LNK2001: unresolved external symbol _recv@16
-input_cdda.obj : error LNK2001: unresolved external symbol _alarm
-input_cdda.obj : error LNK2001: unresolved external symbol _send@16
-Debug/bin/plugins/xineplug_inp_cdda.so : fatal error LNK1120: 9 unresolved externals
-Error executing link.exe.
-
-
-
-<h3>Results</h3>
-xineplug_inp_cdda.so - 10 error(s), 0 warning(s)
-</pre>
-</body>
-</html>