[PATCH] Refreshed OS/2 Patches
Hi/2. I've attach refreshed OS/2 patches expecting to accept. -- KO Myung-Hun Using Mozilla SeaMonkey 1.1.2 Under OS/2 Warp 4 for Korean with FixPak #15 On AMD ThunderBird 750 MHz with 512 MB RAM Korean OS/2 User Community : http://www.ecomstation.co.kr Index: stream/stream_livedotcom.c =================================================================== --- stream/stream_livedotcom.c (revision 23794) +++ 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 23794) +++ stream/cache2.c (working copy) @@ -16,12 +16,16 @@ #include <unistd.h> #include "osdep/timer.h" -#ifndef WIN32 +#if !defined(WIN32) && !defined(__OS2__) #include <sys/wait.h> #include "osdep/shmem.h" -#else +#elif defined(WIN32) #include <windows.h> static DWORD WINAPI ThreadProc(void* s); +#else // OS2 +#define INCL_DOS +#include <os2.h> +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,12 +314,17 @@ 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 while(1){ if(!cache_fill((cache_vars_t*)s)){ Index: stream/udp.c =================================================================== --- stream/udp.c (revision 23794) +++ stream/udp.c (working copy) @@ -43,6 +43,10 @@ #include "url.h" #include "udp.h" +#ifdef __OS2__ +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 23794) +++ 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 23794) +++ stream/tcp.c (working copy) @@ -34,6 +34,10 @@ #include "tcp.h" +#ifdef __OS2__ +typedef int socklen_t; +#endif + /* IPv6 options */ int network_prefer_ipv4 = 0; Index: stream/librtsp/rtsp_rtp.c =================================================================== --- stream/librtsp/rtsp_rtp.c (revision 23794) +++ stream/librtsp/rtsp_rtp.c (working copy) @@ -45,6 +45,10 @@ #include "../freesdp/common.h" #include "../freesdp/parser.h" +#ifdef __OS2__ +typedef int socklen_t; +#endif + #define RTSP_DEFAULT_PORT 31336 #define MAX_LENGTH 256 Index: libao2/ao_dart.c =================================================================== --- libao2/ao_dart.c (revision 0) +++ libao2/ao_dart.c (revision 0) @@ -0,0 +1,267 @@ +/* + * ao_dart.c - libao2 DART Audio Output Driver for MPlayer + * + * Copyright (c) 2007 by KO Myung-Hun (komh@chollian.net) + * + * This program 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. + * + * This program 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Changes : + * KO Myung-Hun <komh@chollian.net> 2007/07/08 + * - Call fast_memcpy instead of memcpy() + */ + +#define INCL_DOS +#include <os2.h> + +#include <stdio.h> +#include <stdlib.h> +#include <sys/time.h> + +#include "config.h" +#include "libaf/af_format.h" +#include "audio_out.h" +#include "audio_out_internal.h" +#include "mp_msg.h" +#include "libvo/fastmemcpy.h" +#include "subopt-helper.h" + +#include "dart.h" + +static ao_info_t info = +{ + "DART audio output", + "dart", + "KO Myung-Hun <komh@chollian.net>", + "" +}; + +LIBAO_EXTERN( dart ) + +#define OUTBURST_SAMPLES 512 +#define DART_SAMPLES ( OUTBURST_SAMPLES << 2 ) +#define MPLAYER_SAMPLES ( OUTBURST_SAMPLES << 4 ) + +static uint8_t *m_audioBuf = NULL; +static volatile int m_nBufSize = 0; +static volatile int m_nBufLen = 0; +static volatile int m_iBufPos = 0; + +static ULONG APIENTRY dart_audio_callback( PVOID pBuffer, ULONG ulSize ) +{ + int nCopySize; + + nCopySize = ulSize < m_nBufLen ? ulSize : m_nBufLen; + + if( m_iBufPos + nCopySize > m_nBufSize ) + { + int len = m_nBufSize - m_iBufPos; + + fast_memcpy( pBuffer, m_audioBuf + m_iBufPos, len ); + fast_memcpy(( uint8_t * )pBuffer + len, m_audioBuf, nCopySize - len ); + } + else + fast_memcpy( pBuffer, m_audioBuf + m_iBufPos, nCopySize ); + + m_iBufPos = ( m_iBufPos + nCopySize ) % m_nBufSize; + m_nBufLen -= nCopySize; + + memset(( uint8_t * )pBuffer + nCopySize, DART.bSilence, ulSize - nCopySize ); + + return ulSize; +} + +// to set/get/query special features/parameters +static int control( int cmd, void *arg ) +{ + switch (cmd) + { + case AOCONTROL_GET_VOLUME : + { + ao_control_vol_t *vol = ( ao_control_vol_t * )arg; + + vol->left = vol->right = LOUSHORT( dartGetVolume()); + + return CONTROL_OK; + } + + case AOCONTROL_SET_VOLUME: + { + int mid; + ao_control_vol_t *vol = ( ao_control_vol_t * )arg; + + mid = ( vol->left + vol->right ) / 2; + dartSetVolume( MCI_SET_AUDIO_ALL, mid ); + + return CONTROL_OK; + } + } + + return CONTROL_UNKNOWN; +} + +static void print_help( void ) +{ + mp_msg( MSGT_AO, MSGL_FATAL, + "\n-ao dart commandline help:\n" + "Example: mplayer -ao kva:noshare\n" + " open DART as exclusive mode\n" + "\nOptions:\n" + " noshare\n" + " Open DART as exclusive mode\n"); +} + +// open & setup audio device +// return: 1=success 0=fail +static int init( int rate, int channels, int format, int flags ) +{ + BOOL fNoShare = FALSE; + int n; + + opt_t subopts[] = { + {"noshare", OPT_ARG_BOOL, &fNoShare, NULL }, + { NULL } + }; + + if( subopt_parse( ao_subdevice, subopts ) != 0 ) + { + print_help(); + return 0; + } + + mp_msg( MSGT_AO, MSGL_V, "DART : opened as %s mode\n", fNoShare ? "exclusive" : "shareable"); + + switch( format ) + { + case AF_FORMAT_S16_LE: + case AF_FORMAT_S8: + break; + + default : + format = AF_FORMAT_S16_LE; + mp_msg( MSGT_AO, MSGL_V, "DART: format %s not supported defaulting to Signed 16-bit Little-Endian\n", af_fmt2str_short( format )); + break; + } + + n = ( af_fmt2bits( format ) >> 3 ) * channels; + + m_nBufSize = n * MPLAYER_SAMPLES; + + if( dartInit( 0, af_fmt2bits( format ), rate, MCI_WAVE_FORMAT_PCM, channels, + 2, n * DART_SAMPLES, !fNoShare, dart_audio_callback )) + return 0; + + ao_data.channels = channels; + ao_data.samplerate = rate; + ao_data.format = format; + ao_data.bps = channels * rate * ( af_fmt2bits( format ) >> 3 ); + ao_data.outburst = n * OUTBURST_SAMPLES; + ao_data.buffersize = m_nBufSize; + + m_audioBuf = malloc( m_nBufSize ); + + m_nBufLen = 0; + m_iBufPos = 0; + + dartPlay(); + + return 1; +} + +// close audio device +static void uninit( int immed ) +{ + if( !immed ) + { + while( m_nBufLen ) + DosSleep( 1 ); + } + + dartClose(); + + free( m_audioBuf ); +} + +// stop playing and empty buffers (for seeking/pause) +static void reset( void ) +{ + dartPause(); + + // empty buffers + m_nBufLen = 0; + + dartResume(); +} + +// stop playing, keep buffers (for pause) +static void audio_pause( void ) +{ + dartPause(); +} + +// resume playing, after audio_pause() +static void audio_resume( void ) +{ + dartResume(); +} + +// return: how many bytes can be played without blocking +static int get_space( void ) +{ + return ( m_nBufSize - m_nBufLen ); +} + +// plays 'len' bytes of 'data' +// it should round it down to outburst*n +// return: number of bytes played +static int play( void *data, int len, int flags) +{ + int start_pos, end_pos; + + if( !( flags & AOPLAY_FINAL_CHUNK )) + len = ( len / ao_data.outburst ) * ao_data.outburst; + + if( len == 0 ) + return 0; + + start_pos = ( m_iBufPos + m_nBufLen ) % m_nBufSize; + + end_pos = ( start_pos + len ) % m_nBufSize; + if( end_pos <= start_pos ) + { + int len1 = m_nBufSize - start_pos; + + if( end_pos > m_iBufPos ) + end_pos = m_iBufPos; + + fast_memcpy( m_audioBuf + start_pos, data, len1 ); + fast_memcpy( m_audioBuf, ( uint8_t * )data + len1, end_pos ); + + len = len1 + end_pos; + } + else + fast_memcpy( m_audioBuf + start_pos, data, len ); + + m_nBufLen += len; + + return len; +} + +// return: delay in seconds between first and last sample in buffer +static float get_delay( void ) +{ + return ( float )m_nBufLen / ( float )ao_data.bps; +} + + Index: libao2/audio_out.c =================================================================== --- libao2/audio_out.c (revision 23794) +++ 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: dvdread/dvd_reader.c =================================================================== --- dvdread/dvd_reader.c (revision 23794) +++ dvdread/dvd_reader.c (working copy) @@ -460,7 +460,7 @@ } fclose( mntfile ); } -#elif defined(__MINGW32__) +#elif defined(__MINGW32__) || defined( __OS2__ ) dev_name = strdup(path); auth_drive = DVDOpenImageFile( path, have_css ); #endif Index: libvo/video_out.c =================================================================== --- libvo/video_out.c (revision 23794) +++ 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: libvo/vo_kva.c =================================================================== --- libvo/vo_kva.c (revision 0) +++ libvo/vo_kva.c (revision 0) @@ -0,0 +1,889 @@ +/* + * vo_kva.c + * + * Copyright (c) 2007 by KO Myung-Hun (komh@chollian.net) + * + * This program 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. + * + * This program 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Changes : + * KO Myung-Hun <komh@chollian.net> 2007/06/11 + * - Added workaround for T23 laptop with S3 Video + * + * KO Myung-Hun <komh@chollian.net> 2007/06/17 + * - Implemented VOCTRL_SET_EQUALIZER and VOCTRL_GET_EQUALIZER + * - Added YV12 as a supported image format + * - Added process VK_ENTER and VK_NEWLINE + * + * KO Myung-Hun <komh@chollian.net> 2007/07/08 + * - Call fast_memcpy() instead of memcpy() + * + */ + +#define INCL_WIN +#include <os2.h> + +#include <fourcc.h> + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <errno.h> + +#include "config.h" +#include "mp_msg.h" +#include "help_mp.h" +#include "video_out.h" +#include "video_out_internal.h" + +#include "fastmemcpy.h" +#include "osdep/keycodes.h" +#include "input/input.h" +#include "input/mouse.h" +#include "subopt-helper.h" +#include "sub.h" + +#include "cpudetect.h" +#include "libswscale/swscale.h" +#include "libmpcodecs/vf_scale.h" + +#include "kva.h" + +static vo_info_t info = +{ + "DIVE/WarpOverlay! video output", + "kva", + "KO Myung-Hun <komh@chollian.net>", + "" +}; + +LIBVO_EXTERN( kva ) + +#define WC_MPLAYER "WC_MPLAYER" +#define COLOR_OVERLAY 0x000008 + +#define SRC_WIDTH m_int.kvas.szlSrcSize.cx +#define SRC_HEIGHT m_int.kvas.szlSrcSize.cy + +#define SCREEN_WIDTH m_int.kvac.cxScreen +#define SCREEN_HEIGHT m_int.kvac.cyScreen + +typedef struct tagVOKVAINTERNAL +{ + HAB hab; + HMQ hmq; + HWND hwndFrame; + HWND hwndClient; + HWND hwndSysMenu; + HWND hwndTitleBar; + HWND hwndMinMax; + BOOL fFullScreen; + FOURCC fcc; + INT iImageFormat; + KVASETUP kvas; + KVACAPS kvac; + RECTL rclDst; + INT bpp; + LONG lStride; + PBYTE pbImage; + BOOL fFixT23; + PFNWP pfnwpOldFrame; + uint8_t *yv12Planes[ 3 ]; // use as YUV420P format unlike name + int yv12Stride[ 3 ]; + struct SwsContext *sws; +} VOKVAINTERNAL, *PVOKVAINTERNAL; + +static VOKVAINTERNAL m_int; + +extern void mplayer_put_key( int code ); // let mplayer handel the keyevents + +static PBYTE imgCreate( VOID ) +{ + int size; + + size = SRC_HEIGHT * m_int.lStride; + + if( m_int.iImageFormat == IMGFMT_YV12 ) + size += size / 2; + + return malloc( size ); +} + +static VOID imgFree( PBYTE pbImage ) +{ + if( pbImage ) + free( pbImage ); +} + +static VOID imgDisplay( PBYTE pbImage ) +{ + PVOID pBuffer; + ULONG ulBPL; + + if( !kvaLockBuffer( &pBuffer, &ulBPL )) + { + if( m_int.iImageFormat == IMGFMT_YV12 ) + { + sws_scale( m_int.sws, m_int.yv12Planes, m_int.yv12Stride, 0, SRC_HEIGHT, + &pBuffer, &ulBPL ); + + if( gCpuCaps.hasMMX ) + asm volatile ("emms\n\t"); + } + else + fast_memcpy( pBuffer, pbImage, SRC_HEIGHT * ulBPL ); + + kvaUnlockBuffer(); + } +} + +#define MRETURN( ret ) return ( MRESULT )( ret ) + +static MRESULT EXPENTRY NewFrameWndProc( HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2 ) +{ + switch( msg ) + { + case WM_QUERYTRACKINFO : + { + //USHORT ustflags = SHORT1FROMMP( mp1 ); + PTRACKINFO pti = ( PTRACKINFO )mp2; + RECTL rcl; + + if( m_int.fFullScreen ) + break; + + m_int.pfnwpOldFrame( hwnd, msg, mp1, mp2 ); + + //if( ustflags & ( TF_LEFT | TF_RIGHT | TF_TOP | TF_BOTTOM | TF_SETPOINTERPOS )) + { + #if 0 + pti->rclBoundary.xLeft = 0; + pti->rclBoundary.yBottom = 0; + pti->rclBoundary.xRight = SCREEN_WIDTH; + pti->rclBoundary.yTop = SCREEN_HEIGHT; + #endif + + rcl.xLeft = 0; + rcl.yBottom = 0; + rcl.xRight = SRC_WIDTH + 1 ; + rcl.yTop = SRC_HEIGHT + 1; + + WinCalcFrameRect( hwnd, &rcl, FALSE ); + + pti->ptlMinTrackSize.x = rcl.xRight - rcl.xLeft; + pti->ptlMinTrackSize.y = rcl.yTop - rcl.yBottom; + + pti->ptlMaxTrackSize.x = SCREEN_WIDTH; + pti->ptlMaxTrackSize.y = SCREEN_HEIGHT; + } + + MRETURN( TRUE ); + } + + case WM_ADJUSTWINDOWPOS : + { + PSWP pswp = ( PSWP )mp1; + RECTL rcl; + + if( m_int.fFullScreen ) + break; + + if( pswp->fl & SWP_SIZE ) + { + rcl.xLeft = pswp->x; + rcl.yBottom = pswp->y; + rcl.xRight = rcl.xLeft + pswp->cx; + rcl.yTop = rcl.yBottom + pswp->cy; + + WinCalcFrameRect( hwnd, &rcl, TRUE ); + + if( rcl.xRight - rcl.xLeft <= SRC_WIDTH ) + rcl.xRight = rcl.xLeft + ( SRC_WIDTH + 1 ); + + if( rcl.yTop - rcl.yBottom <= SRC_HEIGHT ) + rcl.yTop = rcl.yBottom + ( SRC_HEIGHT + 1 ); + + WinCalcFrameRect( hwnd, &rcl, FALSE ); + + if( rcl.xRight - rcl.xLeft > SCREEN_WIDTH ) + { + rcl.xLeft = 0; + rcl.xRight = SCREEN_WIDTH; + } + + if( rcl.yTop - rcl.yBottom > SCREEN_HEIGHT ) + { + rcl.yBottom = 0; + rcl.yTop = SCREEN_HEIGHT; + } + + pswp->fl |= SWP_MOVE; + pswp->x = rcl.xLeft; + pswp->y = rcl.yBottom; + + pswp->cx = rcl.xRight - rcl.xLeft; + pswp->cy = rcl.yTop - rcl.yBottom; + } + + break; + } + } + + MRETURN( m_int.pfnwpOldFrame( hwnd, msg, mp1, mp2 )); +} + +static MRESULT EXPENTRY WndProc( HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2 ) +{ + switch( msg ) + { + case WM_CLOSE : + mplayer_put_key( KEY_CLOSE_WIN ); + + MRETURN( 0 ); + + case WM_CHAR : + { + USHORT fsFlags = SHORT1FROMMP( mp1 ); + USHORT usCh = SHORT1FROMMP( mp2 ); + USHORT usVk = SHORT2FROMMP( mp2 ); + + if( fsFlags & KC_KEYUP ) + break; + + if( fsFlags & KC_VIRTUALKEY ) + { + switch( usVk ) + { + case VK_LEFT : + mplayer_put_key( KEY_LEFT ); + break; + + case VK_UP : + mplayer_put_key( KEY_UP ); + break; + + case VK_RIGHT : + mplayer_put_key( KEY_RIGHT ); + break; + + case VK_DOWN : + mplayer_put_key( KEY_DOWN ); + break; + + case VK_TAB : + mplayer_put_key( KEY_TAB ); + break; + + case VK_BACKSPACE : + mplayer_put_key( KEY_BS ); + break; + + case VK_DELETE : + mplayer_put_key( KEY_DELETE ); + break; + + case VK_INSERT : + mplayer_put_key( KEY_INSERT ); + break; + + case VK_HOME : + mplayer_put_key( KEY_HOME ); + break; + + case VK_END : + mplayer_put_key( KEY_END ); + break; + + case VK_PAGEUP : + mplayer_put_key( KEY_PAGE_UP ); + break; + + case VK_PAGEDOWN : + mplayer_put_key( KEY_PAGE_DOWN ); + break; + + case VK_ESC : + mplayer_put_key( KEY_ESC ); + break; + + case VK_SPACE : + mplayer_put_key(' '); + break; + + //case VK_ENTER : + case VK_NEWLINE : + mplayer_put_key( KEY_ENTER ); + break; + } + } + else if(( fsFlags & KC_CHAR ) && !HIBYTE( usCh )) + mplayer_put_key( usCh ); + + MRETURN( TRUE ); + } + + case WM_BUTTON1DOWN : + if( WinQueryFocus( HWND_DESKTOP ) != hwnd ) + { + WinSetFocus( HWND_DESKTOP, hwnd ); + MRETURN( TRUE ); + } + + if( !vo_nomouse_input ) + mplayer_put_key( MOUSE_BTN0 ); + + MRETURN( TRUE ); + + case WM_BUTTON3DOWN : + if( WinQueryFocus( HWND_DESKTOP ) != hwnd ) + { + WinSetFocus( HWND_DESKTOP, hwnd ); + MRETURN( TRUE ); + } + + if( !vo_nomouse_input ) + mplayer_put_key( MOUSE_BTN1 ); + + MRETURN( TRUE ); + + case WM_BUTTON2DOWN : + if( WinQueryFocus( HWND_DESKTOP ) != hwnd ) + { + WinSetFocus( HWND_DESKTOP, hwnd ); + MRETURN( TRUE ); + } + + if( !vo_nomouse_input ) + mplayer_put_key( MOUSE_BTN2 ); + + MRETURN( TRUE ); + + case WM_BUTTON1DBLCLK : + if( !vo_nomouse_input ) + mplayer_put_key( MOUSE_BTN0_DBL ); + + MRETURN( TRUE ); + + case WM_BUTTON3DBLCLK : + if( !vo_nomouse_input ) + mplayer_put_key( MOUSE_BTN1_DBL ); + + MRETURN( TRUE ); + + case WM_BUTTON2DBLCLK : + if( !vo_nomouse_input) + mplayer_put_key( MOUSE_BTN2_DBL ); + + MRETURN( TRUE ); + } + + MRETURN( WinDefWindowProc( hwnd, msg, mp1, mp2 )); +} + +static int preinit( const char *arg ) +{ + ULONG flFrameFlags; + + BOOL fUseDive = FALSE; + BOOL fFixT23 = FALSE; + + opt_t subopts[] = { + {"dive", OPT_ARG_BOOL, &fUseDive, NULL, 0 }, + {"t23", OPT_ARG_BOOL, &fFixT23, NULL, 0 }, + { NULL, 0, NULL, NULL, 0 } + }; + + if( subopt_parse( arg, subopts ) != 0 ) + return -1; + + memset( &m_int, 0, sizeof( VOKVAINTERNAL )); + + m_int.hab = WinInitialize( 0 ); + m_int.hmq = WinCreateMsgQueue( m_int.hab, 0); + + WinRegisterClass( + m_int.hab, + WC_MPLAYER, + WndProc, + CS_SIZEREDRAW | CS_MOVENOTIFY, + sizeof( PVOID ) + ); + + flFrameFlags = FCF_SYSMENU | FCF_TITLEBAR | FCF_MINMAX | FCF_SIZEBORDER | + FCF_TASKLIST; + + m_int.hwndFrame = + WinCreateStdWindow( + HWND_DESKTOP, // parent window handle + WS_VISIBLE, // frame window style + &flFrameFlags, // window style + WC_MPLAYER, // class name + "", // window title + 0L, // default client style + NULLHANDLE, // resource in exe file + 1, // frame window id + &m_int.hwndClient // client window handle + ); + + if( m_int.hwndFrame == NULLHANDLE ) + return -1; + + m_int.hwndSysMenu = WinWindowFromID( m_int.hwndFrame, FID_SYSMENU ); + m_int.hwndTitleBar = WinWindowFromID( m_int.hwndFrame, FID_TITLEBAR ); + m_int.hwndMinMax = WinWindowFromID( m_int.hwndFrame, FID_MINMAX ); + + m_int.fFullScreen = FALSE; + + m_int.fFixT23 = fFixT23; + + if( m_int.fFixT23 ) + m_int.pfnwpOldFrame = WinSubclassWindow( m_int.hwndFrame, NewFrameWndProc ); + + if( kvaInit( fUseDive, m_int.hwndClient, COLOR_OVERLAY )) + return -1; + + kvaCaps( &m_int.kvac ); + + switch( m_int.kvac.ulMode ) + { + case KVAM_WO : + m_int.fcc = FOURCC_Y422; + m_int.iImageFormat = IMGFMT_YUY2; + m_int.bpp = 2; + break; + + case KVAM_DIVE : + default : + switch( m_int.kvac.fccScreen ) + { + case FOURCC_BGR4 : + case FOURCC_BGR3 : + case FOURCC_LUT8 : // maybe best T.T + m_int.fcc = FOURCC_BGR3; + m_int.iImageFormat = IMGFMT_BGR24; + m_int.bpp = 3; + break; + + case FOURCC_R565 : + m_int.fcc = FOURCC_R565; + m_int.iImageFormat = IMGFMT_BGR16; + m_int.bpp = 2; + break; + + case FOURCC_R555 : + m_int.fcc = FOURCC_R555; + m_int.iImageFormat = IMGFMT_BGR15; + m_int.bpp = 2; + break; + } + break; + } + + return 0; +} + +static void uninit( void ) +{ + if( m_int.pbImage ) + imgFree( m_int.pbImage ); + + if( m_int.sws ) + sws_freeContext( m_int.sws ); + + if( m_int.hwndFrame != NULLHANDLE ) + { + if( m_int.fFixT23 ) + WinSubclassWindow( m_int.hwndFrame, m_int.pfnwpOldFrame ); + + kvaResetAttr(); + kvaDone(); + WinDestroyWindow( m_int.hwndFrame ); + } + + WinDestroyMsgQueue( m_int.hmq ); + WinTerminate( m_int.hab ); +} + +static int config( uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t flags, char *title, uint32_t format ) +{ + RECTL rcl; + + if( format != m_int.iImageFormat ) + { + mp_msg( MSGT_VO, MSGL_ERR, "KVA : Unsupported image format 0x%X(%s)\n", format, vo_format_name(format)); + return -1; + } + + if( mp_msg_test( MSGT_VO, MSGL_V )) + mp_msg( MSGT_VO, MSGL_V, "KVA: Using 0x%X (%s) image format\n", format, vo_format_name(format)); + + if( m_int.pbImage ) + imgFree( m_int.pbImage ); + + m_int.kvas.ulLength = sizeof( KVASETUP ); + m_int.kvas.szlSrcSize.cx = width; + m_int.kvas.szlSrcSize.cy = height; + m_int.kvas.rclSrcRect.xLeft = 0; + m_int.kvas.rclSrcRect.yTop = 0; + m_int.kvas.rclSrcRect.xRight = width; + m_int.kvas.rclSrcRect.yBottom = height; + m_int.kvas.ulRatio = KVAR_ORIGINAL; + m_int.kvas.fccSrcColor = m_int.fcc; + + kvaSetup( &m_int.kvas ); + + m_int.lStride = width * m_int.bpp; + + m_int.pbImage = imgCreate(); + + if( m_int.iImageFormat == IMGFMT_YV12 ) + { + int dstFormat; + + if( m_int.sws ) + sws_freeContext( m_int.sws ); + + m_int.yv12Planes[ 0 ] = m_int.pbImage; + m_int.yv12Planes[ 1 ] = m_int.yv12Planes[ 0 ] + ( m_int.lStride * height ); + m_int.yv12Planes[ 2 ] = m_int.yv12Planes[ 1 ] + ( m_int.lStride * height ) / 4; + + m_int.yv12Stride[ 0 ] = m_int.lStride; + m_int.yv12Stride[ 1 ] = m_int.lStride / 2; + m_int.yv12Stride[ 2 ] = m_int.lStride / 2; + + switch( m_int.fcc ) + { + case FOURCC_Y422 : + dstFormat = PIX_FMT_YUYV422; + break; + + case FOURCC_BGR3 : + dstFormat = PIX_FMT_BGR24; + break; + + case FOURCC_R565 : + dstFormat = PIX_FMT_BGR565; + break; + + case FOURCC_R555 : + dstFormat = PIX_FMT_BGR555; + break; + } + + m_int.sws = sws_getContext( width, height, PIX_FMT_YUV420P, + width, height, dstFormat, + SWS_FAST_BILINEAR | SWS_PRINT_INFO | get_sws_cpuflags(), + NULL, NULL, NULL ); + } + + WinSetWindowText( m_int.hwndFrame, title ); + + if( !d_width ) + d_width = width; + + if( !d_height ) + d_height = height; + + m_int.fFullScreen = flags & VOFLAG_FULLSCREEN; + + // workaround for T23 laptop with S3 Video by Franz Bakan + if( !m_int.fFullScreen && m_int.fFixT23 ) + { + d_width++; + d_height++; + } + + m_int.rclDst.xLeft = (( LONG )SCREEN_WIDTH - ( LONG )d_width ) / 2; + m_int.rclDst.yBottom = (( LONG )SCREEN_HEIGHT - ( LONG )d_height ) /2 ; + m_int.rclDst.xRight = m_int.rclDst.xLeft + d_width; + m_int.rclDst.yTop = m_int.rclDst.yBottom + d_height; + + if( m_int.fFullScreen ) + { + d_width = SCREEN_WIDTH; + d_height = SCREEN_HEIGHT; + + // when -fs option is used without this, title bar is not highlighted + WinSetActiveWindow( HWND_DESKTOP, m_int.hwndFrame ); + + WinSetParent( m_int.hwndSysMenu, HWND_OBJECT, FALSE ); + WinSetParent( m_int.hwndTitleBar, HWND_OBJECT, FALSE ); + WinSetParent( m_int.hwndMinMax, HWND_OBJECT, FALSE ); + } + + rcl.xLeft = (( LONG )SCREEN_WIDTH - ( LONG )d_width ) / 2; + rcl.yBottom = (( LONG )SCREEN_HEIGHT - ( LONG )d_height ) /2 ; + rcl.xRight = rcl.xLeft + d_width; + rcl.yTop = rcl.yBottom + d_height; + + WinCalcFrameRect( m_int.hwndFrame, &rcl, FALSE ); + + WinSetWindowPos( m_int.hwndFrame, HWND_TOP, + rcl.xLeft, rcl.yBottom, + rcl.xRight - rcl.xLeft, rcl.yTop - rcl.yBottom, + SWP_SIZE | SWP_MOVE | SWP_ZORDER | SWP_SHOW | SWP_ACTIVATE ); + + return 0; +} + +static uint32_t get_image( mp_image_t *mpi ) +{ + if( mpi->imgfmt != m_int.iImageFormat ) + return VO_FALSE; + + if( m_int.iImageFormat == IMGFMT_YV12 ) + { + mpi->planes[ 1 ] = m_int.yv12Planes[ 1 ]; + mpi->planes[ 2 ] = m_int.yv12Planes[ 2 ]; + + mpi->stride[ 1 ] = m_int.yv12Stride[ 1 ]; + mpi->stride[ 2 ] = m_int.yv12Stride[ 2 ]; + } + + mpi->planes[0] = m_int.pbImage; + mpi->stride[0] = m_int.lStride; + mpi->flags |= MP_IMGFLAG_DIRECT; + + return VO_TRUE; +} + +static int query_format( uint32_t format ) +{ + int res = 0; + + // here, modify image format and bpp in case of YV12 + if( format == IMGFMT_YV12 ) + { + m_int.iImageFormat = IMGFMT_YV12; + m_int.bpp = 1; + } + + if( format == m_int.iImageFormat ) + { + res = VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW | VFCAP_OSD | + VFCAP_HWSCALE_UP; + + if( !m_int.fFixT23 ) + res |= VFCAP_HWSCALE_DOWN; + } + + return res; +} + +static uint32_t color_ctrl_set( char *what, int value ) +{ + ULONG ulAttr; + ULONG ulValue; + + if( !strcmp( what, "brightness")) + ulAttr = KVAA_BRIGHTNESS; + else if( !strcmp( what, "contrast")) + ulAttr = KVAA_CONTRAST; + else if( !strcmp( what, "hue")) + ulAttr = KVAA_HUE; + else if( !strcmp( what, "saturation")) + ulAttr = KVAA_SATURATION; + else + return VO_NOTIMPL; + + ulValue = ( value + 100 ) * 255 / 200; + + if( kvaSetAttr( ulAttr, &ulValue )) + return VO_NOTIMPL; + + return VO_TRUE; +} + +static uint32_t color_ctrl_get( char *what, int *value ) +{ + ULONG ulAttr; + ULONG ulValue; + + if( !strcmp( what, "brightness")) + ulAttr = KVAA_BRIGHTNESS; + else if( !strcmp( what, "contrast")) + ulAttr = KVAA_CONTRAST; + else if( !strcmp( what, "hue")) + ulAttr = KVAA_HUE; + else if( !strcmp( what, "saturation")) + ulAttr = KVAA_SATURATION; + else + return VO_NOTIMPL; + + if( kvaQueryAttr( ulAttr, &ulValue )) + return VO_NOTIMPL; + + // add 1 to adjust range + *value = (( ulValue + 1 ) * 200 / 255 ) - 100; + + return VO_TRUE; +} + +static int control( uint32_t request, void *data, ... ) +{ + switch( request ) + { + case VOCTRL_GET_IMAGE : + return get_image( data ); + + case VOCTRL_QUERY_FORMAT : + return query_format( *(( uint32_t * )data )); + + case VOCTRL_FULLSCREEN : + { + RECTL rcl; + + m_int.fFullScreen = !m_int.fFullScreen; + + if( m_int.fFullScreen ) + { + WinSetParent( m_int.hwndSysMenu, HWND_OBJECT, FALSE ); + WinSetParent( m_int.hwndTitleBar, HWND_OBJECT, FALSE ); + WinSetParent( m_int.hwndMinMax, HWND_OBJECT, FALSE ); + + rcl.xLeft = 0; + rcl.yBottom = 0; + rcl.xRight = SCREEN_WIDTH; + rcl.yTop = SCREEN_HEIGHT; + } + else + { + WinSetParent( m_int.hwndSysMenu, m_int.hwndFrame, FALSE ); + WinSetParent( m_int.hwndTitleBar, m_int.hwndFrame, FALSE ); + WinSetParent( m_int.hwndMinMax, m_int.hwndFrame, FALSE ); + + rcl = m_int.rclDst; + } + + WinCalcFrameRect( m_int.hwndFrame, &rcl, FALSE ); + + WinSetWindowPos( m_int.hwndFrame, HWND_TOP, + rcl.xLeft, rcl.yBottom, + rcl.xRight - rcl.xLeft, rcl.yTop - rcl.yBottom, + SWP_SIZE | SWP_MOVE | SWP_ZORDER | SWP_SHOW | SWP_ACTIVATE ); + + return VO_TRUE; + } + + case VOCTRL_SET_EQUALIZER : + { + va_list ap; + int value; + + va_start( ap, data ); + value = va_arg( ap, int ); + va_end( ap ); + + return color_ctrl_set( data, value ); + } + + case VOCTRL_GET_EQUALIZER : + { + va_list ap; + int *value; + + va_start( ap, data ); + value = va_arg( ap, int * ); + va_end( ap ); + + return color_ctrl_get( data, value ); + } + } + + return VO_NOTIMPL; +} + +static int draw_frame( uint8_t *src[] ) +{ + fast_memcpy( m_int.pbImage, src[ 0 ], SRC_HEIGHT * m_int.lStride ); + + return 0; +} + +static int draw_slice( uint8_t *src[], int stride[], int w, int h, int x, int y ) +{ + uint8_t *s; + uint8_t *d; + + // copy Y + d = m_int.yv12Planes[ 0 ] + m_int.yv12Stride[ 0 ] * y + x; + s = src[ 0 ]; + mem2agpcpy_pic( d, s, w, h, m_int.yv12Stride[ 0 ], stride[ 0 ]); + + w /= 2; h /= 2; x /= 2; y /= 2; + + // copy U + d = m_int.yv12Planes[ 1 ] + m_int.yv12Stride[ 1 ] * y + x; + s = src[ 1 ]; + mem2agpcpy_pic( d, s, w, h, m_int.yv12Stride[ 1 ], stride[ 1 ]); + + // copy V + d = m_int.yv12Planes[ 2 ] + m_int.yv12Stride[ 2 ] * y + x; + s = src[ 2 ]; + mem2agpcpy_pic( d, s, w, h, m_int.yv12Stride[ 2 ], stride[ 2 ]); + + return 0; +} + +#define vo_draw_alpha( imgfmt ) \ + vo_draw_alpha_##imgfmt( w, h, src, srca, stride, \ + m_int.pbImage + m_int.lStride * y0 + m_int.bpp * x0 , \ + m_int.lStride ) + +static void draw_alpha(int x0, int y0, int w, int h, unsigned char *src, + unsigned char *srca, int stride) +{ + switch( m_int.iImageFormat ) + { + case IMGFMT_YV12 : + vo_draw_alpha( yv12 ); + break; + + case IMGFMT_YUY2 : + vo_draw_alpha( yuy2 ); + break; + + case IMGFMT_BGR24 : + vo_draw_alpha( rgb24 ); + break; + + case IMGFMT_BGR16 : + vo_draw_alpha( rgb16 ); + break; + + case IMGFMT_BGR15 : + vo_draw_alpha( rgb15 ); + break; + } +} + +static void draw_osd( void ) +{ + vo_draw_text( SRC_WIDTH, SRC_HEIGHT, draw_alpha ); +} + +static void flip_page( void ) +{ + imgDisplay( m_int.pbImage ); +} + +static void check_events( void ) +{ + QMSG qm; + + while( WinPeekMsg( m_int.hab, &qm, NULLHANDLE, 0, 0, PM_REMOVE )) + WinDispatchMsg( m_int.hab, &qm ); +} + + Index: libdvdcss/device.c =================================================================== --- libdvdcss/device.c (revision 23794) +++ libdvdcss/device.c (working copy) @@ -65,6 +65,11 @@ # include <IOKit/storage/IODVDMedia.h> #endif +#ifdef __OS2__ +#define INCL_DOS +#include <os2.h> +#endif + #include "dvdcss/dvdcss.h" #include "common.h" @@ -93,6 +98,14 @@ static int aspi_read_internal ( int, void *, int ); #endif +#ifdef __OS2__ +static int os2_open ( dvdcss_t, char const * ); +/* just use macros for libc */ +#define os2_seek libc_seek +#define os2_read libc_read +#define os2_readv libc_readv +#endif + int _dvdcss_use_ioctls( dvdcss_t dvdcss ) { #if defined( WIN32 ) @@ -110,6 +123,10 @@ { return 1; } +#elif defined( __OS2__ ) + /* We should consider a case of file ? */ + + return 1; #else struct stat fileinfo; int ret; @@ -322,6 +339,16 @@ return aspi_open( dvdcss, psz_device ); } else +#elif defined( __OS2__ ) + if( psz_device[ 0 ] && ( psz_device[ 1 ] == ':' ) && !psz_device[ 2 ]) + { + print_debug( dvdcss, "using OS2 API for access" ); + dvdcss->pf_seek = os2_seek; + dvdcss->pf_read = os2_read; + dvdcss->pf_readv = os2_readv; + return os2_open( dvdcss, psz_device ); + } + else #endif { print_debug( dvdcss, "using libc for access" ); @@ -332,7 +359,7 @@ } } -#ifndef WIN32 +#if !defined( WIN32 ) && !defined( __OS2__ ) int _dvdcss_raw_open ( dvdcss_t dvdcss, char const *psz_device ) { dvdcss->i_raw_fd = open( psz_device, 0 ); @@ -385,11 +412,13 @@ #else close( dvdcss->i_fd ); + #ifndef __OS2__ if( dvdcss->i_raw_fd >= 0 ) { close( dvdcss->i_raw_fd ); dvdcss->i_raw_fd = -1; } + #endif return 0; #endif @@ -402,7 +431,7 @@ *****************************************************************************/ static int libc_open ( dvdcss_t dvdcss, char const *psz_device ) { -#if !defined( WIN32 ) +#if !defined( WIN32 ) && !defined( __OS2__ ) dvdcss->i_fd = dvdcss->i_read_fd = open( psz_device, 0 ); #else dvdcss->i_fd = dvdcss->i_read_fd = open( psz_device, O_BINARY ); @@ -578,6 +607,32 @@ } #endif +#ifdef __OS2__ +static int os2_open ( dvdcss_t dvdcss, char const *psz_device ) +{ + HFILE hfile; + ULONG ulAction; + ULONG rc; + + rc = DosOpen( psz_device, &hfile, &ulAction, 0, FILE_NORMAL, + OPEN_ACTION_OPEN_IF_EXISTS | OPEN_ACTION_FAIL_IF_NEW, + OPEN_ACCESS_READONLY | OPEN_SHARE_DENYNONE | OPEN_FLAGS_DASD, + NULL ); + + if( rc ) + { + print_error( dvdcss, "failed to open device" ); + return -1; + } + + dvdcss->i_fd = dvdcss->i_read_fd = hfile; + + dvdcss->i_pos = 0; + + return 0; +} +#endif + /***************************************************************************** * Seek commands. *****************************************************************************/ Index: libdvdcss/libdvdcss.c =================================================================== --- libdvdcss/libdvdcss.c (revision 23794) +++ libdvdcss/libdvdcss.c (working copy) @@ -167,7 +167,7 @@ char *psz_method = getenv( "DVDCSS_METHOD" ); char *psz_verbose = getenv( "DVDCSS_VERBOSE" ); char *psz_cache = getenv( "DVDCSS_CACHE" ); -#ifndef WIN32 +#if !defined( WIN32 ) && !defined( __OS2__ ) char *psz_raw_device = getenv( "DVDCSS_RAW_DEVICE" ); #endif @@ -185,7 +185,7 @@ /* * Initialize structure with default values */ -#ifndef WIN32 +#if !defined( WIN32 ) && !defined( __OS2__ ) dvdcss->i_raw_fd = -1; #endif dvdcss->p_titles = NULL; @@ -536,7 +536,7 @@ } nocache: -#ifndef WIN32 +#if !defined( WIN32 ) && !defined( __OS2__ ) if( psz_raw_device != NULL ) { _dvdcss_raw_open( dvdcss, psz_raw_device ); Index: libdvdcss/libdvdcss.h =================================================================== --- libdvdcss/libdvdcss.h (revision 23794) +++ libdvdcss/libdvdcss.h (working copy) @@ -62,7 +62,7 @@ int i_readv_buf_size; #endif -#ifndef WIN32 +#if !defined( WIN32 ) && !defined( __OS2__ ) int i_raw_fd; #endif }; Index: configure =================================================================== --- configure (revision 23794) +++ 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'. @@ -3416,8 +3434,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" @@ -4718,7 +4739,56 @@ fi echores "$_sdl" +if os2; then +echocheck "KVA (DIVE/WarpOverlay!)" +if test "$_kva" = auto; then + cat > $TMPC << EOF +#include <os2.h> +#include <kva.h> +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 <os2.h> +#include <dart.h> +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" @@ -5240,10 +5310,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" @@ -6012,6 +6082,7 @@ if test -z "$_codecsdir" ; then _codecsdir="$_libdir/codecs" mingw32 && _codecsdir="codecs" + os2 && _codecsdir="codecs" fi @@ -6376,7 +6447,6 @@ fi echores "$_libdv" - echocheck "XviD" if test "$_xvid" = auto ; then _xvid=no @@ -7165,7 +7235,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 @@ -7294,6 +7364,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" @@ -7368,6 +7441,7 @@ LIBDIR = \$(DESTDIR)$_libdir # FFmpeg uses libdir instead of LIBDIR libdir = \$(LIBDIR) +AR = $_ar CC = $_cc CXX = $_cc HOST_CC = $_host_cc @@ -8056,7 +8130,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) @@ -8263,6 +8337,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 23794) +++ 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 <windows.h> #endif + +#ifdef __OS2__ +#define INCL_DOS +#include <os2.h> +#endif + #include <string.h> #include <unistd.h> @@ -2274,6 +2280,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[]){ @@ -2290,6 +2311,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(); @@ -2594,8 +2623,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-os2.c =================================================================== --- osdep/getch2-os2.c (revision 0) +++ osdep/getch2-os2.c (revision 0) @@ -0,0 +1,181 @@ +/* + * getch2-os2.c : OS/2 TermIO for MPlayer + * + * Copyright (c) 2007 KO Myung-Hun (komh@chollian.net) + * + * This program 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. + * + * This program 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#define INCL_KBD +#define INCL_VIO +#define INCL_DOS +#include <os2.h> + +#include <stdio.h> + +#include "config.h" +#include "keycodes.h" +#include "input/input.h" + +#if defined( USE_LANGINFO ) && defined( USE_ICONV ) +#include <locale.h> +#include <langinfo.h> +#endif + +int mp_input_os2_slave_cmd_func( int fd, char *dest, int size) +{ + PPIB ppib; + CHAR szPipeName[ 100 ]; + HFILE hpipe; + ULONG ulAction; + ULONG cbActual; + ULONG rc; + + DosGetInfoBlocks( NULL, &ppib ); + + sprintf( szPipeName, "\\PIPE\\MPLAYER\\%lx", ppib->pib_ulpid ); + + rc = DosOpen( szPipeName, &hpipe, &ulAction, 0, FILE_NORMAL, + OPEN_ACTION_OPEN_IF_EXISTS, + OPEN_SHARE_DENYREADWRITE | OPEN_ACCESS_READWRITE, + NULL ); + if( rc ) + return MP_INPUT_NOTHING; + + rc = DosRead( hpipe, dest, size, &cbActual ); + if( rc ) + return MP_INPUT_NOTHING; + + rc = cbActual; + + // Send ACK + DosWrite( hpipe, &rc, sizeof( ULONG ), &cbActual ); + + DosClose( hpipe ); + + return rc; +} + + +int screen_width = 80; +int screen_height = 24; +char *erase_to_end_of_line = NULL; + +void get_screen_size( void ) +{ + VIOMODEINFO vmi; + + vmi.cb = sizeof( VIOMODEINFO ); + + VioGetMode( &vmi, 0 ); + + screen_width = vmi.col; + screen_height = vmi.row; +} + +static int getch2_status = 0; + +// FIXME : assume time == 0 +int getch2( int time ) +{ + KBDKEYINFO kki; + + if( !getch2_status ) + return -1; + + if( KbdCharIn( &kki, IO_NOWAIT, 0 )) + return -1; + + if( kki.fbStatus ) // key pressed ? + { + if(( kki.chChar == 0x00 ) || ( kki.chChar == 0xE0 )) // extended key ? + { + switch( kki.chScan ) + { + case 0x4B : // Left + return KEY_LEFT; + + case 0x48 : // Up + return KEY_UP; + + case 0x4D : // Right + return KEY_RIGHT; + + case 0x50 : // Down + return KEY_DOWN; + + case 0x53 : // Delete + return KEY_DELETE; + + case 0x52 : // Insert + return KEY_INSERT; + + case 0x47 : // Home + return KEY_HOME; + + case 0x4F : // End + return KEY_END; + + case 0x49 : // Page Up + return KEY_PAGE_UP; + + case 0x51 : // Page Down + return KEY_PAGE_DOWN; + } + } + else // character key ? + { + switch( kki.chChar ) + { + case 0x08 : // Backspace + return KEY_BS; + + case 0x1B : // Esc + return KEY_ESC; + } + + return kki.chChar; + } + } + + return -1; +} + + +void getch2_enable() +{ + getch2_status = 1; +} + +void getch2_disable() +{ + getch2_status = 0; +} + +#ifdef USE_ICONV +char *get_term_charset( void ) +{ + char *charset = NULL; + +#ifdef USE_LANGINFO + setlocale( LC_CTYPE, ""); + charset = nl_langinfo( CODESET ); + setlocale( LC_CTYPE, "C"); +#endif + + return charset; +} +#endif + Index: osdep/getch2.h =================================================================== --- osdep/getch2.h (revision 23794) +++ 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/scandir.c =================================================================== --- osdep/scandir.c (revision 23794) +++ osdep/scandir.c (working copy) @@ -57,10 +57,17 @@ * pointer is null, the array is not sorted. */ int +#ifdef __OS2__ scandir(const char *dirname, struct dirent ***ret_namelist, + int (*select)(struct dirent *), + int (*compar)(const void *, const void *)) +#else +scandir(const char *dirname, + struct dirent ***ret_namelist, int (*select)(const struct dirent *), int (*compar)(const struct dirent **, const struct dirent **)) +#endif { int i, len; int used, allocated; Index: osdep/Makefile =================================================================== --- osdep/Makefile (revision 23794) +++ osdep/Makefile (working copy) @@ -27,6 +27,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 23794) +++ 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 23794) +++ 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
KO Myung-Hun wrote:
Hi/2.
I've attach refreshed OS/2 patches expecting to accept.
split them in smaller ones. just noticed in the large patch:
--- subreader.c (revision 23794) +++ 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
':' ?? lu -- Luca Barbato Gentoo/linux Gentoo/PPC http://dev.gentoo.org/~lu_zero
Hi/2. Luca Barbato wrote:
KO Myung-Hun wrote:
Hi/2.
I've attach refreshed OS/2 patches expecting to accept.
split them in smaller ones.
Ok. I splited into 3 parts, which are MPlayer patches, DVD-related patches and newly created patches. I'll post them as reply of my original post.
just noticed in the large patch:
--- subreader.c (revision 23794) +++ 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
':' ??
This is possible. mplayer x:test.avi Here, x: stands for current directory of x drive. -- KO Myung-Hun Using Mozilla SeaMonkey 1.1.2 Under OS/2 Warp 4 for Korean with FixPak #15 On AMD ThunderBird 750 MHz with 512 MB RAM Korean OS/2 User Community : http://www.ecomstation.co.kr
Hi/2. I've splitted patches into 3 parts. This is 1/3. -- KO Myung-Hun Using Mozilla SeaMonkey 1.1.2 Under OS/2 Warp 4 for Korean with FixPak #15 On AMD ThunderBird 750 MHz with 512 MB RAM Korean OS/2 User Community : http://www.ecomstation.co.kr Index: stream/stream_livedotcom.c =================================================================== --- stream/stream_livedotcom.c (revision 23794) +++ 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 23794) +++ stream/cache2.c (working copy) @@ -16,12 +16,16 @@ #include <unistd.h> #include "osdep/timer.h" -#ifndef WIN32 +#if !defined(WIN32) && !defined(__OS2__) #include <sys/wait.h> #include "osdep/shmem.h" -#else +#elif defined(WIN32) #include <windows.h> static DWORD WINAPI ThreadProc(void* s); +#else // OS2 +#define INCL_DOS +#include <os2.h> +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,12 +314,17 @@ 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 while(1){ if(!cache_fill((cache_vars_t*)s)){ Index: stream/udp.c =================================================================== --- stream/udp.c (revision 23794) +++ stream/udp.c (working copy) @@ -43,6 +43,10 @@ #include "url.h" #include "udp.h" +#ifdef __OS2__ +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 23794) +++ 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 23794) +++ stream/tcp.c (working copy) @@ -34,6 +34,10 @@ #include "tcp.h" +#ifdef __OS2__ +typedef int socklen_t; +#endif + /* IPv6 options */ int network_prefer_ipv4 = 0; Index: stream/librtsp/rtsp_rtp.c =================================================================== --- stream/librtsp/rtsp_rtp.c (revision 23794) +++ stream/librtsp/rtsp_rtp.c (working copy) @@ -45,6 +45,10 @@ #include "../freesdp/common.h" #include "../freesdp/parser.h" +#ifdef __OS2__ +typedef int socklen_t; +#endif + #define RTSP_DEFAULT_PORT 31336 #define MAX_LENGTH 256 Index: libao2/audio_out.c =================================================================== --- libao2/audio_out.c (revision 23794) +++ 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 23794) +++ 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 23794) +++ 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'. @@ -3416,8 +3434,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" @@ -4718,7 +4739,56 @@ fi echores "$_sdl" +if os2; then +echocheck "KVA (DIVE/WarpOverlay!)" +if test "$_kva" = auto; then + cat > $TMPC << EOF +#include <os2.h> +#include <kva.h> +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 <os2.h> +#include <dart.h> +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" @@ -5240,10 +5310,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" @@ -6012,6 +6082,7 @@ if test -z "$_codecsdir" ; then _codecsdir="$_libdir/codecs" mingw32 && _codecsdir="codecs" + os2 && _codecsdir="codecs" fi @@ -6376,7 +6447,6 @@ fi echores "$_libdv" - echocheck "XviD" if test "$_xvid" = auto ; then _xvid=no @@ -7165,7 +7235,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 @@ -7294,6 +7364,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" @@ -7368,6 +7441,7 @@ LIBDIR = \$(DESTDIR)$_libdir # FFmpeg uses libdir instead of LIBDIR libdir = \$(LIBDIR) +AR = $_ar CC = $_cc CXX = $_cc HOST_CC = $_host_cc @@ -8056,7 +8130,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) @@ -8263,6 +8337,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 23794) +++ 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 <windows.h> #endif + +#ifdef __OS2__ +#define INCL_DOS +#include <os2.h> +#endif + #include <string.h> #include <unistd.h> @@ -2274,6 +2280,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[]){ @@ -2290,6 +2311,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(); @@ -2594,8 +2623,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 23794) +++ 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/scandir.c =================================================================== --- osdep/scandir.c (revision 23794) +++ osdep/scandir.c (working copy) @@ -57,10 +57,17 @@ * pointer is null, the array is not sorted. */ int +#ifdef __OS2__ scandir(const char *dirname, struct dirent ***ret_namelist, + int (*select)(struct dirent *), + int (*compar)(const void *, const void *)) +#else +scandir(const char *dirname, + struct dirent ***ret_namelist, int (*select)(const struct dirent *), int (*compar)(const struct dirent **, const struct dirent **)) +#endif { int i, len; int used, allocated; Index: osdep/Makefile =================================================================== --- osdep/Makefile (revision 23794) +++ osdep/Makefile (working copy) @@ -27,6 +27,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 23794) +++ 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 23794) +++ 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
On Tuesday, 17 July 2007 at 15:38, KO Myung-Hun wrote:
Hi/2.
I've splitted patches into 3 parts. This is 1/3.
Index: stream/cache2.c =================================================================== --- stream/cache2.c (revision 23794) +++ stream/cache2.c (working copy) [...] @@ -300,12 +314,17 @@ 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 while(1){ if(!cache_fill((cache_vars_t*)s)){
cosmetics
=================================================================== --- stream/tcp.c (revision 23794) +++ stream/tcp.c (working copy) @@ -34,6 +34,10 @@
#include "tcp.h"
+#ifdef __OS2__ +typedef int socklen_t; +#endif + /* IPv6 options */ int network_prefer_ipv4 = 0;
This belongs to osdep/ directory, not tcp.c.
Index: stream/librtsp/rtsp_rtp.c =================================================================== --- stream/librtsp/rtsp_rtp.c (revision 23794) +++ stream/librtsp/rtsp_rtp.c (working copy) @@ -45,6 +45,10 @@ #include "../freesdp/common.h" #include "../freesdp/parser.h"
+#ifdef __OS2__ +typedef int socklen_t; +#endif + #define RTSP_DEFAULT_PORT 31336 #define MAX_LENGTH 256
Likewise. [...]
Index: configure =================================================================== --- configure (revision 23794) +++ configure (working copy) [...] @@ -6376,7 +6447,6 @@ fi echores "$_libdv"
- echocheck "XviD" if test "$_xvid" = auto ; then _xvid=no
Cosmetics. Regards, R. -- MPlayer developer and RPMs maintainer: http://mplayerhq.hu http://rpm.livna.org There should be a science of discontent. People need hard times and oppression to develop psychic muscles. -- from "Collected Sayings of Muad'Dib" by the Princess Irulan
Hi/2. I've modified those patches in order to check feature-specific condition instead of OS one. And removed cosmetics. ^^ Dominik 'Rathann' Mierzejewski wrote:
On Tuesday, 17 July 2007 at 15:38, KO Myung-Hun wrote:
Hi/2.
I've splitted patches into 3 parts. This is 1/3.
Index: stream/cache2.c =================================================================== --- stream/cache2.c (revision 23794) +++ stream/cache2.c (working copy)
[...]
@@ -300,12 +314,17 @@ 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 while(1){ if(!cache_fill((cache_vars_t*)s)){
cosmetics
=================================================================== --- stream/tcp.c (revision 23794) +++ stream/tcp.c (working copy) @@ -34,6 +34,10 @@
#include "tcp.h"
+#ifdef __OS2__ +typedef int socklen_t; +#endif + /* IPv6 options */ int network_prefer_ipv4 = 0;
This belongs to osdep/ directory, not tcp.c.
Index: stream/librtsp/rtsp_rtp.c =================================================================== --- stream/librtsp/rtsp_rtp.c (revision 23794) +++ stream/librtsp/rtsp_rtp.c (working copy) @@ -45,6 +45,10 @@ #include "../freesdp/common.h" #include "../freesdp/parser.h"
+#ifdef __OS2__ +typedef int socklen_t; +#endif + #define RTSP_DEFAULT_PORT 31336 #define MAX_LENGTH 256
Likewise.
[...]
Index: configure =================================================================== --- configure (revision 23794) +++ configure (working copy)
[...]
@@ -6376,7 +6447,6 @@ fi echores "$_libdv"
- echocheck "XviD" if test "$_xvid" = auto ; then _xvid=no
Cosmetics.
Regards, R.
-- KO Myung-Hun Using Mozilla SeaMonkey 1.1.2 Under OS/2 Warp 4 for Korean with FixPak #15 On AMD ThunderBird 750 MHz with 512 MB RAM Korean OS/2 User Community : http://www.ecomstation.co.kr 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 <unistd.h> #include "osdep/timer.h" -#ifndef WIN32 +#if !defined(WIN32) && !defined(__OS2__) #include <sys/wait.h> #include "osdep/shmem.h" -#else +#elif defined(WIN32) #include <windows.h> static DWORD WINAPI ThreadProc(void* s); +#else // OS2 +#define INCL_DOS +#include <os2.h> +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 <sys/socket.h> +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 <os2.h> +#include <kva.h> +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 <os2.h> +#include <dart.h> +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 <windows.h> #endif + +#ifdef __OS2__ +#define INCL_DOS +#include <os2.h> +#endif + #include <string.h> #include <unistd.h> @@ -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
On Thu, 19 Jul 2007 20:43:18 +0900 KO Myung-Hun <komh@chollian.net> wrote:
I've modified those patches in order to check feature-specific condition instead of OS one. And removed cosmetics. ^^
[os2_patch.diff text/plain (15.8KB)] 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 <unistd.h>
#include "osdep/timer.h" -#ifndef WIN32 +#if !defined(WIN32) && !defined(__OS2__) [...] +#elif defined(WIN32) [...] +#else // OS2 [...] #endif
Could you reorder the #ifdef... clauses to #ifdef WIN32 ... #elif defined(__OS2__) ... #else ... #endif or something similar. The #if !defined(A) && !defined(B) && !defined(C)... is a bit confusing.
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
This belongs into the dart patch.
+#ifdef HAVE_KVA +extern vo_functions_t video_out_kva; +#endif
This belongs into the kva patch
Index: configure =================================================================== --- configure (revision 23825) +++ configure (working copy) + --enable-kva enable KVA (DIVE/WarpOverlay!) video output [autodetect] + --disable-dart disable DART audio output [autodetect]
kva & dart patch The rest of the configure patch needs Diego's Ok.
Index: mplayer.c =================================================================== --- mplayer.c (revision 23825) +++ mplayer.c (working copy) +#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
What is this function good for? What does it do? Where is the doxygen comment?
+#ifdef __OS2__ + _fmode_bin = 1; // to make binary mode default + + _envargs( &argc, &argv, "MPLAYER_OPTIONS" );
What does _envargs do?
=================================================================== --- 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
getch2-os2.c is missing from the patch Attila Kinali -- Praised are the Fountains of Shelieth, the silver harp of the waters, But blest in my name forever this stream that stanched my thirst! -- Deed of Morred
Hi/2. Attila Kinali wrote:
On Thu, 19 Jul 2007 20:43:18 +0900 KO Myung-Hun <komh@chollian.net> wrote:
I've modified those patches in order to check feature-specific condition instead of OS one. And removed cosmetics. ^^
[os2_patch.diff text/plain (15.8KB)] 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 <unistd.h>
#include "osdep/timer.h" -#ifndef WIN32 +#if !defined(WIN32) && !defined(__OS2__)
[...]
+#elif defined(WIN32)
[...]
+#else // OS2
[...]
#endif
Could you reorder the #ifdef... clauses to #ifdef WIN32 ... #elif defined(__OS2__) ... #else ... #endif
or something similar. The #if !defined(A) && !defined(B) && !defined(C)... is a bit confusing.
Some parts need it, but other parts can become more confuse because there are the common codes both WIN32 and OS/2 share. So I'll change them partially.
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
This belongs into the dart patch.
Ok.
+#ifdef HAVE_KVA +extern vo_functions_t video_out_kva; +#endif
This belongs into the kva patch
Ok.
Index: configure =================================================================== --- configure (revision 23825) +++ configure (working copy) + --enable-kva enable KVA (DIVE/WarpOverlay!) video output [autodetect] + --disable-dart disable DART audio output [autodetect]
kva & dart patch
The rest of the configure patch needs Diego's Ok.
Ok.
Index: mplayer.c =================================================================== --- mplayer.c (revision 23825) +++ mplayer.c (working copy) +#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
What is this function good for? What does it do? Where is the doxygen comment?
This function enable VIO(text mode) program to be run as PM(GUI) mode. I'll add simple comments for this.
+#ifdef __OS2__ + _fmode_bin = 1; // to make binary mode default + + _envargs( &argc, &argv, "MPLAYER_OPTIONS" );
What does _envargs do?
_envargs() pass env vars to arguments. So it is similar to config file but it is env var not file.
=================================================================== --- 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
getch2-os2.c is missing from the patch
Ok. -- KO Myung-Hun Using Mozilla SeaMonkey 1.1.2 Under OS/2 Warp 4 for Korean with FixPak #15 On AMD ThunderBird 750 MHz with 512 MB RAM Korean OS/2 User Community : http://www.ecomstation.co.kr
On Tue, Jul 17, 2007 at 10:38:40PM +0900, KO Myung-Hun wrote:
I've splitted patches into 3 parts. This is 1/3.
--- configure (revision 23794) +++ configure (working copy) @@ -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)
Didn't you have to change the system name from OS/2-something? Diego
Hi/2. Diego Biurrun wrote:
On Tue, Jul 17, 2007 at 10:38:40PM +0900, KO Myung-Hun wrote:
I've splitted patches into 3 parts. This is 1/3.
--- configure (revision 23794) +++ configure (working copy) @@ -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)
Didn't you have to change the system name from OS/2-something?
No, I didn't. I just wanted to prevent system name from changing to OS/2-Unknown, that is, to remain as OS/2. BTW, is this wrong ? Should I use 'OS/2*)' ? -- KO Myung-Hun Using Mozilla SeaMonkey 1.1.2 Under OS/2 Warp 4 for Korean with FixPak #15 On AMD ThunderBird 750 MHz with 512 MB RAM Korean OS/2 User Community : http://www.ecomstation.co.kr
On Wed, Jul 18, 2007 at 10:18:26PM +0900, KO Myung-Hun wrote:
Diego Biurrun wrote:
On Tue, Jul 17, 2007 at 10:38:40PM +0900, KO Myung-Hun wrote:
I've splitted patches into 3 parts. This is 1/3.
--- configure (revision 23794) +++ configure (working copy) @@ -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)
Didn't you have to change the system name from OS/2-something?
No, I didn't. I just wanted to prevent system name from changing to OS/2-Unknown, that is, to remain as OS/2.
BTW, is this wrong ? Should I use 'OS/2*)' ?
No, I think we just had a misunderstanding at some point. Diego
Hi/2. I've splitted patches into 3 parts. This is 2/3, which is DVD-related patch. -- KO Myung-Hun Using Mozilla SeaMonkey 1.1.2 Under OS/2 Warp 4 for Korean with FixPak #15 On AMD ThunderBird 750 MHz with 512 MB RAM Korean OS/2 User Community : http://www.ecomstation.co.kr Index: dvdread/dvd_reader.c =================================================================== --- dvdread/dvd_reader.c (revision 23794) +++ dvdread/dvd_reader.c (working copy) @@ -460,7 +460,7 @@ } fclose( mntfile ); } -#elif defined(__MINGW32__) +#elif defined(__MINGW32__) || defined( __OS2__ ) dev_name = strdup(path); auth_drive = DVDOpenImageFile( path, have_css ); #endif Index: libdvdcss/device.c =================================================================== --- libdvdcss/device.c (revision 23794) +++ libdvdcss/device.c (working copy) @@ -65,6 +65,11 @@ # include <IOKit/storage/IODVDMedia.h> #endif +#ifdef __OS2__ +#define INCL_DOS +#include <os2.h> +#endif + #include "dvdcss/dvdcss.h" #include "common.h" @@ -93,6 +98,14 @@ static int aspi_read_internal ( int, void *, int ); #endif +#ifdef __OS2__ +static int os2_open ( dvdcss_t, char const * ); +/* just use macros for libc */ +#define os2_seek libc_seek +#define os2_read libc_read +#define os2_readv libc_readv +#endif + int _dvdcss_use_ioctls( dvdcss_t dvdcss ) { #if defined( WIN32 ) @@ -110,6 +123,10 @@ { return 1; } +#elif defined( __OS2__ ) + /* We should consider a case of file ? */ + + return 1; #else struct stat fileinfo; int ret; @@ -322,6 +339,16 @@ return aspi_open( dvdcss, psz_device ); } else +#elif defined( __OS2__ ) + if( psz_device[ 0 ] && ( psz_device[ 1 ] == ':' ) && !psz_device[ 2 ]) + { + print_debug( dvdcss, "using OS2 API for access" ); + dvdcss->pf_seek = os2_seek; + dvdcss->pf_read = os2_read; + dvdcss->pf_readv = os2_readv; + return os2_open( dvdcss, psz_device ); + } + else #endif { print_debug( dvdcss, "using libc for access" ); @@ -332,7 +359,7 @@ } } -#ifndef WIN32 +#if !defined( WIN32 ) && !defined( __OS2__ ) int _dvdcss_raw_open ( dvdcss_t dvdcss, char const *psz_device ) { dvdcss->i_raw_fd = open( psz_device, 0 ); @@ -385,11 +412,13 @@ #else close( dvdcss->i_fd ); + #ifndef __OS2__ if( dvdcss->i_raw_fd >= 0 ) { close( dvdcss->i_raw_fd ); dvdcss->i_raw_fd = -1; } + #endif return 0; #endif @@ -402,7 +431,7 @@ *****************************************************************************/ static int libc_open ( dvdcss_t dvdcss, char const *psz_device ) { -#if !defined( WIN32 ) +#if !defined( WIN32 ) && !defined( __OS2__ ) dvdcss->i_fd = dvdcss->i_read_fd = open( psz_device, 0 ); #else dvdcss->i_fd = dvdcss->i_read_fd = open( psz_device, O_BINARY ); @@ -578,6 +607,32 @@ } #endif +#ifdef __OS2__ +static int os2_open ( dvdcss_t dvdcss, char const *psz_device ) +{ + HFILE hfile; + ULONG ulAction; + ULONG rc; + + rc = DosOpen( psz_device, &hfile, &ulAction, 0, FILE_NORMAL, + OPEN_ACTION_OPEN_IF_EXISTS | OPEN_ACTION_FAIL_IF_NEW, + OPEN_ACCESS_READONLY | OPEN_SHARE_DENYNONE | OPEN_FLAGS_DASD, + NULL ); + + if( rc ) + { + print_error( dvdcss, "failed to open device" ); + return -1; + } + + dvdcss->i_fd = dvdcss->i_read_fd = hfile; + + dvdcss->i_pos = 0; + + return 0; +} +#endif + /***************************************************************************** * Seek commands. *****************************************************************************/ Index: libdvdcss/libdvdcss.c =================================================================== --- libdvdcss/libdvdcss.c (revision 23794) +++ libdvdcss/libdvdcss.c (working copy) @@ -167,7 +167,7 @@ char *psz_method = getenv( "DVDCSS_METHOD" ); char *psz_verbose = getenv( "DVDCSS_VERBOSE" ); char *psz_cache = getenv( "DVDCSS_CACHE" ); -#ifndef WIN32 +#if !defined( WIN32 ) && !defined( __OS2__ ) char *psz_raw_device = getenv( "DVDCSS_RAW_DEVICE" ); #endif @@ -185,7 +185,7 @@ /* * Initialize structure with default values */ -#ifndef WIN32 +#if !defined( WIN32 ) && !defined( __OS2__ ) dvdcss->i_raw_fd = -1; #endif dvdcss->p_titles = NULL; @@ -536,7 +536,7 @@ } nocache: -#ifndef WIN32 +#if !defined( WIN32 ) && !defined( __OS2__ ) if( psz_raw_device != NULL ) { _dvdcss_raw_open( dvdcss, psz_raw_device ); Index: libdvdcss/libdvdcss.h =================================================================== --- libdvdcss/libdvdcss.h (revision 23794) +++ libdvdcss/libdvdcss.h (working copy) @@ -62,7 +62,7 @@ int i_readv_buf_size; #endif -#ifndef WIN32 +#if !defined( WIN32 ) && !defined( __OS2__ ) int i_raw_fd; #endif };
On Tue, 17 Jul 2007 22:39:46 +0900 KO Myung-Hun <komh@chollian.net> wrote:
I've splitted patches into 3 parts. This is 2/3, which is DVD-related patch.
This whole patch should go to libdvdcss upstream first. Attila Kinali -- Praised are the Fountains of Shelieth, the silver harp of the waters, But blest in my name forever this stream that stanched my thirst! -- Deed of Morred
Hi/2. Attila Kinali wrote:
On Tue, 17 Jul 2007 22:39:46 +0900 KO Myung-Hun <komh@chollian.net> wrote:
I've splitted patches into 3 parts. This is 2/3, which is DVD-related patch.
This whole patch should go to libdvdcss upstream first.
If so, after sending to that, Should I post here again ? -- KO Myung-Hun Using Mozilla SeaMonkey 1.1.2 Under OS/2 Warp 4 for Korean with FixPak #15 On AMD ThunderBird 750 MHz with 512 MB RAM Korean OS/2 User Community : http://www.ecomstation.co.kr
Hi/2. I've splitted patches into 3 parts. This is 3/3, which are newly created files. -- KO Myung-Hun Using Mozilla SeaMonkey 1.1.2 Under OS/2 Warp 4 for Korean with FixPak #15 On AMD ThunderBird 750 MHz with 512 MB RAM Korean OS/2 User Community : http://www.ecomstation.co.kr Index: libao2/ao_dart.c =================================================================== --- libao2/ao_dart.c (revision 0) +++ libao2/ao_dart.c (revision 0) @@ -0,0 +1,267 @@ +/* + * ao_dart.c - libao2 DART Audio Output Driver for MPlayer + * + * Copyright (c) 2007 by KO Myung-Hun (komh@chollian.net) + * + * This program 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. + * + * This program 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Changes : + * KO Myung-Hun <komh@chollian.net> 2007/07/08 + * - Call fast_memcpy instead of memcpy() + */ + +#define INCL_DOS +#include <os2.h> + +#include <stdio.h> +#include <stdlib.h> +#include <sys/time.h> + +#include "config.h" +#include "libaf/af_format.h" +#include "audio_out.h" +#include "audio_out_internal.h" +#include "mp_msg.h" +#include "libvo/fastmemcpy.h" +#include "subopt-helper.h" + +#include "dart.h" + +static ao_info_t info = +{ + "DART audio output", + "dart", + "KO Myung-Hun <komh@chollian.net>", + "" +}; + +LIBAO_EXTERN( dart ) + +#define OUTBURST_SAMPLES 512 +#define DART_SAMPLES ( OUTBURST_SAMPLES << 2 ) +#define MPLAYER_SAMPLES ( OUTBURST_SAMPLES << 4 ) + +static uint8_t *m_audioBuf = NULL; +static volatile int m_nBufSize = 0; +static volatile int m_nBufLen = 0; +static volatile int m_iBufPos = 0; + +static ULONG APIENTRY dart_audio_callback( PVOID pBuffer, ULONG ulSize ) +{ + int nCopySize; + + nCopySize = ulSize < m_nBufLen ? ulSize : m_nBufLen; + + if( m_iBufPos + nCopySize > m_nBufSize ) + { + int len = m_nBufSize - m_iBufPos; + + fast_memcpy( pBuffer, m_audioBuf + m_iBufPos, len ); + fast_memcpy(( uint8_t * )pBuffer + len, m_audioBuf, nCopySize - len ); + } + else + fast_memcpy( pBuffer, m_audioBuf + m_iBufPos, nCopySize ); + + m_iBufPos = ( m_iBufPos + nCopySize ) % m_nBufSize; + m_nBufLen -= nCopySize; + + memset(( uint8_t * )pBuffer + nCopySize, DART.bSilence, ulSize - nCopySize ); + + return ulSize; +} + +// to set/get/query special features/parameters +static int control( int cmd, void *arg ) +{ + switch (cmd) + { + case AOCONTROL_GET_VOLUME : + { + ao_control_vol_t *vol = ( ao_control_vol_t * )arg; + + vol->left = vol->right = LOUSHORT( dartGetVolume()); + + return CONTROL_OK; + } + + case AOCONTROL_SET_VOLUME: + { + int mid; + ao_control_vol_t *vol = ( ao_control_vol_t * )arg; + + mid = ( vol->left + vol->right ) / 2; + dartSetVolume( MCI_SET_AUDIO_ALL, mid ); + + return CONTROL_OK; + } + } + + return CONTROL_UNKNOWN; +} + +static void print_help( void ) +{ + mp_msg( MSGT_AO, MSGL_FATAL, + "\n-ao dart commandline help:\n" + "Example: mplayer -ao kva:noshare\n" + " open DART as exclusive mode\n" + "\nOptions:\n" + " noshare\n" + " Open DART as exclusive mode\n"); +} + +// open & setup audio device +// return: 1=success 0=fail +static int init( int rate, int channels, int format, int flags ) +{ + BOOL fNoShare = FALSE; + int n; + + opt_t subopts[] = { + {"noshare", OPT_ARG_BOOL, &fNoShare, NULL }, + { NULL } + }; + + if( subopt_parse( ao_subdevice, subopts ) != 0 ) + { + print_help(); + return 0; + } + + mp_msg( MSGT_AO, MSGL_V, "DART : opened as %s mode\n", fNoShare ? "exclusive" : "shareable"); + + switch( format ) + { + case AF_FORMAT_S16_LE: + case AF_FORMAT_S8: + break; + + default : + format = AF_FORMAT_S16_LE; + mp_msg( MSGT_AO, MSGL_V, "DART: format %s not supported defaulting to Signed 16-bit Little-Endian\n", af_fmt2str_short( format )); + break; + } + + n = ( af_fmt2bits( format ) >> 3 ) * channels; + + m_nBufSize = n * MPLAYER_SAMPLES; + + if( dartInit( 0, af_fmt2bits( format ), rate, MCI_WAVE_FORMAT_PCM, channels, + 2, n * DART_SAMPLES, !fNoShare, dart_audio_callback )) + return 0; + + ao_data.channels = channels; + ao_data.samplerate = rate; + ao_data.format = format; + ao_data.bps = channels * rate * ( af_fmt2bits( format ) >> 3 ); + ao_data.outburst = n * OUTBURST_SAMPLES; + ao_data.buffersize = m_nBufSize; + + m_audioBuf = malloc( m_nBufSize ); + + m_nBufLen = 0; + m_iBufPos = 0; + + dartPlay(); + + return 1; +} + +// close audio device +static void uninit( int immed ) +{ + if( !immed ) + { + while( m_nBufLen ) + DosSleep( 1 ); + } + + dartClose(); + + free( m_audioBuf ); +} + +// stop playing and empty buffers (for seeking/pause) +static void reset( void ) +{ + dartPause(); + + // empty buffers + m_nBufLen = 0; + + dartResume(); +} + +// stop playing, keep buffers (for pause) +static void audio_pause( void ) +{ + dartPause(); +} + +// resume playing, after audio_pause() +static void audio_resume( void ) +{ + dartResume(); +} + +// return: how many bytes can be played without blocking +static int get_space( void ) +{ + return ( m_nBufSize - m_nBufLen ); +} + +// plays 'len' bytes of 'data' +// it should round it down to outburst*n +// return: number of bytes played +static int play( void *data, int len, int flags) +{ + int start_pos, end_pos; + + if( !( flags & AOPLAY_FINAL_CHUNK )) + len = ( len / ao_data.outburst ) * ao_data.outburst; + + if( len == 0 ) + return 0; + + start_pos = ( m_iBufPos + m_nBufLen ) % m_nBufSize; + + end_pos = ( start_pos + len ) % m_nBufSize; + if( end_pos <= start_pos ) + { + int len1 = m_nBufSize - start_pos; + + if( end_pos > m_iBufPos ) + end_pos = m_iBufPos; + + fast_memcpy( m_audioBuf + start_pos, data, len1 ); + fast_memcpy( m_audioBuf, ( uint8_t * )data + len1, end_pos ); + + len = len1 + end_pos; + } + else + fast_memcpy( m_audioBuf + start_pos, data, len ); + + m_nBufLen += len; + + return len; +} + +// return: delay in seconds between first and last sample in buffer +static float get_delay( void ) +{ + return ( float )m_nBufLen / ( float )ao_data.bps; +} + + Index: libvo/vo_kva.c =================================================================== --- libvo/vo_kva.c (revision 0) +++ libvo/vo_kva.c (revision 0) @@ -0,0 +1,889 @@ +/* + * vo_kva.c + * + * Copyright (c) 2007 by KO Myung-Hun (komh@chollian.net) + * + * This program 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. + * + * This program 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Changes : + * KO Myung-Hun <komh@chollian.net> 2007/06/11 + * - Added workaround for T23 laptop with S3 Video + * + * KO Myung-Hun <komh@chollian.net> 2007/06/17 + * - Implemented VOCTRL_SET_EQUALIZER and VOCTRL_GET_EQUALIZER + * - Added YV12 as a supported image format + * - Added process VK_ENTER and VK_NEWLINE + * + * KO Myung-Hun <komh@chollian.net> 2007/07/08 + * - Call fast_memcpy() instead of memcpy() + * + */ + +#define INCL_WIN +#include <os2.h> + +#include <fourcc.h> + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <errno.h> + +#include "config.h" +#include "mp_msg.h" +#include "help_mp.h" +#include "video_out.h" +#include "video_out_internal.h" + +#include "fastmemcpy.h" +#include "osdep/keycodes.h" +#include "input/input.h" +#include "input/mouse.h" +#include "subopt-helper.h" +#include "sub.h" + +#include "cpudetect.h" +#include "libswscale/swscale.h" +#include "libmpcodecs/vf_scale.h" + +#include "kva.h" + +static vo_info_t info = +{ + "DIVE/WarpOverlay! video output", + "kva", + "KO Myung-Hun <komh@chollian.net>", + "" +}; + +LIBVO_EXTERN( kva ) + +#define WC_MPLAYER "WC_MPLAYER" +#define COLOR_OVERLAY 0x000008 + +#define SRC_WIDTH m_int.kvas.szlSrcSize.cx +#define SRC_HEIGHT m_int.kvas.szlSrcSize.cy + +#define SCREEN_WIDTH m_int.kvac.cxScreen +#define SCREEN_HEIGHT m_int.kvac.cyScreen + +typedef struct tagVOKVAINTERNAL +{ + HAB hab; + HMQ hmq; + HWND hwndFrame; + HWND hwndClient; + HWND hwndSysMenu; + HWND hwndTitleBar; + HWND hwndMinMax; + BOOL fFullScreen; + FOURCC fcc; + INT iImageFormat; + KVASETUP kvas; + KVACAPS kvac; + RECTL rclDst; + INT bpp; + LONG lStride; + PBYTE pbImage; + BOOL fFixT23; + PFNWP pfnwpOldFrame; + uint8_t *yv12Planes[ 3 ]; // use as YUV420P format unlike name + int yv12Stride[ 3 ]; + struct SwsContext *sws; +} VOKVAINTERNAL, *PVOKVAINTERNAL; + +static VOKVAINTERNAL m_int; + +extern void mplayer_put_key( int code ); // let mplayer handel the keyevents + +static PBYTE imgCreate( VOID ) +{ + int size; + + size = SRC_HEIGHT * m_int.lStride; + + if( m_int.iImageFormat == IMGFMT_YV12 ) + size += size / 2; + + return malloc( size ); +} + +static VOID imgFree( PBYTE pbImage ) +{ + if( pbImage ) + free( pbImage ); +} + +static VOID imgDisplay( PBYTE pbImage ) +{ + PVOID pBuffer; + ULONG ulBPL; + + if( !kvaLockBuffer( &pBuffer, &ulBPL )) + { + if( m_int.iImageFormat == IMGFMT_YV12 ) + { + sws_scale( m_int.sws, m_int.yv12Planes, m_int.yv12Stride, 0, SRC_HEIGHT, + &pBuffer, &ulBPL ); + + if( gCpuCaps.hasMMX ) + asm volatile ("emms\n\t"); + } + else + fast_memcpy( pBuffer, pbImage, SRC_HEIGHT * ulBPL ); + + kvaUnlockBuffer(); + } +} + +#define MRETURN( ret ) return ( MRESULT )( ret ) + +static MRESULT EXPENTRY NewFrameWndProc( HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2 ) +{ + switch( msg ) + { + case WM_QUERYTRACKINFO : + { + //USHORT ustflags = SHORT1FROMMP( mp1 ); + PTRACKINFO pti = ( PTRACKINFO )mp2; + RECTL rcl; + + if( m_int.fFullScreen ) + break; + + m_int.pfnwpOldFrame( hwnd, msg, mp1, mp2 ); + + //if( ustflags & ( TF_LEFT | TF_RIGHT | TF_TOP | TF_BOTTOM | TF_SETPOINTERPOS )) + { + #if 0 + pti->rclBoundary.xLeft = 0; + pti->rclBoundary.yBottom = 0; + pti->rclBoundary.xRight = SCREEN_WIDTH; + pti->rclBoundary.yTop = SCREEN_HEIGHT; + #endif + + rcl.xLeft = 0; + rcl.yBottom = 0; + rcl.xRight = SRC_WIDTH + 1 ; + rcl.yTop = SRC_HEIGHT + 1; + + WinCalcFrameRect( hwnd, &rcl, FALSE ); + + pti->ptlMinTrackSize.x = rcl.xRight - rcl.xLeft; + pti->ptlMinTrackSize.y = rcl.yTop - rcl.yBottom; + + pti->ptlMaxTrackSize.x = SCREEN_WIDTH; + pti->ptlMaxTrackSize.y = SCREEN_HEIGHT; + } + + MRETURN( TRUE ); + } + + case WM_ADJUSTWINDOWPOS : + { + PSWP pswp = ( PSWP )mp1; + RECTL rcl; + + if( m_int.fFullScreen ) + break; + + if( pswp->fl & SWP_SIZE ) + { + rcl.xLeft = pswp->x; + rcl.yBottom = pswp->y; + rcl.xRight = rcl.xLeft + pswp->cx; + rcl.yTop = rcl.yBottom + pswp->cy; + + WinCalcFrameRect( hwnd, &rcl, TRUE ); + + if( rcl.xRight - rcl.xLeft <= SRC_WIDTH ) + rcl.xRight = rcl.xLeft + ( SRC_WIDTH + 1 ); + + if( rcl.yTop - rcl.yBottom <= SRC_HEIGHT ) + rcl.yTop = rcl.yBottom + ( SRC_HEIGHT + 1 ); + + WinCalcFrameRect( hwnd, &rcl, FALSE ); + + if( rcl.xRight - rcl.xLeft > SCREEN_WIDTH ) + { + rcl.xLeft = 0; + rcl.xRight = SCREEN_WIDTH; + } + + if( rcl.yTop - rcl.yBottom > SCREEN_HEIGHT ) + { + rcl.yBottom = 0; + rcl.yTop = SCREEN_HEIGHT; + } + + pswp->fl |= SWP_MOVE; + pswp->x = rcl.xLeft; + pswp->y = rcl.yBottom; + + pswp->cx = rcl.xRight - rcl.xLeft; + pswp->cy = rcl.yTop - rcl.yBottom; + } + + break; + } + } + + MRETURN( m_int.pfnwpOldFrame( hwnd, msg, mp1, mp2 )); +} + +static MRESULT EXPENTRY WndProc( HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2 ) +{ + switch( msg ) + { + case WM_CLOSE : + mplayer_put_key( KEY_CLOSE_WIN ); + + MRETURN( 0 ); + + case WM_CHAR : + { + USHORT fsFlags = SHORT1FROMMP( mp1 ); + USHORT usCh = SHORT1FROMMP( mp2 ); + USHORT usVk = SHORT2FROMMP( mp2 ); + + if( fsFlags & KC_KEYUP ) + break; + + if( fsFlags & KC_VIRTUALKEY ) + { + switch( usVk ) + { + case VK_LEFT : + mplayer_put_key( KEY_LEFT ); + break; + + case VK_UP : + mplayer_put_key( KEY_UP ); + break; + + case VK_RIGHT : + mplayer_put_key( KEY_RIGHT ); + break; + + case VK_DOWN : + mplayer_put_key( KEY_DOWN ); + break; + + case VK_TAB : + mplayer_put_key( KEY_TAB ); + break; + + case VK_BACKSPACE : + mplayer_put_key( KEY_BS ); + break; + + case VK_DELETE : + mplayer_put_key( KEY_DELETE ); + break; + + case VK_INSERT : + mplayer_put_key( KEY_INSERT ); + break; + + case VK_HOME : + mplayer_put_key( KEY_HOME ); + break; + + case VK_END : + mplayer_put_key( KEY_END ); + break; + + case VK_PAGEUP : + mplayer_put_key( KEY_PAGE_UP ); + break; + + case VK_PAGEDOWN : + mplayer_put_key( KEY_PAGE_DOWN ); + break; + + case VK_ESC : + mplayer_put_key( KEY_ESC ); + break; + + case VK_SPACE : + mplayer_put_key(' '); + break; + + //case VK_ENTER : + case VK_NEWLINE : + mplayer_put_key( KEY_ENTER ); + break; + } + } + else if(( fsFlags & KC_CHAR ) && !HIBYTE( usCh )) + mplayer_put_key( usCh ); + + MRETURN( TRUE ); + } + + case WM_BUTTON1DOWN : + if( WinQueryFocus( HWND_DESKTOP ) != hwnd ) + { + WinSetFocus( HWND_DESKTOP, hwnd ); + MRETURN( TRUE ); + } + + if( !vo_nomouse_input ) + mplayer_put_key( MOUSE_BTN0 ); + + MRETURN( TRUE ); + + case WM_BUTTON3DOWN : + if( WinQueryFocus( HWND_DESKTOP ) != hwnd ) + { + WinSetFocus( HWND_DESKTOP, hwnd ); + MRETURN( TRUE ); + } + + if( !vo_nomouse_input ) + mplayer_put_key( MOUSE_BTN1 ); + + MRETURN( TRUE ); + + case WM_BUTTON2DOWN : + if( WinQueryFocus( HWND_DESKTOP ) != hwnd ) + { + WinSetFocus( HWND_DESKTOP, hwnd ); + MRETURN( TRUE ); + } + + if( !vo_nomouse_input ) + mplayer_put_key( MOUSE_BTN2 ); + + MRETURN( TRUE ); + + case WM_BUTTON1DBLCLK : + if( !vo_nomouse_input ) + mplayer_put_key( MOUSE_BTN0_DBL ); + + MRETURN( TRUE ); + + case WM_BUTTON3DBLCLK : + if( !vo_nomouse_input ) + mplayer_put_key( MOUSE_BTN1_DBL ); + + MRETURN( TRUE ); + + case WM_BUTTON2DBLCLK : + if( !vo_nomouse_input) + mplayer_put_key( MOUSE_BTN2_DBL ); + + MRETURN( TRUE ); + } + + MRETURN( WinDefWindowProc( hwnd, msg, mp1, mp2 )); +} + +static int preinit( const char *arg ) +{ + ULONG flFrameFlags; + + BOOL fUseDive = FALSE; + BOOL fFixT23 = FALSE; + + opt_t subopts[] = { + {"dive", OPT_ARG_BOOL, &fUseDive, NULL, 0 }, + {"t23", OPT_ARG_BOOL, &fFixT23, NULL, 0 }, + { NULL, 0, NULL, NULL, 0 } + }; + + if( subopt_parse( arg, subopts ) != 0 ) + return -1; + + memset( &m_int, 0, sizeof( VOKVAINTERNAL )); + + m_int.hab = WinInitialize( 0 ); + m_int.hmq = WinCreateMsgQueue( m_int.hab, 0); + + WinRegisterClass( + m_int.hab, + WC_MPLAYER, + WndProc, + CS_SIZEREDRAW | CS_MOVENOTIFY, + sizeof( PVOID ) + ); + + flFrameFlags = FCF_SYSMENU | FCF_TITLEBAR | FCF_MINMAX | FCF_SIZEBORDER | + FCF_TASKLIST; + + m_int.hwndFrame = + WinCreateStdWindow( + HWND_DESKTOP, // parent window handle + WS_VISIBLE, // frame window style + &flFrameFlags, // window style + WC_MPLAYER, // class name + "", // window title + 0L, // default client style + NULLHANDLE, // resource in exe file + 1, // frame window id + &m_int.hwndClient // client window handle + ); + + if( m_int.hwndFrame == NULLHANDLE ) + return -1; + + m_int.hwndSysMenu = WinWindowFromID( m_int.hwndFrame, FID_SYSMENU ); + m_int.hwndTitleBar = WinWindowFromID( m_int.hwndFrame, FID_TITLEBAR ); + m_int.hwndMinMax = WinWindowFromID( m_int.hwndFrame, FID_MINMAX ); + + m_int.fFullScreen = FALSE; + + m_int.fFixT23 = fFixT23; + + if( m_int.fFixT23 ) + m_int.pfnwpOldFrame = WinSubclassWindow( m_int.hwndFrame, NewFrameWndProc ); + + if( kvaInit( fUseDive, m_int.hwndClient, COLOR_OVERLAY )) + return -1; + + kvaCaps( &m_int.kvac ); + + switch( m_int.kvac.ulMode ) + { + case KVAM_WO : + m_int.fcc = FOURCC_Y422; + m_int.iImageFormat = IMGFMT_YUY2; + m_int.bpp = 2; + break; + + case KVAM_DIVE : + default : + switch( m_int.kvac.fccScreen ) + { + case FOURCC_BGR4 : + case FOURCC_BGR3 : + case FOURCC_LUT8 : // maybe best T.T + m_int.fcc = FOURCC_BGR3; + m_int.iImageFormat = IMGFMT_BGR24; + m_int.bpp = 3; + break; + + case FOURCC_R565 : + m_int.fcc = FOURCC_R565; + m_int.iImageFormat = IMGFMT_BGR16; + m_int.bpp = 2; + break; + + case FOURCC_R555 : + m_int.fcc = FOURCC_R555; + m_int.iImageFormat = IMGFMT_BGR15; + m_int.bpp = 2; + break; + } + break; + } + + return 0; +} + +static void uninit( void ) +{ + if( m_int.pbImage ) + imgFree( m_int.pbImage ); + + if( m_int.sws ) + sws_freeContext( m_int.sws ); + + if( m_int.hwndFrame != NULLHANDLE ) + { + if( m_int.fFixT23 ) + WinSubclassWindow( m_int.hwndFrame, m_int.pfnwpOldFrame ); + + kvaResetAttr(); + kvaDone(); + WinDestroyWindow( m_int.hwndFrame ); + } + + WinDestroyMsgQueue( m_int.hmq ); + WinTerminate( m_int.hab ); +} + +static int config( uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t flags, char *title, uint32_t format ) +{ + RECTL rcl; + + if( format != m_int.iImageFormat ) + { + mp_msg( MSGT_VO, MSGL_ERR, "KVA : Unsupported image format 0x%X(%s)\n", format, vo_format_name(format)); + return -1; + } + + if( mp_msg_test( MSGT_VO, MSGL_V )) + mp_msg( MSGT_VO, MSGL_V, "KVA: Using 0x%X (%s) image format\n", format, vo_format_name(format)); + + if( m_int.pbImage ) + imgFree( m_int.pbImage ); + + m_int.kvas.ulLength = sizeof( KVASETUP ); + m_int.kvas.szlSrcSize.cx = width; + m_int.kvas.szlSrcSize.cy = height; + m_int.kvas.rclSrcRect.xLeft = 0; + m_int.kvas.rclSrcRect.yTop = 0; + m_int.kvas.rclSrcRect.xRight = width; + m_int.kvas.rclSrcRect.yBottom = height; + m_int.kvas.ulRatio = KVAR_ORIGINAL; + m_int.kvas.fccSrcColor = m_int.fcc; + + kvaSetup( &m_int.kvas ); + + m_int.lStride = width * m_int.bpp; + + m_int.pbImage = imgCreate(); + + if( m_int.iImageFormat == IMGFMT_YV12 ) + { + int dstFormat; + + if( m_int.sws ) + sws_freeContext( m_int.sws ); + + m_int.yv12Planes[ 0 ] = m_int.pbImage; + m_int.yv12Planes[ 1 ] = m_int.yv12Planes[ 0 ] + ( m_int.lStride * height ); + m_int.yv12Planes[ 2 ] = m_int.yv12Planes[ 1 ] + ( m_int.lStride * height ) / 4; + + m_int.yv12Stride[ 0 ] = m_int.lStride; + m_int.yv12Stride[ 1 ] = m_int.lStride / 2; + m_int.yv12Stride[ 2 ] = m_int.lStride / 2; + + switch( m_int.fcc ) + { + case FOURCC_Y422 : + dstFormat = PIX_FMT_YUYV422; + break; + + case FOURCC_BGR3 : + dstFormat = PIX_FMT_BGR24; + break; + + case FOURCC_R565 : + dstFormat = PIX_FMT_BGR565; + break; + + case FOURCC_R555 : + dstFormat = PIX_FMT_BGR555; + break; + } + + m_int.sws = sws_getContext( width, height, PIX_FMT_YUV420P, + width, height, dstFormat, + SWS_FAST_BILINEAR | SWS_PRINT_INFO | get_sws_cpuflags(), + NULL, NULL, NULL ); + } + + WinSetWindowText( m_int.hwndFrame, title ); + + if( !d_width ) + d_width = width; + + if( !d_height ) + d_height = height; + + m_int.fFullScreen = flags & VOFLAG_FULLSCREEN; + + // workaround for T23 laptop with S3 Video by Franz Bakan + if( !m_int.fFullScreen && m_int.fFixT23 ) + { + d_width++; + d_height++; + } + + m_int.rclDst.xLeft = (( LONG )SCREEN_WIDTH - ( LONG )d_width ) / 2; + m_int.rclDst.yBottom = (( LONG )SCREEN_HEIGHT - ( LONG )d_height ) /2 ; + m_int.rclDst.xRight = m_int.rclDst.xLeft + d_width; + m_int.rclDst.yTop = m_int.rclDst.yBottom + d_height; + + if( m_int.fFullScreen ) + { + d_width = SCREEN_WIDTH; + d_height = SCREEN_HEIGHT; + + // when -fs option is used without this, title bar is not highlighted + WinSetActiveWindow( HWND_DESKTOP, m_int.hwndFrame ); + + WinSetParent( m_int.hwndSysMenu, HWND_OBJECT, FALSE ); + WinSetParent( m_int.hwndTitleBar, HWND_OBJECT, FALSE ); + WinSetParent( m_int.hwndMinMax, HWND_OBJECT, FALSE ); + } + + rcl.xLeft = (( LONG )SCREEN_WIDTH - ( LONG )d_width ) / 2; + rcl.yBottom = (( LONG )SCREEN_HEIGHT - ( LONG )d_height ) /2 ; + rcl.xRight = rcl.xLeft + d_width; + rcl.yTop = rcl.yBottom + d_height; + + WinCalcFrameRect( m_int.hwndFrame, &rcl, FALSE ); + + WinSetWindowPos( m_int.hwndFrame, HWND_TOP, + rcl.xLeft, rcl.yBottom, + rcl.xRight - rcl.xLeft, rcl.yTop - rcl.yBottom, + SWP_SIZE | SWP_MOVE | SWP_ZORDER | SWP_SHOW | SWP_ACTIVATE ); + + return 0; +} + +static uint32_t get_image( mp_image_t *mpi ) +{ + if( mpi->imgfmt != m_int.iImageFormat ) + return VO_FALSE; + + if( m_int.iImageFormat == IMGFMT_YV12 ) + { + mpi->planes[ 1 ] = m_int.yv12Planes[ 1 ]; + mpi->planes[ 2 ] = m_int.yv12Planes[ 2 ]; + + mpi->stride[ 1 ] = m_int.yv12Stride[ 1 ]; + mpi->stride[ 2 ] = m_int.yv12Stride[ 2 ]; + } + + mpi->planes[0] = m_int.pbImage; + mpi->stride[0] = m_int.lStride; + mpi->flags |= MP_IMGFLAG_DIRECT; + + return VO_TRUE; +} + +static int query_format( uint32_t format ) +{ + int res = 0; + + // here, modify image format and bpp in case of YV12 + if( format == IMGFMT_YV12 ) + { + m_int.iImageFormat = IMGFMT_YV12; + m_int.bpp = 1; + } + + if( format == m_int.iImageFormat ) + { + res = VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW | VFCAP_OSD | + VFCAP_HWSCALE_UP; + + if( !m_int.fFixT23 ) + res |= VFCAP_HWSCALE_DOWN; + } + + return res; +} + +static uint32_t color_ctrl_set( char *what, int value ) +{ + ULONG ulAttr; + ULONG ulValue; + + if( !strcmp( what, "brightness")) + ulAttr = KVAA_BRIGHTNESS; + else if( !strcmp( what, "contrast")) + ulAttr = KVAA_CONTRAST; + else if( !strcmp( what, "hue")) + ulAttr = KVAA_HUE; + else if( !strcmp( what, "saturation")) + ulAttr = KVAA_SATURATION; + else + return VO_NOTIMPL; + + ulValue = ( value + 100 ) * 255 / 200; + + if( kvaSetAttr( ulAttr, &ulValue )) + return VO_NOTIMPL; + + return VO_TRUE; +} + +static uint32_t color_ctrl_get( char *what, int *value ) +{ + ULONG ulAttr; + ULONG ulValue; + + if( !strcmp( what, "brightness")) + ulAttr = KVAA_BRIGHTNESS; + else if( !strcmp( what, "contrast")) + ulAttr = KVAA_CONTRAST; + else if( !strcmp( what, "hue")) + ulAttr = KVAA_HUE; + else if( !strcmp( what, "saturation")) + ulAttr = KVAA_SATURATION; + else + return VO_NOTIMPL; + + if( kvaQueryAttr( ulAttr, &ulValue )) + return VO_NOTIMPL; + + // add 1 to adjust range + *value = (( ulValue + 1 ) * 200 / 255 ) - 100; + + return VO_TRUE; +} + +static int control( uint32_t request, void *data, ... ) +{ + switch( request ) + { + case VOCTRL_GET_IMAGE : + return get_image( data ); + + case VOCTRL_QUERY_FORMAT : + return query_format( *(( uint32_t * )data )); + + case VOCTRL_FULLSCREEN : + { + RECTL rcl; + + m_int.fFullScreen = !m_int.fFullScreen; + + if( m_int.fFullScreen ) + { + WinSetParent( m_int.hwndSysMenu, HWND_OBJECT, FALSE ); + WinSetParent( m_int.hwndTitleBar, HWND_OBJECT, FALSE ); + WinSetParent( m_int.hwndMinMax, HWND_OBJECT, FALSE ); + + rcl.xLeft = 0; + rcl.yBottom = 0; + rcl.xRight = SCREEN_WIDTH; + rcl.yTop = SCREEN_HEIGHT; + } + else + { + WinSetParent( m_int.hwndSysMenu, m_int.hwndFrame, FALSE ); + WinSetParent( m_int.hwndTitleBar, m_int.hwndFrame, FALSE ); + WinSetParent( m_int.hwndMinMax, m_int.hwndFrame, FALSE ); + + rcl = m_int.rclDst; + } + + WinCalcFrameRect( m_int.hwndFrame, &rcl, FALSE ); + + WinSetWindowPos( m_int.hwndFrame, HWND_TOP, + rcl.xLeft, rcl.yBottom, + rcl.xRight - rcl.xLeft, rcl.yTop - rcl.yBottom, + SWP_SIZE | SWP_MOVE | SWP_ZORDER | SWP_SHOW | SWP_ACTIVATE ); + + return VO_TRUE; + } + + case VOCTRL_SET_EQUALIZER : + { + va_list ap; + int value; + + va_start( ap, data ); + value = va_arg( ap, int ); + va_end( ap ); + + return color_ctrl_set( data, value ); + } + + case VOCTRL_GET_EQUALIZER : + { + va_list ap; + int *value; + + va_start( ap, data ); + value = va_arg( ap, int * ); + va_end( ap ); + + return color_ctrl_get( data, value ); + } + } + + return VO_NOTIMPL; +} + +static int draw_frame( uint8_t *src[] ) +{ + fast_memcpy( m_int.pbImage, src[ 0 ], SRC_HEIGHT * m_int.lStride ); + + return 0; +} + +static int draw_slice( uint8_t *src[], int stride[], int w, int h, int x, int y ) +{ + uint8_t *s; + uint8_t *d; + + // copy Y + d = m_int.yv12Planes[ 0 ] + m_int.yv12Stride[ 0 ] * y + x; + s = src[ 0 ]; + mem2agpcpy_pic( d, s, w, h, m_int.yv12Stride[ 0 ], stride[ 0 ]); + + w /= 2; h /= 2; x /= 2; y /= 2; + + // copy U + d = m_int.yv12Planes[ 1 ] + m_int.yv12Stride[ 1 ] * y + x; + s = src[ 1 ]; + mem2agpcpy_pic( d, s, w, h, m_int.yv12Stride[ 1 ], stride[ 1 ]); + + // copy V + d = m_int.yv12Planes[ 2 ] + m_int.yv12Stride[ 2 ] * y + x; + s = src[ 2 ]; + mem2agpcpy_pic( d, s, w, h, m_int.yv12Stride[ 2 ], stride[ 2 ]); + + return 0; +} + +#define vo_draw_alpha( imgfmt ) \ + vo_draw_alpha_##imgfmt( w, h, src, srca, stride, \ + m_int.pbImage + m_int.lStride * y0 + m_int.bpp * x0 , \ + m_int.lStride ) + +static void draw_alpha(int x0, int y0, int w, int h, unsigned char *src, + unsigned char *srca, int stride) +{ + switch( m_int.iImageFormat ) + { + case IMGFMT_YV12 : + vo_draw_alpha( yv12 ); + break; + + case IMGFMT_YUY2 : + vo_draw_alpha( yuy2 ); + break; + + case IMGFMT_BGR24 : + vo_draw_alpha( rgb24 ); + break; + + case IMGFMT_BGR16 : + vo_draw_alpha( rgb16 ); + break; + + case IMGFMT_BGR15 : + vo_draw_alpha( rgb15 ); + break; + } +} + +static void draw_osd( void ) +{ + vo_draw_text( SRC_WIDTH, SRC_HEIGHT, draw_alpha ); +} + +static void flip_page( void ) +{ + imgDisplay( m_int.pbImage ); +} + +static void check_events( void ) +{ + QMSG qm; + + while( WinPeekMsg( m_int.hab, &qm, NULLHANDLE, 0, 0, PM_REMOVE )) + WinDispatchMsg( m_int.hab, &qm ); +} + + Index: osdep/getch2-os2.c =================================================================== --- osdep/getch2-os2.c (revision 0) +++ osdep/getch2-os2.c (revision 0) @@ -0,0 +1,181 @@ +/* + * getch2-os2.c : OS/2 TermIO for MPlayer + * + * Copyright (c) 2007 KO Myung-Hun (komh@chollian.net) + * + * This program 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. + * + * This program 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#define INCL_KBD +#define INCL_VIO +#define INCL_DOS +#include <os2.h> + +#include <stdio.h> + +#include "config.h" +#include "keycodes.h" +#include "input/input.h" + +#if defined( USE_LANGINFO ) && defined( USE_ICONV ) +#include <locale.h> +#include <langinfo.h> +#endif + +int mp_input_os2_slave_cmd_func( int fd, char *dest, int size) +{ + PPIB ppib; + CHAR szPipeName[ 100 ]; + HFILE hpipe; + ULONG ulAction; + ULONG cbActual; + ULONG rc; + + DosGetInfoBlocks( NULL, &ppib ); + + sprintf( szPipeName, "\\PIPE\\MPLAYER\\%lx", ppib->pib_ulpid ); + + rc = DosOpen( szPipeName, &hpipe, &ulAction, 0, FILE_NORMAL, + OPEN_ACTION_OPEN_IF_EXISTS, + OPEN_SHARE_DENYREADWRITE | OPEN_ACCESS_READWRITE, + NULL ); + if( rc ) + return MP_INPUT_NOTHING; + + rc = DosRead( hpipe, dest, size, &cbActual ); + if( rc ) + return MP_INPUT_NOTHING; + + rc = cbActual; + + // Send ACK + DosWrite( hpipe, &rc, sizeof( ULONG ), &cbActual ); + + DosClose( hpipe ); + + return rc; +} + + +int screen_width = 80; +int screen_height = 24; +char *erase_to_end_of_line = NULL; + +void get_screen_size( void ) +{ + VIOMODEINFO vmi; + + vmi.cb = sizeof( VIOMODEINFO ); + + VioGetMode( &vmi, 0 ); + + screen_width = vmi.col; + screen_height = vmi.row; +} + +static int getch2_status = 0; + +// FIXME : assume time == 0 +int getch2( int time ) +{ + KBDKEYINFO kki; + + if( !getch2_status ) + return -1; + + if( KbdCharIn( &kki, IO_NOWAIT, 0 )) + return -1; + + if( kki.fbStatus ) // key pressed ? + { + if(( kki.chChar == 0x00 ) || ( kki.chChar == 0xE0 )) // extended key ? + { + switch( kki.chScan ) + { + case 0x4B : // Left + return KEY_LEFT; + + case 0x48 : // Up + return KEY_UP; + + case 0x4D : // Right + return KEY_RIGHT; + + case 0x50 : // Down + return KEY_DOWN; + + case 0x53 : // Delete + return KEY_DELETE; + + case 0x52 : // Insert + return KEY_INSERT; + + case 0x47 : // Home + return KEY_HOME; + + case 0x4F : // End + return KEY_END; + + case 0x49 : // Page Up + return KEY_PAGE_UP; + + case 0x51 : // Page Down + return KEY_PAGE_DOWN; + } + } + else // character key ? + { + switch( kki.chChar ) + { + case 0x08 : // Backspace + return KEY_BS; + + case 0x1B : // Esc + return KEY_ESC; + } + + return kki.chChar; + } + } + + return -1; +} + + +void getch2_enable() +{ + getch2_status = 1; +} + +void getch2_disable() +{ + getch2_status = 0; +} + +#ifdef USE_ICONV +char *get_term_charset( void ) +{ + char *charset = NULL; + +#ifdef USE_LANGINFO + setlocale( LC_CTYPE, ""); + charset = nl_langinfo( CODESET ); + setlocale( LC_CTYPE, "C"); +#endif + + return charset; +} +#endif +
On Tue, 17 Jul 2007 22:41:00 +0900 KO Myung-Hun <komh@chollian.net> wrote:
+static uint8_t *m_audioBuf = NULL; +static volatile int m_nBufSize = 0; +static volatile int m_nBufLen = 0; +static volatile int m_iBufPos = 0;
Why the heck are these variables volatile? You should definitly use standard c types instead of ULONG and the like. You should generally add more comments in the code so that even someone w/o OS/2 programming knowledge can understand it. And finally you should split the kva and dart patches (rule of thumb: things that do not depend on each other should be in different patches). Other than that, someone with an understanding of libao and libvo should check those patches. Attila Kinali -- Praised are the Fountains of Shelieth, the silver harp of the waters, But blest in my name forever this stream that stanched my thirst! -- Deed of Morred
Hi/2. Attila Kinali wrote:
On Tue, 17 Jul 2007 22:41:00 +0900 KO Myung-Hun <komh@chollian.net> wrote:
+static uint8_t *m_audioBuf = NULL; +static volatile int m_nBufSize = 0; +static volatile int m_nBufLen = 0; +static volatile int m_iBufPos = 0;
Why the heck are these variables volatile?
What's wrong with them ?
You should definitly use standard c types instead of ULONG and the like.
I don't understand you. It's specific codes to OS/2. It is natural that the specific data types to OS/2 are used, isn't it ? If not, can you explain the case of win32 implementation and others ?
You should generally add more comments in the code so that even someone w/o OS/2 programming knowledge can understand it.
Ok. I'll try to add more comments.
And finally you should split the kva and dart patches (rule of thumb: things that do not depend on each other should be in different patches).
I have questions. configure script has patches for both kva and dart. In this case, should I split configure script into kva and dart, respectively ? And in the case of common parts, what should I do ? That is, configure script has common code for both kva and dart. Should I include those codes to both kva and dart pathces ?
Other than that, someone with an understanding of libao and libvo should check those patches.
Hmm... Who are they ? Anyway it's very difficult to merge patches to official repository. -- KO Myung-Hun Using Mozilla SeaMonkey 1.1.2 Under OS/2 Warp 4 for Korean with FixPak #15 On AMD ThunderBird 750 MHz with 512 MB RAM Korean OS/2 User Community : http://www.ecomstation.co.kr
On Sun, Jul 29, 2007 at 11:00:52PM +0900, KO Myung-Hun wrote:
Attila Kinali wrote:
On Tue, 17 Jul 2007 22:41:00 +0900 KO Myung-Hun <komh@chollian.net> wrote:
And finally you should split the kva and dart patches (rule of thumb: things that do not depend on each other should be in different patches).
I have questions.
configure script has patches for both kva and dart. In this case, should I split configure script into kva and dart, respectively ?
And in the case of common parts, what should I do ? That is, configure script has common code for both kva and dart. Should I include those codes to both kva and dart pathces ?
Patches should be independent. If I were to apply your vo driver patch, it would not work because the build system part is missing. So yes, you should not split your patch by file, but by logical entity. This means that the vo/ao driver patches should come with separate changes to configure. There is no common kva and dart code in your configure patch.
Other than that, someone with an understanding of libao and libvo should check those patches.
Hmm... Who are they ?
Anyway it's very difficult to merge patches to official repository.
Try FFmpeg :) Or libdvdcss, libdvdread, libmpeg2 ... Diego
Hi/2. Diego Biurrun wrote:
On Sun, Jul 29, 2007 at 11:00:52PM +0900, KO Myung-Hun wrote:
Attila Kinali wrote:
On Tue, 17 Jul 2007 22:41:00 +0900 KO Myung-Hun <komh@chollian.net> wrote:
And finally you should split the kva and dart patches (rule of thumb: things that do not depend on each other should be in different patches).
I have questions.
configure script has patches for both kva and dart. In this case, should I split configure script into kva and dart, respectively ?
And in the case of common parts, what should I do ? That is, configure script has common code for both kva and dart. Should I include those codes to both kva and dart pathces ?
Patches should be independent. If I were to apply your vo driver patch, it would not work because the build system part is missing.
So yes, you should not split your patch by file, but by logical entity. This means that the vo/ao driver patches should come with separate changes to configure.
Ok. Now I seems to understand your review policy a little.
There is no common kva and dart code in your configure patch.
I think the codes to add '-lmmpm2' for kva or dart are common. Am I wrong ?
Other than that, someone with an understanding of libao and libvo should check those patches.
Hmm... Who are they ?
Anyway it's very difficult to merge patches to official repository.
Try FFmpeg :) Or libdvdcss, libdvdread, libmpeg2 ...
-- KO Myung-Hun Using Mozilla SeaMonkey 1.1.2 Under OS/2 Warp 4 for Korean with FixPak #15 On AMD ThunderBird 750 MHz with 512 MB RAM Korean OS/2 User Community : http://www.ecomstation.co.kr
On Mon, Jul 30, 2007 at 04:12:06PM +0900, KO Myung-Hun wrote:
Diego Biurrun wrote:
On Sun, Jul 29, 2007 at 11:00:52PM +0900, KO Myung-Hun wrote:
Attila Kinali wrote:
On Tue, 17 Jul 2007 22:41:00 +0900 KO Myung-Hun <komh@chollian.net> wrote:
And finally you should split the kva and dart patches (rule of thumb: things that do not depend on each other should be in different patches).
I have questions.
configure script has patches for both kva and dart. In this case, should I split configure script into kva and dart, respectively ?
And in the case of common parts, what should I do ? That is, configure script has common code for both kva and dart. Should I include those codes to both kva and dart pathces ?
There is no common kva and dart code in your configure patch.
I think the codes to add '-lmmpm2' for kva or dart are common. Am I wrong ?
This is used by both, yes. Make one patch add the code and the other add the second condition. Diego
Hello, On Tue, Jul 17, 2007 at 10:41:00PM +0900, KO Myung-Hun wrote:
I've splitted patches into 3 parts. This is 3/3, which are newly created files.
I happen to have a OS/2 VM lying around, do you happen to have a link to a development environment lying around? I guess I could help speed this up a bit by testing, but esp. with ffmpeg I have the problem there I can't even find a single POSIX-compatible shell to run configure.
+ ao_control_vol_t *vol = ( ao_control_vol_t * )arg;
Useless cast.
+ BOOL fNoShare = FALSE; + int n; + + opt_t subopts[] = { + {"noshare", OPT_ARG_BOOL, &fNoShare, NULL },
OPT_ARG_BOOL takes an int as parameter. Most likely BOOL will happen to be the same, but it is still the wrong type. [...]
+#define COLOR_OVERLAY 0x000008
I don't know if it has the right format, but MPlayer already has vo_colorkey that allows to specify which colour to use for the overlay.
+#define SRC_WIDTH m_int.kvas.szlSrcSize.cx +#define SRC_HEIGHT m_int.kvas.szlSrcSize.cy + +#define SCREEN_WIDTH m_int.kvac.cxScreen +#define SCREEN_HEIGHT m_int.kvac.cyScreen
I think the other vos use vo_screenwidth/vo_screenheight and vo_dwidth and vo_dheight for this.
+typedef struct tagVOKVAINTERNAL +{ + HAB hab; + HMQ hmq; + HWND hwndFrame; + HWND hwndClient; + HWND hwndSysMenu; + HWND hwndTitleBar; + HWND hwndMinMax; + BOOL fFullScreen; + FOURCC fcc; + INT iImageFormat; + KVASETUP kvas; + KVACAPS kvac; + RECTL rclDst; + INT bpp; + LONG lStride; + PBYTE pbImage; + BOOL fFixT23; + PFNWP pfnwpOldFrame; + uint8_t *yv12Planes[ 3 ]; // use as YUV420P format unlike name + int yv12Stride[ 3 ]; + struct SwsContext *sws; +} VOKVAINTERNAL, *PVOKVAINTERNAL;
PVOKVAINTERNAL seems to be unused, so remove it. I personally also think that all-uppercase struct names aren't a good idea, but your decision.
+static VOID imgFree( PBYTE pbImage ) +{ + if( pbImage ) + free( pbImage ); +}
Seems like overkill to have a whole function for that, even more so since the if should not really be needed, free is supposed to handle NULL just fine.
+static VOID imgDisplay( PBYTE pbImage ) +{ + PVOID pBuffer; + ULONG ulBPL; + + if( !kvaLockBuffer( &pBuffer, &ulBPL )) + { + if( m_int.iImageFormat == IMGFMT_YV12 ) + { + sws_scale( m_int.sws, m_int.yv12Planes, m_int.yv12Stride, 0, SRC_HEIGHT, + &pBuffer, &ulBPL ); + + if( gCpuCaps.hasMMX ) + asm volatile ("emms\n\t");
Is this really needed? I see that vf_scale does something like this, but only init, and even there it is a bug IMO.
+#define MRETURN( ret ) return ( MRESULT )( ret )
I find that really obfuscated, I think it would be better to write it out. If you want to avoid the cast, you could also do it by e.g. #define MTRUE ((MRESULT)TRUE) and then return MTRUE.
+ case WM_CLOSE : + mplayer_put_key( KEY_CLOSE_WIN ); + + MRETURN( 0 );
This is the only place where 0 and not TRUE or FALSE is used. Is that intentional?
+static int preinit( const char *arg ) +{ + ULONG flFrameFlags; + + BOOL fUseDive = FALSE; + BOOL fFixT23 = FALSE; + + opt_t subopts[] = { + {"dive", OPT_ARG_BOOL, &fUseDive, NULL, 0 }, + {"t23", OPT_ARG_BOOL, &fFixT23, NULL, 0 }, + { NULL, 0, NULL, NULL, 0 } + };
Same problem with BOOL type as for the ao.
+ // add 1 to adjust range + *value = (( ulValue + 1 ) * 200 / 255 ) - 100;
*value = ( ulValue + 1 ) * 200 / 255 - 100; The outer () is pointless.
+ m_int.fFullScreen = !m_int.fFullScreen;
I think the other vos use the vo_fs variable for this. I haven't yet checked if the code handles -fixed-vo, -fs and -dr commandline options in a sane way.
+// FIXME : assume time == 0 +int getch2( int time )
Not handling time can cause massive CPU use due to constantly checking for input. Maybe you can fix it like this, instead of:
+ if( !getch2_status ) + return -1; + + if( KbdCharIn( &kki, IO_NOWAIT, 0 )) + return -1;
Do if( !getch2_status ) { DosSleep(time); return -1; } i = time / 10; while (KbdCharIn( &kki, IO_NOWAIT, 0 )) { if (i-- <= 0) return -1; DosSleep(10); } Greetings, Reimar Döffinger
participants (6)
-
Attila Kinali -
Diego Biurrun -
Dominik 'Rathann' Mierzejewski -
KO Myung-Hun -
Luca Barbato -
Reimar Döffinger