summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@mplayer2.org>2012-04-13 17:44:29 +0200
committerwm4 <wm4@mplayer2.org>2012-04-13 17:45:27 +0200
commit47371bdb944652bb17b8b779fae102ce63dd36b7 (patch)
tree495a2b71217a4fefe1c0672fce3d7cf9fabeb2e7
parent4dc0e54d4fffa2b81fbf6fb9b875303638eb1c9a (diff)
parent485f439cfefd4fa8d35f406fd8694e649bd536c8 (diff)
downloadmpv-47371bdb944652bb17b8b779fae102ce63dd36b7.tar.bz2
mpv-47371bdb944652bb17b8b779fae102ce63dd36b7.tar.xz
Merge remote-tracking branch 'origin/master'
Conflicts: libvo/vo_kva.c
-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 paus