1
mirror of https://github.com/mpv-player/mpv synced 2024-12-24 07:33:46 +01:00

build: remove OS/2 support

This commit is contained in:
Uoti Urpala 2012-04-06 16:58:39 +03:00
parent b93ed27836
commit e2fc1f640f
20 changed files with 13 additions and 2683 deletions

View File

@ -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
@ -438,7 +437,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
@ -459,8 +457,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

109
configure vendored
View File

@ -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
@ -866,8 +859,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 ;;
@ -936,10 +927,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 ;;
@ -1409,15 +1396,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"
@ -3103,7 +3081,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"
@ -3480,8 +3457,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"
@ -4611,24 +4587,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"
@ -5034,41 +4992,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"
@ -5089,7 +5014,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"
@ -5101,7 +5026,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
@ -5144,7 +5069,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"
@ -5198,8 +5123,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"
@ -5622,7 +5545,7 @@ fi
# Fall back on default directory.
if test -z "$_codecsdir" ; then
_codecsdir="$_libdir/codecs"
mingw32 || os2 && _codecsdir="codecs"
mingw32 && _codecsdir="codecs"
fi
@ -5674,7 +5597,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
@ -6249,7 +6172,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
@ -6302,15 +6225,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"
@ -6433,7 +6347,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
@ -6455,7 +6368,6 @@ CDDA = $_cdda
CDDB = $_cddb
COREAUDIO = $_coreaudio
COREVIDEO = $_corevideo
DART = $_dart
DGA = $_dga
DIRECT3D = $_direct3d
DIRECTFB = $_directfb
@ -6485,8 +6397,6 @@ IVTV = $_ivtv
JACK = $_jack
JOYSTICK = $_joystick
JPEG = $_jpeg
KAI = $_kai
KVA = $_kva
LADSPA = $_ladspa
LIBA52 = $_liba52
LIBASS = $_ass
@ -6787,11 +6697,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
@ -6881,7 +6789,6 @@ $def_gl_x11
$def_gl_sdl
$def_ivtv
$def_jpeg
$def_kva
$def_md5sum
$def_mga
$def_mng

View File

@ -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;

View File

@ -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;
}

View File

@ -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;
}

File diff suppressed because it is too large Load Diff

View File

@ -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();

View File

@ -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];

View File

@ -1247,7 +1247,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--;

View File

@ -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

View File

@ -24,7 +24,7 @@
#include "config.h"
//#define HAVE_TERMCAP
#if !defined(__OS2__) && !defined(__MORPHOS__)
#if !defined(__MORPHOS__)
#define CONFIG_IOCTL
#endif

View File

@ -60,8 +60,8 @@ bool 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

View File

@ -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 );
}

View File

@ -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 */

View File

@ -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

20
path.c
View File

@ -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

View File

@ -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();

View File

@ -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);

View File

@ -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

View File

@ -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 */