Index: stream/stream_livedotcom.c =================================================================== --- stream/stream_livedotcom.c (revision 24089) +++ stream/stream_livedotcom.c (working copy) @@ -61,7 +61,7 @@ if(strncmp("sdp://",filename,6) == 0) { filename += 6; -#if defined(__CYGWIN__) || defined(__MINGW32__) +#if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__OS2__) f = open(filename,O_RDONLY|O_BINARY); #else f = open(filename,O_RDONLY); Index: stream/cache2.c =================================================================== --- stream/cache2.c (revision 24089) +++ stream/cache2.c (working copy) @@ -16,12 +16,16 @@ #include #include "osdep/timer.h" -#ifndef WIN32 +#ifdef WIN32 +#include +static DWORD WINAPI ThreadProc(void* s); +#elif defined(__OS2__) +#define INCL_DOS +#include +static void ThreadProc( void *s ); +#else #include #include "osdep/shmem.h" -#else -#include -static DWORD WINAPI ThreadProc(void* s); #endif #include "mp_msg.h" @@ -189,7 +193,7 @@ cache_vars_t* cache_init(int size,int sector){ int num; -#ifndef WIN32 +#if !defined(WIN32) && !defined(__OS2__) cache_vars_t* s=shmem_alloc(sizeof(cache_vars_t)); #else cache_vars_t* s=malloc(sizeof(cache_vars_t)); @@ -203,14 +207,14 @@ }//32kb min_size s->buffer_size=num*sector; s->sector_size=sector; -#ifndef WIN32 +#if !defined(WIN32) && !defined(__OS2__) s->buffer=shmem_alloc(s->buffer_size); #else s->buffer=malloc(s->buffer_size); #endif if(s->buffer == NULL){ -#ifndef WIN32 +#if !defined(WIN32) && !defined(__OS2__) shmem_free(s,sizeof(cache_vars_t)); #else free(s); @@ -226,15 +230,19 @@ void cache_uninit(stream_t *s) { cache_vars_t* c = s->cache_data; if(!s->cache_pid) return; -#ifndef WIN32 +#ifdef WIN32 + TerminateThread((HANDLE)s->cache_pid,0); +#elif defined(__OS2__) + DosKillThread( s->cache_pid ); +#else kill(s->cache_pid,SIGKILL); waitpid(s->cache_pid,NULL,0); -#else - TerminateThread((HANDLE)s->cache_pid,0); +#endif +#if defined(WIN32) || defined(__OS2__) free(c->stream); #endif if(!c) return; -#ifndef WIN32 +#if !defined(WIN32) && !defined(__OS2__) shmem_free(c->buffer,c->buffer_size); shmem_free(s->cache_data,sizeof(cache_vars_t)); #else @@ -274,16 +282,22 @@ min = s->buffer_size - s->fill_limit; } -#ifndef WIN32 +#if !defined(WIN32) && !defined(__OS2__) if((stream->cache_pid=fork())){ #else { +#ifdef WIN32 DWORD threadId; +#endif stream_t* stream2=malloc(sizeof(stream_t)); memcpy(stream2,s->stream,sizeof(stream_t)); s->stream=stream2; +#ifdef WIN32 stream->cache_pid = CreateThread(NULL,0,ThreadProc,s,0,&threadId); +#else // OS2 + stream->cache_pid = _beginthread( ThreadProc, NULL, 256 * 1024, s ); #endif +#endif // wait until cache is filled at least prefill_init % mp_msg(MSGT_CACHE,MSGL_V,"CACHE_PRE_INIT: %"PRId64" [%"PRId64"] %"PRId64" pre:%d eof:%d \n", (int64_t)s->min_filepos,(int64_t)s->read_filepos,(int64_t)s->max_filepos,min,s->eof); @@ -300,10 +314,14 @@ return 1; // parent exits } +#if defined(WIN32) || defined(__OS2__) +} #ifdef WIN32 -} static DWORD WINAPI ThreadProc(void*s){ +#else // OS2 +static void ThreadProc( void *s ){ #endif +#endif // cache thread mainloop: signal(SIGTERM,exit_sighandler); // kill Index: stream/udp.c =================================================================== --- stream/udp.c (revision 24089) +++ stream/udp.c (working copy) @@ -43,6 +43,10 @@ #include "url.h" #include "udp.h" +#ifndef HAVE_SOCKLEN_T +typedef int socklen_t; +#endif + int reuse_socket=0; /* Start listening on a UDP port. If multicast, join the group. */ Index: stream/stream_file.c =================================================================== --- stream/stream_file.c (revision 24089) +++ stream/stream_file.c (working copy) @@ -113,7 +113,7 @@ return STREAM_ERROR; } -#if defined(__CYGWIN__)|| defined(__MINGW32__) +#if defined(__CYGWIN__)|| defined(__MINGW32__) || defined(__OS2__) m |= O_BINARY; #endif @@ -122,13 +122,13 @@ // read from stdin mp_msg(MSGT_OPEN,MSGL_INFO,MSGTR_ReadSTDIN); f=0; // 0=stdin -#ifdef __MINGW32__ +#if defined(__MINGW32__) || defined(__OS2__) setmode(fileno(stdin),O_BINARY); #endif } else { mp_msg(MSGT_OPEN,MSGL_INFO,"Writing to stdout\n"); f=1; -#ifdef __MINGW32__ +#if defined(__MINGW32__) || defined(__OS2__) setmode(fileno(stdout),O_BINARY); #endif } Index: stream/tcp.c =================================================================== --- stream/tcp.c (revision 24089) +++ stream/tcp.c (working copy) @@ -34,6 +34,10 @@ #include "tcp.h" +#ifndef HAVE_SOCKLEN_T +typedef int socklen_t; +#endif + /* IPv6 options */ int network_prefer_ipv4 = 0; Index: stream/librtsp/rtsp_rtp.c =================================================================== --- stream/librtsp/rtsp_rtp.c (revision 24089) +++ stream/librtsp/rtsp_rtp.c (working copy) @@ -45,6 +45,10 @@ #include "../freesdp/common.h" #include "../freesdp/parser.h" +#ifndef HAVE_SOCKLEN_T +typedef int socklen_t; +#endif + #define RTSP_DEFAULT_PORT 31336 #define MAX_LENGTH 256 Index: configure =================================================================== --- configure (revision 24089) +++ configure (working copy) @@ -2918,6 +2939,23 @@ echores "$_fast_inttypes" +echocheck "socklen_t in sys/socket.h" +cat > $TMPC << EOF +#include +int main(void) { +socklen_t v = 0; +return v; } +EOF +_socklen_t=no +cc_check && _socklen_t=yes +if test "$_socklen_t" = yes ; then + _def_socklen_t='#define HAVE_SOCKLEN_T 1' +else + _def_socklen_t='#undef HAVE_SOCKLEN_T' +fi +echores "$_socklen_t" + + echocheck "word size" _mp_wordsize="#undef MP_WORDSIZE" cat > $TMPC << EOF @@ -8216,6 +8302,9 @@ /* C99 lrintf function available */ $_def_lrintf +/* socklen_t support */ +$_def_socklen_t + /* mkstemp support */ $_def_mkstemp