aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--Makefile4
-rwxr-xr-xconfigure109
-rw-r--r--cpudetect.c30
-rw-r--r--libao2/ao_dart.c276
-rw-r--r--libao2/ao_kai.c332
-rw-r--r--libvo/vo_kva.c1090
-rw-r--r--loader/ldt_keeper.c3
-rw-r--r--loader/module.c20
-rw-r--r--mplayer.c37
-rw-r--r--osdep/getch2-os2.c200
-rw-r--r--osdep/getch2-win.c3
-rw-r--r--osdep/getch2.c13
-rw-r--r--osdep/getch2.h8
-rw-r--r--osdep/mmap-os2.c211
-rw-r--r--osdep/osdep.h50
-rw-r--r--osdep/priority.c2
-rw-r--r--path.c20
-rw-r--r--stream/cache2.c8
-rw-r--r--stream/stream_cddb.c74
-rw-r--r--stream/stream_vcd.c17
-rw-r--r--stream/vcd_read_os2.h242
21 files changed, 46 insertions, 2703 deletions
diff --git a/Makefile b/Makefile
index cc5c75ef89..34d910687f 100644
--- a/Makefile
+++ b/Makefile
@@ -115,7 +115,6 @@ SRCS_COMMON-$(NATIVE_RTSP) += stream/stream_rtsp.c \
SRCS_COMMON-$(NEED_GETTIMEOFDAY) += osdep/gettimeofday.c
SRCS_COMMON-$(NEED_GLOB) += osdep/glob-win.c
-SRCS_COMMON-$(NEED_MMAP) += osdep/mmap-os2.c
SRCS_COMMON-$(NEED_SETENV) += osdep/setenv.c
SRCS_COMMON-$(NEED_SHMEM) += osdep/shmem.c
SRCS_COMMON-$(NEED_STRSEP) += osdep/strsep.c
@@ -441,7 +440,6 @@ SRCS_MPLAYER-$(BL) += libvo/vo_bl.c
SRCS_MPLAYER-$(CACA) += libvo/vo_caca.c
SRCS_MPLAYER-$(COREAUDIO) += libao2/ao_coreaudio.c
SRCS_MPLAYER-$(COREVIDEO) += libvo/vo_corevideo.m libvo/osx_common.c
-SRCS_MPLAYER-$(DART) += libao2/ao_dart.c
SRCS_MPLAYER-$(DGA) += libvo/vo_dga.c
SRCS_MPLAYER-$(DIRECT3D) += libvo/vo_direct3d.c libvo/w32_common.c
SRCS_MPLAYER-$(DIRECTFB) += libvo/vo_directfb2.c libvo/vo_dfbmga.c
@@ -462,8 +460,6 @@ SRCS_MPLAYER-$(IVTV) += libao2/ao_ivtv.c libvo/vo_ivtv.c
SRCS_MPLAYER-$(JACK) += libao2/ao_jack.c
SRCS_MPLAYER-$(JOYSTICK) += input/joystick.c
SRCS_MPLAYER-$(JPEG) += libvo/vo_jpeg.c
-SRCS_MPLAYER-$(KAI) += libao2/ao_kai.c
-SRCS_MPLAYER-$(KVA) += libvo/vo_kva.c
SRCS_MPLAYER-$(LIRC) += input/lirc.c
SRCS_MPLAYER-$(MD5SUM) += libvo/vo_md5sum.c
SRCS_MPLAYER-$(MGA) += libvo/vo_mga.c
diff --git a/configure b/configure
index 47365586bf..93f4766e39 100755
--- a/configure
+++ b/configure
@@ -215,7 +215,6 @@ mingw32() { issystem "MINGW32"; }
morphos() { issystem "MorphOS"; }
netbsd() { issystem "NetBSD"; }
openbsd() { issystem "OpenBSD"; }
-os2() { issystem "OS/2"; }
qnx() { issystem "QNX"; }
sunos() { issystem "SunOS"; }
win32() { cygwin || mingw32; }
@@ -402,7 +401,6 @@ Video output:
--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 video output [autodetect]
--enable-aa enable AAlib video output [autodetect]
--enable-caca enable CACA video output [autodetect]
--enable-ggi enable GGI video output [autodetect]
@@ -450,8 +448,6 @@ Audio output:
--disable-nas disable NAS audio output [autodetect]
--disable-sgiaudio disable SGI audio output [autodetect]
--disable-sunaudio disable Sun audio output [autodetect]
- --disable-kai disable KAI audio output [autodetect]
- --disable-dart disable DART audio output [autodetect]
--disable-win32waveout disable Windows waveout audio output [autodetect]
--disable-coreaudio disable CoreAudio audio output [autodetect]
--disable-select disable using select() on the audio device [enable]
@@ -575,7 +571,6 @@ _dga2=auto
_xv=auto
_vdpau=auto
_sdl=auto
-_kva=auto
_direct3d=auto
_directx=auto
_win32waveout=auto
@@ -608,8 +603,6 @@ _esd=auto
_rsound=auto
_pulse=auto
_jack=auto
-_kai=auto
-_dart=auto
_openal=no
_libcdio=auto
_mad=auto
@@ -867,8 +860,6 @@ for ac_option do
--disable-vdpau) _vdpau=no ;;
--enable-sdl) _sdl=yes ;;
--disable-sdl) _sdl=no ;;
- --enable-kva) _kva=yes ;;
- --disable-kva) _kva=no ;;
--enable-direct3d) _direct3d=yes ;;
--disable-direct3d) _direct3d=no ;;
--enable-directx) _directx=yes ;;
@@ -937,10 +928,6 @@ for ac_option do
--disable-jack) _jack=no ;;
--enable-openal) _openal=yes ;;
--disable-openal) _openal=no ;;
- --enable-kai) _kai=yes ;;
- --disable-kai) _kai=no ;;
- --enable-dart) _dart=yes ;;
- --disable-dart) _dart=no ;;
--enable-mad) _mad=yes ;;
--disable-mad) _mad=no ;;
--enable-libcdio) _libcdio=yes ;;
@@ -1410,15 +1397,6 @@ if qnx ; then
extra_ldflags="$extra_ldflags -lph"
fi
-if os2 ; then
- _exesuf=".exe"
- _getch=getch2-os2.c
- need_shmem=no
- _priority=yes
- def_dos_paths="#define HAVE_DOS_PATHS 1"
- def_priority="#define CONFIG_PRIORITY 1"
-fi
-
TMPC="$mplayer_tmpdir/tmp.c"
TMPCPP="$mplayer_tmpdir/tmp.cpp"
TMPEXE="$mplayer_tmpdir/tmp$_exesuf"
@@ -3104,7 +3082,6 @@ if test "$_mman" = yes ; then
def_mman_h='#define HAVE_SYS_MMAN_H 1'
else
def_mman_h='#undef HAVE_SYS_MMAN_H'
- os2 && need_mmap=yes
fi
echores "$_mman"
@@ -3481,8 +3458,7 @@ int main(void) {int nfds = 1; fd_set readfds; struct timeval timeout; select(nfd
EOF
_posix_select=no
def_posix_select='#undef HAVE_POSIX_SELECT'
-#select() of kLIBC (OS/2) supports socket only
-! os2 && cc_check && _posix_select=yes &&
+cc_check && _posix_select=yes &&
def_posix_select='#define HAVE_POSIX_SELECT 1'
echores "$_posix_select"
@@ -4612,24 +4588,6 @@ fi
echores "$_gl"
-if os2 ; then
-echocheck "KVA (SNAP/WarpOverlay!/DIVE)"
-if test "$_kva" = auto; then
- _kva=no;
- header_check_broken os2.h kva.h -lkva && _kva=yes
-fi
-if test "$_kva" = yes ; then
- def_kva='#define CONFIG_KVA 1'
- libs_mplayer="$libs_mplayer -lkva"
- vomodules="kva $vomodules"
-else
- def_kva='#undef CONFIG_KVA'
- novomodules="kva $novomodules"
-fi
-echores "$_kva"
-fi #if os2
-
-
if win32; then
echocheck "Windows waveout"
@@ -5035,41 +4993,8 @@ echores "$_sgiaudio"
fi #if irix
-if os2 ; then
-echocheck "KAI (UNIAUD/DART)"
-if test "$_kai" = auto; then
- _kai=no;
- header_check_broken os2.h kai.h -lkai && _kai=yes
-fi
-if test "$_kai" = yes ; then
- def_kai='#define CONFIG_KAI 1'
- libs_mplayer="$libs_mplayer -lkai"
- aomodules="kai $aomodules"
-else
- def_kai='#undef CONFIG_KAI'
- noaomodules="kai $noaomodules"
-fi
-echores "$_kai"
-
-echocheck "DART"
-if test "$_dart" = auto; then
- _dart=no;
- header_check_broken os2.h dart.h -ldart && _dart=yes
-fi
-if test "$_dart" = yes ; then
- def_dart='#define CONFIG_DART 1'
- libs_mplayer="$libs_mplayer -ldart"
- aomodules="dart $aomodules"
-else
- def_dart='#undef CONFIG_DART'
- noaomodules="dart $noaomodules"
-fi
-echores "$_dart"
-fi #if os2
-
-
# set default CD/DVD devices
-if win32 || os2 ; then
+if win32 ; then
default_cdrom_device="D:"
elif darwin ; then
default_cdrom_device="/dev/disk1"
@@ -5090,7 +5015,7 @@ else
default_cdrom_device="/dev/cdrom"
fi
-if win32 || os2 || dragonfly || freebsd || openbsd || sunos || amigaos ; then
+if win32 || dragonfly || freebsd || openbsd || sunos || amigaos ; then
default_dvd_device=$default_cdrom_device
elif darwin ; then
default_dvd_device="/dev/rdiskN"
@@ -5102,7 +5027,7 @@ fi
echocheck "VCD support"
if test "$_vcd" = auto; then
_vcd=no
- if linux || freebsd || netbsd || openbsd || dragonfly || bsdos || darwin || sunos || os2; then
+ if linux || freebsd || netbsd || openbsd || dragonfly || bsdos || darwin || sunos; then
_vcd=yes
elif mingw32; then
header_check ddk/ntddcdrm.h && _vcd=yes
@@ -5145,7 +5070,7 @@ if test "$_dvdread_internal" = auto ; then
if (linux || freebsd || netbsd || openbsd || dragonfly || sunos || hpux) &&
(test "$_dvd" = yes || test "$_cdrom" = yes || test "$_cdio" = yes ||
test "$_dvdio" = yes || test "$_bsdi_dvd" = yes) ||
- darwin || win32 || os2; then
+ darwin || win32; then
_dvdread_internal=yes
_dvdread=yes
extra_cflags="-Ilibdvdread4 $extra_cflags"
@@ -5199,8 +5124,6 @@ if test "$_libdvdcss_internal" = yes ; then
cflags_libdvdcss="-DSYS_CYGWIN -DWIN32"
elif beos ; then
cflags_libdvdcss="-DSYS_BEOS"
- elif os2 ; then
- cflags_libdvdcss="-DSYS_OS2"
fi
cflags_libdvdcss_dvdread="-Ilibdvdcss"
def_dvdcss="#define HAVE_DVDCSS_DVDCSS_H 1"
@@ -5591,7 +5514,7 @@ fi
# Fall back on default directory.
if test -z "$_codecsdir" ; then
_codecsdir="$_libdir/codecs"
- mingw32 || os2 && _codecsdir="codecs"
+ mingw32 && _codecsdir="codecs"
fi
@@ -5643,7 +5566,7 @@ if test "$_real" = auto ; then
_real=no
res_comment="dynamic loader support needed"
if test "$_dl" = yes || test "$_win32dll" = yes &&
- (linux || freebsd || netbsd || openbsd || dragonfly || darwin || win32 || os2) ; then
+ (linux || freebsd || netbsd || openbsd || dragonfly || darwin || win32) ; then
_real=yes
fi
fi
@@ -6232,7 +6155,7 @@ fi
# (FIXME: 'echocheck "dynamic linking"' above and modify here accordingly)
_ld_dl_dynamic=''
freebsd || netbsd || openbsd || dragonfly || bsdos && _ld_dl_dynamic='-rdynamic'
-if test "$_real" = yes || test "$_xanim" = yes && ! win32 && ! qnx && ! darwin && ! os2 && ! sunos; then
+if test "$_real" = yes || test "$_xanim" = yes && ! win32 && ! qnx && ! darwin && ! sunos; then
_ld_dl_dynamic='-rdynamic'
fi
@@ -6285,15 +6208,6 @@ echores "$_lircc"
#############################################################################
-# On OS/2 nm supports only a.out. So the -Zomf compiler option to generate
-# the OMF format needs to come after the 'extern symbol prefix' check, which
-# uses nm.
-if os2 ; then
- extra_ldflags="$extra_ldflags -Zomf -Zstack 16384 -Zbin-files -Zargs-wild"
-fi
-
-#############################################################################
-
CFLAGS="$CFLAGS -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE"
CXXFLAGS=" $CFLAGS -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS"
@@ -6416,7 +6330,6 @@ MPLAYER = $_mplayer
NEED_GETTIMEOFDAY = $need_gettimeofday
NEED_GLOB = $need_glob
-NEED_MMAP = $need_mmap
NEED_SETENV = $need_setenv
NEED_SHMEM = $need_shmem
NEED_STRSEP = $need_strsep
@@ -6438,7 +6351,6 @@ CDDA = $_cdda
CDDB = $_cddb
COREAUDIO = $_coreaudio
COREVIDEO = $_corevideo
-DART = $_dart
DGA = $_dga
DIRECT3D = $_direct3d
DIRECTFB = $_directfb
@@ -6468,8 +6380,6 @@ IVTV = $_ivtv
JACK = $_jack
JOYSTICK = $_joystick
JPEG = $_jpeg
-KAI = $_kai
-KVA = $_kva
LADSPA = $_ladspa
LIBA52 = $_liba52
LIBASS = $_ass
@@ -6770,11 +6680,9 @@ $def_xmms
$def_alsa
$def_arts
$def_coreaudio
-$def_dart
$def_esd
$def_esd_latency
$def_jack
-$def_kai
$def_nas
$def_openal
$def_openal_h
@@ -6866,7 +6774,6 @@ $def_gl_x11
$def_gl_sdl
$def_ivtv
$def_jpeg
-$def_kva
$def_md5sum
$def_mga
$def_mng
diff --git a/cpudetect.c b/cpudetect.c
index 160ec955ea..fb93116c80 100644
--- a/cpudetect.c
+++ b/cpudetect.c
@@ -40,9 +40,6 @@ CpuCaps gCpuCaps;
#include <signal.h>
#elif defined(__MINGW32__) || defined(__CYGWIN__)
#include <windows.h>
-#elif defined(__OS2__)
-#define INCL_DOS
-#include <os2.h>
#elif defined(__AMIGAOS4__)
#include <proto/exec.h>
#endif
@@ -89,24 +86,6 @@ LONG CALLBACK win32_sig_handler_sse(EXCEPTION_POINTERS* ep)
}
#endif /* defined(__MINGW32__) || defined(__CYGWIN__) */
-#ifdef __OS2__
-ULONG _System os2_sig_handler_sse(PEXCEPTIONREPORTRECORD p1,
- PEXCEPTIONREGISTRATIONRECORD p2,
- PCONTEXTRECORD p3,
- PVOID p4)
-{
- if(p1->ExceptionNum == XCPT_ILLEGAL_INSTRUCTION){
- mp_msg(MSGT_CPUDETECT, MSGL_V, "SIGILL, ");
-
- p3->ctx_RegEip += 3;
- gCpuCaps.hasSSE = 0;
-
- return XCPT_CONTINUE_EXECUTION;
- }
- return XCPT_CONTINUE_SEARCH;
-}
-#endif
-
/* If we're running on a processor that can do SSE, let's see if we
* are allowed to or not. This will catch 2.4.0 or later kernels that
* haven't been configured for a Pentium III but are running on one,
@@ -166,15 +145,6 @@ static void check_os_katmai_support( void )
SetUnhandledExceptionFilter(exc_fil);
mp_msg(MSGT_CPUDETECT,MSGL_V, gCpuCaps.hasSSE ? "yes.\n" : "no!\n" );
}
-#elif defined(__OS2__)
- EXCEPTIONREGISTRATIONRECORD RegRec = { 0, &os2_sig_handler_sse };
- if ( gCpuCaps.hasSSE ) {
- mp_msg(MSGT_CPUDETECT,MSGL_V, "Testing OS support for SSE... " );
- DosSetExceptionHandler( &RegRec );
- __asm__ volatile ("xorps %xmm0, %xmm0");
- DosUnsetExceptionHandler( &RegRec );
- mp_msg(MSGT_CPUDETECT,MSGL_V, gCpuCaps.hasSSE ? "yes.\n" : "no!\n" );
- }
#elif defined(__linux__)
#if defined(_POSIX_SOURCE)
struct sigaction saved_sigill;
diff --git a/libao2/ao_dart.c b/libao2/ao_dart.c
deleted file mode 100644
index e1df7d32f7..0000000000
--- a/libao2/ao_dart.c
+++ /dev/null
@@ -1,276 +0,0 @@
-/*
- * OS/2 DART audio output driver
- *
- * Copyright (c) 2007-2009 by KO Myung-Hun (komh@chollian.net)
- *
- * This file is part of MPlayer.
- *
- * MPlayer 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.
- *
- * MPlayer 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 MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#define INCL_DOS
-#define INCL_DOSERRORS
-#include <os2.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/time.h>
-#include <float.h>
-
-#include <dart.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 "libavutil/fifo.h"
-
-static const ao_info_t info = {
- "DART audio output",
- "dart",
- "KO Myung-Hun <komh@chollian.net>",
- ""
-};
-
-LIBAO_EXTERN(dart)
-
-#define OUTBURST_SAMPLES 512
-#define DEFAULT_DART_SAMPLES (OUTBURST_SAMPLES << 2)
-
-#define CHUNK_SIZE ao_data.outburst
-
-static AVFifoBuffer *m_audioBuf;
-
-static int m_nBufSize = 0;
-
-static volatile int m_fQuit = FALSE;
-
-static int write_buffer(unsigned char *data, int len)
-{
- int nFree = av_fifo_space(m_audioBuf);
-
- if (len > nFree)
- len = nFree;
-
- return av_fifo_generic_write(m_audioBuf, data, len, NULL);
-}
-
-static int read_buffer(unsigned char *data, int len)
-{
- int nBuffered = av_fifo_size(m_audioBuf);
-
- if (len > nBuffered)
- len = nBuffered;
-
- av_fifo_generic_read(m_audioBuf, data, len, NULL);
- return len;
-}
-
-// end ring buffer stuff
-
-static ULONG APIENTRY dart_audio_callback(PVOID pCBData, PVOID pBuffer,
- ULONG ulSize)
-{
- int nReadLen;
-
- nReadLen = read_buffer(pBuffer, ulSize);
- if (nReadLen < ulSize && !m_fQuit) {
- memset((uint8_t *)pBuffer + nReadLen, DART.bSilence, ulSize - nReadLen);
- nReadLen = ulSize;
- }
-
- return nReadLen;
-}
-
-// 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 = arg;
-
- vol->left = vol->right = LOUSHORT(dartGetVolume());
-
- return CONTROL_OK;
- }
-
- case AOCONTROL_SET_VOLUME:
- {
- int mid;
- ao_control_vol_t *vol = 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 dart:noshare\n"
- " open DART in exclusive mode\n"
- "\nOptions:\n"
- " (no)share\n"
- " Open DART in shareable or exclusive mode\n"
- " bufsize=<size>\n"
- " Set buffer size to <size> in samples(default: 2048)\n");
-}
-
-// open & set up audio device
-// return: 1=success 0=fail
-static int init(int rate, int channels, int format, int flags)
-{
- int fShare = 1;
- int nDartSamples = DEFAULT_DART_SAMPLES;
- int nBytesPerSample;
-
- const opt_t subopts[] = {
- {"share", OPT_ARG_BOOL, &fShare, NULL},
- {"bufsize", OPT_ARG_INT, &nDartSamples, int_non_neg},
- {NULL}
- };
-
- if (subopt_parse(ao_subdevice, subopts) != 0) {
- print_help();
- return 0;
- }
-
- if (!nDartSamples)
- nDartSamples = DEFAULT_DART_SAMPLES;
-
- mp_msg(MSGT_AO, MSGL_V, "DART: opened in %s mode, buffer size = %d sample(s)\n",
- fShare ? "shareable" : "exclusive", nDartSamples);
-
- 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;
- }
-
- nBytesPerSample = (af_fmt2bits(format) >> 3) * channels;
-
- if (dartInit(0, af_fmt2bits(format), rate, MCI_WAVE_FORMAT_PCM, channels,
- 2, nBytesPerSample * nDartSamples, fShare,
- dart_audio_callback, NULL))
- return 0;
-
- mp_msg(MSGT_AO, MSGL_V, "DART: obtained buffer size = %lu bytes\n",
- DART.ulBufferSize);
-
- m_fQuit = FALSE;
-
- ao_data.channels = channels;
- ao_data.samplerate = rate;
- ao_data.format = format;
- ao_data.bps = nBytesPerSample * rate;
- ao_data.outburst = nBytesPerSample * OUTBURST_SAMPLES;
- ao_data.buffersize = DART.ulBufferSize;
-
- // multiple of CHUNK_SIZE
- m_nBufSize = ((DART.ulBufferSize << 2) / CHUNK_SIZE) * CHUNK_SIZE;
- // and one more chunk plus round up
- m_nBufSize += 2 * CHUNK_SIZE;
-
- m_audioBuf = av_fifo_alloc(m_nBufSize);
-
- dartPlay();
-
- // might cause PM DLLs to be loaded which incorrectly enable SIG_FPE,
- // which AAC decoding might trigger.
- // so, mask off all floating-point exceptions.
- _control87(MCW_EM, MCW_EM);
-
- return 1;
-}
-
-// close audio device
-static void uninit(int immed)
-{
- m_fQuit = TRUE;
-
- if (!immed) {
- while (DART.fPlaying)
- DosSleep(1);
- }
-
- dartClose();
-
- av_fifo_free(m_audioBuf);
-}
-
-// stop playing and empty buffers (for seeking/pause)
-static void reset(void)
-{
- dartPause();
-
- // Reset ring-buffer state
- av_fifo_reset(m_audioBuf);
-
- 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 av_fifo_space(m_audioBuf);
-}
-
-// 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)
-{
-
- if (!(flags & AOPLAY_FINAL_CHUNK))
- len = (len / ao_data.outburst) * ao_data.outburst;
-
- return write_buffer(data, len);
-}
-
-// return: delay in seconds between first and last sample in buffer
-static float get_delay(void)
-{
- int nBuffered = av_fifo_size(m_audioBuf); // could be less
-
- return (float)nBuffered / (float)ao_data.bps;
-}
diff --git a/libao2/ao_kai.c b/libao2/ao_kai.c
deleted file mode 100644
index 98a3e49b44..0000000000
--- a/libao2/ao_kai.c
+++ /dev/null
@@ -1,332 +0,0 @@
-/*
- * OS/2 KAI audio output driver
- *
- * Copyright (c) 2010 by KO Myung-Hun (komh@chollian.net)
- *
- * This file is part of MPlayer.
- *
- * MPlayer 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.
- *
- * MPlayer 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 MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#define INCL_DOS
-#define INCL_DOSERRORS
-#include <os2.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/time.h>
-#include <float.h>
-
-#include <kai.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 "libavutil/avutil.h"
-#include "libavutil/fifo.h"
-
-static const ao_info_t info = {
- "KAI audio output",
- "kai",
- "KO Myung-Hun <komh@chollian.net>",
- ""
-};
-
-LIBAO_EXTERN(kai)
-
-#define OUTBURST_SAMPLES 512
-#define DEFAULT_SAMPLES (OUTBURST_SAMPLES << 2)
-
-#define CHUNK_SIZE ao_data.outburst
-
-static AVFifoBuffer *m_audioBuf;
-
-static int m_nBufSize = 0;
-
-static volatile int m_fQuit = FALSE;
-
-static KAISPEC m_kaiSpec;
-
-static HKAI m_hkai;
-
-static int write_buffer(unsigned char *data, int len)
-{
- int nFree = av_fifo_space(m_audioBuf);
-
- len = FFMIN(len, nFree);
-
- return av_fifo_generic_write(m_audioBuf, data, len, NULL);
-}
-
-static int read_buffer(unsigned char *data, int len)
-{
- int nBuffered = av_fifo_size(m_audioBuf);
-
- len = FFMIN(len, nBuffered);
-
- av_fifo_generic_read(m_audioBuf, data, len, NULL);
- return len;
-}
-
-// end ring buffer stuff
-
-static ULONG APIENTRY kai_audio_callback(PVOID pCBData, PVOID pBuffer,
- ULONG ulSize)
-{
- int nReadLen;
-
- nReadLen = read_buffer(pBuffer, ulSize);
- if (nReadLen < ulSize && !m_fQuit) {
- memset((uint8_t *)pBuffer + nReadLen, m_kaiSpec.bSilence, ulSize - nReadLen);
- nReadLen = ulSize;
- }
-
- return nReadLen;
-}
-
-// 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 = arg;
-
- vol->left = vol->right = kaiGetVolume(m_hkai, MCI_STATUS_AUDIO_ALL);
-
- return CONTROL_OK;
- }
-
- case AOCONTROL_SET_VOLUME:
- {
- int mid;
- ao_control_vol_t *vol = arg;
-
- mid = (vol->left + vol->right) / 2;
- kaiSetVolume(m_hkai, MCI_SET_AUDIO_ALL, mid);
-
- return CONTROL_OK;
- }
- }
-
- return CONTROL_UNKNOWN;
-}
-
-static void print_help(void)
-{
- mp_msg(MSGT_AO, MSGL_FATAL,
- "\n-ao kai commandline help:\n"
- "Example: mplayer -ao kai:noshare\n"
- " open audio in exclusive mode\n"
- "\nOptions:\n"
- " uniaud\n"
- " Use UNIAUD audio driver\n"
- " dart\n"
- " Use DART audio driver\n"
- " (no)share\n"
- " Open audio in shareable or exclusive mode\n"
- " bufsize=<size>\n"
- " Set buffer size to <size> in samples(default: 2048)\n");
-}
-
-// open & set up audio device
-// return: 1=success 0=fail
-static int init(int rate, int channels, int format, int flags)
-{
- int fUseUniaud = 0;
- int fUseDart = 0;
- int fShare = 1;
- ULONG kaiMode;
- KAICAPS kc;
- int nSamples = DEFAULT_SAMPLES;
- int nBytesPerSample;
- KAISPEC ksWanted;
-
- const opt_t subopts[] = {
- {"uniaud", OPT_ARG_BOOL, &fUseUniaud, NULL},
- {"dart", OPT_ARG_BOOL, &fUseDart, NULL},
- {"share", OPT_ARG_BOOL, &fShare, NULL},
- {"bufsize", OPT_ARG_INT, &nSamples, int_non_neg},
- {NULL}
- };
-
- const char *audioDriver[] = {"DART", "UNIAUD",};
-
- if (subopt_parse(ao_subdevice, subopts) != 0) {
- print_help();
- return 0;
- }
-
- if (fUseUniaud && fUseDart)
- mp_msg(MSGT_VO, MSGL_WARN,"KAI: Multiple mode specified!!!\n");
-
- if (fUseUniaud)
- kaiMode = KAIM_UNIAUD;
- else if (fUseDart)
- kaiMode = KAIM_DART;
- else
- kaiMode = KAIM_AUTO;
-
- if (kaiInit(kaiMode)) {
- mp_msg(MSGT_VO, MSGL_ERR, "KAI: Init failed!!!\n");
- return 0;
- }
-
- kaiCaps(&kc);
- mp_msg(MSGT_AO, MSGL_V, "KAI: selected audio driver = %s\n",
- audioDriver[kc.ulMode - 1]);
- mp_msg(MSGT_AO, MSGL_V, "KAI: PDD name = %s, maximum channels = %lu\n",
- kc.szPDDName, kc.ulMaxChannels);
-
- if (!nSamples)
- nSamples = DEFAULT_SAMPLES;
-
- mp_msg(MSGT_AO, MSGL_V, "KAI: open in %s mode, buffer size = %d sample(s)\n",
- fShare ? "shareable" : "exclusive", nSamples);
-
- switch (format) {
- case AF_FORMAT_S16_LE:
- case AF_FORMAT_S8:
- break;
-
- default:
- format = AF_FORMAT_S16_LE;
- mp_msg(MSGT_AO, MSGL_V, "KAI: format %s not supported defaulting to Signed 16-bit Little-Endian\n",
- af_fmt2str_short(format));
- break;
- }
-
- nBytesPerSample = (af_fmt2bits(format) >> 3) * channels;
-
- ksWanted.usDeviceIndex = 0;
- ksWanted.ulType = KAIT_PLAY;
- ksWanted.ulBitsPerSample = af_fmt2bits(format);
- ksWanted.ulSamplingRate = rate;
- ksWanted.ulDataFormat = MCI_WAVE_FORMAT_PCM;
- ksWanted.ulChannels = channels;
- ksWanted.ulNumBuffers = 2;
- ksWanted.ulBufferSize = nBytesPerSample * nSamples;
- ksWanted.fShareable = fShare;
- ksWanted.pfnCallBack = kai_audio_callback;
- ksWanted.pCallBackData = NULL;
-
- if (kaiOpen(&ksWanted, &m_kaiSpec, &m_hkai)) {
- mp_msg(MSGT_VO, MSGL_ERR, "KAI: Open failed!!!\n");
- return 0;
- }
-
- mp_msg(MSGT_AO, MSGL_V, "KAI: obtained buffer count = %lu, size = %lu bytes\n",
- m_kaiSpec.ulNumBuffers, m_kaiSpec.ulBufferSize);
-
- m_fQuit = FALSE;
-
- ao_data.channels = channels;
- ao_data.samplerate = rate;
- ao_data.format = format;
- ao_data.bps = nBytesPerSample * rate;
- ao_data.outburst = nBytesPerSample * OUTBURST_SAMPLES;
- ao_data.buffersize = m_kaiSpec.ulBufferSize;
-
- m_nBufSize = (m_kaiSpec.ulBufferSize * m_kaiSpec.ulNumBuffers) << 2;
-
- // multiple of CHUNK_SIZE
- m_nBufSize = (m_nBufSize / CHUNK_SIZE) * CHUNK_SIZE;
-
- // and one more chunk plus round up
- m_nBufSize += 2 * CHUNK_SIZE;
-
- mp_msg(MSGT_AO, MSGL_V, "KAI: internal audio buffer size = %d bytes\n",
- m_nBufSize);
-
- m_audioBuf = av_fifo_alloc(m_nBufSize);
-
- kaiPlay(m_hkai);
-
- // might cause PM DLLs to be loaded which incorrectly enable SIG_FPE,
- // which AAC decoding might trigger.
- // so, mask off all floating-point exceptions.
- _control87(MCW_EM, MCW_EM);
-
- return 1;
-}
-
-// close audio device
-static void uninit(int immed)
-{
- m_fQuit = TRUE;
-
- if (!immed)
- while (kaiStatus(m_hkai) & KAIS_PLAYING)
- DosSleep(1);
-
- kaiClose(m_hkai);
-
- kaiDone();
-
- av_fifo_free(m_audioBuf);
-}
-
-// stop playing and empty buffers (for seeking/pause)
-static void reset(void)
-{
- kaiPause(m_hkai);
-
- // Reset ring-buffer state
- av_fifo_reset(m_audioBuf);
-
- kaiResume(m_hkai);
-}
-
-// stop playing, keep buffers (for pause)
-static void audio_pause(void)
-{
- kaiPause(m_hkai);
-}
-
-// resume playing, after audio_pause()
-static void audio_resume(void)
-{
- kaiResume(m_hkai);
-}
-
-// return: how many bytes can be played without blocking
-static int get_space(void)
-{
- return av_fifo_space(m_audioBuf);
-}
-
-// 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)
-{
-
- if (!(flags & AOPLAY_FINAL_CHUNK))
- len = (len / ao_data.outburst) * ao_data.outburst;
-
- return write_buffer(data, len);
-}
-
-// return: delay in seconds between first and last sample in buffer
-static float get_delay(void)
-{
- int nBuffered = av_fifo_size(m_audioBuf); // could be less
-
- return (float)nBuffered / (float)ao_data.bps;
-}
diff --git a/libvo/vo_kva.c b/libvo/vo_kva.c
deleted file mode 100644
index e05811c17c..0000000000
--- a/libvo/vo_kva.c
+++ /dev/null
@@ -1,1090 +0,0 @@
-/*
- * OS/2 video output driver
- *
- * Copyright (c) 2007-2009 by KO Myung-Hun (komh@chollian.net)
- *
- * This file is part of MPlayer.
- *
- * MPlayer 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.
- *
- * MPlayer 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 MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#define INCL_WIN
-#define INCL_GPI
-#define INCL_DOS
-#include <os2.h>
-
-#include <mmioos2.h>
-#include <fourcc.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <float.h>
-
-#include <kva.h>
-
-#include "config.h"
-#include "mp_msg.h"
-#include "video_out.h"
-#include "video_out_internal.h"
-#include "aspect.h"
-
-#include "fastmemcpy.h"
-#include "mp_fifo.h"
-#include "input/keycodes.h"
-#include "input/input.h"
-#include "subopt-helper.h"
-#include "sub/sub.h"
-
-#include "cpudetect.h"
-#include "libswscale/swscale.h"
-#include "libmpcodecs/vf_scale.h"
-
-static const vo_info_t info = {
- "SNAP/WarpOverlay!/DIVE video output",
- "kva",
- "KO Myung-Hun <komh@chollian.net>",
- ""
-};
-
-const LIBVO_EXTERN(kva)
-
-#define WC_MPLAYER "WC_MPLAYER"
-
-#define SRC_WIDTH m_int.kvas.szlSrcSize.cx
-#define SRC_HEIGHT m_int.kvas.szlSrcSize.cy
-
-#define HWNDFROMWINID(wid) ((wid) + 0x80000000UL)
-
-static const struct mp_keymap m_vk_map[] = {
- {VK_NEWLINE, KEY_ENTER}, {VK_TAB, KEY_TAB}, {VK_SPACE, ' '},
-
- // control keys
- {VK_CTRL, KEY_CTRL}, {VK_BACKSPACE, KEY_BS},
- {VK_DELETE, KEY_DELETE}, {VK_INSERT, KEY_INSERT},
- {VK_HOME, KEY_HOME}, {VK_END, KEY_END},
- {VK_PAGEUP, KEY_PAGE_UP}, {VK_PAGEDOWN, KEY_PAGE_DOWN},
- {VK_ESC, KEY_ESC},
-
- // cursor keys
- {VK_RIGHT, KEY_RIGHT}, {VK_LEFT, KEY_LEFT},
- {VK_DOWN, KEY_DOWN}, {VK_UP, KEY_UP},
-
- // function keys
- {VK_F1, KEY_F+1}, {VK_F2, KEY_F+2}, {VK_F3, KEY_F+3}, {VK_F4, KEY_F+4},
- {VK_F5, KEY_F+5}, {VK_F6, KEY_F+6}, {VK_F7, KEY_F+7}, {VK_F8, KEY_F+8},
- {VK_F9, KEY_F+9}, {VK_F10, KEY_F+10}, {VK_F11, KEY_F+11}, {VK_F12, KEY_F+12},
-
- {0, 0}
-};
-
-static const struct mp_keymap m_keypad_map[] = {
- // keypad keys
- {0x52, KEY_KP0}, {0x4F, KEY_KP1}, {0x50, KEY_KP2}, {0x51, KEY_KP3},
- {0x4B, KEY_KP4}, {0x4C, KEY_KP5}, {0x4D, KEY_KP6}, {0x47, KEY_KP7},
- {0x48, KEY_KP8}, {0x49, KEY_KP9}, {0x53, KEY_KPDEC}, {0x5A, KEY_KPENTER},
-
- {0, 0}
-};
-
-static const struct mp_keymap m_mouse_map[] = {
- {WM_BUTTON1DOWN, MOUSE_BTN0},
- {WM_BUTTON3DOWN, MOUSE_BTN1},
- {WM_BUTTON2DOWN, MOUSE_BTN2},
- {WM_BUTTON1DBLCLK, MOUSE_BTN0_DBL},
- {WM_BUTTON3DBLCLK, MOUSE_BTN1_DBL},
- {WM_BUTTON2DBLCLK, MOUSE_BTN2_DBL},
-
- {0, 0}
-};
-
-struct {
- HAB hab;
- HMQ hmq;
- HWND hwndFrame;
- HWND hwndClient;
- HWND hwndSysMenu;
- HWND hwndTitleBar;
- HWND hwndMinMax;
- FOURCC fcc;
- int iImageFormat;
- int nChromaShift;
- KVASETUP kvas;
- KVACAPS kvac;
- RECTL rclDst;
- int bpp;
- LONG lStride;
- PBYTE pbImage;
- BOOL fFixT23;
- PFNWP pfnwpOldFrame;
- uint8_t *planes[MP_MAX_PLANES]; // y = 0, u = 1, v = 2
- int stride[MP_MAX_PLANES];
- BOOL fHWAccel;
- RECTL rclParent;
- struct SwsContext *sws;
-} m_int;
-
-static inline void setAspectRatio(ULONG ulRatio)
-{
- ULONG ulValue;
- int i;
-
- m_int.kvas.ulRatio = ulRatio;
- kvaSetup(&m_int.kvas);
-
- // Setup initializes all attributes, so need to restore them.
- for (i = 0; i < KVAA_LAST; i++) {
- kvaQueryAttr(i, &ulValue);
- kvaSetAttr(i, &ulValue);
- }
-}
-
-static int query_format_info(int format, PBOOL pfHWAccel, PFOURCC pfcc,
- int *pbpp, int *pnChromaShift)
-{
- BOOL fHWAccel;
- FOURCC fcc;
- INT bpp;
- INT nChromaShift;
-
- switch (format) {
- case IMGFMT_YV12:
- fHWAccel = m_int.kvac.ulInputFormatFlags & KVAF_YV12;
- fcc = FOURCC_YV12;
- bpp = 1;
- nChromaShift = 1;
- break;
-
- case IMGFMT_YUY2:
- fHWAccel = m_int.kvac.ulInputFormatFlags & KVAF_YUY2;
- fcc = FOURCC_Y422;
- bpp = 2;
- nChromaShift = 0;
- break;
-
- case IMGFMT_YVU9:
- fHWAccel = m_int.kvac.ulInputFormatFlags & KVAF_YVU9;
- fcc = FOURCC_YVU9;
- bpp = 1;
- nChromaShift = 2;
- break;
-
- case IMGFMT_BGR24:
- fHWAccel = m_int.kvac.ulInputFormatFlags & KVAF_BGR24;
- fcc = FOURCC_BGR3;
- bpp = 3;
- nChromaShift = 0;
- break;
-
- case IMGFMT_BGR16:
- fHWAccel = m_int.kvac.ulInputFormatFlags & KVAF_BGR16;
- fcc = FOURCC_R565;
- bpp = 2;
- nChromaShift = 0;
- break;
-
- case IMGFMT_BGR15:
- fHWAccel = m_int.kvac.ulInputFormatFlags & KVAF_BGR15;
- fcc = FOURCC_R555;
- bpp = 2;
- nChromaShift = 0;
- break;
-
- default:
- return 1;
- }
-
- if (pfHWAccel)
- *pfHWAccel = fHWAccel;
-
- if (pfcc)
- *pfcc = fcc;
-
- if (pbpp)
- *pbpp = bpp;
-
- if (pnChromaShift)
- *pnChromaShift = nChromaShift;
-
- return 0;
-}
-
-static void imgCreate(void)
-{
- int size = SRC_HEIGHT * m_int.lStride;;
-
- switch (m_int.iImageFormat) {
- case IMGFMT_YV12:
- size += size / 2;
- break;
-
- case IMGFMT_YVU9:
- size += size / 8;
- break;
- }
-
- m_int.pbImage = malloc(size);
-
- memset(m_int.planes, 0, sizeof(m_int.planes));
- memset(m_int.stride, 0, sizeof(m_int.stride));
- m_int.planes[0] = m_int.pbImage;
- m_int.stride[0] = m_int.lStride;
-
- // YV12 or YVU9 ?
- if (m_int.nChromaShift) {
- m_int.planes[1] = m_int.planes[0] + SRC_HEIGHT * m_int.stride[0];
- m_int.stride[1] = m_int.stride[0] >> m_int.nChromaShift;
-
- m_int.planes[2] = m_int.planes[1] +
- (SRC_HEIGHT >> m_int.nChromaShift) * m_int.stride[1];
- m_int.stride[2] = m_int.stride[1];
- }
-}
-
-static void imgFree(void)
-{
- free(m_int.pbImage);
-
- m_int.pbImage = NULL;
-}
-
-static void imgDisplay(void)
-{
- PVOID pBuffer;
- ULONG ulBPL;
-
- if (!kvaLockBuffer(&pBuffer, &ulBPL)) {
- uint8_t *dst[MP_MAX_PLANES] = {NULL};
- int dstStride[MP_MAX_PLANES] = {0};
-
- // Get packed or Y
- dst[0] = pBuffer;
- dstStride[0] = ulBPL;
-
- // YV12 or YVU9 ?
- if (m_int.nChromaShift) {
- // Get V
- dst[2] = dst[0] + SRC_HEIGHT * dstStride[0];
- dstStride[2] = dstStride[0] >> m_int.nChromaShift;
-
- // Get U
- dst[1] = dst[2] +
- (SRC_HEIGHT >> m_int.nChromaShift ) * dstStride[2];
- dstStride[1] = dstStride[2];
- }
-
- if (m_int.fHWAccel) {
- int w, h;
-
- w = m_int.stride[0];
- h = SRC_HEIGHT;
-
- // Copy packed or Y
- mem2agpcpy_pic(dst[0], m_int.planes[0], w, h,
- dstStride[0], m_int.stride[0]);
-
- // YV12 or YVU9 ?
- if (m_int.nChromaShift) {
- w >>= m_int.nChromaShift; h >>= m_int.nChromaShift;
-
- // Copy U
- mem2agpcpy_pic(dst[1], m_int.planes[1], w, h,
- dstStride[1], m_int.stride[1]);
-
- // Copy V
- mem2agpcpy_pic(dst[2], m_int.planes[2], w, h,
- dstStride[2], m_int.stride[2]);
- }
- } else {
- sws_scale(m_int.sws, m_int.planes, m_int.stride, 0, SRC_HEIGHT,
- dst, dstStride);
- }
-
- kvaUnlockBuffer();
- }
-}
-
-// Frame window procedure to work around T23 laptop with S3 video card,
-// which supports upscaling only.
-static MRESULT EXPENTRY NewFrameWndProc(HWND hwnd, ULONG msg, MPARAM mp1,
- MPARAM mp2)
-{
- switch (msg) {
- case WM_QUERYTRACKINFO:
- {
- PTRACKINFO pti = (PTRACKINFO)mp2;
- RECTL rcl;
-
- if (vo_fs)
- break;
-
- m_int.pfnwpOldFrame(hwnd, msg, mp1, mp2);
-
- 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 = vo_screenwidth;
- pti->ptlMaxTrackSize.y = vo_screenheight;
-
- return (MRESULT)TRUE;
- }
-
- case WM_ADJUSTWINDOWPOS:
- {
- PSWP pswp = (PSWP)mp1;
- RECTL rcl;
-
- if (vo_fs)
- 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 > vo_screenwidth) {
- rcl.xLeft = 0;
- rcl.xRight = vo_screenwidth;
- }
-
- if (rcl.yTop - rcl.yBottom > vo_screenheight) {
- rcl.yBottom = 0;
- rcl.yTop = vo_screenheight;
- }
-
- 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;
- }
- }
-
- return m_int.pfnwpOldFrame(hwnd, msg, mp1, mp2);
-}
-
-static MRESULT EXPENTRY WndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
-{
- // if slave mode, ignore mouse events and deliver them to a parent window
- if (WinID != -1 &&
- ((msg >= WM_MOUSEFIRST && msg <= WM_MOUSELAST) ||
- (msg >= WM_EXTMOUSEFIRST && msg <= WM_EXTMOUSELAST))) {
- WinPostMsg(HWNDFROMWINID(WinID), msg, mp1, mp2);
-
- return (MRESULT)TRUE;
- }
-
- switch (msg) {
- case WM_CLOSE:
- mplayer_put_key(KEY_CLOSE_WIN);
-
- return 0;
-
- case WM_CHAR:
- {
- USHORT fsFlags = SHORT1FROMMP(mp1);
- UCHAR uchScan = CHAR4FROMMP(mp1);
- USHORT usCh = SHORT1FROMMP(mp2);
- USHORT usVk = SHORT2FROMMP(mp2);
- int mpkey;
-
- if (fsFlags & KC_KEYUP)
- break;
-
- if (fsFlags & KC_SCANCODE) {
- mpkey = lookup_keymap_table(m_keypad_map, uchScan);
- if (mpkey) {
- // distinguish KEY_KP0 and KEY_KPINS
- if (mpkey == KEY_KP0 && usCh != '0')
- mpkey = KEY_KPINS;
-
- // distinguish KEY_KPDEC and KEY_KPDEL
- if (mpkey == KEY_KPDEC && usCh != '.')
- mpkey = KEY_KPDEL;
-
- mplayer_put_key(mpkey);
-
- return (MRESULT)TRUE;
- }
- }
-
- if (fsFlags & KC_VIRTUALKEY) {
- mpkey = lookup_keymap_table(m_vk_map, usVk);
- if (mpkey) {
- mplayer_put_key(mpkey);
-
- return (MRESULT)TRUE;
- }
- }
-
- if ((fsFlags & KC_CHAR) && !HIBYTE(usCh))
- mplayer_put_key(usCh);
-
- return (MRESULT)TRUE;
- }
-
- case WM_BUTTON1DOWN:
- case WM_BUTTON3DOWN:
- case WM_BUTTON2DOWN:
- case WM_BUTTON1DBLCLK:
- case WM_BUTTON3DBLCLK:
- case WM_BUTTON2DBLCLK:
- if (WinQueryFocus(HWND_DESKTOP) != hwnd)
- WinSetFocus(HWND_DESKTOP, hwnd);
- else if (!vo_nomouse_input)
- mplayer_put_key(lookup_keymap_table(m_mouse_map, msg));
-
- return (MRESULT)TRUE;
-
- case WM_PAINT:
- {
- HPS hps;
- RECTL rcl, rclDst;
- PRECTL prcl = NULL;
- HRGN hrgn, hrgnDst;
- RGNRECT rgnCtl;
-
- // get a current movie area
- kvaAdjustDstRect(&m_int.kvas.rclSrcRect, &rclDst);
-
- // get a current invalidated area
- hps = WinBeginPaint(hwnd, NULLHANDLE, &rcl);
-
- // create a region for an invalidated area
- hrgn = GpiCreateRegion(hps, 1, &rcl);
- // create a region for a movie area
- hrgnDst = GpiCreateRegion(hps, 1, &rclDst);
-
- // exclude a movie area from an invalidated area
- GpiCombineRegion(hps, hrgn, hrgn, hrgnDst, CRGN_DIFF);
-
- // get rectangles from the region
- rgnCtl.ircStart = 1;
- rgnCtl.ulDirection = RECTDIR_LFRT_TOPBOT;
- GpiQueryRegionRects(hps, hrgn, NULL, &rgnCtl, NULL);
-
- if (rgnCtl.crcReturned > 0) {
- rgnCtl.crc = rgnCtl.crcReturned;
- prcl = malloc(sizeof(RECTL) * rgnCtl.crcReturned);
- }
-
- // draw black bar if needed
- if (prcl && GpiQueryRegionRects(hps, hrgn, NULL, &rgnCtl, prcl)) {
- int i;
-
- for (i = 0; i < rgnCtl.crcReturned; i++)
- WinFillRect(hps, &prcl[i], CLR_BLACK);
- }
-
- free(prcl);
-
- GpiDestroyRegion(hps, hrgnDst);
- GpiDestroyRegion(hps, hrgn);
-
- WinEndPaint(hps);
-
- return 0;
- }
- }
-
- return WinDefWindowProc(hwnd, msg, mp1, mp2);
-}
-
-// Change process type from VIO to PM to use PM APIs.
-static void morphToPM(void)
-{
- PPIB pib;
-
- DosGetInfoBlocks(NULL, &pib);
-
- // Change flag from VIO to PM:
- if (pib->pib_ultype == 2)
- pib->pib_ultype = 3;
-}
-
-static int preinit(const char *arg)
-{
- HWND hwndParent;
- ULONG flFrameFlags;
- ULONG kvaMode = 0;
-
- int fUseSnap = 0;
- int fUseWO = 0;
- int fUseDive = 0;
- int fFixT23 = 0;
-
- const opt_t subopts[] = {
- {"snap", OPT_ARG_BOOL, &fUseSnap, NULL},
- {"wo", OPT_ARG_BOOL, &fUseWO, NULL},
- {"dive", OPT_ARG_BOOL, &fUseDive, NULL},
- {"t23", OPT_ARG_BOOL, &fFixT23, NULL},
- {NULL, 0, NULL, NULL}
- };
-
- PCSZ pcszVideoModeStr[3] = {"DIVE", "WarpOverlay!", "SNAP"};
-
- if (subopt_parse(arg, subopts) != 0)
- return -1;
-
- morphToPM();
-
- memset(&m_int, 0, sizeof(m_int));
-
- 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));
-
- if (WinID == -1) {
- hwndParent = HWND_DESKTOP;
- flFrameFlags = FCF_SYSMENU | FCF_TITLEBAR | FCF_MINMAX |
- FCF_SIZEBORDER | FCF_TASKLIST;
- } else {
- ULONG ulStyle;
-
- hwndParent = HWNDFROMWINID(WinID);
- flFrameFlags = 0;
-
- // Prevent a parent window from painting over our window
- ulStyle = WinQueryWindowULong(hwndParent, QWL_STYLE);
- WinSetWindowULong(hwndParent, QWL_STYLE, ulStyle | WS_CLIPCHILDREN);
- }
-
- m_int.hwndFrame =
- WinCreateStdWindow(hwndParent, // 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.fFixT23 = fFixT23;
-
- if (m_int.fFixT23)
- m_int.pfnwpOldFrame = WinSubclassWindow(m_int.hwndFrame,
- NewFrameWndProc);
-
- if (!!fUseSnap + !!fUseWO + !!fUseDive > 1)
- mp_msg(MSGT_VO, MSGL_WARN,"KVA: Multiple mode specified!!!\n");
-
- if (fUseSnap)
- kvaMode = KVAM_SNAP;
- else if (fUseWO)
- kvaMode = KVAM_WO;
- else if (fUseDive)
- kvaMode = KVAM_DIVE;
- else
- kvaMode = KVAM_AUTO;
-
- if (kvaInit(kvaMode, m_int.hwndClient, vo_colorkey)) {
- mp_msg(MSGT_VO, MSGL_ERR, "KVA: Init failed!!!\n");
-
- return -1;
- }
-
- kvaCaps(&m_int.kvac);
-
- mp_msg(MSGT_VO, MSGL_V, "KVA: Selected video mode = %s\n",
- pcszVideoModeStr[m_int.kvac.ulMode - 1]);
-
- kvaDisableScreenSaver();
-
- // Might cause PM DLLs to be loaded which incorrectly enable SIG_FPE,
- // so mask off all floating-point exceptions.
- _control87(MCW_EM, MCW_EM);
-
- return 0;
-}
-
-static void uninit(void)
-{
- kvaEnableScreenSaver();
-
- imgFree();
-
- sws_freeContext(m_int.sws);
-
- if (m_int.hwndFrame != NULLHANDLE) {
- kvaResetAttr();
- kvaDone();
-
- if (m_int.fFixT23)
- WinSubclassWindow(m_int.hwndFrame, m_int.pfnwpOldFrame);
-
- 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;
-
- mp_msg(MSGT_VO, MSGL_V,
- "KVA: Using 0x%X (%s) image format, vo_config_count = %d\n",
- format, vo_format_name(format), vo_config_count);
-
- imgFree();
-
- if (query_format_info(format, &m_int.fHWAccel, &m_int.fcc, &m_int.bpp,
- &m_int.nChromaShift))
- return 1;
-
- m_int.iImageFormat = format;
-
- // if there is no hw accel for given format,
- // try any format supported by hw accel
- if (!m_int.fHWAccel) {
- int dstFormat = 0;
-
- sws_freeContext(m_int.sws);
-
- if (m_int.kvac.ulInputFormatFlags & KVAF_YV12)
- dstFormat = IMGFMT_YV12;
- else if (m_int.kvac.ulInputFormatFlags & KVAF_YUY2)
- dstFormat = IMGFMT_YUY2;
- else if (m_int.kvac.ulInputFormatFlags & KVAF_YVU9)
- dstFormat = IMGFMT_YVU9;
- else if (m_int.kvac.ulInputFormatFlags & KVAF_BGR24)
- dstFormat = IMGFMT_BGR24;
- else if (m_int.kvac.ulInputFormatFlags & KVAF_BGR16)
- dstFormat = IMGFMT_BGR16;
- else if (m_int.kvac.ulInputFormatFlags & KVAF_BGR15)
- dstFormat = IMGFMT_BGR15;
-
- if (query_format_info(dstFormat, NULL, &m_int.fcc, NULL, NULL))
- return 1;
-
- m_int.sws = sws_getContextFromCmdLine(width, height, format,
- width, height, dstFormat);
- }
-
- mp_msg(MSGT_VO, MSGL_V, "KVA: Selected FOURCC = %.4s\n", (char *)&m_int.fcc);
-
- 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 = vo_keepaspect ? KVAR_FORCEANY : KVAR_NONE;
- m_int.kvas.ulAspectWidth = d_width;
- m_int.kvas.ulAspectHeight = d_height;
- m_int.kvas.fccSrcColor = m_int.fcc;
- m_int.kvas.fDither = TRUE;
-
- if (kvaSetup(&m_int.kvas)) {
- mp_msg(MSGT_VO, MSGL_ERR, "KVA: Setup failed!!!\n");
-
- return 1;
- }
-
- m_int.lStride = width * m_int.bpp;
-
- imgCreate();
-
- if (WinID == -1) {
- WinSetWindowText(m_int.hwndFrame, title);
-
- // initialize 'vo_fs' only once at first config() call
- if (vo_config_count == 0)
- vo_fs = flags & VOFLAG_FULLSCREEN;
-
- // workaround for T23 laptop with S3 Video by Franz Bakan
- if (!vo_fs && m_int.fFixT23) {
- d_width++;
- d_height++;
- }
-
- m_int.rclDst.xLeft = ((LONG)vo_screenwidth - (LONG)d_width) / 2;
- m_int.rclDst.yBottom = ((LONG)vo_screenheight - (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 (vo_fs) {
- d_width = vo_screenwidth;
- d_height = vo_screenheight;
-
- // 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);
-
- setAspectRatio(KVAR_FORCEANY);
- }
-
- rcl.xLeft = ((LONG)vo_screenwidth - (LONG)d_width) / 2;
- rcl.yBottom = ((LONG)vo_screenheight - (LONG)d_height) /2 ;
- rcl.xRight = rcl.xLeft + d_width;
- rcl.yTop = rcl.yBottom + d_height;
- } else {
- vo_fs = 0;
-
- WinQueryWindowRect(HWNDFROMWINID(WinID), &m_int.rclDst);
- 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 |
- (WinID == -1 ? SWP_ACTIVATE : 0));
-
- WinInvalidateRect(m_int.hwndFrame, NULL, TRUE);
-
- return 0;
-}
-
-static uint32_t get_image(mp_image_t *mpi)
-{
- if (m_int.iImageFormat != mpi->imgfmt)
- return VO_FALSE;
-
- if (mpi->type == MP_IMGTYPE_STATIC || mpi->type == MP_IMGTYPE_TEMP) {
- if (mpi->flags & MP_IMGFLAG_PLANAR) {
- mpi->planes[1] = m_int.planes[1];
- mpi->planes[2] = m_int.planes[2];
-
- mpi->stride[1] = m_int.stride[1];
- mpi->stride[2] = m_int.stride[2];
- }
-
- mpi->planes[0] = m_int.planes[0];
- mpi->stride[0] = m_int.stride[0];
- mpi->flags |= MP_IMGFLAG_DIRECT;
-
- return VO_TRUE;
- }
-
- return VO_FALSE;
-}
-
-static uint32_t draw_image(mp_image_t *mpi)
-{
- // if -dr or -slices then do nothing:
- if (mpi->flags & (MP_IMGFLAG_DIRECT | MP_IMGFLAG_DRAW_CALLBACK))
- return VO_TRUE;
-
- draw_slice(mpi->planes, mpi->stride, mpi->w, mpi->h, 0, 0);
-
- return VO_TRUE;
-}
-
-static int query_format(uint32_t format)
-{
- BOOL fHWAccel;
- int res;
-
- if (query_format_info(format, &fHWAccel, NULL, NULL, NULL))
- return 0;
-
- res = VFCAP_CSP_SUPPORTED | VFCAP_OSD;
- if (fHWAccel) {
- res |= VFCAP_CSP_SUPPORTED_BY_HW | VFCAP_HWSCALE_UP;
-
- if (!m_int.fFixT23)
- res |= VFCAP_HWSCALE_DOWN;
- }
-
- return res;
-}
-
-static int fs_toggle(void)
-{
- RECTL rcl;
-
- vo_fs = !vo_fs;
-
- if (vo_fs) {
- SWP swp;
-
- WinQueryWindowPos(m_int.hwndFrame, &swp);
- m_int.rclDst.xLeft = swp.x;
- m_int.rclDst.yBottom = swp.y;
- m_int.rclDst.xRight = m_int.rclDst.xLeft + swp.cx;
- m_int.rclDst.yTop = m_int.rclDst.yBottom + swp.cy;
- WinCalcFrameRect(m_int.hwndFrame, &m_int.rclDst, TRUE);
-
- if (WinID != -1)
- WinSetParent(m_int.hwndFrame, HWND_DESKTOP, FALSE);
-
- 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 = vo_screenwidth;
- rcl.yTop = vo_screenheight;
-
- setAspectRatio(KVAR_FORCEANY);
- } else {
- if (WinID != -1)
- WinSetParent(m_int.hwndFrame, HWNDFROMWINID(WinID), TRUE);
-
- 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;
-
- setAspectRatio(vo_keepaspect ? KVAR_FORCEANY : KVAR_NONE);
- }
-
- 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 |
- (WinID == -1 ? SWP_ACTIVATE : 0));
-
- return VO_TRUE;
-}
-
-static int 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 int 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_DRAW_IMAGE:
- return draw_image(data);
-
- case VOCTRL_QUERY_FORMAT:
- return query_format(*(uint32_t *)data);
-
- case VOCTRL_FULLSCREEN:
- return fs_toggle();
-
- case VOCTRL_SET_EQUALIZER:
- {
- struct voctrl_set_equalizer_args *args = data;
- color_ctrl_set(args->name, args->value);
- }
-
- case VOCTRL_GET_EQUALIZER:
- {
- struct voctrl_get_equalizer_args *args = data;
- return color_ctrl_get(args->name, args->valueptr);
- }
-
- case VOCTRL_UPDATE_SCREENINFO:
- vo_screenwidth = m_int.kvac.cxScreen;
- vo_screenheight = m_int.kvac.cyScreen;
-
- aspect_save_screenres(vo_screenwidth, vo_screenheight);
-
- return VO_TRUE;
- }
-
- return VO_NOTIMPL;
-}
-
-static int draw_frame(uint8_t *src[])
-{
- return VO_ERROR;
-}
-
-static int draw_slice(uint8_t *src[], int stride[], int w, int h, int x, int y)
-{
- uint8_t *s;
- uint8_t *d;
-
- // copy packed or Y
- d = m_int.planes[0] + m_int.stride[0] * y + x;
- s = src[0];
- mem2agpcpy_pic(d, s, w * m_int.bpp, h, m_int.stride[0], stride[0]);
-
- // YV12 or YVU9
- if (m_int.nChromaShift) {
- w >>= m_int.nChromaShift; h >>= m_int.nChromaShift;
- x >>= m_int.nChromaShift; y >>= m_int.nChromaShift;
-
- // copy U
- d = m_int.planes[1] + m_int.stride[1] * y + x;
- s = src[1];
- mem2agpcpy_pic(d, s, w, h, m_int.stride[1], stride[1]);
-
- // copy V
- d = m_int.planes[2] + m_int.stride[2] * y + x;
- s = src[2];
- mem2agpcpy_pic(d, s, w, h, m_int.stride[2], stride[2]);
- }
-
- return 0;
-}
-
-#define vo_draw_alpha(imgfmt) \
- vo_draw_alpha_##imgfmt(w, h, src, srca, stride, \
- m_int.planes[0] + m_int.stride[0] * y0 + m_int.bpp * x0, \
- m_int.stride[0])
-
-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:
- case IMGFMT_YVU9:
- 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();
-}
-
-static void check_events(void)
-{
- QMSG qm;
-
- // On slave mode, we need to change our window size according to a
- // parent window size
- if (WinID != -1) {
- RECTL rcl;
-
- WinQueryWindowRect(HWNDFROMWINID(WinID), &rcl);
-
- if (rcl.xLeft != m_int.rclParent.xLeft ||
- rcl.yBottom != m_int.rclParent.yBottom ||
- rcl.xRight != m_int.rclParent.xRight ||
- rcl.yTop != m_int.rclParent.yTop) {
- WinSetWindowPos(m_int.hwndFrame, NULLHANDLE,
- rcl.xLeft, rcl.yBottom,
- rcl.xRight - rcl.xLeft, rcl.yTop - rcl.yBottom,
- SWP_SIZE | SWP_MOVE);
-
- m_int.rclParent = rcl;
- }
- }
-
- while (WinPeekMsg(m_int.hab, &qm, NULLHANDLE, 0, 0, PM_REMOVE))
- WinDispatchMsg(m_int.hab, &qm);
-}
diff --git a/loader/ldt_keeper.c b/loader/ldt_keeper.c
index 3f7933426a..a5ae1d6b9a 100644
--- a/loader/ldt_keeper.c
+++ b/loader/ldt_keeper.c
@@ -254,9 +254,6 @@ ldt_fs_t* Setup_LDT_Keeper(void)
printf("Couldn't install fs segment, expect segfault\n");
}
}
-#elif defined(__OS2__)
- /* convert flat addr to sel idx for LDT_SEL() */
- fs_ldt = (uintptr_t)fs_seg >> 16;
#endif
Setup_FS_Segment();
diff --git a/loader/module.c b/loader/module.c
index aa921c52d6..44769b74da 100644
--- a/loader/module.c
+++ b/loader/module.c
@@ -715,29 +715,9 @@ static int dump_component(char* name, int type, void* orig, ComponentParameters
#ifdef EMU_QTX_API
-#ifdef __OS2__
-uint32_t _System DosQueryMem(void *, uint32_t *, uint32_t *);
-#endif
-
static int is_invalid_ptr_handle(void *p)
{
-#ifdef __OS2__
- uint32_t cb = 1;
- uint32_t fl;
-
- if(DosQueryMem(p, &cb, &fl))
- return 1;
-
- // Occasionally, ptr with 'EXEC' attr is passed.
- // On OS/2, however, malloc() never sets 'EXEC' attr.
- // So ptr with 'EXEC' attr is invalid.
- if(fl & 0x04)
- return 1;
-
- return 0;
-#else
return (uint32_t)p >= 0x60000000;
-#endif
}
static uint32_t ret_array[4096];
diff --git a/mplayer.c b/mplayer.c
index 05bcf26fae..1826cd485e 100644
--- a/mplayer.c
+++ b/mplayer.c
@@ -1248,7 +1248,7 @@ static void print_status(struct MPContext *mpctx, double a_pos, bool at_frame)
width = screen_width;
else
width = 80;
-#if defined(__MINGW32__) || defined(__CYGWIN__) || defined(__OS2__)
+#if defined(__MINGW32__) || defined(__CYGWIN__)
/* Windows command line is broken (MinGW's rxvt works, but we
* should not depend on that). */
width--;
@@ -3462,12 +3462,12 @@ static void run_playloop(struct MPContext *mpctx)
double buffered_audio = -1;
while (mpctx->sh_video) { // never loops, for "break;" only
+ struct vo *vo = mpctx->video_out;
vo_pts = mpctx->sh_video->timer * 90000.0;
vo_fps = mpctx->sh_video->fps;
- video_left = mpctx->video_out->hasframe;
- if (!mpctx->video_out->frame_loaded
- && (!mpctx->paused || mpctx->restart_playback)) {
+ video_left = vo->hasframe || vo->frame_loaded;
+ if (!vo->frame_loaded && (!mpctx->paused || mpctx->restart_playback)) {
double frame_time = update_video(mpctx);
mp_dbg(MSGT_AVSYNC, MSGL_DBG2, "*** ftime=%5.3f ***\n", frame_time);
if (mpctx->sh_video->vf_initialized < 0) {
@@ -3478,18 +3478,19 @@ static void run_playloop(struct MPContext *mpctx)
return;
}
video_left = frame_time >= 0;
- if (endpts != MP_NOPTS_VALUE)
- video_left &= mpctx->sh_video->pts < endpts;
if (video_left && !mpctx->restart_playback) {
mpctx->time_frame += frame_time / opts->playback_speed;
adjust_sync(mpctx, frame_time);
}
}
+ if (endpts != MP_NOPTS_VALUE)
+ video_left &= mpctx->sh_video->pts < endpts;
+
// ================================================================
current_module = "vo_check_events";
- vo_check_events(mpctx->video_out);
+ vo_check_events(vo);
#ifdef CONFIG_X11
if (stop_xscreensaver) {
@@ -3508,7 +3509,7 @@ static void run_playloop(struct MPContext *mpctx)
if (!video_left || (mpctx->paused && !mpctx->restart_playback))
break;
- if (!mpctx->video_out->frame_loaded) {
+ if (!vo->frame_loaded) {
sleeptime = 0;
break;
}
@@ -3546,7 +3547,7 @@ static void run_playloop(struct MPContext *mpctx)
mpctx->time_frame = 0;
}
- double vsleep = mpctx->time_frame - mpctx->video_out->flip_queue_offset;
+ double vsleep = mpctx->time_frame - vo->flip_queue_offset;
if (vsleep > 0.050) {
sleeptime = FFMIN(sleeptime, vsleep - 0.040);
break;
@@ -3556,7 +3557,7 @@ static void run_playloop(struct MPContext *mpctx)
//=================== FLIP PAGE (VIDEO BLT): ======================
current_module = "flip_page";
- vo_new_frame_imminent(mpctx->video_out);
+ vo_new_frame_imminent(vo);
struct sh_video *sh_video = mpctx->sh_video;
mpctx->video_pts = sh_video->pts;
update_subtitles(mpctx, sh_video->pts, false);
@@ -3568,12 +3569,13 @@ static void run_playloop(struct MPContext *mpctx)
vf->control(vf, VFCTRL_DRAW_OSD, mpctx->osd);
vo_osd_changed(0);
- mpctx->time_frame -= mpctx->video_out->flip_queue_offset;
+ mpctx->time_frame -= get_relative_time(mpctx);
+ mpctx->time_frame -= vo->flip_queue_offset;
float aq_sleep_time = mpctx->time_frame;
if (mpctx->time_frame > 0.001
&& !(mpctx->sh_video->output_flags & VFCAP_TIMER))
mpctx->time_frame = timing_sleep(mpctx, mpctx->time_frame);
- mpctx->time_frame += mpctx->video_out->flip_queue_offset;
+ mpctx->time_frame += vo->flip_queue_offset;
unsigned int t2 = GetTimer();
/* Playing with playback speed it's possible to get pathological
@@ -3582,7 +3584,7 @@ static void run_playloop(struct MPContext *mpctx)
double time_frame = FFMAX(mpctx->time_frame, -1);
unsigned int pts_us = mpctx->last_time + time_frame * 1e6;
int duration = -1;
- double pts2 = mpctx->video_out->next_pts2;
+ double pts2 = vo->next_pts2;
if (pts2 != MP_NOPTS_VALUE && opts->correct_pts &&
!mpctx->restart_playback) {
// expected A/V sync correction is ignored
@@ -3596,11 +3598,11 @@ static void run_playloop(struct MPContext *mpctx)
diff = 10;
duration = diff * 1e6;
}
- vo_flip_page(mpctx->video_out, pts_us | 1, duration);
+ vo_flip_page(vo, pts_us | 1, duration);
mpctx->last_vo_flip_duration = (GetTimer() - t2) * 0.000001;
vout_time_usage += mpctx->last_vo_flip_duration;
- if (mpctx->video_out->driver->flip_page_timed) {
+ if (vo->driver->flip_page_timed) {
// No need to adjust sync based on flip speed
mpctx->last_vo_flip_duration = 0;
// For print_status - VO call finishing early is OK for sync
@@ -3806,8 +3808,9 @@ static void run_playloop(struct MPContext *mpctx)
static int read_keys(void *ctx, int fd)
{
- getch2(ctx);
- return MP_INPUT_NOTHING;
+ if (getch2(ctx))
+ return MP_INPUT_NOTHING;
+ return MP_INPUT_DEAD;
}
static bool attachment_is_font(struct demux_attachment *att)
diff --git a/osdep/getch2-os2.c b/osdep/getch2-os2.c
deleted file mode 100644
index 05e408ff45..0000000000
--- a/osdep/getch2-os2.c
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- * OS/2 TermIO
- *
- * Copyright (c) 2007 KO Myung-Hun (komh@chollian.net)
- *
- * This file is part of MPlayer.
- *
- * MPlayer 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.
- *
- * MPlayer 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 MPlayer; 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 <string.h>
-
-#include "config.h"
-#include "input/keycodes.h"
-#include "input/input.h"
-#include "mp_fifo.h"
-#include "getch2.h"
-
-#if defined(HAVE_LANGINFO) && defined(CONFIG_ICONV)
-#include <locale.h>
-#include <langinfo.h>
-#endif
-
-int mp_input_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;
-
-static int getch2_internal( void )
-{
- KBDKEYINFO kki;
-
- if( !getch2_status )
- return -1;
-
- if( KbdCharIn( &kki, IO_NOWAIT, 0 ))
- return -1;
-
- // key pressed ?
- if( kki.fbStatus )
- {
- // extended key ?
- if(( kki.chChar == 0x00 ) || ( kki.chChar == 0xE0 ))
- {
- 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
- {
- switch( kki.chChar )
- {
- case 0x08 : // Backspace
- return KEY_BS;
-
- case 0x1B : // Esc
- return KEY_ESC;
-
- case 0x0D : // Enter
- // Keypad Enter ?
- if( kki.chScan == 0xE0 )
- return KEY_KPENTER;
- break;
- }
-
- return kki.chChar;
- }
- }
-
- return -1;
-}
-
-void getch2(struct mp_fifo *fifo)
-{
- int key;
-
- key = getch2_internal();
- if( key != -1 )
- mplayer_put_key(fifo, key);
-}
-
-void getch2_enable( void )
-{
- getch2_status = 1;
-}
-
-void getch2_disable( void )
-{
- getch2_status = 0;
-}
-
-#ifdef CONFIG_ICONV
-char *get_term_charset( void )
-{
- char *charset = NULL;
-
-#ifdef HAVE_LANGINFO
- setlocale( LC_CTYPE, "");
- charset = strdup( nl_langinfo( CODESET ));
- setlocale( LC_CTYPE, "C");
-#endif
-
- return charset;
-}
-#endif
diff --git a/osdep/getch2-win.c b/osdep/getch2-win.c
index 326cf1a7d0..f1ccea6359 100644
--- a/osdep/getch2-win.c
+++ b/osdep/getch2-win.c
@@ -158,11 +158,12 @@ static int getch2_internal(void)
return -1;
}
-void getch2(struct mp_fifo *fifo)
+bool getch2(struct mp_fifo *fifo)
{
int r = getch2_internal();
if (r >= 0)
mplayer_put_key(fifo, r);
+ return true;
}
void getch2_enable(void)
diff --git a/osdep/getch2.c b/osdep/getch2.c
index 78e60b2373..f0aa19a2cc 100644
--- a/osdep/getch2.c
+++ b/osdep/getch2.c
@@ -24,7 +24,7 @@
#include "config.h"
//#define HAVE_TERMCAP
-#if !defined(__OS2__) && !defined(__MORPHOS__)
+#if !defined(__MORPHOS__)
#define CONFIG_IOCTL
#endif
@@ -159,11 +159,17 @@ void get_screen_size(void){
#endif
}
-void getch2(struct mp_fifo *fifo)
+bool getch2(struct mp_fifo *fifo)
{
int retval = read(0, &getch2_buf[getch2_len], BUF_LEN-getch2_len);
+ /* Return false on EOF to stop running select() on the FD, as it'd
+ * trigger all the time. Note that it's possible to get temporary
+ * EOF on terminal if the user presses ctrl-d, but that shouldn't
+ * happen if the terminal state change done in getch2_enable()
+ * works.
+ */
if (retval < 1)
- return;
+ return retval;
getch2_len += retval;
while (getch2_len > 0 && (getch2_len > 1 || getch2_buf[0] != 27)) {
@@ -280,6 +286,7 @@ void getch2(struct mp_fifo *fifo)
getch2_buf[i] = getch2_buf[len+i];
mplayer_put_key(fifo, code);
}
+ return true;
}
static volatile int getch2_status=0;
diff --git a/osdep/getch2.h b/osdep/getch2.h
index 8fb346d4f7..4442f1181d 100644
--- a/osdep/getch2.h
+++ b/osdep/getch2.h
@@ -24,6 +24,8 @@
#ifndef MPLAYER_GETCH2_H
#define MPLAYER_GETCH2_H
+#include <stdbool.h>
+
#include "config.h"
/* Screen size. Initialized by load_termcap() and get_screen_size() */
@@ -45,7 +47,7 @@ void getch2_disable(void);
/* Read a character or a special key code (see keycodes.h) */
struct mp_fifo;
-void getch2(struct mp_fifo *fifo);
+bool getch2(struct mp_fifo *fifo);
#ifdef CONFIG_ICONV
/**
@@ -58,8 +60,8 @@ void getch2(struct mp_fifo *fifo);
char *get_term_charset(void);
#endif
-#if defined(__MINGW32__) || defined(__OS2__)
-/* slave cmd function for Windows and OS/2 */
+#if defined(__MINGW32__)
+// slave cmd function for Windows
int mp_input_slave_cmd_func(int fd,char* dest,int size);
#define USE_FD0_CMD_SELECT 0
#define MP_INPUT_SLAVE_CMD_FUNC mp_input_slave_cmd_func
diff --git a/osdep/mmap-os2.c b/osdep/mmap-os2.c
deleted file mode 100644
index 61fcc4f5db..0000000000
--- a/osdep/mmap-os2.c
+++ /dev/null
@@ -1,211 +0,0 @@
-/*
- * very simple implementation of mmap() for OS/2
- *
- * Copyright (c) 2008 KO Myung-Hun (komh@chollian.net)
- *
- * This file is part of MPlayer.
- *
- * MPlayer 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.
- *
- * MPlayer 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 MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#define INCL_DOS
-#include <os2.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <io.h>
-#include <unistd.h>
-#include <sys/types.h>
-
-#include "config.h"
-#include "mmap.h"
-#include "mmap_anon.h"
-
-typedef struct os2_mmap_s
-{
- void *addr;
- size_t len;
- int flags;
- struct os2_mmap_s *prev;
- struct os2_mmap_s *next;
-} os2_mmap;
-static os2_mmap *m_mmap = NULL;
-
-void *mmap( void *addr, size_t len, int prot, int flags, int fildes, off_t off )
-{
- os2_mmap *new_mmap;
-
- ULONG fl;
- ULONG rc;
-
- void *ret;
-
- if( prot & PROT_WRITE )
- {
- if( flags & MAP_SHARED )
- return MAP_FAILED;
-
- if( !( flags & MAP_PRIVATE ))
- return MAP_FAILED;
- }
-
- if( flags & MAP_FIXED )
- {
- ULONG cb;
-
- cb = len;
- rc = DosQueryMem( addr, &cb, &fl );
- if( rc || ( cb < len ))
- return MAP_FAILED;
-
- rc = DosSetMem( addr, len, fPERM );
- if( rc )
- return MAP_FAILED;
-
- ret = addr;
- }
- else
- {
- // Allocate tiled memory compatible with 16-bit selectors
- // 'fs_seg' in 'ldt_keeper.c' need this attribute
- rc = DosAllocMem( &ret, len, fALLOC );
- if( rc )
- return MAP_FAILED;
- }
-
- new_mmap = malloc( sizeof( os2_mmap ));
- new_mmap->addr = ret;
- new_mmap->len = len;
- new_mmap->flags = flags;
- new_mmap->prev = m_mmap;
- new_mmap->next = NULL;
-
- if( m_mmap )
- m_mmap->next = new_mmap;
- m_mmap = new_mmap;
-
- if( !( flags & MAP_ANON ))
- {
- int pos;
-
- /* Now read in the file */
- if(( pos = lseek( fildes, off, SEEK_SET )) == -1)
- {
- munmap( ret, len );
-
- return MAP_FAILED;
- }
-
- read( fildes, ret, len );
- lseek( fildes, pos, SEEK_SET ); /* Restore the file pointer */
- }
-
- fl = 0;
-
- if( prot & PROT_READ )
- fl |= PAG_READ;
-
- if( prot & PROT_WRITE )
- fl |= PAG_WRITE;
-
- if( prot & PROT_EXEC )
- fl |= PAG_EXECUTE;
-
- if( prot & PROT_NONE )
- fl |= PAG_GUARD;
-
- rc = DosSetMem( ret, len, fl );
- if( rc )
- {
- munmap( ret, len );
-
- return MAP_FAILED;
- }
-
- return ret;
-}
-
-int munmap( void *addr, size_t len )
-{
- os2_mmap *mm;
-
- for( mm = m_mmap; mm; mm = mm->prev )
- {
- if( mm->addr == addr )
- break;
- }
-
- if( mm )
- {
-
- if( !( mm->flags & MAP_FIXED ))
- DosFreeMem( addr );
-
- if( mm->next )
- mm->next->prev = mm->prev;
-
- if( mm->prev )
- mm->prev->next = mm->next;
-
- if( m_mmap == mm )
- m_mmap = mm->prev;
-
- free( mm );
-
- return 0;
- }
-
- return -1;
-}
-
-int mprotect( void *addr, size_t len, int prot )
-{
- os2_mmap *mm;
-
- for( mm = m_mmap; mm; mm = mm->prev )
- {
- if( mm->addr == addr )
- break;
- }
-
- if( mm )
- {
- ULONG fl;
-
- fl = 0;
-
- if( prot & PROT_READ )
- fl |= PAG_READ;
-
- if( prot & PROT_WRITE )
- fl |= PAG_WRITE;
-
- if( prot & PROT_EXEC )
- fl |= PAG_EXECUTE;
-
- if( prot & PROT_NONE )
- fl |= PAG_GUARD;
-
- if( DosSetMem( addr, len, fl ) == 0 )
- return 0;
- }
-
- return -1;
-}
-
-void *mmap_anon( void *addr, size_t len, int prot, int flags, off_t off )
-{
- return mmap( addr, len, prot, flags | MAP_ANON, -1, off );
-}
diff --git a/osdep/osdep.h b/osdep/osdep.h
deleted file mode 100644
index 654309c015..0000000000
--- a/osdep/osdep.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Header in order to include OS-specific headers, macros, types and so on
- *
- * Copyright (c) 2010 by KO Myung-Hun (komh@chollian.net)
- *
- * This file is part of MPlayer.
- *
- * MPlayer 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.
- *
- * MPlayer 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 MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifndef MPLAYER_OSDEP_H
-#define MPLAYER_OSDEP_H
-
-#ifdef __OS2__
-#define INCL_DOS
-#define INCL_DOSDEVIOCTL
-#include <os2.h>
-
-#include <process.h> /* getpid() */
-
-#define REALTIME_PRIORITY_CLASS MAKESHORT(0, PRTYC_TIMECRITICAL)
-#define HIGH_PRIORITY_CLASS MAKESHORT(PRTYD_MAXIMUM, PRTYC_REGULAR)
-#define ABOVE_NORMAL_PRIORITY_CLASS MAKESHORT(PRTYD_MAXIMUM / 2, PRTYC_REGULAR)
-#define NORMAL_PRIORITY_CLASS MAKESHORT(0, PRTYC_REGULAR)
-#define BELOW_NORMAL_PRIORITY_CLASS MAKESHORT(PRTYD_MAXIMUM, PRTYC_IDLETIME)
-#define IDLE_PRIORITY_CLASS MAKESHORT(0, PRTYC_IDLETIME)
-
-#define SetPriorityClass(pid, prio) \
- DosSetPriority(PRTYS_PROCESS, \
- HIBYTE(prio), \
- LOBYTE(prio), \
- pid)
-
-#define GetCurrentProcess() getpid()
-#endif /* __OS2__ */
-
-#endif /* MPLAYER_OSDEP_H */
-
diff --git a/osdep/priority.c b/osdep/priority.c
index 0803a3299e..dfa2c54ff5 100644
--- a/osdep/priority.c
+++ b/osdep/priority.c
@@ -20,8 +20,6 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#include "osdep.h"
-
#if defined(__MINGW32__) || defined(__CYGWIN__)
#include <windows.h>
#endif
diff --git a/path.c b/path.c
index b6b87d4e9b..785c48eec9 100644
--- a/path.c
+++ b/path.c
@@ -46,7 +46,6 @@
#include "talloc.h"
-#include "osdep/osdep.h"
#include "osdep/io.h"
char *get_path(const char *filename){
@@ -82,25 +81,6 @@ char *get_path(const char *filename){
exedir[imax]='\0';
homedir = exedir;
}
-#elif defined(__OS2__)
- {
- PPIB ppib;
- char path[260];
-
- // Get process info blocks
- DosGetInfoBlocks(NULL, &ppib);
-
- // Get full path of the executable
- DosQueryModuleName(ppib->pib_hmte, sizeof( path ), path);
-
- // Truncate name part including last backslash
- *strrchr(path, '\\') = 0;
-
- // Convert backslash to slash
- _fnslashify(path);
-
- homedir = path;
- }
#else
return NULL;
#endif
diff --git a/stream/cache2.c b/stream/cache2.c
index 4aed786cb6..47bc76a4f9 100644
--- a/stream/cache2.c
+++ b/stream/cache2.c
@@ -45,10 +45,6 @@
#if defined(__MINGW32__)
#include <windows.h>
static void ThreadProc( void *s );
-#elif defined(__OS2__)
-#define INCL_DOS
-#include <os2.h>
-static void ThreadProc( void *s );
#elif defined(PTHREAD_CACHE)
#include <pthread.h>
static void *ThreadProc(void *s);
@@ -453,8 +449,6 @@ int stream_enable_cache(stream_t *stream,int size,int min,int seek_limit){
s->stream=stream2;
#if defined(__MINGW32__)
stream->cache_pid = _beginthread( ThreadProc, 0, s );
-#elif defined(__OS2__)
- stream->cache_pid = _beginthread( ThreadProc, NULL, 256 * 1024, s );
#else
{
pthread_t tid;
@@ -499,7 +493,7 @@ err_out:
}
#if !FORKED_CACHE
-#if defined(__MINGW32__) || defined(__OS2__)
+#if defined(__MINGW32__)
static void ThreadProc( void *s ){
cache_mainloop(s);
_endthread();
diff --git a/stream/stream_cddb.c b/stream/stream_cddb.c
index aab557ab86..339f8a75f1 100644
--- a/stream/stream_cddb.c
+++ b/stream/stream_cddb.c
@@ -66,8 +66,6 @@
#include "mpbswap.h"
#endif
-#include "osdep/osdep.h"
-
#include "cdd.h"
#include "mpcommon.h"
#include "stream.h"
@@ -126,78 +124,6 @@ static int read_toc(const char *dev)
}
CloseHandle(drive);
-#elif defined(__OS2__)
- UCHAR auchParamDisk[4] = {'C', 'D', '0', '1'};
-
- struct {
- BYTE bFirstTrack;
- BYTE bLastTrack;
- BYTE bLeadOutF;
- BYTE bLeadOutS;
- BYTE bLeadOutM;
- BYTE bLeadOutReserved;
- } __attribute__((packed)) sDataDisk;
-
- struct {
- UCHAR auchSign[4];
- BYTE bTrack;
- } __attribute__((packed)) sParamTrack = {{'C', 'D', '0', '1'},};
-
- struct {
- BYTE bStartF;
- BYTE bStartS;
- BYTE bStartM;
- BYTE bStartReserved;
- BYTE bControlInfo;
- } __attribute__((packed)) sDataTrack;
-
- HFILE hcd;
- ULONG ulAction;
- ULONG ulParamLen;
- ULONG ulDataLen;
- ULONG rc;
-
- rc = DosOpen(dev, &hcd, &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) {
- mp_tmsg(MSGT_OPEN, MSGL_ERR, "Failed to read TOC.\n");
- return -1;
- }
-
- rc = DosDevIOCtl(hcd, IOCTL_CDROMAUDIO, CDROMAUDIO_GETAUDIODISK,
- auchParamDisk, sizeof(auchParamDisk), &ulParamLen,
- &sDataDisk, sizeof(sDataDisk), &ulDataLen);
- if (!rc) {
- first = sDataDisk.bFirstTrack - 1;
- last = sDataDisk.bLastTrack;
- for (i = first; i <= last; i++) {
- if (i == last) {
- sDataTrack.bStartM = sDataDisk.bLeadOutM;
- sDataTrack.bStartS = sDataDisk.bLeadOutS;
- sDataTrack.bStartF = sDataDisk.bLeadOutF;
- } else {
- sParamTrack.bTrack = i + 1;
- rc = DosDevIOCtl(hcd, IOCTL_CDROMAUDIO, CDROMAUDIO_GETAUDIOTRACK,
- &sParamTrack, sizeof(sParamTrack), &ulParamLen,
- &sDataTrack, sizeof(sDataTrack), &ulDataLen);
- if (rc)
- break;
- }
-
- cdtoc[i].min = sDataTrack.bStartM;
- cdtoc[i].sec = sDataTrack.bStartS;
- cdtoc[i].frame = sDataTrack.bStartF;
- }
- }
-
- DosClose(hcd);
-
- if (rc) {
- mp_tmsg(MSGT_OPEN, MSGL_ERR, "Failed to read TOC.\n");
- return -1;
- }
#else
int drive;
drive = open(dev, O_RDONLY | O_NONBLOCK);
diff --git a/stream/stream_vcd.c b/stream/stream_vcd.c
index 5d2eecc27b..e06e381f59 100644
--- a/stream/stream_vcd.c
+++ b/stream/stream_vcd.c
@@ -22,8 +22,6 @@
#include <windows.h>
#endif
-#include "osdep/osdep.h"
-
#include "mp_msg.h"
#include "stream.h"
#include "m_option.h"
@@ -45,8 +43,6 @@
#include "vcd_read_darwin.h"
#elif defined(__MINGW32__) || defined(__CYGWIN__)
#include "vcd_read_win32.h"
-#elif defined(__OS2__)
-#include "vcd_read_os2.h"
#else
#include "vcd_read.h"
#endif
@@ -141,12 +137,6 @@ static int open_s(stream_t *stream,int mode, void* opts, int* file_format) {
HANDLE hd;
char device[] = "\\\\.\\?:";
#endif
-#if defined(__OS2__)
- char device[] = "X:";
- HFILE hcd;
- ULONG ulAction;
- ULONG rc;
-#endif
if(mode != STREAM_READ
#if defined(__MINGW32__) || defined(__CYGWIN__)
@@ -170,13 +160,6 @@ static int open_s(stream_t *stream,int mode, void* opts, int* file_format) {
hd = CreateFile(device, GENERIC_READ, FILE_SHARE_READ, NULL,
OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, NULL);
f = _open_osfhandle((long)hd, _O_RDONLY);
-#elif defined(__OS2__)
- device[0] = p->device[0];
- rc = DosOpen(device, &hcd, &ulAction, 0, FILE_NORMAL,
- OPEN_ACTION_OPEN_IF_EXISTS | OPEN_ACTION_FAIL_IF_NEW,
- OPEN_ACCESS_READONLY | OPEN_SHARE_DENYNONE | OPEN_FLAGS_DASD,
- NULL);
- f = rc ? -1 : hcd;
#else
f=open(p->device,O_RDONLY);
#endif
diff --git a/stream/vcd_read_os2.h b/stream/vcd_read_os2.h
deleted file mode 100644
index 1df2abec89..0000000000
--- a/stream/vcd_read_os2.h
+++ /dev/null
@@ -1,242 +0,0 @@
-/*
- * implementation of VCD IO for OS/2
- *
- * Copyright (c) 2009 KO Myung-Hun (komh@chollian.net)
- *
- * This file is part of MPlayer.
- *
- * MPlayer 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.
- *
- * MPlayer 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 MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifndef MPLAYER_VCD_READ_OS2_H
-#define MPLAYER_VCD_READ_OS2_H
-
-#include "mp_msg.h"
-
-struct __attribute__((packed)) msf {
- BYTE bFrame;
- BYTE bSecond;
- BYTE bMinute;
- BYTE bReserved;
-};
-
-typedef struct {
- HFILE hcd;
- struct msf msfCurrent;
- int iFirstTrack;
- int iLastTrack;
- struct msf msfLeadOut;
- BYTE abVCDSector[VCD_SECTOR_SIZE];
-} mp_vcd_priv_t;
-
-static inline void vcd_set_msf(mp_vcd_priv_t *vcd, unsigned sect)
-{
- sect += 150;
- vcd->msfCurrent.bFrame = sect % 75;
- sect = sect / 75;
- vcd->msfCurrent.bSecond = sect % 60;
- sect = sect / 60;
- vcd->msfCurrent.bMinute = sect;
-}
-
-static inline unsigned vcd_get_msf(mp_vcd_priv_t *vcd)
-{
- return vcd->msfCurrent.bFrame +
- (vcd->msfCurrent.bSecond + vcd->msfCurrent.bMinute * 60) * 75 - 150;
-}
-
-static int vcd_seek_to_track(mp_vcd_priv_t *vcd, int track)
-{
- struct {
- UCHAR auchSign[4];
- BYTE bTrack;
- } __attribute__((packed)) sParam = {{'C', 'D', '0', '1'},};
-
- struct {
- struct msf msfStart;
- BYTE bControlInfo;
- } __attribute__((packed)) sData;
-
- ULONG ulParamLen;
- ULONG ulDataLen;
- ULONG rc;
-
- sParam.bTrack = track;
- rc = DosDevIOCtl(vcd->hcd, IOCTL_CDROMAUDIO, CDROMAUDIO_GETAUDIOTRACK,
- &sParam, sizeof(sParam), &ulParamLen,
- &sData, sizeof(sData), &ulDataLen);
- if (rc) {
- mp_msg(MSGT_STREAM, MSGL_ERR, "DosDevIOCtl(GETAUDIOTRACK) = 0x%lx\n", rc);
- return -1;
- }
-
- vcd->msfCurrent = sData.msfStart;
-
- return VCD_SECTOR_DATA * vcd_get_msf(vcd);
-}
-
-static int vcd_get_track_end(mp_vcd_priv_t *vcd, int track)
-{
- if (track < vcd->iLastTrack)
- return vcd_seek_to_track(vcd, track + 1);
-
- vcd->msfCurrent = vcd->msfLeadOut;
-
- return VCD_SECTOR_DATA * vcd_get_msf(vcd);
-}
-
-static mp_vcd_priv_t *vcd_read_toc(int fd)
-{
- mp_vcd_priv_t *vcd;
-
- UCHAR auchParamDisk[4] = {'C', 'D', '0', '1'};
-
- struct {
- BYTE bFirstTrack;
- BYTE bLastTrack;
- struct msf msfLeadOut;
- } __attribute__((packed)) sDataDisk;
-
- struct {
- UCHAR auchSign[4];
- BYTE bTrack;
- } __attribute__((packed)) sParamTrack = {{'C', 'D', '0', '1'},};
-
- struct {
- struct msf msfStart;
- BYTE bControlInfo;
- } __attribute__((packed)) sDataTrack;
-
- ULONG ulParamLen;
- ULONG ulDataLen;
- ULONG rc;
- int i, iMinute = 0, iSecond = 0, iFrame = 0;
-
- rc = DosDevIOCtl(fd, IOCTL_CDROMAUDIO, CDROMAUDIO_GETAUDIODISK,
- auchParamDisk, sizeof(auchParamDisk), &ulParamLen,
- &sDataDisk, sizeof(sDataDisk), &ulDataLen);
- if (rc) {
- mp_msg(MSGT_OPEN, MSGL_ERR, "DosDevIOCtl(GETAUDIODISK) = 0x%lx\n", rc);
- return NULL;
- }
-
- mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_VCD_START_TRACK=%d\n", sDataDisk.bFirstTrack);
- mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_VCD_END_TRACK=%d\n", sDataDisk.bLastTrack);
-
- for (i = sDataDisk.bFirstTrack; i <= sDataDisk.bLastTrack + 1; i++) {
- if (i <= sDataDisk.bLastTrack) {
- sParamTrack.bTrack = i;
- rc = DosDevIOCtl(fd, IOCTL_CDROMAUDIO, CDROMAUDIO_GETAUDIOTRACK,
- &sParamTrack, sizeof(sParamTrack), &ulParamLen,
- &sDataTrack, sizeof(sDataTrack), &ulDataLen);
- if (rc) {
- mp_msg(MSGT_OPEN, MSGL_ERR, "DosDevIOCtl(GETAUDIOTRACK) = 0x%lx\n", rc);
- return NULL;
- }
-
- mp_msg(MSGT_OPEN, MSGL_INFO, "track %02d: adr=%d ctrl=%d %02d:%02d:%02d\n",
- i,
- sDataTrack.bControlInfo & 0x0F,
- sDataTrack.bControlInfo >> 4,
- sDataTrack.msfStart.bMinute,
- sDataTrack.msfStart.bSecond,
- sDataTrack.msfStart.bFrame);
- } else
- sDataTrack.msfStart = sDataDisk.msfLeadOut;
-
- if (mp_msg_test(MSGT_IDENTIFY, MSGL_INFO)) {
- if (i > sDataDisk.bFirstTrack) {
- iMinute = sDataTrack.msfStart.bMinute - iMinute;
- iSecond = sDataTrack.msfStart.bSecond - iSecond;
- iFrame = sDataTrack.msfStart.bFrame - iFrame;
- if (iFrame < 0) {
- iFrame += 75;
- iSecond--;
- }
- if (iSecond < 0) {
- iSecond += 60;
- iMinute--;
- }
- mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_VCD_TRACK_%d_MSF=%02d:%02d:%02d\n",
- i - 1, iMinute, iSecond, iFrame);
- }
-
- iMinute = sDataTrack.msfStart.bMinute;
- iSecond = sDataTrack.msfStart.bSecond;
- iFrame = sDataTrack.msfStart.bFrame;
- }
- }
-
- vcd = calloc(1, sizeof(mp_vcd_priv_t));
- vcd->hcd = fd;
- vcd->iFirstTrack = sDataDisk.bFirstTrack;
- vcd->iLastTrack = sDataDisk.bLastTrack;
- vcd->msfLeadOut = sDataDisk.msfLeadOut;
-
- return vcd;
-}
-
-static int vcd_end_track(mp_vcd_priv_t* vcd)
-{
- return vcd->iLastTrack;
-}
-
-static int vcd_read(mp_vcd_priv_t *vcd, char *mem)
-{
- struct {
- UCHAR auchSign[4];
- BYTE bAddrMode;
- USHORT usSectors;
- struct msf msfStart;
- BYTE bReserved;
- BYTE bInterleavedSize;
- } __attribute__((packed)) sParam = {{'C', 'D', '0', '1'}, 1, 1,};
-
- ULONG ulParamLen;
- ULONG ulDataLen;
- ULONG rc;
-
- /* lead-out ? */
- if (vcd->msfCurrent.bMinute == vcd->msfLeadOut.bMinute &&
- vcd->msfCurrent.bSecond == vcd->msfLeadOut.bSecond &&
- vcd->msfCurrent.bFrame == vcd->msfLeadOut.bFrame)
- return 0;
-
- sParam.msfStart = vcd->msfCurrent;
- rc = DosDevIOCtl(vcd->hcd, IOCTL_CDROMDISK, CDROMDISK_READLONG,
- &sParam, sizeof(sParam), &ulParamLen,
- vcd->abVCDSector, sizeof(vcd->abVCDSector), &ulDataLen);
- if (rc) {
- mp_msg(MSGT_STREAM, MSGL_ERR, "DosDevIOCtl(READLONG) = 0x%lx\n", rc);
- return 0;
- }
-
- memcpy(mem, &vcd->abVCDSector[VCD_SECTOR_OFFS], VCD_SECTOR_DATA);
-
- vcd->msfCurrent.bFrame++;
- if (vcd->msfCurrent.bFrame == 75) {
- vcd->msfCurrent.bFrame = 0;
- vcd->msfCurrent.bSecond++;
- if (vcd->msfCurrent.bSecond == 60) {
- vcd->msfCurrent.bSecond = 0;
- vcd->msfCurrent.bMinute++;
- }
- }
-
- return VCD_SECTOR_DATA;
-}
-
-#endif /* MPLAYER_VCD_READ_OS2_H */
-