Index: stream/stream_livedotcom.c =================================================================== --- stream/stream_livedotcom.c (revision 23825) +++ 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 23825) +++ stream/cache2.c (working copy) @@ -16,12 +16,16 @@ #include #include "osdep/timer.h" -#ifndef WIN32 +#if !defined(WIN32) && !defined(__OS2__) #include #include "osdep/shmem.h" -#else +#elif defined(WIN32) #include static DWORD WINAPI ThreadProc(void* s); +#else // OS2 +#define INCL_DOS +#include +static void 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 +#if !defined(WIN32) && !defined(__OS2__) kill(s->cache_pid,SIGKILL); waitpid(s->cache_pid,NULL,0); #else +#ifdef WIN32 TerminateThread((HANDLE)s->cache_pid,0); +#else // OS2 + DosKillThread( s->cache_pid ); +#endif 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 23825) +++ 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 23825) +++ 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 23825) +++ 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 23825) +++ 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: libao2/audio_out.c =================================================================== --- libao2/audio_out.c (revision 23825) +++ libao2/audio_out.c (working copy) @@ -62,6 +62,9 @@ #ifdef HAVE_DIRECTX extern ao_functions_t audio_out_dsound; #endif +#ifdef HAVE_DART +extern ao_functions_t audio_out_dart; +#endif #ifdef HAVE_DXR2 extern ao_functions_t audio_out_dxr2; #endif @@ -81,6 +84,9 @@ #ifdef HAVE_WIN32WAVEOUT &audio_out_win32, #endif +#ifdef HAVE_DART + &audio_out_dart, +#endif #ifdef MACOSX &audio_out_macosx, #endif Index: libvo/video_out.c =================================================================== --- libvo/video_out.c (revision 23825) +++ libvo/video_out.c (working copy) @@ -97,6 +97,9 @@ #ifdef HAVE_DIRECTX extern vo_functions_t video_out_directx; #endif +#ifdef HAVE_KVA +extern vo_functions_t video_out_kva; +#endif #ifdef HAVE_DXR2 extern vo_functions_t video_out_dxr2; #endif @@ -151,6 +154,9 @@ #ifdef HAVE_DIRECTX &video_out_directx, #endif +#ifdef HAVE_KVA + &video_out_kva, +#endif #ifdef MACOSX #ifdef MACOSX_COREVIDEO &video_out_macosx, Index: configure =================================================================== --- configure (revision 23825) +++ configure (working copy) @@ -116,6 +116,7 @@ amigaos() { issystem "AmigaOS" ; return "$?" ; } win32() { cygwin || mingw32 ; return "$?" ; } beos() { issystem "BEOS" ; return "$?" ; } +os2() { issystem "OS/2" ; return "$?" ; } # arch test boolean functions # x86/x86pc is used by QNX @@ -341,6 +342,7 @@ --enable-vesa enable VESA video output [autodetect] --enable-svga enable SVGAlib video output [autodetect] --enable-sdl enable SDL video output [autodetect] + --enable-kva enable KVA (DIVE/WarpOverlay!) video output [autodetect] --enable-aa enable AAlib video output [autodetect] --enable-caca enable CACA video output [autodetect] --enable-ggi enable GGI video output [autodetect] @@ -383,6 +385,7 @@ --disable-nas disable NAS audio output [autodetect] --disable-sgiaudio disable SGI audio output [autodetect] --disable-sunaudio disable Sun audio output [autodetect] + --disable-dart disable DART audio output [autodetect] --disable-win32waveout disable Windows waveout audio output [autodetect] --disable-select disable using select() on the audio device [enable] @@ -468,6 +471,7 @@ _iwmmxt=auto _mtrr=auto _install=install +_ar=ar _ranlib=ranlib _ldconfig=ldconfig _cc=cc @@ -509,6 +513,8 @@ _xv=auto _xvmc=no #auto when complete _sdl=auto +_kva=auto +_dart=auto _directx=auto _win32waveout=auto _nas=auto @@ -793,6 +799,10 @@ --disable-xvmc) _xvmc=no ;; --enable-sdl) _sdl=yes ;; --disable-sdl) _sdl=no ;; + --enable-kva) _kva=yes ;; + --disable-kva) _kva=no ;; + --enable-dart) _dart=yes ;; + --disable-dart) _dart=no ;; --enable-directx) _directx=yes ;; --disable-directx) _directx=no ;; --enable-win32waveout) _win32waveout=yes ;; @@ -1162,7 +1172,7 @@ # OS name system_name=`uname -s 2>&1` case "$system_name" in - Linux|FreeBSD|NetBSD|BSD/OS|OpenBSD|SunOS|QNX|Darwin|GNU|BeOS|MorphOS|AIX|AmigaOS) + Linux|FreeBSD|NetBSD|BSD/OS|OpenBSD|SunOS|QNX|Darwin|GNU|BeOS|MorphOS|AIX|AmigaOS|OS/2) ;; IRIX*) system_name=IRIX @@ -1328,6 +1338,14 @@ _ld_extra="$_ld_extra -lph" fi +if os2 ; then + _exesuf=".exe" + _need_shmem=no + _ar="emxomfar -p256" + _ranlib="echo ignoring ranlib" + _ld_extra="$_ld_extra -Zomf -Zstack 16384" +fi + # Check how to call 'head' and 'tail'. Newer versions spit out warnings # if used as 'head -1' instead of 'head -n 1', but older versions don't # know about '-n'. @@ -2871,6 +2889,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 @@ -3355,8 +3390,11 @@ EOF _posix_select=no _def_posix_select='#undef HAVE_POSIX_SELECT' +#select() of kLIBC supports socket only +if not os2 ; then cc_check && _posix_select=yes \ && _def_posix_select='#define HAVE_POSIX_SELECT 1' +fi echores "$_posix_select" @@ -4659,7 +4697,56 @@ fi echores "$_sdl" +if os2; then +echocheck "KVA (DIVE/WarpOverlay!)" +if test "$_kva" = auto; then + cat > $TMPC << EOF +#include +#include +int main( void ) { return 0; } +EOF + _kva=no; + cc_check -lkva -lmmpm2 && _kva=yes +fi +if test "$_kva" = yes ; then + _def_kva='#define HAVE_KVA 1' + _libs_mplayer="$_libs_mplayer -lkva" + _vosrc="$_vosrc vo_kva.c" + _vomodules="kva $_vomodules" +else + _def_kva='#undef HAVE_KVA' + _novomodules="kva $_novomodules" +fi +echores "$_kva" +echocheck "DART" +if test "$_dart" = auto; then + cat > $TMPC << EOF +#include +#include +int main( void ) { return 0; } +EOF + _dart=no; + cc_check -ldart -lmmpm2 && _dart=yes +fi +if test "$_dart" = yes ; then + _def_dart='#define HAVE_DART 1' + _libs_mplayer="$_libs_mplayer -ldart" + _aosrc="$_aosrc ao_dart.c" + _aomodules="dart $_aomodules" +else + _def_dart='#undef HAVE_DART' + _noaomodules="dart $_noaomodules" +fi +echores "$_dart" + +if test "$_kva" = yes || test "$_dart" = yes ; then + _libs_mplayer="$_libs_mplayer -lmmpm2" +fi + +fi #if os2; then + + if win32; then echocheck "Windows waveout" @@ -5181,10 +5268,10 @@ echocheck "dvdread" if test "$_dvdread_internal" = auto ; then _dvdread_internal=no - if linux || freebsd || netbsd || darwin || openbsd || win32 || sunos || hpux && \ + if linux || freebsd || netbsd || darwin || openbsd || win32 || os2 || sunos || hpux && \ test "$_dvd" = yes || test "$_cdrom" = yes || test "$_cdio" = yes || \ test "$_dvdio" = yes || test "$_bsdi_dvd" = yes || \ - test "$_hpux_scsi_h" = yes || darwin || win32 ; then + test "$_hpux_scsi_h" = yes || darwin || win32 || os2 ; then _dvdread_internal=yes _dvdread=yes _res_comment="internal" @@ -5953,6 +6040,7 @@ if test -z "$_codecsdir" ; then _codecsdir="$_libdir/codecs" mingw32 && _codecsdir="codecs" + os2 && _codecsdir="codecs" fi @@ -7089,7 +7177,7 @@ # (FIXME: 'echocheck "dynamic linking"' above and modify here accordingly) _ld_dl_dynamic='' bsd && _ld_dl_dynamic='-rdynamic' -if test "$_real" = yes || test "$_xanim" = yes && not win32 && not qnx && not darwin ; then +if test "$_real" = yes || test "$_xanim" = yes && not win32 && not qnx && not darwin && not os2 ; then _ld_dl_dynamic='-rdynamic' fi @@ -7218,6 +7306,9 @@ if cygwin ; then CFLAGS="$CFLAGS -D__CYGWIN__ -DSYS_CYGWIN" fi +if os2 ; then + CFLAGS="$CFLAGS -Zomf -DSYS_OS2" +fi # 64 bit file offsets? if test "$_largefiles" = yes || freebsd ; then CFLAGS="$CFLAGS -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" @@ -7292,6 +7383,7 @@ LIBDIR = \$(DESTDIR)$_libdir # FFmpeg uses libdir instead of LIBDIR libdir = \$(LIBDIR) +AR = $_ar CC = $_cc CXX = $_cc HOST_CC = $_host_cc @@ -7955,7 +8047,7 @@ #elif defined(HPUX) #define DEFAULT_CDROM_DEVICE "/dev/cdrom" #define DEFAULT_DVD_DEVICE "/dev/dvd" -#elif defined(WIN32) +#elif defined(WIN32) || defined(__OS2__) #define DEFAULT_CDROM_DEVICE "D:" #define DEFAULT_DVD_DEVICE "D:" #elif defined(SYS_DARWIN) @@ -7993,6 +8085,9 @@ /* int_fastXY_t emulation */ $_def_fast_inttypes +/* socklen_t support */ +$_def_socklen_t + /* mkstemp support */ $_def_mkstemp @@ -8162,6 +8257,8 @@ $_def_sdl /* defined for SDLlib with keyrepeat bugs (before 1.2.1) */ $_def_sdlbuggy +$_def_kva +$_def_dart $_def_directx $_def_ggi $_def_ggiwmh Index: mplayer.c =================================================================== --- mplayer.c (revision 23825) +++ mplayer.c (working copy) @@ -10,6 +10,12 @@ #define _UWIN 1 /*disable Non-underscored versions of non-ANSI functions as otherwise int eof would conflict with eof()*/ #include #endif + +#ifdef __OS2__ +#define INCL_DOS +#include +#endif + #include #include @@ -2273,6 +2279,21 @@ return 0; } +#ifdef __OS2__ +extern int _fmode_bin; + + void MorphToPM() + { + PPIB pib; + PTIB tib; + + DosGetInfoBlocks(&tib, &pib); + + // Change flag from VIO to PM: + if (pib->pib_ultype==2) pib->pib_ultype = 3; + } +#endif + int main(int argc,char* argv[]){ @@ -2289,6 +2310,14 @@ int gui_no_filename=0; +#ifdef __OS2__ + _fmode_bin = 1; // to make binary mode default + + _envargs( &argc, &argv, "MPLAYER_OPTIONS" ); + + MorphToPM(); +#endif + srand((int) time(NULL)); InitTimer(); @@ -2593,8 +2622,10 @@ mp_input_init(use_gui); mp_input_add_key_fd(-1,0,mplayer_get_key,NULL); if(slave_mode) -#ifndef __MINGW32__ +#if !defined( __MINGW32__ ) && !defined( __OS2__ ) mp_input_add_cmd_fd(0,1,NULL,NULL); +#elif defined( __OS2__ ) + mp_input_add_cmd_fd(0,0,mp_input_os2_slave_cmd_func,NULL); #else mp_input_add_cmd_fd(0,0,mp_input_win32_slave_cmd_func,NULL); #endif Index: osdep/getch2.h =================================================================== --- osdep/getch2.h (revision 23825) +++ osdep/getch2.h (working copy) @@ -24,3 +24,7 @@ #ifdef __MINGW32__ extern int mp_input_win32_slave_cmd_func(int fd,char* dest,int size); #endif + +#ifdef __OS2__ +extern int mp_input_os2_slave_cmd_func(int fd,char* dest,int size); +#endif Index: osdep/Makefile =================================================================== --- osdep/Makefile (revision 23825) +++ osdep/Makefile (working copy) @@ -24,6 +24,9 @@ ifeq ($(TARGET_OS),MINGW32) getch = getch2-win.c endif +ifeq ($(TARGET_OS),OS/2) +getch = getch2-os2.c +endif SRCS_COMMON += $(timer) SRCS_COMMON += $(getch) Index: libmenu/menu_filesel.c =================================================================== --- libmenu/menu_filesel.c (revision 23825) +++ libmenu/menu_filesel.c (working copy) @@ -320,7 +320,7 @@ if(l <= 1) break; mpriv->dir[l-1] = '\0'; slash = strrchr(mpriv->dir,'/'); -#if defined(__MINGW32__) || defined(__CYGWIN__) +#if defined(__MINGW32__) || defined(__CYGWIN__) || defined(__OS2__) if (!slash) slash = strrchr(mpriv->dir,'\\'); #endif Index: subreader.c =================================================================== --- subreader.c (revision 23825) +++ subreader.c (working copy) @@ -1839,8 +1839,9 @@ subcnt = 0; tmp = strrchr(fname,'/'); -#ifdef WIN32 +#if defined(WIN32) || defined(__OS2__) if(!tmp)tmp = strrchr(fname,'\\'); + if(!tmp)tmp = strrchr(fname,':'); #endif // extract filename & dirname from fname