mirror of
https://github.com/mpv-player/mpv.git
synced 2026-06-06 20:10:30 +00:00
Remove win32/qt/xanim/real binary codecs loading
Remove the win32 loader - the win32 emulation layer, as well as the
code for using DirectShow/DMO/VFW codecs. Remove loading of xanim,
QuickTime, and RealMedia codecs.
The win32 emulation layer is based on a very old version of wine.
Apparently, wine code was copied and hacked until it was somehow able
to load a limited collection of binary codecs. It poked around in the
code segment of some known binary codecs to disable unsupported win32
API calls to make them work. Example from module.c:
for (i=0;i<5;i++) RVA(0x19e842)[i]=0x90; // make_new_region ?
for (i=0;i<28;i++) RVA(0x19e86d)[i]=0x90; // call__call_CreateCompatibleDC ?
for (i=0;i<5;i++) RVA(0x19e898)[i]=0x90; // jmp_to_call_loadbitmap ?
for (i=0;i<9;i++) RVA(0x19e8ac)[i]=0x90; // call__calls_OLE_shit ?
for (i=0;i<106;i++) RVA(0x261b10)[i]=0x90; // disable threads
Just to show how utterly insane this code is. You wouldn't want even
your worst enemy to have to maintain this. In fact, it seems nobody
made major changes to this code ever since it was committed.
Most formats can be decoded by libavcodecs these days, and the loader
couldn't be used on 64 bit platforms anyway. The same is (probably)
true for the other binary codecs.
General note about how support for win32 codecs could be added back:
It's not possible to replace the win32 loader code by using wine as
library, because modern wine can not be linked with native Linux
programs for certain reasons. It would be possible to to move DirectShow
video decoding into a separate process linked with wine, like the
CoreAVC-for-Linux patches do. There is also the mplayer-ww fork, which
uses the dshownative library to use DirectShow codecs on Windows.
This commit is contained in:
@@ -120,66 +120,17 @@ SRCS_COMMON-$(NETWORKING) += stream/stream_netstream.c \
|
||||
SRCS_COMMON-$(PNG) += libmpcodecs/vd_mpng.c
|
||||
SRCS_COMMON-$(PRIORITY) += osdep/priority.c
|
||||
SRCS_COMMON-$(PVR) += stream/stream_pvr.c
|
||||
SRCS_COMMON-$(QTX_CODECS) += libmpcodecs/ad_qtaudio.c \
|
||||
libmpcodecs/vd_qtvideo.c
|
||||
SRCS_COMMON-$(RADIO) += stream/stream_radio.c
|
||||
SRCS_COMMON-$(RADIO_CAPTURE) += stream/audio_in.c
|
||||
SRCS_COMMON-$(REAL_CODECS) += libmpcodecs/ad_realaud.c \
|
||||
libmpcodecs/vd_realvid.c
|
||||
SRCS_COMMON-$(STREAM_CACHE) += stream/cache2.c
|
||||
|
||||
SRCS_COMMON-$(TV) += stream/stream_tv.c stream/tv.c \
|
||||
stream/frequencies.c stream/tvi_dummy.c
|
||||
SRCS_COMMON-$(TV_BSDBT848) += stream/tvi_bsdbt848.c
|
||||
SRCS_COMMON-$(TV_DSHOW) += stream/tvi_dshow.c \
|
||||
loader/dshow/guids.c \
|
||||
loader/dshow/mediatype.c \
|
||||
|
||||
SRCS_COMMON-$(TV_V4L2) += stream/tvi_v4l2.c stream/audio_in.c
|
||||
SRCS_COMMON-$(VCD) += stream/stream_vcd.c
|
||||
SRCS_COMMON-$(VSTREAM) += stream/stream_vstream.c
|
||||
SRCS_QTX_EMULATION += loader/wrapper.S
|
||||
SRCS_COMMON-$(QTX_EMULATION) += $(SRCS_QTX_EMULATION)
|
||||
SRCS_WIN32_EMULATION += loader/elfdll.c \
|
||||
loader/ext.c \
|
||||
loader/ldt_keeper.c \
|
||||
loader/module.c \
|
||||
loader/pe_image.c \
|
||||
loader/pe_resource.c \
|
||||
loader/registry.c \
|
||||
loader/resource.c \
|
||||
loader/win32.c \
|
||||
|
||||
SRCS_COMMON-$(WIN32_EMULATION) += $(SRCS_WIN32_EMULATION)
|
||||
|
||||
SRCS_COMMON-$(WIN32DLL) += libmpcodecs/ad_acm.c \
|
||||
libmpcodecs/ad_dmo.c \
|
||||
libmpcodecs/ad_dshow.c \
|
||||
libmpcodecs/vd_dmo.c \
|
||||
libmpcodecs/vd_dshow.c \
|
||||
libmpcodecs/vd_vfw.c \
|
||||
libmpcodecs/vd_vfwex.c \
|
||||
libmpdemux/demux_avs.c \
|
||||
loader/afl.c \
|
||||
loader/drv.c \
|
||||
loader/vfl.c \
|
||||
loader/dshow/DS_AudioDecoder.c \
|
||||
loader/dshow/DS_Filter.c \
|
||||
loader/dshow/DS_VideoDecoder.c \
|
||||
loader/dshow/allocator.c \
|
||||
loader/dshow/cmediasample.c \
|
||||
loader/dshow/graph.c \
|
||||
loader/dshow/guids.c \
|
||||
loader/dshow/inputpin.c \
|
||||
loader/dshow/mediatype.c \
|
||||
loader/dshow/outputpin.c \
|
||||
loader/dmo/DMO_AudioDecoder.c \
|
||||
loader/dmo/DMO_VideoDecoder.c \
|
||||
loader/dmo/buffer.c \
|
||||
loader/dmo/dmo.c \
|
||||
loader/dmo/dmo_guids.c \
|
||||
|
||||
SRCS_COMMON-$(XANIM_CODECS) += libmpcodecs/vd_xanim.c
|
||||
|
||||
SRCS_COMMON-$(DUMMY_OSD) += sub/osd_dummy.c
|
||||
SRCS_COMMON-$(LIBASS_OSD) += sub/osd_libass.c
|
||||
@@ -455,10 +406,6 @@ DIRS = . \
|
||||
libmpcodecs/native \
|
||||
libmpdemux \
|
||||
libvo \
|
||||
loader \
|
||||
loader/dshow \
|
||||
loader/dmo \
|
||||
loader/wine \
|
||||
osdep \
|
||||
stream \
|
||||
sub \
|
||||
@@ -575,10 +522,6 @@ libdvdcss/%: CFLAGS := -Ilibdvdcss -D_GNU_SOURCE -DVERSION=\"1.2.10\" $(CFLAGS
|
||||
libdvdnav/%: CFLAGS := -Ilibdvdnav -D_GNU_SOURCE -DHAVE_CONFIG_H -DVERSION=\"MPlayer-custom\" $(CFLAGS)
|
||||
libdvdread4/%: CFLAGS := -Ilibdvdread4 -D_GNU_SOURCE $(CFLAGS_LIBDVDCSS_DVDREAD) $(CFLAGS)
|
||||
|
||||
loader/%: CFLAGS += -fno-omit-frame-pointer $(CFLAGS_NO_OMIT_LEAF_FRAME_POINTER)
|
||||
#loader/%: CFLAGS += -Ddbg_printf=__vprintf -DTRACE=__vprintf -DDETAILED_OUT
|
||||
loader/win32%: CFLAGS += $(CFLAGS_STACKREALIGN)
|
||||
|
||||
stream/stream_dvdnav%: CFLAGS := $(CFLAGS_LIBDVDNAV) $(CFLAGS)
|
||||
|
||||
|
||||
|
||||
@@ -363,7 +363,6 @@ const m_option_t common_opts[] = {
|
||||
#ifdef CONFIG_PRIORITY
|
||||
{"priority", &proc_priority, CONF_TYPE_STRING, 0, 0, 0, NULL},
|
||||
#endif
|
||||
{"codecpath", &codec_path, CONF_TYPE_STRING, 0, 0, 0, NULL},
|
||||
OPT_CHOICE("noconfig", noconfig, CONF_GLOBAL | CONF_NOCFG | CONF_PRE_PARSE,
|
||||
({"off", 0}, {"user", 1}, {"system", 2}, {"all", 3})),
|
||||
|
||||
|
||||
@@ -340,7 +340,6 @@ Optional features:
|
||||
--disable-ftp disable FTP support [enabled]
|
||||
--disable-vstream disable TiVo vstream client support [autodetect]
|
||||
--disable-pthreads disable Posix threads support [autodetect]
|
||||
--disable-w32threads disable Win32 threads support [autodetect]
|
||||
--disable-libass disable subtitle rendering with libass [autodetect]
|
||||
--disable-libass-osd disable OSD rendering with libass [autodetect]
|
||||
--enable-rpath enable runtime linker path for extra libs [disabled]
|
||||
@@ -352,10 +351,6 @@ Codecs:
|
||||
--enable-mng enable MNG input support [autodetect]
|
||||
--enable-jpeg enable JPEG input/output support [autodetect]
|
||||
--enable-libcdio enable libcdio support [autodetect]
|
||||
--disable-win32dll disable Win32 DLL support [disabled]
|
||||
--disable-qtx disable QuickTime codecs support [enabled]
|
||||
--disable-xanim disable XAnim codecs support [enabled]
|
||||
--disable-real disable RealPlayer codecs support [enabled]
|
||||
--enable-libav skip Libav autodetection [autodetect]
|
||||
--enable-faad enable FAAD2 (AAC) [autodetect]
|
||||
--disable-ladspa disable LADSPA plugin support [autodetect]
|
||||
@@ -493,8 +488,6 @@ _dvdreadconfig=dvdread-config
|
||||
_dvdread=auto
|
||||
_dvdread_internal=auto
|
||||
_libdvdcss_internal=auto
|
||||
_xanim=auto
|
||||
_real=auto
|
||||
_live=no
|
||||
_nemesi=auto
|
||||
_lcms2=auto
|
||||
@@ -502,7 +495,6 @@ _xinerama=auto
|
||||
_vm=auto
|
||||
_xf86keysym=auto
|
||||
_alsa=auto
|
||||
_win32dll=no
|
||||
_select=yes
|
||||
_radio=no
|
||||
_radio_capture=no
|
||||
@@ -511,7 +503,6 @@ _radio_bsdbt848=auto
|
||||
_tv=yes
|
||||
_tv_v4l2=auto
|
||||
_tv_bsdbt848=auto
|
||||
_tv_dshow=auto
|
||||
_pvr=auto
|
||||
networking=yes
|
||||
_winsock2_h=auto
|
||||
@@ -531,11 +522,9 @@ _translation=no
|
||||
_libdv=auto
|
||||
_cdda=auto
|
||||
_cddb=auto
|
||||
_qtx=auto
|
||||
_coreaudio=auto
|
||||
_corevideo=auto
|
||||
_cocoa=auto
|
||||
quicktime=auto
|
||||
_macosx_finder=no
|
||||
_macosx_bundle=auto
|
||||
_sortsub=yes
|
||||
@@ -545,7 +534,6 @@ _gethostbyname2=auto
|
||||
_ftp=auto
|
||||
_vstream=auto
|
||||
_pthreads=auto
|
||||
_w32threads=auto
|
||||
_ass=auto
|
||||
_libass_osd=auto
|
||||
_rpath=no
|
||||
@@ -736,10 +724,6 @@ for ac_option do
|
||||
--disable-libdvdcss-internal) _libdvdcss_internal=no ;;
|
||||
--enable-dvdnav) _dvdnav=yes ;;
|
||||
--disable-dvdnav) _dvdnav=no ;;
|
||||
--enable-xanim) _xanim=yes ;;
|
||||
--disable-xanim) _xanim=no ;;
|
||||
--enable-real) _real=yes ;;
|
||||
--disable-real) _real=no ;;
|
||||
--enable-live) _live=yes ;;
|
||||
--disable-live) _live=no ;;
|
||||
--enable-nemesi) _nemesi=yes ;;
|
||||
@@ -760,8 +744,6 @@ for ac_option do
|
||||
--disable-tv-bsdbt848) _tv_bsdbt848=no ;;
|
||||
--enable-tv-v4l2) _tv_v4l2=yes ;;
|
||||
--disable-tv-v4l2) _tv_v4l2=no ;;
|
||||
--enable-tv-dshow) _tv_dshow=yes ;;
|
||||
--disable-tv-dshow) _tv_dshow=no ;;
|
||||
--enable-radio) _radio=yes ;;
|
||||
--enable-radio-capture) _radio_capture=yes ;;
|
||||
--disable-radio-capture) _radio_capture=no ;;
|
||||
@@ -812,8 +794,6 @@ for ac_option do
|
||||
--disable-vstream) _vstream=no ;;
|
||||
--enable-pthreads) _pthreads=yes ;;
|
||||
--disable-pthreads) _pthreads=no ;;
|
||||
--enable-w32threads) _w32threads=yes ;;
|
||||
--disable-w32threads) _w32threads=no ;;
|
||||
--enable-libass) _ass=yes ;;
|
||||
--disable-libass) _ass=no ;;
|
||||
--enable-libass-osd) _libass_osd=yes ;;
|
||||
@@ -832,9 +812,6 @@ for ac_option do
|
||||
--enable-gethostbyname2) _gethostbyname2=yes ;;
|
||||
--disable-gethostbyname2) _gethostbyname2=no ;;
|
||||
|
||||
--enable-qtx) _qtx=yes ;;
|
||||
--disable-qtx) _qtx=no ;;
|
||||
|
||||
--enable-coreaudio) _coreaudio=yes ;;
|
||||
--disable-coreaudio) _coreaudio=no ;;
|
||||
--enable-corevideo) _corevideo=yes ;;
|
||||
@@ -849,9 +826,6 @@ for ac_option do
|
||||
--enable-sortsub) _sortsub=yes ;;
|
||||
--disable-sortsub) _sortsub=no ;;
|
||||
|
||||
--enable-win32dll) _win32dll=yes ;;
|
||||
--disable-win32dll) _win32dll=no ;;
|
||||
|
||||
*)
|
||||
echo "Unknown parameter: $ac_option" >&2
|
||||
exit 1
|
||||
@@ -1261,7 +1235,6 @@ else
|
||||
CFLAGS="-D_ISOC99_SOURCE -D_BSD_SOURCE $CFLAGS"
|
||||
fi
|
||||
|
||||
cflag_check -mno-omit-leaf-frame-pointer && cflags_no_omit_leaf_frame_pointer="-mno-omit-leaf-frame-pointer"
|
||||
cflag_check -MD -MP && DEPFLAGS="-MD -MP"
|
||||
|
||||
|
||||
@@ -1661,7 +1634,6 @@ else
|
||||
res_comment="v4l2, ao_nas, win32 loader disabled"
|
||||
def_pthreads='#undef HAVE_PTHREADS'
|
||||
_nas=no ; _tv_v4l2=no
|
||||
mingw32 || _win32dll=no
|
||||
fi
|
||||
echores "$_pthreads"
|
||||
|
||||
@@ -1674,18 +1646,6 @@ if cygwin ; then
|
||||
fi
|
||||
fi
|
||||
|
||||
echocheck "w32threads"
|
||||
if test "$_pthreads" = yes ; then
|
||||
res_comment="using pthread instead"
|
||||
_w32threads=no
|
||||
fi
|
||||
if test "$_w32threads" = auto ; then
|
||||
_w32threads=no
|
||||
mingw32 && _w32threads=yes
|
||||
fi
|
||||
test "$_w32threads" = yes && def_threads='#define HAVE_THREADS 1'
|
||||
echores "$_w32threads"
|
||||
|
||||
echocheck "rpath"
|
||||
if test "$_rpath" = yes ; then
|
||||
for I in $(echo $extra_ldflags | sed 's/-L//g') ; do
|
||||
@@ -2084,19 +2044,6 @@ echores "$_directfb"
|
||||
|
||||
if darwin; then
|
||||
|
||||
echocheck "QuickTime"
|
||||
if test "$quicktime" = auto ; then
|
||||
quicktime=no
|
||||
statement_check QuickTime/QuickTime.h 'ImageDescription *desc; EnterMovies(); ExitMovies()' -framework QuickTime && quicktime=yes
|
||||
fi
|
||||
if test "$quicktime" = yes ; then
|
||||
extra_ldflags="$extra_ldflags -framework QuickTime"
|
||||
def_quicktime='#define CONFIG_QUICKTIME 1'
|
||||
else
|
||||
def_quicktime='#undef CONFIG_QUICKTIME'
|
||||
fi
|
||||
echores $quicktime
|
||||
|
||||
echocheck "Cocoa"
|
||||
if test "$_cocoa" = auto ; then
|
||||
cat > $TMPC <<EOF
|
||||
@@ -3193,85 +3140,6 @@ if test -z "$_codecsdir" ; then
|
||||
fi
|
||||
|
||||
|
||||
echocheck "Win32 codecs"
|
||||
if test "$_win32dll" = auto ; then
|
||||
_win32dll=no
|
||||
if x86_32 ; then
|
||||
_win32dll=yes
|
||||
fi
|
||||
fi
|
||||
if test "$_win32dll" = yes ; then
|
||||
def_win32dll='#define CONFIG_WIN32DLL 1'
|
||||
if ! win32 ; then
|
||||
def_win32_loader='#define WIN32_LOADER 1'
|
||||
_win32_emulation=yes
|
||||
else
|
||||
extra_ldflags="$extra_ldflags -ladvapi32 -lole32"
|
||||
res_comment="using native windows"
|
||||
fi
|
||||
codecmodules="win32 $codecmodules"
|
||||
else
|
||||
def_win32dll='#undef CONFIG_WIN32DLL'
|
||||
def_win32_loader='#undef WIN32_LOADER'
|
||||
nocodecmodules="win32 $nocodecmodules"
|
||||
fi
|
||||
echores "$_win32dll"
|
||||
|
||||
|
||||
echocheck "XAnim codecs"
|
||||
if test "$_xanim" = auto ; then
|
||||
_xanim=no
|
||||
res_comment="dynamic loader support needed"
|
||||
if test "$_dl" = yes ; then
|
||||
_xanim=yes
|
||||
fi
|
||||
fi
|
||||
if test "$_xanim" = yes ; then
|
||||
def_xanim='#define CONFIG_XANIM 1'
|
||||
codecmodules="xanim $codecmodules"
|
||||
else
|
||||
def_xanim='#undef CONFIG_XANIM'
|
||||
nocodecmodules="xanim $nocodecmodules"
|
||||
fi
|
||||
echores "$_xanim"
|
||||
|
||||
|
||||
echocheck "RealPlayer codecs"
|
||||
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) ; then
|
||||
_real=yes
|
||||
fi
|
||||
fi
|
||||
if test "$_real" = yes ; then
|
||||
def_real='#define CONFIG_REALCODECS 1'
|
||||
codecmodules="real $codecmodules"
|
||||
else
|
||||
def_real='#undef CONFIG_REALCODECS'
|
||||
nocodecmodules="real $nocodecmodules"
|
||||
fi
|
||||
echores "$_real"
|
||||
|
||||
|
||||
echocheck "QuickTime codecs"
|
||||
_qtx_emulation=no
|
||||
def_qtx_win32='#undef CONFIG_QTX_CODECS_WIN32'
|
||||
if test "$_qtx" = auto ; then
|
||||
test "$_win32dll" = yes || test "$quicktime" = yes && _qtx=yes
|
||||
fi
|
||||
if test "$_qtx" = yes ; then
|
||||
def_qtx='#define CONFIG_QTX_CODECS 1'
|
||||
win32 && _qtx_codecs_win32=yes && def_qtx_win32='#define CONFIG_QTX_CODECS_WIN32 1'
|
||||
codecmodules="qtx $codecmodules"
|
||||
darwin || win32 || _qtx_emulation=yes
|
||||
else
|
||||
def_qtx='#undef CONFIG_QTX_CODECS'
|
||||
nocodecmodules="qtx $nocodecmodules"
|
||||
fi
|
||||
echores "$_qtx"
|
||||
|
||||
echocheck "LCMS2 support"
|
||||
if test "$_lcms2" = auto ; then
|
||||
_lcms2=no
|
||||
@@ -3489,24 +3357,6 @@ EOF
|
||||
fi #if freebsd || netbsd || openbsd || dragonfly
|
||||
|
||||
|
||||
echocheck "DirectShow TV interface"
|
||||
if test "$_tv_dshow" = auto ; then
|
||||
_tv_dshow=no
|
||||
if test "$_tv" = yes && win32 ; then
|
||||
statement_check ole2.h 'void* p; CoCreateInstance((GUID*)&GUID_NULL, NULL, CLSCTX_INPROC_SERVER, &GUID_NULL, &p)' -lole32 -luuid && _tv_dshow=yes
|
||||
fi
|
||||
fi
|
||||
if test "$_tv_dshow" = yes ; then
|
||||
inputmodules="tv-dshow $inputmodules"
|
||||
def_tv_dshow='#define CONFIG_TV_DSHOW 1'
|
||||
extra_ldflags="$extra_ldflags -lole32 -luuid"
|
||||
else
|
||||
noinputmodules="tv-dshow $noinputmodules"
|
||||
def_tv_dshow='#undef CONFIG_TV_DSHOW'
|
||||
fi
|
||||
echores "$_tv_dshow"
|
||||
|
||||
|
||||
echocheck "Video 4 Linux 2 TV interface"
|
||||
if test "$_tv_v4l2" = auto ; then
|
||||
_tv_v4l2=no
|
||||
@@ -3676,15 +3526,7 @@ else
|
||||
fi
|
||||
|
||||
|
||||
# Dynamic linking flags
|
||||
# (FIXME: 'echocheck "dynamic linking"' above and modify here accordingly)
|
||||
_ld_dl_dynamic=''
|
||||
freebsd || netbsd || openbsd || dragonfly && _ld_dl_dynamic='-rdynamic'
|
||||
if test "$_real" = yes || test "$_xanim" = yes && ! win32 && ! darwin ; then
|
||||
_ld_dl_dynamic='-rdynamic'
|
||||
fi
|
||||
|
||||
extra_ldflags="$extra_ldflags $_ld_pthread $_ld_dl $_ld_dl_dynamic"
|
||||
extra_ldflags="$extra_ldflags $_ld_pthread $_ld_dl"
|
||||
(netbsd || openbsd) && x86_32 && extra_ldflags="$extra_ldflags -li386"
|
||||
|
||||
|
||||
@@ -3826,8 +3668,6 @@ DEPFLAGS = $DEPFLAGS
|
||||
CFLAGS_LIBDVDCSS = $cflags_libdvdcss
|
||||
CFLAGS_LIBDVDCSS_DVDREAD = $cflags_libdvdcss_dvdread
|
||||
CFLAGS_LIBDVDNAV = $cflags_libdvdnav
|
||||
CFLAGS_NO_OMIT_LEAF_FRAME_POINTER = $cflags_no_omit_leaf_frame_pointer
|
||||
CFLAGS_STACKREALIGN = $cflags_stackrealign
|
||||
|
||||
EXTRALIBS = $extra_ldflags $_ld_static $_ld_lm $extra_libs
|
||||
EXTRALIBS_MPLAYER = $libs_mplayer
|
||||
@@ -3913,25 +3753,17 @@ PRIORITY = $_priority
|
||||
PULSE = $_pulse
|
||||
PORTAUDIO = $_portaudio
|
||||
PVR = $_pvr
|
||||
QTX_CODECS = $_qtx
|
||||
QTX_CODECS_WIN32 = $_qtx_codecs_win32
|
||||
QTX_EMULATION = $_qtx_emulation
|
||||
RADIO=$_radio
|
||||
RADIO_CAPTURE=$_radio_capture
|
||||
REAL_CODECS = $_real
|
||||
RSOUND = $_rsound
|
||||
STREAM_CACHE = $_stream_cache
|
||||
TV = $_tv
|
||||
TV_BSDBT848 = $_tv_bsdbt848
|
||||
TV_DSHOW = $_tv_dshow
|
||||
TV_V4L2 = $_tv_v4l2
|
||||
VCD = $_vcd
|
||||
VDPAU = $_vdpau
|
||||
VSTREAM = $_vstream
|
||||
WIN32DLL = $_win32dll
|
||||
WIN32_EMULATION = $_win32_emulation
|
||||
X11 = $_x11
|
||||
XANIM_CODECS = $_xanim
|
||||
XV = $_xv
|
||||
|
||||
# FFmpeg
|
||||
@@ -3943,7 +3775,6 @@ CONFIG_ZLIB = $_zlib
|
||||
|
||||
HAVE_PTHREADS = $_pthreads
|
||||
HAVE_SHM = $_shm
|
||||
HAVE_W32THREADS = $_w32threads
|
||||
|
||||
EOF
|
||||
|
||||
@@ -4049,7 +3880,6 @@ $def_iconv
|
||||
$def_macosx_bundle
|
||||
$def_macosx_finder
|
||||
$def_priority
|
||||
$def_quicktime
|
||||
|
||||
|
||||
/* configurable options */
|
||||
@@ -4103,16 +3933,6 @@ $def_zlib
|
||||
$def_libpostproc
|
||||
|
||||
|
||||
/* binary codecs */
|
||||
$def_qtx
|
||||
$def_qtx_win32
|
||||
$def_real
|
||||
$def_win32_loader
|
||||
$def_win32dll
|
||||
$def_xanim
|
||||
#define BINARY_CODECS_PATH "$_codecsdir"
|
||||
|
||||
|
||||
/* Audio output drivers */
|
||||
$def_alsa
|
||||
$def_coreaudio
|
||||
@@ -4146,7 +3966,6 @@ $def_radio_capture
|
||||
$def_radio_v4l2
|
||||
$def_tv
|
||||
$def_tv_bsdbt848
|
||||
$def_tv_dshow
|
||||
$def_tv_v4l2
|
||||
|
||||
|
||||
|
||||
@@ -40,15 +40,9 @@ extern const ad_functions_t mpcodecs_ad_pcm;
|
||||
extern const ad_functions_t mpcodecs_ad_dvdpcm;
|
||||
extern const ad_functions_t mpcodecs_ad_alaw;
|
||||
extern const ad_functions_t mpcodecs_ad_imaadpcm;
|
||||
extern const ad_functions_t mpcodecs_ad_msadpcm;
|
||||
extern const ad_functions_t mpcodecs_ad_dshow;
|
||||
extern const ad_functions_t mpcodecs_ad_dmo;
|
||||
extern const ad_functions_t mpcodecs_ad_acm;
|
||||
extern const ad_functions_t mpcodecs_ad_faad;
|
||||
extern const ad_functions_t mpcodecs_ad_libmad;
|
||||
extern const ad_functions_t mpcodecs_ad_realaud;
|
||||
extern const ad_functions_t mpcodecs_ad_libdv;
|
||||
extern const ad_functions_t mpcodecs_ad_qtaudio;
|
||||
extern const ad_functions_t mpcodecs_ad_spdif;
|
||||
extern const ad_functions_t mpcodecs_ad_libdca;
|
||||
|
||||
@@ -68,25 +62,12 @@ const ad_functions_t * const mpcodecs_ad_drivers[] =
|
||||
&mpcodecs_ad_dvdpcm,
|
||||
&mpcodecs_ad_alaw,
|
||||
&mpcodecs_ad_imaadpcm,
|
||||
&mpcodecs_ad_msadpcm,
|
||||
#ifdef CONFIG_WIN32DLL
|
||||
&mpcodecs_ad_dshow,
|
||||
&mpcodecs_ad_dmo,
|
||||
&mpcodecs_ad_acm,
|
||||
&mpcodecs_ad_twin,
|
||||
#endif
|
||||
#ifdef CONFIG_QTX_CODECS
|
||||
&mpcodecs_ad_qtaudio,
|
||||
#endif
|
||||
#ifdef CONFIG_FAAD
|
||||
&mpcodecs_ad_faad,
|
||||
#endif
|
||||
#ifdef CONFIG_LIBMAD
|
||||
&mpcodecs_ad_libmad,
|
||||
#endif
|
||||
#ifdef CONFIG_REALCODECS
|
||||
&mpcodecs_ad_realaud,
|
||||
#endif
|
||||
#ifdef CONFIG_LIBDV095
|
||||
&mpcodecs_ad_libdv,
|
||||
#endif
|
||||
|
||||
@@ -1,259 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "config.h"
|
||||
#include "mp_msg.h"
|
||||
#include "libmpdemux/aviprint.h"
|
||||
#include "loader/wineacm.h"
|
||||
|
||||
#include "ad_internal.h"
|
||||
#include "osdep/timer.h"
|
||||
|
||||
static const ad_info_t info =
|
||||
{
|
||||
"Win32/ACM decoders",
|
||||
"acm",
|
||||
"A'rpi",
|
||||
"A'rpi & Alex",
|
||||
""
|
||||
};
|
||||
|
||||
LIBAD_EXTERN(acm)
|
||||
|
||||
typedef struct {
|
||||
WAVEFORMATEX *o_wf;
|
||||
HACMSTREAM handle;
|
||||
} acm_context_t;
|
||||
|
||||
static int init(sh_audio_t *sh_audio)
|
||||
{
|
||||
int ret=decode_audio(sh_audio,sh_audio->a_buffer,4096,sh_audio->a_buffer_size);
|
||||
if(ret<0){
|
||||
mp_msg(MSGT_DECAUDIO,MSGL_INFO,"ACM decoding error: %d\n",ret);
|
||||
return 0;
|
||||
}
|
||||
sh_audio->a_buffer_len=ret;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int preinit(sh_audio_t *sh_audio)
|
||||
{
|
||||
HRESULT ret;
|
||||
WAVEFORMATEX *in_fmt = sh_audio->wf;
|
||||
DWORD srcsize = 0;
|
||||
acm_context_t *priv;
|
||||
|
||||
priv = malloc(sizeof(acm_context_t));
|
||||
if (!priv)
|
||||
return 0;
|
||||
sh_audio->context = priv;
|
||||
|
||||
mp_msg(MSGT_WIN32, MSGL_V, "======= Win32 (ACM) AUDIO Codec init =======\n");
|
||||
|
||||
// priv->handle = NULL;
|
||||
|
||||
priv->o_wf = malloc(sizeof(*priv->o_wf));
|
||||
if (!priv->o_wf)
|
||||
{
|
||||
mp_tmsg(MSGT_DECAUDIO,MSGL_ERR,"Could not load/initialize Win32/ACM audio codec (missing DLL file?).\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
priv->o_wf->nChannels = in_fmt->nChannels;
|
||||
priv->o_wf->nSamplesPerSec = in_fmt->nSamplesPerSec;
|
||||
priv->o_wf->nAvgBytesPerSec = 2*in_fmt->nSamplesPerSec*in_fmt->nChannels;
|
||||
priv->o_wf->wFormatTag = WAVE_FORMAT_PCM;
|
||||
priv->o_wf->nBlockAlign = 2*in_fmt->nChannels;
|
||||
priv->o_wf->wBitsPerSample = 16;
|
||||
// priv->o_wf->wBitsPerSample = inf_fmt->wBitsPerSample;
|
||||
priv->o_wf->cbSize = 0;
|
||||
|
||||
if ( mp_msg_test(MSGT_DECAUDIO,MSGL_V) )
|
||||
{
|
||||
mp_msg(MSGT_DECAUDIO, MSGL_V, "Input format:\n");
|
||||
print_wave_header(in_fmt, MSGL_V);
|
||||
mp_msg(MSGT_DECAUDIO, MSGL_V, "Output format:\n");
|
||||
print_wave_header(priv->o_wf, MSGL_V);
|
||||
}
|
||||
|
||||
MSACM_RegisterDriver((const char *)sh_audio->codec->dll, in_fmt->wFormatTag, 0);
|
||||
ret = acmStreamOpen(&priv->handle, (HACMDRIVER)NULL, in_fmt,
|
||||
priv->o_wf, NULL, 0, 0, 0);
|
||||
if (ret)
|
||||
{
|
||||
if (ret == ACMERR_NOTPOSSIBLE)
|
||||
mp_msg(MSGT_WIN32, MSGL_ERR, "ACM_Decoder: Unappropriate audio format\n");
|
||||
else
|
||||
mp_msg(MSGT_WIN32, MSGL_ERR, "ACM_Decoder: acmStreamOpen error: %d\n",
|
||||
(int)ret);
|
||||
mp_tmsg(MSGT_DECAUDIO,MSGL_ERR,"Could not load/initialize Win32/ACM audio codec (missing DLL file?).\n");
|
||||
return 0;
|
||||
}
|
||||
mp_msg(MSGT_WIN32, MSGL_V, "Audio codec opened OK! ;-)\n");
|
||||
|
||||
acmStreamSize(priv->handle, in_fmt->nBlockAlign, &srcsize, ACM_STREAMSIZEF_SOURCE);
|
||||
//if ( mp_msg_test(MSGT_DECAUDIO,MSGL_V) ) printf("Audio ACM output buffer min. size: %ld (reported by codec)\n", srcsize);
|
||||
srcsize *= 2;
|
||||
//if (srcsize < MAX_OUTBURST) srcsize = MAX_OUTBURST;
|
||||
if (!srcsize)
|
||||
{
|
||||
mp_msg(MSGT_WIN32, MSGL_WARN, "Warning! ACM codec reports srcsize=0\n");
|
||||
srcsize = 16384;
|
||||
}
|
||||
// limit srcsize to 4-16kb
|
||||
//while(srcsize && srcsize<4096) srcsize*=2;
|
||||
//while(srcsize>16384) srcsize/=2;
|
||||
sh_audio->audio_out_minsize=srcsize; // audio output min. size
|
||||
mp_msg(MSGT_WIN32,MSGL_V,"Audio ACM output buffer min. size: %ld\n",srcsize);
|
||||
|
||||
acmStreamSize(priv->handle, srcsize, &srcsize, ACM_STREAMSIZEF_DESTINATION);
|
||||
// if(srcsize<in_fmt->nBlockAlign) srcsize=in_fmt->nBlockAlign;
|
||||
|
||||
if (!srcsize)
|
||||
{
|
||||
mp_msg(MSGT_WIN32, MSGL_WARN, "Warning! ACM codec reports srcsize=0\n");
|
||||
srcsize = 2*in_fmt->nBlockAlign;
|
||||
}
|
||||
|
||||
mp_msg(MSGT_WIN32,MSGL_V,"Audio ACM input buffer min. size: %ld\n",srcsize);
|
||||
|
||||
sh_audio->audio_in_minsize=2*srcsize; // audio input min. size
|
||||
|
||||
sh_audio->i_bps=sh_audio->wf->nAvgBytesPerSec;
|
||||
sh_audio->channels=priv->o_wf->nChannels;
|
||||
sh_audio->samplerate=priv->o_wf->nSamplesPerSec;
|
||||
sh_audio->samplesize=2;
|
||||
|
||||
mp_msg(MSGT_DECVIDEO,MSGL_V,"INFO: Win32/ACM audio codec init OK!\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void uninit(sh_audio_t *sh)
|
||||
{
|
||||
HRESULT ret;
|
||||
acm_context_t *priv = sh->context;
|
||||
|
||||
retry:
|
||||
ret = acmStreamClose(priv->handle, 0);
|
||||
|
||||
if (ret)
|
||||
switch(ret)
|
||||
{
|
||||
case ACMERR_BUSY:
|
||||
case ACMERR_CANCELED:
|
||||
mp_msg(MSGT_WIN32, MSGL_DBG2, "ACM_Decoder: stream busy, waiting..\n");
|
||||
usec_sleep(100000000);
|
||||
goto retry;
|
||||
case ACMERR_UNPREPARED:
|
||||
case ACMERR_NOTPOSSIBLE:
|
||||
return;
|
||||
default:
|
||||
mp_msg(MSGT_WIN32, MSGL_WARN, "ACM_Decoder: unknown error occurred: %ld\n", ret);
|
||||
return;
|
||||
}
|
||||
|
||||
MSACM_UnregisterAllDrivers();
|
||||
|
||||
free(priv->o_wf);
|
||||
free(priv);
|
||||
}
|
||||
|
||||
static int control(sh_audio_t *sh_audio,int cmd,void* arg, ...)
|
||||
{
|
||||
int skip;
|
||||
switch(cmd)
|
||||
{
|
||||
case ADCTRL_SKIP_FRAME:
|
||||
skip=sh_audio->wf->nBlockAlign;
|
||||
if(skip<16){
|
||||
skip=(sh_audio->wf->nAvgBytesPerSec/16)&(~7);
|
||||
if(skip<16) skip=16;
|
||||
}
|
||||
demux_read_data(sh_audio->ds,NULL,skip);
|
||||
return CONTROL_TRUE;
|
||||
}
|
||||
return CONTROL_UNKNOWN;
|
||||
}
|
||||
|
||||
static int decode_audio(sh_audio_t *sh_audio,unsigned char *buf,int minlen,int maxlen)
|
||||
{
|
||||
ACMSTREAMHEADER ash;
|
||||
HRESULT hr;
|
||||
DWORD srcsize=0;
|
||||
DWORD len=minlen;
|
||||
acm_context_t *priv = sh_audio->context;
|
||||
|
||||
acmStreamSize(priv->handle, len, &srcsize, ACM_STREAMSIZEF_DESTINATION);
|
||||
mp_msg(MSGT_WIN32,MSGL_DBG3,"acm says: srcsize=%ld (buffsize=%d) out_size=%ld\n",srcsize,sh_audio->a_in_buffer_size,len);
|
||||
|
||||
if(srcsize<sh_audio->wf->nBlockAlign){
|
||||
srcsize=sh_audio->wf->nBlockAlign;
|
||||
acmStreamSize(priv->handle, srcsize, &len, ACM_STREAMSIZEF_SOURCE);
|
||||
if(len>maxlen) len=maxlen;
|
||||
}
|
||||
|
||||
// if(srcsize==0) srcsize=((WAVEFORMATEX *)&sh_audio->o_wf_ext)->nBlockAlign;
|
||||
if(srcsize>sh_audio->a_in_buffer_size) srcsize=sh_audio->a_in_buffer_size; // !!!!!!
|
||||
if(sh_audio->a_in_buffer_len<srcsize){
|
||||
sh_audio->a_in_buffer_len+=
|
||||
demux_read_data(sh_audio->ds,&sh_audio->a_in_buffer[sh_audio->a_in_buffer_len],
|
||||
srcsize-sh_audio->a_in_buffer_len);
|
||||
}
|
||||
mp_msg(MSGT_WIN32,MSGL_DBG3,"acm convert %d -> %ld bytes\n",sh_audio->a_in_buffer_len,len);
|
||||
memset(&ash, 0, sizeof(ash));
|
||||
ash.cbStruct=sizeof(ash);
|
||||
ash.fdwStatus=0;
|
||||
ash.dwUser=0;
|
||||
ash.pbSrc=sh_audio->a_in_buffer;
|
||||
ash.cbSrcLength=sh_audio->a_in_buffer_len;
|
||||
ash.pbDst=buf;
|
||||
ash.cbDstLength=len;
|
||||
hr=acmStreamPrepareHeader(priv->handle,&ash,0);
|
||||
if(hr){
|
||||
mp_msg(MSGT_WIN32,MSGL_V,"ACM_Decoder: acmStreamPrepareHeader error %d\n",(int)hr);
|
||||
return -1;
|
||||
}
|
||||
hr=acmStreamConvert(priv->handle,&ash,0);
|
||||
if(hr){
|
||||
mp_msg(MSGT_WIN32,MSGL_DBG2,"ACM_Decoder: acmStreamConvert error %d\n",(int)hr);
|
||||
switch(hr)
|
||||
{
|
||||
case ACMERR_NOTPOSSIBLE:
|
||||
case ACMERR_UNPREPARED:
|
||||
mp_msg(MSGT_WIN32, MSGL_DBG2, "ACM_Decoder: acmStreamConvert error: probarly not initialized!\n");
|
||||
}
|
||||
// return -1;
|
||||
}
|
||||
mp_msg(MSGT_WIN32,MSGL_DBG2,"acm converted %ld -> %ld\n",ash.cbSrcLengthUsed,ash.cbDstLengthUsed);
|
||||
if(ash.cbSrcLengthUsed>=sh_audio->a_in_buffer_len){
|
||||
sh_audio->a_in_buffer_len=0;
|
||||
} else {
|
||||
sh_audio->a_in_buffer_len-=ash.cbSrcLengthUsed;
|
||||
memcpy(sh_audio->a_in_buffer,&sh_audio->a_in_buffer[ash.cbSrcLengthUsed],sh_audio->a_in_buffer_len);
|
||||
}
|
||||
len=ash.cbDstLengthUsed;
|
||||
hr=acmStreamUnprepareHeader(priv->handle,&ash,0);
|
||||
if(hr){
|
||||
mp_msg(MSGT_WIN32,MSGL_V,"ACM_Decoder: acmStreamUnprepareHeader error %d\n",(int)hr);
|
||||
}
|
||||
return len;
|
||||
}
|
||||
@@ -1,126 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "config.h"
|
||||
#include "options.h"
|
||||
#include "mp_msg.h"
|
||||
|
||||
#include "ad_internal.h"
|
||||
#include "libaf/reorder_ch.h"
|
||||
|
||||
static const ad_info_t info =
|
||||
{
|
||||
"Win32/DMO decoders",
|
||||
"dmo",
|
||||
"A'rpi",
|
||||
"avifile.sf.net",
|
||||
""
|
||||
};
|
||||
|
||||
LIBAD_EXTERN(dmo)
|
||||
|
||||
#include "loader/dmo/DMO_AudioDecoder.h"
|
||||
|
||||
static int init(sh_audio_t *sh)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int preinit(sh_audio_t *sh_audio)
|
||||
{
|
||||
struct MPOpts *opts = sh_audio->opts;
|
||||
DMO_AudioDecoder* ds_adec;
|
||||
int chans=(opts->audio_output_channels==sh_audio->wf->nChannels) ?
|
||||
opts->audio_output_channels : (sh_audio->wf->nChannels>=2 ? 2 : 1);
|
||||
if(!(ds_adec=DMO_AudioDecoder_Open(sh_audio->codec->dll,&sh_audio->codec->guid,sh_audio->wf,chans)))
|
||||
{
|
||||
mp_tmsg(MSGT_DECAUDIO,MSGL_ERR,"ERROR: Could not open required DirectShow codec %s.\n",sh_audio->codec->dll);
|
||||
return 0;
|
||||
}
|
||||
sh_audio->i_bps=sh_audio->wf->nAvgBytesPerSec;
|
||||
sh_audio->channels=chans;
|
||||
sh_audio->samplerate=sh_audio->wf->nSamplesPerSec;
|
||||
sh_audio->samplesize=2;
|
||||
sh_audio->audio_in_minsize=4*sh_audio->wf->nBlockAlign;
|
||||
if(sh_audio->audio_in_minsize<8192) sh_audio->audio_in_minsize=8192;
|
||||
sh_audio->audio_out_minsize=4*16384;
|
||||
sh_audio->context = ds_adec;
|
||||
mp_msg(MSGT_DECVIDEO,MSGL_V,"INFO: Win32/DMO audio codec init OK!\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void uninit(sh_audio_t *sh)
|
||||
{
|
||||
DMO_AudioDecoder* ds_adec = sh->context;
|
||||
DMO_AudioDecoder_Destroy(ds_adec);
|
||||
}
|
||||
|
||||
static int control(sh_audio_t *sh_audio,int cmd,void* arg, ...)
|
||||
{
|
||||
int skip;
|
||||
switch(cmd)
|
||||
{
|
||||
case ADCTRL_SKIP_FRAME:
|
||||
skip=sh_audio->wf->nBlockAlign;
|
||||
if(skip<16){
|
||||
skip=(sh_audio->wf->nAvgBytesPerSec/16)&(~7);
|
||||
if(skip<16) skip=16;
|
||||
}
|
||||
demux_read_data(sh_audio->ds,NULL,skip);
|
||||
return CONTROL_TRUE;
|
||||
}
|
||||
return CONTROL_UNKNOWN;
|
||||
}
|
||||
|
||||
static int decode_audio(sh_audio_t *sh_audio,unsigned char *buf,int minlen,int maxlen)
|
||||
{
|
||||
DMO_AudioDecoder* ds_adec = sh_audio->context;
|
||||
// int len=-1;
|
||||
int size_in=0;
|
||||
int size_out=0;
|
||||
int srcsize=DMO_AudioDecoder_GetSrcSize(ds_adec, maxlen);
|
||||
mp_msg(MSGT_DECAUDIO,MSGL_DBG3,"DMO says: srcsize=%d (buffsize=%d) out_size=%d\n",srcsize,sh_audio->a_in_buffer_size,maxlen);
|
||||
if(srcsize>sh_audio->a_in_buffer_size) srcsize=sh_audio->a_in_buffer_size; // !!!!!!
|
||||
if(sh_audio->a_in_buffer_len<srcsize){
|
||||
sh_audio->a_in_buffer_len+=
|
||||
demux_read_data(sh_audio->ds,&sh_audio->a_in_buffer[sh_audio->a_in_buffer_len],
|
||||
srcsize-sh_audio->a_in_buffer_len);
|
||||
}
|
||||
DMO_AudioDecoder_Convert(ds_adec, sh_audio->a_in_buffer,sh_audio->a_in_buffer_len,
|
||||
buf,maxlen, &size_in,&size_out);
|
||||
mp_dbg(MSGT_DECAUDIO,MSGL_DBG2,"DMO: audio %d -> %d converted (in_buf_len=%d of %d) %d\n",size_in,size_out,sh_audio->a_in_buffer_len,sh_audio->a_in_buffer_size,ds_tell_pts(sh_audio->ds));
|
||||
if(size_in>=sh_audio->a_in_buffer_len){
|
||||
sh_audio->a_in_buffer_len=0;
|
||||
} else {
|
||||
sh_audio->a_in_buffer_len-=size_in;
|
||||
memmove(sh_audio->a_in_buffer,&sh_audio->a_in_buffer[size_in],sh_audio->a_in_buffer_len);
|
||||
}
|
||||
if (size_out > 0 && sh_audio->channels >= 5) {
|
||||
reorder_channel_nch(buf, AF_CHANNEL_LAYOUT_WAVEEX_DEFAULT,
|
||||
AF_CHANNEL_LAYOUT_MPLAYER_DEFAULT,
|
||||
sh_audio->channels,
|
||||
size_out / sh_audio->samplesize,
|
||||
sh_audio->samplesize);
|
||||
}
|
||||
// len=size_out;
|
||||
return size_out;
|
||||
}
|
||||
@@ -1,114 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "config.h"
|
||||
#include "mp_msg.h"
|
||||
|
||||
#include "ad_internal.h"
|
||||
|
||||
static const ad_info_t info =
|
||||
{
|
||||
"Win32/DirectShow decoders",
|
||||
"dshow",
|
||||
"Nick Kurshev",
|
||||
"avifile.sf.net",
|
||||
""
|
||||
};
|
||||
|
||||
LIBAD_EXTERN(dshow)
|
||||
|
||||
#include "loader/dshow/DS_AudioDecoder.h"
|
||||
|
||||
static int init(sh_audio_t *sh)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int preinit(sh_audio_t *sh_audio)
|
||||
{
|
||||
DS_AudioDecoder* ds_adec;
|
||||
if(!(ds_adec=DS_AudioDecoder_Open(sh_audio->codec->dll,&sh_audio->codec->guid,sh_audio->wf)))
|
||||
{
|
||||
mp_tmsg(MSGT_DECAUDIO,MSGL_ERR,"ERROR: Could not open required DirectShow codec %s.\n",sh_audio->codec->dll);
|
||||
return 0;
|
||||
}
|
||||
sh_audio->i_bps=sh_audio->wf->nAvgBytesPerSec;
|
||||
sh_audio->channels=sh_audio->wf->nChannels;
|
||||
sh_audio->samplerate=sh_audio->wf->nSamplesPerSec;
|
||||
sh_audio->samplesize=2;
|
||||
sh_audio->audio_in_minsize=2*sh_audio->wf->nBlockAlign;
|
||||
if(sh_audio->audio_in_minsize<8192) sh_audio->audio_in_minsize=8192;
|
||||
sh_audio->audio_out_minsize=16384;
|
||||
sh_audio->context = ds_adec;
|
||||
mp_msg(MSGT_DECVIDEO,MSGL_V,"INFO: Win32/DShow audio codec init OK!\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void uninit(sh_audio_t *sh)
|
||||
{
|
||||
DS_AudioDecoder* ds_adec = sh->context;
|
||||
DS_AudioDecoder_Destroy(ds_adec);
|
||||
}
|
||||
|
||||
static int control(sh_audio_t *sh_audio,int cmd,void* arg, ...)
|
||||
{
|
||||
int skip;
|
||||
switch(cmd)
|
||||
{
|
||||
case ADCTRL_SKIP_FRAME:
|
||||
skip=sh_audio->wf->nBlockAlign;
|
||||
if(skip<16){
|
||||
skip=(sh_audio->wf->nAvgBytesPerSec/16)&(~7);
|
||||
if(skip<16) skip=16;
|
||||
}
|
||||
demux_read_data(sh_audio->ds,NULL,skip);
|
||||
return CONTROL_TRUE;
|
||||
}
|
||||
return CONTROL_UNKNOWN;
|
||||
}
|
||||
|
||||
static int decode_audio(sh_audio_t *sh_audio,unsigned char *buf,int minlen,int maxlen)
|
||||
{
|
||||
DS_AudioDecoder* ds_adec = sh_audio->context;
|
||||
// int len=-1;
|
||||
int size_in=0;
|
||||
int size_out=0;
|
||||
int srcsize=DS_AudioDecoder_GetSrcSize(ds_adec, maxlen);
|
||||
mp_msg(MSGT_DECAUDIO,MSGL_DBG3,"DShow says: srcsize=%d (buffsize=%d) out_size=%d\n",srcsize,sh_audio->a_in_buffer_size,maxlen);
|
||||
if(srcsize>sh_audio->a_in_buffer_size) srcsize=sh_audio->a_in_buffer_size; // !!!!!!
|
||||
if(sh_audio->a_in_buffer_len<srcsize){
|
||||
sh_audio->a_in_buffer_len+=
|
||||
demux_read_data(sh_audio->ds,&sh_audio->a_in_buffer[sh_audio->a_in_buffer_len],
|
||||
srcsize-sh_audio->a_in_buffer_len);
|
||||
}
|
||||
DS_AudioDecoder_Convert(ds_adec, sh_audio->a_in_buffer,sh_audio->a_in_buffer_len,
|
||||
buf,maxlen, &size_in,&size_out);
|
||||
mp_dbg(MSGT_DECAUDIO,MSGL_DBG2,"DShow: audio %d -> %d converted (in_buf_len=%d of %d) %d\n",size_in,size_out,sh_audio->a_in_buffer_len,sh_audio->a_in_buffer_size,ds_tell_pts(sh_audio->ds));
|
||||
if(size_in>=sh_audio->a_in_buffer_len){
|
||||
sh_audio->a_in_buffer_len=0;
|
||||
} else {
|
||||
sh_audio->a_in_buffer_len-=size_in;
|
||||
memcpy(sh_audio->a_in_buffer,&sh_audio->a_in_buffer[size_in],sh_audio->a_in_buffer_len);
|
||||
}
|
||||
// len=size_out;
|
||||
return size_out;
|
||||
}
|
||||
@@ -1,353 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#include "config.h"
|
||||
#include "mp_msg.h"
|
||||
#include "mpbswap.h"
|
||||
#include "ad_internal.h"
|
||||
|
||||
#ifdef CONFIG_QUICKTIME
|
||||
#include <QuickTime/QuickTimeComponents.h>
|
||||
#else
|
||||
#include "loader/ldt_keeper.h"
|
||||
#include "loader/wine/winbase.h"
|
||||
#include "loader/wine/windef.h"
|
||||
#endif
|
||||
|
||||
static const ad_info_t info = {
|
||||
"QuickTime Audio Decoder",
|
||||
"qtaudio",
|
||||
"A'rpi",
|
||||
"Sascha Sommer",
|
||||
"uses win32 quicktime DLLs"
|
||||
};
|
||||
|
||||
LIBAD_EXTERN(qtaudio)
|
||||
|
||||
#ifndef CONFIG_QUICKTIME
|
||||
typedef struct OpaqueSoundConverter* SoundConverter;
|
||||
typedef unsigned long OSType;
|
||||
typedef unsigned long UnsignedFixed;
|
||||
typedef uint8_t Byte;
|
||||
typedef struct SoundComponentData {
|
||||
long flags;
|
||||
OSType format;
|
||||
short numChannels;
|
||||
short sampleSize;
|
||||
UnsignedFixed sampleRate;
|
||||
long sampleCount;
|
||||
Byte * buffer;
|
||||
long reserved;
|
||||
}SoundComponentData;
|
||||
|
||||
typedef int (__cdecl* LPFUNC1)(long flag);
|
||||
typedef int (__cdecl* LPFUNC2)(const SoundComponentData *, const SoundComponentData *,SoundConverter *);
|
||||
typedef int (__cdecl* LPFUNC3)(SoundConverter sc);
|
||||
typedef int (__cdecl* LPFUNC4)(void);
|
||||
typedef int (__cdecl* LPFUNC5)(SoundConverter sc, OSType selector,void * infoPtr);
|
||||
typedef int (__cdecl* LPFUNC6)(SoundConverter sc,
|
||||
unsigned long inputBytesTarget,
|
||||
unsigned long *inputFrames,
|
||||
unsigned long *inputBytes,
|
||||
unsigned long *outputBytes );
|
||||
typedef int (__cdecl* LPFUNC7)(SoundConverter sc,
|
||||
const void *inputPtr,
|
||||
unsigned long inputFrames,
|
||||
void *outputPtr,
|
||||
unsigned long *outputFrames,
|
||||
unsigned long *outputBytes );
|
||||
typedef int (__cdecl* LPFUNC8)(SoundConverter sc,
|
||||
void *outputPtr,
|
||||
unsigned long *outputFrames,
|
||||
unsigned long *outputBytes);
|
||||
typedef int (__cdecl* LPFUNC9)(SoundConverter sc) ;
|
||||
|
||||
static HINSTANCE qtime_qts; // handle to the preloaded quicktime.qts
|
||||
static HINSTANCE qtml_dll;
|
||||
static LPFUNC1 InitializeQTML;
|
||||
static LPFUNC2 SoundConverterOpen;
|
||||
static LPFUNC3 SoundConverterClose;
|
||||
static LPFUNC4 TerminateQTML;
|
||||
static LPFUNC5 SoundConverterSetInfo;
|
||||
static LPFUNC6 SoundConverterGetBufferSizes;
|
||||
static LPFUNC7 SoundConverterConvertBuffer;
|
||||
static LPFUNC8 SoundConverterEndConversion;
|
||||
static LPFUNC9 SoundConverterBeginConversion;
|
||||
|
||||
#define siDecompressionParams 2002876005 // siDecompressionParams = FOUR_CHAR_CODE('wave')
|
||||
|
||||
static int loader_init(void)
|
||||
{
|
||||
|
||||
#ifdef WIN32_LOADER
|
||||
Setup_LDT_Keeper();
|
||||
#endif
|
||||
//preload quicktime.qts to avoid the problems caused by the hardcoded path inside the dll
|
||||
qtime_qts = LoadLibraryA("QuickTime.qts");
|
||||
if( qtime_qts == (HMODULE)NULL )
|
||||
{
|
||||
mp_msg(MSGT_DECAUDIO,MSGL_ERR,"failed loading QuickTime.qts\n" );
|
||||
return 1;
|
||||
}
|
||||
qtml_dll = LoadLibraryA("qtmlClient.dll");
|
||||
if( qtml_dll == (HMODULE)NULL )
|
||||
{
|
||||
mp_msg(MSGT_DECAUDIO,MSGL_ERR,"failed loading qtmlClient.dll\n" );
|
||||
return 1;
|
||||
}
|
||||
InitializeQTML = (LPFUNC1)GetProcAddress(qtml_dll,"InitializeQTML");
|
||||
if ( InitializeQTML == NULL )
|
||||
{
|
||||
mp_msg(MSGT_DECAUDIO,MSGL_ERR,"failed geting proc address InitializeQTML\n");
|
||||
return 1;
|
||||
}
|
||||
SoundConverterOpen = (LPFUNC2)GetProcAddress(qtml_dll,"SoundConverterOpen");
|
||||
if ( SoundConverterOpen == NULL )
|
||||
{
|
||||
mp_msg(MSGT_DECAUDIO,MSGL_ERR,"failed getting proc address SoundConverterOpen\n");
|
||||
return 1;
|
||||
}
|
||||
SoundConverterClose = (LPFUNC3)GetProcAddress(qtml_dll,"SoundConverterClose");
|
||||
if ( SoundConverterClose == NULL )
|
||||
{
|
||||
mp_msg(MSGT_DECAUDIO,MSGL_ERR,"failed getting proc address SoundConverterClose\n");
|
||||
return 1;
|
||||
}
|
||||
TerminateQTML = (LPFUNC4)GetProcAddress(qtml_dll,"TerminateQTML");
|
||||
if ( TerminateQTML == NULL )
|
||||
{
|
||||
mp_msg(MSGT_DECAUDIO,MSGL_ERR,"failed getting proc address TerminateQTML\n");
|
||||
return 1;
|
||||
}
|
||||
SoundConverterSetInfo = (LPFUNC5)GetProcAddress(qtml_dll,"SoundConverterSetInfo");
|
||||
if ( SoundConverterSetInfo == NULL )
|
||||
{
|
||||
mp_msg(MSGT_DECAUDIO,MSGL_ERR,"failed getting proc address SoundConverterSetInfo\n");
|
||||
return 1;
|
||||
}
|
||||
SoundConverterGetBufferSizes = (LPFUNC6)GetProcAddress(qtml_dll,"SoundConverterGetBufferSizes");
|
||||
if ( SoundConverterGetBufferSizes == NULL )
|
||||
{
|
||||
mp_msg(MSGT_DECAUDIO,MSGL_ERR,"failed getting proc address SoundConverterGetBufferSizes\n");
|
||||
return 1;
|
||||
}
|
||||
SoundConverterConvertBuffer = (LPFUNC7)GetProcAddress(qtml_dll,"SoundConverterConvertBuffer");
|
||||
if ( SoundConverterConvertBuffer == NULL )
|
||||
{
|
||||
mp_msg(MSGT_DECAUDIO,MSGL_ERR,"failed getting proc address SoundConverterConvertBuffer1\n");
|
||||
return 1;
|
||||
}
|
||||
SoundConverterEndConversion = (LPFUNC8)GetProcAddress(qtml_dll,"SoundConverterEndConversion");
|
||||
if ( SoundConverterEndConversion == NULL )
|
||||
{
|
||||
mp_msg(MSGT_DECAUDIO,MSGL_ERR,"failed getting proc address SoundConverterEndConversion\n");
|
||||
return 1;
|
||||
}
|
||||
SoundConverterBeginConversion = (LPFUNC9)GetProcAddress(qtml_dll,"SoundConverterBeginConversion");
|
||||
if ( SoundConverterBeginConversion == NULL )
|
||||
{
|
||||
mp_msg(MSGT_DECAUDIO,MSGL_ERR,"failed getting proc address SoundConverterBeginConversion\n");
|
||||
return 1;
|
||||
}
|
||||
mp_msg(MSGT_DECAUDIO,MSGL_DBG2,"loader_init DONE???\n");
|
||||
return 0;
|
||||
}
|
||||
#endif /* #ifndef CONFIG_QUICKTIME */
|
||||
|
||||
static SoundConverter myConverter = NULL;
|
||||
static SoundComponentData InputFormatInfo,OutputFormatInfo;
|
||||
|
||||
static int InFrameSize;
|
||||
static int OutFrameSize;
|
||||
|
||||
static int preinit(sh_audio_t *sh){
|
||||
int error;
|
||||
unsigned long FramesToGet=0; //how many frames the demuxer has to get
|
||||
unsigned long InputBufferSize=0; //size of the input buffer
|
||||
unsigned long OutputBufferSize=0; //size of the output buffer
|
||||
unsigned long WantedBufferSize=0; //the size you want your buffers to be
|
||||
void* codecdata = sh->codecdata;
|
||||
|
||||
if (!sh->codecdata_len && sh->wf && sh->wf->cbSize){
|
||||
codecdata = sh->wf + 1;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_QUICKTIME
|
||||
EnterMovies();
|
||||
#else
|
||||
if(loader_init()) return 0; // failed to load DLL
|
||||
|
||||
mp_msg(MSGT_DECAUDIO,MSGL_DBG2,"loader_init DONE!\n");
|
||||
|
||||
error = InitializeQTML(6+16);
|
||||
if(error){
|
||||
mp_msg(MSGT_DECAUDIO,MSGL_ERR,"InitializeQTML:%i\n",error);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
OutputFormatInfo.flags = InputFormatInfo.flags = 0;
|
||||
OutputFormatInfo.sampleCount = InputFormatInfo.sampleCount = 0;
|
||||
OutputFormatInfo.buffer = InputFormatInfo.buffer = NULL;
|
||||
OutputFormatInfo.reserved = InputFormatInfo.reserved = 0;
|
||||
OutputFormatInfo.numChannels = InputFormatInfo.numChannels = sh->wf->nChannels;
|
||||
InputFormatInfo.sampleSize = sh->wf->wBitsPerSample;
|
||||
OutputFormatInfo.sampleSize = 16;
|
||||
OutputFormatInfo.sampleRate = InputFormatInfo.sampleRate = sh->wf->nSamplesPerSec;
|
||||
InputFormatInfo.format = bswap_32(sh->format); //1363430706;///*1768775988;//*/1902406962;//qdm2//1768775988;//FOUR_CHAR_CODE('ima4');
|
||||
OutputFormatInfo.format = 1313820229;// FOUR_CHAR_CODE('NONE');
|
||||
|
||||
error = SoundConverterOpen(&InputFormatInfo, &OutputFormatInfo, &myConverter);
|
||||
mp_msg(MSGT_DECAUDIO,MSGL_DBG2,"SoundConverterOpen:%i\n",error);
|
||||
if(error) return 0;
|
||||
|
||||
if(codecdata){
|
||||
error = SoundConverterSetInfo(myConverter,siDecompressionParams,codecdata);
|
||||
mp_msg(MSGT_DECAUDIO,MSGL_DBG2,"SoundConverterSetInfo:%i\n",error);
|
||||
// if(error) return 0;
|
||||
}
|
||||
|
||||
WantedBufferSize=OutputFormatInfo.numChannels*OutputFormatInfo.sampleRate*2;
|
||||
error = SoundConverterGetBufferSizes(myConverter,
|
||||
WantedBufferSize,&FramesToGet,&InputBufferSize,&OutputBufferSize);
|
||||
mp_msg(MSGT_DECAUDIO,MSGL_DBG2,"SoundConverterGetBufferSizes:%i\n",error);
|
||||
mp_msg(MSGT_DECAUDIO,MSGL_DBG2,"WantedBufferSize = %li\n",WantedBufferSize);
|
||||
mp_msg(MSGT_DECAUDIO,MSGL_DBG2,"InputBufferSize = %li\n",InputBufferSize);
|
||||
mp_msg(MSGT_DECAUDIO,MSGL_DBG2,"OutputBufferSize = %li\n",OutputBufferSize);
|
||||
mp_msg(MSGT_DECAUDIO,MSGL_DBG2,"FramesToGet = %li\n",FramesToGet);
|
||||
|
||||
InFrameSize=(InputBufferSize+FramesToGet-1)/FramesToGet;
|
||||
OutFrameSize=OutputBufferSize/FramesToGet;
|
||||
|
||||
mp_msg(MSGT_DECAUDIO,MSGL_DBG2,"FrameSize: %i -> %i\n",InFrameSize,OutFrameSize);
|
||||
|
||||
error = SoundConverterBeginConversion(myConverter);
|
||||
mp_msg(MSGT_DECAUDIO,MSGL_DBG2,"SoundConverterBeginConversion:%i\n",error);
|
||||
if(error) return 0;
|
||||
|
||||
sh->audio_out_minsize=OutputBufferSize;
|
||||
sh->audio_in_minsize=InputBufferSize;
|
||||
|
||||
sh->channels=sh->wf->nChannels;
|
||||
sh->samplerate=sh->wf->nSamplesPerSec;
|
||||
sh->samplesize=2; //(sh->wf->wBitsPerSample+7)/8;
|
||||
|
||||
sh->i_bps=sh->wf->nAvgBytesPerSec;
|
||||
//InputBufferSize*WantedBufferSize/OutputBufferSize;
|
||||
|
||||
if(sh->format==0x3343414D){
|
||||
// MACE 3:1
|
||||
sh->ds->ss_div = 2*3; // 1 samples/packet
|
||||
sh->ds->ss_mul = sh->channels*2*1; // 1 bytes/packet
|
||||
} else
|
||||
if(sh->format==0x3643414D){
|
||||
// MACE 6:1
|
||||
sh->ds->ss_div = 2*6; // 1 samples/packet
|
||||
sh->ds->ss_mul = sh->channels*2*1; // 1 bytes/packet
|
||||
}
|
||||
|
||||
return 1; // return values: 1=OK 0=ERROR
|
||||
}
|
||||
|
||||
static int init(sh_audio_t *sh_audio){
|
||||
|
||||
return 1; // return values: 1=OK 0=ERROR
|
||||
}
|
||||
|
||||
static void uninit(sh_audio_t *sh){
|
||||
int error;
|
||||
unsigned long ConvertedFrames=0;
|
||||
unsigned long ConvertedBytes=0;
|
||||
|
||||
#if defined(WIN32_LOADER) && !defined(CONFIG_QUICKTIME)
|
||||
Setup_FS_Segment();
|
||||
#endif
|
||||
|
||||
error=SoundConverterEndConversion(myConverter,NULL,&ConvertedFrames,&ConvertedBytes);
|
||||
mp_msg(MSGT_DECAUDIO,MSGL_DBG2,"SoundConverterEndConversion:%i\n",error);
|
||||
error = SoundConverterClose(myConverter);
|
||||
mp_msg(MSGT_DECAUDIO,MSGL_DBG2,"SoundConverterClose:%i\n",error);
|
||||
// error = TerminateQTML();
|
||||
// printf("TerminateQTML:%i\n",error);
|
||||
// FreeLibrary( qtml_dll );
|
||||
// qtml_dll = NULL;
|
||||
// FreeLibrary( qtime_qts );
|
||||
// qtime_qts = NULL;
|
||||
// printf("qt dll loader uninit done\n");
|
||||
#ifdef CONFIG_QUICKTIME
|
||||
ExitMovies();
|
||||
#endif
|
||||
}
|
||||
|
||||
static int decode_audio(sh_audio_t *sh,unsigned char *buf,int minlen,int maxlen){
|
||||
unsigned long FramesToGet=0; //how many frames the demuxer has to get
|
||||
unsigned long InputBufferSize=0; //size of the input buffer
|
||||
unsigned long ConvertedFrames=0;
|
||||
unsigned long ConvertedBytes=0;
|
||||
|
||||
#if defined(WIN32_LOADER) && !defined(CONFIG_QUICKTIME)
|
||||
Setup_FS_Segment();
|
||||
#endif
|
||||
|
||||
FramesToGet=minlen/OutFrameSize;
|
||||
if(FramesToGet*OutFrameSize<minlen &&
|
||||
(FramesToGet+1)*OutFrameSize<=maxlen) ++FramesToGet;
|
||||
if(FramesToGet*InFrameSize>sh->a_in_buffer_size)
|
||||
FramesToGet=sh->a_in_buffer_size/InFrameSize;
|
||||
|
||||
InputBufferSize=FramesToGet*InFrameSize;
|
||||
|
||||
// printf("FramesToGet = %li (%li -> %li bytes)\n",FramesToGet,
|
||||
// InputBufferSize, FramesToGet*OutFrameSize);
|
||||
|
||||
if(InputBufferSize>sh->a_in_buffer_len){
|
||||
int x=demux_read_data(sh->ds,&sh->a_in_buffer[sh->a_in_buffer_len],
|
||||
InputBufferSize-sh->a_in_buffer_len);
|
||||
if(x>0) sh->a_in_buffer_len+=x;
|
||||
if(InputBufferSize>sh->a_in_buffer_len)
|
||||
FramesToGet=sh->a_in_buffer_len/InFrameSize; // not enough data!
|
||||
}
|
||||
|
||||
// printf("\nSoundConverterConvertBuffer(myConv=%p,inbuf=%p,frames=%d,outbuf=%p,&convframes=%p,&convbytes=%p)\n",
|
||||
// myConverter,sh->a_in_buffer,FramesToGet,buf,&ConvertedFrames,&ConvertedBytes);
|
||||
SoundConverterConvertBuffer(myConverter,sh->a_in_buffer,
|
||||
FramesToGet,buf,&ConvertedFrames,&ConvertedBytes);
|
||||
// printf("SoundConverterConvertBuffer:%i\n",error);
|
||||
// printf("ConvertedFrames = %li\n",ConvertedFrames);
|
||||
// printf("ConvertedBytes = %li\n",ConvertedBytes);
|
||||
|
||||
// InputBufferSize=(ConvertedBytes/OutFrameSize)*InFrameSize; // FIXME!!
|
||||
InputBufferSize=FramesToGet*InFrameSize;
|
||||
sh->a_in_buffer_len-=InputBufferSize;
|
||||
if(sh->a_in_buffer_len<0) sh->a_in_buffer_len=0; // should not happen...
|
||||
else if(sh->a_in_buffer_len>0){
|
||||
memcpy(sh->a_in_buffer,&sh->a_in_buffer[InputBufferSize],sh->a_in_buffer_len);
|
||||
}
|
||||
|
||||
return ConvertedBytes;
|
||||
}
|
||||
|
||||
static int control(sh_audio_t *sh,int cmd,void* arg, ...){
|
||||
// various optional functions you MAY implement:
|
||||
return CONTROL_UNKNOWN;
|
||||
}
|
||||
@@ -1,463 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "config.h"
|
||||
|
||||
//#include <stddef.h>
|
||||
#ifdef HAVE_LIBDL
|
||||
#include <dlfcn.h>
|
||||
#endif
|
||||
#include "path.h"
|
||||
#include "libavutil/attributes.h"
|
||||
#include "ad_internal.h"
|
||||
#include "loader/wine/windef.h"
|
||||
|
||||
static const ad_info_t info = {
|
||||
"RealAudio decoder",
|
||||
"realaud",
|
||||
"Alex Beregszaszi",
|
||||
"Florian Schneider, Arpad Gereoffy, Alex Beregszaszi, Donnie Smith",
|
||||
"binary real audio codecs"
|
||||
};
|
||||
|
||||
LIBAD_EXTERN(realaud)
|
||||
|
||||
void *__builtin_new(unsigned long size);
|
||||
void __builtin_delete(void *ize);
|
||||
|
||||
void *__builtin_new(unsigned long size) {
|
||||
return malloc(size);
|
||||
}
|
||||
|
||||
// required for cook's uninit:
|
||||
void __builtin_delete(void* ize) {
|
||||
free(ize);
|
||||
}
|
||||
|
||||
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
|
||||
void *__ctype_b=NULL;
|
||||
#endif
|
||||
|
||||
static unsigned long (*raCloseCodec)(void*);
|
||||
static unsigned long (*raDecode)(void*, char*,unsigned long,char*,unsigned int*,long);
|
||||
static unsigned long (*raFreeDecoder)(void*);
|
||||
//static unsigned long (*raGetNumberOfFlavors2)(void);
|
||||
static unsigned long (*raInitDecoder)(void*, void*);
|
||||
static unsigned long (*raOpenCodec)(void*);
|
||||
static unsigned long (*raOpenCodec2)(void*, void*);
|
||||
static unsigned long (*raSetFlavor)(void*,unsigned long);
|
||||
static void (*raSetDLLAccessPath)(char*);
|
||||
static void (*raSetPwd)(char*,char*);
|
||||
#ifdef CONFIG_WIN32DLL
|
||||
static unsigned long WINAPI (*wraCloseCodec)(void*);
|
||||
static unsigned long WINAPI (*wraDecode)(void*, char*,unsigned long,char*,unsigned int*,long);
|
||||
static unsigned long WINAPI (*wraFreeDecoder)(void*);
|
||||
static unsigned long WINAPI (*wraInitDecoder)(void*, void*);
|
||||
static unsigned long WINAPI (*wraOpenCodec)(void*);
|
||||
static unsigned long WINAPI (*wraOpenCodec2)(void*, void*);
|
||||
static unsigned long WINAPI (*wraSetFlavor)(void*,unsigned long);
|
||||
static void WINAPI (*wraSetDLLAccessPath)(char*);
|
||||
static void WINAPI (*wraSetPwd)(char*,char*);
|
||||
|
||||
static int dll_type = 0; /* 0 = unix dlopen, 1 = win32 dll */
|
||||
#endif
|
||||
|
||||
static void *rv_handle = NULL;
|
||||
|
||||
#if 0
|
||||
typedef struct {
|
||||
int samplerate;
|
||||
short bits;
|
||||
short channels;
|
||||
int unk1;
|
||||
int unk2;
|
||||
int packetsize;
|
||||
int unk3;
|
||||
void* unk4;
|
||||
} ra_init_t ;
|
||||
#else
|
||||
|
||||
/*
|
||||
Probably the linux .so-s were compiled with old GCC without setting
|
||||
packing, so it adds 2 bytes padding after the quality field.
|
||||
In windows it seems that there's no padding in it.
|
||||
|
||||
-- alex
|
||||
*/
|
||||
|
||||
/* linux dlls doesn't need packing */
|
||||
typedef struct /*__attribute__((__packed__))*/ {
|
||||
int samplerate;
|
||||
short bits;
|
||||
short channels;
|
||||
short quality;
|
||||
/* 2bytes padding here, by gcc */
|
||||
int bits_per_frame;
|
||||
int packetsize;
|
||||
int extradata_len;
|
||||
void* extradata;
|
||||
} ra_init_t;
|
||||
|
||||
/* windows dlls need packed structs (no padding) */
|
||||
typedef struct __attribute__((__packed__)) {
|
||||
int samplerate;
|
||||
short bits;
|
||||
short channels;
|
||||
short quality;
|
||||
int bits_per_frame;
|
||||
int packetsize;
|
||||
int extradata_len;
|
||||
void* extradata;
|
||||
} wra_init_t;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LIBDL
|
||||
static int load_syms_linux(char *path)
|
||||
{
|
||||
void *handle;
|
||||
|
||||
mp_msg(MSGT_DECVIDEO, MSGL_V, "opening shared obj '%s'\n", path);
|
||||
handle = dlopen(path, RTLD_LAZY);
|
||||
if (!handle)
|
||||
{
|
||||
mp_msg(MSGT_DECVIDEO, MSGL_WARN, "Error: %s\n", dlerror());
|
||||
return 0;
|
||||
}
|
||||
|
||||
raCloseCodec = dlsym(handle, "RACloseCodec");
|
||||
raDecode = dlsym(handle, "RADecode");
|
||||
raFreeDecoder = dlsym(handle, "RAFreeDecoder");
|
||||
raOpenCodec = dlsym(handle, "RAOpenCodec");
|
||||
raOpenCodec2 = dlsym(handle, "RAOpenCodec2");
|
||||
raInitDecoder = dlsym(handle, "RAInitDecoder");
|
||||
raSetFlavor = dlsym(handle, "RASetFlavor");
|
||||
raSetDLLAccessPath = dlsym(handle, "SetDLLAccessPath");
|
||||
raSetPwd = dlsym(handle, "RASetPwd"); // optional, used by SIPR
|
||||
|
||||
if (raCloseCodec && raDecode && raFreeDecoder &&
|
||||
(raOpenCodec||raOpenCodec2) && raSetFlavor &&
|
||||
/*raSetDLLAccessPath &&*/ raInitDecoder)
|
||||
{
|
||||
rv_handle = handle;
|
||||
return 1;
|
||||
}
|
||||
|
||||
mp_msg(MSGT_DECAUDIO,MSGL_WARN,"Cannot resolve symbols - incompatible dll: %s\n",path);
|
||||
dlclose(handle);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_WIN32DLL
|
||||
|
||||
#ifdef WIN32_LOADER
|
||||
#include "loader/ldt_keeper.h"
|
||||
#endif
|
||||
void* WINAPI LoadLibraryA(char* name);
|
||||
void* WINAPI GetProcAddress(void* handle,char *func);
|
||||
int WINAPI FreeLibrary(void *handle);
|
||||
|
||||
static int load_syms_windows(char *path)
|
||||
{
|
||||
void *handle;
|
||||
|
||||
mp_msg(MSGT_DECVIDEO, MSGL_V, "opening win32 dll '%s'\n", path);
|
||||
#ifdef WIN32_LOADER
|
||||
Setup_LDT_Keeper();
|
||||
#endif
|
||||
handle = LoadLibraryA(path);
|
||||
if (!handle)
|
||||
{
|
||||
mp_msg(MSGT_DECVIDEO, MSGL_WARN, "Error loading dll\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
wraCloseCodec = GetProcAddress(handle, "RACloseCodec");
|
||||
wraDecode = GetProcAddress(handle, "RADecode");
|
||||
wraFreeDecoder = GetProcAddress(handle, "RAFreeDecoder");
|
||||
wraOpenCodec = GetProcAddress(handle, "RAOpenCodec");
|
||||
wraOpenCodec2 = GetProcAddress(handle, "RAOpenCodec2");
|
||||
wraInitDecoder = GetProcAddress(handle, "RAInitDecoder");
|
||||
wraSetFlavor = GetProcAddress(handle, "RASetFlavor");
|
||||
wraSetDLLAccessPath = GetProcAddress(handle, "SetDLLAccessPath");
|
||||
wraSetPwd = GetProcAddress(handle, "RASetPwd"); // optional, used by SIPR
|
||||
|
||||
if (wraCloseCodec && wraDecode && wraFreeDecoder &&
|
||||
(wraOpenCodec || wraOpenCodec2) && wraSetFlavor &&
|
||||
/*wraSetDLLAccessPath &&*/ wraInitDecoder)
|
||||
{
|
||||
rv_handle = handle;
|
||||
dll_type = 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
mp_msg(MSGT_DECAUDIO,MSGL_WARN,"Cannot resolve symbols - incompatible dll: %s\n",path);
|
||||
FreeLibrary(handle);
|
||||
return 0;
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
static int preinit(sh_audio_t *sh){
|
||||
// let's check if the driver is available, return 0 if not.
|
||||
// (you should do that if you use external lib(s) which is optional)
|
||||
unsigned int result;
|
||||
char *path;
|
||||
|
||||
path = malloc(strlen(codec_path) + strlen(sh->codec->dll) + 2);
|
||||
if (!path) return 0;
|
||||
sprintf(path, "%s/%s", codec_path, sh->codec->dll);
|
||||
|
||||
/* first try to load linux dlls, if failed and we're supporting win32 dlls,
|
||||
then try to load the windows ones */
|
||||
|
||||
#ifdef HAVE_LIBDL
|
||||
if (strstr(sh->codec->dll,".dll") || !load_syms_linux(path))
|
||||
#endif
|
||||
#ifdef CONFIG_WIN32DLL
|
||||
if (!load_syms_windows(sh->codec->dll))
|
||||
#endif
|
||||
{
|
||||
mp_tmsg(MSGT_DECVIDEO, MSGL_ERR, "ERROR: Could not open required DirectShow codec %s.\n", sh->codec->dll);
|
||||
mp_msg(MSGT_DECVIDEO, MSGL_HINT, "Read the RealAudio section of the DOCS!\n");
|
||||
free(path);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_WIN32DLL
|
||||
if((raSetDLLAccessPath && dll_type == 0) || (wraSetDLLAccessPath && dll_type == 1)){
|
||||
#else
|
||||
if(raSetDLLAccessPath){
|
||||
#endif
|
||||
// used by 'SIPR'
|
||||
path = realloc(path, strlen(codec_path) + 13);
|
||||
sprintf(path, "DT_Codecs=%s", codec_path);
|
||||
if(path[strlen(path)-1]!='/'){
|
||||
path[strlen(path)+1]=0;
|
||||
path[strlen(path)]='/';
|
||||
}
|
||||
path[strlen(path)+1]=0;
|
||||
#ifdef CONFIG_WIN32DLL
|
||||
if (dll_type == 1)
|
||||
{
|
||||
int i;
|
||||
for (i=0; i < strlen(path); i++)
|
||||
if (path[i] == '/') path[i] = '\\';
|
||||
wraSetDLLAccessPath(path);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
raSetDLLAccessPath(path);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_WIN32DLL
|
||||
if (dll_type == 1){
|
||||
if (wraOpenCodec2) {
|
||||
sprintf(path, "%s\\", codec_path);
|
||||
result = wraOpenCodec2(&sh->context, path);
|
||||
} else
|
||||
result=wraOpenCodec(&sh->context);
|
||||
} else
|
||||
#endif
|
||||
if (raOpenCodec2) {
|
||||
sprintf(path, "%s/", codec_path);
|
||||
result = raOpenCodec2(&sh->context, path);
|
||||
} else
|
||||
result=raOpenCodec(&sh->context);
|
||||
if(result){
|
||||
mp_msg(MSGT_DECAUDIO,MSGL_WARN,"Decoder open failed, error code: 0x%X\n",result);
|
||||
return 0;
|
||||
}
|
||||
// printf("opencodec ok (result: %x)\n", result);
|
||||
free(path); /* after this it isn't used anymore */
|
||||
|
||||
sh->samplerate=sh->wf->nSamplesPerSec;
|
||||
sh->samplesize=sh->wf->wBitsPerSample/8;
|
||||
sh->channels=sh->wf->nChannels;
|
||||
|
||||
{
|
||||
ra_init_t init_data={
|
||||
sh->wf->nSamplesPerSec,
|
||||
sh->wf->wBitsPerSample,
|
||||
sh->wf->nChannels,
|
||||
100, // quality
|
||||
sh->wf->nBlockAlign, // subpacket size
|
||||
sh->wf->nBlockAlign, // coded frame size
|
||||
sh->wf->cbSize, // codec data length
|
||||
(char*)(sh->wf+1) // extras
|
||||
};
|
||||
#ifdef CONFIG_WIN32DLL
|
||||
wra_init_t winit_data={
|
||||
sh->wf->nSamplesPerSec,
|
||||
sh->wf->wBitsPerSample,
|
||||
sh->wf->nChannels,
|
||||
100, // quality
|
||||
sh->wf->nBlockAlign, // subpacket size
|
||||
sh->wf->nBlockAlign, // coded frame size
|
||||
sh->wf->cbSize, // codec data length
|
||||
(char*)(sh->wf+1) // extras
|
||||
};
|
||||
#endif
|
||||
#ifdef CONFIG_WIN32DLL
|
||||
if (dll_type == 1)
|
||||
result=wraInitDecoder(sh->context,&winit_data);
|
||||
else
|
||||
#endif
|
||||
result=raInitDecoder(sh->context,&init_data);
|
||||
|
||||
if(result){
|
||||
mp_msg(MSGT_DECAUDIO,MSGL_WARN,"Decoder init failed, error code: 0x%X\n",result);
|
||||
return 0;
|
||||
}
|
||||
// printf("initdecoder ok (result: %x)\n", result);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_WIN32DLL
|
||||
if((raSetPwd && dll_type == 0) || (wraSetPwd && dll_type == 1)){
|
||||
#else
|
||||
if(raSetPwd){
|
||||
#endif
|
||||
// used by 'SIPR'
|
||||
#ifdef CONFIG_WIN32DLL
|
||||
if (dll_type == 1)
|
||||
wraSetPwd(sh->context,"Ardubancel Quazanga");
|
||||
else
|
||||
#endif
|
||||
raSetPwd(sh->context,"Ardubancel Quazanga"); // set password... lol.
|
||||
}
|
||||
|
||||
if (sh->format == mmioFOURCC('s','i','p','r')) {
|
||||
short flavor;
|
||||
|
||||
if (sh->wf->nAvgBytesPerSec > 1531)
|
||||
flavor = 3;
|
||||
else if (sh->wf->nAvgBytesPerSec > 937)
|
||||
flavor = 1;
|
||||
else if (sh->wf->nAvgBytesPerSec > 719)
|
||||
flavor = 0;
|
||||
else
|
||||
flavor = 2;
|
||||
mp_msg(MSGT_DECAUDIO,MSGL_V,"Got sipr flavor %d from bitrate %d\n",flavor, sh->wf->nAvgBytesPerSec);
|
||||
|
||||
#ifdef CONFIG_WIN32DLL
|
||||
if (dll_type == 1)
|
||||
result=wraSetFlavor(sh->context,flavor);
|
||||
else
|
||||
#endif
|
||||
result=raSetFlavor(sh->context,flavor);
|
||||
if(result){
|
||||
mp_msg(MSGT_DECAUDIO,MSGL_WARN,"Decoder flavor setup failed, error code: 0x%X\n",result);
|
||||
return 0;
|
||||
}
|
||||
} // sipr flavor
|
||||
|
||||
sh->i_bps=sh->wf->nAvgBytesPerSec;
|
||||
|
||||
sh->audio_out_minsize=128000; // no idea how to get... :(
|
||||
sh->audio_in_minsize = sh->wf->nBlockAlign;
|
||||
|
||||
return 1; // return values: 1=OK 0=ERROR
|
||||
}
|
||||
|
||||
static int init(sh_audio_t *sh_audio){
|
||||
// initialize the decoder, set tables etc...
|
||||
|
||||
// you can store HANDLE or private struct pointer at sh->context
|
||||
// you can access WAVEFORMATEX header at sh->wf
|
||||
|
||||
// set sample format/rate parameters if you didn't do it in preinit() yet.
|
||||
|
||||
return 1; // return values: 1=OK 0=ERROR
|
||||
}
|
||||
|
||||
static void uninit(sh_audio_t *sh){
|
||||
// uninit the decoder etc...
|
||||
// again: you don't have to free() a_in_buffer here! it's done by the core.
|
||||
#ifdef CONFIG_WIN32DLL
|
||||
if (dll_type == 1)
|
||||
{
|
||||
if (wraFreeDecoder) wraFreeDecoder(sh->context);
|
||||
if (wraCloseCodec) wraCloseCodec(sh->context);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (raFreeDecoder) raFreeDecoder(sh->context);
|
||||
if (raCloseCodec) raCloseCodec(sh->context);
|
||||
|
||||
|
||||
#ifdef CONFIG_WIN32DLL
|
||||
if (dll_type == 1)
|
||||
{
|
||||
if (rv_handle) FreeLibrary(rv_handle);
|
||||
} else
|
||||
#endif
|
||||
// this dlclose() causes some memory corruption, and crashes soon (in caller):
|
||||
// if (rv_handle) dlclose(rv_handle);
|
||||
rv_handle = NULL;
|
||||
}
|
||||
|
||||
static int decode_audio(sh_audio_t *sh,unsigned char *buf,int minlen,int maxlen){
|
||||
int result av_unused;
|
||||
int len=-1;
|
||||
|
||||
if(sh->a_in_buffer_len<=0){
|
||||
// fill the buffer!
|
||||
if (sh->ds->eof)
|
||||
return 0;
|
||||
demux_read_data(sh->ds, sh->a_in_buffer, sh->wf->nBlockAlign);
|
||||
sh->a_in_buffer_size=
|
||||
sh->a_in_buffer_len=sh->wf->nBlockAlign;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_WIN32DLL
|
||||
if (dll_type == 1)
|
||||
result=wraDecode(sh->context, sh->a_in_buffer+sh->a_in_buffer_size-sh->a_in_buffer_len, sh->wf->nBlockAlign,
|
||||
buf, &len, -1);
|
||||
else
|
||||
#endif
|
||||
result=raDecode(sh->context, sh->a_in_buffer+sh->a_in_buffer_size-sh->a_in_buffer_len, sh->wf->nBlockAlign,
|
||||
buf, &len, -1);
|
||||
sh->a_in_buffer_len-=sh->wf->nBlockAlign;
|
||||
|
||||
// printf("radecode: %d bytes, res=0x%X \n",len,result);
|
||||
|
||||
return len; // return value: number of _bytes_ written to output buffer,
|
||||
// or -1 for EOF (or uncorrectable error)
|
||||
}
|
||||
|
||||
static int control(sh_audio_t *sh,int cmd,void* arg, ...){
|
||||
// various optional functions you MAY implement:
|
||||
switch(cmd){
|
||||
case ADCTRL_RESYNC_STREAM:
|
||||
// it is called once after seeking, to resync.
|
||||
// Note: sh_audio->a_in_buffer_len=0; is done _before_ this call!
|
||||
return CONTROL_TRUE;
|
||||
case ADCTRL_SKIP_FRAME:
|
||||
// it is called to skip (jump over) small amount (1/10 sec or 1 frame)
|
||||
// of audio data - used to sync audio to video after seeking
|
||||
// if you don't return CONTROL_TRUE, it will defaults to:
|
||||
// ds_fill_buffer(sh_audio->ds); // skip 1 demux packet
|
||||
return CONTROL_TRUE;
|
||||
}
|
||||
return CONTROL_UNKNOWN;
|
||||
}
|
||||
@@ -39,13 +39,8 @@
|
||||
|
||||
extern const vd_functions_t mpcodecs_vd_null;
|
||||
extern const vd_functions_t mpcodecs_vd_ffmpeg;
|
||||
extern const vd_functions_t mpcodecs_vd_dshow;
|
||||
extern const vd_functions_t mpcodecs_vd_dmo;
|
||||
extern const vd_functions_t mpcodecs_vd_vfw;
|
||||
extern const vd_functions_t mpcodecs_vd_vfwex;
|
||||
extern const vd_functions_t mpcodecs_vd_raw;
|
||||
extern const vd_functions_t mpcodecs_vd_hmblck;
|
||||
extern const vd_functions_t mpcodecs_vd_xanim;
|
||||
extern const vd_functions_t mpcodecs_vd_mpng;
|
||||
extern const vd_functions_t mpcodecs_vd_ijpg;
|
||||
extern const vd_functions_t mpcodecs_vd_mtga;
|
||||
@@ -61,18 +56,9 @@ extern const vd_functions_t mpcodecs_vd_qtvideo;
|
||||
const vd_functions_t * const mpcodecs_vd_drivers[] = {
|
||||
&mpcodecs_vd_null,
|
||||
&mpcodecs_vd_ffmpeg,
|
||||
#ifdef CONFIG_WIN32DLL
|
||||
&mpcodecs_vd_dshow,
|
||||
&mpcodecs_vd_dmo,
|
||||
&mpcodecs_vd_vfw,
|
||||
&mpcodecs_vd_vfwex,
|
||||
#endif
|
||||
&mpcodecs_vd_lzo,
|
||||
&mpcodecs_vd_raw,
|
||||
&mpcodecs_vd_hmblck,
|
||||
#ifdef CONFIG_XANIM
|
||||
&mpcodecs_vd_xanim,
|
||||
#endif
|
||||
#ifdef CONFIG_PNG
|
||||
&mpcodecs_vd_mpng,
|
||||
#endif
|
||||
@@ -80,14 +66,8 @@ const vd_functions_t * const mpcodecs_vd_drivers[] = {
|
||||
&mpcodecs_vd_ijpg,
|
||||
#endif
|
||||
&mpcodecs_vd_mtga,
|
||||
#ifdef CONFIG_REALCODECS
|
||||
&mpcodecs_vd_realvid,
|
||||
#endif
|
||||
#ifdef CONFIG_LIBDV095
|
||||
&mpcodecs_vd_libdv,
|
||||
#endif
|
||||
#ifdef CONFIG_QTX_CODECS
|
||||
&mpcodecs_vd_qtvideo,
|
||||
#endif
|
||||
/* Please do not add any new decoders here. If you want to implement a new
|
||||
* decoder, add it to libavcodec, except for wrappers around external
|
||||
|
||||
@@ -1,134 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "mp_msg.h"
|
||||
|
||||
#include "vd_internal.h"
|
||||
|
||||
#include "loader/dmo/DMO_VideoDecoder.h"
|
||||
|
||||
static const vd_info_t info = {
|
||||
"DMO video codecs",
|
||||
"dmo",
|
||||
"A'rpi",
|
||||
"based on http://avifile.sf.net",
|
||||
"win32 codecs"
|
||||
};
|
||||
|
||||
LIBVD_EXTERN(dmo)
|
||||
|
||||
struct context {
|
||||
void *decoder;
|
||||
uint8_t *buffer;
|
||||
int stride;
|
||||
};
|
||||
|
||||
// to set/get/query special features/parameters
|
||||
static int control(sh_video_t *sh,int cmd,void* arg,...){
|
||||
return CONTROL_UNKNOWN;
|
||||
}
|
||||
|
||||
// init driver
|
||||
static int init(sh_video_t *sh){
|
||||
unsigned int out_fmt=sh->codec->outfmt[0];
|
||||
struct context *ctx;
|
||||
void *decoder;
|
||||
if(!(decoder=DMO_VideoDecoder_Open(sh->codec->dll,&sh->codec->guid, sh->bih, 0, 0))){
|
||||
mp_tmsg(MSGT_DECVIDEO,MSGL_ERR,"ERROR: Could not open required DirectShow codec %s.\n",sh->codec->dll);
|
||||
mp_tmsg(MSGT_DECVIDEO,MSGL_HINT,"You need to upgrade/install the binary codecs package.\nGo to http://www.mplayerhq.hu/dload.html\n");
|
||||
return 0;
|
||||
}
|
||||
if(!mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,out_fmt)) return 0;
|
||||
// mpcodecs_config_vo can change the format
|
||||
out_fmt=sh->codec->outfmt[sh->outfmtidx];
|
||||
sh->context = ctx = calloc(1, sizeof(*ctx));
|
||||
ctx->decoder = decoder;
|
||||
switch(out_fmt){
|
||||
case IMGFMT_YUY2:
|
||||
case IMGFMT_UYVY:
|
||||
DMO_VideoDecoder_SetDestFmt(ctx->decoder,16,out_fmt);break; // packed YUV
|
||||
case IMGFMT_YV12:
|
||||
case IMGFMT_I420:
|
||||
case IMGFMT_IYUV:
|
||||
DMO_VideoDecoder_SetDestFmt(ctx->decoder,12,out_fmt);break; // planar YUV
|
||||
case IMGFMT_YVU9:
|
||||
DMO_VideoDecoder_SetDestFmt(ctx->decoder,9,out_fmt);break;
|
||||
case IMGFMT_RGB24:
|
||||
case IMGFMT_BGR24:
|
||||
if (sh->disp_w & 3)
|
||||
{
|
||||
ctx->stride = ((sh->disp_w * 3) + 3) & ~3;
|
||||
ctx->buffer = av_malloc(ctx->stride * sh->disp_h);
|
||||
}
|
||||
default:
|
||||
DMO_VideoDecoder_SetDestFmt(ctx->decoder,out_fmt&255,0); // RGB/BGR
|
||||
}
|
||||
DMO_VideoDecoder_StartInternal(ctx->decoder);
|
||||
mp_tmsg(MSGT_DECVIDEO,MSGL_V,"INFO: Win32/DMO video codec init OK.\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
// uninit driver
|
||||
static void uninit(sh_video_t *sh){
|
||||
struct context *ctx = sh->context;
|
||||
DMO_VideoDecoder_Destroy(ctx->decoder);
|
||||
av_free(ctx->buffer);
|
||||
free(ctx);
|
||||
sh->context = NULL;
|
||||
}
|
||||
|
||||
//mp_image_t* mpcodecs_get_image(sh_video_t *sh, int mp_imgtype, int mp_imgflag, int w, int h);
|
||||
|
||||
// decode a frame
|
||||
static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){
|
||||
struct context *ctx = sh->context;
|
||||
uint8_t *buffer = ctx->buffer;
|
||||
int type = ctx->buffer ? MP_IMGTYPE_EXPORT : MP_IMGTYPE_TEMP;
|
||||
mp_image_t* mpi;
|
||||
if(len<=0) return NULL; // skipped frame
|
||||
|
||||
if(flags&3){
|
||||
// framedrop:
|
||||
DMO_VideoDecoder_DecodeInternal(ctx->decoder, data, len, 0, 0);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
mpi=mpcodecs_get_image(sh, type, MP_IMGFLAG_COMMON_PLANE,
|
||||
sh->disp_w, sh->disp_h);
|
||||
if (buffer) {
|
||||
mpi->planes[0] = buffer;
|
||||
mpi->stride[0] = ctx->stride;
|
||||
} else {
|
||||
buffer = mpi->planes[0];
|
||||
}
|
||||
|
||||
if(!mpi){ // temporary!
|
||||
mp_tmsg(MSGT_DECVIDEO,MSGL_WARN,"[VD_DMO] Couldn't allocate image for cinepak codec.\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
DMO_VideoDecoder_DecodeInternal(ctx->decoder, data, len, 1, buffer);
|
||||
|
||||
return mpi;
|
||||
}
|
||||
@@ -1,133 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "mp_msg.h"
|
||||
|
||||
#include "vd_internal.h"
|
||||
|
||||
#include "loader/dshow/DS_VideoDecoder.h"
|
||||
|
||||
static const vd_info_t info = {
|
||||
"DirectShow video codecs",
|
||||
"dshow",
|
||||
"A'rpi",
|
||||
"based on http://avifile.sf.net",
|
||||
"win32 codecs"
|
||||
};
|
||||
|
||||
LIBVD_EXTERN(dshow)
|
||||
|
||||
// to set/get/query special features/parameters
|
||||
static int control(sh_video_t *sh,int cmd,void* arg,...){
|
||||
switch(cmd){
|
||||
case VDCTRL_QUERY_MAX_PP_LEVEL:
|
||||
return 4;
|
||||
case VDCTRL_SET_PP_LEVEL:
|
||||
if(!sh->context) return CONTROL_ERROR;
|
||||
DS_VideoDecoder_SetValue(sh->context,"Quality",*((int*)arg));
|
||||
return CONTROL_OK;
|
||||
|
||||
case VDCTRL_SET_EQUALIZER: {
|
||||
va_list ap;
|
||||
int value;
|
||||
va_start(ap, arg);
|
||||
value=va_arg(ap, int);
|
||||
va_end(ap);
|
||||
if(DS_VideoDecoder_SetValue(sh->context,arg,50+value/2)==0)
|
||||
return CONTROL_OK;
|
||||
return CONTROL_FALSE;
|
||||
}
|
||||
|
||||
}
|
||||
return CONTROL_UNKNOWN;
|
||||
}
|
||||
|
||||
// init driver
|
||||
static int init(sh_video_t *sh){
|
||||
unsigned int out_fmt=sh->codec->outfmt[0];
|
||||
|
||||
/* Hack for VSSH codec: new dll can't decode old files
|
||||
* In my samples old files have no extradata, so use that info
|
||||
* to decide what dll should be used (here and in vd_vfw).
|
||||
*/
|
||||
if (!strcmp(sh->codec->dll, "vsshdsd.dll") && (sh->bih->biSize == 40))
|
||||
return 0;
|
||||
|
||||
if(!(sh->context=DS_VideoDecoder_Open(sh->codec->dll,&sh->codec->guid, sh->bih, 0, 0))){
|
||||
mp_tmsg(MSGT_DECVIDEO,MSGL_ERR,"ERROR: Could not open required DirectShow codec %s.\n",sh->codec->dll);
|
||||
mp_tmsg(MSGT_DECVIDEO,MSGL_HINT,"You need to upgrade/install the binary codecs package.\nGo to http://www.mplayerhq.hu/dload.html\n");
|
||||
return 0;
|
||||
}
|
||||
if(!mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,out_fmt)) return 0;
|
||||
// mpcodecs_config_vo can change the format
|
||||
out_fmt=sh->codec->outfmt[sh->outfmtidx];
|
||||
switch(out_fmt){
|
||||
case IMGFMT_YUY2:
|
||||
case IMGFMT_UYVY:
|
||||
DS_VideoDecoder_SetDestFmt(sh->context,16,out_fmt);break; // packed YUV
|
||||
case IMGFMT_YV12:
|
||||
case IMGFMT_I420:
|
||||
case IMGFMT_IYUV:
|
||||
DS_VideoDecoder_SetDestFmt(sh->context,12,out_fmt);break; // planar YUV
|
||||
case IMGFMT_YVU9:
|
||||
DS_VideoDecoder_SetDestFmt(sh->context,9,out_fmt);break;
|
||||
default:
|
||||
DS_VideoDecoder_SetDestFmt(sh->context,out_fmt&255,0); // RGB/BGR
|
||||
}
|
||||
DS_SetAttr_DivX("Quality",divx_quality);
|
||||
DS_VideoDecoder_StartInternal(sh->context);
|
||||
mp_tmsg(MSGT_DECVIDEO,MSGL_V,"INFO: Win32/DShow video codec init OK.\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
// uninit driver
|
||||
static void uninit(sh_video_t *sh){
|
||||
DS_VideoDecoder_Destroy(sh->context);
|
||||
}
|
||||
|
||||
//mp_image_t* mpcodecs_get_image(sh_video_t *sh, int mp_imgtype, int mp_imgflag, int w, int h);
|
||||
|
||||
// decode a frame
|
||||
static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){
|
||||
mp_image_t* mpi;
|
||||
if(len<=0) return NULL; // skipped frame
|
||||
|
||||
if(flags&3){
|
||||
// framedrop:
|
||||
DS_VideoDecoder_DecodeInternal(sh->context, data, len, 0, 0);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
mpi=mpcodecs_get_image(sh, MP_IMGTYPE_TEMP, MP_IMGFLAG_COMMON_PLANE,
|
||||
sh->disp_w, sh->disp_h);
|
||||
|
||||
if(!mpi){ // temporary!
|
||||
mp_tmsg(MSGT_DECVIDEO,MSGL_WARN,"[VD_DMO] Couldn't allocate image for cinepak codec.\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
DS_VideoDecoder_DecodeInternal(sh->context, data, len, 0, mpi->planes[0]);
|
||||
|
||||
return mpi;
|
||||
}
|
||||
@@ -1,321 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#include "config.h"
|
||||
#include "mp_msg.h"
|
||||
#include "mpbswap.h"
|
||||
#include "vd_internal.h"
|
||||
|
||||
#ifdef CONFIG_QUICKTIME
|
||||
#include <QuickTime/ImageCodec.h>
|
||||
#define dump_ImageDescription(x)
|
||||
#else
|
||||
#include "loader/ldt_keeper.h"
|
||||
#include "loader/qtx/qtxsdk/components.h"
|
||||
#include "loader/wine/winbase.h"
|
||||
#include "loader/wine/windef.h"
|
||||
#endif
|
||||
|
||||
static const vd_info_t info = {
|
||||
"Quicktime Video decoder",
|
||||
"qtvideo",
|
||||
"A'rpi",
|
||||
"Sascha Sommer",
|
||||
"win32"
|
||||
};
|
||||
|
||||
LIBVD_EXTERN(qtvideo)
|
||||
|
||||
static mp_image_t* mpi;
|
||||
static Rect OutBufferRect; //the dimensions of our GWorld
|
||||
|
||||
static GWorldPtr OutBufferGWorld = NULL;//a GWorld is some kind of description for a drawing environment
|
||||
static ImageDescriptionHandle framedescHandle;
|
||||
static ImageSequence imageSeq;
|
||||
|
||||
#ifndef CONFIG_QUICKTIME
|
||||
static HINSTANCE qtime_qts; // handle to the preloaded quicktime.qts
|
||||
static HMODULE handler;
|
||||
static OSErr (*InitializeQTML)(long flags);
|
||||
static OSErr (*EnterMovies)(void);
|
||||
static void (*ExitMovies)(void);
|
||||
static OSErr (*DecompressSequenceBegin)(ImageSequence *seqID,
|
||||
ImageDescriptionHandle desc,
|
||||
CGrafPtr port,
|
||||
/*GDHandle*/void* gdh,
|
||||
const Rect *srcRect,
|
||||
MatrixRecordPtr matrix,
|
||||
short mode,
|
||||
RgnHandle mask,
|
||||
CodecFlags flags,
|
||||
CodecQ accuracy,
|
||||
DecompressorComponent codec);
|
||||
static OSErr (*DecompressSequenceFrameS)(ImageSequence seqID,
|
||||
Ptr data,
|
||||
long dataSize,
|
||||
CodecFlags inFlags,
|
||||
CodecFlags *outFlags,
|
||||
ICMCompletionProcRecordPtr asyncCompletionProc);
|
||||
static PixMapHandle (*GetGWorldPixMap)(GWorldPtr offscreenGWorld);
|
||||
static OSErr (*QTNewGWorldFromPtr)(GWorldPtr *gw,
|
||||
OSType pixelFormat,
|
||||
const Rect *boundsRect,
|
||||
CTabHandle cTable,
|
||||
/*GDHandle*/void* aGDevice, //unused anyway
|
||||
GWorldFlags flags,
|
||||
void *baseAddr,
|
||||
long rowBytes);
|
||||
static Handle (*NewHandleClear)(Size byteCount);
|
||||
static void (*DisposeHandle)(Handle h);
|
||||
static void (*DisposeGWorld)(GWorldPtr offscreenGWorld);
|
||||
static OSErr (*CDSequenceEnd)(ImageSequence seqID);
|
||||
#endif /* #ifndef CONFIG_QUICKTIME */
|
||||
|
||||
// to set/get/query special features/parameters
|
||||
static int control(sh_video_t *sh,int cmd,void* arg,...){
|
||||
return CONTROL_UNKNOWN;
|
||||
}
|
||||
|
||||
// init driver
|
||||
static int init(sh_video_t *sh){
|
||||
OSErr result = 1;
|
||||
int extradata_size = sh->bih ? sh->bih->biSize - sizeof(*sh->bih) : 0;
|
||||
void *extradata = sh->bih + 1;
|
||||
|
||||
if (!sh->ImageDesc)
|
||||
mp_msg(MSGT_DECVIDEO,MSGL_ERR,"sh->ImageDesc not set, try -demuxer mov if this fails.\n");
|
||||
|
||||
#ifndef CONFIG_QUICKTIME
|
||||
#ifdef WIN32_LOADER
|
||||
Setup_LDT_Keeper();
|
||||
#endif
|
||||
|
||||
//preload quicktime.qts to avoid the problems caused by the hardcoded path inside the dll
|
||||
qtime_qts = LoadLibraryA("QuickTime.qts");
|
||||
if(!qtime_qts){
|
||||
mp_msg(MSGT_DECVIDEO,MSGL_ERR,"unable to load QuickTime.qts\n" );
|
||||
return 0;
|
||||
}
|
||||
|
||||
handler = LoadLibraryA("qtmlClient.dll");
|
||||
if(!handler){
|
||||
mp_msg(MSGT_DECVIDEO,MSGL_ERR,"unable to load qtmlClient.dll\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
InitializeQTML = (OSErr (*)(long))GetProcAddress(handler, "InitializeQTML");
|
||||
EnterMovies = (OSErr (*)(void))GetProcAddress(handler, "EnterMovies");
|
||||
ExitMovies = (void (*)(void))GetProcAddress(handler, "ExitMovies");
|
||||
DecompressSequenceBegin = (OSErr (*)(ImageSequence*,ImageDescriptionHandle,CGrafPtr,void *,const Rect *,MatrixRecordPtr,short,RgnHandle,CodecFlags,CodecQ,DecompressorComponent))GetProcAddress(handler, "DecompressSequenceBegin");
|
||||
DecompressSequenceFrameS = (OSErr (*)(ImageSequence,Ptr,long,CodecFlags,CodecFlags*,ICMCompletionProcRecordPtr))GetProcAddress(handler, "DecompressSequenceFrameS");
|
||||
GetGWorldPixMap = (PixMapHandle (*)(GWorldPtr))GetProcAddress(handler, "GetGWorldPixMap");
|
||||
QTNewGWorldFromPtr = (OSErr(*)(GWorldPtr *,OSType,const Rect *,CTabHandle,void*,GWorldFlags,void *,long))GetProcAddress(handler, "QTNewGWorldFromPtr");
|
||||
NewHandleClear = (Handle(*)(Size))GetProcAddress(handler, "NewHandleClear");
|
||||
DisposeHandle = (void (*)(Handle))GetProcAddress(handler, "DisposeHandle");
|
||||
DisposeGWorld = (void (*)(GWorldPtr))GetProcAddress(handler, "DisposeGWorld");
|
||||
CDSequenceEnd = (OSErr (*)(ImageSequence))GetProcAddress(handler, "CDSequenceEnd");
|
||||
|
||||
if(!InitializeQTML || !EnterMovies || !DecompressSequenceBegin || !DecompressSequenceFrameS){
|
||||
mp_msg(MSGT_DECVIDEO,MSGL_ERR,"invalid qtmlClient.dll!\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
result=InitializeQTML(kInitializeQTMLDisableDirectSound |
|
||||
kInitializeQTMLUseGDIFlag |
|
||||
kInitializeQTMLDisableDDClippers);
|
||||
mp_msg(MSGT_DECVIDEO,MSGL_DBG2,"InitializeQTML returned %d\n",result);
|
||||
#endif /* CONFIG_QUICKTIME */
|
||||
|
||||
result=EnterMovies();
|
||||
mp_msg(MSGT_DECVIDEO,MSGL_DBG2,"EnterMovies returned %d\n",result);
|
||||
|
||||
//make a yuy2 gworld
|
||||
OutBufferRect.top=0;
|
||||
OutBufferRect.left=0;
|
||||
OutBufferRect.right=sh->disp_w;
|
||||
OutBufferRect.bottom=sh->disp_h;
|
||||
|
||||
//Fill the imagedescription for our SVQ3 frame
|
||||
//we can probably get this from Demuxer
|
||||
if (!sh->ImageDesc && extradata_size >= sizeof(ImageDescription) &&
|
||||
((ImageDescription *)extradata)->idSize <= extradata_size)
|
||||
sh->ImageDesc = extradata;
|
||||
if (sh->ImageDesc) {
|
||||
mp_msg(MSGT_DECVIDEO,MSGL_DBG2,"ImageDescription size: %d\n",((ImageDescription*)(sh->ImageDesc))->idSize);
|
||||
framedescHandle=(ImageDescriptionHandle)NewHandleClear(((ImageDescription*)(sh->ImageDesc))->idSize);
|
||||
memcpy(*framedescHandle,sh->ImageDesc,((ImageDescription*)(sh->ImageDesc))->idSize);
|
||||
} else {
|
||||
// assume extradata consists only of the atoms, build the other parts
|
||||
ImageDescription *idesc;
|
||||
int size = sizeof(*idesc) + extradata_size;
|
||||
mp_msg(MSGT_DECVIDEO, MSGL_V, "Generating a ImageDescription\n");
|
||||
framedescHandle=(ImageDescriptionHandle)NewHandleClear(size);
|
||||
idesc = *framedescHandle;
|
||||
memcpy(idesc + 1, extradata, extradata_size);
|
||||
idesc->idSize = size;
|
||||
idesc->width = sh->disp_w;
|
||||
idesc->height = sh->disp_h;
|
||||
}
|
||||
if (mp_msg_test(MSGT_DECVIDEO, MSGL_V))
|
||||
dump_ImageDescription(*framedescHandle);
|
||||
|
||||
(**framedescHandle).cType = bswap_32(sh->format);
|
||||
sh->context = (void *)kYUVSPixelFormat;
|
||||
{
|
||||
int imgfmt = sh->codec->outfmt[sh->outfmtidx];
|
||||
int qt_imgfmt;
|
||||
switch(imgfmt)
|
||||
{
|
||||
case IMGFMT_YUY2:
|
||||
qt_imgfmt = kYUVSPixelFormat;
|
||||
break;
|
||||
case IMGFMT_YVU9:
|
||||
qt_imgfmt = 0x73797639; //kYVU9PixelFormat;
|
||||
break;
|
||||
case IMGFMT_YV12:
|
||||
qt_imgfmt = 0x79343230;
|
||||
break;
|
||||
case IMGFMT_UYVY:
|
||||
qt_imgfmt = k2vuyPixelFormat;
|
||||
break;
|
||||
case IMGFMT_YVYU:
|
||||
qt_imgfmt = kYVYU422PixelFormat;
|
||||
imgfmt = IMGFMT_YUY2;
|
||||
break;
|
||||
case IMGFMT_RGB16:
|
||||
qt_imgfmt = k16LE555PixelFormat;
|
||||
break;
|
||||
case IMGFMT_BGR24:
|
||||
qt_imgfmt = k24BGRPixelFormat;
|
||||
break;
|
||||
case IMGFMT_BGR32:
|
||||
qt_imgfmt = k32BGRAPixelFormat;
|
||||
break;
|
||||
case IMGFMT_RGB32:
|
||||
qt_imgfmt = k32RGBAPixelFormat;
|
||||
break;
|
||||
default:
|
||||
mp_msg(MSGT_DECVIDEO,MSGL_ERR,"Unknown requested csp\n");
|
||||
return 0;
|
||||
}
|
||||
mp_msg(MSGT_DECVIDEO,MSGL_DBG2,"imgfmt: %s qt_imgfmt: %.4s\n", vo_format_name(imgfmt), (char *)&qt_imgfmt);
|
||||
sh->context = (void *)qt_imgfmt;
|
||||
if(!mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,imgfmt)) return 0;
|
||||
}
|
||||
|
||||
mpi=mpcodecs_get_image(sh, MP_IMGTYPE_STATIC, MP_IMGFLAG_PRESERVE,
|
||||
sh->disp_w, sh->disp_h);
|
||||
if(!mpi) return 0;
|
||||
|
||||
result = QTNewGWorldFromPtr(
|
||||
&OutBufferGWorld,
|
||||
(OSType)sh->context,
|
||||
&OutBufferRect, //we should benchmark if yvu9 is faster for svq3, too
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
mpi->planes[0],
|
||||
mpi->stride[0]);
|
||||
if (result) {
|
||||
mp_msg(MSGT_DECVIDEO,MSGL_ERR,"QTNewGWorldFromPtr result=%d\n",result);
|
||||
return 0;
|
||||
}
|
||||
|
||||
result = DecompressSequenceBegin(&imageSeq, framedescHandle, (CGrafPtr)OutBufferGWorld,
|
||||
NULL, NULL, NULL, srcCopy, NULL, 0,
|
||||
codecNormalQuality, 0);
|
||||
if(result) {
|
||||
mp_msg(MSGT_DECVIDEO,MSGL_ERR,"DecompressSequenceBegin result=%d\n",result);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
// uninit driver
|
||||
static void uninit(sh_video_t *sh){
|
||||
if(OutBufferGWorld) {
|
||||
DisposeGWorld(OutBufferGWorld);
|
||||
OutBufferGWorld = NULL;
|
||||
}
|
||||
if(framedescHandle) {
|
||||
DisposeHandle((Handle)framedescHandle);
|
||||
framedescHandle = NULL;
|
||||
}
|
||||
if(imageSeq) {
|
||||
CDSequenceEnd(imageSeq);
|
||||
imageSeq = 0;
|
||||
}
|
||||
ExitMovies();
|
||||
}
|
||||
|
||||
// decode a frame
|
||||
static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){
|
||||
OSErr result = 1;
|
||||
CodecFlags ignore;
|
||||
|
||||
if(len<=0) return NULL; // skipped frame
|
||||
|
||||
#if defined(WIN32_LOADER) && !defined(CONFIG_QUICKTIME)
|
||||
Setup_FS_Segment();
|
||||
#endif
|
||||
|
||||
result = DecompressSequenceFrameS(imageSeq, data, len, 0, &ignore, NULL);
|
||||
if(result) {
|
||||
mp_msg(MSGT_DECVIDEO,MSGL_ERR,"DecompressSequenceFrameS result=0x%d\n",result);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if((int)sh->context==0x73797639){ // Sorenson 16-bit YUV -> std YVU9
|
||||
int i;
|
||||
|
||||
PixMap dstPixMap = **GetGWorldPixMap(OutBufferGWorld);
|
||||
short *src0=(short *)((char*)dstPixMap.baseAddr+0x20);
|
||||
|
||||
for(i=0;i<mpi->h;i++){
|
||||
int x;
|
||||
unsigned char* dst=mpi->planes[0]+i*mpi->stride[0];
|
||||
unsigned short* src=src0+i*((mpi->w+15)&(~15));
|
||||
for(x=0;x<mpi->w;x++) dst[x]=src[x];
|
||||
}
|
||||
src0+=((mpi->w+15)&(~15))*((mpi->h+15)&(~15));
|
||||
for(i=0;i<mpi->h/4;i++){
|
||||
int x;
|
||||
unsigned char* dst=mpi->planes[1]+i*mpi->stride[1];
|
||||
unsigned short* src=src0+i*(((mpi->w+63)&(~63))/4);
|
||||
for(x=0;x<mpi->w/4;x++) dst[x]=src[x];
|
||||
src+=((mpi->w+63)&(~63))/4;
|
||||
}
|
||||
src0+=(((mpi->w+63)&(~63))/4)*(((mpi->h+63)&(~63))/4);
|
||||
for(i=0;i<mpi->h/4;i++){
|
||||
int x;
|
||||
unsigned char* dst=mpi->planes[2]+i*mpi->stride[2];
|
||||
unsigned short* src=src0+i*(((mpi->w+63)&(~63))/4);
|
||||
for(x=0;x<mpi->w/4;x++) dst[x]=src[x];
|
||||
src+=((mpi->w+63)&(~63))/4;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
return mpi;
|
||||
}
|
||||
@@ -1,453 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <libavutil/intreadwrite.h>
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#ifdef HAVE_LIBDL
|
||||
#include <dlfcn.h>
|
||||
#endif
|
||||
|
||||
#include "mp_msg.h"
|
||||
#include "path.h"
|
||||
|
||||
#include "vd_internal.h"
|
||||
#include "loader/wine/windef.h"
|
||||
|
||||
static const vd_info_t info = {
|
||||
"RealVideo decoder",
|
||||
"realvid",
|
||||
"Alex Beregszaszi",
|
||||
"Florian Schneider, Arpad Gereoffy, Alex Beregszaszi, Donnie Smith",
|
||||
"binary real video codecs"
|
||||
};
|
||||
|
||||
LIBVD_EXTERN(realvid)
|
||||
|
||||
|
||||
/*
|
||||
* Structures for data packets. These used to be tables of unsigned ints, but
|
||||
* that does not work on 64 bit platforms (e.g. Alpha). The entries that are
|
||||
* pointers get truncated. Pointers on 64 bit platforms are 8 byte longs.
|
||||
* So we have to use structures so the compiler will assign the proper space
|
||||
* for the pointer.
|
||||
*/
|
||||
typedef struct cmsg_data_s {
|
||||
uint32_t data1;
|
||||
uint32_t data2;
|
||||
uint32_t* dimensions;
|
||||
} cmsg_data_t;
|
||||
|
||||
typedef struct transform_in_s {
|
||||
uint32_t len;
|
||||
uint32_t unknown1;
|
||||
uint32_t chunks;
|
||||
uint32_t* extra;
|
||||
uint32_t unknown2;
|
||||
uint32_t timestamp;
|
||||
} transform_in_t;
|
||||
|
||||
static unsigned long (*rvyuv_custom_message)(cmsg_data_t* ,void*);
|
||||
static unsigned long (*rvyuv_free)(void*);
|
||||
static unsigned long (*rvyuv_init)(void*, void*); // initdata,context
|
||||
static unsigned long (*rvyuv_transform)(char*, char*,transform_in_t*,unsigned int*,void*);
|
||||
#ifdef CONFIG_WIN32DLL
|
||||
static unsigned long WINAPI (*wrvyuv_custom_message)(cmsg_data_t* ,void*);
|
||||
static unsigned long WINAPI (*wrvyuv_free)(void*);
|
||||
static unsigned long WINAPI (*wrvyuv_init)(void*, void*); // initdata,context
|
||||
static unsigned long WINAPI (*wrvyuv_transform)(char*, char*,transform_in_t*,unsigned int*,void*);
|
||||
#endif
|
||||
|
||||
static void *rv_handle=NULL;
|
||||
static int initialized=0;
|
||||
static uint8_t *buffer = NULL;
|
||||
static int bufsz = 0;
|
||||
#ifdef CONFIG_WIN32DLL
|
||||
static int dll_type = 0; /* 0 = unix dlopen, 1 = win32 dll */
|
||||
#endif
|
||||
|
||||
void *__builtin_vec_new(unsigned long size);
|
||||
void __builtin_vec_delete(void *mem);
|
||||
void __pure_virtual(void);
|
||||
|
||||
void *__builtin_vec_new(unsigned long size) {
|
||||
return malloc(size);
|
||||
}
|
||||
|
||||
void __builtin_vec_delete(void *mem) {
|
||||
free(mem);
|
||||
}
|
||||
|
||||
void __pure_virtual(void) {
|
||||
printf("FATAL: __pure_virtual() called!\n");
|
||||
// exit(1);
|
||||
}
|
||||
|
||||
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
|
||||
void ___brk_addr(void) {exit(0);}
|
||||
char **__environ={NULL};
|
||||
#undef stderr
|
||||
FILE *stderr=NULL;
|
||||
#endif
|
||||
|
||||
// to set/get/query special features/parameters
|
||||
static int control(sh_video_t *sh,int cmd,void* arg,...){
|
||||
// switch(cmd){
|
||||
// case VDCTRL_QUERY_MAX_PP_LEVEL:
|
||||
// return 9;
|
||||
// case VDCTRL_SET_PP_LEVEL:
|
||||
// vfw_set_postproc(sh,10*(*((int*)arg)));
|
||||
// return CONTROL_OK;
|
||||
// }
|
||||
return CONTROL_UNKNOWN;
|
||||
}
|
||||
|
||||
/* exits program when failure */
|
||||
#ifdef HAVE_LIBDL
|
||||
static int load_syms_linux(char *path) {
|
||||
void *handle;
|
||||
|
||||
mp_msg(MSGT_DECVIDEO,MSGL_V, "opening shared obj '%s'\n", path);
|
||||
handle = dlopen (path, RTLD_LAZY);
|
||||
if (!handle) {
|
||||
mp_msg(MSGT_DECVIDEO,MSGL_WARN,"Error: %s\n",dlerror());
|
||||
return 0;
|
||||
}
|
||||
|
||||
rvyuv_custom_message = dlsym(handle, "RV20toYUV420CustomMessage");
|
||||
rvyuv_free = dlsym(handle, "RV20toYUV420Free");
|
||||
rvyuv_init = dlsym(handle, "RV20toYUV420Init");
|
||||
rvyuv_transform = dlsym(handle, "RV20toYUV420Transform");
|
||||
|
||||
if(rvyuv_custom_message &&
|
||||
rvyuv_free &&
|
||||
rvyuv_init &&
|
||||
rvyuv_transform)
|
||||
{
|
||||
rv_handle = handle;
|
||||
return 1;
|
||||
}
|
||||
|
||||
rvyuv_custom_message = dlsym(handle, "RV40toYUV420CustomMessage");
|
||||
rvyuv_free = dlsym(handle, "RV40toYUV420Free");
|
||||
rvyuv_init = dlsym(handle, "RV40toYUV420Init");
|
||||
rvyuv_transform = dlsym(handle, "RV40toYUV420Transform");
|
||||
|
||||
if(rvyuv_custom_message &&
|
||||
rvyuv_free &&
|
||||
rvyuv_init &&
|
||||
rvyuv_transform)
|
||||
{
|
||||
rv_handle = handle;
|
||||
return 1;
|
||||
}
|
||||
|
||||
mp_msg(MSGT_DECVIDEO,MSGL_WARN,"Error resolving symbols! (version incompatibility?)\n");
|
||||
dlclose(handle);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_WIN32DLL
|
||||
|
||||
#ifdef WIN32_LOADER
|
||||
#include "loader/ldt_keeper.h"
|
||||
#endif
|
||||
void* WINAPI LoadLibraryA(char* name);
|
||||
void* WINAPI GetProcAddress(void* handle,char* func);
|
||||
int WINAPI FreeLibrary(void *handle);
|
||||
|
||||
#ifndef WIN32_LOADER
|
||||
void * WINAPI GetModuleHandleA(char *);
|
||||
static int patch_dll(uint8_t *patchpos, const uint8_t *oldcode,
|
||||
const uint8_t *newcode, int codesize) {
|
||||
void *handle = GetModuleHandleA("kernel32");
|
||||
int WINAPI (*VirtProt)(void *, unsigned, int, int *);
|
||||
int res = 0;
|
||||
int prot, tmp;
|
||||
VirtProt = GetProcAddress(handle, "VirtualProtect");
|
||||
// change permissions to PAGE_WRITECOPY
|
||||
if (!VirtProt ||
|
||||
!VirtProt(patchpos, codesize, 0x08, &prot)) {
|
||||
mp_msg(MSGT_DECVIDEO, MSGL_WARN, "VirtualProtect failed at %p\n", patchpos);
|
||||
return 0;
|
||||
}
|
||||
if (memcmp(patchpos, oldcode, codesize) == 0) {
|
||||
memcpy(patchpos, newcode, codesize);
|
||||
res = 1;
|
||||
}
|
||||
VirtProt(patchpos, codesize, prot, &tmp);
|
||||
return res;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int load_syms_windows(char *path) {
|
||||
void *handle;
|
||||
|
||||
mp_msg(MSGT_DECVIDEO,MSGL_V, "opening win32 dll '%s'\n", path);
|
||||
#ifdef WIN32_LOADER
|
||||
Setup_LDT_Keeper();
|
||||
#endif
|
||||
handle = LoadLibraryA(path);
|
||||
mp_msg(MSGT_DECVIDEO,MSGL_V,"win32 real codec handle=%p \n",handle);
|
||||
if (!handle) {
|
||||
mp_msg(MSGT_DECVIDEO,MSGL_WARN,"Error loading dll\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
wrvyuv_custom_message = GetProcAddress(handle, "RV20toYUV420CustomMessage");
|
||||
wrvyuv_free = GetProcAddress(handle, "RV20toYUV420Free");
|
||||
wrvyuv_init = GetProcAddress(handle, "RV20toYUV420Init");
|
||||
wrvyuv_transform = GetProcAddress(handle, "RV20toYUV420Transform");
|
||||
|
||||
if(wrvyuv_custom_message &&
|
||||
wrvyuv_free &&
|
||||
wrvyuv_init &&
|
||||
wrvyuv_transform)
|
||||
{
|
||||
dll_type = 1;
|
||||
rv_handle = handle;
|
||||
#ifndef WIN32_LOADER
|
||||
{
|
||||
if (strstr(path, "drv43260.dll")) {
|
||||
int patched;
|
||||
// patch away multithreaded decoding, it causes crashes
|
||||
static const uint8_t oldcode[13] = {
|
||||
0x83, 0xbb, 0xf8, 0x05, 0x00, 0x00, 0x01,
|
||||
0x0f, 0x86, 0xd0, 0x00, 0x00, 0x00 };
|
||||
static const uint8_t newcode[13] = {
|
||||
0x31, 0xc0,
|
||||
0x89, 0x83, 0xf8, 0x05, 0x00, 0x00,
|
||||
0xe9, 0xd0, 0x00, 0x00, 0x00 };
|
||||
patched = patch_dll(
|
||||
(char*)wrvyuv_transform + 0x634132fa - 0x634114d0,
|
||||
oldcode, newcode, sizeof(oldcode));
|
||||
if (!patched)
|
||||
mp_msg(MSGT_DECVIDEO, MSGL_WARN, "Could not patch Real codec, this might crash on multi-CPU systems\n");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
wrvyuv_custom_message = GetProcAddress(handle, "RV40toYUV420CustomMessage");
|
||||
wrvyuv_free = GetProcAddress(handle, "RV40toYUV420Free");
|
||||
wrvyuv_init = GetProcAddress(handle, "RV40toYUV420Init");
|
||||
wrvyuv_transform = GetProcAddress(handle, "RV40toYUV420Transform");
|
||||
if(wrvyuv_custom_message &&
|
||||
wrvyuv_free &&
|
||||
wrvyuv_init &&
|
||||
wrvyuv_transform) {
|
||||
dll_type = 1;
|
||||
rv_handle = handle;
|
||||
return 1;
|
||||
}
|
||||
|
||||
mp_msg(MSGT_DECVIDEO,MSGL_WARN,"Error resolving symbols! (version incompatibility?)\n");
|
||||
FreeLibrary(handle);
|
||||
return 0; // error
|
||||
}
|
||||
#endif
|
||||
|
||||
/* we need exact positions */
|
||||
struct rv_init_t {
|
||||
short unk1;
|
||||
short w;
|
||||
short h;
|
||||
short unk3;
|
||||
int unk2;
|
||||
int subformat;
|
||||
int unk5;
|
||||
int format;
|
||||
} rv_init_t;
|
||||
|
||||
// init driver
|
||||
static int init(sh_video_t *sh){
|
||||
//unsigned int out_fmt;
|
||||
char *path;
|
||||
int result;
|
||||
// we export codec id and sub-id from demuxer in bitmapinfohdr:
|
||||
unsigned char* extrahdr=(unsigned char*)(sh->bih+1);
|
||||
unsigned int extrahdr_size = sh->bih->biSize - sizeof(*sh->bih);
|
||||
struct rv_init_t init_data;
|
||||
|
||||
if(extrahdr_size < 8) {
|
||||
mp_msg(MSGT_DECVIDEO,MSGL_ERR,"realvideo: extradata too small (%u)\n", extrahdr_size);
|
||||
return 0;
|
||||
}
|
||||
init_data = (struct rv_init_t){11, sh->disp_w, sh->disp_h, 0, 0, AV_RB32(extrahdr), 1, AV_RB32(extrahdr + 4)}; // rv30
|
||||
|
||||
mp_msg(MSGT_DECVIDEO,MSGL_V,"realvideo codec id: 0x%08X sub-id: 0x%08X\n",init_data.format,init_data.subformat);
|
||||
|
||||
path = malloc(strlen(codec_path) + strlen(sh->codec->dll) + 2);
|
||||
if (!path) return 0;
|
||||
sprintf(path, "%s/%s", codec_path, sh->codec->dll);
|
||||
|
||||
/* first try to load linux dlls, if failed and we're supporting win32 dlls,
|
||||
then try to load the windows ones */
|
||||
#ifdef HAVE_LIBDL
|
||||
if(strstr(sh->codec->dll,".dll") || !load_syms_linux(path))
|
||||
#endif
|
||||
#ifdef CONFIG_WIN32DLL
|
||||
if (!load_syms_windows(sh->codec->dll))
|
||||
#endif
|
||||
{
|
||||
mp_tmsg(MSGT_DECVIDEO,MSGL_ERR,"ERROR: Could not open required DirectShow codec %s.\n",sh->codec->dll);
|
||||
mp_msg(MSGT_DECVIDEO,MSGL_HINT,"Read the RealVideo section of the DOCS!\n");
|
||||
free(path);
|
||||
return 0;
|
||||
}
|
||||
free(path);
|
||||
// only I420 supported
|
||||
// if((sh->format!=0x30335652) && !mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_I420)) return 0;
|
||||
// init codec:
|
||||
sh->context=NULL;
|
||||
#ifdef CONFIG_WIN32DLL
|
||||
if (dll_type == 1)
|
||||
result=(*wrvyuv_init)(&init_data, &sh->context);
|
||||
else
|
||||
#endif
|
||||
result=(*rvyuv_init)(&init_data, &sh->context);
|
||||
if (result){
|
||||
mp_msg(MSGT_DECVIDEO,MSGL_ERR,"Couldn't open RealVideo codec, error code: 0x%X \n",result);
|
||||
return 0;
|
||||
}
|
||||
// setup rv30 codec (codec sub-type and image dimensions):
|
||||
if((sh->format<=0x30335652) && AV_RB32(extrahdr + 4)>=0x20200002){
|
||||
int i, cmsg_cnt;
|
||||
uint32_t cmsg24[16]={sh->disp_w,sh->disp_h};
|
||||
cmsg_data_t cmsg_data={0x24,1+(extrahdr[1]&7), &cmsg24[0]};
|
||||
|
||||
mp_msg(MSGT_DECVIDEO,MSGL_V,"realvideo: using cmsg24 with %u elements.\n",extrahdr[1]&7);
|
||||
cmsg_cnt = (extrahdr[1]&7)*2;
|
||||
if (extrahdr_size-8 < cmsg_cnt) {
|
||||
mp_msg(MSGT_DECVIDEO,MSGL_WARN,"realvideo: not enough extradata (%u) to make %u cmsg24 elements.\n",extrahdr_size-8,extrahdr[1]&7);
|
||||
cmsg_cnt = extrahdr_size-8;
|
||||
}
|
||||
for (i = 0; i < cmsg_cnt; i++)
|
||||
cmsg24[2+i] = extrahdr[8+i]*4;
|
||||
if (extrahdr_size-8 > cmsg_cnt)
|
||||
mp_msg(MSGT_DECVIDEO,MSGL_WARN,"realvideo: %u bytes of unknown extradata remaining.\n",extrahdr_size-8-cmsg_cnt);
|
||||
|
||||
#ifdef CONFIG_WIN32DLL
|
||||
if (dll_type == 1)
|
||||
(*wrvyuv_custom_message)(&cmsg_data,sh->context);
|
||||
else
|
||||
#endif
|
||||
(*rvyuv_custom_message)(&cmsg_data,sh->context);
|
||||
}
|
||||
mp_msg(MSGT_DECVIDEO,MSGL_V,"INFO: RealVideo codec init OK!\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
// uninit driver
|
||||
static void uninit(sh_video_t *sh){
|
||||
#ifdef CONFIG_WIN32DLL
|
||||
if (dll_type == 1)
|
||||
{
|
||||
if (wrvyuv_free) wrvyuv_free(sh->context);
|
||||
} else
|
||||
#endif
|
||||
if(rvyuv_free) rvyuv_free(sh->context);
|
||||
|
||||
#ifdef CONFIG_WIN32DLL
|
||||
if (dll_type == 1)
|
||||
{
|
||||
if (rv_handle) FreeLibrary(rv_handle);
|
||||
} else
|
||||
#endif
|
||||
#ifdef HAVE_LIBDL
|
||||
if(rv_handle) dlclose(rv_handle);
|
||||
#endif
|
||||
rv_handle=NULL;
|
||||
initialized = 0;
|
||||
free(buffer);
|
||||
buffer = NULL;
|
||||
bufsz = 0;
|
||||
}
|
||||
|
||||
// decode a frame
|
||||
static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){
|
||||
mp_image_t* mpi;
|
||||
unsigned long result;
|
||||
uint8_t *buf = data;
|
||||
int chunks = *buf++;
|
||||
int extra_size = 8*(chunks+1);
|
||||
uint32_t data_size = len-1-extra_size;
|
||||
unsigned char* dp_data=buf+extra_size;
|
||||
uint32_t* extra=(uint32_t*)buf;
|
||||
int i;
|
||||
|
||||
unsigned int transform_out[5];
|
||||
transform_in_t transform_in={
|
||||
data_size, // length of the packet (sub-packets appended)
|
||||
0, // unknown, seems to be unused
|
||||
chunks, // number of sub-packets - 1
|
||||
extra, // table of sub-packet offsets
|
||||
0, // unknown, seems to be unused
|
||||
0, // timestamp (should be unneded)
|
||||
};
|
||||
|
||||
if(len<=0 || flags&2) return NULL; // skipped frame || hardframedrop
|
||||
|
||||
if (bufsz < sh->disp_w*sh->disp_h*3/2) {
|
||||
free(buffer);
|
||||
bufsz = sh->disp_w*sh->disp_h*3/2;
|
||||
buffer=malloc(bufsz);
|
||||
if (!buffer) return 0;
|
||||
}
|
||||
|
||||
for (i=0; i<2*(chunks+1); i++)
|
||||
extra[i] = le2me_32(extra[i]);
|
||||
|
||||
#ifdef CONFIG_WIN32DLL
|
||||
if (dll_type == 1)
|
||||
result=(*wrvyuv_transform)(dp_data, buffer, &transform_in,
|
||||
transform_out, sh->context);
|
||||
else
|
||||
#endif
|
||||
result=(*rvyuv_transform)(dp_data, buffer, &transform_in,
|
||||
transform_out, sh->context);
|
||||
|
||||
if(!initialized){ // rv30 width/height now known
|
||||
sh->aspect=(float)sh->disp_w/(float)sh->disp_h;
|
||||
sh->disp_w=transform_out[3];
|
||||
sh->disp_h=transform_out[4];
|
||||
if (!mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_I420)) return 0;
|
||||
initialized=1;
|
||||
}
|
||||
mpi=mpcodecs_get_image(sh, MP_IMGTYPE_EXPORT, 0 /*MP_IMGFLAG_ACCEPT_STRIDE*/,
|
||||
sh->disp_w, sh->disp_h);
|
||||
if(!mpi) return NULL;
|
||||
mpi->planes[0] = buffer;
|
||||
mpi->stride[0] = sh->disp_w;
|
||||
mpi->planes[1] = buffer + sh->disp_w*sh->disp_h;
|
||||
mpi->stride[1] = sh->disp_w / 2;
|
||||
mpi->planes[2] = buffer + sh->disp_w*sh->disp_h*5/4;
|
||||
mpi->stride[2] = sh->disp_w / 2;
|
||||
|
||||
if(transform_out[0] &&
|
||||
(sh->disp_w != transform_out[3] || sh->disp_h != transform_out[4]))
|
||||
initialized = 0;
|
||||
|
||||
return result ? NULL : mpi;
|
||||
}
|
||||
@@ -1,355 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "config.h"
|
||||
#include "mp_msg.h"
|
||||
|
||||
#include "vd_internal.h"
|
||||
#include "libmpdemux/aviprint.h"
|
||||
#include "loader/wine/driver.h"
|
||||
#include "loader/wine/vfw.h"
|
||||
|
||||
static const vd_info_t info = {
|
||||
#ifdef BUILD_VFWEX
|
||||
"Win32/VfWex video codecs",
|
||||
"vfwex",
|
||||
#else
|
||||
"Win32/VfW video codecs",
|
||||
"vfw",
|
||||
#endif
|
||||
"A'rpi & Alex",
|
||||
"avifile.sf.net",
|
||||
"win32 codecs"
|
||||
};
|
||||
|
||||
#ifdef BUILD_VFWEX
|
||||
LIBVD_EXTERN(vfwex)
|
||||
#else
|
||||
LIBVD_EXTERN(vfw)
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
BITMAPINFOHEADER *o_bih;
|
||||
HIC handle;
|
||||
unsigned char *palette;
|
||||
} vd_vfw_ctx;
|
||||
|
||||
static int vfw_set_postproc(sh_video_t* sh, int quality)
|
||||
{
|
||||
vd_vfw_ctx *priv = sh->context;
|
||||
// Works only with opendivx/divx4 based DLL
|
||||
return ICSendMessage(priv->handle, ICM_USER+80, (long)(&quality), 0);
|
||||
}
|
||||
|
||||
static void set_csp(BITMAPINFOHEADER *o_bih,unsigned int outfmt){
|
||||
int yuv = 0;
|
||||
|
||||
switch (outfmt)
|
||||
{
|
||||
/* planar format */
|
||||
case IMGFMT_YV12:
|
||||
case IMGFMT_I420:
|
||||
case IMGFMT_IYUV:
|
||||
o_bih->biBitCount=12;
|
||||
yuv=1;
|
||||
break;
|
||||
case IMGFMT_YVU9:
|
||||
case IMGFMT_IF09:
|
||||
o_bih->biBitCount=9;
|
||||
yuv=1;
|
||||
break;
|
||||
/* packed format */
|
||||
case IMGFMT_YUY2:
|
||||
case IMGFMT_UYVY:
|
||||
case IMGFMT_YVYU:
|
||||
o_bih->biBitCount=16;
|
||||
yuv=1;
|
||||
break;
|
||||
/* rgb/bgr format */
|
||||
case IMGFMT_RGB8:
|
||||
case IMGFMT_BGR8:
|
||||
o_bih->biBitCount=8;
|
||||
break;
|
||||
case IMGFMT_RGB15:
|
||||
case IMGFMT_RGB16:
|
||||
case IMGFMT_BGR15:
|
||||
case IMGFMT_BGR16:
|
||||
o_bih->biBitCount=16;
|
||||
break;
|
||||
case IMGFMT_RGB24:
|
||||
case IMGFMT_BGR24:
|
||||
o_bih->biBitCount=24;
|
||||
break;
|
||||
case IMGFMT_RGB32:
|
||||
case IMGFMT_BGR32:
|
||||
o_bih->biBitCount=32;
|
||||
break;
|
||||
default:
|
||||
mp_msg(MSGT_WIN32,MSGL_ERR,"Unsupported image format: %s\n", vo_format_name(outfmt));
|
||||
return;
|
||||
}
|
||||
|
||||
o_bih->biSizeImage = abs(o_bih->biWidth * o_bih->biHeight * (o_bih->biBitCount/8));
|
||||
|
||||
// Note: we cannot rely on sh->outfmtidx here, it's undefined at this stage!!!
|
||||
// if (yuv && !(sh->codec->outflags[sh->outfmtidx] & CODECS_FLAG_YUVHACK))
|
||||
if (yuv)
|
||||
o_bih->biCompression = outfmt;
|
||||
else
|
||||
o_bih->biCompression = 0;
|
||||
}
|
||||
|
||||
// to set/get/query special features/parameters
|
||||
static int control(sh_video_t *sh,int cmd,void* arg,...){
|
||||
vd_vfw_ctx *priv = sh->context;
|
||||
switch(cmd){
|
||||
case VDCTRL_QUERY_MAX_PP_LEVEL:
|
||||
return 9;
|
||||
case VDCTRL_SET_PP_LEVEL:
|
||||
vfw_set_postproc(sh,10*(*((int*)arg)));
|
||||
return CONTROL_OK;
|
||||
// FIXME: make this optional...
|
||||
case VDCTRL_QUERY_FORMAT:
|
||||
{
|
||||
HRESULT ret;
|
||||
if(!(sh->codec->outflags[sh->outfmtidx]&CODECS_FLAG_QUERY))
|
||||
return CONTROL_UNKNOWN; // do not query!
|
||||
set_csp(priv->o_bih,*((int*)arg));
|
||||
#ifdef BUILD_VFWEX
|
||||
ret = ICDecompressQueryEx(priv->handle, sh->bih, priv->o_bih);
|
||||
#else
|
||||
ret = ICDecompressQuery(priv->handle, sh->bih, priv->o_bih);
|
||||
#endif
|
||||
if (ret)
|
||||
{
|
||||
mp_msg(MSGT_WIN32, MSGL_DBG2, "ICDecompressQuery failed:: Error %d\n", (int)ret);
|
||||
return CONTROL_FALSE;
|
||||
}
|
||||
return CONTROL_TRUE;
|
||||
}
|
||||
}
|
||||
return CONTROL_UNKNOWN;
|
||||
}
|
||||
|
||||
// init driver
|
||||
static int init(sh_video_t *sh){
|
||||
HRESULT ret;
|
||||
// unsigned int outfmt=sh->codec->outfmt[sh->outfmtidx];
|
||||
int o_bih_len;
|
||||
vd_vfw_ctx *priv;
|
||||
|
||||
/* Hack for VSSH codec: new dll can't decode old files
|
||||
* In my samples old files have no extradata, so use that info
|
||||
* to decide what dll should be used (here and in vd_dshow).
|
||||
*/
|
||||
if (!strcmp(sh->codec->dll, "vssh264.dll") && (sh->bih->biSize > 40))
|
||||
return 0;
|
||||
|
||||
priv = malloc(sizeof(vd_vfw_ctx));
|
||||
if (!priv)
|
||||
return 0;
|
||||
memset(priv, 0, sizeof(vd_vfw_ctx));
|
||||
sh->context = priv;
|
||||
|
||||
mp_msg(MSGT_WIN32,MSGL_V,"======= Win32 (VFW) VIDEO Codec init =======\n");
|
||||
|
||||
|
||||
// win32_codec_name = sh->codec->dll;
|
||||
// sh->hic = ICOpen( 0x63646976, sh->bih->biCompression, ICMODE_FASTDECOMPRESS);
|
||||
// priv->handle = ICOpen( 0x63646976, sh->bih->biCompression, ICMODE_DECOMPRESS);
|
||||
priv->handle = ICOpen( (long)(sh->codec->dll), sh->bih->biCompression, ICMODE_DECOMPRESS);
|
||||
if(!priv->handle){
|
||||
mp_msg(MSGT_WIN32,MSGL_ERR,"ICOpen failed! unknown codec / wrong parameters?\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
// sh->bih->biBitCount=32;
|
||||
|
||||
o_bih_len = ICDecompressGetFormatSize(priv->handle, sh->bih);
|
||||
|
||||
if(o_bih_len < sizeof(BITMAPINFOHEADER)){
|
||||
mp_msg(MSGT_WIN32,MSGL_ERR,"ICDecompressGetFormatSize returned a bogus value: %d\n", o_bih_len);
|
||||
return 0;
|
||||
}
|
||||
|
||||
priv->o_bih = malloc(o_bih_len);
|
||||
memset(priv->o_bih, 0, o_bih_len);
|
||||
|
||||
mp_msg(MSGT_WIN32,MSGL_V,"ICDecompressGetFormatSize ret: %d\n", o_bih_len);
|
||||
|
||||
ret = ICDecompressGetFormat(priv->handle, sh->bih, priv->o_bih);
|
||||
if(ret < 0){
|
||||
mp_msg(MSGT_WIN32,MSGL_ERR,"ICDecompressGetFormat failed: Error %d\n", (int)ret);
|
||||
//for (i=0; i < o_bih_len; i++) mp_msg(MSGT_WIN32, MSGL_DBG2, "%02x ", priv->o_bih[i]);
|
||||
return 0;
|
||||
}
|
||||
mp_msg(MSGT_WIN32,MSGL_V,"ICDecompressGetFormat OK\n");
|
||||
|
||||
#if 0
|
||||
// workaround for pegasus MJPEG:
|
||||
if(!sh_video->o_bih.biWidth) sh_video->o_bih.biWidth=sh_video->bih->biWidth;
|
||||
if(!sh_video->o_bih.biHeight) sh_video->o_bih.biHeight=sh_video->bih->biHeight;
|
||||
if(!sh_video->o_bih.biPlanes) sh_video->o_bih.biPlanes=sh_video->bih->biPlanes;
|
||||
#endif
|
||||
|
||||
// ok let libvo and vd core to handshake and decide the optimal csp:
|
||||
if(!mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_YUY2)) return 0;
|
||||
|
||||
if (!(sh->codec->outflags[sh->outfmtidx]&CODECS_FLAG_FLIP)) {
|
||||
priv->o_bih->biHeight=-sh->bih->biHeight; // flip image!
|
||||
}
|
||||
|
||||
// ok, let's set the choosen colorspace:
|
||||
set_csp(priv->o_bih,sh->codec->outfmt[sh->outfmtidx]);
|
||||
|
||||
// fake it to RGB for broken DLLs (divx3)
|
||||
if(sh->codec->outflags[sh->outfmtidx] & CODECS_FLAG_YUVHACK)
|
||||
priv->o_bih->biCompression = 0;
|
||||
|
||||
// sanity check:
|
||||
#ifdef BUILD_VFWEX
|
||||
ret = ICDecompressQueryEx(priv->handle, sh->bih, priv->o_bih);
|
||||
#else
|
||||
ret = ICDecompressQuery(priv->handle, sh->bih, priv->o_bih);
|
||||
#endif
|
||||
if (ret)
|
||||
{
|
||||
mp_msg(MSGT_WIN32,MSGL_WARN,"ICDecompressQuery failed: Error %d\n", (int)ret);
|
||||
// return 0;
|
||||
} else
|
||||
mp_msg(MSGT_WIN32,MSGL_V,"ICDecompressQuery OK\n");
|
||||
|
||||
#ifdef BUILD_VFWEX
|
||||
ret = ICDecompressBeginEx(priv->handle, sh->bih, priv->o_bih);
|
||||
#else
|
||||
ret = ICDecompressBegin(priv->handle, sh->bih, priv->o_bih);
|
||||
#endif
|
||||
if (ret)
|
||||
{
|
||||
mp_msg(MSGT_WIN32,MSGL_WARN,"ICDecompressBegin failed: Error %d\n", (int)ret);
|
||||
// return 0;
|
||||
}
|
||||
|
||||
// for broken codecs set it again:
|
||||
if(sh->codec->outflags[sh->outfmtidx] & CODECS_FLAG_YUVHACK)
|
||||
set_csp(priv->o_bih,sh->codec->outfmt[sh->outfmtidx]);
|
||||
|
||||
mp_msg(MSGT_WIN32, MSGL_V, "Input format:\n");
|
||||
if( mp_msg_test(MSGT_HEADER,MSGL_V) ) print_video_header(sh->bih,MSGL_V);
|
||||
mp_msg(MSGT_WIN32, MSGL_V, "Output format:\n");
|
||||
if( mp_msg_test(MSGT_HEADER,MSGL_V) ) print_video_header(priv->o_bih,MSGL_V);
|
||||
|
||||
// set postprocessing level in xvid/divx4 .dll
|
||||
ICSendMessage(priv->handle, ICM_USER+80, (long)(&divx_quality), 0);
|
||||
|
||||
// don't do this palette mess always, it makes div3 dll crashing...
|
||||
if(sh->codec->outfmt[sh->outfmtidx]==IMGFMT_BGR8){
|
||||
if(ICDecompressGetPalette(priv->handle, sh->bih, priv->o_bih)){
|
||||
priv->palette = (unsigned char*)(priv->o_bih+1);
|
||||
mp_msg(MSGT_WIN32,MSGL_V,"ICDecompressGetPalette OK\n");
|
||||
} else {
|
||||
if(sh->bih->biSize>=40+4*4)
|
||||
priv->palette = (unsigned char*)(sh->bih+1);
|
||||
}
|
||||
}
|
||||
|
||||
mp_msg(MSGT_DECVIDEO,MSGL_V,"INFO: Win32 video codec init OK!\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
// uninit driver
|
||||
static void uninit(sh_video_t *sh){
|
||||
HRESULT ret;
|
||||
vd_vfw_ctx *priv = sh->context;
|
||||
|
||||
#ifdef BUILD_VFWEX
|
||||
ret = ICDecompressEndEx(priv->handle);
|
||||
#else
|
||||
ret = ICDecompressEnd(priv->handle);
|
||||
#endif
|
||||
if (ret)
|
||||
{
|
||||
mp_msg(MSGT_WIN32, MSGL_WARN, "ICDecompressEnd failed: %ld\n", ret);
|
||||
return;
|
||||
}
|
||||
|
||||
ret = ICClose(priv->handle);
|
||||
if (ret)
|
||||
{
|
||||
mp_msg(MSGT_WIN32, MSGL_WARN, "ICClose failed: %ld\n", ret);
|
||||
return;
|
||||
}
|
||||
|
||||
free(priv->o_bih);
|
||||
free(priv);
|
||||
}
|
||||
|
||||
// decode a frame
|
||||
static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){
|
||||
vd_vfw_ctx *priv = sh->context;
|
||||
mp_image_t* mpi;
|
||||
HRESULT ret;
|
||||
|
||||
if(len<=0) return NULL; // skipped frame
|
||||
|
||||
mpi=mpcodecs_get_image(sh,
|
||||
(sh->codec->outflags[sh->outfmtidx] & CODECS_FLAG_STATIC) ?
|
||||
MP_IMGTYPE_STATIC : MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_WIDTH,
|
||||
sh->disp_w, sh->disp_h);
|
||||
if(!mpi){ // temporary!
|
||||
mp_tmsg(MSGT_DECVIDEO,MSGL_WARN,"[VD_DMO] Couldn't allocate image for cinepak codec.\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// set stride: (trick discovered by Andreas Ackermann - thanx!)
|
||||
sh->bih->biWidth=mpi->width; //mpi->stride[0]/(mpi->bpp/8);
|
||||
priv->o_bih->biWidth=mpi->width; //mpi->stride[0]/(mpi->bpp/8);
|
||||
|
||||
sh->bih->biSizeImage = len;
|
||||
|
||||
#ifdef BUILD_VFWEX
|
||||
ret = ICDecompressEx(priv->handle,
|
||||
#else
|
||||
ret = ICDecompress(priv->handle,
|
||||
#endif
|
||||
( sh->ds->keyframe ? 0 : ICDECOMPRESS_NOTKEYFRAME ) |
|
||||
( (flags&3) == 2 && !sh->ds->keyframe ?
|
||||
ICDECOMPRESS_HURRYUP|ICDECOMPRESS_PREROL : 0 ),
|
||||
sh->bih, data, priv->o_bih, (flags&3) ? 0 : mpi->planes[0]);
|
||||
|
||||
if ((int)ret){
|
||||
mp_msg(MSGT_DECVIDEO,MSGL_WARN,"Error decompressing frame, err=%ld\n",ret);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// export palette:
|
||||
if(mpi->imgfmt==IMGFMT_RGB8 || mpi->imgfmt==IMGFMT_BGR8){
|
||||
if (priv->palette)
|
||||
{
|
||||
mpi->planes[1] = priv->palette;
|
||||
mp_dbg(MSGT_DECVIDEO, MSGL_DBG2, "Found and copied palette\n");
|
||||
}
|
||||
else
|
||||
mpi->planes[1]=NULL;
|
||||
}
|
||||
|
||||
return mpi;
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
|
||||
#define BUILD_VFWEX 1
|
||||
|
||||
#include "vd_vfw.c"
|
||||
@@ -1,854 +0,0 @@
|
||||
/*
|
||||
* XAnim Video Codec DLL support
|
||||
*
|
||||
* It partly emulates the Xanim codebase.
|
||||
* You need the -rdynamic flag to use this with gcc.
|
||||
*
|
||||
* Copyright (C) 2001-2002 Alex Beregszaszi
|
||||
* Arpad Gereoffy <arpi@thot.banki.hu>
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h> /* strerror */
|
||||
|
||||
#include "config.h"
|
||||
#include "path.h"
|
||||
#include "mp_msg.h"
|
||||
|
||||
#include "vd_internal.h"
|
||||
|
||||
static const vd_info_t info = {
|
||||
"XAnim codecs",
|
||||
"xanim",
|
||||
"A'rpi & Alex",
|
||||
"Xanim (http://xanim.va.pubnix.com/)",
|
||||
"binary codec plugins"
|
||||
};
|
||||
|
||||
LIBVD_EXTERN(xanim)
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <dlfcn.h> /* dlsym, dlopen, dlclose */
|
||||
#include <stdarg.h> /* va_alist, va_start, va_end */
|
||||
#include <errno.h> /* strerror, errno */
|
||||
|
||||
#include "mp_msg.h"
|
||||
#include "mpbswap.h"
|
||||
|
||||
#include "osdep/timer.h"
|
||||
|
||||
#if 0
|
||||
/* this should be removed */
|
||||
#ifndef RTLD_NOW
|
||||
#define RLTD_NOW 2
|
||||
#endif
|
||||
#ifndef RTLD_LAZY
|
||||
#define RLTD_LAZY 1
|
||||
#endif
|
||||
#ifndef RTLD_GLOBAL
|
||||
#define RLTD_GLOBAL 256
|
||||
#endif
|
||||
#endif
|
||||
|
||||
struct XA_CODEC_HDR;
|
||||
struct XA_DEC_INFO;
|
||||
|
||||
typedef long init_function(struct XA_CODEC_HDR *);
|
||||
typedef unsigned int decode_function(unsigned char *, unsigned char *,
|
||||
unsigned int, struct XA_DEC_INFO *);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned int what;
|
||||
unsigned int id;
|
||||
init_function *iq_func; /* init/query function */
|
||||
decode_function *dec_func; /* opt decode function */
|
||||
} XAVID_FUNC_HDR;
|
||||
|
||||
#define XAVID_WHAT_NO_MORE 0x0000
|
||||
#define XAVID_AVI_QUERY 0x0001
|
||||
#define XAVID_QT_QUERY 0x0002
|
||||
#define XAVID_DEC_FUNC 0x0100
|
||||
|
||||
#define XAVID_API_REV 0x0003
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned int api_rev;
|
||||
char *desc;
|
||||
char *rev;
|
||||
char *copyright;
|
||||
char *mod_author;
|
||||
char *authors;
|
||||
unsigned int num_funcs;
|
||||
XAVID_FUNC_HDR *funcs;
|
||||
} XAVID_MOD_HDR;
|
||||
|
||||
/* XA CODEC .. */
|
||||
typedef struct XA_CODEC_HDR
|
||||
{
|
||||
void *anim_hdr;
|
||||
unsigned int compression;
|
||||
unsigned int x, y;
|
||||
unsigned int depth;
|
||||
void *extra;
|
||||
unsigned int xapi_rev;
|
||||
decode_function *decoder;
|
||||
char *description;
|
||||
unsigned int avi_ctab_flag;
|
||||
unsigned int (*avi_read_ext)(void);
|
||||
} XA_CODEC_HDR;
|
||||
|
||||
#define CODEC_SUPPORTED 1
|
||||
#define CODEC_UNKNOWN 0
|
||||
#define CODEC_UNSUPPORTED -1
|
||||
|
||||
/* fuckin colormap structures for xanim */
|
||||
typedef struct
|
||||
{
|
||||
unsigned short red;
|
||||
unsigned short green;
|
||||
unsigned short blue;
|
||||
unsigned short gray;
|
||||
} ColorReg;
|
||||
|
||||
typedef struct XA_ACTION_STRUCT
|
||||
{
|
||||
int type;
|
||||
int cmap_rev;
|
||||
unsigned char *data;
|
||||
struct XA_ACTION_STRUCT *next;
|
||||
struct XA_CHDR_STRUCT *chdr;
|
||||
ColorReg *h_cmap;
|
||||
unsigned int *map;
|
||||
struct XA_ACTION_STRUCT *next_same_chdr;
|
||||
} XA_ACTION;
|
||||
|
||||
typedef struct XA_CHDR_STRUCT
|
||||
{
|
||||
unsigned int rev;
|
||||
ColorReg *cmap;
|
||||
unsigned int csize, coff;
|
||||
unsigned int *map;
|
||||
unsigned int msize, moff;
|
||||
struct XA_CHDR_STRUCT *next;
|
||||
XA_ACTION *acts;
|
||||
struct XA_CHDR_STRUCT *new_chdr;
|
||||
} XA_CHDR;
|
||||
|
||||
typedef struct XA_DEC_INFO
|
||||
{
|
||||
unsigned int cmd;
|
||||
unsigned int skip_flag;
|
||||
unsigned int imagex, imagey; /* image buffer size */
|
||||
unsigned int imaged; /* image depth */
|
||||
XA_CHDR *chdr; /* color map header */
|
||||
unsigned int map_flag;
|
||||
unsigned int *map;
|
||||
unsigned int xs, ys;
|
||||
unsigned int xe, ye;
|
||||
unsigned int special;
|
||||
void *extra;
|
||||
} XA_DEC_INFO;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned int file_num;
|
||||
unsigned int anim_type;
|
||||
unsigned int imagex;
|
||||
unsigned int imagey;
|
||||
unsigned int imagec;
|
||||
unsigned int imaged;
|
||||
} XA_ANIM_HDR;
|
||||
|
||||
typedef struct {
|
||||
XA_DEC_INFO *decinfo;
|
||||
void *file_handler;
|
||||
init_function *iq_func;
|
||||
decode_function *dec_func;
|
||||
mp_image_t *mpi;
|
||||
} vd_xanim_ctx;
|
||||
|
||||
#if 0
|
||||
typedef char xaBYTE;
|
||||
typedef short xaSHORT;
|
||||
typedef int xaLONG;
|
||||
|
||||
typedef unsigned char xaUBYTE;
|
||||
typedef unsigned short xaUSHORT;
|
||||
typedef unsigned int xaULONG;
|
||||
#endif
|
||||
|
||||
#define xaFALSE 0
|
||||
#define xaTRUE 1
|
||||
|
||||
#define ACT_DLTA_NORM 0x00000000
|
||||
#define ACT_DLTA_BODY 0x00000001
|
||||
#define ACT_DLTA_XOR 0x00000002
|
||||
#define ACT_DLTA_NOP 0x00000004
|
||||
#define ACT_DLTA_MAPD 0x00000008
|
||||
#define ACT_DLTA_DROP 0x00000010
|
||||
#define ACT_DLTA_BAD 0x80000000
|
||||
|
||||
#define XA_CLOSE_FUNCS 5
|
||||
int xa_close_funcs = 0;
|
||||
void *xa_close_func[XA_CLOSE_FUNCS];
|
||||
|
||||
/* load, init and query */
|
||||
static int xacodec_load(sh_video_t *sh, char *filename)
|
||||
{
|
||||
vd_xanim_ctx *priv = sh->context;
|
||||
void *(*what_the)(void);
|
||||
char *error;
|
||||
XAVID_MOD_HDR *mod_hdr;
|
||||
XAVID_FUNC_HDR *func;
|
||||
int i;
|
||||
|
||||
// priv->file_handler = dlopen(filename, RTLD_NOW|RTLD_GLOBAL);
|
||||
priv->file_handler = dlopen(filename, RTLD_LAZY);
|
||||
if (!priv->file_handler)
|
||||
{
|
||||
error = dlerror();
|
||||
if (error)
|
||||
mp_msg(MSGT_DECVIDEO, MSGL_FATAL, "xacodec: failed to dlopen %s while %s\n", filename, error);
|
||||
else
|
||||
mp_msg(MSGT_DECVIDEO, MSGL_FATAL, "xacodec: failed to dlopen %s\n", filename);
|
||||
return 0;
|
||||
}
|
||||
|
||||
what_the = dlsym(priv->file_handler, "What_The");
|
||||
if ((error = dlerror()) != NULL)
|
||||
{
|
||||
mp_msg(MSGT_DECVIDEO, MSGL_FATAL, "xacodec: failed to init %s while %s\n", filename, error);
|
||||
dlclose(priv->file_handler);
|
||||
return 0;
|
||||
}
|
||||
|
||||
mod_hdr = what_the();
|
||||
if (!mod_hdr)
|
||||
{
|
||||
mp_msg(MSGT_DECVIDEO, MSGL_FATAL, "xacodec: initializer function failed in %s\n", filename);
|
||||
dlclose(priv->file_handler);
|
||||
return 0;
|
||||
}
|
||||
|
||||
mp_msg(MSGT_DECVIDEO, MSGL_V, "=== XAnim Codec ===\n");
|
||||
mp_msg(MSGT_DECVIDEO, MSGL_V, " Filename: %s (API revision: %x)\n", filename, mod_hdr->api_rev);
|
||||
mp_msg(MSGT_DECVIDEO, MSGL_V, " Codec: %s. Rev: %s\n", mod_hdr->desc, mod_hdr->rev);
|
||||
if (mod_hdr->copyright)
|
||||
mp_msg(MSGT_DECVIDEO, MSGL_V, " %s\n", mod_hdr->copyright);
|
||||
if (mod_hdr->mod_author)
|
||||
mp_msg(MSGT_DECVIDEO, MSGL_V, " Module Author(s): %s\n", mod_hdr->mod_author);
|
||||
if (mod_hdr->authors)
|
||||
mp_msg(MSGT_DECVIDEO, MSGL_V, " Codec Author(s): %s\n", mod_hdr->authors);
|
||||
|
||||
if (mod_hdr->api_rev > XAVID_API_REV)
|
||||
{
|
||||
mp_msg(MSGT_DECVIDEO, MSGL_FATAL, "xacodec: not supported api revision (%d) in %s\n",
|
||||
mod_hdr->api_rev, filename);
|
||||
dlclose(priv->file_handler);
|
||||
return 0;
|
||||
}
|
||||
|
||||
func = mod_hdr->funcs;
|
||||
if (!func)
|
||||
{
|
||||
mp_msg(MSGT_DECVIDEO, MSGL_FATAL, "xacodec: function table error in %s\n", filename);
|
||||
dlclose(priv->file_handler);
|
||||
return 0;
|
||||
}
|
||||
|
||||
mp_msg(MSGT_DECVIDEO, MSGL_DBG2, "Exported functions by codec: [functable: %p entries: %d]\n",
|
||||
mod_hdr->funcs, mod_hdr->num_funcs);
|
||||
for (i = 0; i < (int)mod_hdr->num_funcs; i++)
|
||||
{
|
||||
mp_msg(MSGT_DECVIDEO, MSGL_DBG2, " %d: %d %d [iq:%p d:%p]\n",
|
||||
i, func[i].what, func[i].id, func[i].iq_func, func[i].dec_func);
|
||||
if (func[i].what & XAVID_AVI_QUERY)
|
||||
{
|
||||
mp_msg(MSGT_DECVIDEO, MSGL_DBG2, " %p: avi init/query func (id: %d)\n",
|
||||
func[i].iq_func, func[i].id);
|
||||
priv->iq_func = func[i].iq_func;
|
||||
}
|
||||
if (func[i].what & XAVID_QT_QUERY)
|
||||
{
|
||||
mp_msg(MSGT_DECVIDEO, MSGL_DBG2, " %p: qt init/query func (id: %d)\n",
|
||||
func[i].iq_func, func[i].id);
|
||||
priv->iq_func = func[i].iq_func;
|
||||
}
|
||||
if (func[i].what & XAVID_DEC_FUNC)
|
||||
{
|
||||
mp_msg(MSGT_DECVIDEO, MSGL_DBG2, " %p: decoder func (init/query: %p) (id: %d)\n",
|
||||
func[i].dec_func, func[i].iq_func, func[i].id);
|
||||
priv->dec_func = func[i].dec_func;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int xacodec_query(sh_video_t *sh, XA_CODEC_HDR *codec_hdr)
|
||||
{
|
||||
vd_xanim_ctx *priv = sh->context;
|
||||
long ret;
|
||||
|
||||
#if 0
|
||||
/* the brute one */
|
||||
if (priv->dec_func)
|
||||
{
|
||||
codec_hdr->decoder = priv->dec_func;
|
||||
mp_msg(MSGT_DECVIDEO, MSGL_DBG2, "We got decoder's address at init! %p\n", codec_hdr->decoder);
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
ret = priv->iq_func(codec_hdr);
|
||||
switch(ret)
|
||||
{
|
||||
case CODEC_SUPPORTED:
|
||||
priv->dec_func = codec_hdr->decoder;
|
||||
mp_msg(MSGT_DECVIDEO, MSGL_DBG2, "Codec is supported: found decoder for %s at %p\n",
|
||||
codec_hdr->description, codec_hdr->decoder);
|
||||
return 1;
|
||||
case CODEC_UNSUPPORTED:
|
||||
mp_msg(MSGT_DECVIDEO, MSGL_FATAL, "Codec (%s) is unsupported by dll\n",
|
||||
codec_hdr->description);
|
||||
return 0;
|
||||
case CODEC_UNKNOWN:
|
||||
default:
|
||||
mp_msg(MSGT_DECVIDEO, MSGL_FATAL, "Codec (%s) is unknown by dll\n",
|
||||
codec_hdr->description);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* These functions are required for loading XAnim binary libs.
|
||||
* Add forward declarations to avoid warnings with -Wmissing-prototypes. */
|
||||
void XA_Print(char *fmt, ...);
|
||||
void TheEnd1(char *err_mess);
|
||||
void XA_Add_Func_To_Free_Chain(XA_ANIM_HDR *anim_hdr, void (*function)(void));
|
||||
unsigned long XA_Time_Read(void);
|
||||
void XA_Gen_YUV_Tabs(XA_ANIM_HDR *anim_hdr);
|
||||
void JPG_Setup_Samp_Limit_Table(XA_ANIM_HDR *anim_hdr);
|
||||
void JPG_Alloc_MCU_Bufs(XA_ANIM_HDR *anim_hdr, unsigned int width,
|
||||
unsigned int height, unsigned int full_flag);
|
||||
void *YUV2x2_Blk_Func(unsigned int image_type, int blks,
|
||||
unsigned int dith_flag);
|
||||
void *YUV2x2_Map_Func(unsigned int image_type, unsigned int dith_type);
|
||||
void *XA_YUV1611_Func(unsigned int image_type);
|
||||
void *XA_YUV221111_Func(unsigned int image_type);
|
||||
|
||||
void XA_Print(char *fmt, ...)
|
||||
{
|
||||
va_list vallist;
|
||||
char buf[1024];
|
||||
|
||||
va_start(vallist, fmt);
|
||||
vsnprintf(buf, 1024, fmt, vallist);
|
||||
mp_msg(MSGT_XACODEC, MSGL_DBG2, "[xacodec] %s\n", buf);
|
||||
va_end(vallist);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/* 0 is no debug (needed by 3ivX) */
|
||||
long xa_debug = 0;
|
||||
|
||||
void TheEnd1(char *err_mess)
|
||||
{
|
||||
XA_Print("error: %s - exiting\n", err_mess);
|
||||
/* we should exit here... */
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void XA_Add_Func_To_Free_Chain(XA_ANIM_HDR *anim_hdr, void (*function)(void))
|
||||
{
|
||||
// XA_Print("XA_Add_Func_To_Free_Chain('anim_hdr: %08x', 'function: %08x')",
|
||||
// anim_hdr, function);
|
||||
xa_close_func[xa_close_funcs] = function;
|
||||
if (xa_close_funcs+1 < XA_CLOSE_FUNCS)
|
||||
xa_close_funcs++;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
unsigned long XA_Time_Read(void)
|
||||
{
|
||||
return GetTimer(); //(GetRelativeTime());
|
||||
}
|
||||
|
||||
static void XA_dummy(void)
|
||||
{
|
||||
XA_Print("dummy() called");
|
||||
}
|
||||
|
||||
void XA_Gen_YUV_Tabs(XA_ANIM_HDR *anim_hdr)
|
||||
{
|
||||
XA_Print("XA_Gen_YUV_Tabs('anim_hdr: %08x')", anim_hdr);
|
||||
return;
|
||||
}
|
||||
|
||||
void JPG_Setup_Samp_Limit_Table(XA_ANIM_HDR *anim_hdr)
|
||||
{
|
||||
XA_Print("JPG_Setup_Samp_Limit_Table('anim_hdr: %08x')", anim_hdr);
|
||||
return;
|
||||
}
|
||||
|
||||
void JPG_Alloc_MCU_Bufs(XA_ANIM_HDR *anim_hdr, unsigned int width,
|
||||
unsigned int height, unsigned int full_flag)
|
||||
{
|
||||
XA_Print("JPG_Alloc_MCU_Bufs('anim_hdr: %08x', 'width: %d', 'height: %d', 'full_flag: %d')",
|
||||
anim_hdr, width, height, full_flag);
|
||||
return;
|
||||
}
|
||||
|
||||
/* --------------- 4x4 pixel YUV block fillers [CVID] ----------------- */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned char r0, g0, b0;
|
||||
unsigned char r1, g1, b1;
|
||||
unsigned char r2, g2, b2;
|
||||
unsigned char r3, g3, b3;
|
||||
unsigned int clr0_0, clr0_1, clr0_2, clr0_3;
|
||||
unsigned int clr1_0, clr1_1, clr1_2, clr1_3;
|
||||
unsigned int clr2_0, clr2_1, clr2_2, clr2_3;
|
||||
unsigned int clr3_0, clr3_1, clr3_2, clr3_3;
|
||||
} XA_2x2_Color;
|
||||
|
||||
#define SET_4_YUV_PIXELS(image,x,y,cmap2x2) \
|
||||
image->planes[0][((x)+0)+((y)+0)*image->stride[0]]=cmap2x2->clr0_0;\
|
||||
image->planes[0][((x)+1)+((y)+0)*image->stride[0]]=cmap2x2->clr0_1;\
|
||||
image->planes[0][((x)+0)+((y)+1)*image->stride[0]]=cmap2x2->clr0_2;\
|
||||
image->planes[0][((x)+1)+((y)+1)*image->stride[0]]=cmap2x2->clr0_3;\
|
||||
image->planes[1][((x)>>1)+((y)>>1)*image->stride[1]]=cmap2x2->clr1_0;\
|
||||
image->planes[2][((x)>>1)+((y)>>1)*image->stride[2]]=cmap2x2->clr1_1;
|
||||
|
||||
static void XA_2x2_OUT_1BLK_Convert(unsigned char *image_p, unsigned int x, unsigned int y,
|
||||
unsigned int imagex, XA_2x2_Color *cmap2x2)
|
||||
{
|
||||
mp_image_t *mpi = (mp_image_t *)image_p;
|
||||
|
||||
#if 0
|
||||
SET_4_YUV_PIXELS(mpi,x,y,cmap2x2)
|
||||
#else
|
||||
SET_4_YUV_PIXELS(mpi,x,y,cmap2x2)
|
||||
SET_4_YUV_PIXELS(mpi,x+2,y,cmap2x2)
|
||||
SET_4_YUV_PIXELS(mpi,x,y+2,cmap2x2)
|
||||
SET_4_YUV_PIXELS(mpi,x+2,y+2,cmap2x2)
|
||||
#endif
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static void XA_2x2_OUT_4BLKS_Convert(unsigned char *image_p, unsigned int x, unsigned int y,
|
||||
unsigned int imagex, XA_2x2_Color *cm0, XA_2x2_Color *cm1, XA_2x2_Color *cm2,
|
||||
XA_2x2_Color *cm3)
|
||||
{
|
||||
mp_image_t *mpi = (mp_image_t *)image_p;
|
||||
|
||||
SET_4_YUV_PIXELS(mpi,x,y,cm0)
|
||||
SET_4_YUV_PIXELS(mpi,x+2,y,cm1)
|
||||
SET_4_YUV_PIXELS(mpi,x,y+2,cm2)
|
||||
SET_4_YUV_PIXELS(mpi,x+2,y+2,cm3)
|
||||
return;
|
||||
}
|
||||
|
||||
void *YUV2x2_Blk_Func(unsigned int image_type, int blks, unsigned int dith_flag)
|
||||
{
|
||||
mp_dbg(MSGT_DECVIDEO,MSGL_DBG2, "YUV2x2_Blk_Func(image_type=%d, blks=%d, dith_flag=%d)\n",
|
||||
image_type, blks, dith_flag);
|
||||
switch(blks){
|
||||
case 1:
|
||||
return (void*) XA_2x2_OUT_1BLK_Convert;
|
||||
case 4:
|
||||
return (void*) XA_2x2_OUT_4BLKS_Convert;
|
||||
}
|
||||
|
||||
mp_msg(MSGT_DECVIDEO,MSGL_WARN,"Unimplemented: YUV2x2_Blk_Func(image_type=%d blks=%d dith=%d)\n",image_type,blks,dith_flag);
|
||||
return (void*) XA_dummy;
|
||||
}
|
||||
|
||||
// Take Four Y's and UV and put them into a 2x2 Color structure.
|
||||
|
||||
static void XA_YUV_2x2_clr(XA_2x2_Color *cmap2x2, unsigned int Y0, unsigned int Y1,
|
||||
unsigned int Y2, unsigned int Y3, unsigned int U, unsigned int V,
|
||||
unsigned int map_flag, unsigned int *map, XA_CHDR *chdr)
|
||||
{
|
||||
|
||||
mp_dbg(MSGT_DECVIDEO,MSGL_DBG3, "XA_YUV_2x2_clr(%p [%d,%d,%d,%d][%d][%d] %d %p %p)\n",
|
||||
cmap2x2,Y0,Y1,Y2,Y3,U,V,map_flag,map,chdr);
|
||||
|
||||
cmap2x2->clr0_0=Y0;
|
||||
cmap2x2->clr0_1=Y1;
|
||||
cmap2x2->clr0_2=Y2;
|
||||
cmap2x2->clr0_3=Y3;
|
||||
cmap2x2->clr1_0=U;
|
||||
cmap2x2->clr1_1=V;
|
||||
return;
|
||||
}
|
||||
|
||||
void *YUV2x2_Map_Func(unsigned int image_type, unsigned int dith_type)
|
||||
{
|
||||
mp_dbg(MSGT_DECVIDEO,MSGL_DBG2, "YUV2x2_Map_Func('image_type: %d', 'dith_type: %d')",
|
||||
image_type, dith_type);
|
||||
return (void*)XA_YUV_2x2_clr;
|
||||
}
|
||||
|
||||
/* -------------------- whole YUV frame converters ------------------------- */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned char *Ybuf;
|
||||
unsigned char *Ubuf;
|
||||
unsigned char *Vbuf;
|
||||
unsigned char *the_buf;
|
||||
unsigned int the_buf_size;
|
||||
unsigned short y_w, y_h;
|
||||
unsigned short uv_w, uv_h;
|
||||
} YUVBufs;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned long Uskip_mask;
|
||||
long *YUV_Y_tab;
|
||||
long *YUV_UB_tab;
|
||||
long *YUV_VR_tab;
|
||||
long *YUV_UG_tab;
|
||||
long *YUV_VG_tab;
|
||||
} YUVTabs;
|
||||
|
||||
YUVBufs jpg_YUVBufs;
|
||||
YUVTabs def_yuv_tabs;
|
||||
|
||||
/* -------------- YUV 4x4 1x1 1x1 (4:1:0 aka YVU9) [Indeo 3,4,5] ------------------ */
|
||||
|
||||
static void XA_YUV1611_Convert(unsigned char *image_p, unsigned int imagex, unsigned int imagey,
|
||||
unsigned int i_x, unsigned int i_y, YUVBufs *yuv, YUVTabs *yuv_tabs,
|
||||
unsigned int map_flag, unsigned int *map, XA_CHDR *chdr)
|
||||
{
|
||||
sh_video_t *sh = (sh_video_t*)image_p;
|
||||
vd_xanim_ctx *priv = sh->context;
|
||||
mp_image_t *mpi;
|
||||
int y;
|
||||
int ystride=(yuv->y_w)?yuv->y_w:imagex;
|
||||
int uvstride=(yuv->uv_w)?yuv->uv_w:(imagex/4);
|
||||
|
||||
mp_dbg(MSGT_DECVIDEO,MSGL_DBG3, "YUVTabs: %ld %p %p %p %p %p\n",yuv_tabs->Uskip_mask,
|
||||
yuv_tabs->YUV_Y_tab,
|
||||
yuv_tabs->YUV_UB_tab,
|
||||
yuv_tabs->YUV_VR_tab,
|
||||
yuv_tabs->YUV_UG_tab,
|
||||
yuv_tabs->YUV_VG_tab );
|
||||
|
||||
mp_dbg(MSGT_DECVIDEO,MSGL_DBG3, "XA_YUV1611_Convert('image: %p', 'imagex: %d', 'imagey: %d', 'i_x: %d', 'i_y: %d', 'yuv_bufs: %p', 'yuv_tabs: %p', 'map_flag: %d', 'map: %p', 'chdr: %p')",
|
||||
image_p, imagex, imagey, i_x, i_y, yuv, yuv_tabs, map_flag, map, chdr);
|
||||
|
||||
mp_dbg(MSGT_DECVIDEO,MSGL_DBG3, "YUV: %p %p %p %p (%d) %dx%d %dx%d\n",
|
||||
yuv->Ybuf,yuv->Ubuf,yuv->Vbuf,yuv->the_buf,yuv->the_buf_size,
|
||||
yuv->y_w,yuv->y_h,yuv->uv_w,yuv->uv_h);
|
||||
|
||||
if(!yuv_tabs->YUV_Y_tab){
|
||||
// standard YVU9 - simply export it!
|
||||
mpi = mpcodecs_get_image(sh, MP_IMGTYPE_EXPORT, 0,
|
||||
sh->disp_w, sh->disp_h);
|
||||
priv->mpi=mpi; if(!mpi) return; // ERROR!
|
||||
mpi->planes[0]=yuv->Ybuf;
|
||||
mpi->planes[1]=yuv->Ubuf;
|
||||
mpi->planes[2]=yuv->Vbuf;
|
||||
mpi->width=imagex;
|
||||
mpi->stride[0]=ystride; //i_x; // yuv->y_w
|
||||
mpi->stride[1]=mpi->stride[2]=uvstride; //i_x/4; // yuv->uv_w
|
||||
return;
|
||||
}
|
||||
|
||||
// allocate TEMP buffer and convert the image:
|
||||
mpi = mpcodecs_get_image(sh, MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE,
|
||||
sh->disp_w, sh->disp_h);
|
||||
priv->mpi=mpi; if(!mpi) return; // ERROR!
|
||||
|
||||
// convert the Y plane:
|
||||
for(y=0;y<(int)imagey;y++){
|
||||
unsigned int x;
|
||||
unsigned char* s=yuv->Ybuf+ystride*y;
|
||||
unsigned char* d=mpi->planes[0]+mpi->stride[0]*y;
|
||||
for(x=0;x<imagex;x++) d[x]=s[x]<<1;
|
||||
}
|
||||
|
||||
imagex>>=2;
|
||||
imagey>>=2;
|
||||
|
||||
// convert the U plane:
|
||||
for(y=0;y<(int)imagey;y++){
|
||||
unsigned int x;
|
||||
unsigned char* s=yuv->Ubuf+uvstride*y;
|
||||
unsigned char* d=mpi->planes[1]+mpi->stride[1]*y;
|
||||
for(x=0;x<imagex;x++) d[x]=s[x]<<1;
|
||||
}
|
||||
|
||||
// convert the V plane:
|
||||
for(y=0;y<(int)imagey;y++){
|
||||
unsigned int x;
|
||||
unsigned char* s=yuv->Vbuf+uvstride*y;
|
||||
unsigned char* d=mpi->planes[2]+mpi->stride[2]*y;
|
||||
for(x=0;x<imagex;x++) d[x]=s[x]<<1;
|
||||
}
|
||||
}
|
||||
|
||||
void *XA_YUV1611_Func(unsigned int image_type)
|
||||
{
|
||||
mp_dbg(MSGT_DECVIDEO,MSGL_DBG2, "XA_YUV1611_Func('image_type: %d')", image_type);
|
||||
return (void *)XA_YUV1611_Convert;
|
||||
}
|
||||
|
||||
/* --------------- YUV 2x2 1x1 1x1 (4:2:0 aka YV12) [3ivX,H263] ------------ */
|
||||
|
||||
static void XA_YUV221111_Convert(unsigned char *image_p, unsigned int imagex, unsigned int imagey,
|
||||
unsigned int i_x, unsigned int i_y, YUVBufs *yuv, YUVTabs *yuv_tabs, unsigned int map_flag,
|
||||
unsigned int *map, XA_CHDR *chdr)
|
||||
{
|
||||
sh_video_t *sh = (sh_video_t*)image_p;
|
||||
vd_xanim_ctx *priv = sh->context;
|
||||
mp_image_t *mpi;
|
||||
// note: 3ivX codec doesn't set y_w, uv_w, they are random junk :(
|
||||
int ystride=imagex; //(yuv->y_w)?yuv->y_w:imagex;
|
||||
int uvstride=imagex/2; //(yuv->uv_w)?yuv->uv_w:(imagex/2);
|
||||
|
||||
mp_dbg(MSGT_DECVIDEO,MSGL_DBG3, "XA_YUV221111_Convert(%p %dx%d %d;%d [%dx%d] %p %p %d %p %p)\n",
|
||||
image_p,imagex,imagey,i_x,i_y, sh->disp_w, sh->disp_h,
|
||||
yuv,yuv_tabs,map_flag,map,chdr);
|
||||
|
||||
mp_dbg(MSGT_DECVIDEO,MSGL_DBG3, "YUV: %p %p %p %p (%X) %Xx%X %Xx%X\n",
|
||||
yuv->Ybuf,yuv->Ubuf,yuv->Vbuf,yuv->the_buf,yuv->the_buf_size,
|
||||
yuv->y_w,yuv->y_h,yuv->uv_w,yuv->uv_h);
|
||||
|
||||
// standard YV12 - simply export it!
|
||||
mpi = mpcodecs_get_image(sh, MP_IMGTYPE_EXPORT, 0, sh->disp_w, sh->disp_h);
|
||||
priv->mpi=mpi; if(!mpi) return; // ERROR!
|
||||
mpi->planes[0]=yuv->Ybuf;
|
||||
mpi->planes[1]=yuv->Ubuf;
|
||||
mpi->planes[2]=yuv->Vbuf;
|
||||
mpi->width=imagex;
|
||||
mpi->stride[0]=ystride; //i_x; // yuv->y_w
|
||||
mpi->stride[1]=mpi->stride[2]=uvstride; //=i_x/4; // yuv->uv_w
|
||||
}
|
||||
|
||||
void *XA_YUV221111_Func(unsigned int image_type)
|
||||
{
|
||||
mp_dbg(MSGT_DECVIDEO,MSGL_DBG2, "XA_YUV221111_Func('image_type: %d')\n",image_type);
|
||||
return (void *)XA_YUV221111_Convert;
|
||||
}
|
||||
|
||||
/* *** EOF XANIM *** */
|
||||
|
||||
// to set/get/query special features/parameters
|
||||
static int control(sh_video_t *sh,int cmd,void* arg,...){
|
||||
return CONTROL_UNKNOWN;
|
||||
}
|
||||
|
||||
// init driver
|
||||
static int init(sh_video_t *sh)
|
||||
{
|
||||
vd_xanim_ctx *priv;
|
||||
char dll[1024];
|
||||
XA_CODEC_HDR codec_hdr;
|
||||
int i;
|
||||
|
||||
priv = malloc(sizeof(vd_xanim_ctx));
|
||||
if (!priv)
|
||||
return 0;
|
||||
sh->context = priv;
|
||||
memset(priv, 0, sizeof(vd_xanim_ctx));
|
||||
|
||||
if(!mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_YV12)) return 0;
|
||||
|
||||
priv->iq_func = NULL;
|
||||
priv->dec_func = NULL;
|
||||
|
||||
for (i=0; i < XA_CLOSE_FUNCS; i++)
|
||||
xa_close_func[i] = NULL;
|
||||
|
||||
snprintf(dll, 1024, "%s/%s", codec_path, sh->codec->dll);
|
||||
if (xacodec_load(sh, dll) == 0)
|
||||
return 0;
|
||||
|
||||
codec_hdr.xapi_rev = XAVID_API_REV;
|
||||
codec_hdr.anim_hdr = malloc(4096);
|
||||
codec_hdr.description = sh->codec->info;
|
||||
codec_hdr.compression = bswap_32(sh->bih->biCompression);
|
||||
codec_hdr.decoder = NULL;
|
||||
codec_hdr.x = sh->bih->biWidth; /* ->disp_w */
|
||||
codec_hdr.y = sh->bih->biHeight; /* ->disp_h */
|
||||
/* extra fields to store palette */
|
||||
codec_hdr.avi_ctab_flag = 0;
|
||||
codec_hdr.avi_read_ext = NULL;
|
||||
codec_hdr.extra = NULL;
|
||||
|
||||
switch(sh->codec->outfmt[sh->outfmtidx])
|
||||
{
|
||||
case IMGFMT_BGR32:
|
||||
codec_hdr.depth = 32;
|
||||
break;
|
||||
case IMGFMT_BGR24:
|
||||
codec_hdr.depth = 24;
|
||||
break;
|
||||
case IMGFMT_IYUV:
|
||||
case IMGFMT_I420:
|
||||
case IMGFMT_YV12:
|
||||
codec_hdr.depth = 12;
|
||||
break;
|
||||
case IMGFMT_YVU9:
|
||||
codec_hdr.depth = 9;
|
||||
break;
|
||||
default:
|
||||
mp_msg(MSGT_DECVIDEO, MSGL_FATAL, "xacodec: not supported image out format (%s)\n",
|
||||
vo_format_name(sh->codec->outfmt[sh->outfmtidx]));
|
||||
return 0;
|
||||
}
|
||||
mp_msg(MSGT_DECVIDEO, MSGL_INFO, "xacodec: querying for input %dx%d %dbit [fourcc: %4x] (%s)...\n",
|
||||
codec_hdr.x, codec_hdr.y, codec_hdr.depth, codec_hdr.compression, codec_hdr.description);
|
||||
|
||||
if (xacodec_query(sh, &codec_hdr) == 0)
|
||||
return 0;
|
||||
|
||||
// free(codec_hdr.anim_hdr);
|
||||
|
||||
priv->decinfo = malloc(sizeof(XA_DEC_INFO));
|
||||
if (priv->decinfo == NULL)
|
||||
{
|
||||
mp_msg(MSGT_DECVIDEO, MSGL_FATAL, "xacodec: memory allocation error: %s\n",
|
||||
strerror(errno));
|
||||
return 0;
|
||||
}
|
||||
priv->decinfo->cmd = 0;
|
||||
priv->decinfo->skip_flag = 0;
|
||||
priv->decinfo->imagex = priv->decinfo->xe = codec_hdr.x;
|
||||
priv->decinfo->imagey = priv->decinfo->ye = codec_hdr.y;
|
||||
priv->decinfo->imaged = codec_hdr.depth;
|
||||
priv->decinfo->chdr = NULL;
|
||||
priv->decinfo->map_flag = 0; /* xaFALSE */
|
||||
priv->decinfo->map = NULL;
|
||||
priv->decinfo->xs = priv->decinfo->ys = 0;
|
||||
priv->decinfo->special = 0;
|
||||
priv->decinfo->extra = codec_hdr.extra;
|
||||
mp_msg(MSGT_DECVIDEO, MSGL_DBG2, "decinfo->extra, filled by codec: %p [%s]\n",
|
||||
&priv->decinfo->extra, (char *)priv->decinfo->extra);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
// uninit driver
|
||||
static void uninit(sh_video_t *sh)
|
||||
{
|
||||
vd_xanim_ctx *priv = sh->context;
|
||||
int i;
|
||||
void (*close_func)(void);
|
||||
|
||||
for (i=0; i < XA_CLOSE_FUNCS; i++)
|
||||
if (xa_close_func[i])
|
||||
{
|
||||
close_func = xa_close_func[i];
|
||||
close_func();
|
||||
}
|
||||
dlclose(priv->file_handler);
|
||||
free(priv->decinfo);
|
||||
free(priv);
|
||||
}
|
||||
|
||||
// unsigned int (*dec_func)(unsigned char *image, unsigned char *delta,
|
||||
// unsigned int dsize, XA_DEC_INFO *dec_info);
|
||||
|
||||
// decode a frame
|
||||
static mp_image_t* decode(sh_video_t *sh, void *data, int len, int flags)
|
||||
{
|
||||
vd_xanim_ctx *priv = sh->context;
|
||||
unsigned int ret;
|
||||
|
||||
if (len <= 0)
|
||||
return NULL; // skipped frame
|
||||
|
||||
priv->decinfo->skip_flag = (flags&3)?1:0;
|
||||
|
||||
if(sh->codec->outflags[sh->outfmtidx] & CODECS_FLAG_STATIC){
|
||||
// allocate static buffer for cvid-like codecs:
|
||||
priv->mpi = mpcodecs_get_image(sh, MP_IMGTYPE_STATIC,
|
||||
MP_IMGFLAG_ACCEPT_STRIDE|MP_IMGFLAG_PREFER_ALIGNED_STRIDE,
|
||||
(sh->disp_w+3)&(~3), (sh->disp_h+3)&(~3));
|
||||
if (!priv->mpi) return NULL;
|
||||
ret = priv->dec_func((uint8_t*)priv->mpi, data, len, priv->decinfo);
|
||||
} else {
|
||||
// left the buffer allocation to the codecs, pass sh_video && priv
|
||||
priv->mpi=NULL;
|
||||
ret = priv->dec_func((uint8_t*)sh, data, len, priv->decinfo);
|
||||
}
|
||||
|
||||
if (ret == ACT_DLTA_NORM)
|
||||
return priv->mpi;
|
||||
|
||||
if (ret & ACT_DLTA_MAPD)
|
||||
mp_msg(MSGT_DECVIDEO, MSGL_DBG2, "mapd\n");
|
||||
/*
|
||||
if (!(ret & ACT_DLT_MAPD))
|
||||
xacodec_driver->decinfo->map_flag = 0;
|
||||
else
|
||||
{
|
||||
xacodec_driver->decinfo->map_flag = 1;
|
||||
xacodec_driver->decinfo->map = ...
|
||||
}
|
||||
*/
|
||||
|
||||
if (ret & ACT_DLTA_XOR)
|
||||
{
|
||||
mp_msg(MSGT_DECVIDEO, MSGL_DBG2, "xor\n");
|
||||
return priv->mpi;
|
||||
}
|
||||
|
||||
/* nothing changed */
|
||||
if (ret & ACT_DLTA_NOP)
|
||||
{
|
||||
mp_msg(MSGT_DECVIDEO, MSGL_DBG2, "nop\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* frame dropped (also display latest frame) */
|
||||
if (ret & ACT_DLTA_DROP)
|
||||
{
|
||||
mp_msg(MSGT_DECVIDEO, MSGL_DBG2, "drop\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (ret & ACT_DLTA_BAD)
|
||||
{
|
||||
mp_msg(MSGT_DECVIDEO, MSGL_DBG2, "bad\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* used for double buffer */
|
||||
if (ret & ACT_DLTA_BODY)
|
||||
{
|
||||
mp_msg(MSGT_DECVIDEO, MSGL_DBG2, "body\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return priv->mpi;
|
||||
}
|
||||
@@ -1,476 +0,0 @@
|
||||
/*
|
||||
* Demuxer for avisynth
|
||||
* Copyright (c) 2005 Gianluigi Tiesi <sherpya@netfarm.it>
|
||||
*
|
||||
* This file is part of MPlayer.
|
||||
*
|
||||
* MPlayer is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser 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.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <limits.h>
|
||||
|
||||
#include "config.h"
|
||||
#include "mp_msg.h"
|
||||
|
||||
#include "stream/stream.h"
|
||||
#include "demuxer.h"
|
||||
#include "stheader.h"
|
||||
#include "libvo/fastmemcpy.h"
|
||||
|
||||
#include "loader/wine/winbase.h"
|
||||
#include "loader/wine/windef.h"
|
||||
|
||||
#ifdef WIN32_LOADER
|
||||
#include "loader/ldt_keeper.h"
|
||||
#endif
|
||||
|
||||
#include "demux_avs.h"
|
||||
|
||||
#define MAX_AVS_SIZE 16 * 1024 /* 16k should be enough */
|
||||
|
||||
typedef WINAPI AVS_ScriptEnvironment* (*imp_avs_create_script_environment)(int version);
|
||||
typedef WINAPI AVS_Value (*imp_avs_invoke)(AVS_ScriptEnvironment *, const char * name, AVS_Value args, const char** arg_names);
|
||||
typedef WINAPI const AVS_VideoInfo *(*imp_avs_get_video_info)(AVS_Clip *);
|
||||
typedef WINAPI AVS_Clip* (*imp_avs_take_clip)(AVS_Value, AVS_ScriptEnvironment *);
|
||||
typedef WINAPI void (*imp_avs_release_clip)(AVS_Clip *);
|
||||
typedef WINAPI AVS_VideoFrame* (*imp_avs_get_frame)(AVS_Clip *, int n);
|
||||
typedef WINAPI void (*imp_avs_release_video_frame)(AVS_VideoFrame *);
|
||||
typedef WINAPI int (*imp_avs_get_audio)(AVS_Clip *, void * buf, uint64_t start, uint64_t count);
|
||||
|
||||
#define Q(string) # string
|
||||
#define IMPORT_FUNC(x) \
|
||||
AVS->x = ( imp_##x ) GetProcAddress(AVS->dll, Q(x)); \
|
||||
if (!AVS->x) { mp_msg(MSGT_DEMUX,MSGL_V,"AVS: failed to load "Q(x)"()\n"); return 0; }
|
||||
|
||||
typedef struct tagAVS
|
||||
{
|
||||
AVS_ScriptEnvironment *avs_env;
|
||||
AVS_Value handler;
|
||||
AVS_Clip *clip;
|
||||
const AVS_VideoInfo *video_info;
|
||||
#ifdef WIN32_LOADER
|
||||
ldt_fs_t* ldt_fs;
|
||||
#endif
|
||||
HMODULE dll;
|
||||
int frameno;
|
||||
uint64_t sampleno;
|
||||
int init;
|
||||
|
||||
imp_avs_create_script_environment avs_create_script_environment;
|
||||
imp_avs_invoke avs_invoke;
|
||||
imp_avs_get_video_info avs_get_video_info;
|
||||
imp_avs_take_clip avs_take_clip;
|
||||
imp_avs_release_clip avs_release_clip;
|
||||
imp_avs_get_frame avs_get_frame;
|
||||
imp_avs_release_video_frame avs_release_video_frame;
|
||||
imp_avs_get_audio avs_get_audio;
|
||||
} AVS_T;
|
||||
|
||||
static AVS_T *initAVS(const char *filename)
|
||||
{
|
||||
AVS_T *AVS = malloc (sizeof(AVS_T));
|
||||
AVS_Value arg0 = avs_new_value_string(filename);
|
||||
AVS_Value args = avs_new_value_array(&arg0, 1);
|
||||
|
||||
memset(AVS, 0, sizeof(AVS_T));
|
||||
|
||||
#ifdef WIN32_LOADER
|
||||
AVS->ldt_fs = Setup_LDT_Keeper();
|
||||
#endif
|
||||
|
||||
AVS->dll = LoadLibraryA("avisynth.dll");
|
||||
if(!AVS->dll)
|
||||
{
|
||||
mp_msg(MSGT_DEMUX ,MSGL_V, "AVS: failed to load avisynth.dll\n");
|
||||
goto avs_err;
|
||||
}
|
||||
|
||||
/* Dynamic import of needed stuff from avisynth.dll */
|
||||
IMPORT_FUNC(avs_create_script_environment);
|
||||
IMPORT_FUNC(avs_invoke);
|
||||
IMPORT_FUNC(avs_get_video_info);
|
||||
IMPORT_FUNC(avs_take_clip);
|
||||
IMPORT_FUNC(avs_release_clip);
|
||||
IMPORT_FUNC(avs_get_frame);
|
||||
IMPORT_FUNC(avs_release_video_frame);
|
||||
IMPORT_FUNC(avs_get_audio);
|
||||
|
||||
AVS->avs_env = AVS->avs_create_script_environment(AVISYNTH_INTERFACE_VERSION);
|
||||
if (!AVS->avs_env)
|
||||
{
|
||||
mp_msg(MSGT_DEMUX, MSGL_V, "AVS: avs_create_script_environment failed\n");
|
||||
goto avs_err;
|
||||
}
|
||||
|
||||
|
||||
AVS->handler = AVS->avs_invoke(AVS->avs_env, "Import", args, 0);
|
||||
|
||||
if (avs_is_error(AVS->handler))
|
||||
{
|
||||
mp_msg(MSGT_DEMUX, MSGL_V, "AVS: Avisynth error: %s\n", avs_as_string(AVS->handler));
|
||||
goto avs_err;
|
||||
}
|
||||
|
||||
if (!avs_is_clip(AVS->handler))
|
||||
{
|
||||
mp_msg(MSGT_DEMUX, MSGL_V, "AVS: Avisynth doesn't return a clip\n");
|
||||
goto avs_err;
|
||||
}
|
||||
|
||||
return AVS;
|
||||
|
||||
avs_err:
|
||||
if (AVS->dll) FreeLibrary(AVS->dll);
|
||||
#ifdef WIN32_LOADER
|
||||
Restore_LDT_Keeper(AVS->ldt_fs);
|
||||
#endif
|
||||
free(AVS);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Implement RGB MODES ?? */
|
||||
#if 0
|
||||
static __inline int get_mmioFOURCC(const AVS_VideoInfo *v)
|
||||
{
|
||||
if (avs_is_rgb(v)) return mmioFOURCC(8, 'R', 'G', 'B');
|
||||
if (avs_is_rgb24(v)) return mmioFOURCC(24, 'R', 'G', 'B');
|
||||
if (avs_is_rgb32(v)) return mmioFOURCC(32, 'R', 'G', 'B');
|
||||
if (avs_is_yv12(v)) return mmioFOURCC('Y', 'V', '1', '2');
|
||||
if (avs_is_yuy(v)) return mmioFOURCC('Y', 'U', 'Y', ' ');
|
||||
if (avs_is_yuy2(v)) return mmioFOURCC('Y', 'U', 'Y', '2');
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int demux_avs_fill_buffer(demuxer_t *demuxer, demux_stream_t *ds)
|
||||
{
|
||||
AVS_VideoFrame *curr_frame;
|
||||
demux_packet_t *dp = NULL;
|
||||
AVS_T *AVS = demuxer->priv;
|
||||
|
||||
if (ds == demuxer->video)
|
||||
{
|
||||
sh_video_t *sh_video = demuxer->video->sh;
|
||||
char *dst;
|
||||
int w, h;
|
||||
if (AVS->video_info->num_frames <= AVS->frameno) return 0; // EOF
|
||||
|
||||
curr_frame = AVS->avs_get_frame(AVS->clip, AVS->frameno);
|
||||
if (!curr_frame)
|
||||
{
|
||||
mp_msg(MSGT_DEMUX, MSGL_V, "AVS: error getting frame -- EOF??\n");
|
||||
return 0;
|
||||
}
|
||||
w = curr_frame->row_size;
|
||||
h = curr_frame->height;
|
||||
|
||||
dp = new_demux_packet(w * h + 2 * (w / 2) * (h / 2));
|
||||
|
||||
dp->pts=AVS->frameno / sh_video->fps;
|
||||
|
||||
dst = dp->buffer;
|
||||
memcpy_pic(dst, curr_frame->vfb->data + curr_frame->offset,
|
||||
w, h, w, curr_frame->pitch);
|
||||
dst += w * h;
|
||||
w /= 2; h /= 2;
|
||||
memcpy_pic(dst, curr_frame->vfb->data + curr_frame->offsetV,
|
||||
w, h, w, curr_frame->pitchUV);
|
||||
dst += w * h;
|
||||
memcpy_pic(dst, curr_frame->vfb->data + curr_frame->offsetU,
|
||||
w, h, w, curr_frame->pitchUV);
|
||||
ds_add_packet(demuxer->video, dp);
|
||||
|
||||
AVS->frameno++;
|
||||
AVS->avs_release_video_frame(curr_frame);
|
||||
}
|
||||
|
||||
/* Audio */
|
||||
if (ds == demuxer->audio)
|
||||
{
|
||||
sh_audio_t *sh_audio = ds->sh;
|
||||
int samples = sh_audio->samplerate;
|
||||
uint64_t l;
|
||||
samples = FFMIN(samples, AVS->video_info->num_audio_samples - AVS->sampleno);
|
||||
if (!samples) return 0;
|
||||
l = samples * sh_audio->channels * sh_audio->samplesize;
|
||||
if (l > INT_MAX) {
|
||||
mp_msg(MSGT_DEMUX, MSGL_FATAL, "AVS: audio packet too big\n");
|
||||
return 0;
|
||||
}
|
||||
dp = new_demux_packet(l);
|
||||
dp->pts = AVS->sampleno / sh_audio->samplerate;
|
||||
|
||||
if (AVS->avs_get_audio(AVS->clip, dp->buffer, AVS->sampleno, samples))
|
||||
{
|
||||
mp_msg(MSGT_DEMUX, MSGL_V, "AVS: avs_get_audio() failed\n");
|
||||
return 0;
|
||||
}
|
||||
ds_add_packet(demuxer->audio, dp);
|
||||
|
||||
AVS->sampleno += samples;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static demuxer_t* demux_open_avs(demuxer_t* demuxer)
|
||||
{
|
||||
int found = 0;
|
||||
AVS_T *AVS = demuxer->priv;
|
||||
int audio_samplesize = 0;
|
||||
AVS->frameno = 0;
|
||||
AVS->sampleno = 0;
|
||||
|
||||
mp_msg(MSGT_DEMUX, MSGL_V, "AVS: demux_open_avs()\n");
|
||||
demuxer->seekable = 1;
|
||||
|
||||
AVS->clip = AVS->avs_take_clip(AVS->handler, AVS->avs_env);
|
||||
if(!AVS->clip)
|
||||
{
|
||||
mp_msg(MSGT_DEMUX, MSGL_V, "AVS: avs_take_clip() failed\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
AVS->video_info = AVS->avs_get_video_info(AVS->clip);
|
||||
if (!AVS->video_info)
|
||||
{
|
||||
mp_msg(MSGT_DEMUX, MSGL_V, "AVS: avs_get_video_info() call failed\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!avs_is_yv12(AVS->video_info))
|
||||
{
|
||||
AVS->handler = AVS->avs_invoke(AVS->avs_env, "ConvertToYV12", avs_new_value_array(&AVS->handler, 1), 0);
|
||||
if (avs_is_error(AVS->handler))
|
||||
{
|
||||
mp_msg(MSGT_DEMUX, MSGL_V, "AVS: Cannot convert input video to YV12: %s\n", avs_as_string(AVS->handler));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
AVS->clip = AVS->avs_take_clip(AVS->handler, AVS->avs_env);
|
||||
|
||||
if(!AVS->clip)
|
||||
{
|
||||
mp_msg(MSGT_DEMUX, MSGL_V, "AVS: avs_take_clip() failed\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
AVS->video_info = AVS->avs_get_video_info(AVS->clip);
|
||||
if (!AVS->video_info)
|
||||
{
|
||||
mp_msg(MSGT_DEMUX, MSGL_V, "AVS: avs_get_video_info() call failed\n");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO check field-based ??
|
||||
|
||||
/* Video */
|
||||
if (avs_has_video(AVS->video_info))
|
||||
{
|
||||
sh_video_t *sh_video = new_sh_video(demuxer, 0);
|
||||
found = 1;
|
||||
|
||||
if (demuxer->video->id == -1) demuxer->video->id = 0;
|
||||
if (demuxer->video->id == 0)
|
||||
demuxer->video->sh = sh_video;
|
||||
sh_video->ds = demuxer->video;
|
||||
|
||||
sh_video->disp_w = AVS->video_info->width;
|
||||
sh_video->disp_h = AVS->video_info->height;
|
||||
|
||||
//sh_video->format = get_mmioFOURCC(AVS->video_info);
|
||||
sh_video->format = mmioFOURCC('Y', 'V', '1', '2');
|
||||
sh_video->fps = (double) AVS->video_info->fps_numerator / (double) AVS->video_info->fps_denominator;
|
||||
sh_video->frametime = 1.0 / sh_video->fps;
|
||||
|
||||
sh_video->bih = malloc(sizeof(*sh_video->bih) + (256 * 4));
|
||||
sh_video->bih->biCompression = sh_video->format;
|
||||
sh_video->bih->biBitCount = avs_bits_per_pixel(AVS->video_info);
|
||||
//sh_video->bih->biPlanes = 2;
|
||||
|
||||
sh_video->bih->biWidth = AVS->video_info->width;
|
||||
sh_video->bih->biHeight = AVS->video_info->height;
|
||||
sh_video->num_frames = 0;
|
||||
sh_video->num_frames_decoded = 0;
|
||||
}
|
||||
|
||||
/* Audio */
|
||||
if (avs_has_audio(AVS->video_info))
|
||||
switch (AVS->video_info->sample_type) {
|
||||
case AVS_SAMPLE_INT8: audio_samplesize = 1; break;
|
||||
case AVS_SAMPLE_INT16: audio_samplesize = 2; break;
|
||||
case AVS_SAMPLE_INT24: audio_samplesize = 3; break;
|
||||
case AVS_SAMPLE_INT32:
|
||||
case AVS_SAMPLE_FLOAT: audio_samplesize = 4; break;
|
||||
default:
|
||||
mp_msg(MSGT_DEMUX, MSGL_ERR, "AVS: unknown audio type, disabling\n");
|
||||
}
|
||||
if (audio_samplesize)
|
||||
{
|
||||
sh_audio_t *sh_audio = new_sh_audio(demuxer, 0);
|
||||
found = 1;
|
||||
mp_msg(MSGT_DEMUX, MSGL_V, "AVS: Clip has audio -> Channels = %d - Freq = %d\n", AVS->video_info->nchannels, AVS->video_info->audio_samples_per_second);
|
||||
|
||||
if (demuxer->audio->id == -1) demuxer->audio->id = 0;
|
||||
if (demuxer->audio->id == 0)
|
||||
demuxer->audio->sh = sh_audio;
|
||||
sh_audio->ds = demuxer->audio;
|
||||
|
||||
sh_audio->wf = malloc(sizeof(*sh_audio->wf));
|
||||
sh_audio->wf->wFormatTag = sh_audio->format =
|
||||
(AVS->video_info->sample_type == AVS_SAMPLE_FLOAT) ? 0x3 : 0x1;
|
||||
sh_audio->wf->nChannels = sh_audio->channels = AVS->video_info->nchannels;
|
||||
sh_audio->wf->nSamplesPerSec = sh_audio->samplerate = AVS->video_info->audio_samples_per_second;
|
||||
sh_audio->samplesize = audio_samplesize;
|
||||
sh_audio->wf->nAvgBytesPerSec = sh_audio->channels * sh_audio->samplesize * sh_audio->samplerate;
|
||||
sh_audio->wf->nBlockAlign = sh_audio->channels * sh_audio->samplesize;
|
||||
sh_audio->wf->wBitsPerSample = sh_audio->samplesize * 8;
|
||||
sh_audio->wf->cbSize = 0;
|
||||
sh_audio->i_bps = sh_audio->wf->nAvgBytesPerSec;
|
||||
}
|
||||
|
||||
AVS->init = 1;
|
||||
if (found)
|
||||
return demuxer;
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int demux_avs_control(demuxer_t *demuxer, int cmd, void *arg)
|
||||
{
|
||||
sh_video_t *sh_video=demuxer->video->sh;
|
||||
sh_audio_t *sh_audio=demuxer->audio->sh;
|
||||
AVS_T *AVS = demuxer->priv;
|
||||
|
||||
switch(cmd)
|
||||
{
|
||||
case DEMUXER_CTRL_GET_TIME_LENGTH:
|
||||
{
|
||||
double res = sh_video ? (double)AVS->video_info->num_frames / sh_video->fps : 0;
|
||||
if (sh_audio)
|
||||
res = FFMAX(res, (double)AVS->video_info->num_audio_samples / sh_audio->samplerate);
|
||||
*((double *)arg) = res;
|
||||
return DEMUXER_CTRL_OK;
|
||||
}
|
||||
case DEMUXER_CTRL_GET_PERCENT_POS:
|
||||
{
|
||||
if (sh_video)
|
||||
*((int *)arg) = AVS->frameno * 100 / AVS->video_info->num_frames;
|
||||
else
|
||||
*((int *)arg) = AVS->sampleno * 100 / AVS->video_info->num_audio_samples;
|
||||
return DEMUXER_CTRL_OK;
|
||||
}
|
||||
default:
|
||||
return DEMUXER_CTRL_NOTIMPL;
|
||||
}
|
||||
}
|
||||
|
||||
static void demux_close_avs(demuxer_t* demuxer)
|
||||
{
|
||||
AVS_T *AVS = demuxer->priv;
|
||||
|
||||
if (AVS)
|
||||
{
|
||||
if (AVS->dll)
|
||||
{
|
||||
if (AVS->clip)
|
||||
AVS->avs_release_clip(AVS->clip);
|
||||
mp_msg(MSGT_DEMUX, MSGL_V, "AVS: Unloading avisynth.dll\n");
|
||||
FreeLibrary(AVS->dll);
|
||||
}
|
||||
#ifdef WIN32_LOADER
|
||||
Restore_LDT_Keeper(AVS->ldt_fs);
|
||||
#endif
|
||||
free(AVS);
|
||||
}
|
||||
}
|
||||
|
||||
static void demux_seek_avs(demuxer_t *demuxer, float rel_seek_secs, float audio_delay, int flags)
|
||||
{
|
||||
sh_video_t *sh_video=demuxer->video->sh;
|
||||
sh_audio_t *sh_audio=demuxer->audio->sh;
|
||||
AVS_T *AVS = demuxer->priv;
|
||||
double video_pos = sh_video ?
|
||||
(double)AVS->frameno / sh_video->fps :
|
||||
(double)AVS->sampleno / sh_audio->samplerate;
|
||||
double duration = sh_video ?
|
||||
(double)AVS->video_info->num_frames / sh_video->fps :
|
||||
(double)AVS->video_info->num_audio_samples / sh_audio->samplerate;
|
||||
|
||||
//mp_msg(MSGT_DEMUX, MSGL_V, "AVS: seek rel_seek_secs = %f - flags = %x\n", rel_seek_secs, flags);
|
||||
|
||||
if (flags&SEEK_ABSOLUTE) video_pos=0;
|
||||
if (flags&SEEK_FACTOR) rel_seek_secs *= duration;
|
||||
|
||||
video_pos += rel_seek_secs;
|
||||
if (video_pos < 0) video_pos = 0;
|
||||
|
||||
if (sh_video) {
|
||||
AVS->frameno = FFMIN(video_pos * sh_video->fps,
|
||||
AVS->video_info->num_frames);
|
||||
sh_video->num_frames_decoded = AVS->frameno;
|
||||
sh_video->num_frames = AVS->frameno;
|
||||
}
|
||||
video_pos += audio_delay;
|
||||
if (video_pos < 0) video_pos = 0;
|
||||
if (sh_audio)
|
||||
AVS->sampleno = FFMIN(video_pos * sh_audio->samplerate,
|
||||
AVS->video_info->num_audio_samples);
|
||||
}
|
||||
|
||||
static int avs_check_file(demuxer_t *demuxer)
|
||||
{
|
||||
mp_msg(MSGT_DEMUX, MSGL_V, "AVS: avs_check_file - attempting to open file %s\n", demuxer->filename);
|
||||
|
||||
if (!demuxer->filename) return 0;
|
||||
|
||||
/* Avoid crazy memory eating when passing an mpg stream */
|
||||
if (demuxer->movi_end > MAX_AVS_SIZE)
|
||||
{
|
||||
mp_msg(MSGT_DEMUX,MSGL_V, "AVS: File is too big, aborting...\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
demuxer->priv = initAVS(demuxer->filename);
|
||||
|
||||
if (demuxer->priv)
|
||||
{
|
||||
mp_msg(MSGT_DEMUX,MSGL_V, "AVS: Init Ok\n");
|
||||
return DEMUXER_TYPE_AVS;
|
||||
}
|
||||
mp_msg(MSGT_DEMUX,MSGL_V, "AVS: Init failed\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
const demuxer_desc_t demuxer_desc_avs = {
|
||||
"Avisynth demuxer",
|
||||
"avs",
|
||||
"AVS",
|
||||
"Gianluigi Tiesi",
|
||||
"Requires binary dll",
|
||||
DEMUXER_TYPE_AVS,
|
||||
0, // unsafe autodetect
|
||||
avs_check_file,
|
||||
demux_avs_fill_buffer,
|
||||
demux_open_avs,
|
||||
demux_close_avs,
|
||||
demux_seek_avs,
|
||||
demux_avs_control
|
||||
};
|
||||
@@ -1,173 +0,0 @@
|
||||
/*
|
||||
* Demuxer for avisynth
|
||||
* Copyright (c) 2005 Gianluigi Tiesi <sherpya@netfarm.it>
|
||||
*
|
||||
* Avisynth C Interface Version 0.20
|
||||
* Copyright 2003 Kevin Atkinson
|
||||
*
|
||||
* This file is part of MPlayer.
|
||||
*
|
||||
* MPlayer is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser 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_DEMUX_AVS_H
|
||||
#define MPLAYER_DEMUX_AVS_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include "loader/wine/windef.h"
|
||||
|
||||
enum { AVISYNTH_INTERFACE_VERSION = 2 };
|
||||
|
||||
enum
|
||||
{
|
||||
AVS_SAMPLE_INT8 = 1<<0,
|
||||
AVS_SAMPLE_INT16 = 1<<1,
|
||||
AVS_SAMPLE_INT24 = 1<<2,
|
||||
AVS_SAMPLE_INT32 = 1<<3,
|
||||
AVS_SAMPLE_FLOAT = 1<<4
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
AVS_PLANAR_Y=1<<0,
|
||||
AVS_PLANAR_U=1<<1,
|
||||
AVS_PLANAR_V=1<<2,
|
||||
AVS_PLANAR_ALIGNED=1<<3,
|
||||
AVS_PLANAR_Y_ALIGNED=AVS_PLANAR_Y|AVS_PLANAR_ALIGNED,
|
||||
AVS_PLANAR_U_ALIGNED=AVS_PLANAR_U|AVS_PLANAR_ALIGNED,
|
||||
AVS_PLANAR_V_ALIGNED=AVS_PLANAR_V|AVS_PLANAR_ALIGNED
|
||||
};
|
||||
|
||||
// Colorspace properties.
|
||||
enum
|
||||
{
|
||||
AVS_CS_BGR = 1<<28,
|
||||
AVS_CS_YUV = 1<<29,
|
||||
AVS_CS_INTERLEAVED = 1<<30,
|
||||
AVS_CS_PLANAR = 1<<31
|
||||
};
|
||||
|
||||
// Specific colorformats
|
||||
enum
|
||||
{
|
||||
AVS_CS_UNKNOWN = 0,
|
||||
AVS_CS_BGR24 = 1<<0 | AVS_CS_BGR | AVS_CS_INTERLEAVED,
|
||||
AVS_CS_BGR32 = 1<<1 | AVS_CS_BGR | AVS_CS_INTERLEAVED,
|
||||
AVS_CS_YUY2 = 1<<2 | AVS_CS_YUV | AVS_CS_INTERLEAVED,
|
||||
AVS_CS_YV12 = 1<<3 | AVS_CS_YUV | AVS_CS_PLANAR, // y-v-u, planar
|
||||
AVS_CS_I420 = 1<<4 | AVS_CS_YUV | AVS_CS_PLANAR, // y-u-v, planar
|
||||
AVS_CS_IYUV = 1<<4 | AVS_CS_YUV | AVS_CS_PLANAR // same as above
|
||||
};
|
||||
|
||||
typedef struct AVS_Clip AVS_Clip;
|
||||
typedef struct AVS_ScriptEnvironment AVS_ScriptEnvironment;
|
||||
|
||||
typedef struct AVS_Value AVS_Value;
|
||||
struct AVS_Value {
|
||||
short type; // 'a'rray, 'c'lip, 'b'ool, 'i'nt, 'f'loat, 's'tring, 'v'oid, or 'l'ong
|
||||
// for some function e'rror
|
||||
short array_size;
|
||||
union {
|
||||
void * clip; // do not use directly, use avs_take_clip
|
||||
char boolean;
|
||||
int integer;
|
||||
float floating_pt;
|
||||
const char * string;
|
||||
const AVS_Value * array;
|
||||
} d;
|
||||
};
|
||||
|
||||
// AVS_VideoInfo is layed out identicly to VideoInfo
|
||||
typedef struct AVS_VideoInfo {
|
||||
int width, height; // width=0 means no video
|
||||
unsigned fps_numerator, fps_denominator;
|
||||
int num_frames;
|
||||
|
||||
int pixel_type;
|
||||
|
||||
int audio_samples_per_second; // 0 means no audio
|
||||
int sample_type;
|
||||
uint64_t num_audio_samples;
|
||||
int nchannels;
|
||||
|
||||
// Imagetype properties
|
||||
|
||||
int image_type;
|
||||
} AVS_VideoInfo;
|
||||
|
||||
typedef struct AVS_VideoFrameBuffer {
|
||||
BYTE * data;
|
||||
int data_size;
|
||||
// sequence_number is incremented every time the buffer is changed, so
|
||||
// that stale views can tell they're no longer valid.
|
||||
long sequence_number;
|
||||
|
||||
long refcount;
|
||||
} AVS_VideoFrameBuffer;
|
||||
|
||||
typedef struct AVS_VideoFrame {
|
||||
int refcount;
|
||||
AVS_VideoFrameBuffer * vfb;
|
||||
int offset, pitch, row_size, height, offsetU, offsetV, pitchUV; // U&V offsets are from top of picture.
|
||||
} AVS_VideoFrame;
|
||||
|
||||
static inline AVS_Value avs_new_value_string(const char * v0)
|
||||
{ AVS_Value v; v.type = 's'; v.d.string = v0; return v; }
|
||||
|
||||
static inline AVS_Value avs_new_value_array(AVS_Value * v0, int size)
|
||||
{ AVS_Value v; v.type = 'a'; v.d.array = v0; v.array_size = size; return v; }
|
||||
|
||||
|
||||
static inline int avs_is_error(AVS_Value v) { return v.type == 'e'; }
|
||||
static inline int avs_is_clip(AVS_Value v) { return v.type == 'c'; }
|
||||
static inline int avs_is_string(AVS_Value v) { return v.type == 's'; }
|
||||
static inline int avs_has_video(const AVS_VideoInfo * p) { return p->width != 0; }
|
||||
static inline int avs_has_audio(const AVS_VideoInfo * p) { return p->audio_samples_per_second != 0; }
|
||||
|
||||
static inline const char * avs_as_string(AVS_Value v)
|
||||
{ return avs_is_error(v) || avs_is_string(v) ? v.d.string : 0; }
|
||||
|
||||
/* Color spaces */
|
||||
static inline int avs_is_rgb(const AVS_VideoInfo * p)
|
||||
{ return p->pixel_type & AVS_CS_BGR; }
|
||||
|
||||
static inline int avs_is_rgb24(const AVS_VideoInfo * p)
|
||||
{ return (p->pixel_type&AVS_CS_BGR24)==AVS_CS_BGR24; } // Clear out additional properties
|
||||
|
||||
static inline int avs_is_rgb32(const AVS_VideoInfo * p)
|
||||
{ return (p->pixel_type & AVS_CS_BGR32) == AVS_CS_BGR32 ; }
|
||||
|
||||
static inline int avs_is_yuy(const AVS_VideoInfo * p)
|
||||
{ return p->pixel_type & AVS_CS_YUV; }
|
||||
|
||||
static inline int avs_is_yuy2(const AVS_VideoInfo * p)
|
||||
{ return (p->pixel_type & AVS_CS_YUY2) == AVS_CS_YUY2; }
|
||||
|
||||
static inline int avs_is_yv12(const AVS_VideoInfo * p)
|
||||
{ return ((p->pixel_type & AVS_CS_YV12) == AVS_CS_YV12)||((p->pixel_type & AVS_CS_I420) == AVS_CS_I420); }
|
||||
|
||||
static inline int avs_bits_per_pixel(const AVS_VideoInfo * p)
|
||||
{
|
||||
switch (p->pixel_type) {
|
||||
case AVS_CS_BGR24: return 24;
|
||||
case AVS_CS_BGR32: return 32;
|
||||
case AVS_CS_YUY2: return 16;
|
||||
case AVS_CS_YV12:
|
||||
case AVS_CS_I420: return 12;
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* MPLAYER_DEMUX_AVS_H */
|
||||
+1
-32
@@ -53,10 +53,6 @@
|
||||
#include "sub/sub.h"
|
||||
|
||||
|
||||
#ifdef CONFIG_QTX_CODECS
|
||||
#include "loader/qtx/qtxsdk/components.h"
|
||||
#endif
|
||||
|
||||
static const unsigned char sipr_swaps[38][2] = {
|
||||
{0,63},{1,22},{2,44},{3,90},{5,81},{7,31},{8,86},{9,58},{10,36},{12,68},
|
||||
{13,39},{14,73},{15,53},{16,69},{17,57},{19,88},{20,34},{21,71},{24,46},
|
||||
@@ -1157,7 +1153,6 @@ static int demux_mkv_open_video(demuxer_t *demuxer, mkv_track_t *track,
|
||||
int vid)
|
||||
{
|
||||
BITMAPINFOHEADER *bih;
|
||||
void *ImageDesc = NULL;
|
||||
sh_video_t *sh_v;
|
||||
|
||||
if (track->ms_compat) { /* MS compatibility mode */
|
||||
@@ -1222,32 +1217,6 @@ static int demux_mkv_open_video(demuxer_t *demuxer, mkv_track_t *track,
|
||||
memcpy(dst, src - 8, 8 + cnt);
|
||||
track->realmedia = 1;
|
||||
|
||||
#ifdef CONFIG_QTX_CODECS
|
||||
} else if (track->private_size >= sizeof(ImageDescription)
|
||||
&& !strcmp(track->codec_id, MKV_V_QUICKTIME)) {
|
||||
ImageDescriptionPtr idesc;
|
||||
|
||||
idesc = (ImageDescriptionPtr) track->private_data;
|
||||
idesc->idSize = be2me_32(idesc->idSize);
|
||||
idesc->cType = be2me_32(idesc->cType);
|
||||
idesc->version = be2me_16(idesc->version);
|
||||
idesc->revisionLevel = be2me_16(idesc->revisionLevel);
|
||||
idesc->vendor = be2me_32(idesc->vendor);
|
||||
idesc->temporalQuality = be2me_32(idesc->temporalQuality);
|
||||
idesc->spatialQuality = be2me_32(idesc->spatialQuality);
|
||||
idesc->width = be2me_16(idesc->width);
|
||||
idesc->height = be2me_16(idesc->height);
|
||||
idesc->hRes = be2me_32(idesc->hRes);
|
||||
idesc->vRes = be2me_32(idesc->vRes);
|
||||
idesc->dataSize = be2me_32(idesc->dataSize);
|
||||
idesc->frameCount = be2me_16(idesc->frameCount);
|
||||
idesc->depth = be2me_16(idesc->depth);
|
||||
idesc->clutID = be2me_16(idesc->clutID);
|
||||
bih->biPlanes = 1;
|
||||
bih->biCompression = idesc->cType;
|
||||
ImageDesc = idesc;
|
||||
#endif /* CONFIG_QTX_CODECS */
|
||||
|
||||
} else {
|
||||
const videocodec_info_t *vi = vinfo;
|
||||
while (vi->id && strcmp(vi->id, track->codec_id))
|
||||
@@ -1295,7 +1264,7 @@ static int demux_mkv_open_video(demuxer_t *demuxer, mkv_track_t *track,
|
||||
sh_v->disp_w = track->v_dwidth;
|
||||
sh_v->disp_h = track->v_dheight;
|
||||
}
|
||||
sh_v->ImageDesc = ImageDesc;
|
||||
sh_v->ImageDesc = NULL;
|
||||
mp_msg(MSGT_DEMUX, MSGL_V, "[mkv] Aspect: %f\n", sh_v->aspect);
|
||||
|
||||
sh_v->ds = demuxer->video;
|
||||
|
||||
-763
@@ -1,763 +0,0 @@
|
||||
/**************************************************************************
|
||||
|
||||
|
||||
This file will contain an interface to ACM drivers.
|
||||
Its content will be based mainly on wine/dlls/msacm32
|
||||
actually, for audio decompression only the following functions
|
||||
are needed:
|
||||
|
||||
acmStreamOpen ( takes formats of src and dest, returns stream handle )
|
||||
acmStreamPrepareHeader ( takes stream handler and info on data )
|
||||
acmStreamConvert ( the same as PrepareHeader )
|
||||
acmStreamUnprepareHeader
|
||||
acmStreamClose
|
||||
acmStreamSize
|
||||
maybe acmStreamReset
|
||||
|
||||
In future I'll also add functions for format enumeration,
|
||||
but not right now.
|
||||
|
||||
Modified for use with MPlayer, detailed changelog at
|
||||
http://svn.mplayerhq.hu/mplayer/trunk/
|
||||
|
||||
***************************************************************************/
|
||||
#include "config.h"
|
||||
#include "debug.h"
|
||||
|
||||
#include "wine/winbase.h"
|
||||
#include "wine/windef.h"
|
||||
#include "wine/winuser.h"
|
||||
#include "wine/vfw.h"
|
||||
#include "wine/winestring.h"
|
||||
#include "wine/driver.h"
|
||||
#include "wine/winerror.h"
|
||||
#include "wine/msacm.h"
|
||||
#include "wine/msacmdrv.h"
|
||||
#include "wineacm.h"
|
||||
#ifndef __MINGW32__
|
||||
#include "ext.h"
|
||||
#endif
|
||||
#include "drv.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#pragma pack(1)
|
||||
#define OpenDriverA DrvOpen
|
||||
#define CloseDriver DrvClose
|
||||
|
||||
static inline PWINE_ACMSTREAM ACM_GetStream(HACMSTREAM has)
|
||||
{
|
||||
return (PWINE_ACMSTREAM)has;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* acmDriverAddA (MSACM32.2)
|
||||
*/
|
||||
MMRESULT WINAPI acmDriverAddA(PHACMDRIVERID phadid, HINSTANCE hinstModule,
|
||||
LPARAM lParam, DWORD dwPriority, DWORD fdwAdd)
|
||||
{
|
||||
if (!phadid)
|
||||
return MMSYSERR_INVALPARAM;
|
||||
|
||||
/* Check if any unknown flags */
|
||||
if (fdwAdd &
|
||||
~(ACM_DRIVERADDF_FUNCTION|ACM_DRIVERADDF_NOTIFYHWND|
|
||||
ACM_DRIVERADDF_GLOBAL))
|
||||
return MMSYSERR_INVALFLAG;
|
||||
|
||||
/* Check if any incompatible flags */
|
||||
if ((fdwAdd & ACM_DRIVERADDF_FUNCTION) &&
|
||||
(fdwAdd & ACM_DRIVERADDF_NOTIFYHWND))
|
||||
return MMSYSERR_INVALFLAG;
|
||||
|
||||
/* FIXME: in fact, should GetModuleFileName(hinstModule) and do a
|
||||
* LoadDriver on it, to be sure we can call SendDriverMessage on the
|
||||
* hDrvr handle.
|
||||
*/
|
||||
*phadid = (HACMDRIVERID) MSACM_RegisterDriver(NULL, 0, hinstModule);
|
||||
|
||||
/* FIXME: lParam, dwPriority and fdwAdd ignored */
|
||||
|
||||
return MMSYSERR_NOERROR;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* acmDriverClose (MSACM32.4)
|
||||
*/
|
||||
MMRESULT WINAPI acmDriverClose(HACMDRIVER had, DWORD fdwClose)
|
||||
{
|
||||
PWINE_ACMDRIVER p;
|
||||
PWINE_ACMDRIVER* tp;
|
||||
|
||||
if (fdwClose)
|
||||
return MMSYSERR_INVALFLAG;
|
||||
|
||||
p = MSACM_GetDriver(had);
|
||||
if (!p)
|
||||
return MMSYSERR_INVALHANDLE;
|
||||
|
||||
for (tp = &(p->obj.pACMDriverID->pACMDriverList); *tp; *tp = (*tp)->pNextACMDriver) {
|
||||
if (*tp == p) {
|
||||
*tp = (*tp)->pNextACMDriver;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (p->hDrvr && !p->obj.pACMDriverID->pACMDriverList)
|
||||
CloseDriver(p->hDrvr);
|
||||
|
||||
HeapFree(MSACM_hHeap, 0, p);
|
||||
|
||||
return MMSYSERR_NOERROR;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* acmDriverEnum (MSACM32.7)
|
||||
*/
|
||||
MMRESULT WINAPI acmDriverEnum(ACMDRIVERENUMCB fnCallback, DWORD dwInstance, DWORD fdwEnum)
|
||||
{
|
||||
PWINE_ACMDRIVERID p;
|
||||
DWORD fdwSupport;
|
||||
|
||||
if (!fnCallback) {
|
||||
return MMSYSERR_INVALPARAM;
|
||||
}
|
||||
|
||||
if (fdwEnum && ~(ACM_DRIVERENUMF_NOLOCAL|ACM_DRIVERENUMF_DISABLED)) {
|
||||
return MMSYSERR_INVALFLAG;
|
||||
}
|
||||
|
||||
for (p = MSACM_pFirstACMDriverID; p; p = p->pNextACMDriverID) {
|
||||
fdwSupport = ACMDRIVERDETAILS_SUPPORTF_CODEC;
|
||||
if (!p->bEnabled) {
|
||||
if (fdwEnum & ACM_DRIVERENUMF_DISABLED)
|
||||
fdwSupport |= ACMDRIVERDETAILS_SUPPORTF_DISABLED;
|
||||
else
|
||||
continue;
|
||||
}
|
||||
(*fnCallback)((HACMDRIVERID) p, dwInstance, fdwSupport);
|
||||
}
|
||||
|
||||
return MMSYSERR_NOERROR;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* acmDriverID (MSACM32.8)
|
||||
*/
|
||||
MMRESULT WINAPI acmDriverID(HACMOBJ hao, PHACMDRIVERID phadid, DWORD fdwDriverID)
|
||||
{
|
||||
PWINE_ACMOBJ pao;
|
||||
|
||||
pao = MSACM_GetObj(hao);
|
||||
if (!pao)
|
||||
return MMSYSERR_INVALHANDLE;
|
||||
|
||||
if (!phadid)
|
||||
return MMSYSERR_INVALPARAM;
|
||||
|
||||
if (fdwDriverID)
|
||||
return MMSYSERR_INVALFLAG;
|
||||
|
||||
*phadid = (HACMDRIVERID) pao->pACMDriverID;
|
||||
|
||||
return MMSYSERR_NOERROR;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* acmDriverMessage (MSACM32.9)
|
||||
* FIXME
|
||||
* Not implemented
|
||||
*/
|
||||
LRESULT WINAPI acmDriverMessage(HACMDRIVER had, UINT uMsg, LPARAM lParam1, LPARAM lParam2)
|
||||
{
|
||||
PWINE_ACMDRIVER pad = MSACM_GetDriver(had);
|
||||
if (!pad)
|
||||
return MMSYSERR_INVALPARAM;
|
||||
|
||||
/* FIXME: Check if uMsg legal */
|
||||
|
||||
if (!SendDriverMessage(pad->hDrvr, uMsg, lParam1, lParam2))
|
||||
return MMSYSERR_NOTSUPPORTED;
|
||||
|
||||
return MMSYSERR_NOERROR;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* acmDriverOpen (MSACM32.10)
|
||||
*/
|
||||
MMRESULT WINAPI acmDriverOpen(PHACMDRIVER phad, HACMDRIVERID hadid, DWORD fdwOpen)
|
||||
{
|
||||
PWINE_ACMDRIVERID padid;
|
||||
PWINE_ACMDRIVER pad;
|
||||
ICOPEN icopen;
|
||||
|
||||
|
||||
TRACE("(%p, %x, %08lu)\n", phad, hadid, fdwOpen);
|
||||
|
||||
if (!phad)
|
||||
return MMSYSERR_INVALPARAM;
|
||||
|
||||
padid = MSACM_GetDriverID(hadid);
|
||||
if (!padid)
|
||||
return MMSYSERR_INVALHANDLE;
|
||||
|
||||
if (fdwOpen)
|
||||
return MMSYSERR_INVALFLAG;
|
||||
|
||||
pad = (PWINE_ACMDRIVER) HeapAlloc(MSACM_hHeap, 0, sizeof(WINE_ACMDRIVER));
|
||||
if (!pad)
|
||||
return MMSYSERR_NOMEM;
|
||||
|
||||
pad->obj.pACMDriverID = padid;
|
||||
icopen.fccType = mmioFOURCC('a', 'u', 'd', 'c');
|
||||
icopen.fccHandler = (long)padid->pszFileName;
|
||||
icopen.dwSize = sizeof(ICOPEN);
|
||||
icopen.dwFlags = 0;
|
||||
|
||||
icopen.pV1Reserved = padid->pszFileName;
|
||||
if (!padid->hInstModule)
|
||||
pad->hDrvr = OpenDriverA((long)&icopen);
|
||||
else
|
||||
pad->hDrvr = padid->hInstModule;
|
||||
|
||||
if (!pad->hDrvr) {
|
||||
HeapFree(MSACM_hHeap, 0, pad);
|
||||
return MMSYSERR_ERROR;
|
||||
}
|
||||
|
||||
pad->pfnDriverProc = (DRIVERPROC)GetProcAddress(pad->hDrvr, "DriverProc");
|
||||
|
||||
/* insert new pad at beg of list */
|
||||
pad->pNextACMDriver = padid->pACMDriverList;
|
||||
padid->pACMDriverList = pad;
|
||||
|
||||
/* FIXME: Create a WINE_ACMDRIVER32 */
|
||||
*phad = (HACMDRIVER)pad;
|
||||
|
||||
return MMSYSERR_NOERROR;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* acmDriverRemove (MSACM32.12)
|
||||
*/
|
||||
MMRESULT WINAPI acmDriverRemove(HACMDRIVERID hadid, DWORD fdwRemove)
|
||||
{
|
||||
PWINE_ACMDRIVERID padid;
|
||||
|
||||
padid = MSACM_GetDriverID(hadid);
|
||||
if (!padid)
|
||||
return MMSYSERR_INVALHANDLE;
|
||||
|
||||
if (fdwRemove)
|
||||
return MMSYSERR_INVALFLAG;
|
||||
|
||||
MSACM_UnregisterDriver(padid);
|
||||
|
||||
return MMSYSERR_NOERROR;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**********************************************************************/
|
||||
|
||||
HANDLE MSACM_hHeap = (HANDLE) NULL;
|
||||
PWINE_ACMDRIVERID MSACM_pFirstACMDriverID = NULL;
|
||||
PWINE_ACMDRIVERID MSACM_pLastACMDriverID = NULL;
|
||||
|
||||
/***********************************************************************
|
||||
* MSACM_RegisterDriver32()
|
||||
*/
|
||||
PWINE_ACMDRIVERID MSACM_RegisterDriver(const char* pszFileName,
|
||||
WORD wFormatTag,
|
||||
HINSTANCE hinstModule)
|
||||
{
|
||||
PWINE_ACMDRIVERID padid;
|
||||
|
||||
TRACE("('%s', '%x', 0x%08x)\n", pszFileName, wFormatTag, hinstModule);
|
||||
|
||||
#ifndef WIN32_LOADER
|
||||
MSACM_hHeap = GetProcessHeap();
|
||||
#endif
|
||||
padid = (PWINE_ACMDRIVERID) HeapAlloc(MSACM_hHeap, 0, sizeof(WINE_ACMDRIVERID));
|
||||
padid->pszFileName = malloc(strlen(pszFileName)+1);
|
||||
strcpy(padid->pszFileName, pszFileName);
|
||||
// 1~strdup(pszDriverAlias);
|
||||
padid->wFormatTag = wFormatTag;
|
||||
padid->hInstModule = hinstModule;
|
||||
padid->bEnabled = TRUE;
|
||||
padid->pACMDriverList = NULL;
|
||||
padid->pNextACMDriverID = NULL;
|
||||
padid->pPrevACMDriverID = MSACM_pLastACMDriverID;
|
||||
if (MSACM_pLastACMDriverID)
|
||||
MSACM_pLastACMDriverID->pNextACMDriverID = padid;
|
||||
MSACM_pLastACMDriverID = padid;
|
||||
if (!MSACM_pFirstACMDriverID)
|
||||
MSACM_pFirstACMDriverID = padid;
|
||||
|
||||
return padid;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* MSACM_UnregisterDriver32()
|
||||
*/
|
||||
PWINE_ACMDRIVERID MSACM_UnregisterDriver(PWINE_ACMDRIVERID p)
|
||||
{
|
||||
PWINE_ACMDRIVERID pNextACMDriverID;
|
||||
|
||||
while (p->pACMDriverList)
|
||||
acmDriverClose((HACMDRIVER) p->pACMDriverList, 0);
|
||||
|
||||
free(p->pszFileName);
|
||||
|
||||
if (p == MSACM_pFirstACMDriverID)
|
||||
MSACM_pFirstACMDriverID = p->pNextACMDriverID;
|
||||
if (p == MSACM_pLastACMDriverID)
|
||||
MSACM_pLastACMDriverID = p->pPrevACMDriverID;
|
||||
|
||||
if (p->pPrevACMDriverID)
|
||||
p->pPrevACMDriverID->pNextACMDriverID = p->pNextACMDriverID;
|
||||
if (p->pNextACMDriverID)
|
||||
p->pNextACMDriverID->pPrevACMDriverID = p->pPrevACMDriverID;
|
||||
|
||||
pNextACMDriverID = p->pNextACMDriverID;
|
||||
|
||||
HeapFree(MSACM_hHeap, 0, p);
|
||||
|
||||
return pNextACMDriverID;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* MSACM_UnregisterAllDrivers32()
|
||||
* FIXME
|
||||
* Where should this function be called?
|
||||
*/
|
||||
void MSACM_UnregisterAllDrivers(void)
|
||||
{
|
||||
PWINE_ACMDRIVERID p;
|
||||
|
||||
for (p = MSACM_pFirstACMDriverID; p; p = MSACM_UnregisterDriver(p));
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* MSACM_GetDriverID32()
|
||||
*/
|
||||
PWINE_ACMDRIVERID MSACM_GetDriverID(HACMDRIVERID hDriverID)
|
||||
{
|
||||
return (PWINE_ACMDRIVERID)hDriverID;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* MSACM_GetDriver32()
|
||||
*/
|
||||
PWINE_ACMDRIVER MSACM_GetDriver(HACMDRIVER hDriver)
|
||||
{
|
||||
return (PWINE_ACMDRIVER)hDriver;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* MSACM_GetObj32()
|
||||
*/
|
||||
PWINE_ACMOBJ MSACM_GetObj(HACMOBJ hObj)
|
||||
{
|
||||
return (PWINE_ACMOBJ)hObj;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* acmStreamOpen (MSACM32.40)
|
||||
*/
|
||||
MMRESULT WINAPI acmStreamOpen(PHACMSTREAM phas, HACMDRIVER had, PWAVEFORMATEX pwfxSrc,
|
||||
PWAVEFORMATEX pwfxDst, PWAVEFILTER pwfltr, DWORD dwCallback,
|
||||
DWORD dwInstance, DWORD fdwOpen)
|
||||
{
|
||||
PWINE_ACMSTREAM was;
|
||||
PWINE_ACMDRIVER wad;
|
||||
MMRESULT ret;
|
||||
int wfxSrcSize;
|
||||
int wfxDstSize;
|
||||
|
||||
TRACE("(%p, 0x%08x, %p, %p, %p, %ld, %ld, %ld)\n",
|
||||
phas, had, pwfxSrc, pwfxDst, pwfltr, dwCallback, dwInstance, fdwOpen);
|
||||
|
||||
TRACE("src [wFormatTag=%u, nChannels=%u, nSamplesPerSec=%lu, nAvgBytesPerSec=%lu, nBlockAlign=%u, wBitsPerSample=%u, cbSize=%u]\n",
|
||||
pwfxSrc->wFormatTag, pwfxSrc->nChannels, pwfxSrc->nSamplesPerSec, pwfxSrc->nAvgBytesPerSec,
|
||||
pwfxSrc->nBlockAlign, pwfxSrc->wBitsPerSample, pwfxSrc->cbSize);
|
||||
|
||||
TRACE("dst [wFormatTag=%u, nChannels=%u, nSamplesPerSec=%lu, nAvgBytesPerSec=%lu, nBlockAlign=%u, wBitsPerSample=%u, cbSize=%u]\n",
|
||||
pwfxDst->wFormatTag, pwfxDst->nChannels, pwfxDst->nSamplesPerSec, pwfxDst->nAvgBytesPerSec,
|
||||
pwfxDst->nBlockAlign, pwfxDst->wBitsPerSample, pwfxDst->cbSize);
|
||||
|
||||
#define SIZEOF_WFX(wfx) (sizeof(WAVEFORMATEX) + ((wfx->wFormatTag == WAVE_FORMAT_PCM) ? 0 : wfx->cbSize))
|
||||
wfxSrcSize = SIZEOF_WFX(pwfxSrc);
|
||||
wfxDstSize = SIZEOF_WFX(pwfxDst);
|
||||
#undef SIZEOF_WFX
|
||||
|
||||
was = (PWINE_ACMSTREAM) HeapAlloc(MSACM_hHeap, 0, sizeof(*was) + wfxSrcSize + wfxDstSize + ((pwfltr) ? sizeof(WAVEFILTER) : 0));
|
||||
if (was == NULL)
|
||||
return MMSYSERR_NOMEM;
|
||||
was->drvInst.cbStruct = sizeof(was->drvInst);
|
||||
was->drvInst.pwfxSrc = (PWAVEFORMATEX)(was + 1);
|
||||
memcpy(was->drvInst.pwfxSrc, pwfxSrc, wfxSrcSize);
|
||||
// LHACM is checking for 0x1
|
||||
// but if this will not help
|
||||
// was->drvInst.pwfxSrc->wFormatTag = 1;
|
||||
was->drvInst.pwfxDst = (PWAVEFORMATEX)((LPSTR)(was + 1) + wfxSrcSize);
|
||||
memcpy(was->drvInst.pwfxDst, pwfxDst, wfxDstSize);
|
||||
if (pwfltr) {
|
||||
was->drvInst.pwfltr = (PWAVEFILTER)((LPSTR)(was + 1) + wfxSrcSize + wfxDstSize);
|
||||
memcpy(was->drvInst.pwfltr, pwfltr, sizeof(WAVEFILTER));
|
||||
} else {
|
||||
was->drvInst.pwfltr = NULL;
|
||||
}
|
||||
was->drvInst.dwCallback = dwCallback;
|
||||
was->drvInst.dwInstance = dwInstance;
|
||||
was->drvInst.fdwOpen = fdwOpen;
|
||||
was->drvInst.fdwDriver = 0L;
|
||||
was->drvInst.dwDriver = 0L;
|
||||
was->drvInst.has = (HACMSTREAM)was;
|
||||
|
||||
if (had) {
|
||||
if (!(wad = MSACM_GetDriver(had))) {
|
||||
ret = MMSYSERR_INVALPARAM;
|
||||
goto errCleanUp;
|
||||
}
|
||||
|
||||
was->obj.pACMDriverID = wad->obj.pACMDriverID;
|
||||
was->pDrv = wad;
|
||||
was->hAcmDriver = 0; /* not to close it in acmStreamClose */
|
||||
|
||||
ret = SendDriverMessage(wad->hDrvr, ACMDM_STREAM_OPEN, (DWORD)&was->drvInst, 0L);
|
||||
if (ret != MMSYSERR_NOERROR)
|
||||
goto errCleanUp;
|
||||
} else {
|
||||
PWINE_ACMDRIVERID wadi;
|
||||
//short drv_tag;
|
||||
ret = ACMERR_NOTPOSSIBLE;
|
||||
/* if(pwfxSrc->wFormatTag==1)//compression
|
||||
drv_tag=pwfxDst->wFormatTag;
|
||||
else
|
||||
if(pwfxDst->wFormatTag==1)//decompression
|
||||
drv_tag=pwfxSrc->wFormatTag;
|
||||
else
|
||||
goto errCleanUp;
|
||||
|
||||
ret=acmDriverOpen2(drv_tag);
|
||||
if (ret == MMSYSERR_NOERROR) {
|
||||
if ((wad = MSACM_GetDriver(had)) != 0) {
|
||||
was->obj.pACMDriverID = wad->obj.pACMDriverID;
|
||||
was->pDrv = wad;
|
||||
was->hAcmDriver = had;
|
||||
|
||||
ret = SendDriverMessage(wad->hDrvr, ACMDM_STREAM_OPEN, (DWORD)&was->drvInst, 0L);
|
||||
if (ret == MMSYSERR_NOERROR) {
|
||||
if (fdwOpen & ACM_STREAMOPENF_QUERY) {
|
||||
acmDriverClose(had, 0L);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
acmDriverClose(had, 0L);*/
|
||||
//if(MSACM_pFirstACMDriverID==NULL)
|
||||
// MSACM_RegisterAllDrivers();
|
||||
|
||||
for (wadi = MSACM_pFirstACMDriverID; wadi; wadi = wadi->pNextACMDriverID)
|
||||
{
|
||||
/* Check Format */
|
||||
if ((int)wadi->wFormatTag != (int)pwfxSrc->wFormatTag) continue;
|
||||
|
||||
ret = acmDriverOpen(&had, (HACMDRIVERID)wadi, 0L);
|
||||
if (ret == MMSYSERR_NOERROR) {
|
||||
if ((wad = MSACM_GetDriver(had)) != 0) {
|
||||
was->obj.pACMDriverID = wad->obj.pACMDriverID;
|
||||
was->pDrv = wad;
|
||||
was->hAcmDriver = had;
|
||||
|
||||
ret = SendDriverMessage(wad->hDrvr, ACMDM_STREAM_OPEN, (DWORD)&was->drvInst, 0L);
|
||||
//lhacm - crash printf("RETOPEN %d\n", ret);
|
||||
//ret = 0;
|
||||
if (ret == MMSYSERR_NOERROR) {
|
||||
if (fdwOpen & ACM_STREAMOPENF_QUERY) {
|
||||
acmDriverClose(had, 0L);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
// no match, close this acm driver and try next one
|
||||
acmDriverClose(had, 0L);
|
||||
}
|
||||
}
|
||||
if (ret != MMSYSERR_NOERROR) {
|
||||
ret = ACMERR_NOTPOSSIBLE;
|
||||
goto errCleanUp;
|
||||
}
|
||||
}
|
||||
ret = MMSYSERR_NOERROR;
|
||||
if (!(fdwOpen & ACM_STREAMOPENF_QUERY)) {
|
||||
if (phas)
|
||||
*phas = (HACMSTREAM)was;
|
||||
TRACE("=> (%d)\n", ret);
|
||||
#ifdef WIN32_LOADER
|
||||
CodecAlloc();
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
errCleanUp:
|
||||
if (phas)
|
||||
*phas = (HACMSTREAM)0;
|
||||
HeapFree(MSACM_hHeap, 0, was);
|
||||
TRACE("=> (%d)\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
MMRESULT WINAPI acmStreamClose(HACMSTREAM has, DWORD fdwClose)
|
||||
{
|
||||
PWINE_ACMSTREAM was;
|
||||
MMRESULT ret;
|
||||
|
||||
TRACE("(0x%08x, %ld)\n", has, fdwClose);
|
||||
|
||||
if ((was = ACM_GetStream(has)) == NULL) {
|
||||
return MMSYSERR_INVALHANDLE;
|
||||
}
|
||||
ret = SendDriverMessage(was->pDrv->hDrvr, ACMDM_STREAM_CLOSE, (DWORD)&was->drvInst, 0);
|
||||
if (ret == MMSYSERR_NOERROR) {
|
||||
if (was->hAcmDriver)
|
||||
acmDriverClose(was->hAcmDriver, 0L);
|
||||
HeapFree(MSACM_hHeap, 0, was);
|
||||
#ifdef WIN32_LOADER
|
||||
CodecRelease();
|
||||
#endif
|
||||
}
|
||||
TRACE("=> (%d)\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* acmStreamConvert (MSACM32.38)
|
||||
*/
|
||||
MMRESULT WINAPI acmStreamConvert(HACMSTREAM has, PACMSTREAMHEADER pash,
|
||||
DWORD fdwConvert)
|
||||
{
|
||||
PWINE_ACMSTREAM was;
|
||||
MMRESULT ret = MMSYSERR_NOERROR;
|
||||
PACMDRVSTREAMHEADER padsh;
|
||||
|
||||
TRACE("(0x%08x, %p, %ld)\n", has, pash, fdwConvert);
|
||||
|
||||
if ((was = ACM_GetStream(has)) == NULL)
|
||||
return MMSYSERR_INVALHANDLE;
|
||||
if (!pash || pash->cbStruct < sizeof(ACMSTREAMHEADER))
|
||||
return MMSYSERR_INVALPARAM;
|
||||
|
||||
if (!(pash->fdwStatus & ACMSTREAMHEADER_STATUSF_PREPARED))
|
||||
return ACMERR_UNPREPARED;
|
||||
|
||||
/* Note: the ACMSTREAMHEADER and ACMDRVSTREAMHEADER structs are of same
|
||||
* size. some fields are private to msacm internals, and are exposed
|
||||
* in ACMSTREAMHEADER in the dwReservedDriver array
|
||||
*/
|
||||
padsh = (PACMDRVSTREAMHEADER)pash;
|
||||
|
||||
/* check that pointers have not been modified */
|
||||
if (padsh->pbPreparedSrc != padsh->pbSrc ||
|
||||
padsh->cbPreparedSrcLength < padsh->cbSrcLength ||
|
||||
padsh->pbPreparedDst != padsh->pbDst ||
|
||||
padsh->cbPreparedDstLength < padsh->cbDstLength) {
|
||||
return MMSYSERR_INVALPARAM;
|
||||
}
|
||||
|
||||
padsh->fdwConvert = fdwConvert;
|
||||
|
||||
ret = SendDriverMessage(was->pDrv->hDrvr, ACMDM_STREAM_CONVERT, (DWORD)&was->drvInst, (DWORD)padsh);
|
||||
if (ret == MMSYSERR_NOERROR) {
|
||||
padsh->fdwStatus |= ACMSTREAMHEADER_STATUSF_DONE;
|
||||
}
|
||||
TRACE("=> (%d)\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* acmStreamPrepareHeader (MSACM32.41)
|
||||
*/
|
||||
MMRESULT WINAPI acmStreamPrepareHeader(HACMSTREAM has, PACMSTREAMHEADER pash,
|
||||
DWORD fdwPrepare)
|
||||
{
|
||||
PWINE_ACMSTREAM was;
|
||||
MMRESULT ret = MMSYSERR_NOERROR;
|
||||
PACMDRVSTREAMHEADER padsh;
|
||||
|
||||
TRACE("(0x%08x, %p, %ld)\n", has, pash, fdwPrepare);
|
||||
|
||||
if ((was = ACM_GetStream(has)) == NULL)
|
||||
return MMSYSERR_INVALHANDLE;
|
||||
if (!pash || pash->cbStruct < sizeof(ACMSTREAMHEADER))
|
||||
return MMSYSERR_INVALPARAM;
|
||||
if (fdwPrepare)
|
||||
ret = MMSYSERR_INVALFLAG;
|
||||
|
||||
if (pash->fdwStatus & ACMSTREAMHEADER_STATUSF_DONE)
|
||||
return MMSYSERR_NOERROR;
|
||||
|
||||
/* Note: the ACMSTREAMHEADER and ACMDRVSTREAMHEADER structs are of same
|
||||
* size. some fields are private to msacm internals, and are exposed
|
||||
* in ACMSTREAMHEADER in the dwReservedDriver array
|
||||
*/
|
||||
padsh = (PACMDRVSTREAMHEADER)pash;
|
||||
|
||||
padsh->fdwConvert = fdwPrepare;
|
||||
padsh->padshNext = NULL;
|
||||
padsh->fdwDriver = padsh->dwDriver = 0L;
|
||||
|
||||
padsh->fdwPrepared = 0;
|
||||
padsh->dwPrepared = 0;
|
||||
padsh->pbPreparedSrc = 0;
|
||||
padsh->cbPreparedSrcLength = 0;
|
||||
padsh->pbPreparedDst = 0;
|
||||
padsh->cbPreparedDstLength = 0;
|
||||
|
||||
ret = SendDriverMessage(was->pDrv->hDrvr, ACMDM_STREAM_PREPARE, (DWORD)&was->drvInst, (DWORD)padsh);
|
||||
if (ret == MMSYSERR_NOERROR || ret == MMSYSERR_NOTSUPPORTED) {
|
||||
ret = MMSYSERR_NOERROR;
|
||||
padsh->fdwStatus &= ~(ACMSTREAMHEADER_STATUSF_DONE|ACMSTREAMHEADER_STATUSF_INQUEUE);
|
||||
padsh->fdwStatus |= ACMSTREAMHEADER_STATUSF_PREPARED;
|
||||
padsh->fdwPrepared = padsh->fdwStatus;
|
||||
padsh->dwPrepared = 0;
|
||||
padsh->pbPreparedSrc = padsh->pbSrc;
|
||||
padsh->cbPreparedSrcLength = padsh->cbSrcLength;
|
||||
padsh->pbPreparedDst = padsh->pbDst;
|
||||
padsh->cbPreparedDstLength = padsh->cbDstLength;
|
||||
} else {
|
||||
padsh->fdwPrepared = 0;
|
||||
padsh->dwPrepared = 0;
|
||||
padsh->pbPreparedSrc = 0;
|
||||
padsh->cbPreparedSrcLength = 0;
|
||||
padsh->pbPreparedDst = 0;
|
||||
padsh->cbPreparedDstLength = 0;
|
||||
}
|
||||
TRACE("=> (%d)\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* acmStreamReset (MSACM32.42)
|
||||
*/
|
||||
MMRESULT WINAPI acmStreamReset(HACMSTREAM has, DWORD fdwReset)
|
||||
{
|
||||
PWINE_ACMSTREAM was;
|
||||
MMRESULT ret = MMSYSERR_NOERROR;
|
||||
|
||||
TRACE("(0x%08x, %ld)\n", has, fdwReset);
|
||||
|
||||
if (fdwReset) {
|
||||
ret = MMSYSERR_INVALFLAG;
|
||||
} else if ((was = ACM_GetStream(has)) == NULL) {
|
||||
return MMSYSERR_INVALHANDLE;
|
||||
} else if (was->drvInst.fdwOpen & ACM_STREAMOPENF_ASYNC) {
|
||||
ret = SendDriverMessage(was->pDrv->hDrvr, ACMDM_STREAM_RESET, (DWORD)&was->drvInst, 0);
|
||||
}
|
||||
TRACE("=> (%d)\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* acmStreamSize (MSACM32.43)
|
||||
*/
|
||||
MMRESULT WINAPI acmStreamSize(HACMSTREAM has, DWORD cbInput,
|
||||
LPDWORD pdwOutputBytes, DWORD fdwSize)
|
||||
{
|
||||
PWINE_ACMSTREAM was;
|
||||
ACMDRVSTREAMSIZE adss;
|
||||
MMRESULT ret;
|
||||
|
||||
TRACE("(0x%08x, %ld, %p, %ld)\n", has, cbInput, pdwOutputBytes, fdwSize);
|
||||
|
||||
if ((was = ACM_GetStream(has)) == NULL) {
|
||||
return MMSYSERR_INVALHANDLE;
|
||||
}
|
||||
if ((fdwSize & ~ACM_STREAMSIZEF_QUERYMASK) != 0) {
|
||||
return MMSYSERR_INVALFLAG;
|
||||
}
|
||||
|
||||
*pdwOutputBytes = 0L;
|
||||
|
||||
switch (fdwSize & ACM_STREAMSIZEF_QUERYMASK) {
|
||||
case ACM_STREAMSIZEF_DESTINATION:
|
||||
adss.cbDstLength = cbInput;
|
||||
adss.cbSrcLength = 0;
|
||||
break;
|
||||
case ACM_STREAMSIZEF_SOURCE:
|
||||
adss.cbSrcLength = cbInput;
|
||||
adss.cbDstLength = 0;
|
||||
break;
|
||||
default:
|
||||
return MMSYSERR_INVALFLAG;
|
||||
}
|
||||
|
||||
adss.cbStruct = sizeof(adss);
|
||||
adss.fdwSize = fdwSize;
|
||||
ret = SendDriverMessage(was->pDrv->hDrvr, ACMDM_STREAM_SIZE,
|
||||
(DWORD)&was->drvInst, (DWORD)&adss);
|
||||
if (ret == MMSYSERR_NOERROR) {
|
||||
switch (fdwSize & ACM_STREAMSIZEF_QUERYMASK) {
|
||||
case ACM_STREAMSIZEF_DESTINATION:
|
||||
*pdwOutputBytes = adss.cbSrcLength;
|
||||
break;
|
||||
case ACM_STREAMSIZEF_SOURCE:
|
||||
*pdwOutputBytes = adss.cbDstLength;
|
||||
break;
|
||||
}
|
||||
}
|
||||
TRACE("=> (%d) [%lu]\n", ret, *pdwOutputBytes);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* acmStreamUnprepareHeader (MSACM32.44)
|
||||
*/
|
||||
MMRESULT WINAPI acmStreamUnprepareHeader(HACMSTREAM has, PACMSTREAMHEADER pash,
|
||||
DWORD fdwUnprepare)
|
||||
{
|
||||
PWINE_ACMSTREAM was;
|
||||
MMRESULT ret = MMSYSERR_NOERROR;
|
||||
PACMDRVSTREAMHEADER padsh;
|
||||
|
||||
TRACE("(0x%08x, %p, %ld)\n", has, pash, fdwUnprepare);
|
||||
|
||||
if ((was = ACM_GetStream(has)) == NULL)
|
||||
return MMSYSERR_INVALHANDLE;
|
||||
if (!pash || pash->cbStruct < sizeof(ACMSTREAMHEADER))
|
||||
return MMSYSERR_INVALPARAM;
|
||||
|
||||
if (!(pash->fdwStatus & ACMSTREAMHEADER_STATUSF_PREPARED))
|
||||
return ACMERR_UNPREPARED;
|
||||
|
||||
/* Note: the ACMSTREAMHEADER and ACMDRVSTREAMHEADER structs are of same
|
||||
* size. some fields are private to msacm internals, and are exposed
|
||||
* in ACMSTREAMHEADER in the dwReservedDriver array
|
||||
*/
|
||||
padsh = (PACMDRVSTREAMHEADER)pash;
|
||||
|
||||
/* check that pointers have not been modified */
|
||||
if (padsh->pbPreparedSrc != padsh->pbSrc ||
|
||||
padsh->cbPreparedSrcLength < padsh->cbSrcLength ||
|
||||
padsh->pbPreparedDst != padsh->pbDst ||
|
||||
padsh->cbPreparedDstLength < padsh->cbDstLength) {
|
||||
return MMSYSERR_INVALPARAM;
|
||||
}
|
||||
|
||||
padsh->fdwConvert = fdwUnprepare;
|
||||
|
||||
ret = SendDriverMessage(was->pDrv->hDrvr, ACMDM_STREAM_UNPREPARE, (DWORD)&was->drvInst, (DWORD)padsh);
|
||||
if (ret == MMSYSERR_NOERROR || ret == MMSYSERR_NOTSUPPORTED) {
|
||||
ret = MMSYSERR_NOERROR;
|
||||
padsh->fdwStatus &= ~(ACMSTREAMHEADER_STATUSF_DONE|ACMSTREAMHEADER_STATUSF_INQUEUE|ACMSTREAMHEADER_STATUSF_PREPARED);
|
||||
}
|
||||
TRACE("=> (%d)\n", ret);
|
||||
return ret;
|
||||
}
|
||||
@@ -1,82 +0,0 @@
|
||||
/*
|
||||
* Modified for use with MPlayer, detailed changelog at
|
||||
* http://svn.mplayerhq.hu/mplayer/trunk/
|
||||
*/
|
||||
|
||||
#ifndef MPLAYER_COM_H
|
||||
#define MPLAYER_COM_H
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#ifdef HAVE_STDINT_H
|
||||
#include <stdint.h>
|
||||
#else
|
||||
#include <inttypes.h>
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Internal functions and structures for COM emulation code.
|
||||
*/
|
||||
|
||||
#ifndef GUID_TYPE
|
||||
#define GUID_TYPE
|
||||
typedef struct
|
||||
{
|
||||
uint32_t f1;
|
||||
uint16_t f2;
|
||||
uint16_t f3;
|
||||
uint8_t f4[8];
|
||||
} GUID;
|
||||
#endif
|
||||
|
||||
extern const GUID IID_IUnknown;
|
||||
extern const GUID IID_IClassFactory;
|
||||
|
||||
typedef long (*GETCLASSOBJECT) (GUID* clsid, const GUID* iid, void** ppv);
|
||||
int RegisterComClass(const GUID* clsid, GETCLASSOBJECT gcs);
|
||||
int UnregisterComClass(const GUID* clsid, GETCLASSOBJECT gcs);
|
||||
|
||||
#ifndef STDCALL
|
||||
#define STDCALL __attribute__((__stdcall__))
|
||||
#endif
|
||||
|
||||
struct IUnknown;
|
||||
struct IClassFactory;
|
||||
struct IUnknown_vt
|
||||
{
|
||||
long STDCALL (*QueryInterface)(struct IUnknown* this, const GUID* iid, void** ppv);
|
||||
long STDCALL (*AddRef)(struct IUnknown* this) ;
|
||||
long STDCALL (*Release)(struct IUnknown* this) ;
|
||||
} ;
|
||||
|
||||
typedef struct IUnknown
|
||||
{
|
||||
struct IUnknown_vt* vt;
|
||||
} IUnknown;
|
||||
|
||||
struct IClassFactory_vt
|
||||
{
|
||||
long STDCALL (*QueryInterface)(struct IUnknown* this, const GUID* iid, void** ppv);
|
||||
long STDCALL (*AddRef)(struct IUnknown* this) ;
|
||||
long STDCALL (*Release)(struct IUnknown* this) ;
|
||||
long STDCALL (*CreateInstance)(struct IClassFactory* this, struct IUnknown* pUnkOuter, const GUID* riid, void** ppvObject);
|
||||
};
|
||||
|
||||
struct IClassFactory
|
||||
{
|
||||
struct IClassFactory_vt* vt;
|
||||
};
|
||||
|
||||
#ifdef WIN32_LOADER
|
||||
long CoCreateInstance(GUID* rclsid, struct IUnknown* pUnkOuter,
|
||||
long dwClsContext, const GUID* riid, void** ppv);
|
||||
void* CoTaskMemAlloc(unsigned long cb);
|
||||
void CoTaskMemFree(void* cb);
|
||||
#else
|
||||
long STDCALL CoCreateInstance(GUID* rclsid, struct IUnknown* pUnkOuter,
|
||||
long dwClsContext, const GUID* riid, void** ppv);
|
||||
void* STDCALL CoTaskMemAlloc(unsigned long);
|
||||
void STDCALL CoTaskMemFree(void*);
|
||||
#endif
|
||||
|
||||
#endif /* MPLAYER_COM_H */
|
||||
@@ -1,12 +0,0 @@
|
||||
#ifndef MPLAYER_DEBUG_H
|
||||
#define MPLAYER_DEBUG_H
|
||||
|
||||
#ifdef DEBUG
|
||||
#define TRACE printf
|
||||
#define dbg_printf printf
|
||||
#else
|
||||
#define TRACE(...)
|
||||
#define dbg_printf(...)
|
||||
#endif
|
||||
|
||||
#endif /* MPLAYER_DEBUG_H */
|
||||
@@ -1,171 +0,0 @@
|
||||
/********************************************************
|
||||
|
||||
DirectShow audio decoder
|
||||
Copyright 2001 Eugene Kuznetsov (divx@euro.ru)
|
||||
|
||||
*********************************************************/
|
||||
#include "config.h"
|
||||
#include "loader/dshow/libwin32.h"
|
||||
#ifdef WIN32_LOADER
|
||||
#include "loader/ldt_keeper.h"
|
||||
#endif
|
||||
|
||||
#include "DMO_Filter.h"
|
||||
#include "DMO_AudioDecoder.h"
|
||||
|
||||
struct DMO_AudioDecoder
|
||||
{
|
||||
DMO_MEDIA_TYPE m_sOurType, m_sDestType;
|
||||
DMO_Filter* m_pDMO_Filter;
|
||||
char* m_sVhdr;
|
||||
char* m_sVhdr2;
|
||||
int m_iFlushed;
|
||||
};
|
||||
|
||||
#include "DMO_AudioDecoder.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "mp_msg.h"
|
||||
#include "libmpdemux/aviprint.h"
|
||||
|
||||
typedef long STDCALL (*GETCLASS) (GUID*, GUID*, void**);
|
||||
|
||||
DMO_AudioDecoder * DMO_AudioDecoder_Open(char* dllname, GUID* guid, WAVEFORMATEX* wf,int out_channels)
|
||||
//DMO_AudioDecoder * DMO_AudioDecoder_Create(const CodecInfo * info, const WAVEFORMATEX* wf)
|
||||
{
|
||||
DMO_AudioDecoder *this;
|
||||
int sz;
|
||||
WAVEFORMATEX* pWF;
|
||||
|
||||
#ifdef WIN32_LOADER
|
||||
Setup_LDT_Keeper();
|
||||
Setup_FS_Segment();
|
||||
#endif
|
||||
|
||||
this = malloc(sizeof(DMO_AudioDecoder));
|
||||
|
||||
this->m_iFlushed=1;
|
||||
|
||||
sz = 18 + wf->cbSize;
|
||||
this->m_sVhdr = malloc(sz);
|
||||
memcpy(this->m_sVhdr, wf, sz);
|
||||
this->m_sVhdr2 = malloc(18);
|
||||
memcpy(this->m_sVhdr2, this->m_sVhdr, 18);
|
||||
|
||||
pWF = (WAVEFORMATEX*)this->m_sVhdr2;
|
||||
pWF->wFormatTag = 1;
|
||||
pWF->wBitsPerSample = 16;
|
||||
pWF->nChannels = out_channels;
|
||||
pWF->nBlockAlign = 2*pWF->nChannels; //pWF->nChannels * (pWF->wBitsPerSample + 7) / 8;
|
||||
pWF->nAvgBytesPerSec = pWF->nBlockAlign * pWF->nSamplesPerSec;
|
||||
pWF->cbSize = 0;
|
||||
|
||||
memset(&this->m_sOurType, 0, sizeof(this->m_sOurType));
|
||||
this->m_sOurType.majortype=MEDIATYPE_Audio;
|
||||
this->m_sOurType.subtype=MEDIASUBTYPE_PCM;
|
||||
this->m_sOurType.subtype.f1=wf->wFormatTag;
|
||||
this->m_sOurType.formattype=FORMAT_WaveFormatEx;
|
||||
this->m_sOurType.lSampleSize=wf->nBlockAlign;
|
||||
this->m_sOurType.bFixedSizeSamples=1;
|
||||
this->m_sOurType.bTemporalCompression=0;
|
||||
this->m_sOurType.cbFormat=sz;
|
||||
this->m_sOurType.pbFormat=this->m_sVhdr;
|
||||
|
||||
memset(&this->m_sDestType, 0, sizeof(this->m_sDestType));
|
||||
this->m_sDestType.majortype=MEDIATYPE_Audio;
|
||||
this->m_sDestType.subtype=MEDIASUBTYPE_PCM;
|
||||
this->m_sDestType.formattype=FORMAT_WaveFormatEx;
|
||||
this->m_sDestType.bFixedSizeSamples=1;
|
||||
this->m_sDestType.bTemporalCompression=0;
|
||||
this->m_sDestType.lSampleSize=pWF->nBlockAlign;
|
||||
this->m_sDestType.cbFormat=18; //pWF->cbSize;
|
||||
this->m_sDestType.pbFormat=this->m_sVhdr2;
|
||||
|
||||
print_wave_header((WAVEFORMATEX *)this->m_sVhdr, MSGL_V);
|
||||
print_wave_header((WAVEFORMATEX *)this->m_sVhdr2, MSGL_V);
|
||||
|
||||
this->m_pDMO_Filter = DMO_FilterCreate(dllname, guid, &this->m_sOurType, &this->m_sDestType);
|
||||
if( !this->m_pDMO_Filter ) {
|
||||
free(this);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
void DMO_AudioDecoder_Destroy(DMO_AudioDecoder *this)
|
||||
{
|
||||
free(this->m_sVhdr);
|
||||
free(this->m_sVhdr2);
|
||||
DMO_Filter_Destroy(this->m_pDMO_Filter);
|
||||
free(this);
|
||||
}
|
||||
|
||||
int DMO_AudioDecoder_Convert(DMO_AudioDecoder *this, const void* in_data, unsigned int in_size,
|
||||
void* out_data, unsigned int out_size,
|
||||
unsigned int* size_read, unsigned int* size_written)
|
||||
{
|
||||
DMO_OUTPUT_DATA_BUFFER db;
|
||||
CMediaBuffer* bufferin;
|
||||
unsigned long written = 0;
|
||||
unsigned long read = 0;
|
||||
int r = 0;
|
||||
|
||||
if (!in_data || !out_data)
|
||||
return -1;
|
||||
|
||||
#ifdef WIN32_LOADER
|
||||
Setup_FS_Segment();
|
||||
#endif
|
||||
|
||||
//m_pDMO_Filter->m_pMedia->vt->Lock(m_pDMO_Filter->m_pMedia, 1);
|
||||
bufferin = CMediaBufferCreate(in_size, (void*)in_data, in_size, 1);
|
||||
r = this->m_pDMO_Filter->m_pMedia->vt->ProcessInput(this->m_pDMO_Filter->m_pMedia, 0,
|
||||
(IMediaBuffer*)bufferin,
|
||||
(this->m_iFlushed) ? DMO_INPUT_DATA_BUFFERF_SYNCPOINT : 0,
|
||||
0, 0);
|
||||
if (r == 0){
|
||||
((IMediaBuffer*)bufferin)->vt->GetBufferAndLength((IMediaBuffer*)bufferin, 0, &read);
|
||||
this->m_iFlushed = 0;
|
||||
}
|
||||
|
||||
((IMediaBuffer*)bufferin)->vt->Release((IUnknown*)bufferin);
|
||||
|
||||
//printf("RESULTA: %d 0x%x %ld %d %d\n", r, r, read, m_iFlushed, out_size);
|
||||
if (r == 0 || (unsigned)r == DMO_E_NOTACCEPTING){
|
||||
unsigned long status = 0;
|
||||
/* something for process */
|
||||
db.rtTimestamp = 0;
|
||||
db.rtTimelength = 0;
|
||||
db.dwStatus = 0;
|
||||
db.pBuffer = (IMediaBuffer*) CMediaBufferCreate(out_size, out_data, 0, 0);
|
||||
//printf("OUTSIZE %d\n", out_size);
|
||||
r = this->m_pDMO_Filter->m_pMedia->vt->ProcessOutput(this->m_pDMO_Filter->m_pMedia,
|
||||
0, 1, &db, &status);
|
||||
|
||||
((IMediaBuffer*)db.pBuffer)->vt->GetBufferAndLength((IMediaBuffer*)db.pBuffer, 0, &written);
|
||||
((IMediaBuffer*)db.pBuffer)->vt->Release((IUnknown*)db.pBuffer);
|
||||
|
||||
//printf("RESULTB: %d 0x%x %ld\n", r, r, written);
|
||||
//printf("Converted %d -> %d\n", in_size, out_size);
|
||||
}
|
||||
else if (in_size > 0)
|
||||
printf("ProcessInputError r:0x%x=%d\n", r, r);
|
||||
|
||||
if (size_read)
|
||||
*size_read = read;
|
||||
if (size_written)
|
||||
*size_written = written;
|
||||
return r;
|
||||
}
|
||||
|
||||
int DMO_AudioDecoder_GetSrcSize(DMO_AudioDecoder *this, int dest_size)
|
||||
{
|
||||
// unsigned long inputs, outputs;
|
||||
// Setup_FS_Segment();
|
||||
// this->m_pDMO_Filter->m_pMedia->vt->GetOutputSizeInfo(this->m_pDMO_Filter->m_pMedia, 0, &inputs, &outputs);
|
||||
return ((WAVEFORMATEX*)this->m_sVhdr)->nBlockAlign*4;
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
#ifndef MPLAYER_DMO_AUDIODECODER_H
|
||||
#define MPLAYER_DMO_AUDIODECODER_H
|
||||
|
||||
#include "loader/com.h"
|
||||
#include "loader/wine/mmreg.h"
|
||||
|
||||
typedef struct DMO_AudioDecoder DMO_AudioDecoder;
|
||||
|
||||
//DMO_AudioDecoder * DMO_AudioDecoder_Create(const CodecInfo * info, const WAVEFORMATEX* wf);
|
||||
DMO_AudioDecoder * DMO_AudioDecoder_Open(char* dllname, GUID* guid, WAVEFORMATEX* wf,int out_channels);
|
||||
|
||||
void DMO_AudioDecoder_Destroy(DMO_AudioDecoder *this);
|
||||
|
||||
int DMO_AudioDecoder_Convert(DMO_AudioDecoder *this, const void* in_data, unsigned int in_size,
|
||||
void* out_data, unsigned int out_size,
|
||||
unsigned int* size_read, unsigned int* size_written);
|
||||
|
||||
int DMO_AudioDecoder_GetSrcSize(DMO_AudioDecoder *this, int dest_size);
|
||||
|
||||
#endif /* MPLAYER_DMO_AUDIODECODER_H */
|
||||
@@ -1,39 +0,0 @@
|
||||
#ifndef MPLAYER_DMO_FILTER_H
|
||||
#define MPLAYER_DMO_FILTER_H
|
||||
|
||||
#include "dmo_guids.h"
|
||||
#include "dmo_interfaces.h"
|
||||
|
||||
typedef struct DMO_Filter
|
||||
{
|
||||
int m_iHandle;
|
||||
IDMOVideoOutputOptimizations* m_pOptim;
|
||||
IMediaObject* m_pMedia;
|
||||
IMediaObjectInPlace* m_pInPlace;
|
||||
AM_MEDIA_TYPE *m_pOurType, *m_pDestType;
|
||||
} DMO_Filter;
|
||||
|
||||
typedef struct CMediaBuffer CMediaBuffer;
|
||||
|
||||
/**
|
||||
* Create DMO_Filter object - similar syntax as for DS_Filter
|
||||
*/
|
||||
DMO_Filter* DMO_FilterCreate(const char* dllname, const GUID* id,
|
||||
AM_MEDIA_TYPE* in_fmt, AM_MEDIA_TYPE* out_fmt);
|
||||
/**
|
||||
* Destroy DMO_Filter object - release all allocated resources
|
||||
*/
|
||||
void DMO_Filter_Destroy(DMO_Filter* This);
|
||||
|
||||
|
||||
/**
|
||||
* Create IMediaBuffer object - to pass/receive data from DMO_Filter
|
||||
*
|
||||
* maxlen - maximum size for this buffer
|
||||
* mem - initial memory 0 - creates memory
|
||||
* len - initial size of used portion of the buffer
|
||||
* copy - make a local copy of data
|
||||
*/
|
||||
CMediaBuffer* CMediaBufferCreate(unsigned long maxlen, void* mem, unsigned long len, int copy);
|
||||
|
||||
#endif /* MPLAYER_DMO_FILTER_H */
|
||||
@@ -1,555 +0,0 @@
|
||||
/********************************************************
|
||||
|
||||
DirectShow Video decoder implementation
|
||||
Copyright 2000 Eugene Kuznetsov (divx@euro.ru)
|
||||
|
||||
*********************************************************/
|
||||
#include "config.h"
|
||||
#include "loader/dshow/guids.h"
|
||||
#include "loader/dshow/interfaces.h"
|
||||
#include "loader/registry.h"
|
||||
#ifdef WIN32_LOADER
|
||||
#include "loader/ldt_keeper.h"
|
||||
#endif
|
||||
|
||||
#include "loader/dshow/libwin32.h"
|
||||
#include "DMO_Filter.h"
|
||||
|
||||
#include "DMO_VideoDecoder.h"
|
||||
|
||||
struct DMO_VideoDecoder
|
||||
{
|
||||
IVideoDecoder iv;
|
||||
|
||||
DMO_Filter* m_pDMO_Filter;
|
||||
AM_MEDIA_TYPE m_sOurType, m_sDestType;
|
||||
VIDEOINFOHEADER* m_sVhdr;
|
||||
VIDEOINFOHEADER* m_sVhdr2;
|
||||
int m_Caps;//CAPS m_Caps; // capabilities of DirectShow decoder
|
||||
int m_iLastQuality; // remember last quality as integer
|
||||
int m_iMinBuffers;
|
||||
int m_iMaxAuto;
|
||||
};
|
||||
|
||||
//#include "DMO_VideoDecoder.h"
|
||||
|
||||
#include "loader/wine/winerror.h"
|
||||
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#ifdef HAVE_SYS_MMAN_H
|
||||
#include <sys/mman.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h> // labs
|
||||
|
||||
// strcmp((const char*)info.dll,...) is used instead of (... == ...)
|
||||
// so Arpi could use char* pointer in his simplified DMO_VideoDecoder class
|
||||
|
||||
#define false 0
|
||||
#define true 1
|
||||
|
||||
|
||||
//int DMO_VideoDecoder_GetCapabilities(DMO_VideoDecoder *this){return this->m_Caps;}
|
||||
|
||||
typedef struct ct ct;
|
||||
|
||||
struct ct {
|
||||
fourcc_t fcc;
|
||||
unsigned int bits;
|
||||
const GUID* subtype;
|
||||
int cap;
|
||||
char *name;
|
||||
};
|
||||
|
||||
static ct check[] = {
|
||||
{ fccI420, 12, &MEDIASUBTYPE_I420, CAP_I420, NULL },
|
||||
{ fccYV12, 12, &MEDIASUBTYPE_YV12, CAP_YV12, NULL },
|
||||
{ fccYUY2, 16, &MEDIASUBTYPE_YUY2, CAP_YUY2, NULL },
|
||||
{ fccUYVY, 16, &MEDIASUBTYPE_UYVY, CAP_UYVY, NULL },
|
||||
{ fccYVYU, 16, &MEDIASUBTYPE_YVYU, CAP_YVYU, NULL },
|
||||
{ fccIYUV, 24, &MEDIASUBTYPE_IYUV, CAP_IYUV, NULL },
|
||||
|
||||
{ 8, 8, &MEDIASUBTYPE_RGB8, CAP_NONE, "RGB8" },
|
||||
{ 15, 16, &MEDIASUBTYPE_RGB555, CAP_NONE, "RGB555" },
|
||||
{ 16, 16, &MEDIASUBTYPE_RGB565, CAP_NONE, "RGB565" },
|
||||
{ 24, 24, &MEDIASUBTYPE_RGB24, CAP_NONE, "RGB24" },
|
||||
{ 32, 32, &MEDIASUBTYPE_RGB32, CAP_NONE, "RGB32" },
|
||||
|
||||
{0,0,NULL,0},
|
||||
};
|
||||
|
||||
DMO_VideoDecoder * DMO_VideoDecoder_Open(char* dllname, GUID* guid, BITMAPINFOHEADER * format, int flip, int maxauto)
|
||||
{
|
||||
DMO_VideoDecoder *this;
|
||||
HRESULT result;
|
||||
ct* c;
|
||||
|
||||
this = malloc(sizeof(DMO_VideoDecoder));
|
||||
memset( this, 0, sizeof(DMO_VideoDecoder));
|
||||
|
||||
this->m_sVhdr2 = 0;
|
||||
this->m_iLastQuality = -1;
|
||||
this->m_iMaxAuto = maxauto;
|
||||
|
||||
#ifdef WIN32_LOADER
|
||||
Setup_LDT_Keeper();
|
||||
#endif
|
||||
|
||||
//memset(&m_obh, 0, sizeof(m_obh));
|
||||
//m_obh.biSize = sizeof(m_obh);
|
||||
/*try*/
|
||||
{
|
||||
unsigned int bihs;
|
||||
|
||||
bihs = (format->biSize < (int) sizeof(BITMAPINFOHEADER)) ?
|
||||
sizeof(BITMAPINFOHEADER) : format->biSize;
|
||||
|
||||
this->iv.m_bh = malloc(bihs);
|
||||
memcpy(this->iv.m_bh, format, bihs);
|
||||
this->iv.m_bh->biSize = bihs;
|
||||
|
||||
this->iv.m_State = STOP;
|
||||
//this->iv.m_pFrame = 0;
|
||||
this->iv.m_Mode = DIRECT;
|
||||
this->iv.m_iDecpos = 0;
|
||||
this->iv.m_iPlaypos = -1;
|
||||
this->iv.m_fQuality = 0.0f;
|
||||
this->iv.m_bCapable16b = true;
|
||||
|
||||
bihs += sizeof(VIDEOINFOHEADER) - sizeof(BITMAPINFOHEADER);
|
||||
this->m_sVhdr = malloc(bihs);
|
||||
memset(this->m_sVhdr, 0, bihs);
|
||||
memcpy(&this->m_sVhdr->bmiHeader, this->iv.m_bh, this->iv.m_bh->biSize);
|
||||
this->m_sVhdr->rcSource.left = this->m_sVhdr->rcSource.top = 0;
|
||||
this->m_sVhdr->rcSource.right = this->m_sVhdr->bmiHeader.biWidth;
|
||||
this->m_sVhdr->rcSource.bottom = this->m_sVhdr->bmiHeader.biHeight;
|
||||
//this->m_sVhdr->rcSource.right = 0;
|
||||
//this->m_sVhdr->rcSource.bottom = 0;
|
||||
this->m_sVhdr->rcTarget = this->m_sVhdr->rcSource;
|
||||
|
||||
this->m_sOurType.majortype = MEDIATYPE_Video;
|
||||
this->m_sOurType.subtype = MEDIATYPE_Video;
|
||||
this->m_sOurType.subtype.f1 = this->m_sVhdr->bmiHeader.biCompression;
|
||||
this->m_sOurType.formattype = FORMAT_VideoInfo;
|
||||
this->m_sOurType.bFixedSizeSamples = false;
|
||||
this->m_sOurType.bTemporalCompression = true;
|
||||
this->m_sOurType.pUnk = 0;
|
||||
this->m_sOurType.cbFormat = bihs;
|
||||
this->m_sOurType.pbFormat = (char*)this->m_sVhdr;
|
||||
|
||||
this->m_sVhdr2 = (VIDEOINFOHEADER*)(malloc(sizeof(VIDEOINFOHEADER)+12));
|
||||
memcpy(this->m_sVhdr2, this->m_sVhdr, sizeof(VIDEOINFOHEADER));
|
||||
memset((char*)this->m_sVhdr2 + sizeof(VIDEOINFOHEADER), 0, 12);
|
||||
this->m_sVhdr2->bmiHeader.biCompression = 0;
|
||||
this->m_sVhdr2->bmiHeader.biBitCount = 24;
|
||||
|
||||
// memset((char*)this->m_sVhdr2, 0, sizeof(VIDEOINFOHEADER)+12);
|
||||
this->m_sVhdr2->rcTarget = this->m_sVhdr->rcTarget;
|
||||
// this->m_sVhdr2->rcSource = this->m_sVhdr->rcSource;
|
||||
|
||||
memset(&this->m_sDestType, 0, sizeof(this->m_sDestType));
|
||||
this->m_sDestType.majortype = MEDIATYPE_Video;
|
||||
this->m_sDestType.subtype = MEDIASUBTYPE_RGB24;
|
||||
this->m_sDestType.formattype = FORMAT_VideoInfo;
|
||||
this->m_sDestType.bFixedSizeSamples = true;
|
||||
this->m_sDestType.bTemporalCompression = false;
|
||||
this->m_sDestType.lSampleSize = labs(this->m_sVhdr2->bmiHeader.biWidth*this->m_sVhdr2->bmiHeader.biHeight
|
||||
* ((this->m_sVhdr2->bmiHeader.biBitCount + 7) / 8));
|
||||
this->m_sVhdr2->bmiHeader.biSizeImage = this->m_sDestType.lSampleSize;
|
||||
this->m_sDestType.pUnk = 0;
|
||||
this->m_sDestType.cbFormat = sizeof(VIDEOINFOHEADER);
|
||||
this->m_sDestType.pbFormat = (char*)this->m_sVhdr2;
|
||||
|
||||
memset(&this->iv.m_obh, 0, sizeof(this->iv.m_obh));
|
||||
memcpy(&this->iv.m_obh, this->iv.m_bh, sizeof(this->iv.m_obh) < (unsigned) this->iv.m_bh->biSize
|
||||
? sizeof(this->iv.m_obh) : (unsigned) this->iv.m_bh->biSize);
|
||||
this->iv.m_obh.biBitCount=24;
|
||||
this->iv.m_obh.biSize = sizeof(BITMAPINFOHEADER);
|
||||
this->iv.m_obh.biCompression = 0; //BI_RGB
|
||||
//this->iv.m_obh.biHeight = labs(this->iv.m_obh.biHeight);
|
||||
this->iv.m_obh.biSizeImage = labs(this->iv.m_obh.biWidth * this->iv.m_obh.biHeight)
|
||||
* ((this->iv.m_obh.biBitCount + 7) / 8);
|
||||
|
||||
|
||||
this->m_pDMO_Filter = DMO_FilterCreate(dllname, guid, &this->m_sOurType, &this->m_sDestType);
|
||||
|
||||
if (!this->m_pDMO_Filter)
|
||||
{
|
||||
printf("Failed to create DMO filter\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!flip)
|
||||
{
|
||||
this->iv.m_obh.biHeight *= -1;
|
||||
this->m_sVhdr2->bmiHeader.biHeight = this->iv.m_obh.biHeight;
|
||||
// result = this->m_pDMO_Filter->m_pOutputPin->vt->QueryAccept(this->m_pDMO_Filter->m_pOutputPin, &this->m_sDestType);
|
||||
result = this->m_pDMO_Filter->m_pMedia->vt->SetOutputType(this->m_pDMO_Filter->m_pMedia, 0, &this->m_sDestType, DMO_SET_TYPEF_TEST_ONLY);
|
||||
if (result)
|
||||
{
|
||||
printf("Decoder does not support upside-down RGB frames\n");
|
||||
this->iv.m_obh.biHeight *= -1;
|
||||
this->m_sVhdr2->bmiHeader.biHeight = this->iv.m_obh.biHeight;
|
||||
}
|
||||
}
|
||||
|
||||
memcpy( &this->iv.m_decoder, &this->iv.m_obh, sizeof(this->iv.m_obh) );
|
||||
|
||||
switch (this->iv.m_bh->biCompression)
|
||||
{
|
||||
#if 0
|
||||
case fccDIV3:
|
||||
case fccDIV4:
|
||||
case fccDIV5:
|
||||
case fccDIV6:
|
||||
case fccMP42:
|
||||
case fccWMV2:
|
||||
//YV12 seems to be broken for DivX :-) codec
|
||||
// case fccIV50:
|
||||
//produces incorrect picture
|
||||
//m_Caps = (CAPS) (m_Caps & ~CAP_YV12);
|
||||
//m_Caps = CAP_UYVY;//CAP_YUY2; // | CAP_I420;
|
||||
//m_Caps = CAP_I420;
|
||||
this->m_Caps = (CAP_YUY2 | CAP_UYVY);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
|
||||
this->m_Caps = CAP_NONE;
|
||||
|
||||
printf("Decoder supports the following formats: ");
|
||||
for (c = check; c->bits; c++)
|
||||
{
|
||||
this->m_sVhdr2->bmiHeader.biBitCount = c->bits;
|
||||
this->m_sVhdr2->bmiHeader.biCompression = c->fcc;
|
||||
this->m_sDestType.subtype = *c->subtype;
|
||||
//result = this->m_pDMO_Filter->m_pOutputPin->vt->QueryAccept(this->m_pDMO_Filter->m_pOutputPin, &this->m_sDestType);
|
||||
result = this->m_pDMO_Filter->m_pMedia->vt->SetOutputType(this->m_pDMO_Filter->m_pMedia, 0, &this->m_sDestType, DMO_SET_TYPEF_TEST_ONLY);
|
||||
if (!result)
|
||||
{
|
||||
this->m_Caps = (this->m_Caps | c->cap);
|
||||
if (c->name)
|
||||
printf("%s ", c->name);
|
||||
else
|
||||
printf("%.4s ", (char*) &c->fcc);
|
||||
}
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
if (this->m_Caps != CAP_NONE)
|
||||
printf("Decoder is capable of YUV output (flags 0x%x)\n", (int)this->m_Caps);
|
||||
|
||||
this->m_sVhdr2->bmiHeader.biBitCount = 24;
|
||||
this->m_sVhdr2->bmiHeader.biCompression = 0;
|
||||
this->m_sDestType.subtype = MEDIASUBTYPE_RGB24;
|
||||
|
||||
this->m_iMinBuffers = this->iv.VBUFSIZE;
|
||||
}
|
||||
/*catch (FatalError& error)
|
||||
{
|
||||
delete[] m_sVhdr;
|
||||
delete[] m_sVhdr2;
|
||||
delete m_pDMO_Filter;
|
||||
throw;
|
||||
}*/
|
||||
return this;
|
||||
}
|
||||
|
||||
void DMO_VideoDecoder_Destroy(DMO_VideoDecoder *this)
|
||||
{
|
||||
DMO_VideoDecoder_StopInternal(this);
|
||||
this->iv.m_State = STOP;
|
||||
free(this->m_sVhdr);
|
||||
free(this->m_sVhdr2);
|
||||
DMO_Filter_Destroy(this->m_pDMO_Filter);
|
||||
}
|
||||
|
||||
void DMO_VideoDecoder_StartInternal(DMO_VideoDecoder *this)
|
||||
{
|
||||
#if 0
|
||||
ALLOCATOR_PROPERTIES props, props1;
|
||||
Debug printf("DMO_VideoDecoder_StartInternal\n");
|
||||
//cout << "DSSTART" << endl;
|
||||
this->m_pDMO_Filter->Start(this->m_pDMO_Filter);
|
||||
|
||||
props.cBuffers = 1;
|
||||
props.cbBuffer = this->m_sDestType.lSampleSize;
|
||||
|
||||
props.cbAlign = 1;
|
||||
props.cbPrefix = 0;
|
||||
this->m_pDMO_Filter->m_pAll->vt->SetProperties(this->m_pDMO_Filter->m_pAll, &props, &props1);
|
||||
this->m_pDMO_Filter->m_pAll->vt->Commit(this->m_pDMO_Filter->m_pAll);
|
||||
#endif
|
||||
this->iv.m_State = START;
|
||||
}
|
||||
|
||||
void DMO_VideoDecoder_StopInternal(DMO_VideoDecoder *this)
|
||||
{
|
||||
// this->m_pDMO_Filter->Stop(this->m_pDMO_Filter);
|
||||
//??? why was this here ??? m_pOurOutput->SetFramePointer(0);
|
||||
}
|
||||
|
||||
int DMO_VideoDecoder_DecodeInternal(DMO_VideoDecoder *this, const void* src, int size, int is_keyframe, char* imdata)
|
||||
{
|
||||
// IMediaSample* sample = 0;
|
||||
int result;
|
||||
unsigned long status; // to be ignored by M$ specs
|
||||
DMO_OUTPUT_DATA_BUFFER db;
|
||||
CMediaBuffer* bufferin;
|
||||
//+ uint8_t* imdata = dest ? dest->Data() : 0;
|
||||
|
||||
Debug printf("DMO_VideoDecoder_DecodeInternal(%p,%p,%d,%d,%p)\n",this,src,size,is_keyframe,imdata);
|
||||
|
||||
// this->m_pDMO_Filter->m_pAll->vt->GetBuffer(this->m_pDMO_Filter->m_pAll, &sample, 0, 0, 0);
|
||||
// if (!sample)
|
||||
// {
|
||||
// Debug printf("ERROR: null sample\n");
|
||||
// return -1;
|
||||
// }
|
||||
|
||||
#ifdef WIN32_LOADER
|
||||
Setup_FS_Segment();
|
||||
#endif
|
||||
|
||||
bufferin = CMediaBufferCreate(size, (void*)src, size, 0);
|
||||
result = this->m_pDMO_Filter->m_pMedia->vt->ProcessInput(this->m_pDMO_Filter->m_pMedia, 0,
|
||||
(IMediaBuffer*)bufferin,
|
||||
DMO_INPUT_DATA_BUFFERF_SYNCPOINT,
|
||||
0, 0);
|
||||
((IMediaBuffer*)bufferin)->vt->Release((IUnknown*)bufferin);
|
||||
|
||||
if (result != S_OK)
|
||||
{
|
||||
/* something for process */
|
||||
if (result != S_FALSE)
|
||||
printf("ProcessInputError r:0x%x=%d (keyframe: %d)\n", result, result, is_keyframe);
|
||||
else
|
||||
printf("ProcessInputError FALSE ?? (keyframe: %d)\n", is_keyframe);
|
||||
return size;
|
||||
}
|
||||
|
||||
db.rtTimestamp = 0;
|
||||
db.rtTimelength = 0;
|
||||
db.dwStatus = 0;
|
||||
db.pBuffer = (IMediaBuffer*) CMediaBufferCreate(this->m_sDestType.lSampleSize,
|
||||
imdata, 0, 0);
|
||||
result = this->m_pDMO_Filter->m_pMedia->vt->ProcessOutput(this->m_pDMO_Filter->m_pMedia,
|
||||
(imdata) ? 0 : DMO_PROCESS_OUTPUT_DISCARD_WHEN_NO_BUFFER,
|
||||
1, &db, &status);
|
||||
//m_pDMO_Filter->m_pMedia->vt->Lock(m_pDMO_Filter->m_pMedia, 0);
|
||||
if ((unsigned)result == DMO_E_NOTACCEPTING)
|
||||
printf("ProcessOutputError: Not accepting\n");
|
||||
else if (result)
|
||||
printf("ProcessOutputError: r:0x%x=%d %ld stat:%ld\n", result, result, status, db.dwStatus);
|
||||
|
||||
((IMediaBuffer*)db.pBuffer)->vt->Release((IUnknown*)db.pBuffer);
|
||||
|
||||
//int r = m_pDMO_Filter->m_pMedia->vt->Flush(m_pDMO_Filter->m_pMedia);
|
||||
//printf("FLUSH %d\n", r);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* bits == 0 - leave unchanged
|
||||
*/
|
||||
//int SetDestFmt(DMO_VideoDecoder * this, int bits = 24, fourcc_t csp = 0);
|
||||
int DMO_VideoDecoder_SetDestFmt(DMO_VideoDecoder *this, int bits, unsigned int csp)
|
||||
{
|
||||
HRESULT result;
|
||||
//int should_test=1;
|
||||
|
||||
Debug printf("DMO_VideoDecoder_SetDestFmt (%p, %d, %d)\n",this,bits,(int)csp);
|
||||
|
||||
/* if (!CImage::Supported(csp, bits))
|
||||
return -1;
|
||||
*/
|
||||
// BitmapInfo temp = m_obh;
|
||||
|
||||
if (!csp) // RGB
|
||||
{
|
||||
int ok = true;
|
||||
|
||||
switch (bits)
|
||||
{
|
||||
case 15:
|
||||
this->m_sDestType.subtype = MEDIASUBTYPE_RGB555;
|
||||
break;
|
||||
case 16:
|
||||
this->m_sDestType.subtype = MEDIASUBTYPE_RGB565;
|
||||
break;
|
||||
case 24:
|
||||
this->m_sDestType.subtype = MEDIASUBTYPE_RGB24;
|
||||
break;
|
||||
case 32:
|
||||
this->m_sDestType.subtype = MEDIASUBTYPE_RGB32;
|
||||
break;
|
||||
default:
|
||||
ok = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if (ok) {
|
||||
this->iv.m_obh.biBitCount=bits;
|
||||
if( bits == 15 || bits == 16 ) {
|
||||
this->iv.m_obh.biSize=sizeof(BITMAPINFOHEADER)+12;
|
||||
this->iv.m_obh.biCompression=3;//BI_BITFIELDS
|
||||
this->iv.m_obh.biSizeImage=abs((int)(2*this->iv.m_obh.biWidth*this->iv.m_obh.biHeight));
|
||||
}
|
||||
|
||||
if( bits == 16 ) {
|
||||
this->iv.m_obh.colors[0]=0xF800;
|
||||
this->iv.m_obh.colors[1]=0x07E0;
|
||||
this->iv.m_obh.colors[2]=0x001F;
|
||||
} else if ( bits == 15 ) {
|
||||
this->iv.m_obh.colors[0]=0x7C00;
|
||||
this->iv.m_obh.colors[1]=0x03E0;
|
||||
this->iv.m_obh.colors[2]=0x001F;
|
||||
} else {
|
||||
this->iv.m_obh.biSize = sizeof(BITMAPINFOHEADER);
|
||||
this->iv.m_obh.biCompression = 0; //BI_RGB
|
||||
//this->iv.m_obh.biHeight = labs(this->iv.m_obh.biHeight);
|
||||
this->iv.m_obh.biSizeImage = labs(this->iv.m_obh.biWidth * this->iv.m_obh.biHeight)
|
||||
* ((this->iv.m_obh.biBitCount + 7) / 8);
|
||||
}
|
||||
}
|
||||
//.biSizeImage=abs(temp.biWidth*temp.biHeight*((temp.biBitCount+7)/8));
|
||||
} else
|
||||
{ // YUV
|
||||
int ok = true;
|
||||
switch (csp)
|
||||
{
|
||||
case fccYUY2:
|
||||
this->m_sDestType.subtype = MEDIASUBTYPE_YUY2;
|
||||
break;
|
||||
case fccYV12:
|
||||
this->m_sDestType.subtype = MEDIASUBTYPE_YV12;
|
||||
break;
|
||||
case fccIYUV:
|
||||
this->m_sDestType.subtype = MEDIASUBTYPE_IYUV;
|
||||
break;
|
||||
case fccI420:
|
||||
this->m_sDestType.subtype = MEDIASUBTYPE_I420;
|
||||
break;
|
||||
case fccUYVY:
|
||||
this->m_sDestType.subtype = MEDIASUBTYPE_UYVY;
|
||||
break;
|
||||
case fccYVYU:
|
||||
this->m_sDestType.subtype = MEDIASUBTYPE_YVYU;
|
||||
break;
|
||||
case fccYVU9:
|
||||
this->m_sDestType.subtype = MEDIASUBTYPE_YVU9;
|
||||
default:
|
||||
ok = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if (ok) {
|
||||
if (csp != 0 && csp != 3 && this->iv.m_obh.biHeight > 0)
|
||||
this->iv.m_obh.biHeight *= -1; // YUV formats uses should have height < 0
|
||||
this->iv.m_obh.biSize = sizeof(BITMAPINFOHEADER);
|
||||
this->iv.m_obh.biCompression=csp;
|
||||
this->iv.m_obh.biBitCount=bits;
|
||||
|
||||
this->iv.m_obh.biSizeImage = labs(this->iv.m_obh.biWidth * this->iv.m_obh.biHeight)
|
||||
* ((this->iv.m_obh.biBitCount + 7) / 8);
|
||||
}
|
||||
}
|
||||
this->m_sDestType.lSampleSize = this->iv.m_obh.biSizeImage;
|
||||
memcpy(&(this->m_sVhdr2->bmiHeader), &this->iv.m_obh, sizeof(this->iv.m_obh));
|
||||
this->m_sVhdr2->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||
if (this->m_sVhdr2->bmiHeader.biCompression == 3)
|
||||
this->m_sDestType.cbFormat = sizeof(VIDEOINFOHEADER) + 12;
|
||||
else
|
||||
this->m_sDestType.cbFormat = sizeof(VIDEOINFOHEADER);
|
||||
|
||||
#if 0
|
||||
switch(csp)
|
||||
{
|
||||
case fccYUY2:
|
||||
if(!(this->m_Caps & CAP_YUY2))
|
||||
should_test=false;
|
||||
break;
|
||||
case fccYV12:
|
||||
if(!(this->m_Caps & CAP_YV12))
|
||||
should_test=false;
|
||||
break;
|
||||
case fccIYUV:
|
||||
if(!(this->m_Caps & CAP_IYUV))
|
||||
should_test=false;
|
||||
break;
|
||||
case fccI420:
|
||||
if(!(this->m_Caps & CAP_I420))
|
||||
should_test=false;
|
||||
break;
|
||||
case fccUYVY:
|
||||
if(!(this->m_Caps & CAP_UYVY))
|
||||
should_test=false;
|
||||
break;
|
||||
case fccYVYU:
|
||||
if(!(this->m_Caps & CAP_YVYU))
|
||||
should_test=false;
|
||||
break;
|
||||
case fccYVU9:
|
||||
if(!(this->m_Caps & CAP_YVU9))
|
||||
should_test=false;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef WIN32_LOADER
|
||||
Setup_FS_Segment();
|
||||
#endif
|
||||
|
||||
// if(should_test)
|
||||
// result = this->m_pDMO_Filter->m_pOutputPin->vt->QueryAccept(this->m_pDMO_Filter->m_pOutputPin, &this->m_sDestType);
|
||||
// else
|
||||
// result = -1;
|
||||
|
||||
// test accept
|
||||
if(!this->m_pDMO_Filter) return 0;
|
||||
result = this->m_pDMO_Filter->m_pMedia->vt->SetOutputType(this->m_pDMO_Filter->m_pMedia, 0, &this->m_sDestType, DMO_SET_TYPEF_TEST_ONLY);
|
||||
|
||||
if (result != 0)
|
||||
{
|
||||
if (csp)
|
||||
printf("Warning: unsupported color space\n");
|
||||
else
|
||||
printf("Warning: unsupported bit depth\n");
|
||||
|
||||
this->m_sDestType.lSampleSize = this->iv.m_decoder.biSizeImage;
|
||||
memcpy(&(this->m_sVhdr2->bmiHeader), &this->iv.m_decoder, sizeof(this->iv.m_decoder));
|
||||
this->m_sVhdr2->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||
if (this->m_sVhdr2->bmiHeader.biCompression == 3)
|
||||
this->m_sDestType.cbFormat = sizeof(VIDEOINFOHEADER) + 12;
|
||||
else
|
||||
this->m_sDestType.cbFormat = sizeof(VIDEOINFOHEADER);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
memcpy( &this->iv.m_decoder, &this->iv.m_obh, sizeof(this->iv.m_obh));
|
||||
|
||||
// m_obh=temp;
|
||||
// if(csp)
|
||||
// m_obh.biBitCount=BitmapInfo::BitCount(csp);
|
||||
this->iv.m_bh->biBitCount = bits;
|
||||
|
||||
//DMO_VideoDecoder_Restart(this);
|
||||
|
||||
this->m_pDMO_Filter->m_pMedia->vt->SetOutputType(this->m_pDMO_Filter->m_pMedia, 0, &this->m_sDestType, 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int DMO_VideoDecoder_SetDirection(DMO_VideoDecoder *this, int d)
|
||||
{
|
||||
this->iv.m_obh.biHeight = (d) ? this->iv.m_bh->biHeight : -this->iv.m_bh->biHeight;
|
||||
this->m_sVhdr2->bmiHeader.biHeight = this->iv.m_obh.biHeight;
|
||||
return 0;
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
#ifndef MPLAYER_DMO_VIDEODECODER_H
|
||||
#define MPLAYER_DMO_VIDEODECODER_H
|
||||
|
||||
#include "loader/com.h"
|
||||
#include "loader/wine/vfw.h"
|
||||
|
||||
typedef struct DMO_VideoDecoder DMO_VideoDecoder;
|
||||
|
||||
int DMO_VideoDecoder_GetCapabilities(DMO_VideoDecoder *this);
|
||||
|
||||
DMO_VideoDecoder * DMO_VideoDecoder_Open(char* dllname, GUID* guid, BITMAPINFOHEADER * format, int flip, int maxauto);
|
||||
|
||||
void DMO_VideoDecoder_Destroy(DMO_VideoDecoder *this);
|
||||
|
||||
void DMO_VideoDecoder_StartInternal(DMO_VideoDecoder *this);
|
||||
|
||||
void DMO_VideoDecoder_StopInternal(DMO_VideoDecoder *this);
|
||||
|
||||
int DMO_VideoDecoder_DecodeInternal(DMO_VideoDecoder *this, const void* src, int size, int is_keyframe, char* pImage);
|
||||
|
||||
/*
|
||||
* bits == 0 - leave unchanged
|
||||
*/
|
||||
//int SetDestFmt(DMO_VideoDecoder * this, int bits = 24, fourcc_t csp = 0);
|
||||
int DMO_VideoDecoder_SetDestFmt(DMO_VideoDecoder *this, int bits, unsigned int csp);
|
||||
int DMO_VideoDecoder_SetDirection(DMO_VideoDecoder *this, int d);
|
||||
|
||||
|
||||
#endif /* MPLAYER_DMO_VIDEODECODER_H */
|
||||
@@ -1,119 +0,0 @@
|
||||
#include "DMO_Filter.h"
|
||||
|
||||
#include "loader/wine/winerror.h"
|
||||
#include "loader/wine/windef.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
struct CMediaBuffer
|
||||
{
|
||||
IMediaBuffer_vt* vt;
|
||||
DECLARE_IUNKNOWN();
|
||||
GUID interfaces[2];
|
||||
void* mem;
|
||||
unsigned long len;
|
||||
unsigned long maxlen;
|
||||
int freemem;
|
||||
};
|
||||
|
||||
static HRESULT STDCALL CMediaBuffer_SetLength(IMediaBuffer* This,
|
||||
unsigned long cbLength)
|
||||
{
|
||||
CMediaBuffer* cmb = (CMediaBuffer*) This;
|
||||
Debug printf("CMediaBuffer_SetLength(%p) called (%ld, %ld)\n", This, cbLength, cmb->maxlen);
|
||||
if (cbLength > cmb->maxlen)
|
||||
return E_INVALIDARG;
|
||||
cmb->len = cbLength;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT STDCALL CMediaBuffer_GetMaxLength(IMediaBuffer* This,
|
||||
/* [out] */ unsigned long *pcbMaxLength)
|
||||
{
|
||||
CMediaBuffer* cmb = (CMediaBuffer*) This;
|
||||
Debug printf("CMediaBuffer_GetMaxLength(%p) called -> %ld\n", This, cmb->maxlen);
|
||||
if (!pcbMaxLength)
|
||||
return E_POINTER;
|
||||
*pcbMaxLength = cmb->maxlen;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT STDCALL CMediaBuffer_GetBufferAndLength(IMediaBuffer* This,
|
||||
/* [out] */ char** ppBuffer,
|
||||
/* [out] */ unsigned long* pcbLength)
|
||||
{
|
||||
CMediaBuffer* cmb = (CMediaBuffer*) This;
|
||||
Debug printf("CMediaBuffer_GetBufferAndLength(%p) called -> %p %ld\n", This, cmb->mem, cmb->len);
|
||||
if (!ppBuffer && !pcbLength)
|
||||
return E_POINTER;
|
||||
if (ppBuffer)
|
||||
*ppBuffer = cmb->mem;
|
||||
if (pcbLength)
|
||||
*pcbLength = cmb->len;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static void CMediaBuffer_Destroy(CMediaBuffer* This)
|
||||
{
|
||||
Debug printf("CMediaBuffer_Destroy(%p) called\n", This);
|
||||
if (This->freemem)
|
||||
free(This->mem);
|
||||
free(This->vt);
|
||||
free(This);
|
||||
}
|
||||
|
||||
IMPLEMENT_IUNKNOWN(CMediaBuffer)
|
||||
|
||||
CMediaBuffer* CMediaBufferCreate(unsigned long maxlen, void* mem,
|
||||
unsigned long len, int copy)
|
||||
{
|
||||
CMediaBuffer* This = malloc(sizeof(CMediaBuffer));
|
||||
|
||||
if (!This)
|
||||
return NULL;
|
||||
|
||||
This->vt = malloc(sizeof(IMediaBuffer_vt));
|
||||
if (!This->vt)
|
||||
{
|
||||
CMediaBuffer_Destroy(This);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
This->refcount = 1;
|
||||
This->len = len;
|
||||
This->maxlen = maxlen;
|
||||
This->freemem = 0;
|
||||
This->mem = mem;
|
||||
if (copy)
|
||||
/* make a private copy of data */
|
||||
This->mem = 0;
|
||||
if (This->mem == NULL)
|
||||
{
|
||||
if (This->maxlen)
|
||||
{
|
||||
This->mem = malloc(This->maxlen);
|
||||
if (!This->mem)
|
||||
{
|
||||
CMediaBuffer_Destroy(This);
|
||||
return NULL;
|
||||
}
|
||||
This->freemem = 1;
|
||||
if (copy)
|
||||
memcpy(This->mem, mem, This->len);
|
||||
}
|
||||
}
|
||||
This->vt->QueryInterface = CMediaBuffer_QueryInterface;
|
||||
This->vt->AddRef = CMediaBuffer_AddRef;
|
||||
This->vt->Release = CMediaBuffer_Release;
|
||||
|
||||
This->vt->SetLength = CMediaBuffer_SetLength;
|
||||
This->vt->GetMaxLength = CMediaBuffer_GetMaxLength;
|
||||
This->vt->GetBufferAndLength = CMediaBuffer_GetBufferAndLength;
|
||||
|
||||
This->interfaces[0] = IID_IUnknown;
|
||||
This->interfaces[1] = IID_IMediaBuffer;
|
||||
|
||||
return This;
|
||||
}
|
||||
@@ -1,166 +0,0 @@
|
||||
/*
|
||||
* Modified for use with MPlayer, detailed changelog at
|
||||
* http://svn.mplayerhq.hu/mplayer/trunk/
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "DMO_Filter.h"
|
||||
#include "loader/drv.h"
|
||||
#include "loader/com.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "loader/win32.h" // printf macro
|
||||
|
||||
void trapbug(void);
|
||||
typedef long STDCALL (*GETCLASS) (const GUID*, const GUID*, void**);
|
||||
|
||||
void DMO_Filter_Destroy(DMO_Filter* This)
|
||||
{
|
||||
if (This->m_pOptim)
|
||||
This->m_pOptim->vt->Release((IUnknown*)This->m_pOptim);
|
||||
if (This->m_pInPlace)
|
||||
This->m_pInPlace->vt->Release((IUnknown*)This->m_pInPlace);
|
||||
if (This->m_pMedia)
|
||||
This->m_pMedia->vt->Release((IUnknown*)This->m_pMedia);
|
||||
|
||||
free(This);
|
||||
#ifdef WIN32_LOADER
|
||||
CodecRelease();
|
||||
#endif
|
||||
}
|
||||
|
||||
DMO_Filter* DMO_FilterCreate(const char* dllname, const GUID* id,
|
||||
DMO_MEDIA_TYPE* in_fmt,
|
||||
DMO_MEDIA_TYPE* out_fmt)
|
||||
{
|
||||
HRESULT hr = 0;
|
||||
const char* em = NULL;
|
||||
DMO_Filter* This = malloc(sizeof(DMO_Filter));
|
||||
if (!This)
|
||||
return NULL;
|
||||
|
||||
memset(This, 0, sizeof(DMO_Filter));
|
||||
#ifdef WIN32_LOADER
|
||||
CodecAlloc();
|
||||
#endif
|
||||
|
||||
//This->Start = DS_Filter_Start;
|
||||
//This->Stop = DS_Filter_Stop;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
GETCLASS func;
|
||||
struct IClassFactory* factory = NULL;
|
||||
struct IUnknown* object = NULL;
|
||||
unsigned int i;
|
||||
unsigned long inputs, outputs;
|
||||
|
||||
This->m_iHandle = LoadLibraryA(dllname);
|
||||
if (!This->m_iHandle)
|
||||
{
|
||||
em = "could not open DMO DLL";
|
||||
break;
|
||||
}
|
||||
func = (GETCLASS)GetProcAddress((unsigned)This->m_iHandle, "DllGetClassObject");
|
||||
if (!func)
|
||||
{
|
||||
em = "illegal or corrupt DMO DLL";
|
||||
break;
|
||||
}
|
||||
//trapbug();
|
||||
hr = func(id, &IID_IClassFactory, (void*)&factory);
|
||||
if (hr || !factory)
|
||||
{
|
||||
em = "no such class object";
|
||||
break;
|
||||
}
|
||||
hr = factory->vt->CreateInstance(factory, 0, &IID_IUnknown, (void*)&object);
|
||||
factory->vt->Release((IUnknown*)factory);
|
||||
if (hr || !object)
|
||||
{
|
||||
em = "class factory failure";
|
||||
break;
|
||||
}
|
||||
hr = object->vt->QueryInterface(object, &IID_IMediaObject, (void*)&This->m_pMedia);
|
||||
if (hr == 0)
|
||||
{
|
||||
/* query for some extra available interface */
|
||||
HRESULT r = object->vt->QueryInterface(object, &IID_IMediaObjectInPlace, (void*)&This->m_pInPlace);
|
||||
if (r == 0 && This->m_pInPlace)
|
||||
printf("DMO dll supports InPlace - PLEASE REPORT to developer\n");
|
||||
r = object->vt->QueryInterface(object, &IID_IDMOVideoOutputOptimizations, (void*)&This->m_pOptim);
|
||||
if (r == 0 && This->m_pOptim)
|
||||
{
|
||||
unsigned long flags;
|
||||
r = This->m_pOptim->vt->QueryOperationModePreferences(This->m_pOptim, 0, &flags);
|
||||
printf("DMO dll supports VO Optimizations %ld %lx\n", r, flags);
|
||||
if (flags & DMO_VOSF_NEEDS_PREVIOUS_SAMPLE)
|
||||
printf("DMO dll might use previous sample when requested\n");
|
||||
}
|
||||
}
|
||||
object->vt->Release((IUnknown*)object);
|
||||
if (hr || !This->m_pMedia)
|
||||
{
|
||||
em = "object does not provide IMediaObject interface";
|
||||
break;
|
||||
}
|
||||
hr = This->m_pMedia->vt->SetInputType(This->m_pMedia, 0, in_fmt, 0);
|
||||
if (hr)
|
||||
{
|
||||
em = "input format not accepted";
|
||||
break;
|
||||
}
|
||||
|
||||
if (0) {
|
||||
DMO_MEDIA_TYPE dmo;
|
||||
//VIDEOINFOHEADER* vi;
|
||||
memset(&dmo, 0, sizeof(dmo));
|
||||
i = This->m_pMedia->vt->GetOutputType(This->m_pMedia, 0, 2, &dmo);
|
||||
Debug printf("GetOutputType %x \n", i);
|
||||
Debug printf("DMO 0x%x (%.4s) 0x%x (%.4s)\n"
|
||||
//Debug printf("DMO 0x%x 0x%x\n"
|
||||
":: fixszsamp:%d tempcomp:%d sampsz:%ld\n"
|
||||
":: formtype: 0x%x\n"
|
||||
":: unk %p cbform: %ld pbform:%p\n",
|
||||
dmo.majortype.f1,
|
||||
(const char*)&dmo.majortype.f1,
|
||||
dmo.subtype.f1,
|
||||
(const char*)&dmo.subtype.f1,
|
||||
dmo.bFixedSizeSamples, dmo.bTemporalCompression,
|
||||
dmo.lSampleSize,
|
||||
dmo.formattype.f1,
|
||||
dmo.pUnk, dmo.cbFormat, dmo.pbFormat
|
||||
);
|
||||
/* vi = (VIDEOINFOHEADER*) dmo.pbFormat;
|
||||
vi = (VIDEOINFOHEADER*) out_fmt->pbFormat;
|
||||
for (i = 0; i < out_fmt->cbFormat; i++)
|
||||
Debug printf("BYTE %d %02x %02x\n", i, ((uint8_t*)dmo.pbFormat)[i], ((uint8_t*)out_fmt->pbFormat)[i]);
|
||||
*/
|
||||
}
|
||||
|
||||
hr = This->m_pMedia->vt->SetOutputType(This->m_pMedia, 0, out_fmt, 0);
|
||||
if (hr)
|
||||
{
|
||||
em = "output format no accepted";
|
||||
break;
|
||||
}
|
||||
|
||||
inputs = outputs = 0;
|
||||
hr = This->m_pMedia->vt->GetOutputSizeInfo(This->m_pMedia, 0, &inputs, &outputs);
|
||||
Debug printf("GetOutput r=0x%lx size:%ld align:%ld\n", hr, inputs, outputs);
|
||||
|
||||
// This->m_pMedia->vt->AllocateStreamingResources(This->m_pMedia);
|
||||
hr = This->m_pMedia->vt->GetStreamCount(This->m_pMedia, &inputs, &outputs);
|
||||
Debug printf("StreamCount r=0x%lx %ld %ld\n", hr, inputs, outputs);
|
||||
|
||||
break;
|
||||
}
|
||||
if (em)
|
||||
{
|
||||
DMO_Filter_Destroy(This);
|
||||
printf("IMediaObject ERROR: %p %s (0x%lx : %ld)\n", em, em ? em : "", hr, hr);
|
||||
This = 0;
|
||||
}
|
||||
return This;
|
||||
}
|
||||
@@ -1,81 +0,0 @@
|
||||
#ifndef MPLAYER_DMO_H
|
||||
#define MPLAYER_DMO_H
|
||||
|
||||
/*
|
||||
*
|
||||
* Definition of important DMO interfaces.
|
||||
* Created using freely-available DirectX 8.1 SDK
|
||||
* ( http://msdn.microsoft.com )
|
||||
*
|
||||
*/
|
||||
|
||||
#include "loader/dshow/iunk.h"
|
||||
#include "loader/dshow/guids.h"
|
||||
|
||||
typedef AM_MEDIA_TYPE DMO_MEDIA_TYPE;
|
||||
|
||||
|
||||
|
||||
enum DMO_INPUT_DATA_BUFFER_FLAGS
|
||||
{
|
||||
DMO_INPUT_DATA_BUFFERF_SYNCPOINT = 0x1,
|
||||
DMO_INPUT_DATA_BUFFERF_TIME = 0x2,
|
||||
DMO_INPUT_DATA_BUFFERF_TIMELENGTH = 0x4
|
||||
};
|
||||
|
||||
enum DMO_OUTPUT_DATA_BUFFER_FLAGS
|
||||
{
|
||||
DMO_OUTPUT_DATA_BUFFERF_SYNCPOINT = 0x1,
|
||||
DMO_OUTPUT_DATA_BUFFERF_TIME = 0x2,
|
||||
DMO_OUTPUT_DATA_BUFFERF_TIMELENGTH = 0x4,
|
||||
DMO_OUTPUT_DATA_BUFFERF_INCOMPLETE = 0x1000000
|
||||
};
|
||||
|
||||
enum DMO_INPUT_STATUS_FLAGS
|
||||
{
|
||||
DMO_INPUT_STATUSF_ACCEPT_DATA = 0x1
|
||||
};
|
||||
|
||||
enum DMO_INPUT_STREAM_INFO_FLAGS
|
||||
{
|
||||
DMO_INPUT_STREAMF_WHOLE_SAMPLES = 0x1,
|
||||
DMO_INPUT_STREAMF_SINGLE_SAMPLE_PER_BUFFER = 0x2,
|
||||
DMO_INPUT_STREAMF_FIXED_SAMPLE_SIZE = 0x4,
|
||||
DMO_INPUT_STREAMF_HOLDS_BUFFERS = 0x8
|
||||
};
|
||||
|
||||
enum DMO_OUTPUT_STREAM_INFO_FLAGS
|
||||
{
|
||||
DMO_OUTPUT_STREAMF_WHOLE_SAMPLES = 0x1,
|
||||
DMO_OUTPUT_STREAMF_SINGLE_SAMPLE_PER_BUFFER = 0x2,
|
||||
DMO_OUTPUT_STREAMF_FIXED_SAMPLE_SIZE = 0x4,
|
||||
DMO_OUTPUT_STREAMF_DISCARDABLE = 0x8,
|
||||
DMO_OUTPUT_STREAMF_OPTIONAL = 0x10
|
||||
};
|
||||
|
||||
enum DMO_SET_TYPE_FLAGS
|
||||
{
|
||||
DMO_SET_TYPEF_TEST_ONLY = 0x1,
|
||||
DMO_SET_TYPEF_CLEAR = 0x2
|
||||
};
|
||||
|
||||
enum DMO_PROCESS_OUTPUT_FLAGS
|
||||
{
|
||||
DMO_PROCESS_OUTPUT_DISCARD_WHEN_NO_BUFFER = 0x1
|
||||
};
|
||||
|
||||
enum DMO_VIDEO_OUTPUT_STREAM_FLAGS
|
||||
{
|
||||
DMO_VOSF_NEEDS_PREVIOUS_SAMPLE = 0x1
|
||||
};
|
||||
|
||||
|
||||
/* MediaErr.h */
|
||||
#define DMO_E_INVALIDSTREAMINDEX 0x80040201
|
||||
#define DMO_E_INVALIDTYPE 0x80040202
|
||||
#define DMO_E_TYPE_NOT_SET 0x80040203
|
||||
#define DMO_E_NOTACCEPTING 0x80040204
|
||||
#define DMO_E_TYPE_NOT_ACCEPTED 0x80040205
|
||||
#define DMO_E_NO_MORE_ITEMS 0x80040206
|
||||
|
||||
#endif /* MPLAYER_DMO_H */
|
||||
@@ -1,41 +0,0 @@
|
||||
#include "dmo_guids.h"
|
||||
int DMO_DEBUG = 0;
|
||||
|
||||
const GUID IID_IMediaBuffer = { 0x59eff8b9, 0x938c, 0x4a26,
|
||||
{ 0x82, 0xf2, 0x95, 0xcb, 0x84, 0xcd, 0xc8, 0x37}};
|
||||
const GUID IID_IMediaObject = { 0xd8ad0f58, 0x5494, 0x4102,
|
||||
{ 0x97, 0xc5, 0xec, 0x79, 0x8e, 0x59, 0xbc, 0xf4}};
|
||||
const GUID IID_IEnumDMO = { 0x2c3cd98a, 0x2bfa, 0x4a53,
|
||||
{ 0x9c, 0x27, 0x52, 0x49, 0xba, 0x64, 0xba, 0x0f}};
|
||||
const GUID IID_IMediaObjectInPlace = { 0x651b9ad0, 0x0fc7, 0x4aa9,
|
||||
{ 0x95, 0x38, 0xd8, 0x99, 0x31, 0x01, 0x07, 0x41}};
|
||||
const GUID IID_IDMOQualityControl = { 0x65abea96, 0xcf36, 0x453f,
|
||||
{ 0xaf, 0x8a, 0x70, 0x5e, 0x98, 0xf1, 0x62, 0x60}};
|
||||
const GUID IID_IDMOVideoOutputOptimizations = { 0xbe8f4f4e, 0x5b16, 0x4d29,
|
||||
{ 0xb3, 0x50, 0x7f, 0x6b, 0x5d, 0x92, 0x98, 0xac}};
|
||||
|
||||
|
||||
const GUID DMOCATEGORY_AUDIO_DECODER = { 0x57f2db8b, 0xe6bb, 0x4513,
|
||||
{ 0x9d, 0x43, 0xdc, 0xd2, 0xa6, 0x59, 0x31, 0x25}};
|
||||
const GUID DMOCATEGORY_AUDIO_ENCODER = { 0x33d9a761, 0x90c8, 0x11d0,
|
||||
{ 0xbd, 0x43, 0x00, 0xa0, 0xc9, 0x11, 0xce, 0x86}};
|
||||
const GUID DMOCATEGORY_VIDEO_DECODER = { 0x4a69b442, 0x28be, 0x4991,
|
||||
{ 0x96, 0x9c, 0xb5, 0x00, 0xad, 0xf5, 0xd8, 0xa8}};
|
||||
const GUID DMOCATEGORY_VIDEO_ENCODER = { 0x33d9a760, 0x90c8, 0x11d0,
|
||||
{ 0xbd, 0x43, 0x00, 0xa0, 0xc9, 0x11, 0xce, 0x86}};
|
||||
const GUID DMOCATEGORY_AUDIO_EFFECT = { 0xf3602b3f, 0x0592, 0x48df,
|
||||
{ 0xa4, 0xcd, 0x67, 0x47, 0x21, 0xe7, 0xeb, 0xeb}};
|
||||
const GUID DMOCATEGORY_VIDEO_EFFECT = { 0xd990ee14, 0x776c, 0x4723,
|
||||
{ 0xbe, 0x46, 0x3d, 0xa2, 0xf5, 0x6f, 0x10,0xb9}};
|
||||
const GUID DMOCATEGORY_AUDIO_CAPTURE_EFFECT = { 0xf665aaba, 0x3e09, 0x4920,
|
||||
{ 0xaa, 0x5f, 0x21, 0x98, 0x11, 0x14, 0x8f, 0x09}};
|
||||
|
||||
|
||||
const GUID DMOCATEGORY_ACOUSTIC_ECHO_CANCEL = { 0xBF963D80L, 0xC559, 0x11D0,
|
||||
{ 0x8A, 0x2B, 0x00, 0xA0, 0xC9, 0x25, 0x5A, 0xC1}};
|
||||
|
||||
const GUID DMOCATEGORY_AUDIO_NOISE_SUPPRESS = { 0xe07f903f, 0x62fd, 0x4e60,
|
||||
{ 0x8c, 0xdd, 0xde, 0xa7, 0x23, 0x66, 0x65, 0xb5}};
|
||||
|
||||
const GUID DMOCATEGORY_AGC = { 0xe88c9ba0l, 0xc557, 0x11d0,
|
||||
{ 0x8a, 0x2b, 0x00, 0xa0, 0xc9, 0x25, 0x5a, 0xc1}};
|
||||
@@ -1,35 +0,0 @@
|
||||
#ifndef MPLAYER_DMO_GUIDS_H
|
||||
#define MPLAYER_DMO_GUIDS_H
|
||||
|
||||
#include "loader/dshow/guids.h"
|
||||
|
||||
extern const GUID IID_IMediaBuffer;
|
||||
extern const GUID IID_IMediaObject;
|
||||
extern const GUID IID_IEnumDMO;
|
||||
extern const GUID IID_IMediaObjectInPlace;
|
||||
extern const GUID IID_IDMOQualityControl;
|
||||
extern const GUID IID_IDMOVideoOutputOptimizations;
|
||||
|
||||
/* to be removed
|
||||
extern const GUID DMOCATEGORY_AUDIO_DECODER;
|
||||
extern const GUID DMOCATEGORY_AUDIO_ENCODER;
|
||||
extern const GUID DMOCATEGORY_VIDEO_DECODER;
|
||||
extern const GUID DMOCATEGORY_VIDEO_ENCODER;
|
||||
extern const GUID DMOCATEGORY_AUDIO_EFFECT;
|
||||
extern const GUID DMOCATEGORY_VIDEO_EFFECT;
|
||||
extern const GUID DMOCATEGORY_AUDIO_CAPTURE_EFFECT;
|
||||
|
||||
// Acoustic Echo Canceller
|
||||
// Matches KSNODETYPE_ACOUSTIC_ECHO_CANCEL
|
||||
extern const GUID DMOCATEGORY_ACOUSTIC_ECHO_CANCEL;
|
||||
|
||||
// Noise Suppression
|
||||
// Matches KSNODETYPE_AUDIO_NOISE_SUPPRESS
|
||||
extern const GUID DMOCATEGORY_AUDIO_NOISE_SUPPRESS;
|
||||
|
||||
// Automatic Gain Control
|
||||
// Matches KSNODETYPE_AGC
|
||||
extern const GUID DMOCATEGORY_AGC;
|
||||
*/
|
||||
|
||||
#endif /* MPLAYER_DMO_GUIDS_H */
|
||||
@@ -1,194 +0,0 @@
|
||||
#ifndef MPLAYER_DMO_INTERFACES_H
|
||||
#define MPLAYER_DMO_INTERFACES_H
|
||||
|
||||
#include "dmo.h"
|
||||
|
||||
/*
|
||||
* IMediaBuffer interface
|
||||
*/
|
||||
typedef struct IMediaBuffer IMediaBuffer;
|
||||
typedef struct IMediaBuffer_vt
|
||||
{
|
||||
INHERIT_IUNKNOWN();
|
||||
|
||||
HRESULT STDCALL ( *SetLength )(IMediaBuffer* This,
|
||||
unsigned long cbLength);
|
||||
HRESULT STDCALL ( *GetMaxLength )(IMediaBuffer* This,
|
||||
/* [out] */ unsigned long *pcbMaxLength);
|
||||
HRESULT STDCALL ( *GetBufferAndLength )(IMediaBuffer* This,
|
||||
/* [out] */ char** ppBuffer,
|
||||
/* [out] */ unsigned long* pcbLength);
|
||||
} IMediaBuffer_vt;
|
||||
struct IMediaBuffer { IMediaBuffer_vt* vt; };
|
||||
|
||||
|
||||
typedef struct DMO_OUTPUT_DATA_BUFFER
|
||||
{
|
||||
IMediaBuffer *pBuffer;
|
||||
unsigned long dwStatus;
|
||||
REFERENCE_TIME rtTimestamp;
|
||||
REFERENCE_TIME rtTimelength;
|
||||
} DMO_OUTPUT_DATA_BUFFER;
|
||||
|
||||
|
||||
/*
|
||||
* IMediaObject interface
|
||||
*/
|
||||
typedef struct IMediaObject IMediaObject;
|
||||
typedef struct IMediaObject_vt
|
||||
{
|
||||
INHERIT_IUNKNOWN();
|
||||
|
||||
HRESULT STDCALL ( *GetStreamCount )(IMediaObject * This,
|
||||
/* [out] */ unsigned long *pcInputStreams,
|
||||
/* [out] */ unsigned long *pcOutputStreams);
|
||||
HRESULT STDCALL ( *GetInputStreamInfo )(IMediaObject * This,
|
||||
unsigned long dwInputStreamIndex,
|
||||
/* [out] */ unsigned long *pdwFlags);
|
||||
HRESULT STDCALL ( *GetOutputStreamInfo )(IMediaObject * This,
|
||||
unsigned long dwOutputStreamIndex,
|
||||
/* [out] */ unsigned long *pdwFlags);
|
||||
HRESULT STDCALL ( *GetInputType )(IMediaObject * This,
|
||||
unsigned long dwInputStreamIndex,
|
||||
unsigned long dwTypeIndex,
|
||||
/* [out] */ DMO_MEDIA_TYPE *pmt);
|
||||
HRESULT STDCALL ( *GetOutputType )(IMediaObject * This,
|
||||
unsigned long dwOutputStreamIndex,
|
||||
unsigned long dwTypeIndex,
|
||||
/* [out] */ DMO_MEDIA_TYPE *pmt);
|
||||
HRESULT STDCALL ( *SetInputType )(IMediaObject * This,
|
||||
unsigned long dwInputStreamIndex,
|
||||
/* [in] */ const DMO_MEDIA_TYPE *pmt,
|
||||
unsigned long dwFlags);
|
||||
HRESULT STDCALL ( *SetOutputType )(IMediaObject * This,
|
||||
unsigned long dwOutputStreamIndex,
|
||||
/* [in] */ const DMO_MEDIA_TYPE *pmt,
|
||||
unsigned long dwFlags);
|
||||
HRESULT STDCALL ( *GetInputCurrentType )(IMediaObject * This,
|
||||
unsigned long dwInputStreamIndex,
|
||||
/* [out] */ DMO_MEDIA_TYPE *pmt);
|
||||
HRESULT STDCALL ( *GetOutputCurrentType )(IMediaObject * This,
|
||||
unsigned long dwOutputStreamIndex,
|
||||
/* [out] */ DMO_MEDIA_TYPE *pmt);
|
||||
HRESULT STDCALL ( *GetInputSizeInfo )(IMediaObject * This,
|
||||
unsigned long dwInputStreamIndex,
|
||||
/* [out] */ unsigned long *pcbSize,
|
||||
/* [out] */ unsigned long *pcbMaxLookahead,
|
||||
/* [out] */ unsigned long *pcbAlignment);
|
||||
HRESULT STDCALL ( *GetOutputSizeInfo )(IMediaObject * This,
|
||||
unsigned long dwOutputStreamIndex,
|
||||
/* [out] */ unsigned long *pcbSize,
|
||||
/* [out] */ unsigned long *pcbAlignment);
|
||||
HRESULT STDCALL ( *GetInputMaxLatency )(IMediaObject * This,
|
||||
unsigned long dwInputStreamIndex,
|
||||
/* [out] */ REFERENCE_TIME *prtMaxLatency);
|
||||
HRESULT STDCALL ( *SetInputMaxLatency )(IMediaObject * This,
|
||||
unsigned long dwInputStreamIndex,
|
||||
REFERENCE_TIME rtMaxLatency);
|
||||
HRESULT STDCALL ( *Flush )(IMediaObject * This);
|
||||
HRESULT STDCALL ( *Discontinuity )(IMediaObject * This,
|
||||
unsigned long dwInputStreamIndex);
|
||||
HRESULT STDCALL ( *AllocateStreamingResources )(IMediaObject * This);
|
||||
HRESULT STDCALL ( *FreeStreamingResources )(IMediaObject * This);
|
||||
HRESULT STDCALL ( *GetInputStatus )(IMediaObject * This,
|
||||
unsigned long dwInputStreamIndex,
|
||||
/* [out] */ unsigned long *dwFlags);
|
||||
HRESULT STDCALL ( *ProcessInput )(IMediaObject * This,
|
||||
unsigned long dwInputStreamIndex,
|
||||
IMediaBuffer *pBuffer,
|
||||
unsigned long dwFlags,
|
||||
REFERENCE_TIME rtTimestamp,
|
||||
REFERENCE_TIME rtTimelength);
|
||||
HRESULT STDCALL ( *ProcessOutput )(IMediaObject * This,
|
||||
unsigned long dwFlags,
|
||||
unsigned long cOutputBufferCount,
|
||||
/* [size_is][out][in] */ DMO_OUTPUT_DATA_BUFFER *pOutputBuffers,
|
||||
/* [out] */ unsigned long *pdwStatus);
|
||||
HRESULT STDCALL ( *Lock )(IMediaObject * This, long bLock);
|
||||
} IMediaObject_vt;
|
||||
struct IMediaObject { IMediaObject_vt* vt; };
|
||||
|
||||
/*
|
||||
* IEnumDMO interface
|
||||
*/
|
||||
typedef struct IEnumDMO IEnumDMO;
|
||||
typedef struct IEnumDMO_vt
|
||||
{
|
||||
INHERIT_IUNKNOWN();
|
||||
|
||||
HRESULT STDCALL ( *Next )(IEnumDMO * This,
|
||||
unsigned long cItemsToFetch,
|
||||
/* [length_is][size_is][out] */ CLSID *pCLSID,
|
||||
/* [string][length_is][size_is][out] */ WCHAR **Names,
|
||||
/* [out] */ unsigned long *pcItemsFetched);
|
||||
HRESULT STDCALL ( *Skip )(IEnumDMO * This,
|
||||
unsigned long cItemsToSkip);
|
||||
HRESULT STDCALL ( *Reset )(IEnumDMO * This);
|
||||
HRESULT STDCALL ( *Clone )(IEnumDMO * This,
|
||||
/* [out] */ IEnumDMO **ppEnum);
|
||||
} IEnumDMO_vt;
|
||||
struct IEnumDMO { IEnumDMO_vt* vt; };
|
||||
|
||||
/*
|
||||
* IMediaObjectInPlace interface
|
||||
*/
|
||||
typedef struct IMediaObjectInPlace IMediaObjectInPlace;
|
||||
typedef struct IMediaObjectInPlace_vt
|
||||
{
|
||||
INHERIT_IUNKNOWN();
|
||||
|
||||
HRESULT STDCALL ( *Process )(IMediaObjectInPlace * This,
|
||||
/* [in] */ unsigned long ulSize,
|
||||
/* [size_is][out][in] */ BYTE *pData,
|
||||
/* [in] */ REFERENCE_TIME refTimeStart,
|
||||
/* [in] */ unsigned long dwFlags);
|
||||
HRESULT STDCALL ( *Clone )(IMediaObjectInPlace * This,
|
||||
/* [out] */ IMediaObjectInPlace **ppMediaObject);
|
||||
HRESULT STDCALL ( *GetLatency )(IMediaObjectInPlace * This,
|
||||
/* [out] */ REFERENCE_TIME *pLatencyTime);
|
||||
|
||||
} IMediaObjectInPlace_vt;
|
||||
struct IMediaObjectInPlace { IMediaObjectInPlace_vt* vt; };
|
||||
|
||||
|
||||
/*
|
||||
* IDMOQualityControl interface
|
||||
*/
|
||||
typedef struct IDMOQualityControl IDMOQualityControl;
|
||||
typedef struct IDMOQualityControl_vt
|
||||
{
|
||||
INHERIT_IUNKNOWN();
|
||||
|
||||
HRESULT STDCALL ( *SetNow )(IDMOQualityControl * This,
|
||||
/* [in] */ REFERENCE_TIME rtNow);
|
||||
HRESULT STDCALL ( *SetStatus )(IDMOQualityControl * This,
|
||||
/* [in] */ unsigned long dwFlags);
|
||||
HRESULT STDCALL ( *GetStatus )(IDMOQualityControl * This,
|
||||
/* [out] */ unsigned long *pdwFlags);
|
||||
} IDMOQualityControl_vt;
|
||||
struct IDMOQualityControl { IDMOQualityControl_vt* vt; };
|
||||
|
||||
/*
|
||||
* IDMOVideoOutputOptimizations interface
|
||||
*/
|
||||
typedef struct IDMOVideoOutputOptimizations IDMOVideoOutputOptimizations;
|
||||
typedef struct IDMOVideoOutputOptimizations_vt
|
||||
{
|
||||
INHERIT_IUNKNOWN();
|
||||
|
||||
HRESULT STDCALL ( *QueryOperationModePreferences )(IDMOVideoOutputOptimizations * This,
|
||||
unsigned long ulOutputStreamIndex,
|
||||
unsigned long *pdwRequestedCapabilities);
|
||||
HRESULT STDCALL ( *SetOperationMode )(IDMOVideoOutputOptimizations * This,
|
||||
unsigned long ulOutputStreamIndex,
|
||||
unsigned long dwEnabledFeatures);
|
||||
HRESULT STDCALL ( *GetCurrentOperationMode )(IDMOVideoOutputOptimizations * This,
|
||||
unsigned long ulOutputStreamIndex,
|
||||
unsigned long *pdwEnabledFeatures);
|
||||
HRESULT STDCALL ( *GetCurrentSampleRequirements )(IDMOVideoOutputOptimizations * This,
|
||||
unsigned long ulOutputStreamIndex,
|
||||
unsigned long *pdwRequestedFeatures);
|
||||
} IDMOVideoOutputOptimizations_vt;
|
||||
struct IDMOVideoOutputOptimizations { IDMOVideoOutputOptimizations_vt* vt; };
|
||||
|
||||
#endif /* MPLAYER_DMO_INTERFACES_H */
|
||||
-176
@@ -1,176 +0,0 @@
|
||||
/*
|
||||
* Modified for use with MPlayer, detailed changelog at
|
||||
* http://svn.mplayerhq.hu/mplayer/trunk/
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "debug.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#ifdef __FreeBSD__
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
#include "win32.h"
|
||||
#include "wine/driver.h"
|
||||
#include "wine/pe_image.h"
|
||||
#include "wine/winreg.h"
|
||||
#include "wine/vfw.h"
|
||||
#include "registry.h"
|
||||
#ifdef WIN32_LOADER
|
||||
#include "ldt_keeper.h"
|
||||
#endif
|
||||
#include "drv.h"
|
||||
#ifndef __MINGW32__
|
||||
#include "ext.h"
|
||||
#endif
|
||||
#include "path.h"
|
||||
|
||||
#if 1
|
||||
|
||||
/*
|
||||
* STORE_ALL/REST_ALL seems like an attempt to workaround problems due to
|
||||
* WINAPI/no-WINAPI bustage.
|
||||
*
|
||||
* There should be no need for the STORE_ALL/REST_ALL hack once all
|
||||
* function definitions agree with their prototypes (WINAPI-wise) and
|
||||
* we make sure, that we do not call these functions without a proper
|
||||
* prototype in scope.
|
||||
*/
|
||||
|
||||
#define STORE_ALL
|
||||
#define REST_ALL
|
||||
#else
|
||||
// this asm code is no longer needed
|
||||
#define STORE_ALL \
|
||||
__asm__ volatile ( \
|
||||
"push %%ebx\n\t" \
|
||||
"push %%ecx\n\t" \
|
||||
"push %%edx\n\t" \
|
||||
"push %%esi\n\t" \
|
||||
"push %%edi\n\t"::)
|
||||
|
||||
#define REST_ALL \
|
||||
__asm__ volatile ( \
|
||||
"pop %%edi\n\t" \
|
||||
"pop %%esi\n\t" \
|
||||
"pop %%edx\n\t" \
|
||||
"pop %%ecx\n\t" \
|
||||
"pop %%ebx\n\t"::)
|
||||
#endif
|
||||
|
||||
static DWORD dwDrvID = 0;
|
||||
|
||||
LRESULT WINAPI SendDriverMessage(HDRVR hDriver, UINT message,
|
||||
LPARAM lParam1, LPARAM lParam2)
|
||||
{
|
||||
DRVR* module=(DRVR*)hDriver;
|
||||
int result;
|
||||
#ifndef __svr4__
|
||||
char qw[300];
|
||||
#endif
|
||||
#ifdef DETAILED_OUT
|
||||
printf("SendDriverMessage: driver %X, message %X, arg1 %X, arg2 %X\n", hDriver, message, lParam1, lParam2);
|
||||
#endif
|
||||
if (!module || !module->hDriverModule || !module->DriverProc) return -1;
|
||||
#ifndef __svr4__
|
||||
__asm__ volatile ("fsave (%0)\n\t": :"r"(&qw));
|
||||
#endif
|
||||
|
||||
#ifdef WIN32_LOADER
|
||||
Setup_FS_Segment();
|
||||
#endif
|
||||
|
||||
STORE_ALL;
|
||||
result=module->DriverProc(module->dwDriverID, hDriver, message, lParam1, lParam2);
|
||||
REST_ALL;
|
||||
|
||||
#ifndef __svr4__
|
||||
__asm__ volatile ("frstor (%0)\n\t": :"r"(&qw));
|
||||
#endif
|
||||
|
||||
#ifdef DETAILED_OUT
|
||||
printf("\t\tResult: %X\n", result);
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
void DrvClose(HDRVR hDriver)
|
||||
{
|
||||
if (hDriver)
|
||||
{
|
||||
DRVR* d = (DRVR*)hDriver;
|
||||
if (d->hDriverModule)
|
||||
{
|
||||
#ifdef WIN32_LOADER
|
||||
Setup_FS_Segment();
|
||||
#endif
|
||||
if (d->DriverProc)
|
||||
{
|
||||
SendDriverMessage(hDriver, DRV_CLOSE, 0, 0);
|
||||
d->dwDriverID = 0;
|
||||
SendDriverMessage(hDriver, DRV_FREE, 0, 0);
|
||||
}
|
||||
FreeLibrary(d->hDriverModule);
|
||||
}
|
||||
free(d);
|
||||
}
|
||||
#ifdef WIN32_LOADER
|
||||
CodecRelease();
|
||||
#endif
|
||||
}
|
||||
|
||||
//DrvOpen(LPCSTR lpszDriverName, LPCSTR lpszSectionName, LPARAM lParam2)
|
||||
HDRVR DrvOpen(LPARAM lParam2)
|
||||
{
|
||||
NPDRVR hDriver;
|
||||
char unknown[0x124];
|
||||
const char* filename = (const char*) ((ICOPEN*) lParam2)->pV1Reserved;
|
||||
|
||||
#ifdef WIN32_LOADER
|
||||
Setup_LDT_Keeper();
|
||||
#endif
|
||||
printf("Loading codec DLL: '%s'\n",filename);
|
||||
|
||||
hDriver = malloc(sizeof(DRVR));
|
||||
if (!hDriver)
|
||||
return (HDRVR) 0;
|
||||
memset((void*)hDriver, 0, sizeof(DRVR));
|
||||
|
||||
#ifdef WIN32_LOADER
|
||||
CodecAlloc();
|
||||
Setup_FS_Segment();
|
||||
#endif
|
||||
|
||||
hDriver->hDriverModule = LoadLibraryA(filename);
|
||||
if (!hDriver->hDriverModule)
|
||||
{
|
||||
printf("Can't open library %s\n", filename);
|
||||
DrvClose((HDRVR)hDriver);
|
||||
return (HDRVR) 0;
|
||||
}
|
||||
|
||||
hDriver->DriverProc = (DRIVERPROC) GetProcAddress(hDriver->hDriverModule,
|
||||
"DriverProc");
|
||||
if (!hDriver->DriverProc)
|
||||
{
|
||||
printf("Library %s is not a valid VfW/ACM codec\n", filename);
|
||||
DrvClose((HDRVR)hDriver);
|
||||
return (HDRVR) 0;
|
||||
}
|
||||
|
||||
TRACE("DriverProc == %X\n", hDriver->DriverProc);
|
||||
SendDriverMessage((HDRVR)hDriver, DRV_LOAD, 0, 0);
|
||||
TRACE("DRV_LOAD Ok!\n");
|
||||
SendDriverMessage((HDRVR)hDriver, DRV_ENABLE, 0, 0);
|
||||
TRACE("DRV_ENABLE Ok!\n");
|
||||
hDriver->dwDriverID = ++dwDrvID; // generate new id
|
||||
|
||||
// open driver and remmeber proper DriverID
|
||||
hDriver->dwDriverID = SendDriverMessage((HDRVR)hDriver, DRV_OPEN, (LPARAM) unknown, lParam2);
|
||||
TRACE("DRV_OPEN Ok!(%X)\n", hDriver->dwDriverID);
|
||||
|
||||
printf("Loaded DLL driver %s at %x\n", filename, hDriver->hDriverModule);
|
||||
return (HDRVR)hDriver;
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
/*
|
||||
* Modified for use with MPlayer, detailed changelog at
|
||||
* http://svn.mplayerhq.hu/mplayer/trunk/
|
||||
*/
|
||||
|
||||
#ifndef MPLAYER_DRV_H
|
||||
#define MPLAYER_DRV_H
|
||||
|
||||
#include "wine/windef.h"
|
||||
#include "wine/driver.h"
|
||||
|
||||
void CodecAlloc(void);
|
||||
void CodecRelease(void);
|
||||
|
||||
HDRVR DrvOpen(LPARAM lParam2);
|
||||
void DrvClose(HDRVR hdrvr);
|
||||
|
||||
#endif /* MPLAYER_DRV_H */
|
||||
@@ -1,192 +0,0 @@
|
||||
/********************************************************
|
||||
|
||||
DirectShow audio decoder
|
||||
Copyright 2001 Eugene Kuznetsov (divx@euro.ru)
|
||||
|
||||
*********************************************************/
|
||||
#include "config.h"
|
||||
|
||||
#include "libwin32.h"
|
||||
|
||||
#include "DS_Filter.h"
|
||||
|
||||
struct DS_AudioDecoder
|
||||
{
|
||||
WAVEFORMATEX in_fmt;
|
||||
AM_MEDIA_TYPE m_sOurType, m_sDestType;
|
||||
DS_Filter* m_pDS_Filter;
|
||||
char* m_sVhdr;
|
||||
char* m_sVhdr2;
|
||||
};
|
||||
|
||||
#include "DS_AudioDecoder.h"
|
||||
#ifdef WIN32_LOADER
|
||||
#include "loader/ldt_keeper.h"
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef long STDCALL (*GETCLASS) (GUID*, GUID*, void**);
|
||||
|
||||
static SampleProcUserData sampleProcData;
|
||||
|
||||
|
||||
DS_AudioDecoder * DS_AudioDecoder_Open(char* dllname, GUID* guid, WAVEFORMATEX* wf)
|
||||
//DS_AudioDecoder * DS_AudioDecoder_Create(const CodecInfo * info, const WAVEFORMATEX* wf)
|
||||
{
|
||||
DS_AudioDecoder *this;
|
||||
int sz;
|
||||
WAVEFORMATEX* pWF;
|
||||
|
||||
#ifdef WIN32_LOADER
|
||||
Setup_LDT_Keeper();
|
||||
Setup_FS_Segment();
|
||||
#endif
|
||||
|
||||
this = malloc(sizeof(DS_AudioDecoder));
|
||||
|
||||
sz = 18 + wf->cbSize;
|
||||
this->m_sVhdr = malloc(sz);
|
||||
memcpy(this->m_sVhdr, wf, sz);
|
||||
this->m_sVhdr2 = malloc(18);
|
||||
memcpy(this->m_sVhdr2, this->m_sVhdr, 18);
|
||||
|
||||
pWF = (WAVEFORMATEX*)this->m_sVhdr2;
|
||||
pWF->wFormatTag = 1;
|
||||
pWF->wBitsPerSample = 16;
|
||||
pWF->nBlockAlign = pWF->nChannels * (pWF->wBitsPerSample + 7) / 8;
|
||||
pWF->cbSize = 0;
|
||||
pWF->nAvgBytesPerSec = pWF->nBlockAlign * pWF->nSamplesPerSec;
|
||||
|
||||
memcpy(&this->in_fmt,wf,sizeof(WAVEFORMATEX));
|
||||
|
||||
memset(&this->m_sOurType, 0, sizeof(this->m_sOurType));
|
||||
this->m_sOurType.majortype=MEDIATYPE_Audio;
|
||||
this->m_sOurType.subtype=MEDIASUBTYPE_PCM;
|
||||
this->m_sOurType.subtype.f1=wf->wFormatTag;
|
||||
this->m_sOurType.formattype=FORMAT_WaveFormatEx;
|
||||
this->m_sOurType.lSampleSize=wf->nBlockAlign;
|
||||
this->m_sOurType.bFixedSizeSamples=1;
|
||||
this->m_sOurType.bTemporalCompression=0;
|
||||
this->m_sOurType.pUnk=0;
|
||||
this->m_sOurType.cbFormat=sz;
|
||||
this->m_sOurType.pbFormat=this->m_sVhdr;
|
||||
|
||||
memset(&this->m_sDestType, 0, sizeof(this->m_sDestType));
|
||||
this->m_sDestType.majortype=MEDIATYPE_Audio;
|
||||
this->m_sDestType.subtype=MEDIASUBTYPE_PCM;
|
||||
// this->m_sDestType.subtype.f1=pWF->wFormatTag;
|
||||
this->m_sDestType.formattype=FORMAT_WaveFormatEx;
|
||||
this->m_sDestType.bFixedSizeSamples=1;
|
||||
this->m_sDestType.bTemporalCompression=0;
|
||||
this->m_sDestType.lSampleSize=pWF->nBlockAlign;
|
||||
if (wf->wFormatTag == 0x130)
|
||||
// ACEL hack to prevent memory corruption
|
||||
// obviosly we are missing something here
|
||||
this->m_sDestType.lSampleSize *= 288;
|
||||
this->m_sDestType.pUnk=0;
|
||||
this->m_sDestType.cbFormat=18; //pWF->cbSize;
|
||||
this->m_sDestType.pbFormat=this->m_sVhdr2;
|
||||
|
||||
//print_wave_header(this->m_sVhdr, MSGL_V);
|
||||
//print_wave_header(this->m_sVhdr2, MSGL_V);
|
||||
|
||||
/*try*/
|
||||
{
|
||||
this->m_pDS_Filter = DS_FilterCreate(dllname, guid, &this->m_sOurType, &this->m_sDestType,&sampleProcData);
|
||||
if( !this->m_pDS_Filter ) {
|
||||
free(this);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//Commit should be done before binary codec start
|
||||
this->m_pDS_Filter->m_pAll->vt->Commit(this->m_pDS_Filter->m_pAll);
|
||||
|
||||
this->m_pDS_Filter->Start(this->m_pDS_Filter);
|
||||
|
||||
}
|
||||
/*
|
||||
catch (FatalError& e)
|
||||
{
|
||||
e.PrintAll();
|
||||
delete[] m_sVhdr;
|
||||
delete[] m_sVhdr2;
|
||||
delete m_pDS_Filter;
|
||||
throw;
|
||||
}
|
||||
*/
|
||||
return this;
|
||||
}
|
||||
|
||||
void DS_AudioDecoder_Destroy(DS_AudioDecoder *this)
|
||||
{
|
||||
free(this->m_sVhdr);
|
||||
free(this->m_sVhdr2);
|
||||
DS_Filter_Destroy(this->m_pDS_Filter);
|
||||
free(this);
|
||||
}
|
||||
|
||||
int DS_AudioDecoder_Convert(DS_AudioDecoder *this, const void* in_data, unsigned int in_size,
|
||||
void* out_data, unsigned int out_size,
|
||||
unsigned int* size_read, unsigned int* size_written)
|
||||
{
|
||||
unsigned int written = 0;
|
||||
unsigned int read = 0;
|
||||
|
||||
if (!in_data || !out_data)
|
||||
return -1;
|
||||
|
||||
#ifdef WIN32_LOADER
|
||||
Setup_FS_Segment();
|
||||
#endif
|
||||
|
||||
in_size -= in_size%this->in_fmt.nBlockAlign;
|
||||
while (in_size>0)
|
||||
{
|
||||
IMediaSample* sample=0;
|
||||
char* ptr;
|
||||
int result;
|
||||
this->m_pDS_Filter->m_pAll->vt->GetBuffer(this->m_pDS_Filter->m_pAll, &sample, 0, 0, 0);
|
||||
if (!sample)
|
||||
{
|
||||
Debug printf("DS_AudioDecoder::Convert() Error: null sample\n");
|
||||
break;
|
||||
}
|
||||
sample->vt->SetActualDataLength(sample, this->in_fmt.nBlockAlign);
|
||||
sample->vt->GetPointer(sample, (BYTE **)&ptr);
|
||||
memcpy(ptr, (const uint8_t*)in_data + read, this->in_fmt.nBlockAlign);
|
||||
sample->vt->SetSyncPoint(sample, 1);
|
||||
sample->vt->SetPreroll(sample, 0);
|
||||
result = this->m_pDS_Filter->m_pImp->vt->Receive(this->m_pDS_Filter->m_pImp, sample);
|
||||
if (result)
|
||||
Debug printf("DS_AudioDecoder::Convert() Error: putting data into input pin %x\n", result);
|
||||
if ((written + sampleProcData.frame_size) > out_size)
|
||||
{
|
||||
sample->vt->Release((IUnknown*)sample);
|
||||
break;
|
||||
}
|
||||
memcpy((uint8_t*)out_data + written, sampleProcData.frame_pointer, sampleProcData.frame_size);
|
||||
sample->vt->Release((IUnknown*)sample);
|
||||
read+=this->in_fmt.nBlockAlign;
|
||||
written+=sampleProcData.frame_size;
|
||||
break;
|
||||
}
|
||||
if (size_read)
|
||||
*size_read = read;
|
||||
if (size_written)
|
||||
*size_written = written;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int DS_AudioDecoder_GetSrcSize(DS_AudioDecoder *this, int dest_size)
|
||||
{
|
||||
double efficiency =(double) this->in_fmt.nAvgBytesPerSec
|
||||
/ (this->in_fmt.nSamplesPerSec*this->in_fmt.nBlockAlign);
|
||||
int frames = (int)(dest_size*efficiency);
|
||||
|
||||
if (frames < 1)
|
||||
frames = 1;
|
||||
return frames * this->in_fmt.nBlockAlign;
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
#ifndef MPLAYER_DS_AUDIODECODER_H
|
||||
#define MPLAYER_DS_AUDIODECODER_H
|
||||
|
||||
#include "loader/com.h"
|
||||
#include "loader/wine/mmreg.h"
|
||||
|
||||
typedef struct DS_AudioDecoder DS_AudioDecoder;
|
||||
|
||||
//DS_AudioDecoder * DS_AudioDecoder_Create(const CodecInfo * info, const WAVEFORMATEX* wf);
|
||||
DS_AudioDecoder * DS_AudioDecoder_Open(char* dllname, GUID* guid, WAVEFORMATEX* wf);
|
||||
|
||||
void DS_AudioDecoder_Destroy(DS_AudioDecoder *this);
|
||||
|
||||
int DS_AudioDecoder_Convert(DS_AudioDecoder *this, const void* in_data, unsigned int in_size,
|
||||
void* out_data, unsigned int out_size,
|
||||
unsigned int* size_read, unsigned int* size_written);
|
||||
|
||||
int DS_AudioDecoder_GetSrcSize(DS_AudioDecoder *this, int dest_size);
|
||||
|
||||
#endif /* MPLAYER_DS_AUDIODECODER_H */
|
||||
@@ -1,318 +0,0 @@
|
||||
/*
|
||||
* Modified for use with MPlayer, detailed changelog at
|
||||
* http://svn.mplayerhq.hu/mplayer/trunk/
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "DS_Filter.h"
|
||||
#include "graph.h"
|
||||
#include "loader/drv.h"
|
||||
#include "loader/com.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include "loader/win32.h" // printf macro
|
||||
|
||||
typedef long STDCALL (*GETCLASS) (const GUID*, const GUID*, void**);
|
||||
|
||||
#ifndef WIN32_LOADER
|
||||
const GUID IID_IUnknown =
|
||||
{
|
||||
0x00000000, 0x0000, 0x0000,
|
||||
{0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46}
|
||||
};
|
||||
const GUID IID_IClassFactory =
|
||||
{
|
||||
0x00000001, 0x0000, 0x0000,
|
||||
{0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46}
|
||||
};
|
||||
|
||||
HRESULT STDCALL CoInitialize(LPVOID pvReserved);
|
||||
void STDCALL CoUninitialize(void);
|
||||
#endif
|
||||
|
||||
static void DS_Filter_Start(DS_Filter* This)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
//Debug printf("DS_Filter_Start(%p)\n", This);
|
||||
hr = This->m_pFilter->vt->Run(This->m_pFilter, (REFERENCE_TIME)0);
|
||||
if (hr != 0)
|
||||
{
|
||||
Debug printf("WARNING: m_Filter->Run() failed, error code %x\n", (int)hr);
|
||||
}
|
||||
}
|
||||
|
||||
static void DS_Filter_Stop(DS_Filter* This)
|
||||
{
|
||||
if (This->m_pAll)
|
||||
{
|
||||
//Debug printf("DS_Filter_Stop(%p)\n", This);
|
||||
This->m_pFilter->vt->Stop(This->m_pFilter); // causes weird crash ??? FIXME
|
||||
This->m_pAll->vt->Release((IUnknown*)This->m_pAll);
|
||||
This->m_pAll = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void DS_Filter_Destroy(DS_Filter* This)
|
||||
{
|
||||
This->Stop(This);
|
||||
|
||||
if (This->m_pOurInput)
|
||||
This->m_pOurInput->vt->Release((IUnknown*)This->m_pOurInput);
|
||||
if (This->m_pInputPin)
|
||||
This->m_pInputPin->vt->Disconnect(This->m_pInputPin);
|
||||
if (This->m_pOutputPin)
|
||||
This->m_pOutputPin->vt->Disconnect(This->m_pOutputPin);
|
||||
if (This->m_pFilter)
|
||||
This->m_pFilter->vt->Release((IUnknown*)This->m_pFilter);
|
||||
if (This->m_pOutputPin)
|
||||
This->m_pOutputPin->vt->Release((IUnknown*)This->m_pOutputPin);
|
||||
if (This->m_pInputPin)
|
||||
This->m_pInputPin->vt->Release((IUnknown*)This->m_pInputPin);
|
||||
if (This->m_pImp)
|
||||
This->m_pImp->vt->Release((IUnknown*)This->m_pImp);
|
||||
|
||||
if (This->m_pOurOutput)
|
||||
This->m_pOurOutput->vt->Release((IUnknown*)This->m_pOurOutput);
|
||||
if (This->m_pParentFilter)
|
||||
This->m_pParentFilter->vt->Release((IUnknown*)This->m_pParentFilter);
|
||||
if (This->m_pSrcFilter)
|
||||
This->m_pSrcFilter->vt->Release((IUnknown*)This->m_pSrcFilter);
|
||||
|
||||
// FIXME - we are still leaving few things allocated!
|
||||
if (This->m_iHandle)
|
||||
FreeLibrary((unsigned)This->m_iHandle);
|
||||
|
||||
free(This);
|
||||
|
||||
#ifdef WIN32_LOADER
|
||||
CodecRelease();
|
||||
#else
|
||||
CoUninitialize();
|
||||
#endif
|
||||
}
|
||||
|
||||
static HRESULT STDCALL DS_Filter_CopySample(void* pUserData,IMediaSample* pSample){
|
||||
BYTE* pointer;
|
||||
int len;
|
||||
SampleProcUserData* pData=pUserData;
|
||||
Debug printf("CopySample called(%p,%p)\n",pSample,pUserData);
|
||||
if (pSample->vt->GetPointer(pSample, &pointer))
|
||||
return 1;
|
||||
len = pSample->vt->GetActualDataLength(pSample);
|
||||
if (len == 0)
|
||||
len = pSample->vt->GetSize(pSample);//for iv50
|
||||
|
||||
pData->frame_pointer = pointer;
|
||||
pData->frame_size = len;
|
||||
/*
|
||||
FILE* file=fopen("./uncompr.bmp", "wb");
|
||||
char head[14]={0x42, 0x4D, 0x36, 0x10, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00};
|
||||
*(int*)(&head[2])=len+0x36;
|
||||
fwrite(head, 14, 1, file);
|
||||
fwrite(&((VIDEOINFOHEADER*)me.type.pbFormat)->bmiHeader, sizeof(BITMAPINFOHEADER), 1, file);
|
||||
fwrite(pointer, len, 1, file);
|
||||
fclose(file);
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
DS_Filter* DS_FilterCreate(const char* dllname, const GUID* id,
|
||||
AM_MEDIA_TYPE* in_fmt,
|
||||
AM_MEDIA_TYPE* out_fmt,SampleProcUserData* pUserData)
|
||||
{
|
||||
int init = 0;
|
||||
// char eb[250];
|
||||
const char* em = NULL;
|
||||
MemAllocator* tempAll;
|
||||
FilterGraph* graph;
|
||||
ALLOCATOR_PROPERTIES props,props1;
|
||||
DS_Filter* This = malloc(sizeof(DS_Filter));
|
||||
if (!This)
|
||||
return NULL;
|
||||
|
||||
#ifdef WIN32_LOADER
|
||||
CodecAlloc();
|
||||
#else
|
||||
CoInitialize(0L);
|
||||
#endif
|
||||
|
||||
/*
|
||||
tempAll is not used anywhere.
|
||||
MemAllocatorCreate() is called to ensure that RegisterComObject for IMemoryAllocator
|
||||
will be called before possible call
|
||||
to CoCreateInstance(...,&IID_IMemoryAllocator,...) from binary codec.
|
||||
*/
|
||||
tempAll=MemAllocatorCreate();
|
||||
This->m_pFilter = NULL;
|
||||
This->m_pInputPin = NULL;
|
||||
This->m_pOutputPin = NULL;
|
||||
This->m_pSrcFilter = NULL;
|
||||
This->m_pParentFilter = NULL;
|
||||
This->m_pOurInput = NULL;
|
||||
This->m_pOurOutput = NULL;
|
||||
This->m_pAll = NULL;
|
||||
This->m_pImp = NULL;
|
||||
|
||||
This->Start = DS_Filter_Start;
|
||||
This->Stop = DS_Filter_Stop;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
GETCLASS func;
|
||||
struct IClassFactory* factory = NULL;
|
||||
struct IUnknown* object = NULL;
|
||||
IEnumPins* enum_pins = 0;
|
||||
IPin* array[256];
|
||||
ULONG fetched;
|
||||
HRESULT result;
|
||||
unsigned int i;
|
||||
static const uint16_t filter_name[] = { 'F', 'i', 'l', 't', 'e', 'r', 0 };
|
||||
|
||||
This->m_iHandle = LoadLibraryA(dllname);
|
||||
if (!This->m_iHandle)
|
||||
{
|
||||
em = "could not open DirectShow DLL";
|
||||
break;
|
||||
}
|
||||
func = (GETCLASS)GetProcAddress((unsigned)This->m_iHandle, "DllGetClassObject");
|
||||
if (!func)
|
||||
{
|
||||
em = "illegal or corrupt DirectShow DLL";
|
||||
break;
|
||||
}
|
||||
result = func(id, &IID_IClassFactory, (void*)&factory);
|
||||
if (result || !factory)
|
||||
{
|
||||
em = "no such class object";
|
||||
break;
|
||||
}
|
||||
result = factory->vt->CreateInstance(factory, 0, &IID_IUnknown, (void*)&object);
|
||||
factory->vt->Release((IUnknown*)factory);
|
||||
if (result || !object)
|
||||
{
|
||||
em = "class factory failure";
|
||||
break;
|
||||
}
|
||||
result = object->vt->QueryInterface(object, &IID_IBaseFilter, (void*)&This->m_pFilter);
|
||||
object->vt->Release((IUnknown*)object);
|
||||
if (result || !This->m_pFilter)
|
||||
{
|
||||
em = "object does not provide IBaseFilter interface";
|
||||
break;
|
||||
}
|
||||
|
||||
graph = FilterGraphCreate();
|
||||
result = This->m_pFilter->vt->JoinFilterGraph(This->m_pFilter, (IFilterGraph*)graph, filter_name);
|
||||
|
||||
// enumerate pins
|
||||
result = This->m_pFilter->vt->EnumPins(This->m_pFilter, &enum_pins);
|
||||
if (result || !enum_pins)
|
||||
{
|
||||
em = "could not enumerate pins";
|
||||
break;
|
||||
}
|
||||
|
||||
enum_pins->vt->Reset(enum_pins);
|
||||
result = enum_pins->vt->Next(enum_pins, (ULONG)256, (IPin**)array, &fetched);
|
||||
enum_pins->vt->Release((IUnknown*)enum_pins);
|
||||
Debug printf("Pins enumeration returned %ld pins, error is %x\n", fetched, (int)result);
|
||||
|
||||
for (i = 0; i < fetched; i++)
|
||||
{
|
||||
PIN_DIRECTION direction = -1;
|
||||
array[i]->vt->QueryDirection(array[i], &direction);
|
||||
if (!This->m_pInputPin && direction == PINDIR_INPUT)
|
||||
{
|
||||
This->m_pInputPin = array[i];
|
||||
This->m_pInputPin->vt->AddRef((IUnknown*)This->m_pInputPin);
|
||||
}
|
||||
if (!This->m_pOutputPin && direction == PINDIR_OUTPUT)
|
||||
{
|
||||
This->m_pOutputPin = array[i];
|
||||
This->m_pOutputPin->vt->AddRef((IUnknown*)This->m_pOutputPin);
|
||||
}
|
||||
array[i]->vt->Release((IUnknown*)(array[i]));
|
||||
}
|
||||
if (!This->m_pInputPin)
|
||||
{
|
||||
em = "could not find input pin";
|
||||
break;
|
||||
}
|
||||
if (!This->m_pOutputPin)
|
||||
{
|
||||
em = "could not find output pin";
|
||||
break;
|
||||
}
|
||||
result = This->m_pInputPin->vt->QueryInterface((IUnknown*)This->m_pInputPin,
|
||||
&IID_IMemInputPin,
|
||||
(void*)&This->m_pImp);
|
||||
if (result)
|
||||
{
|
||||
em = "could not get IMemInputPin interface";
|
||||
break;
|
||||
}
|
||||
|
||||
This->m_pOurType = in_fmt;
|
||||
This->m_pDestType = out_fmt;
|
||||
result = This->m_pInputPin->vt->QueryAccept(This->m_pInputPin, This->m_pOurType);
|
||||
if (result)
|
||||
{
|
||||
em = "source format is not accepted";
|
||||
break;
|
||||
}
|
||||
This->m_pParentFilter = CBaseFilter2Create();
|
||||
This->m_pSrcFilter = CBaseFilterCreate(This->m_pOurType, This->m_pParentFilter);
|
||||
This->m_pOurInput = This->m_pSrcFilter->GetPin(This->m_pSrcFilter);
|
||||
This->m_pOurInput->vt->AddRef((IUnknown*)This->m_pOurInput);
|
||||
|
||||
result = This->m_pInputPin->vt->ReceiveConnection(This->m_pInputPin,
|
||||
This->m_pOurInput,
|
||||
This->m_pOurType);
|
||||
if (result)
|
||||
{
|
||||
em = "could not connect to input pin";
|
||||
break;
|
||||
}
|
||||
result = This->m_pImp->vt->GetAllocator(This->m_pImp, &This->m_pAll);
|
||||
if (result || !This->m_pAll)
|
||||
{
|
||||
em="error getting IMemAllocator interface";
|
||||
break;
|
||||
}
|
||||
|
||||
//Seting allocator property according to our media type
|
||||
props.cBuffers=1;
|
||||
props.cbBuffer=This->m_pOurType->lSampleSize;
|
||||
props.cbAlign=1;
|
||||
props.cbPrefix=0;
|
||||
This->m_pAll->vt->SetProperties(This->m_pAll, &props, &props1);
|
||||
|
||||
//Notify remote pin about choosed allocator
|
||||
This->m_pImp->vt->NotifyAllocator(This->m_pImp, This->m_pAll, 0);
|
||||
|
||||
This->m_pOurOutput = COutputPinCreate(This->m_pDestType,DS_Filter_CopySample,pUserData);
|
||||
|
||||
result = This->m_pOutputPin->vt->ReceiveConnection(This->m_pOutputPin,
|
||||
(IPin*) This->m_pOurOutput,
|
||||
This->m_pDestType);
|
||||
if (result)
|
||||
{
|
||||
em = "could not connect to output pin";
|
||||
break;
|
||||
}
|
||||
|
||||
init++;
|
||||
break;
|
||||
}
|
||||
tempAll->vt->Release((IUnknown*)tempAll);
|
||||
|
||||
if (!init)
|
||||
{
|
||||
DS_Filter_Destroy(This);
|
||||
printf("Warning: DS_Filter() %s. (DLL=%.200s)\n", em, dllname);
|
||||
This = 0;
|
||||
}
|
||||
return This;
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
#ifndef MPLAYER_DS_FILTER_H
|
||||
#define MPLAYER_DS_FILTER_H
|
||||
|
||||
#include "inputpin.h"
|
||||
#include "outputpin.h"
|
||||
|
||||
typedef struct {
|
||||
char* frame_pointer;
|
||||
long frame_size;
|
||||
} SampleProcUserData;
|
||||
|
||||
/**
|
||||
User will allocate and fill format structures, call Create(),
|
||||
and then set up m_pAll.
|
||||
**/
|
||||
|
||||
typedef struct DS_Filter DS_Filter;
|
||||
struct DS_Filter
|
||||
{
|
||||
int m_iHandle;
|
||||
IBaseFilter* m_pFilter;
|
||||
IPin* m_pInputPin;
|
||||
IPin* m_pOutputPin;
|
||||
|
||||
CBaseFilter* m_pSrcFilter;
|
||||
CBaseFilter2* m_pParentFilter;
|
||||
IPin* m_pOurInput;
|
||||
COutputPin* m_pOurOutput;
|
||||
|
||||
AM_MEDIA_TYPE *m_pOurType, *m_pDestType;
|
||||
IMemAllocator* m_pAll;
|
||||
IMemInputPin* m_pImp;
|
||||
|
||||
void ( *Start )(DS_Filter*);
|
||||
void ( *Stop )(DS_Filter*);
|
||||
};
|
||||
|
||||
DS_Filter* DS_FilterCreate(const char* dllname, const GUID* id,
|
||||
AM_MEDIA_TYPE* in_fmt, AM_MEDIA_TYPE* out_fmt,SampleProcUserData* pUserData);
|
||||
void DS_Filter_Destroy(DS_Filter* This);
|
||||
|
||||
#endif /* MPLAYER_DS_FILTER_H */
|
||||
@@ -1,916 +0,0 @@
|
||||
/********************************************************
|
||||
|
||||
DirectShow Video decoder implementation
|
||||
Copyright 2000 Eugene Kuznetsov (divx@euro.ru)
|
||||
|
||||
*********************************************************/
|
||||
#include "config.h"
|
||||
#include "guids.h"
|
||||
#include "interfaces.h"
|
||||
#include "loader/registry.h"
|
||||
#include "libwin32.h"
|
||||
#include "DS_Filter.h"
|
||||
|
||||
struct DS_VideoDecoder
|
||||
{
|
||||
IVideoDecoder iv;
|
||||
|
||||
DS_Filter* m_pDS_Filter;
|
||||
AM_MEDIA_TYPE m_sOurType, m_sDestType;
|
||||
VIDEOINFOHEADER* m_sVhdr;
|
||||
VIDEOINFOHEADER* m_sVhdr2;
|
||||
int m_Caps;//CAPS m_Caps; // capabilities of DirectShow decoder
|
||||
int m_iLastQuality; // remember last quality as integer
|
||||
int m_iMinBuffers;
|
||||
int m_iMaxAuto;
|
||||
int m_bIsDivX; // for speed
|
||||
int m_bIsDivX4; // for speed
|
||||
};
|
||||
static SampleProcUserData sampleProcData;
|
||||
|
||||
#include "DS_VideoDecoder.h"
|
||||
|
||||
#include "loader/wine/winerror.h"
|
||||
#ifdef WIN32_LOADER
|
||||
#include "loader/ldt_keeper.h"
|
||||
#endif
|
||||
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#ifdef HAVE_SYS_MMAN_H
|
||||
#include <sys/mman.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h> // labs
|
||||
|
||||
// strcmp((const char*)info.dll,...) is used instead of (... == ...)
|
||||
// so Arpi could use char* pointer in his simplified DS_VideoDecoder class
|
||||
|
||||
#define false 0
|
||||
#define true 1
|
||||
|
||||
int DS_VideoDecoder_GetCapabilities(DS_VideoDecoder *this)
|
||||
{return this->m_Caps;}
|
||||
|
||||
typedef struct ct ct;
|
||||
|
||||
struct ct {
|
||||
unsigned int bits;
|
||||
fourcc_t fcc;
|
||||
const GUID *subtype;
|
||||
int cap;
|
||||
};
|
||||
|
||||
static ct check[] = {
|
||||
{16, fccYUY2, &MEDIASUBTYPE_YUY2, CAP_YUY2},
|
||||
{12, fccIYUV, &MEDIASUBTYPE_IYUV, CAP_IYUV},
|
||||
{16, fccUYVY, &MEDIASUBTYPE_UYVY, CAP_UYVY},
|
||||
{12, fccYV12, &MEDIASUBTYPE_YV12, CAP_YV12},
|
||||
//{16, fccYV12, &MEDIASUBTYPE_YV12, CAP_YV12},
|
||||
{16, fccYVYU, &MEDIASUBTYPE_YVYU, CAP_YVYU},
|
||||
{12, fccI420, &MEDIASUBTYPE_I420, CAP_I420},
|
||||
{9, fccYVU9, &MEDIASUBTYPE_YVU9, CAP_YVU9},
|
||||
{0, 0, 0, 0},
|
||||
};
|
||||
|
||||
|
||||
DS_VideoDecoder * DS_VideoDecoder_Open(char* dllname, GUID* guid, BITMAPINFOHEADER * format, int flip, int maxauto)
|
||||
{
|
||||
DS_VideoDecoder *this;
|
||||
HRESULT result;
|
||||
ct* c;
|
||||
|
||||
this = malloc(sizeof(DS_VideoDecoder));
|
||||
memset( this, 0, sizeof(DS_VideoDecoder));
|
||||
|
||||
this->m_sVhdr2 = 0;
|
||||
this->m_iLastQuality = -1;
|
||||
this->m_iMaxAuto = maxauto;
|
||||
|
||||
#ifdef WIN32_LOADER
|
||||
Setup_LDT_Keeper();
|
||||
#endif
|
||||
|
||||
//memset(&m_obh, 0, sizeof(m_obh));
|
||||
//m_obh.biSize = sizeof(m_obh);
|
||||
/*try*/
|
||||
{
|
||||
unsigned int bihs;
|
||||
|
||||
bihs = (format->biSize < (int) sizeof(BITMAPINFOHEADER)) ?
|
||||
sizeof(BITMAPINFOHEADER) : format->biSize;
|
||||
|
||||
this->iv.m_bh = malloc(bihs);
|
||||
memcpy(this->iv.m_bh, format, bihs);
|
||||
this->iv.m_bh->biSize = bihs;
|
||||
|
||||
this->iv.m_State = STOP;
|
||||
//this->iv.m_pFrame = 0;
|
||||
this->iv.m_Mode = DIRECT;
|
||||
this->iv.m_iDecpos = 0;
|
||||
this->iv.m_iPlaypos = -1;
|
||||
this->iv.m_fQuality = 0.0f;
|
||||
this->iv.m_bCapable16b = true;
|
||||
|
||||
bihs += sizeof(VIDEOINFOHEADER) - sizeof(BITMAPINFOHEADER);
|
||||
this->m_sVhdr = malloc(bihs);
|
||||
memset(this->m_sVhdr, 0, bihs);
|
||||
memcpy(&this->m_sVhdr->bmiHeader, this->iv.m_bh, this->iv.m_bh->biSize);
|
||||
this->m_sVhdr->rcSource.left = this->m_sVhdr->rcSource.top = 0;
|
||||
this->m_sVhdr->rcSource.right = this->m_sVhdr->bmiHeader.biWidth;
|
||||
this->m_sVhdr->rcSource.bottom = this->m_sVhdr->bmiHeader.biHeight;
|
||||
//this->m_sVhdr->rcSource.right = 0;
|
||||
//this->m_sVhdr->rcSource.bottom = 0;
|
||||
this->m_sVhdr->rcTarget = this->m_sVhdr->rcSource;
|
||||
|
||||
this->m_sOurType.majortype = MEDIATYPE_Video;
|
||||
this->m_sOurType.subtype = MEDIATYPE_Video;
|
||||
this->m_sOurType.subtype.f1 = this->m_sVhdr->bmiHeader.biCompression;
|
||||
this->m_sOurType.formattype = FORMAT_VideoInfo;
|
||||
this->m_sOurType.bFixedSizeSamples = false;
|
||||
this->m_sOurType.bTemporalCompression = true;
|
||||
this->m_sOurType.pUnk = 0;
|
||||
this->m_sOurType.cbFormat = bihs;
|
||||
this->m_sOurType.pbFormat = (char*)this->m_sVhdr;
|
||||
|
||||
this->m_sVhdr2 = malloc(sizeof(VIDEOINFOHEADER)+12);
|
||||
memcpy(this->m_sVhdr2, this->m_sVhdr, sizeof(VIDEOINFOHEADER));
|
||||
memset((char*)this->m_sVhdr2 + sizeof(VIDEOINFOHEADER), 0, 12);
|
||||
this->m_sVhdr2->bmiHeader.biCompression = 0;
|
||||
this->m_sVhdr2->bmiHeader.biBitCount = 24;
|
||||
|
||||
memset(&this->m_sDestType, 0, sizeof(this->m_sDestType));
|
||||
this->m_sDestType.majortype = MEDIATYPE_Video;
|
||||
this->m_sDestType.subtype = MEDIASUBTYPE_RGB24;
|
||||
this->m_sDestType.formattype = FORMAT_VideoInfo;
|
||||
this->m_sDestType.bFixedSizeSamples = true;
|
||||
this->m_sDestType.bTemporalCompression = false;
|
||||
this->m_sDestType.lSampleSize = labs(this->m_sVhdr2->bmiHeader.biWidth*this->m_sVhdr2->bmiHeader.biHeight
|
||||
* ((this->m_sVhdr2->bmiHeader.biBitCount + 7) / 8));
|
||||
this->m_sVhdr2->bmiHeader.biSizeImage = this->m_sDestType.lSampleSize;
|
||||
this->m_sDestType.pUnk = 0;
|
||||
this->m_sDestType.cbFormat = sizeof(VIDEOINFOHEADER);
|
||||
this->m_sDestType.pbFormat = (char*)this->m_sVhdr2;
|
||||
|
||||
memset(&this->iv.m_obh, 0, sizeof(this->iv.m_obh));
|
||||
memcpy(&this->iv.m_obh, this->iv.m_bh, sizeof(this->iv.m_obh) < (unsigned) this->iv.m_bh->biSize
|
||||
? sizeof(this->iv.m_obh) : (unsigned) this->iv.m_bh->biSize);
|
||||
this->iv.m_obh.biBitCount=24;
|
||||
this->iv.m_obh.biSize = sizeof(BITMAPINFOHEADER);
|
||||
this->iv.m_obh.biCompression = 0; //BI_RGB
|
||||
//this->iv.m_obh.biHeight = labs(this->iv.m_obh.biHeight);
|
||||
this->iv.m_obh.biSizeImage = labs(this->iv.m_obh.biWidth * this->iv.m_obh.biHeight)
|
||||
* ((this->iv.m_obh.biBitCount + 7) / 8);
|
||||
|
||||
|
||||
this->m_pDS_Filter = DS_FilterCreate(dllname, guid, &this->m_sOurType, &this->m_sDestType,&sampleProcData);
|
||||
|
||||
if (!this->m_pDS_Filter)
|
||||
{
|
||||
printf("Failed to create DirectShow filter\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!flip)
|
||||
{
|
||||
this->iv.m_obh.biHeight *= -1;
|
||||
this->m_sVhdr2->bmiHeader.biHeight = this->iv.m_obh.biHeight;
|
||||
result = this->m_pDS_Filter->m_pOutputPin->vt->QueryAccept(this->m_pDS_Filter->m_pOutputPin, &this->m_sDestType);
|
||||
if (result)
|
||||
{
|
||||
printf("Decoder does not support upside-down RGB frames\n");
|
||||
this->iv.m_obh.biHeight *= -1;
|
||||
this->m_sVhdr2->bmiHeader.biHeight = this->iv.m_obh.biHeight;
|
||||
}
|
||||
}
|
||||
|
||||
memcpy( &this->iv.m_decoder, &this->iv.m_obh, sizeof(this->iv.m_obh) );
|
||||
|
||||
switch (this->iv.m_bh->biCompression)
|
||||
{
|
||||
#if 0
|
||||
case fccDIV3:
|
||||
case fccDIV4:
|
||||
case fccDIV5:
|
||||
case fccDIV6:
|
||||
case fccMP42:
|
||||
case fccWMV2:
|
||||
//YV12 seems to be broken for DivX :-) codec
|
||||
// case fccIV50:
|
||||
//produces incorrect picture
|
||||
//m_Caps = (CAPS) (m_Caps & ~CAP_YV12);
|
||||
//m_Caps = CAP_UYVY;//CAP_YUY2; // | CAP_I420;
|
||||
//m_Caps = CAP_I420;
|
||||
this->m_Caps = (CAP_YUY2 | CAP_UYVY);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
|
||||
this->m_Caps = CAP_NONE;
|
||||
|
||||
printf("Decoder supports the following YUV formats: ");
|
||||
for (c = check; c->bits; c++)
|
||||
{
|
||||
this->m_sVhdr2->bmiHeader.biBitCount = c->bits;
|
||||
this->m_sVhdr2->bmiHeader.biCompression = c->fcc;
|
||||
this->m_sDestType.subtype = *c->subtype;
|
||||
result = this->m_pDS_Filter->m_pOutputPin->vt->QueryAccept(this->m_pDS_Filter->m_pOutputPin, &this->m_sDestType);
|
||||
if (!result)
|
||||
{
|
||||
this->m_Caps = (this->m_Caps | c->cap);
|
||||
printf("%.4s ", (char *)&c->fcc);
|
||||
}
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
if (this->m_Caps != CAP_NONE)
|
||||
printf("Decoder is capable of YUV output (flags 0x%x)\n", (int)this->m_Caps);
|
||||
|
||||
this->m_sVhdr2->bmiHeader.biBitCount = 24;
|
||||
this->m_sVhdr2->bmiHeader.biCompression = 0;
|
||||
this->m_sDestType.subtype = MEDIASUBTYPE_RGB24;
|
||||
|
||||
this->m_iMinBuffers = this->iv.VBUFSIZE;
|
||||
this->m_bIsDivX = (strcmp(dllname, "divxcvki.ax") == 0
|
||||
|| strcmp(dllname, "divx_c32.ax") == 0
|
||||
|| strcmp(dllname, "wmvds32.ax") == 0
|
||||
|| strcmp(dllname, "wmv8ds32.ax") == 0);
|
||||
this->m_bIsDivX4 = (strcmp(dllname, "divxdec.ax") == 0);
|
||||
if (this->m_bIsDivX)
|
||||
this->iv.VBUFSIZE += 7;
|
||||
else if (this->m_bIsDivX4)
|
||||
this->iv.VBUFSIZE += 9;
|
||||
}
|
||||
/*catch (FatalError& error)
|
||||
{
|
||||
delete[] m_sVhdr;
|
||||
delete[] m_sVhdr2;
|
||||
delete m_pDS_Filter;
|
||||
throw;
|
||||
}*/
|
||||
return this;
|
||||
}
|
||||
|
||||
void DS_VideoDecoder_Destroy(DS_VideoDecoder *this)
|
||||
{
|
||||
DS_VideoDecoder_StopInternal(this);
|
||||
this->iv.m_State = STOP;
|
||||
free(this->m_sVhdr);
|
||||
free(this->m_sVhdr2);
|
||||
DS_Filter_Destroy(this->m_pDS_Filter);
|
||||
}
|
||||
|
||||
void DS_VideoDecoder_StartInternal(DS_VideoDecoder *this)
|
||||
{
|
||||
Debug printf("DS_VideoDecoder_StartInternal\n");
|
||||
//cout << "DSSTART" << endl;
|
||||
this->m_pDS_Filter->m_pAll->vt->Commit(this->m_pDS_Filter->m_pAll);
|
||||
this->m_pDS_Filter->Start(this->m_pDS_Filter);
|
||||
|
||||
this->iv.m_State = START;
|
||||
}
|
||||
|
||||
void DS_VideoDecoder_StopInternal(DS_VideoDecoder *this)
|
||||
{
|
||||
this->m_pDS_Filter->Stop(this->m_pDS_Filter);
|
||||
//??? why was this here ??? m_pOurOutput->SetFramePointer(0);
|
||||
}
|
||||
|
||||
int DS_VideoDecoder_DecodeInternal(DS_VideoDecoder *this, const void* src, int size, int is_keyframe, char* pImage)
|
||||
{
|
||||
IMediaSample* sample = 0;
|
||||
char* ptr;
|
||||
int result;
|
||||
|
||||
Debug printf("DS_VideoDecoder_DecodeInternal(%p,%p,%d,%d,%p)\n",this,src,size,is_keyframe,pImage);
|
||||
|
||||
this->m_pDS_Filter->m_pAll->vt->GetBuffer(this->m_pDS_Filter->m_pAll, &sample, 0, 0, 0);
|
||||
|
||||
if (!sample)
|
||||
{
|
||||
Debug printf("ERROR: null sample\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
//cout << "DECODE " << (void*) pImage << " d: " << (void*) pImage->Data() << endl;
|
||||
|
||||
|
||||
sample->vt->SetActualDataLength(sample, size);
|
||||
sample->vt->GetPointer(sample, (BYTE **)&ptr);
|
||||
memcpy(ptr, src, size);
|
||||
sample->vt->SetSyncPoint(sample, is_keyframe);
|
||||
sample->vt->SetPreroll(sample, pImage ? 0 : 1);
|
||||
// sample->vt->SetMediaType(sample, &m_sOurType);
|
||||
|
||||
// FIXME: - crashing with YV12 at this place decoder will crash
|
||||
// while doing this call
|
||||
// %FS register was not setup for calling into win32 dll. Are all
|
||||
// crashes inside ...->Receive() fixed now?
|
||||
//
|
||||
// nope - but this is surely helpfull - I'll try some more experiments
|
||||
#ifdef WIN32_LOADER
|
||||
Setup_FS_Segment();
|
||||
#endif
|
||||
#if 0
|
||||
if (!this->m_pDS_Filter || !this->m_pDS_Filter->m_pImp
|
||||
|| !this->m_pDS_Filter->m_pImp->vt
|
||||
|| !this->m_pDS_Filter->m_pImp->vt->Receive)
|
||||
printf("DecodeInternal ERROR???\n");
|
||||
#endif
|
||||
result = this->m_pDS_Filter->m_pImp->vt->Receive(this->m_pDS_Filter->m_pImp, sample);
|
||||
if (result)
|
||||
{
|
||||
Debug printf("DS_VideoDecoder::DecodeInternal() error putting data into input pin %x\n", result);
|
||||
}
|
||||
if (pImage)
|
||||
{
|
||||
memcpy(pImage, sampleProcData.frame_pointer, sampleProcData.frame_size);
|
||||
}
|
||||
sample->vt->Release((IUnknown*)sample);
|
||||
|
||||
#if 0
|
||||
if (this->m_bIsDivX)
|
||||
{
|
||||
int q;
|
||||
IHidden* hidden=(IHidden*)((int)this->m_pDS_Filter->m_pFilter + 0xb8);
|
||||
// always check for actual value
|
||||
// this seems to be the only way to know the actual value
|
||||
hidden->vt->GetSmth2(hidden, &this->m_iLastQuality);
|
||||
if (this->m_iLastQuality > 9)
|
||||
this->m_iLastQuality -= 10;
|
||||
|
||||
if (this->m_iLastQuality < 0)
|
||||
this->m_iLastQuality = 0;
|
||||
else if (this->m_iLastQuality > this->m_iMaxAuto)
|
||||
this->m_iLastQuality = this->m_iMaxAuto;
|
||||
|
||||
//cout << " Qual: " << this->m_iLastQuality << endl;
|
||||
this->iv.m_fQuality = this->m_iLastQuality / 4.0;
|
||||
}
|
||||
else if (this->m_bIsDivX4)
|
||||
{
|
||||
|
||||
// maybe access methods directly to safe some cpu cycles...
|
||||
DS_VideoDecoder_GetValue(this, "Postprocessing", this->m_iLastQuality);
|
||||
if (this->m_iLastQuality < 0)
|
||||
this->m_iLastQuality = 0;
|
||||
else if (this->m_iLastQuality > this->m_iMaxAuto)
|
||||
this->m_iLastQuality = this->m_iMaxAuto;
|
||||
|
||||
//cout << " Qual: " << m_iLastQuality << endl;
|
||||
this->iv.m_fQuality = this->m_iLastQuality / 6.0;
|
||||
}
|
||||
|
||||
if (this->iv.m_Mode == -1 ) // ???BUFFERED_QUALITY_AUTO)
|
||||
{
|
||||
// adjust Quality - depends on how many cached frames we have
|
||||
int buffered = this->iv.m_iDecpos - this->iv.m_iPlaypos;
|
||||
|
||||
if (this->m_bIsDivX || this->m_bIsDivX4)
|
||||
{
|
||||
int to = buffered - this->m_iMinBuffers;
|
||||
if (to < 0)
|
||||
to = 0;
|
||||
if (to != this->m_iLastQuality)
|
||||
{
|
||||
if (to > this->m_iMaxAuto)
|
||||
to = this->m_iMaxAuto;
|
||||
if (this->m_iLastQuality != to)
|
||||
{
|
||||
if (this->m_bIsDivX)
|
||||
{
|
||||
IHidden* hidden=(IHidden*)((int)this->m_pDS_Filter->m_pFilter + 0xb8);
|
||||
hidden->vt->SetSmth(hidden, to, 0);
|
||||
}
|
||||
else
|
||||
DS_VideoDecoder_SetValue(this, "Postprocessing", to);
|
||||
#ifndef QUIET
|
||||
//printf("Switching quality %d -> %d b:%d\n",m_iLastQuality, to, buffered);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* bits == 0 - leave unchanged
|
||||
*/
|
||||
//int SetDestFmt(DS_VideoDecoder * this, int bits = 24, fourcc_t csp = 0);
|
||||
int DS_VideoDecoder_SetDestFmt(DS_VideoDecoder *this, int bits, unsigned int csp)
|
||||
{
|
||||
HRESULT result;
|
||||
ALLOCATOR_PROPERTIES props,props1;
|
||||
int should_test=1;
|
||||
int stopped = 0;
|
||||
|
||||
Debug printf("DS_VideoDecoder_SetDestFmt (%p, %d, %d)\n",this,bits,(int)csp);
|
||||
|
||||
/* if (!CImage::Supported(csp, bits))
|
||||
return -1;
|
||||
*/
|
||||
// BitmapInfo temp = m_obh;
|
||||
|
||||
if (!csp) // RGB
|
||||
{
|
||||
int ok = true;
|
||||
|
||||
switch (bits)
|
||||
{
|
||||
case 15:
|
||||
this->m_sDestType.subtype = MEDIASUBTYPE_RGB555;
|
||||
break;
|
||||
case 16:
|
||||
this->m_sDestType.subtype = MEDIASUBTYPE_RGB565;
|
||||
break;
|
||||
case 24:
|
||||
this->m_sDestType.subtype = MEDIASUBTYPE_RGB24;
|
||||
break;
|
||||
case 32:
|
||||
this->m_sDestType.subtype = MEDIASUBTYPE_RGB32;
|
||||
break;
|
||||
default:
|
||||
ok = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if (ok) {
|
||||
if (bits == 15)
|
||||
this->iv.m_obh.biBitCount=16;
|
||||
else
|
||||
this->iv.m_obh.biBitCount=bits;
|
||||
if( bits == 15 || bits == 16 ) {
|
||||
this->iv.m_obh.biSize=sizeof(BITMAPINFOHEADER)+12;
|
||||
this->iv.m_obh.biCompression=3;//BI_BITFIELDS
|
||||
this->iv.m_obh.biSizeImage=abs((int)(2*this->iv.m_obh.biWidth*this->iv.m_obh.biHeight));
|
||||
}
|
||||
|
||||
if( bits == 16 ) {
|
||||
this->iv.m_obh.colors[0]=0xF800;
|
||||
this->iv.m_obh.colors[1]=0x07E0;
|
||||
this->iv.m_obh.colors[2]=0x001F;
|
||||
} else if ( bits == 15 ) {
|
||||
this->iv.m_obh.colors[0]=0x7C00;
|
||||
this->iv.m_obh.colors[1]=0x03E0;
|
||||
this->iv.m_obh.colors[2]=0x001F;
|
||||
} else {
|
||||
this->iv.m_obh.biSize = sizeof(BITMAPINFOHEADER);
|
||||
this->iv.m_obh.biCompression = 0; //BI_RGB
|
||||
//this->iv.m_obh.biHeight = labs(this->iv.m_obh.biHeight);
|
||||
this->iv.m_obh.biSizeImage = labs(this->iv.m_obh.biWidth * this->iv.m_obh.biHeight)
|
||||
* ((this->iv.m_obh.biBitCount + 7) / 8);
|
||||
}
|
||||
}
|
||||
//.biSizeImage=abs(temp.biWidth*temp.biHeight*((temp.biBitCount+7)/8));
|
||||
} else
|
||||
{ // YUV
|
||||
int ok = true;
|
||||
switch (csp)
|
||||
{
|
||||
case fccYUY2:
|
||||
this->m_sDestType.subtype = MEDIASUBTYPE_YUY2;
|
||||
break;
|
||||
case fccYV12:
|
||||
this->m_sDestType.subtype = MEDIASUBTYPE_YV12;
|
||||
break;
|
||||
case fccIYUV:
|
||||
this->m_sDestType.subtype = MEDIASUBTYPE_IYUV;
|
||||
break;
|
||||
case fccI420:
|
||||
this->m_sDestType.subtype = MEDIASUBTYPE_I420;
|
||||
break;
|
||||
case fccUYVY:
|
||||
this->m_sDestType.subtype = MEDIASUBTYPE_UYVY;
|
||||
break;
|
||||
case fccYVYU:
|
||||
this->m_sDestType.subtype = MEDIASUBTYPE_YVYU;
|
||||
break;
|
||||
case fccYVU9:
|
||||
this->m_sDestType.subtype = MEDIASUBTYPE_YVU9;
|
||||
default:
|
||||
ok = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if (ok) {
|
||||
if (csp != 0 && csp != 3 && this->iv.m_obh.biHeight > 0)
|
||||
this->iv.m_obh.biHeight *= -1; // YUV formats uses should have height < 0
|
||||
this->iv.m_obh.biSize = sizeof(BITMAPINFOHEADER);
|
||||
this->iv.m_obh.biCompression=csp;
|
||||
this->iv.m_obh.biBitCount=bits;
|
||||
this->iv.m_obh.biSizeImage=labs(this->iv.m_obh.biBitCount*
|
||||
this->iv.m_obh.biWidth*this->iv.m_obh.biHeight)>>3;
|
||||
}
|
||||
}
|
||||
this->m_sDestType.lSampleSize = this->iv.m_obh.biSizeImage;
|
||||
memcpy(&(this->m_sVhdr2->bmiHeader), &this->iv.m_obh, sizeof(this->iv.m_obh));
|
||||
this->m_sVhdr2->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||
if (this->m_sVhdr2->bmiHeader.biCompression == 3)
|
||||
this->m_sDestType.cbFormat = sizeof(VIDEOINFOHEADER) + 12;
|
||||
else
|
||||
this->m_sDestType.cbFormat = sizeof(VIDEOINFOHEADER);
|
||||
|
||||
|
||||
switch(csp)
|
||||
{
|
||||
case fccYUY2:
|
||||
if(!(this->m_Caps & CAP_YUY2))
|
||||
should_test=false;
|
||||
break;
|
||||
case fccYV12:
|
||||
if(!(this->m_Caps & CAP_YV12))
|
||||
should_test=false;
|
||||
break;
|
||||
case fccIYUV:
|
||||
if(!(this->m_Caps & CAP_IYUV))
|
||||
should_test=false;
|
||||
break;
|
||||
case fccI420:
|
||||
if(!(this->m_Caps & CAP_I420))
|
||||
should_test=false;
|
||||
break;
|
||||
case fccUYVY:
|
||||
if(!(this->m_Caps & CAP_UYVY))
|
||||
should_test=false;
|
||||
break;
|
||||
case fccYVYU:
|
||||
if(!(this->m_Caps & CAP_YVYU))
|
||||
should_test=false;
|
||||
break;
|
||||
case fccYVU9:
|
||||
if(!(this->m_Caps & CAP_YVU9))
|
||||
should_test=false;
|
||||
break;
|
||||
}
|
||||
if(should_test)
|
||||
result = this->m_pDS_Filter->m_pOutputPin->vt->QueryAccept(this->m_pDS_Filter->m_pOutputPin, &this->m_sDestType);
|
||||
else
|
||||
result = -1;
|
||||
|
||||
if (result != 0)
|
||||
{
|
||||
if (csp)
|
||||
printf("Warning: unsupported color space\n");
|
||||
else
|
||||
printf("Warning: unsupported bit depth\n");
|
||||
|
||||
this->m_sDestType.lSampleSize = this->iv.m_decoder.biSizeImage;
|
||||
memcpy(&(this->m_sVhdr2->bmiHeader), &this->iv.m_decoder, sizeof(this->iv.m_decoder));
|
||||
this->m_sVhdr2->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||
if (this->m_sVhdr2->bmiHeader.biCompression == 3)
|
||||
this->m_sDestType.cbFormat = sizeof(VIDEOINFOHEADER) + 12;
|
||||
else
|
||||
this->m_sDestType.cbFormat = sizeof(VIDEOINFOHEADER);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
memcpy( &this->iv.m_decoder, &this->iv.m_obh, sizeof(this->iv.m_obh));
|
||||
|
||||
// m_obh=temp;
|
||||
// if(csp)
|
||||
// m_obh.biBitCount=BitmapInfo::BitCount(csp);
|
||||
this->iv.m_bh->biBitCount = bits;
|
||||
|
||||
//DS_VideoDecoder_Restart(this);
|
||||
|
||||
if (this->iv.m_State == START)
|
||||
{
|
||||
DS_VideoDecoder_StopInternal(this);
|
||||
this->iv.m_State = STOP;
|
||||
stopped = true;
|
||||
}
|
||||
|
||||
this->m_pDS_Filter->m_pInputPin->vt->Disconnect(this->m_pDS_Filter->m_pInputPin);
|
||||
this->m_pDS_Filter->m_pOutputPin->vt->Disconnect(this->m_pDS_Filter->m_pOutputPin);
|
||||
this->m_pDS_Filter->m_pOurOutput->SetNewFormat(this->m_pDS_Filter->m_pOurOutput,&this->m_sDestType);
|
||||
result = this->m_pDS_Filter->m_pInputPin->vt->ReceiveConnection(this->m_pDS_Filter->m_pInputPin,
|
||||
this->m_pDS_Filter->m_pOurInput,
|
||||
&this->m_sOurType);
|
||||
if (result)
|
||||
{
|
||||
printf("Error reconnecting input pin 0x%x\n", (int)result);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(this->m_pDS_Filter->m_pAll)
|
||||
this->m_pDS_Filter->m_pAll->vt->Release((IUnknown*)this->m_pDS_Filter->m_pAll);
|
||||
this->m_pDS_Filter->m_pAll=(IMemAllocator*)MemAllocatorCreate();
|
||||
if (!this->m_pDS_Filter->m_pAll)
|
||||
{
|
||||
printf("Call to MemAllocatorCreate failed\n");
|
||||
return -1;
|
||||
}
|
||||
//Seting allocator property according to our media type
|
||||
props.cBuffers=1;
|
||||
props.cbBuffer=this->m_sDestType.lSampleSize;
|
||||
props.cbAlign=1;
|
||||
props.cbPrefix=0;
|
||||
this->m_pDS_Filter->m_pAll->vt->SetProperties(this->m_pDS_Filter->m_pAll, &props, &props1);
|
||||
//Notify remote pin about choosed allocator
|
||||
this->m_pDS_Filter->m_pImp->vt->NotifyAllocator(this->m_pDS_Filter->m_pImp, this->m_pDS_Filter->m_pAll, 0);
|
||||
|
||||
result = this->m_pDS_Filter->m_pOutputPin->vt->ReceiveConnection(this->m_pDS_Filter->m_pOutputPin,
|
||||
(IPin *)this->m_pDS_Filter->m_pOurOutput,
|
||||
&this->m_sDestType);
|
||||
if (result)
|
||||
{
|
||||
printf("Error reconnecting output pin 0x%x\n", (int)result);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (stopped)
|
||||
{
|
||||
DS_VideoDecoder_StartInternal(this);
|
||||
this->iv.m_State = START;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int DS_VideoDecoder_SetDirection(DS_VideoDecoder *this, int d)
|
||||
{
|
||||
this->iv.m_obh.biHeight = (d) ? this->iv.m_bh->biHeight : -this->iv.m_bh->biHeight;
|
||||
this->m_sVhdr2->bmiHeader.biHeight = this->iv.m_obh.biHeight;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int DS_VideoDecoder_GetValue(DS_VideoDecoder *this, const char* name, int* value)
|
||||
{
|
||||
/*
|
||||
if (m_bIsDivX4)
|
||||
{
|
||||
IDivxFilterInterface* pIDivx;
|
||||
if (m_pDS_Filter->m_pFilter->vt->QueryInterface((IUnknown*)m_pDS_Filter->m_pFilter, &IID_IDivxFilterInterface, (void**)&pIDivx))
|
||||
{
|
||||
Debug printf("No such interface\n");
|
||||
return -1;
|
||||
}
|
||||
if (strcmp(name, "Postprocessing") == 0)
|
||||
{
|
||||
pIDivx->vt->get_PPLevel(pIDivx, &value);
|
||||
value /= 10;
|
||||
}
|
||||
else if (strcmp(name, "Brightness") == 0)
|
||||
pIDivx->vt->get_Brightness(pIDivx, &value);
|
||||
else if (strcmp(name, "Contrast") == 0)
|
||||
pIDivx->vt->get_Contrast(pIDivx, &value);
|
||||
else if (strcmp(name, "Saturation") == 0)
|
||||
pIDivx->vt->get_Saturation(pIDivx, &value);
|
||||
else if (strcmp(name, "MaxAuto") == 0)
|
||||
value = m_iMaxAuto;
|
||||
pIDivx->vt->Release((IUnknown*)pIDivx);
|
||||
return 0;
|
||||
}
|
||||
else if (m_bIsDivX)
|
||||
{
|
||||
if (m_State != START)
|
||||
return VFW_E_NOT_RUNNING;
|
||||
// brightness 87
|
||||
// contrast 74
|
||||
// hue 23
|
||||
// saturation 20
|
||||
// post process mode 0
|
||||
// get1 0x01
|
||||
// get2 10
|
||||
// get3=set2 86
|
||||
// get4=set3 73
|
||||
// get5=set4 19
|
||||
// get6=set5 23
|
||||
IHidden* hidden=(IHidden*)((int)m_pDS_Filter->m_pFilter+0xb8);
|
||||
if (strcmp(name, "Quality") == 0)
|
||||
{
|
||||
// NOT SURE
|
||||
int r = hidden->vt->GetSmth2(hidden, &value);
|
||||
if (value >= 10)
|
||||
value -= 10;
|
||||
return 0;
|
||||
}
|
||||
if (strcmp(name, "Brightness") == 0)
|
||||
return hidden->vt->GetSmth3(hidden, &value);
|
||||
if (strcmp(name, "Contrast") == 0)
|
||||
return hidden->vt->GetSmth4(hidden, &value);
|
||||
if (strcmp(name, "Hue") == 0)
|
||||
return hidden->vt->GetSmth6(hidden, &value);
|
||||
if (strcmp(name, "Saturation") == 0)
|
||||
return hidden->vt->GetSmth5(hidden, &value);
|
||||
if (strcmp(name, "MaxAuto") == 0)
|
||||
{
|
||||
value = m_iMaxAuto;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else if (strcmp((const char*)record.dll, "ir50_32.dll") == 0)
|
||||
{
|
||||
IHidden2* hidden = 0;
|
||||
if (m_pDS_Filter->m_pFilter->vt->QueryInterface((IUnknown*)m_pDS_Filter->m_pFilter, &IID_Iv50Hidden, (void**)&hidden))
|
||||
{
|
||||
Debug printf("No such interface\n");
|
||||
return -1;
|
||||
}
|
||||
// FIXME
|
||||
int recordpar[30];
|
||||
recordpar[0]=0x7c;
|
||||
recordpar[1]=fccIV50;
|
||||
recordpar[2]=0x10005;
|
||||
recordpar[3]=2;
|
||||
recordpar[4]=1;
|
||||
recordpar[5]=0x80000000;
|
||||
|
||||
if (strcmp(name, "Brightness") == 0)
|
||||
recordpar[5]|=0x20;
|
||||
else if (strcmp(name, "Saturation") == 0)
|
||||
recordpar[5]|=0x40;
|
||||
else if (strcmp(name, "Contrast") == 0)
|
||||
recordpar[5]|=0x80;
|
||||
if (!recordpar[5])
|
||||
{
|
||||
hidden->vt->Release((IUnknown*)hidden);
|
||||
return -1;
|
||||
}
|
||||
if (hidden->vt->DecodeSet(hidden, recordpar))
|
||||
return -1;
|
||||
|
||||
if (strcmp(name, "Brightness") == 0)
|
||||
value = recordpar[18];
|
||||
else if (strcmp(name, "Saturation") == 0)
|
||||
value = recordpar[19];
|
||||
else if (strcmp(name, "Contrast") == 0)
|
||||
value = recordpar[20];
|
||||
|
||||
hidden->vt->Release((IUnknown*)hidden);
|
||||
}
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
int DS_VideoDecoder_SetValue(DS_VideoDecoder *this, const char* name, int value)
|
||||
{
|
||||
if (this->m_bIsDivX4) {
|
||||
IDivxFilterInterface* pIDivx=NULL;
|
||||
// printf("DS_SetValue for DIVX4, name=%s value=%d\n",name,value);
|
||||
if (this->m_pDS_Filter->m_pFilter->vt->QueryInterface((IUnknown*)this->m_pDS_Filter->m_pFilter, &IID_IDivxFilterInterface, (void**)&pIDivx))
|
||||
{
|
||||
printf("No such interface\n");
|
||||
return -1;
|
||||
}
|
||||
if (strcasecmp(name, "Postprocessing") == 0)
|
||||
pIDivx->vt->put_PPLevel(pIDivx, value * 10);
|
||||
else if (strcasecmp(name, "Brightness") == 0)
|
||||
pIDivx->vt->put_Brightness(pIDivx, value);
|
||||
else if (strcasecmp(name, "Contrast") == 0)
|
||||
pIDivx->vt->put_Contrast(pIDivx, value);
|
||||
else if (strcasecmp(name, "Saturation") == 0)
|
||||
pIDivx->vt->put_Saturation(pIDivx, value);
|
||||
else if (strcasecmp(name, "MaxAuto") == 0)
|
||||
this->m_iMaxAuto = value;
|
||||
pIDivx->vt->Release((IUnknown*)pIDivx);
|
||||
//printf("Set %s %d\n", name, value);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (this->m_bIsDivX) {
|
||||
IHidden* hidden;
|
||||
if (this->iv.m_State != START)
|
||||
return VFW_E_NOT_RUNNING;
|
||||
|
||||
//cout << "set value " << name << " " << value << endl;
|
||||
// brightness 87
|
||||
// contrast 74
|
||||
// hue 23
|
||||
// saturation 20
|
||||
// post process mode 0
|
||||
// get1 0x01
|
||||
// get2 10
|
||||
// get3=set2 86
|
||||
// get4=set3 73
|
||||
// get5=set4 19
|
||||
// get6=set5 23
|
||||
hidden = (IHidden*)((int)this->m_pDS_Filter->m_pFilter + 0xb8);
|
||||
//printf("DS_SetValue for DIVX, name=%s value=%d\n",name,value);
|
||||
if (strcasecmp(name, "Quality") == 0)
|
||||
{
|
||||
this->m_iLastQuality = value;
|
||||
return hidden->vt->SetSmth(hidden, value, 0);
|
||||
}
|
||||
if (strcasecmp(name, "Brightness") == 0)
|
||||
return hidden->vt->SetSmth2(hidden, value, 0);
|
||||
if (strcasecmp(name, "Contrast") == 0)
|
||||
return hidden->vt->SetSmth3(hidden, value, 0);
|
||||
if (strcasecmp(name, "Saturation") == 0)
|
||||
return hidden->vt->SetSmth4(hidden, value, 0);
|
||||
if (strcasecmp(name, "Hue") == 0)
|
||||
return hidden->vt->SetSmth5(hidden, value, 0);
|
||||
if (strcasecmp(name, "MaxAuto") == 0)
|
||||
{
|
||||
this->m_iMaxAuto = value;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#if 0
|
||||
if (strcmp((const char*)record.dll, "ir50_32.dll") == 0)
|
||||
{
|
||||
IHidden2* hidden = 0;
|
||||
if (m_pDS_Filter->m_pFilter->vt->QueryInterface((IUnknown*)m_pDS_Filter->m_pFilter, &IID_Iv50Hidden, (void**)&hidden))
|
||||
{
|
||||
Debug printf("No such interface\n");
|
||||
return -1;
|
||||
}
|
||||
int recordpar[30];
|
||||
recordpar[0]=0x7c;
|
||||
recordpar[1]=fccIV50;
|
||||
recordpar[2]=0x10005;
|
||||
recordpar[3]=2;
|
||||
recordpar[4]=1;
|
||||
recordpar[5]=0x80000000;
|
||||
if (strcmp(name, "Brightness") == 0)
|
||||
{
|
||||
recordpar[5]|=0x20;
|
||||
recordpar[18]=value;
|
||||
}
|
||||
else if (strcmp(name, "Saturation") == 0)
|
||||
{
|
||||
recordpar[5]|=0x40;
|
||||
recordpar[19]=value;
|
||||
}
|
||||
else if (strcmp(name, "Contrast") == 0)
|
||||
{
|
||||
recordpar[5]|=0x80;
|
||||
recordpar[20]=value;
|
||||
}
|
||||
if(!recordpar[5])
|
||||
{
|
||||
hidden->vt->Release((IUnknown*)hidden);
|
||||
return -1;
|
||||
}
|
||||
HRESULT result = hidden->vt->DecodeSet(hidden, recordpar);
|
||||
hidden->vt->Release((IUnknown*)hidden);
|
||||
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
// printf("DS_SetValue for ????, name=%s value=%d\n",name,value);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int DS_SetAttr_DivX(char* attribute, int value){
|
||||
int result, status, newkey;
|
||||
if(strcasecmp(attribute, "Quality")==0){
|
||||
char* keyname="SOFTWARE\\Microsoft\\Scrunch";
|
||||
result=RegCreateKeyExA(HKEY_CURRENT_USER, keyname, 0, 0, 0, 0, 0, &newkey, &status);
|
||||
if(result!=0)
|
||||
{
|
||||
printf("VideoDecoder::SetExtAttr: registry failure\n");
|
||||
return -1;
|
||||
}
|
||||
result=RegSetValueExA(newkey, "Current Post Process Mode", 0, REG_DWORD, &value, 4);
|
||||
if(result!=0)
|
||||
{
|
||||
printf("VideoDecoder::SetExtAttr: error writing value\n");
|
||||
return -1;
|
||||
}
|
||||
value=-1;
|
||||
result=RegSetValueExA(newkey, "Force Post Process Mode", 0, REG_DWORD, &value, 4);
|
||||
if(result!=0)
|
||||
{
|
||||
printf("VideoDecoder::SetExtAttr: error writing value\n");
|
||||
return -1;
|
||||
}
|
||||
RegCloseKey(newkey);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(
|
||||
(strcasecmp(attribute, "Saturation")==0) ||
|
||||
(strcasecmp(attribute, "Hue")==0) ||
|
||||
(strcasecmp(attribute, "Contrast")==0) ||
|
||||
(strcasecmp(attribute, "Brightness")==0)
|
||||
)
|
||||
{
|
||||
char* keyname="SOFTWARE\\Microsoft\\Scrunch\\Video";
|
||||
result=RegCreateKeyExA(HKEY_CURRENT_USER, keyname, 0, 0, 0, 0, 0, &newkey, &status);
|
||||
if(result!=0)
|
||||
{
|
||||
printf("VideoDecoder::SetExtAttr: registry failure\n");
|
||||
return -1;
|
||||
}
|
||||
result=RegSetValueExA(newkey, attribute, 0, REG_DWORD, &value, 4);
|
||||
if(result!=0)
|
||||
{
|
||||
printf("VideoDecoder::SetExtAttr: error writing value\n");
|
||||
return -1;
|
||||
}
|
||||
RegCloseKey(newkey);
|
||||
return 0;
|
||||
}
|
||||
|
||||
printf("Unknown attribute!\n");
|
||||
return -200;
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
#ifndef MPLAYER_DS_VIDEODECODER_H
|
||||
#define MPLAYER_DS_VIDEODECODER_H
|
||||
|
||||
#include "loader/com.h"
|
||||
#include "loader/wine/vfw.h"
|
||||
|
||||
typedef struct DS_VideoDecoder DS_VideoDecoder;
|
||||
|
||||
int DS_VideoDecoder_GetCapabilities(DS_VideoDecoder *this);
|
||||
|
||||
DS_VideoDecoder * DS_VideoDecoder_Open(char* dllname, GUID* guid, BITMAPINFOHEADER * format, int flip, int maxauto);
|
||||
|
||||
void DS_VideoDecoder_Destroy(DS_VideoDecoder *this);
|
||||
|
||||
void DS_VideoDecoder_StartInternal(DS_VideoDecoder *this);
|
||||
|
||||
void DS_VideoDecoder_StopInternal(DS_VideoDecoder *this);
|
||||
|
||||
int DS_VideoDecoder_DecodeInternal(DS_VideoDecoder *this, const void* src, int size, int is_keyframe, char* pImage);
|
||||
|
||||
/*
|
||||
* bits == 0 - leave unchanged
|
||||
*/
|
||||
//int SetDestFmt(DS_VideoDecoder * this, int bits = 24, fourcc_t csp = 0);
|
||||
int DS_VideoDecoder_SetDestFmt(DS_VideoDecoder *this, int bits, unsigned int csp);
|
||||
int DS_VideoDecoder_SetDirection(DS_VideoDecoder *this, int d);
|
||||
int DS_VideoDecoder_GetValue(DS_VideoDecoder *this, const char* name, int* value);
|
||||
int DS_VideoDecoder_SetValue(DS_VideoDecoder *this, const char* name, int value);
|
||||
int DS_SetAttr_DivX(char* attribute, int value);
|
||||
|
||||
|
||||
#endif /* MPLAYER_DS_VIDEODECODER_H */
|
||||
@@ -1,363 +0,0 @@
|
||||
/*
|
||||
* Modified for use with MPlayer, detailed changelog at
|
||||
* http://svn.mplayerhq.hu/mplayer/trunk/
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "allocator.h"
|
||||
#include "loader/com.h"
|
||||
#include "loader/wine/winerror.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
static int AllocatorKeeper = 0;
|
||||
|
||||
struct avm_list_t
|
||||
{
|
||||
struct avm_list_t* next;
|
||||
struct avm_list_t* prev;
|
||||
void* member;
|
||||
};
|
||||
|
||||
static inline int avm_list_size(avm_list_t* head)
|
||||
{
|
||||
avm_list_t* it = head;
|
||||
int i = 0;
|
||||
if (it)
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
i++;
|
||||
it = it->next;
|
||||
if (it == head)
|
||||
break;
|
||||
}
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
static inline int avm_list_print(avm_list_t* head)
|
||||
{
|
||||
avm_list_t* it = head;
|
||||
int i = 0;
|
||||
printf("Head: %p\n", head);
|
||||
if (it)
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
i++;
|
||||
printf("%d: member: %p next: %p prev: %p\n",
|
||||
i, it->member, it->next, it->prev);
|
||||
it = it->next;
|
||||
if (it == head)
|
||||
break;
|
||||
}
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
static inline avm_list_t* avm_list_add_head(avm_list_t* head, void* member)
|
||||
{
|
||||
avm_list_t* n = malloc(sizeof(avm_list_t));
|
||||
n->member = member;
|
||||
|
||||
if (!head)
|
||||
{
|
||||
head = n;
|
||||
head->prev = head;
|
||||
}
|
||||
|
||||
n->prev = head->prev;
|
||||
head->prev = n;
|
||||
n->next = head;
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
static inline avm_list_t* avm_list_add_tail(avm_list_t* head, void* member)
|
||||
{
|
||||
avm_list_t* n = avm_list_add_head(head, member);
|
||||
return (!head) ? n : head;
|
||||
}
|
||||
|
||||
static inline avm_list_t* avm_list_del_head(avm_list_t* head)
|
||||
{
|
||||
avm_list_t* n = 0;
|
||||
|
||||
if (head)
|
||||
{
|
||||
if (head->next != head)
|
||||
{
|
||||
n = head->next;
|
||||
head->prev->next = head->next;
|
||||
head->next->prev = head->prev;
|
||||
}
|
||||
free(head);
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
static inline avm_list_t* avm_list_find(avm_list_t* head, void* member)
|
||||
{
|
||||
avm_list_t* it = head;
|
||||
if (it)
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
if (it->member == member)
|
||||
return it;
|
||||
it = it->next;
|
||||
if (it == head)
|
||||
break;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifdef WIN32_LOADER
|
||||
static long MemAllocator_CreateAllocator(GUID* clsid, const GUID* iid, void** ppv)
|
||||
{
|
||||
IUnknown* p;
|
||||
int result;
|
||||
if (!ppv)
|
||||
return -1;
|
||||
*ppv = 0;
|
||||
if (memcmp(clsid, &CLSID_MemoryAllocator, sizeof(GUID)))
|
||||
return -1;
|
||||
|
||||
p = (IUnknown*) MemAllocatorCreate();
|
||||
result = p->vt->QueryInterface(p, iid, ppv);
|
||||
p->vt->Release(p);
|
||||
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
static HRESULT STDCALL MemAllocator_SetProperties(IMemAllocator * This,
|
||||
/* [in] */ ALLOCATOR_PROPERTIES *pRequest,
|
||||
/* [out] */ ALLOCATOR_PROPERTIES *pActual)
|
||||
{
|
||||
MemAllocator* me = (MemAllocator*)This;
|
||||
Debug printf("MemAllocator_SetProperties(%p) called\n", This);
|
||||
if (!pRequest || !pActual)
|
||||
return E_INVALIDARG;
|
||||
if (pRequest->cBuffers<=0 || pRequest->cbBuffer<=0)
|
||||
return E_FAIL;
|
||||
if (me->used_list != 0 || me->free_list != 0)
|
||||
return E_FAIL;
|
||||
|
||||
*pActual = *pRequest;
|
||||
/*
|
||||
DirectShow DOCS ("Negotiating Allocators" chapter) says that allocator might not
|
||||
honor the requested properties. Thus, since WMSP audio codecs requests bufer with two
|
||||
bytes length for unknown reason, we should correct requested value. Otherwise above
|
||||
codec don't want to load.
|
||||
*/
|
||||
if (pActual->cbBuffer == 2)
|
||||
pActual->cbBuffer = 10240; //Enough for WMSP codec
|
||||
|
||||
me->props = *pActual;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static HRESULT STDCALL MemAllocator_GetProperties(IMemAllocator * This,
|
||||
/* [out] */ ALLOCATOR_PROPERTIES *pProps)
|
||||
{
|
||||
Debug printf("MemAllocator_GetProperties(%p) called\n", This);
|
||||
if (!pProps)
|
||||
return E_INVALIDARG;
|
||||
if (((MemAllocator*)This)->props.cbBuffer<0)
|
||||
return E_FAIL;
|
||||
*pProps=((MemAllocator*)This)->props;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static HRESULT STDCALL MemAllocator_Commit(IMemAllocator * This)
|
||||
{
|
||||
MemAllocator* me = (MemAllocator*)This;
|
||||
int i;
|
||||
Debug printf("MemAllocator_Commit(%p) called\n", This);
|
||||
if (((MemAllocator*)This)->props.cbBuffer < 0)
|
||||
return E_FAIL;
|
||||
if (me->used_list || me->free_list)
|
||||
return E_INVALIDARG;
|
||||
for (i = 0; i < me->props.cBuffers; i++)
|
||||
{
|
||||
CMediaSample* sample = CMediaSampleCreate((IMemAllocator*)me,
|
||||
me->props.cbBuffer);
|
||||
if (!sample)
|
||||
return E_OUTOFMEMORY;
|
||||
//printf("FREEEEEEEEEEEE ADDED %p\n", sample);
|
||||
me->free_list = avm_list_add_tail(me->free_list, sample);
|
||||
//avm_list_print(me->free_list);
|
||||
}
|
||||
|
||||
//printf("Added mem %p: lsz: %d %d size: %d\n", me, avm_list_size(me->free_list), me->props.cBuffers, me->props.cbBuffer);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static HRESULT STDCALL MemAllocator_Decommit(IMemAllocator * This)
|
||||
{
|
||||
MemAllocator* me=(MemAllocator*)This;
|
||||
Debug printf("MemAllocator_Decommit(%p) called\n", This);
|
||||
//printf("Deleted mem %p: %d %d\n", me, me->free_list.size(), me->used_list.size());
|
||||
while (me->used_list)
|
||||
{
|
||||
me->free_list = avm_list_add_tail(me->free_list,
|
||||
(CMediaSample*) me->used_list->member);
|
||||
me->used_list = avm_list_del_head(me->used_list);
|
||||
}
|
||||
|
||||
while (me->free_list)
|
||||
{
|
||||
CMediaSample* sample = (CMediaSample*) me->free_list->member;
|
||||
//printf("****************** Decommiting FREE %p\n", sample);
|
||||
//sample->vt->Release((IUnknown*)sample);
|
||||
CMediaSample_Destroy((CMediaSample*)sample);
|
||||
me->free_list = avm_list_del_head(me->free_list);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static HRESULT STDCALL MemAllocator_GetBuffer(IMemAllocator * This,
|
||||
/* [out] */ IMediaSample **ppBuffer,
|
||||
/* [in] */ REFERENCE_TIME *pStartTime,
|
||||
/* [in] */ REFERENCE_TIME *pEndTime,
|
||||
/* [in] */ DWORD dwFlags)
|
||||
{
|
||||
MemAllocator* me = (MemAllocator*)This;
|
||||
CMediaSample* sample;
|
||||
Debug printf("MemAllocator_ReleaseBuffer(%p) called %d %d\n", This,
|
||||
avm_list_size(me->used_list), avm_list_size(me->free_list));
|
||||
|
||||
if (!me->free_list)
|
||||
{
|
||||
Debug printf("No samples available\n");
|
||||
return E_FAIL;//should block here if no samples are available
|
||||
}
|
||||
|
||||
sample = (CMediaSample*) me->free_list->member;
|
||||
me->free_list = avm_list_del_head(me->free_list);
|
||||
me->used_list = avm_list_add_tail(me->used_list, sample);
|
||||
|
||||
*ppBuffer = (IMediaSample*) sample;
|
||||
sample->vt->AddRef((IUnknown*) sample);
|
||||
if (me->new_pointer)
|
||||
{
|
||||
if (me->modified_sample)
|
||||
me->modified_sample->ResetPointer(me->modified_sample);
|
||||
sample->SetPointer(sample, me->new_pointer);
|
||||
me->modified_sample = sample;
|
||||
me->new_pointer = 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static HRESULT STDCALL MemAllocator_ReleaseBuffer(IMemAllocator* This,
|
||||
/* [in] */ IMediaSample* pBuffer)
|
||||
{
|
||||
avm_list_t* l;
|
||||
MemAllocator* me = (MemAllocator*)This;
|
||||
Debug printf("MemAllocator_ReleaseBuffer(%p) called %d %d\n", This,
|
||||
avm_list_size(me->used_list), avm_list_size(me->free_list));
|
||||
|
||||
l = avm_list_find(me->used_list, pBuffer);
|
||||
if (l)
|
||||
{
|
||||
CMediaSample* sample = (CMediaSample*) l->member;
|
||||
if (me->modified_sample == sample)
|
||||
{
|
||||
me->modified_sample->ResetPointer(me->modified_sample);
|
||||
me->modified_sample = 0;
|
||||
}
|
||||
me->used_list = avm_list_del_head(me->used_list);
|
||||
me->free_list = avm_list_add_head(me->free_list, sample);
|
||||
//printf("****************** RELEASED OK %p %p\n", me->used_list, me->free_list);
|
||||
return 0;
|
||||
}
|
||||
Debug printf("MemAllocator_ReleaseBuffer(%p) releasing unknown buffer!!!! %p\n", This, pBuffer);
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
|
||||
static void MemAllocator_SetPointer(MemAllocator* This, char* pointer)
|
||||
{
|
||||
This->new_pointer = pointer;
|
||||
}
|
||||
|
||||
static void MemAllocator_ResetPointer(MemAllocator* This)
|
||||
{
|
||||
if (This->modified_sample)
|
||||
{
|
||||
This->modified_sample->ResetPointer(This->modified_sample);
|
||||
This->modified_sample = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void MemAllocator_Destroy(MemAllocator* This)
|
||||
{
|
||||
Debug printf("MemAllocator_Destroy(%p) called (%d, %d)\n", This, This->refcount, AllocatorKeeper);
|
||||
#ifdef WIN32_LOADER
|
||||
if (--AllocatorKeeper == 0)
|
||||
UnregisterComClass(&CLSID_MemoryAllocator, MemAllocator_CreateAllocator);
|
||||
#endif
|
||||
free(This->vt);
|
||||
free(This);
|
||||
}
|
||||
|
||||
IMPLEMENT_IUNKNOWN(MemAllocator)
|
||||
|
||||
MemAllocator* MemAllocatorCreate()
|
||||
{
|
||||
MemAllocator* This = malloc(sizeof(MemAllocator));
|
||||
|
||||
if (!This)
|
||||
return NULL;
|
||||
|
||||
Debug printf("MemAllocatorCreate() called -> %p\n", This);
|
||||
|
||||
This->refcount = 1;
|
||||
This->props.cBuffers = 1;
|
||||
This->props.cbBuffer = 65536; /* :/ */
|
||||
This->props.cbAlign = 1;
|
||||
This->props.cbPrefix = 0;
|
||||
|
||||
This->vt = malloc(sizeof(IMemAllocator_vt));
|
||||
|
||||
if (!This->vt)
|
||||
{
|
||||
free(This);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
This->vt->QueryInterface = MemAllocator_QueryInterface;
|
||||
This->vt->AddRef = MemAllocator_AddRef;
|
||||
This->vt->Release = MemAllocator_Release;
|
||||
This->vt->SetProperties = MemAllocator_SetProperties;
|
||||
This->vt->GetProperties = MemAllocator_GetProperties;
|
||||
This->vt->Commit = MemAllocator_Commit;
|
||||
This->vt->Decommit = MemAllocator_Decommit;
|
||||
This->vt->GetBuffer = MemAllocator_GetBuffer;
|
||||
This->vt->ReleaseBuffer = MemAllocator_ReleaseBuffer;
|
||||
|
||||
This->SetPointer = MemAllocator_SetPointer;
|
||||
This->ResetPointer = MemAllocator_ResetPointer;
|
||||
|
||||
This->modified_sample = 0;
|
||||
This->new_pointer = 0;
|
||||
This->used_list = 0;
|
||||
This->free_list = 0;
|
||||
|
||||
This->interfaces[0]=IID_IUnknown;
|
||||
This->interfaces[1]=IID_IMemAllocator;
|
||||
|
||||
#ifdef WIN32_LOADER
|
||||
if (AllocatorKeeper++ == 0)
|
||||
RegisterComClass(&CLSID_MemoryAllocator, MemAllocator_CreateAllocator);
|
||||
#endif
|
||||
|
||||
return This;
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
#ifndef MPLAYER_ALLOCATOR_H
|
||||
#define MPLAYER_ALLOCATOR_H
|
||||
|
||||
#include "interfaces.h"
|
||||
#include "cmediasample.h"
|
||||
|
||||
typedef struct avm_list_t avm_list_t;
|
||||
typedef struct MemAllocator MemAllocator;
|
||||
|
||||
struct MemAllocator
|
||||
{
|
||||
IMemAllocator_vt* vt;
|
||||
DECLARE_IUNKNOWN();
|
||||
ALLOCATOR_PROPERTIES props;
|
||||
avm_list_t* used_list;
|
||||
avm_list_t* free_list;
|
||||
char* new_pointer;
|
||||
CMediaSample* modified_sample;
|
||||
GUID interfaces[2];
|
||||
|
||||
void ( *SetPointer )(MemAllocator* This, char* pointer);
|
||||
void ( *ResetPointer )(MemAllocator* This);
|
||||
};
|
||||
|
||||
MemAllocator* MemAllocatorCreate(void);
|
||||
|
||||
#endif /* MPLAYER_ALLOCATOR_H */
|
||||
@@ -1,576 +0,0 @@
|
||||
/*
|
||||
* Modified for use with MPlayer, detailed changelog at
|
||||
* http://svn.mplayerhq.hu/mplayer/trunk/
|
||||
*/
|
||||
|
||||
#include "cmediasample.h"
|
||||
#include "mediatype.h"
|
||||
#include "loader/wine/winerror.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/*
|
||||
* currently hack to make some extra room for DS Acel codec which
|
||||
* seems to overwrite allocated memory - FIXME better later
|
||||
* check the buffer allocation
|
||||
*/
|
||||
static const int SAFETY_ACEL = 1024;
|
||||
|
||||
/**
|
||||
* \brief IPin::QueryInternalConnections (retries pin's internal connections)
|
||||
*
|
||||
* \param[in] This pointer to IPin interface
|
||||
* \param[out] apPin Array that receives pins, internally connected to this
|
||||
* \param[in,out] nPint Size of an array
|
||||
*
|
||||
* \return S_OK - success
|
||||
* \return S_FALSE - pin rejects media type
|
||||
* \return E_NOTIMPL - not implemented
|
||||
*
|
||||
*/
|
||||
static long STDCALL CMediaSample_QueryInterface(IUnknown* This,
|
||||
/* [in] */ const GUID* iid,
|
||||
/* [iid_is][out] */ void **ppv)
|
||||
{
|
||||
Debug printf("CMediaSample_QueryInterface(%p) called\n", This);
|
||||
if (!ppv)
|
||||
return E_INVALIDARG;
|
||||
if (memcmp(iid, &IID_IUnknown, sizeof(*iid)) == 0)
|
||||
{
|
||||
*ppv = (void*)This;
|
||||
((IMediaSample*) This)->vt->AddRef(This);
|
||||
return 0;
|
||||
}
|
||||
if (memcmp(iid, &IID_IMediaSample, sizeof(*iid)) == 0)
|
||||
{
|
||||
*ppv = (void*)This;
|
||||
((IMediaSample*) This)->vt->AddRef(This);
|
||||
return 0;
|
||||
}
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief IUnknown::AddRef (increases reference counter for interface)
|
||||
*
|
||||
* \param[in] This pointer to IUnknown class
|
||||
*
|
||||
* \return new value of reference counter
|
||||
*
|
||||
* \remarks
|
||||
* Return value should be used only for debug purposes
|
||||
*
|
||||
*/
|
||||
static long STDCALL CMediaSample_AddRef(IUnknown* This)
|
||||
{
|
||||
Debug printf("CMediaSample_AddRef(%p) called\n", This);
|
||||
((CMediaSample*)This)->refcount++;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief CMediaSample destructor
|
||||
*
|
||||
* \param[in] This pointer to CMediaSample object
|
||||
*
|
||||
*/
|
||||
void CMediaSample_Destroy(CMediaSample* This)
|
||||
{
|
||||
|
||||
Debug printf("CMediaSample_Destroy(%p) called (ref:%d)\n", This, This->refcount);
|
||||
free(This->vt);
|
||||
free(This->own_block);
|
||||
if(((CMediaSample*)This)->type_valid)
|
||||
FreeMediaType(&(This->media_type));
|
||||
free(This);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief IUnknown::Release (desreases reference counter for interface)
|
||||
*
|
||||
* \param[in] This pointer to IUnknown class
|
||||
*
|
||||
* \return new value of reference counter
|
||||
*
|
||||
* \remarks
|
||||
* When reference counter reaches zero calls destructor
|
||||
* Return value should be used only for debug purposes
|
||||
*
|
||||
*/
|
||||
static long STDCALL CMediaSample_Release(IUnknown* This)
|
||||
{
|
||||
CMediaSample* parent = (CMediaSample*)This;
|
||||
Debug printf("CMediaSample_Release(%p) called (new ref:%d)\n",
|
||||
This, ((CMediaSample*)This)->refcount-1);
|
||||
|
||||
if (--((CMediaSample*) This)->refcount == 0)
|
||||
{
|
||||
parent->all->vt->ReleaseBuffer((IMemAllocator*)(parent->all),
|
||||
(IMediaSample*)This);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief IMediaSample::GetPointer (retrieves a read/write pointer to the media sample's buffer)
|
||||
*
|
||||
* \param[in] This pointer to CMediaSample object
|
||||
* \param[out] address of variable that receives pointer to sample's buffer
|
||||
*
|
||||
* \return S_OK success
|
||||
* \return apropriate error otherwise
|
||||
*
|
||||
* \note The calles should not free or reallocate buffer
|
||||
*
|
||||
*/
|
||||
static HRESULT STDCALL CMediaSample_GetPointer(IMediaSample* This,
|
||||
/* [out] */ BYTE** ppBuffer)
|
||||
{
|
||||
Debug printf("CMediaSample_GetPointer(%p) called -> %p, size: %d %d\n", This, ((CMediaSample*) This)->block, ((CMediaSample*)This)->actual_size, ((CMediaSample*)This)->size);
|
||||
if (!ppBuffer)
|
||||
return E_INVALIDARG;
|
||||
*ppBuffer = (BYTE*) ((CMediaSample*) This)->block;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief IMediaSample::GetSize (retrieves a size of buffer in bytes)
|
||||
*
|
||||
* \param[in] This pointer to CMediaSample object
|
||||
*
|
||||
* \return size of buffer in bytes
|
||||
*
|
||||
*/
|
||||
static long STDCALL CMediaSample_GetSize(IMediaSample * This)
|
||||
{
|
||||
Debug printf("CMediaSample_GetSize(%p) called -> %d\n", This, ((CMediaSample*) This)->size);
|
||||
return ((CMediaSample*) This)->size;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief IMediaSample::GetTime (retrieves a stream time at wich sample sould start and finish)
|
||||
*
|
||||
* \param[in] This pointer to CMediaSample object
|
||||
* \param[out] pTimeStart pointer to variable that receives start time
|
||||
* \param[out] pTimeEnd pointer to variable that receives end time
|
||||
*
|
||||
* \return S_OK success
|
||||
* \return VFW_E_NO_STOP_TIME The sample has valid start time, but no stop time
|
||||
* \return VFW_E_SAMPLE_TIME_NOT_SET The sample is not time-stamped
|
||||
*
|
||||
* \remarks
|
||||
* Both values are relative to stream time
|
||||
*
|
||||
*/
|
||||
static HRESULT STDCALL CMediaSample_GetTime(IMediaSample * This,
|
||||
/* [out] */ REFERENCE_TIME *pTimeStart,
|
||||
/* [out] */ REFERENCE_TIME *pTimeEnd)
|
||||
{
|
||||
Debug printf("CMediaSample_GetTime(%p) called (UNIMPLEMENTED)\n", This);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief IMediaSample::SetTime (sets a stream time at wich sample sould start and finish)
|
||||
*
|
||||
* \param[in] This pointer to CMediaSample object
|
||||
* \param[out] pTimeStart pointer to variable that contains start time
|
||||
* \param[out] pTimeEnd pointer to variable that contains end time
|
||||
*
|
||||
* \return S_OK success
|
||||
* \return apropriate error otherwise
|
||||
*
|
||||
* \remarks
|
||||
* Both values are relative to stream time
|
||||
* To invalidate the stream times set pTimeStart and pTimeEnd to NULL. this will cause
|
||||
* IMEdiaSample::GetTime to return VFW_E_SAMPLE_TIME_NOT_SET
|
||||
*
|
||||
*/
|
||||
static HRESULT STDCALL CMediaSample_SetTime(IMediaSample * This,
|
||||
/* [in] */ REFERENCE_TIME *pTimeStart,
|
||||
/* [in] */ REFERENCE_TIME *pTimeEnd)
|
||||
{
|
||||
Debug printf("CMediaSample_SetTime(%p) called (UNIMPLEMENTED)\n", This);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief IMediaSample::IsSyncPoint (determines if start of this sample is sync point)
|
||||
*
|
||||
* \param[in] This pointer to CMediaSample object
|
||||
*
|
||||
* \return S_OK start of this sample is sync point
|
||||
* \return S_FALSE start of this sample is not sync point
|
||||
*
|
||||
* \remarks
|
||||
* If bTemporalCompression of AM_MEDIA_TYPE is FALSE, all samples are sync points.
|
||||
*
|
||||
*/
|
||||
static HRESULT STDCALL CMediaSample_IsSyncPoint(IMediaSample * This)
|
||||
{
|
||||
Debug printf("CMediaSample_IsSyncPoint(%p) called\n", This);
|
||||
if (((CMediaSample*)This)->isSyncPoint)
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief IMediaSample::SetSyncPoint (specifies if start of this sample is sync point)
|
||||
*
|
||||
* \param[in] This pointer to CMediaSample object
|
||||
* \param[in] bIsSyncPoint specifies whether this is sync point or not
|
||||
*
|
||||
* \return S_OK success
|
||||
* \return apropriate error code otherwise
|
||||
*
|
||||
*/
|
||||
static HRESULT STDCALL CMediaSample_SetSyncPoint(IMediaSample * This,
|
||||
long bIsSyncPoint)
|
||||
{
|
||||
Debug printf("CMediaSample_SetSyncPoint(%p) called\n", This);
|
||||
((CMediaSample*)This)->isSyncPoint = bIsSyncPoint;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief IMediaSample::IsPreroll (determines if this sample is preroll sample)
|
||||
*
|
||||
* \param[in] This pointer to CMediaSample object
|
||||
*
|
||||
* \return S_OK if this sample is preroll sample
|
||||
* \return S_FALSE if this sample is not preroll sample
|
||||
*
|
||||
* \remarks
|
||||
* Preroll samples are processed but not displayed. They are lokated in media stream
|
||||
* before displayable samples.
|
||||
*
|
||||
*/
|
||||
static HRESULT STDCALL CMediaSample_IsPreroll(IMediaSample * This)
|
||||
{
|
||||
Debug printf("CMediaSample_IsPreroll(%p) called\n", This);
|
||||
|
||||
if (((CMediaSample*)This)->isPreroll)
|
||||
return 0;//S_OK
|
||||
|
||||
return 1;//S_FALSE
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief IMediaSample::SetPreroll (specifies if this sample is preroll sample)
|
||||
*
|
||||
* \param[in] This pointer to CMediaSample object
|
||||
* \param[in] bIsPreroll specifies whether this sample is preroll sample or not
|
||||
*
|
||||
* \return S_OK success
|
||||
* \return apropriate error code otherwise
|
||||
*
|
||||
* \remarks
|
||||
* Preroll samples are processed but not displayed. They are lokated in media stream
|
||||
* before displayable samples.
|
||||
*
|
||||
*/
|
||||
static HRESULT STDCALL CMediaSample_SetPreroll(IMediaSample * This,
|
||||
long bIsPreroll)
|
||||
{
|
||||
Debug printf("CMediaSample_SetPreroll(%p) called\n", This);
|
||||
((CMediaSample*)This)->isPreroll=bIsPreroll;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief IMediaSample::GetActualDataLength (retrieves the length of valid data in the buffer)
|
||||
*
|
||||
* \param[in] This pointer to CMediaSample object
|
||||
*
|
||||
* \return length of valid data in buffer in bytes
|
||||
*
|
||||
*/
|
||||
static long STDCALL CMediaSample_GetActualDataLength(IMediaSample* This)
|
||||
{
|
||||
Debug printf("CMediaSample_GetActualDataLength(%p) called -> %d\n", This, ((CMediaSample*)This)->actual_size);
|
||||
return ((CMediaSample*)This)->actual_size;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief IMediaSample::SetActualDataLength (specifies the length of valid data in the buffer)
|
||||
*
|
||||
* \param[in] This pointer to CMediaSample object
|
||||
* \param[in] __MIDL_0010 length of data in sample in bytes
|
||||
*
|
||||
* \return S_OK success
|
||||
* \return VFW_E_BUFFER_OVERFLOW length specified by parameter is larger than buffer size
|
||||
*
|
||||
*/
|
||||
static HRESULT STDCALL CMediaSample_SetActualDataLength(IMediaSample* This,
|
||||
long __MIDL_0010)
|
||||
{
|
||||
CMediaSample* cms = (CMediaSample*)This;
|
||||
Debug printf("CMediaSample_SetActualDataLength(%p, %ld) called\n", This, __MIDL_0010);
|
||||
|
||||
if (__MIDL_0010 > cms->size)
|
||||
{
|
||||
char* c = cms->own_block;
|
||||
Debug printf("CMediaSample - buffer overflow %ld %d %p %p\n",
|
||||
__MIDL_0010, ((CMediaSample*)This)->size, cms->own_block, cms->block);
|
||||
cms->own_block = realloc(cms->own_block, (size_t) __MIDL_0010 + SAFETY_ACEL);
|
||||
if (c == cms->block)
|
||||
cms->block = cms->own_block;
|
||||
cms->size = __MIDL_0010;
|
||||
}
|
||||
cms->actual_size = __MIDL_0010;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief IMediaSample::GetMediaType (retrieves media type, if it changed from previous sample)
|
||||
*
|
||||
* \param[in] This pointer to CMediaSample object
|
||||
* \param[out] ppMediaType address of variable that receives pointer to AM_MEDIA_TYPE.
|
||||
*
|
||||
* \return S_OK success
|
||||
* \return S_FALSE Media type was not changed from previous sample
|
||||
* \return E_OUTOFMEMORY Insufficient memory
|
||||
*
|
||||
* \remarks
|
||||
* If media type is not changed from previous sample, ppMediaType is null
|
||||
* If method returns S_OK caller should free memory allocated for structure
|
||||
* including pbFormat block
|
||||
*/
|
||||
static HRESULT STDCALL CMediaSample_GetMediaType(IMediaSample* This,
|
||||
AM_MEDIA_TYPE** ppMediaType)
|
||||
{
|
||||
AM_MEDIA_TYPE* t;
|
||||
Debug printf("CMediaSample_GetMediaType(%p) called\n", This);
|
||||
if(!ppMediaType)
|
||||
return E_INVALIDARG;
|
||||
if(!((CMediaSample*)This)->type_valid)
|
||||
{
|
||||
*ppMediaType=0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
t = &((CMediaSample*)This)->media_type;
|
||||
// free(t.pbFormat);
|
||||
*ppMediaType=CreateMediaType(t);
|
||||
// *ppMediaType=0; //media type was not changed
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief IMediaType::SetMediaType (specifies media type for sample)
|
||||
*
|
||||
* \param[in] This pointer to CMediaSample object
|
||||
* \param[in] pMediaType pointer to AM_MEDIA_TYPE specifies new media type
|
||||
*
|
||||
* \return S_OK success
|
||||
* \return E_OUTOFMEMORY insufficient memory
|
||||
*
|
||||
*/
|
||||
static HRESULT STDCALL CMediaSample_SetMediaType(IMediaSample * This,
|
||||
AM_MEDIA_TYPE *pMediaType)
|
||||
{
|
||||
AM_MEDIA_TYPE* t;
|
||||
Debug printf("CMediaSample_SetMediaType(%p) called\n", This);
|
||||
if (!pMediaType)
|
||||
return E_INVALIDARG;
|
||||
t = &((CMediaSample*)This)->media_type;
|
||||
if(((CMediaSample*)This)->type_valid)
|
||||
FreeMediaType(t);
|
||||
CopyMediaType(t,pMediaType);
|
||||
((CMediaSample*) This)->type_valid=1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief IMediaSample::IsDiscontinuity (determines if this sample represents data break
|
||||
* in stream)
|
||||
*
|
||||
* \param[in] This pointer to CMediaSample object
|
||||
*
|
||||
* \return S_OK if this sample is break in data stream
|
||||
* \return S_FALSE otherwise
|
||||
*
|
||||
* \remarks
|
||||
* Discontinuity occures when filter seeks to different place in the stream or when drops
|
||||
* samples.
|
||||
*
|
||||
*/
|
||||
static HRESULT STDCALL CMediaSample_IsDiscontinuity(IMediaSample * This)
|
||||
{
|
||||
Debug printf("CMediaSample_IsDiscontinuity(%p) called\n", This);
|
||||
return ((CMediaSample*) This)->isDiscontinuity;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief IMediaSample::IsDiscontinuity (specifies whether this sample represents data break
|
||||
* in stream)
|
||||
*
|
||||
* \param[in] This pointer to CMediaSample object
|
||||
* \param[in] bDiscontinuity if TRUE this sample represents discontinuity with previous sample
|
||||
*
|
||||
* \return S_OK success
|
||||
* \return apropriate error code otherwise
|
||||
*
|
||||
*/
|
||||
static HRESULT STDCALL CMediaSample_SetDiscontinuity(IMediaSample * This,
|
||||
long bDiscontinuity)
|
||||
{
|
||||
Debug printf("CMediaSample_SetDiscontinuity(%p) called (%ld)\n", This, bDiscontinuity);
|
||||
((CMediaSample*) This)->isDiscontinuity = bDiscontinuity;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief IMediaSample::GetMediaTime (retrieves the media times of this sample)
|
||||
*
|
||||
* \param[in] This pointer to CMediaSample object
|
||||
* \param[out] pTimeStart pointer to variable that receives start time
|
||||
* \param[out] pTimeEnd pointer to variable that receives end time
|
||||
*
|
||||
* \return S_OK success
|
||||
* \return VFW_E_MEDIA_TIME_NOT_SET The sample is not time-stamped
|
||||
*
|
||||
*/
|
||||
static HRESULT STDCALL CMediaSample_GetMediaTime(IMediaSample * This,
|
||||
/* [out] */ LONGLONG *pTimeStart,
|
||||
/* [out] */ LONGLONG *pTimeEnd)
|
||||
{
|
||||
Debug printf("CMediaSample_GetMediaTime(%p) called\n", This);
|
||||
if (pTimeStart)
|
||||
*pTimeStart = ((CMediaSample*) This)->time_start;
|
||||
if (pTimeEnd)
|
||||
*pTimeEnd = ((CMediaSample*) This)->time_end;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief IMediaSample::GetMediaTime (retrieves the media times of this sample)
|
||||
*
|
||||
* \param[in] This pointer to CMediaSample object
|
||||
* \param[out] pTimeStart pointer to variable that specifies start time
|
||||
* \param[out] pTimeEnd pointer to variable that specifies end time
|
||||
*
|
||||
* \return S_OK success
|
||||
* \return apropriate error code otherwise
|
||||
*
|
||||
* \remarks
|
||||
* To invalidate the media times set pTimeStart and pTimeEnd to NULL. this will cause
|
||||
* IMEdiaSample::GetTime to return VFW_E_MEDIA_TIME_NOT_SET
|
||||
*/
|
||||
static HRESULT STDCALL CMediaSample_SetMediaTime(IMediaSample * This,
|
||||
/* [in] */ LONGLONG *pTimeStart,
|
||||
/* [in] */ LONGLONG *pTimeEnd)
|
||||
{
|
||||
Debug printf("CMediaSample_SetMediaTime(%p) called\n", This);
|
||||
if (pTimeStart)
|
||||
((CMediaSample*) This)->time_start = *pTimeStart;
|
||||
if (pTimeEnd)
|
||||
((CMediaSample*) This)->time_end = *pTimeEnd;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief CMediaSample::SetPointer (extension for direct memory write of decompressed data)
|
||||
*
|
||||
* \param[in] This pointer to CMediaSample object
|
||||
* \param[in] pointer pointer to an external buffer to store data to
|
||||
*
|
||||
*/
|
||||
static void CMediaSample_SetPointer(CMediaSample* This, char* pointer)
|
||||
{
|
||||
Debug printf("CMediaSample_SetPointer(%p) called -> %p\n", This, pointer);
|
||||
if (pointer)
|
||||
This->block = pointer;
|
||||
else
|
||||
This->block = This->own_block;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief CMediaSample::SetPointer (resets pointer to external buffer with internal one)
|
||||
*
|
||||
* \param[in] This pointer to CMediaSample object
|
||||
*
|
||||
*/
|
||||
static void CMediaSample_ResetPointer(CMediaSample* This)
|
||||
{
|
||||
Debug printf("CMediaSample_ResetPointer(%p) called\n", This);
|
||||
This->block = This->own_block;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief CMediaSample constructor
|
||||
*
|
||||
* \param[in] allocator IMemallocator interface of allocator to use
|
||||
* \param[in] size size of internal buffer
|
||||
*
|
||||
* \return pointer to CMediaSample object of NULL if error occured
|
||||
*
|
||||
*/
|
||||
CMediaSample* CMediaSampleCreate(IMemAllocator* allocator, int size)
|
||||
{
|
||||
CMediaSample* This = malloc(sizeof(CMediaSample));
|
||||
if (!This)
|
||||
return NULL;
|
||||
|
||||
// some hack here!
|
||||
// it looks like Acelp decoder is actually accessing
|
||||
// the allocated memory before it sets the new size for it ???
|
||||
// -- maybe it's being initialized with wrong parameters
|
||||
// anyway this is fixes the problem somehow with some reserves
|
||||
//
|
||||
// using different trick for now - in DS_Audio modify sample size
|
||||
//if (size < 0x1000)
|
||||
// size = (size + 0xfff) & ~0xfff;
|
||||
|
||||
This->vt = malloc(sizeof(IMediaSample_vt));
|
||||
This->own_block = malloc((size_t)size + SAFETY_ACEL);
|
||||
This->media_type.pbFormat = 0;
|
||||
This->media_type.pUnk = 0;
|
||||
|
||||
if (!This->vt || !This->own_block)
|
||||
{
|
||||
CMediaSample_Destroy(This);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
This->vt->QueryInterface = CMediaSample_QueryInterface;
|
||||
This->vt->AddRef = CMediaSample_AddRef;
|
||||
This->vt->Release = CMediaSample_Release;
|
||||
This->vt->GetPointer = CMediaSample_GetPointer;
|
||||
This->vt->GetSize = CMediaSample_GetSize;
|
||||
This->vt->GetTime = CMediaSample_GetTime;
|
||||
This->vt->SetTime = CMediaSample_SetTime;
|
||||
This->vt->IsSyncPoint = CMediaSample_IsSyncPoint;
|
||||
This->vt->SetSyncPoint = CMediaSample_SetSyncPoint;
|
||||
This->vt->IsPreroll = CMediaSample_IsPreroll;
|
||||
This->vt->SetPreroll = CMediaSample_SetPreroll;
|
||||
This->vt->GetActualDataLength = CMediaSample_GetActualDataLength;
|
||||
This->vt->SetActualDataLength = CMediaSample_SetActualDataLength;
|
||||
This->vt->GetMediaType = CMediaSample_GetMediaType;
|
||||
This->vt->SetMediaType = CMediaSample_SetMediaType;
|
||||
This->vt->IsDiscontinuity = CMediaSample_IsDiscontinuity;
|
||||
This->vt->SetDiscontinuity = CMediaSample_SetDiscontinuity;
|
||||
This->vt->GetMediaTime = CMediaSample_GetMediaTime;
|
||||
This->vt->SetMediaTime = CMediaSample_SetMediaTime;
|
||||
|
||||
This->all = allocator;
|
||||
This->size = size;
|
||||
This->refcount = 0; // increased by MemAllocator
|
||||
This->actual_size = 0;
|
||||
This->isPreroll = 0;
|
||||
This->isDiscontinuity = 1;
|
||||
This->time_start = 0;
|
||||
This->time_end = 0;
|
||||
This->type_valid = 0;
|
||||
This->block = This->own_block;
|
||||
|
||||
This->SetPointer = CMediaSample_SetPointer;
|
||||
This->ResetPointer = CMediaSample_ResetPointer;
|
||||
|
||||
Debug printf("CMediaSample_Create(%p) called - sample size %d, buffer %p\n",
|
||||
This, This->size, This->block);
|
||||
|
||||
return This;
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
#ifndef MPLAYER_CMEDIASAMPLE_H
|
||||
#define MPLAYER_CMEDIASAMPLE_H
|
||||
|
||||
#include "interfaces.h"
|
||||
#include "guids.h"
|
||||
|
||||
typedef struct CMediaSample CMediaSample;
|
||||
struct CMediaSample
|
||||
{
|
||||
IMediaSample_vt* vt;
|
||||
DECLARE_IUNKNOWN();
|
||||
IMemAllocator* all;
|
||||
int size;
|
||||
int actual_size;
|
||||
char* block;
|
||||
char* own_block;
|
||||
int isPreroll;
|
||||
int isSyncPoint;
|
||||
int isDiscontinuity;
|
||||
LONGLONG time_start;
|
||||
LONGLONG time_end;
|
||||
AM_MEDIA_TYPE media_type;
|
||||
int type_valid;
|
||||
void ( *SetPointer) (CMediaSample* This, char* pointer);
|
||||
void ( *ResetPointer) (CMediaSample* This); // FIXME replace with Set & 0
|
||||
};
|
||||
|
||||
CMediaSample* CMediaSampleCreate(IMemAllocator* allocator, int size);
|
||||
// called from allocator
|
||||
void CMediaSample_Destroy(CMediaSample* This);
|
||||
|
||||
#endif /* MPLAYER_CMEDIASAMPLE_H */
|
||||
@@ -1,165 +0,0 @@
|
||||
/*
|
||||
* Implemention of FilterGraph. Based on allocator.c.
|
||||
* Copyright 2010 Steinar H. Gunderson
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Modified for use with MPlayer, detailed changelog at
|
||||
* http://svn.mplayerhq.hu/mplayer/trunk/
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "config.h"
|
||||
#include "loader/com.h"
|
||||
#include "loader/dshow/graph.h"
|
||||
#include "loader/wine/winerror.h"
|
||||
|
||||
// How many FilterGraph objects exist.
|
||||
// Used for knowing when to register and unregister the class in COM.
|
||||
static int GraphKeeper = 0;
|
||||
|
||||
#ifdef WIN32_LOADER
|
||||
static long FilterGraph_CreateGraph(GUID* clsid, const GUID* iid, void** ppv)
|
||||
{
|
||||
IUnknown* p;
|
||||
int result;
|
||||
if (!ppv)
|
||||
return -1;
|
||||
*ppv = 0;
|
||||
if (memcmp(clsid, &CLSID_FilterGraph, sizeof(*clsid)))
|
||||
return -1;
|
||||
|
||||
p = (IUnknown*) FilterGraphCreate();
|
||||
result = p->vt->QueryInterface(p, iid, ppv);
|
||||
p->vt->Release(p);
|
||||
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void FilterGraph_Destroy(FilterGraph* This)
|
||||
{
|
||||
Debug printf("FilterGraph_Destroy(%p) called (%d, %d)\n", This, This->refcount, GraphKeeper);
|
||||
#ifdef WIN32_LOADER
|
||||
if (--GraphKeeper == 0)
|
||||
UnregisterComClass(&CLSID_FilterGraph, FilterGraph_CreateGraph);
|
||||
#endif
|
||||
free(This->vt);
|
||||
free(This);
|
||||
}
|
||||
|
||||
static HRESULT STDCALL FilterGraph_AddFilter(IFilterGraph* This,
|
||||
IBaseFilter* pFilter,
|
||||
unsigned short* pName)
|
||||
{
|
||||
Debug printf("FilterGraph_AddFilter(%p) called\n", This);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT STDCALL FilterGraph_RemoveFilter(IFilterGraph* This, IBaseFilter* pFilter)
|
||||
{
|
||||
Debug printf("FilterGraph_RemoveFilter(%p) called\n", This);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT STDCALL FilterGraph_EnumFilters(IFilterGraph* This, IEnumFilters** ppEnum)
|
||||
{
|
||||
Debug printf("FilterGraph_EnumFilters(%p) called\n", This);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT STDCALL FilterGraph_FindFilterByName(IFilterGraph* This,
|
||||
unsigned short* pName,
|
||||
IBaseFilter** ppFilter)
|
||||
{
|
||||
Debug printf("FilterGraph_FindFilterByName(%p) called\n", This);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT STDCALL FilterGraph_ConnectDirect(IFilterGraph* This,
|
||||
IPin* ppinOut,
|
||||
IPin* ppinIn,
|
||||
const AM_MEDIA_TYPE* pmt)
|
||||
{
|
||||
Debug printf("FilterGraph_ConnectDirect(%p) called\n", This);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT STDCALL FilterGraph_Reconnect(IFilterGraph* This, IPin* ppin)
|
||||
{
|
||||
Debug printf("FilterGraph_Reconnect(%p) called\n", This);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT STDCALL FilterGraph_Disconnect(IFilterGraph* This, IPin* ppin)
|
||||
{
|
||||
Debug printf("FilterGraph_Disconnect(%p) called\n", This);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT STDCALL FilterGraph_SetDefaultSyncSource(IFilterGraph* This)
|
||||
{
|
||||
Debug printf("FilterGraph_SetDefaultSyncSource(%p) called\n", This);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
IMPLEMENT_IUNKNOWN(FilterGraph)
|
||||
|
||||
FilterGraph* FilterGraphCreate()
|
||||
{
|
||||
FilterGraph* This = calloc(1, sizeof(*This));
|
||||
|
||||
if (!This)
|
||||
return NULL;
|
||||
|
||||
Debug printf("FilterGraphCreate() called -> %p\n", This);
|
||||
|
||||
This->refcount = 1;
|
||||
|
||||
This->vt = calloc(1, sizeof(*This->vt));
|
||||
|
||||
if (!This->vt) {
|
||||
free(This);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
This->vt->QueryInterface = FilterGraph_QueryInterface;
|
||||
This->vt->AddRef = FilterGraph_AddRef;
|
||||
This->vt->Release = FilterGraph_Release;
|
||||
|
||||
This->vt->AddFilter = FilterGraph_AddFilter;
|
||||
This->vt->RemoveFilter = FilterGraph_RemoveFilter;
|
||||
This->vt->EnumFilters = FilterGraph_EnumFilters;
|
||||
This->vt->FindFilterByName = FilterGraph_FindFilterByName;
|
||||
This->vt->ConnectDirect = FilterGraph_ConnectDirect;
|
||||
This->vt->Reconnect = FilterGraph_Reconnect;
|
||||
This->vt->Disconnect = FilterGraph_Disconnect;
|
||||
This->vt->SetDefaultSyncSource = FilterGraph_SetDefaultSyncSource;
|
||||
|
||||
This->interfaces[0] = IID_IUnknown;
|
||||
This->interfaces[1] = IID_IFilterGraph;
|
||||
|
||||
#ifdef WIN32_LOADER
|
||||
if (GraphKeeper++ == 0)
|
||||
RegisterComClass(&CLSID_FilterGraph, FilterGraph_CreateGraph);
|
||||
#endif
|
||||
|
||||
return This;
|
||||
}
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
#ifndef MPLAYER_GRAPH_H
|
||||
#define MPLAYER_GRAPH_H
|
||||
|
||||
/*
|
||||
* Copyright 2010 Steinar H. Gunderson
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "interfaces.h"
|
||||
#include "cmediasample.h"
|
||||
|
||||
typedef struct FilterGraph FilterGraph;
|
||||
|
||||
struct FilterGraph {
|
||||
IFilterGraph_vt* vt;
|
||||
DECLARE_IUNKNOWN();
|
||||
GUID interfaces[2];
|
||||
|
||||
HRESULT STDCALL (*AddFilter)(FilterGraph* This,
|
||||
/* [in] */ IBaseFilter* pFilter,
|
||||
/* [string][in] */ unsigned short* pName);
|
||||
HRESULT STDCALL (*RemoveFilter)(FilterGraph* This,
|
||||
/* [in] */ IBaseFilter* pFilter);
|
||||
HRESULT STDCALL (*EnumFilters)(FilterGraph* This,
|
||||
/* [out] */ IEnumFilters** ppEnum);
|
||||
HRESULT STDCALL (*FindFilterByName)(FilterGraph* This,
|
||||
/* [string][in] */ unsigned short* pName,
|
||||
/* [out] */ IBaseFilter** ppFilter);
|
||||
HRESULT STDCALL (*ConnectDirect)(FilterGraph* This,
|
||||
/* [in] */ IPin* ppinOut,
|
||||
/* [in] */ IPin* ppinIn,
|
||||
/* [in] */ const AM_MEDIA_TYPE* pmt);
|
||||
HRESULT STDCALL (*Reconnect)(FilterGraph* This,
|
||||
/* [in] */ IPin* ppin);
|
||||
HRESULT STDCALL (*Disconnect)(FilterGraph* This,
|
||||
/* [in] */ IPin* ppin);
|
||||
HRESULT STDCALL (*SetDefaultSyncSource)(FilterGraph* This);
|
||||
};
|
||||
|
||||
FilterGraph* FilterGraphCreate(void);
|
||||
|
||||
#endif /* MPLAYER_GRAPH_H */
|
||||
@@ -1,83 +0,0 @@
|
||||
#include "guids.h"
|
||||
|
||||
const GUID CLSID_DivxDecompressorCF={0x82CCd3E0, 0xF71A, 0x11D0,
|
||||
{ 0x9f, 0xe5, 0x00, 0x60, 0x97, 0x78, 0xaa, 0xaa}};
|
||||
const GUID IID_IDivxFilterInterface={0xd132ee97, 0x3e38, 0x4030,
|
||||
{0x8b, 0x17, 0x59, 0x16, 0x3b, 0x30, 0xa1, 0xf5}};
|
||||
|
||||
const GUID CLSID_IV50_Decoder={0x30355649, 0x0000, 0x0010,
|
||||
{0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}};
|
||||
const GUID IID_IBaseFilter={0x56a86895, 0x0ad4, 0x11ce,
|
||||
{0xb0, 0x3a, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}};
|
||||
const GUID IID_IEnumPins={0x56a86892, 0x0ad4, 0x11ce,
|
||||
{0xb0, 0x3a, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}};
|
||||
const GUID IID_IFilterGraph={0x56a8689f, 0x0ad4, 0x11ce,
|
||||
{0xb0, 0x3a, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}};
|
||||
const GUID IID_IEnumMediaTypes={0x89c31040, 0x846b, 0x11ce,
|
||||
{0x97, 0xd3, 0x00, 0xaa, 0x00, 0x55, 0x59, 0x5a}};
|
||||
const GUID IID_IMemInputPin={0x56a8689d, 0x0ad4, 0x11ce,
|
||||
{0xb0, 0x3a, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}};
|
||||
const GUID IID_IMemAllocator={0x56a8689c, 0x0ad4, 0x11ce,
|
||||
{0xb0, 0x3a, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}};
|
||||
const GUID IID_IMediaSample={0x56a8689a, 0x0ad4, 0x11ce,
|
||||
{0xb0, 0x3a, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}};
|
||||
|
||||
const GUID MEDIATYPE_Video={0x73646976, 0x0000, 0x0010,
|
||||
{0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}};
|
||||
const GUID GUID_NULL={0x0, 0x0, 0x0,
|
||||
{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}};
|
||||
const GUID FORMAT_VideoInfo={0x05589f80, 0xc356, 0x11ce,
|
||||
{0xbf, 0x01, 0x00, 0xaa, 0x00, 0x55, 0x59, 0x5a}};
|
||||
const GUID MEDIASUBTYPE_RGB1={0xe436eb78, 0x524f, 0x11ce,
|
||||
{0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}};
|
||||
const GUID MEDIASUBTYPE_RGB4={0xe436eb79, 0x524f, 0x11ce,
|
||||
{0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}};
|
||||
const GUID MEDIASUBTYPE_RGB8={0xe436eb7a, 0x524f, 0x11ce,
|
||||
{0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}};
|
||||
const GUID MEDIASUBTYPE_RGB565={0xe436eb7b, 0x524f, 0x11ce,
|
||||
{0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}};
|
||||
const GUID MEDIASUBTYPE_RGB555={0xe436eb7c, 0x524f, 0x11ce,
|
||||
{0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}};
|
||||
const GUID MEDIASUBTYPE_RGB24={0xe436eb7d, 0x524f, 0x11ce,
|
||||
{0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}};
|
||||
const GUID MEDIASUBTYPE_RGB32={0xe436eb7e, 0x524f, 0x11ce,
|
||||
{0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}};
|
||||
const GUID MEDIASUBTYPE_YUYV={0x56595559, 0x0000, 0x0010,
|
||||
{0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}};
|
||||
const GUID MEDIASUBTYPE_IYUV={0x56555949, 0x0000, 0x0010,
|
||||
{0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}};
|
||||
const GUID MEDIASUBTYPE_YVU9={0x39555659, 0x0000, 0x0010,
|
||||
{0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}};
|
||||
const GUID MEDIASUBTYPE_Y411={0x31313459, 0x0000, 0x0010,
|
||||
{0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}};
|
||||
const GUID MEDIASUBTYPE_Y41P={0x50313459, 0x0000, 0x0010,
|
||||
{0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}};
|
||||
const GUID MEDIASUBTYPE_YUY2={0x32595559, 0x0000, 0x0010,
|
||||
{0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}};
|
||||
const GUID MEDIASUBTYPE_YVYU={0x55595659, 0x0000, 0x0010,
|
||||
{0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}};
|
||||
const GUID MEDIASUBTYPE_UYVY={0x59565955, 0x0000, 0x0010,
|
||||
{0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}};
|
||||
const GUID MEDIASUBTYPE_Y211={0x31313259, 0x0000, 0x0010,
|
||||
{0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}};
|
||||
const GUID MEDIASUBTYPE_YV12={0x32315659, 0x0000, 0x0010,
|
||||
{0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}};
|
||||
const GUID MEDIASUBTYPE_I420={0x30323449, 0x0000, 0x0010,
|
||||
{0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}};
|
||||
const GUID MEDIASUBTYPE_IF09={0x39304649, 0x0000, 0x0010,
|
||||
{0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}};
|
||||
const GUID CLSID_FilterGraph={0xe436ebb3, 0x524f, 0x11ce,
|
||||
{0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}};
|
||||
const GUID CLSID_MemoryAllocator={0x1e651cc0, 0xb199, 0x11d0,
|
||||
{0x82, 0x12, 0x00, 0xc0, 0x4f, 0xc3, 0x2c, 0x45}};
|
||||
const GUID IID_DivxHidden={0x598eba01, 0xb49a, 0x11d2,
|
||||
{0xa1, 0xc1, 0x00, 0x60, 0x97, 0x78, 0xaa, 0xaa}};
|
||||
const GUID IID_Iv50Hidden={0x665a4442, 0xd905, 0x11d0,
|
||||
{0xa3, 0x0e, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}};
|
||||
|
||||
const GUID FORMAT_WaveFormatEx = {0x05589f81, 0xc356, 0x11CE,
|
||||
{0xBF, 0x01, 0x00, 0xAA, 0x00, 0x55, 0x59, 0x5A}};
|
||||
const GUID MEDIATYPE_Audio = {0x73647561, 0x0000, 0x0010,
|
||||
{0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71}};
|
||||
const GUID MEDIASUBTYPE_PCM = {0x00000001, 0x0000, 0x0010,
|
||||
{0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71}};
|
||||
@@ -1,89 +0,0 @@
|
||||
#ifndef MPLAYER_GUIDS_H
|
||||
#define MPLAYER_GUIDS_H
|
||||
|
||||
/*
|
||||
this will be defined if <ole2.h> already included before this file
|
||||
under MinGW
|
||||
*/
|
||||
|
||||
#ifndef GUID_DEFINED
|
||||
#include "loader/com.h"
|
||||
#endif
|
||||
|
||||
#ifndef VFWAPI
|
||||
#include "loader/wine/module.h"
|
||||
#include "loader/wine/windef.h"
|
||||
#include "loader/wine/vfw.h"
|
||||
#endif
|
||||
|
||||
#include "mediatype.h"
|
||||
|
||||
//#define Debug if(1)
|
||||
#define Debug if(0)
|
||||
|
||||
|
||||
typedef long long REFERENCE_TIME;
|
||||
|
||||
typedef struct __attribute__((__packed__)) RECT32
|
||||
{
|
||||
int left, top, right, bottom;
|
||||
} RECT32;
|
||||
|
||||
typedef struct __attribute__((__packed__)) tagVIDEOINFOHEADER
|
||||
{
|
||||
RECT32 rcSource; // The bit we really want to use
|
||||
RECT32 rcTarget; // Where the video should go
|
||||
unsigned long dwBitRate; // Approximate bit data rate
|
||||
unsigned long dwBitErrorRate; // Bit error rate for this stream
|
||||
REFERENCE_TIME AvgTimePerFrame; // Average time per frame (100ns units)
|
||||
BITMAPINFOHEADER bmiHeader;
|
||||
//int reserved[3];
|
||||
} VIDEOINFOHEADER;
|
||||
|
||||
typedef GUID CLSID;
|
||||
typedef GUID IID;
|
||||
|
||||
extern const GUID IID_IBaseFilter;
|
||||
extern const GUID IID_IEnumPins;
|
||||
extern const GUID IID_IEnumMediaTypes;
|
||||
extern const GUID IID_IFilterGraph;
|
||||
extern const GUID IID_IMemInputPin;
|
||||
extern const GUID IID_IMemAllocator;
|
||||
extern const GUID IID_IMediaSample;
|
||||
extern const GUID IID_DivxHidden;
|
||||
extern const GUID IID_Iv50Hidden;
|
||||
extern const GUID CLSID_DivxDecompressorCF;
|
||||
extern const GUID IID_IDivxFilterInterface;
|
||||
extern const GUID CLSID_IV50_Decoder;
|
||||
extern const GUID CLSID_FilterGraph;
|
||||
extern const GUID CLSID_MemoryAllocator;
|
||||
extern const GUID MEDIATYPE_Video;
|
||||
// avoid a clash with MinGW-W64 libuuid
|
||||
#define GUID_NULL MP_GUID_NULL
|
||||
extern const GUID GUID_NULL;
|
||||
extern const GUID FORMAT_VideoInfo;
|
||||
extern const GUID MEDIASUBTYPE_RGB1;
|
||||
extern const GUID MEDIASUBTYPE_RGB4;
|
||||
extern const GUID MEDIASUBTYPE_RGB8;
|
||||
extern const GUID MEDIASUBTYPE_RGB565;
|
||||
extern const GUID MEDIASUBTYPE_RGB555;
|
||||
extern const GUID MEDIASUBTYPE_RGB24;
|
||||
extern const GUID MEDIASUBTYPE_RGB32;
|
||||
extern const GUID MEDIASUBTYPE_YUYV;
|
||||
extern const GUID MEDIASUBTYPE_IYUV;
|
||||
extern const GUID MEDIASUBTYPE_YVU9;
|
||||
extern const GUID MEDIASUBTYPE_Y411;
|
||||
extern const GUID MEDIASUBTYPE_Y41P;
|
||||
extern const GUID MEDIASUBTYPE_YUY2;
|
||||
extern const GUID MEDIASUBTYPE_YVYU;
|
||||
extern const GUID MEDIASUBTYPE_UYVY;
|
||||
extern const GUID MEDIASUBTYPE_Y211;
|
||||
extern const GUID MEDIASUBTYPE_YV12;
|
||||
extern const GUID MEDIASUBTYPE_I420;
|
||||
extern const GUID MEDIASUBTYPE_IF09;
|
||||
|
||||
extern const GUID FORMAT_WaveFormatEx;
|
||||
extern const GUID MEDIATYPE_Audio;
|
||||
extern const GUID MEDIASUBTYPE_PCM;
|
||||
|
||||
#endif /* MPLAYER_GUIDS_H */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,70 +0,0 @@
|
||||
#ifndef MPLAYER_INPUTPIN_H
|
||||
#define MPLAYER_INPUTPIN_H
|
||||
|
||||
#include "interfaces.h"
|
||||
|
||||
typedef struct CBaseFilter2 CBaseFilter2;
|
||||
struct CBaseFilter2
|
||||
{
|
||||
IBaseFilter_vt* vt;
|
||||
DECLARE_IUNKNOWN();
|
||||
IPin* pin;
|
||||
GUID interfaces[5];
|
||||
|
||||
IPin* ( *GetPin )(CBaseFilter2* This);
|
||||
};
|
||||
|
||||
CBaseFilter2* CBaseFilter2Create(void);
|
||||
|
||||
|
||||
typedef struct CBaseFilter CBaseFilter;
|
||||
struct CBaseFilter
|
||||
{
|
||||
IBaseFilter_vt* vt;
|
||||
DECLARE_IUNKNOWN(); // has to match CBaseFilter2 - INHERITANCE!!
|
||||
IPin* pin;
|
||||
IPin* unused_pin;
|
||||
GUID interfaces[2];
|
||||
|
||||
IPin* ( *GetPin )(CBaseFilter* This);
|
||||
IPin* ( *GetUnusedPin )(CBaseFilter* This);
|
||||
};
|
||||
|
||||
CBaseFilter* CBaseFilterCreate(const AM_MEDIA_TYPE* vhdr, CBaseFilter2* parent);
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
IPin_vt* vt;
|
||||
DECLARE_IUNKNOWN();
|
||||
CBaseFilter* parent;
|
||||
AM_MEDIA_TYPE type;
|
||||
GUID interfaces[1];
|
||||
} CInputPin;
|
||||
|
||||
CInputPin* CInputPinCreate(CBaseFilter* parent, const AM_MEDIA_TYPE* vhdr);
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
IPin_vt* vt;
|
||||
DECLARE_IUNKNOWN();
|
||||
CBaseFilter* parent;
|
||||
GUID interfaces[1];
|
||||
IPin* remote_pin;
|
||||
} CRemotePin;
|
||||
|
||||
CRemotePin* CRemotePinCreate(CBaseFilter* pt, IPin* rpin);
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
IPin_vt* vt;
|
||||
DECLARE_IUNKNOWN();
|
||||
CBaseFilter2* parent;
|
||||
GUID interfaces[1];
|
||||
} CRemotePin2;
|
||||
|
||||
CRemotePin2* CRemotePin2Create(CBaseFilter2* parent);
|
||||
|
||||
#endif /* MPLAYER_INPUTPIN_H */
|
||||
@@ -1,360 +0,0 @@
|
||||
#ifndef MPLAYER_INTERFACES_H
|
||||
#define MPLAYER_INTERFACES_H
|
||||
|
||||
/*
|
||||
* Definition of important DirectShow interfaces.
|
||||
* Created using freely-available DirectX 8.0 SDK
|
||||
* ( http://msdn.microsoft.com )
|
||||
*/
|
||||
|
||||
#include "iunk.h"
|
||||
#include "loader/com.h"
|
||||
|
||||
/* Sh*t. MSVC++ and g++ use different methods of storing vtables. */
|
||||
|
||||
typedef struct IReferenceClock IReferenceClock;
|
||||
typedef struct IFilterGraph IFilterGraph;
|
||||
|
||||
typedef struct IBaseFilter IBaseFilter;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
PINDIR_INPUT = 0,
|
||||
PINDIR_OUTPUT
|
||||
} PIN_DIRECTION;
|
||||
|
||||
typedef struct PinInfo
|
||||
{
|
||||
IBaseFilter* pFilter;
|
||||
PIN_DIRECTION dir;
|
||||
unsigned short achName[128];
|
||||
} PIN_INFO;
|
||||
|
||||
typedef struct AllocatorProperties
|
||||
{
|
||||
long cBuffers;
|
||||
long cbBuffer;
|
||||
long cbAlign;
|
||||
long cbPrefix;
|
||||
} ALLOCATOR_PROPERTIES;
|
||||
|
||||
typedef struct IEnumMediaTypes IEnumMediaTypes;
|
||||
typedef struct IEnumMediaTypes_vt
|
||||
{
|
||||
INHERIT_IUNKNOWN();
|
||||
|
||||
HRESULT STDCALL ( *Next )(IEnumMediaTypes* This,
|
||||
/* [in] */ unsigned long cMediaTypes,
|
||||
/* [size_is][out] */ AM_MEDIA_TYPE** ppMediaTypes,
|
||||
/* [out] */ unsigned long* pcFetched);
|
||||
HRESULT STDCALL ( *Skip )(IEnumMediaTypes* This,
|
||||
/* [in] */ unsigned long cMediaTypes);
|
||||
HRESULT STDCALL ( *Reset )(IEnumMediaTypes* This);
|
||||
HRESULT STDCALL ( *Clone )(IEnumMediaTypes* This,
|
||||
/* [out] */ IEnumMediaTypes** ppEnum);
|
||||
} IEnumMediaTypes_vt;
|
||||
struct IEnumMediaTypes { IEnumMediaTypes_vt* vt; };
|
||||
|
||||
|
||||
|
||||
typedef struct IPin IPin;
|
||||
typedef struct IPin_vt
|
||||
{
|
||||
INHERIT_IUNKNOWN();
|
||||
|
||||
HRESULT STDCALL ( *Connect )(IPin * This,
|
||||
/* [in] */ IPin *pReceivePin,
|
||||
/* [in] */ /*const*/ AM_MEDIA_TYPE *pmt);
|
||||
HRESULT STDCALL ( *ReceiveConnection )(IPin * This,
|
||||
/* [in] */ IPin *pConnector,
|
||||
/* [in] */ const AM_MEDIA_TYPE *pmt);
|
||||
HRESULT STDCALL ( *Disconnect )(IPin * This);
|
||||
HRESULT STDCALL ( *ConnectedTo )(IPin * This, /* [out] */ IPin **pPin);
|
||||
HRESULT STDCALL ( *ConnectionMediaType )(IPin * This,
|
||||
/* [out] */ AM_MEDIA_TYPE *pmt);
|
||||
HRESULT STDCALL ( *QueryPinInfo )(IPin * This, /* [out] */ PIN_INFO *pInfo);
|
||||
HRESULT STDCALL ( *QueryDirection )(IPin * This,
|
||||
/* [out] */ PIN_DIRECTION *pPinDir);
|
||||
HRESULT STDCALL ( *QueryId )(IPin * This, /* [out] */ unsigned short* *Id);
|
||||
HRESULT STDCALL ( *QueryAccept )(IPin * This,
|
||||
/* [in] */ const AM_MEDIA_TYPE *pmt);
|
||||
HRESULT STDCALL ( *EnumMediaTypes )(IPin * This,
|
||||
/* [out] */ IEnumMediaTypes **ppEnum);
|
||||
HRESULT STDCALL ( *QueryInternalConnections )(IPin * This,
|
||||
/* [out] */ IPin **apPin,
|
||||
/* [out][in] */ unsigned long *nPin);
|
||||
HRESULT STDCALL ( *EndOfStream )(IPin * This);
|
||||
HRESULT STDCALL ( *BeginFlush )(IPin * This);
|
||||
HRESULT STDCALL ( *EndFlush )(IPin * This);
|
||||
HRESULT STDCALL ( *NewSegment )(IPin * This,
|
||||
/* [in] */ REFERENCE_TIME tStart,
|
||||
/* [in] */ REFERENCE_TIME tStop,
|
||||
/* [in] */ double dRate);
|
||||
} IPin_vt;
|
||||
struct IPin { IPin_vt *vt; };
|
||||
|
||||
|
||||
typedef struct IEnumPins IEnumPins;
|
||||
typedef struct IEnumPins_vt
|
||||
{
|
||||
INHERIT_IUNKNOWN();
|
||||
|
||||
// retrieves a specified number of pins in the enumeration sequence..
|
||||
HRESULT STDCALL ( *Next )(IEnumPins* This,
|
||||
/* [in] */ unsigned long cPins,
|
||||
/* [size_is][out] */ IPin** ppPins,
|
||||
/* [out] */ unsigned long* pcFetched);
|
||||
// skips over a specified number of pins.
|
||||
HRESULT STDCALL ( *Skip )(IEnumPins* This,
|
||||
/* [in] */ unsigned long cPins);
|
||||
// resets the enumeration sequence to the beginning.
|
||||
HRESULT STDCALL ( *Reset )(IEnumPins* This);
|
||||
// makes a copy of the enumerator with the same enumeration state.
|
||||
HRESULT STDCALL ( *Clone )(IEnumPins* This,
|
||||
/* [out] */ IEnumPins** ppEnum);
|
||||
} IEnumPins_vt;
|
||||
struct IEnumPins { struct IEnumPins_vt* vt; };
|
||||
|
||||
|
||||
typedef struct IMediaSample IMediaSample;
|
||||
typedef struct IMediaSample_vt
|
||||
{
|
||||
INHERIT_IUNKNOWN();
|
||||
|
||||
HRESULT STDCALL ( *GetPointer )(IMediaSample* This,
|
||||
/* [out] */ unsigned char** ppBuffer);
|
||||
LONG STDCALL ( *GetSize )(IMediaSample* This);
|
||||
HRESULT STDCALL ( *GetTime )(IMediaSample* This,
|
||||
/* [out] */ REFERENCE_TIME* pTimeStart,
|
||||
/* [out] */ REFERENCE_TIME* pTimeEnd);
|
||||
HRESULT STDCALL ( *SetTime )(IMediaSample* This,
|
||||
/* [in] */ REFERENCE_TIME* pTimeStart,
|
||||
/* [in] */ REFERENCE_TIME* pTimeEnd);
|
||||
|
||||
// sync-point property. If true, then the beginning of this
|
||||
// sample is a sync-point. (note that if AM_MEDIA_TYPE.bTemporalCompression
|
||||
// is false then all samples are sync points). A filter can start
|
||||
// a stream at any sync point. S_FALSE if not sync-point, S_OK if true.
|
||||
HRESULT STDCALL ( *IsSyncPoint )(IMediaSample* This);
|
||||
HRESULT STDCALL ( *SetSyncPoint )(IMediaSample* This,
|
||||
long bIsSyncPoint);
|
||||
|
||||
// preroll property. If true, this sample is for preroll only and
|
||||
// shouldn't be displayed.
|
||||
HRESULT STDCALL ( *IsPreroll )(IMediaSample* This);
|
||||
HRESULT STDCALL ( *SetPreroll )(IMediaSample* This,
|
||||
long bIsPreroll);
|
||||
|
||||
LONG STDCALL ( *GetActualDataLength )(IMediaSample* This);
|
||||
HRESULT STDCALL ( *SetActualDataLength )(IMediaSample* This,
|
||||
long __MIDL_0010);
|
||||
|
||||
// these allow for limited format changes in band - if no format change
|
||||
// has been made when you receive a sample GetMediaType will return S_FALSE
|
||||
HRESULT STDCALL ( *GetMediaType )(IMediaSample* This,
|
||||
AM_MEDIA_TYPE** ppMediaType);
|
||||
HRESULT STDCALL ( *SetMediaType )(IMediaSample* This,
|
||||
AM_MEDIA_TYPE* pMediaType);
|
||||
|
||||
// returns S_OK if there is a discontinuity in the data (this frame is
|
||||
// not a continuation of the previous stream of data
|
||||
// - there has been a seek or some dropped samples).
|
||||
HRESULT STDCALL ( *IsDiscontinuity )(IMediaSample* This);
|
||||
HRESULT STDCALL ( *SetDiscontinuity )(IMediaSample* This,
|
||||
long bDiscontinuity);
|
||||
|
||||
// get the media times for this sample
|
||||
HRESULT STDCALL ( *GetMediaTime )(IMediaSample* This,
|
||||
/* [out] */ long long* pTimeStart,
|
||||
/* [out] */ long long* pTimeEnd);
|
||||
// Set the media times for this sample
|
||||
// pTimeStart==pTimeEnd==NULL will invalidate the media time stamps in
|
||||
// this sample
|
||||
HRESULT STDCALL ( *SetMediaTime )(IMediaSample* This,
|
||||
/* [in] */ long long* pTimeStart,
|
||||
/* [in] */ long long* pTimeEnd);
|
||||
} IMediaSample_vt;
|
||||
struct IMediaSample { struct IMediaSample_vt* vt; };
|
||||
|
||||
|
||||
|
||||
//typedef struct IBaseFilter IBaseFilter;
|
||||
typedef struct IBaseFilter_vt
|
||||
{
|
||||
INHERIT_IUNKNOWN();
|
||||
|
||||
HRESULT STDCALL ( *GetClassID )(IBaseFilter * This,
|
||||
/* [out] */ CLSID *pClassID);
|
||||
HRESULT STDCALL ( *Stop )(IBaseFilter * This);
|
||||
HRESULT STDCALL ( *Pause )(IBaseFilter * This);
|
||||
HRESULT STDCALL ( *Run )(IBaseFilter * This,
|
||||
REFERENCE_TIME tStart);
|
||||
HRESULT STDCALL ( *GetState )(IBaseFilter * This,
|
||||
/* [in] */ unsigned long dwMilliSecsTimeout,
|
||||
///* [out] */ FILTER_STATE *State);
|
||||
void* State);
|
||||
HRESULT STDCALL ( *SetSyncSource )(IBaseFilter* This,
|
||||
/* [in] */ IReferenceClock *pClock);
|
||||
HRESULT STDCALL ( *GetSyncSource )(IBaseFilter* This,
|
||||
/* [out] */ IReferenceClock **pClock);
|
||||
HRESULT STDCALL ( *EnumPins )(IBaseFilter* This,
|
||||
/* [out] */ IEnumPins **ppEnum);
|
||||
HRESULT STDCALL ( *FindPin )(IBaseFilter* This,
|
||||
/* [string][in] */ const unsigned short* Id,
|
||||
/* [out] */ IPin** ppPin);
|
||||
HRESULT STDCALL ( *QueryFilterInfo )(IBaseFilter* This,
|
||||
// /* [out] */ FILTER_INFO *pInfo);
|
||||
void* pInfo);
|
||||
HRESULT STDCALL ( *JoinFilterGraph )(IBaseFilter* This,
|
||||
/* [in] */ IFilterGraph* pGraph,
|
||||
/* [string][in] */ const unsigned short* pName);
|
||||
HRESULT STDCALL ( *QueryVendorInfo )(IBaseFilter* This,
|
||||
/* [string][out] */ unsigned short** pVendorInfo);
|
||||
} IBaseFilter_vt;
|
||||
struct IBaseFilter { struct IBaseFilter_vt* vt; };
|
||||
|
||||
|
||||
|
||||
typedef struct IMemAllocator IMemAllocator;
|
||||
typedef struct IMemAllocator_vt
|
||||
{
|
||||
INHERIT_IUNKNOWN();
|
||||
|
||||
// specifies the number of buffers to allocate and the size of each buffer.
|
||||
HRESULT STDCALL ( *SetProperties )(IMemAllocator* This,
|
||||
/* [in] */ ALLOCATOR_PROPERTIES *pRequest,
|
||||
/* [out] */ ALLOCATOR_PROPERTIES *pActual);
|
||||
// retrieves the number of buffers that the allocator will create, and the buffer properties.
|
||||
HRESULT STDCALL ( *GetProperties )(IMemAllocator* This,
|
||||
/* [out] */ ALLOCATOR_PROPERTIES *pProps);
|
||||
// allocates the buffer memory.
|
||||
HRESULT STDCALL ( *Commit )(IMemAllocator* This);
|
||||
// releases the memory for the buffers.
|
||||
HRESULT STDCALL ( *Decommit )(IMemAllocator* This);
|
||||
// retrieves a media sample that contains an empty buffer.
|
||||
HRESULT STDCALL ( *GetBuffer )(IMemAllocator* This,
|
||||
/* [out] */ IMediaSample** ppBuffer,
|
||||
/* [in] */ REFERENCE_TIME* pStartTime,
|
||||
/* [in] */ REFERENCE_TIME* pEndTime,
|
||||
/* [in] */ unsigned long dwFlags);
|
||||
// releases a media sample.
|
||||
HRESULT STDCALL ( *ReleaseBuffer )(IMemAllocator* This,
|
||||
/* [in] */ IMediaSample* pBuffer);
|
||||
} IMemAllocator_vt;
|
||||
struct IMemAllocator { IMemAllocator_vt* vt; };
|
||||
|
||||
|
||||
|
||||
typedef struct IMemInputPin IMemInputPin;
|
||||
typedef struct IMemInputPin_vt
|
||||
{
|
||||
INHERIT_IUNKNOWN();
|
||||
|
||||
HRESULT STDCALL ( *GetAllocator )(IMemInputPin * This,
|
||||
/* [out] */ IMemAllocator **ppAllocator);
|
||||
HRESULT STDCALL ( *NotifyAllocator )(IMemInputPin * This,
|
||||
/* [in] */ IMemAllocator *pAllocator,
|
||||
/* [in] */ int bReadOnly);
|
||||
HRESULT STDCALL ( *GetAllocatorRequirements )(IMemInputPin * This,
|
||||
/* [out] */ ALLOCATOR_PROPERTIES *pProps);
|
||||
HRESULT STDCALL ( *Receive )(IMemInputPin * This,
|
||||
/* [in] */ IMediaSample *pSample);
|
||||
HRESULT STDCALL ( *ReceiveMultiple )(IMemInputPin * This,
|
||||
/* [size_is][in] */ IMediaSample **pSamples,
|
||||
/* [in] */ long nSamples,
|
||||
/* [out] */ long *nSamplesProcessed);
|
||||
HRESULT STDCALL ( *ReceiveCanBlock )(IMemInputPin * This);
|
||||
} IMemInputPin_vt;
|
||||
struct IMemInputPin { IMemInputPin_vt* vt; };
|
||||
|
||||
|
||||
typedef struct IHidden IHidden;
|
||||
typedef struct IHidden_vt
|
||||
{
|
||||
INHERIT_IUNKNOWN();
|
||||
|
||||
HRESULT STDCALL ( *GetSmth )(IHidden* This, int* pv);
|
||||
HRESULT STDCALL ( *SetSmth )(IHidden* This, int v1, int v2);
|
||||
HRESULT STDCALL ( *GetSmth2 )(IHidden* This, int* pv);
|
||||
HRESULT STDCALL ( *SetSmth2 )(IHidden* This, int v1, int v2);
|
||||
HRESULT STDCALL ( *GetSmth3 )(IHidden* This, int* pv);
|
||||
HRESULT STDCALL ( *SetSmth3 )(IHidden* This, int v1, int v2);
|
||||
HRESULT STDCALL ( *GetSmth4 )(IHidden* This, int* pv);
|
||||
HRESULT STDCALL ( *SetSmth4 )(IHidden* This, int v1, int v2);
|
||||
HRESULT STDCALL ( *GetSmth5 )(IHidden* This, int* pv);
|
||||
HRESULT STDCALL ( *SetSmth5 )(IHidden* This, int v1, int v2);
|
||||
HRESULT STDCALL ( *GetSmth6 )(IHidden* This, int* pv);
|
||||
} IHidden_vt;
|
||||
struct IHidden { struct IHidden_vt* vt; };
|
||||
|
||||
|
||||
typedef struct IHidden2 IHidden2;
|
||||
typedef struct IHidden2_vt
|
||||
{
|
||||
INHERIT_IUNKNOWN();
|
||||
|
||||
HRESULT STDCALL ( *unk1 )(void);
|
||||
HRESULT STDCALL ( *unk2 )(void);
|
||||
HRESULT STDCALL ( *unk3 )(void);
|
||||
HRESULT STDCALL ( *DecodeGet )(IHidden2* This, int* region);
|
||||
HRESULT STDCALL ( *unk5 )(void);
|
||||
HRESULT STDCALL ( *DecodeSet )(IHidden2* This, int* region);
|
||||
HRESULT STDCALL ( *unk7 )(void);
|
||||
HRESULT STDCALL ( *unk8 )(void);
|
||||
} IHidden2_vt;
|
||||
struct IHidden2 { struct IHidden2_vt* vt; };
|
||||
|
||||
|
||||
// fixme
|
||||
typedef struct IDivxFilterInterface {
|
||||
struct IDivxFilterInterface_vt* vt;
|
||||
} IDivxFilterInterface;
|
||||
|
||||
struct IDivxFilterInterface_vt
|
||||
{
|
||||
INHERIT_IUNKNOWN();
|
||||
|
||||
HRESULT STDCALL ( *get_PPLevel )(IDivxFilterInterface* This, int* PPLevel); // current postprocessing level
|
||||
HRESULT STDCALL ( *put_PPLevel )(IDivxFilterInterface* This, int PPLevel); // new postprocessing level
|
||||
HRESULT STDCALL ( *put_DefaultPPLevel )(IDivxFilterInterface* This);
|
||||
HRESULT STDCALL ( *put_MaxDelayAllowed )(IDivxFilterInterface* This, int maxdelayallowed);
|
||||
HRESULT STDCALL ( *put_Brightness )(IDivxFilterInterface* This, int brightness);
|
||||
HRESULT STDCALL ( *put_Contrast )(IDivxFilterInterface* This, int contrast);
|
||||
HRESULT STDCALL ( *put_Saturation )(IDivxFilterInterface* This, int saturation);
|
||||
HRESULT STDCALL ( *get_MaxDelayAllowed )(IDivxFilterInterface* This, int* maxdelayallowed);
|
||||
HRESULT STDCALL ( *get_Brightness)(IDivxFilterInterface* This, int* brightness);
|
||||
HRESULT STDCALL ( *get_Contrast)(IDivxFilterInterface* This, int* contrast);
|
||||
HRESULT STDCALL ( *get_Saturation )(IDivxFilterInterface* This, int* saturation);
|
||||
HRESULT STDCALL ( *put_AspectRatio )(IDivxFilterInterface* This, int x, IDivxFilterInterface* Thisit, int y);
|
||||
HRESULT STDCALL ( *get_AspectRatio )(IDivxFilterInterface* This, int* x, IDivxFilterInterface* Thisit, int* y);
|
||||
};
|
||||
|
||||
typedef struct IEnumFilters IEnumFilters;
|
||||
|
||||
typedef struct IFilterGraph_vt
|
||||
{
|
||||
INHERIT_IUNKNOWN();
|
||||
|
||||
HRESULT STDCALL ( *AddFilter )(IFilterGraph* This,
|
||||
/* [in] */ IBaseFilter* pFilter,
|
||||
/* [string][in] */ unsigned short* pName);
|
||||
HRESULT STDCALL ( *RemoveFilter )(IFilterGraph* This,
|
||||
/* [in] */ IBaseFilter* pFilter);
|
||||
HRESULT STDCALL ( *EnumFilters )(IFilterGraph* This,
|
||||
/* [out] */ IEnumFilters** ppEnum);
|
||||
HRESULT STDCALL ( *FindFilterByName )(IFilterGraph* This,
|
||||
/* [string][in] */ unsigned short* pName,
|
||||
/* [out] */ IBaseFilter** ppFilter);
|
||||
HRESULT STDCALL ( *ConnectDirect )(IFilterGraph* This,
|
||||
/* [in] */ IPin* ppinOut,
|
||||
/* [in] */ IPin* ppinIn,
|
||||
/* [in] */ const AM_MEDIA_TYPE* pmt);
|
||||
HRESULT STDCALL ( *Reconnect )(IFilterGraph* This,
|
||||
/* [in] */ IPin* ppin);
|
||||
HRESULT STDCALL ( *Disconnect )(IFilterGraph* This,
|
||||
/* [in] */ IPin* ppin);
|
||||
HRESULT STDCALL ( *SetDefaultSyncSource )(IFilterGraph* This);
|
||||
} IFilterGraph_vt;
|
||||
struct IFilterGraph { IFilterGraph_vt *vt; };
|
||||
|
||||
#endif /*MPLAYER_INTERFACES_H */
|
||||
@@ -1,54 +0,0 @@
|
||||
/*
|
||||
* Modified for use with MPlayer, detailed changelog at
|
||||
* http://svn.mplayerhq.hu/mplayer/trunk/
|
||||
*/
|
||||
|
||||
#ifndef MPLAYER_IUNK_H
|
||||
#define MPLAYER_IUNK_H
|
||||
|
||||
#include "guids.h"
|
||||
|
||||
#define INHERIT_IUNKNOWN() \
|
||||
long STDCALL ( *QueryInterface )(IUnknown * This, const GUID* riid, void **ppvObject); \
|
||||
long STDCALL ( *AddRef )(IUnknown * This); \
|
||||
long STDCALL ( *Release )(IUnknown * This);
|
||||
|
||||
#define DECLARE_IUNKNOWN() \
|
||||
int refcount;
|
||||
|
||||
#define IMPLEMENT_IUNKNOWN(CLASSNAME) \
|
||||
static long STDCALL CLASSNAME ## _QueryInterface(IUnknown * This, \
|
||||
const GUID* riid, void **ppvObject) \
|
||||
{ \
|
||||
CLASSNAME * me = (CLASSNAME *)This; \
|
||||
GUID* r; unsigned int i = 0; \
|
||||
Debug printf(#CLASSNAME "_QueryInterface(%p) called\n", This);\
|
||||
if (!ppvObject) return E_POINTER; \
|
||||
for(r=me->interfaces; i<sizeof(me->interfaces)/sizeof(me->interfaces[0]); r++, i++) \
|
||||
if(!memcmp(r, riid, sizeof(*r))) \
|
||||
{ \
|
||||
me->vt->AddRef((IUnknown*)This); \
|
||||
*ppvObject=This; \
|
||||
return 0; \
|
||||
} \
|
||||
Debug printf("Query failed! (GUID: 0x%x)\n", *(unsigned int*)riid); \
|
||||
return E_NOINTERFACE; \
|
||||
} \
|
||||
\
|
||||
static long STDCALL CLASSNAME ## _AddRef(IUnknown * This) \
|
||||
{ \
|
||||
CLASSNAME * me=( CLASSNAME *)This; \
|
||||
Debug printf(#CLASSNAME "_AddRef(%p) called (ref:%d)\n", This, me->refcount); \
|
||||
return ++(me->refcount); \
|
||||
} \
|
||||
\
|
||||
static long STDCALL CLASSNAME ## _Release(IUnknown * This) \
|
||||
{ \
|
||||
CLASSNAME* me=( CLASSNAME *)This; \
|
||||
Debug printf(#CLASSNAME "_Release(%p) called (new ref:%d)\n", This, me->refcount - 1); \
|
||||
if(--(me->refcount) == 0) \
|
||||
CLASSNAME ## _Destroy(me); \
|
||||
return 0; \
|
||||
}
|
||||
|
||||
#endif /* MPLAYER_IUNK_H */
|
||||
@@ -1,256 +0,0 @@
|
||||
#ifndef MPLAYER_LIBWIN32_H
|
||||
#define MPLAYER_LIBWIN32_H
|
||||
|
||||
#define VFW_E_NOT_RUNNING 0x80040226
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
//#define FATAL(a) // you don't need exception - if you want - just fill more code
|
||||
#include "loader/wine/mmreg.h"
|
||||
#include "loader/wine/winreg.h"
|
||||
#include "loader/wine/vfw.h"
|
||||
#include "loader/com.h"
|
||||
|
||||
typedef uint32_t fourcc_t;
|
||||
|
||||
/*
|
||||
typedef struct FatalError
|
||||
{
|
||||
FatalError();
|
||||
void PrintAll(void) {}
|
||||
}FatalError;
|
||||
*/
|
||||
|
||||
typedef struct CodecInfo
|
||||
{
|
||||
char* dll;
|
||||
GUID* guid;
|
||||
}CodecInfo;
|
||||
|
||||
|
||||
typedef struct CImage // public your_libvo_mem
|
||||
{
|
||||
char* ptr;
|
||||
|
||||
/*char* (*Data)();
|
||||
{
|
||||
return 0;
|
||||
// pointer to memory block
|
||||
}*/
|
||||
/*int (*Supported)(fourcc_t csp, int bits);
|
||||
{
|
||||
return true;
|
||||
// if you support such surface
|
||||
}*/
|
||||
}CImage;
|
||||
|
||||
|
||||
#if 0
|
||||
struct BitmapInfo : public BITMAPINFOHEADER
|
||||
{
|
||||
void SetBits(int b) { return; /*fixme*/ }
|
||||
void SetSpace(int b) { return; /*fixme*/ }
|
||||
};
|
||||
#endif
|
||||
|
||||
typedef struct IAudioDecoder
|
||||
{
|
||||
WAVEFORMATEX in_fmt;
|
||||
CodecInfo record;
|
||||
/*(*IAudioDecoder)( CodecInfo * r, const WAVEFORMATEX* w);
|
||||
{
|
||||
memcpy(&this->record,r,sizeof(CodecInfo));
|
||||
in_fmt = *w;
|
||||
}*/
|
||||
}IAudioDecoder;
|
||||
|
||||
/*
|
||||
struct IAudioEncoder
|
||||
{
|
||||
IAudioEncoder(const CodecInfo&, WAVEFORMATEX*) {}
|
||||
// you do not need this one...
|
||||
};
|
||||
*/
|
||||
|
||||
enum CAPS
|
||||
{
|
||||
CAP_NONE = 0,
|
||||
CAP_YUY2 = 1,
|
||||
CAP_YV12 = 2,
|
||||
CAP_IYUV = 4,
|
||||
CAP_UYVY = 8,
|
||||
CAP_YVYU = 16,
|
||||
CAP_I420 = 32,
|
||||
CAP_YVU9 = 64,
|
||||
CAP_IF09 = 128,
|
||||
};
|
||||
enum DecodingMode
|
||||
{
|
||||
DIRECT = 0,
|
||||
REALTIME,
|
||||
REALTIME_QUALITY_AUTO,
|
||||
};
|
||||
enum DecodingState
|
||||
{
|
||||
STOP = 0,
|
||||
START,
|
||||
};
|
||||
|
||||
typedef struct BitmapInfo
|
||||
{
|
||||
long biSize;
|
||||
long biWidth;
|
||||
long biHeight;
|
||||
short biPlanes;
|
||||
short biBitCount;
|
||||
long biCompression;
|
||||
long biSizeImage;
|
||||
long biXPelsPerMeter;
|
||||
long biYPelsPerMeter;
|
||||
long biClrUsed;
|
||||
long biClrImportant;
|
||||
int colors[3];
|
||||
} BitmapInfo;
|
||||
|
||||
typedef struct IVideoDecoder
|
||||
{
|
||||
int VBUFSIZE;
|
||||
int QMARKHI;
|
||||
int QMARKLO;
|
||||
int DMARKHI;
|
||||
int DMARKLO;
|
||||
|
||||
/*
|
||||
IVideoDecoder(CodecInfo& info, const BITMAPINFOHEADER& format) : record(info)
|
||||
{
|
||||
// implement init part
|
||||
}
|
||||
virtual ~IVideoDecoder();
|
||||
void Stop()
|
||||
{
|
||||
}
|
||||
void Start()
|
||||
{
|
||||
}
|
||||
*/
|
||||
const CodecInfo record;
|
||||
int m_Mode; // should we do precaching (or even change Quality on the fly)
|
||||
int m_State;
|
||||
int m_iDecpos;
|
||||
int m_iPlaypos;
|
||||
float m_fQuality; // quality for the progress bar 0..1(best)
|
||||
int m_bCapable16b;
|
||||
|
||||
BITMAPINFOHEADER* m_bh; // format of input data (might be larger - e.g. huffyuv)
|
||||
BitmapInfo m_decoder; // format of decoder output
|
||||
BitmapInfo m_obh; // format of returned frames
|
||||
}IVideoDecoder;
|
||||
|
||||
/*
|
||||
struct IRtConfig
|
||||
{
|
||||
};
|
||||
*/
|
||||
|
||||
// might be minimalized to contain just those which are needed by DS_VideoDecoder
|
||||
|
||||
#ifndef mmioFOURCC
|
||||
#define mmioFOURCC( ch0, ch1, ch2, ch3 ) \
|
||||
( (long)(unsigned char)(ch0) | ( (long)(unsigned char)(ch1) << 8 ) | \
|
||||
( (long)(unsigned char)(ch2) << 16 ) | ( (long)(unsigned char)(ch3) << 24 ) )
|
||||
#endif /* mmioFOURCC */
|
||||
|
||||
/* OpenDivX */
|
||||
#define fccMP4S mmioFOURCC('M', 'P', '4', 'S')
|
||||
#define fccmp4s mmioFOURCC('m', 'p', '4', 's')
|
||||
#define fccDIVX mmioFOURCC('D', 'I', 'V', 'X')
|
||||
#define fccdivx mmioFOURCC('d', 'i', 'v', 'x')
|
||||
#define fccDIV1 mmioFOURCC('D', 'I', 'V', '1')
|
||||
#define fccdiv1 mmioFOURCC('d', 'i', 'v', '1')
|
||||
|
||||
/* DivX codecs */
|
||||
#define fccDIV2 mmioFOURCC('D', 'I', 'V', '2')
|
||||
#define fccdiv2 mmioFOURCC('d', 'i', 'v', '2')
|
||||
#define fccDIV3 mmioFOURCC('D', 'I', 'V', '3')
|
||||
#define fccdiv3 mmioFOURCC('d', 'i', 'v', '3')
|
||||
#define fccDIV4 mmioFOURCC('D', 'I', 'V', '4')
|
||||
#define fccdiv4 mmioFOURCC('d', 'i', 'v', '4')
|
||||
#define fccDIV5 mmioFOURCC('D', 'I', 'V', '5')
|
||||
#define fccdiv5 mmioFOURCC('d', 'i', 'v', '5')
|
||||
#define fccDIV6 mmioFOURCC('D', 'I', 'V', '6')
|
||||
#define fccdiv6 mmioFOURCC('d', 'i', 'v', '6')
|
||||
#define fccMP41 mmioFOURCC('M', 'P', '4', '1')
|
||||
#define fccmp41 mmioFOURCC('m', 'p', '4', '1')
|
||||
#define fccMP43 mmioFOURCC('M', 'P', '4', '3')
|
||||
#define fccmp43 mmioFOURCC('m', 'p', '4', '3')
|
||||
/* old ms mpeg-4 codecs */
|
||||
#define fccMP42 mmioFOURCC('M', 'P', '4', '2')
|
||||
#define fccmp42 mmioFOURCC('m', 'p', '4', '2')
|
||||
#define fccMPG4 mmioFOURCC('M', 'P', 'G', '4')
|
||||
#define fccmpg4 mmioFOURCC('m', 'p', 'g', '4')
|
||||
/* Windows media codecs */
|
||||
#define fccWMV1 mmioFOURCC('W', 'M', 'V', '1')
|
||||
#define fccwmv1 mmioFOURCC('w', 'm', 'v', '1')
|
||||
#define fccWMV2 mmioFOURCC('W', 'M', 'V', '2')
|
||||
#define fccwmv2 mmioFOURCC('w', 'm', 'v', '2')
|
||||
#define fccMWV1 mmioFOURCC('M', 'W', 'V', '1')
|
||||
|
||||
/* Angel codecs */
|
||||
#define fccAP41 mmioFOURCC('A', 'P', '4', '1')
|
||||
#define fccap41 mmioFOURCC('a', 'p', '4', '1')
|
||||
#define fccAP42 mmioFOURCC('A', 'P', '4', '2')
|
||||
#define fccap42 mmioFOURCC('a', 'p', '4', '2')
|
||||
|
||||
/* other codecs */
|
||||
#define fccIV31 mmioFOURCC('I', 'V', '3', '1')
|
||||
#define fcciv31 mmioFOURCC('i', 'v', '3', '1')
|
||||
#define fccIV32 mmioFOURCC('I', 'V', '3', '2')
|
||||
#define fcciv32 mmioFOURCC('i', 'v', '3', '2')
|
||||
#define fccIV41 mmioFOURCC('I', 'V', '4', '1')
|
||||
#define fcciv41 mmioFOURCC('i', 'v', '4', '1')
|
||||
#define fccIV50 mmioFOURCC('I', 'V', '5', '0')
|
||||
#define fcciv50 mmioFOURCC('i', 'v', '5', '0')
|
||||
#define fccI263 mmioFOURCC('I', '2', '6', '3')
|
||||
#define fcci263 mmioFOURCC('i', '2', '6', '3')
|
||||
|
||||
#define fccMJPG mmioFOURCC('M', 'J', 'P', 'G')
|
||||
#define fccmjpg mmioFOURCC('m', 'j', 'p', 'g')
|
||||
|
||||
#define fccHFYU mmioFOURCC('H', 'F', 'Y', 'U')
|
||||
|
||||
#define fcccvid mmioFOURCC('c', 'v', 'i', 'd')
|
||||
#define fccdvsd mmioFOURCC('d', 'v', 's', 'd')
|
||||
|
||||
/* Ati codecs */
|
||||
#define fccVCR2 mmioFOURCC('V', 'C', 'R', '2')
|
||||
#define fccVCR1 mmioFOURCC('V', 'C', 'R', '1')
|
||||
#define fccVYUY mmioFOURCC('V', 'Y', 'U', 'Y')
|
||||
#define fccIYU9 mmioFOURCC('I', 'Y', 'U', '9') // it was defined as fccYVU9
|
||||
|
||||
/* Asus codecs */
|
||||
#define fccASV1 mmioFOURCC('A', 'S', 'V', '1')
|
||||
#define fccASV2 mmioFOURCC('A', 'S', 'V', '2')
|
||||
|
||||
/* Microsoft video */
|
||||
#define fcccram mmioFOURCC('c', 'r', 'a', 'm')
|
||||
#define fccCRAM mmioFOURCC('C', 'R', 'A', 'M')
|
||||
#define fccMSVC mmioFOURCC('M', 'S', 'V', 'C')
|
||||
|
||||
|
||||
#define fccMSZH mmioFOURCC('M', 'S', 'Z', 'H')
|
||||
|
||||
#define fccZLIB mmioFOURCC('Z', 'L', 'I', 'B')
|
||||
|
||||
#define fccTM20 mmioFOURCC('T', 'M', '2', '0')
|
||||
|
||||
#define fccYUV mmioFOURCC('Y', 'U', 'V', ' ')
|
||||
#define fccYUY2 mmioFOURCC('Y', 'U', 'Y', '2')
|
||||
#define fccYV12 mmioFOURCC('Y', 'V', '1', '2')/* Planar mode: Y + V + U (3 planes) */
|
||||
#define fccI420 mmioFOURCC('I', '4', '2', '0')
|
||||
#define fccIYUV mmioFOURCC('I', 'Y', 'U', 'V')/* Planar mode: Y + U + V (3 planes) */
|
||||
#define fccUYVY mmioFOURCC('U', 'Y', 'V', 'Y')/* Packed mode: U0+Y0+V0+Y1 (1 plane) */
|
||||
#define fccYVYU mmioFOURCC('Y', 'V', 'Y', 'U')/* Packed mode: Y0+V0+Y1+U0 (1 plane) */
|
||||
#define fccYVU9 mmioFOURCC('Y', 'V', 'U', '9')/* Planar 4:1:0 */
|
||||
#define fccIF09 mmioFOURCC('I', 'F', '0', '9')/* Planar 4:1:0 + delta */
|
||||
|
||||
#endif /* MPLAYER_LIBWIN32_H */
|
||||
@@ -1,161 +0,0 @@
|
||||
/*
|
||||
* AM_MEDIA_TYPE service functions implementations
|
||||
* Code is based on quartz/enummedia.c file from wine project.
|
||||
* Modified by Vladimir Voroshilov
|
||||
*
|
||||
* Original code: Copyright 2003 Robert Shearman
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
#include "mp_msg.h"
|
||||
#include "libmpcodecs/img_format.h"
|
||||
#include "loader/wine/winerror.h"
|
||||
#include "loader/com.h"
|
||||
#include "mediatype.h"
|
||||
#include "libwin32.h"
|
||||
|
||||
void DisplayMediaType(const char * label,const AM_MEDIA_TYPE* pmt){
|
||||
WAVEFORMATEX* pWF;
|
||||
VIDEOINFOHEADER* Vhdr;
|
||||
int i;
|
||||
GUID* iid;
|
||||
|
||||
|
||||
Debug mp_msg(MSGT_LOADER,MSGL_DBG4,"=======================\n");
|
||||
if(label){
|
||||
Debug mp_msg(MSGT_LOADER,MSGL_DBG4,"AM_MEDIA_TYPE: %s\n",label);
|
||||
}else
|
||||
Debug mp_msg(MSGT_LOADER,MSGL_DBG4,"AM_MEDIA_TYPE:\n");
|
||||
Debug mp_msg(MSGT_LOADER,MSGL_DBG4,"-(Ptr:%p)--------\n",pmt);
|
||||
for(i=0;i<sizeof(AM_MEDIA_TYPE);i++){
|
||||
Debug mp_msg(MSGT_LOADER,MSGL_DBG4,"%02x ",(BYTE)((BYTE*)pmt)[i]);
|
||||
if((i+1)%8==0) Debug mp_msg(MSGT_LOADER,MSGL_DBG4,"\n");
|
||||
}
|
||||
if((i)%8!=0) Debug mp_msg(MSGT_LOADER,MSGL_DBG4,"\n");
|
||||
Debug mp_msg(MSGT_LOADER,MSGL_DBG4,"-(Ptr:%p)--(%lu)--\n",pmt->pbFormat,pmt->cbFormat);
|
||||
for(i=0;i<pmt->cbFormat;i++){
|
||||
Debug mp_msg(MSGT_LOADER,MSGL_DBG4,"%02x ",(BYTE)pmt->pbFormat[i]);
|
||||
if((i+1)%8==0) Debug mp_msg(MSGT_LOADER,MSGL_DBG4,"\n");
|
||||
}
|
||||
if((i)%8!=0) Debug mp_msg(MSGT_LOADER,MSGL_DBG4,"\n");
|
||||
Debug mp_msg(MSGT_LOADER,MSGL_DBG4,"-----------------------\n");
|
||||
iid=(GUID*)&(pmt->subtype);
|
||||
Debug mp_msg(MSGT_LOADER,MSGL_DBG4,"Subtype: %08x-%04x-%04x-%02x%02x-"
|
||||
"%02x%02x%02x%02x%02x%02x\n",
|
||||
iid->f1, iid->f2, iid->f3,
|
||||
(unsigned char)iid->f4[1], (unsigned char)iid->f4[0],
|
||||
(unsigned char)iid->f4[2], (unsigned char)iid->f4[3],
|
||||
(unsigned char)iid->f4[4], (unsigned char)iid->f4[5],
|
||||
(unsigned char)iid->f4[6], (unsigned char)iid->f4[7]);
|
||||
|
||||
iid=(GUID*)&(pmt->formattype);
|
||||
Debug mp_msg(MSGT_LOADER,MSGL_DBG4,"Format type: %08x-%04x-%04x-%02x%02x-"
|
||||
"%02x%02x%02x%02x%02x%02x\n",
|
||||
iid->f1, iid->f2, iid->f3,
|
||||
(unsigned char)iid->f4[1], (unsigned char)iid->f4[0],
|
||||
(unsigned char)iid->f4[2], (unsigned char)iid->f4[3],
|
||||
(unsigned char)iid->f4[4], (unsigned char)iid->f4[5],
|
||||
(unsigned char)iid->f4[6], (unsigned char)iid->f4[7]);
|
||||
if(pmt && memcmp(&pmt->formattype,&FORMAT_WaveFormatEx,16)==0 && pmt->pbFormat){
|
||||
pWF=(WAVEFORMATEX*)pmt->pbFormat;
|
||||
Debug mp_msg(MSGT_LOADER,MSGL_DBG4,"PMT: nChannels %d\n",pWF->nChannels);
|
||||
Debug mp_msg(MSGT_LOADER,MSGL_DBG4,"PMT: nSamplesPerSec %ld\n",pWF->nSamplesPerSec);
|
||||
Debug mp_msg(MSGT_LOADER,MSGL_DBG4,"PMT: wBitsPerSample %d\n",pWF->wBitsPerSample);
|
||||
Debug mp_msg(MSGT_LOADER,MSGL_DBG4,"PMT: nBlockAlign %d\n",pWF->nBlockAlign);
|
||||
Debug mp_msg(MSGT_LOADER,MSGL_DBG4,"PMT: nAvgBytesPerSec %ld\n",pWF->nAvgBytesPerSec);
|
||||
Debug mp_msg(MSGT_LOADER,MSGL_DBG4,"PMT: SampleSize %ld\n",pmt->lSampleSize);
|
||||
}
|
||||
if(pmt && memcmp(&pmt->formattype,&FORMAT_VideoInfo,16)==0 && pmt->pbFormat){
|
||||
Vhdr=(VIDEOINFOHEADER*)pmt->pbFormat;
|
||||
Debug mp_msg(MSGT_LOADER,MSGL_DBG4,"Vhdr: dwBitRate %ld\n",Vhdr->dwBitRate);
|
||||
Debug mp_msg(MSGT_LOADER,MSGL_DBG4,"Vhdr: biWidth %ld\n",Vhdr->bmiHeader.biWidth);
|
||||
Debug mp_msg(MSGT_LOADER,MSGL_DBG4,"Vhdr: biHeight %ld\n",Vhdr->bmiHeader.biHeight);
|
||||
Debug mp_msg(MSGT_LOADER,MSGL_DBG4,"Vhdr: biSizeImage %ld\n",Vhdr->bmiHeader.biSizeImage);
|
||||
Debug mp_msg(MSGT_LOADER,MSGL_DBG4,"Vhdr: biBitCount %d\n",Vhdr->bmiHeader.biBitCount);
|
||||
if(Vhdr->bmiHeader.biCompression){
|
||||
Debug mp_msg(MSGT_LOADER,MSGL_DBG4,"Vhdr: biComression 0x%08lx (%s)\n",Vhdr->bmiHeader.biCompression,vo_format_name(Vhdr->bmiHeader.biCompression));
|
||||
}else
|
||||
Debug mp_msg(MSGT_LOADER,MSGL_DBG4,"Vhdr: biComression 0x00000000\n");
|
||||
|
||||
}
|
||||
Debug mp_msg(MSGT_LOADER,MSGL_DBG4,"=======================\n");
|
||||
}
|
||||
|
||||
HRESULT CopyMediaType(AM_MEDIA_TYPE * pDest, const AM_MEDIA_TYPE *pSrc)
|
||||
{
|
||||
Debug mp_msg(MSGT_LOADER,MSGL_DBG4,"%s(%p) called\n", "CopyMediaType",pSrc);
|
||||
|
||||
if(!pSrc || !pDest) return E_POINTER;
|
||||
|
||||
if(pSrc == pDest) return E_INVALIDARG;
|
||||
|
||||
if(!pSrc->pbFormat && pSrc->cbFormat) return E_POINTER;
|
||||
|
||||
memcpy(pDest, pSrc, sizeof(AM_MEDIA_TYPE));
|
||||
if (!pSrc->pbFormat) return S_OK;
|
||||
if (!(pDest->pbFormat = CoTaskMemAlloc(pSrc->cbFormat)))
|
||||
return E_OUTOFMEMORY;
|
||||
memcpy(pDest->pbFormat, pSrc->pbFormat, pSrc->cbFormat);
|
||||
if (pDest->pUnk)
|
||||
pDest->pUnk->vt->AddRef(pDest->pUnk);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
void FreeMediaType(AM_MEDIA_TYPE * pMediaType)
|
||||
{
|
||||
if (!pMediaType) return;
|
||||
if (pMediaType->pbFormat)
|
||||
{
|
||||
CoTaskMemFree(pMediaType->pbFormat);
|
||||
pMediaType->pbFormat = NULL;
|
||||
}
|
||||
if (pMediaType->pUnk)
|
||||
{
|
||||
pMediaType->pUnk->vt->Release(pMediaType->pUnk);
|
||||
pMediaType->pUnk = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
AM_MEDIA_TYPE * CreateMediaType(AM_MEDIA_TYPE const * pSrc)
|
||||
{
|
||||
AM_MEDIA_TYPE * pDest;
|
||||
if (!pSrc) return NULL;
|
||||
pDest = CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE));
|
||||
if (!pDest)
|
||||
return NULL;
|
||||
|
||||
if (FAILED(CopyMediaType(pDest, pSrc)))
|
||||
{
|
||||
CoTaskMemFree(pDest);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return pDest;
|
||||
}
|
||||
|
||||
void DeleteMediaType(AM_MEDIA_TYPE * pMediaType)
|
||||
{
|
||||
if (!pMediaType) return;
|
||||
FreeMediaType(pMediaType);
|
||||
CoTaskMemFree(pMediaType);
|
||||
}
|
||||
|
||||
#define IsEqualGUID(a,b) (memcmp(a,b,16)==0)
|
||||
int CompareMediaTypes(const AM_MEDIA_TYPE * pmt1, const AM_MEDIA_TYPE * pmt2, int bWildcards)
|
||||
{
|
||||
return ((bWildcards && (IsEqualGUID(&pmt1->majortype, &GUID_NULL) || IsEqualGUID(&pmt2->majortype, &GUID_NULL))) || IsEqualGUID(&pmt1->majortype, &pmt2->majortype)) &&
|
||||
((bWildcards && (IsEqualGUID(&pmt1->subtype, &GUID_NULL) || IsEqualGUID(&pmt2->subtype, &GUID_NULL))) || IsEqualGUID(&pmt1->subtype, &pmt2->subtype));
|
||||
}
|
||||
@@ -1,96 +0,0 @@
|
||||
/*
|
||||
-------------------------------------------------------------------
|
||||
AM_MEDIA_TYPE service functions declarations
|
||||
-------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef MPLAYER_MEDIATYPE_H
|
||||
#define MPLAYER_MEDIATYPE_H
|
||||
|
||||
#include "guids.h"
|
||||
|
||||
typedef struct __attribute__((__packed__)) MediaType
|
||||
{
|
||||
GUID majortype; //0x0
|
||||
GUID subtype; //0x10
|
||||
int bFixedSizeSamples; //0x20
|
||||
int bTemporalCompression; //0x24
|
||||
unsigned long lSampleSize; //0x28
|
||||
GUID formattype; //0x2c
|
||||
IUnknown* pUnk; //0x3c
|
||||
unsigned long cbFormat; //0x40
|
||||
char* pbFormat; //0x44
|
||||
} AM_MEDIA_TYPE;
|
||||
|
||||
/**
|
||||
* \brief print info from AM_MEDIA_TYPE structure
|
||||
* =param[in] label short lable for media type
|
||||
* \param[in] pmt pointer to AM_MEDIA_TYPE
|
||||
*
|
||||
* routine used for debug purposes
|
||||
*
|
||||
*/
|
||||
void DisplayMediaType(const char * label,const AM_MEDIA_TYPE* pmt);
|
||||
/**
|
||||
* \brief frees memory, pointed by pbFormat and pUnk members of AM_MEDIA_TYPE structure
|
||||
*
|
||||
* \param[in] pmt pointer to structure
|
||||
*
|
||||
* \note
|
||||
* routine does not frees memory allocated for AM_MEDIA_TYPE, so given pointer will be
|
||||
* valid after this routine call.
|
||||
*
|
||||
*/
|
||||
void FreeMediaType(AM_MEDIA_TYPE* pmt);
|
||||
/**
|
||||
* \brief frees memory allocated for AM_MEDIA_TYPE structure, including pbFormat and pUnk
|
||||
* members
|
||||
*
|
||||
* \param[in] pmt pointer to structure
|
||||
*
|
||||
* \note
|
||||
* after call to this routine, pointer to AM_MEDIA_TYPE will not be valid anymore
|
||||
*
|
||||
*/
|
||||
void DeleteMediaType(AM_MEDIA_TYPE* pmt);
|
||||
/**
|
||||
* \brief copyies info from source to destination AM_MEDIA_TYPE structures
|
||||
*
|
||||
* \param[in] pSrc pointer to AM_MEDIA_TYPE structure to copy data from
|
||||
* \param[out] pDst pointer to AM_MEDIA_TYPE structure to copy data to
|
||||
*
|
||||
* \return S_OK - success
|
||||
* \return E_POINTER - pSrc or pDst is NULL or (pSrc->cbFormat && !pSrc->pbFormat)
|
||||
* \return E_INVALIDARG - (pSrc == pDst)
|
||||
* \return E_OUTOFMEMORY - Insufficient memory
|
||||
*
|
||||
* \note
|
||||
* - pDst must point to existing AM_MEDIA_TYPE structure (all data will be overwritten)
|
||||
* - if pDst->pbFormat!=NULL this will cause memory leak (as described in Directshow SDK)!
|
||||
*
|
||||
*/
|
||||
HRESULT CopyMediaType(AM_MEDIA_TYPE* pDst,const AM_MEDIA_TYPE* pSrc);
|
||||
/**
|
||||
* \brief allocates new AM_MEDIA_TYPE structure and fills it with info from given one
|
||||
*
|
||||
* \param[in] pSrc pointer to AM_MEDIA_TYPE structure to copy data from
|
||||
*
|
||||
* \return result code, returned from CopyMediaType
|
||||
*
|
||||
*/
|
||||
AM_MEDIA_TYPE* CreateMediaType(const AM_MEDIA_TYPE* pSrc);
|
||||
|
||||
/**
|
||||
* \brief compares two AM_MEDIA_TYPE structures for compatibility
|
||||
*
|
||||
* \param[in] pmt1 first AM_MEDIA_TYPE structure for compare
|
||||
* \param[in] pmt2 second AM_MEDIA_TYPE structure for compare
|
||||
* \param[in] bWildcards 1 means that GUID_NULL of one structure will be compatible with any value of another structure
|
||||
*
|
||||
* \return 1 if structures are compatible
|
||||
* \return 0 if structures are not compatible
|
||||
*
|
||||
*/
|
||||
int CompareMediaTypes(const AM_MEDIA_TYPE * pmt1, const AM_MEDIA_TYPE * pmt2, int bWildcards);
|
||||
|
||||
#endif /* MPLAYER_MEDIA_TYPE_H */
|
||||
@@ -1,957 +0,0 @@
|
||||
/*
|
||||
* Modified for use with MPlayer, detailed changelog at
|
||||
* http://svn.mplayerhq.hu/mplayer/trunk/
|
||||
*/
|
||||
|
||||
#include "loader/wine/winerror.h"
|
||||
#include "loader/wine/windef.h"
|
||||
#include "outputpin.h"
|
||||
#include "mediatype.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
static inline int output_unimplemented(const char* s, void* p)
|
||||
{
|
||||
Debug printf("%s(%p) called (UNIMPLEMENTED)", s, p);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
/**
|
||||
An object beyond interface IEnumMediaTypes.
|
||||
Returned by COutputPin through call IPin::EnumMediaTypes().
|
||||
*/
|
||||
typedef struct CEnumMediaTypes
|
||||
{
|
||||
IEnumMediaTypes_vt* vt;
|
||||
DECLARE_IUNKNOWN();
|
||||
AM_MEDIA_TYPE type;
|
||||
GUID interfaces[2];
|
||||
} CEnumMediaTypes;
|
||||
|
||||
/**
|
||||
IMemOutput interface implementation
|
||||
*/
|
||||
struct COutputMemPin
|
||||
{
|
||||
IMemInputPin_vt* vt;
|
||||
DECLARE_IUNKNOWN();
|
||||
char** frame_pointer;
|
||||
long* frame_size_pointer;
|
||||
MemAllocator* pAllocator;
|
||||
COutputPin* parent;
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief IEnumMediaTypes:Next (retrives a specified number of media types )
|
||||
*
|
||||
* \param[in] This pointer to CEnumMediaTypes object
|
||||
* \param[in] cMediaTypes number of media types to retrive
|
||||
* \param[out] ppMediaTypes array of AM_MEDIA_TYPE structure pointers of size cMediaTypes
|
||||
* \param[out] pcFetched address of variables that receives number of returned media types
|
||||
*
|
||||
* \return S_OK - success
|
||||
* \return S_FALSE - did not return as meny structures as requested
|
||||
* \return E_INVALIDARG Invalid argument
|
||||
* \return E_POINTER Null pointer
|
||||
* \return VFW_E_ENUM_OUT_OF_SYNC - pin's state has changed and is now inconsistent with enumerator
|
||||
*
|
||||
*/
|
||||
static HRESULT STDCALL CEnumMediaTypes_Next(IEnumMediaTypes * This,
|
||||
/* [in] */ ULONG cMediaTypes,
|
||||
/* [size_is][out] */ AM_MEDIA_TYPE **ppMediaTypes,
|
||||
/* [out] */ ULONG *pcFetched)
|
||||
{
|
||||
AM_MEDIA_TYPE* type = &((CEnumMediaTypes*)This)->type;
|
||||
Debug printf("CEnumMediaTypes::Next(%p) called\n", This);
|
||||
if (!ppMediaTypes)
|
||||
return E_INVALIDARG;
|
||||
if (!pcFetched && (cMediaTypes!=1))
|
||||
return E_INVALIDARG;
|
||||
if (cMediaTypes <= 0)
|
||||
return 0;
|
||||
|
||||
if (pcFetched)
|
||||
*pcFetched=1;
|
||||
ppMediaTypes[0] = CreateMediaType(type);
|
||||
|
||||
if (cMediaTypes == 1)
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* I expect that these methods are unused. */
|
||||
|
||||
/**
|
||||
* \brief IEnumMediaTypes::Skip (skips over a specified number of media types)
|
||||
*
|
||||
* \param[in] This pointer to CEnumMEdiaTypes object
|
||||
* \param[in] cMediaTypes number of media types to skip
|
||||
*
|
||||
* \return S_OK - success
|
||||
* \return S_FALSE - skipped past the end of the sequence
|
||||
* \return VFW_E_ENUM_OUT_OF_SYNC - pin's state has changed and is now inconsistent with enumerator
|
||||
*
|
||||
*/
|
||||
static HRESULT STDCALL CEnumMediaTypes_Skip(IEnumMediaTypes * This,
|
||||
/* [in] */ ULONG cMediaTypes)
|
||||
{
|
||||
return output_unimplemented("CEnumMediaTypes::Skip", This);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief IEnumMediaTypes::Reset (resets enumeration sequence to beginning)
|
||||
*
|
||||
* \param[in] This pointer to CEnumMEdiaTypes object
|
||||
*
|
||||
* \return S_OK - success
|
||||
*
|
||||
*/
|
||||
static HRESULT STDCALL CEnumMediaTypes_Reset(IEnumMediaTypes * This)
|
||||
{
|
||||
Debug printf("CEnumMediaTypes::Reset(%p) called\n", This);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief IEnumMediaTypes::Clone (makes a copy of enumerator, returned object
|
||||
* starts at the same position as original)
|
||||
*
|
||||
* \param[in] This pointer to CEnumMEdiaTypes object
|
||||
* \param[out] ppEnum address of variable that receives pointer to IEnumMediaTypes interface
|
||||
*
|
||||
* \return S_OK - success
|
||||
* \return E_OUTOFMEMRY - Insufficient memory
|
||||
* \return E_POINTER - Null pointer
|
||||
* \return VFW_E_ENUM_OUT_OF_SYNC - pin's state has changed and is now inconsistent with enumerator
|
||||
*
|
||||
*/
|
||||
static HRESULT STDCALL CEnumMediaTypes_Clone(IEnumMediaTypes * This,
|
||||
/* [out] */ IEnumMediaTypes **ppEnum)
|
||||
{
|
||||
Debug printf("CEnumMediaTypes::Clone(%p) called\n", This);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief CEnumMediaTypes destructor
|
||||
*
|
||||
* \param[in] This pointer to CEnumMediaTypes object
|
||||
*
|
||||
*/
|
||||
static void CEnumMediaTypes_Destroy(CEnumMediaTypes* This)
|
||||
{
|
||||
FreeMediaType(&(This->type));
|
||||
free(This->vt);
|
||||
free(This);
|
||||
}
|
||||
|
||||
// IEnumMediaTypes->IUnknown methods
|
||||
IMPLEMENT_IUNKNOWN(CEnumMediaTypes)
|
||||
|
||||
/**
|
||||
* \brief CEnumMediaTypes constructor
|
||||
*
|
||||
* \param[in] amt media type for enumerating
|
||||
*
|
||||
* \return pointer to CEnumMEdiaTypes object or NULL if error occured
|
||||
*
|
||||
*/
|
||||
static CEnumMediaTypes* CEnumMediaTypesCreate(const AM_MEDIA_TYPE* amt)
|
||||
{
|
||||
CEnumMediaTypes *This = malloc(sizeof(CEnumMediaTypes)) ;
|
||||
|
||||
if (!This)
|
||||
return NULL;
|
||||
|
||||
This->vt = malloc(sizeof(IEnumMediaTypes_vt));
|
||||
if (!This->vt)
|
||||
{
|
||||
free(This);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
This->refcount = 1;
|
||||
CopyMediaType(&(This->type),amt);
|
||||
|
||||
This->vt->QueryInterface = CEnumMediaTypes_QueryInterface;
|
||||
This->vt->AddRef = CEnumMediaTypes_AddRef;
|
||||
This->vt->Release = CEnumMediaTypes_Release;
|
||||
This->vt->Next = CEnumMediaTypes_Next;
|
||||
This->vt->Skip = CEnumMediaTypes_Skip;
|
||||
This->vt->Reset = CEnumMediaTypes_Reset;
|
||||
This->vt->Clone = CEnumMediaTypes_Clone;
|
||||
|
||||
This->interfaces[0] = IID_IUnknown;
|
||||
This->interfaces[1] = IID_IEnumMediaTypes;
|
||||
|
||||
return This;
|
||||
}
|
||||
|
||||
|
||||
/*************
|
||||
* COutputPin
|
||||
*
|
||||
* WARNING:
|
||||
* This is implementation of INPUT pin in DirectShow's terms
|
||||
*
|
||||
*************/
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* \brief IUnknown::QueryInterface (query object for interface)
|
||||
* \param[in] This pointer to IUnknown interface
|
||||
* \param[in] iid GUID of requested interface
|
||||
* \param[out] ppv receives pointer to interface
|
||||
*
|
||||
* \return S_OK - success (and *ppv contains valid pointer)
|
||||
* \return E_NOINTERFACE - interface not found (and *ppv was set NULL)
|
||||
*
|
||||
* \note
|
||||
* Make sure to call Release on received interface when you are done
|
||||
*
|
||||
*/
|
||||
static HRESULT STDCALL COutputPin_QueryInterface(IUnknown* This, const GUID* iid, void** ppv)
|
||||
{
|
||||
COutputPin* p = (COutputPin*) This;
|
||||
|
||||
Debug printf("COutputPin_QueryInterface(%p) called\n", This);
|
||||
if (!ppv)
|
||||
return E_INVALIDARG;
|
||||
|
||||
if (memcmp(iid, &IID_IUnknown, 16) == 0)
|
||||
{
|
||||
*ppv = p;
|
||||
p->vt->AddRef(This);
|
||||
return 0;
|
||||
}
|
||||
if (memcmp(iid, &IID_IMemInputPin, 16) == 0)
|
||||
{
|
||||
*ppv = p->mempin;
|
||||
p->mempin->vt->AddRef((IUnknown*)*ppv);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Debug printf("Unknown interface : %08x-%04x-%04x-%02x%02x-"
|
||||
"%02x%02x%02x%02x%02x%02x\n",
|
||||
iid->f1, iid->f2, iid->f3,
|
||||
(unsigned char)iid->f4[1], (unsigned char)iid->f4[0],
|
||||
(unsigned char)iid->f4[2], (unsigned char)iid->f4[3],
|
||||
(unsigned char)iid->f4[4], (unsigned char)iid->f4[5],
|
||||
(unsigned char)iid->f4[6], (unsigned char)iid->f4[7]);
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
// IPin methods
|
||||
|
||||
/**
|
||||
* \brief IPin::Connect (connects pin to another pin)
|
||||
*
|
||||
* \param[in] This pointer to IPin interface
|
||||
* \param[in] pReceivePin pointer to IPin interface of remote pin
|
||||
* \param[in] pmt suggested media type for link. Can be NULL (any media type)
|
||||
*
|
||||
* \return S_OK - success.
|
||||
* \return VFW_E_ALREADY_CONNECTED - pin already connected
|
||||
* \return VFW_E_NOT_STOPPED - filter is active
|
||||
* \return VFW_E_TYPE_NOT_ACCEPT - type is not acceptable
|
||||
* \return Apropriate error code otherwise.
|
||||
*
|
||||
*/
|
||||
static HRESULT STDCALL COutputPin_Connect(IPin * This,
|
||||
/* [in] */ IPin *pReceivePin,
|
||||
/* [in] */ /* const */ AM_MEDIA_TYPE *pmt)
|
||||
{
|
||||
Debug printf("COutputPin_Connect(%p) called\n",This);
|
||||
/*
|
||||
*pmt=((COutputPin*)This)->type;
|
||||
if(pmt->cbFormat>0)
|
||||
{
|
||||
pmt->pbFormat=malloc(pmt->cbFormat);
|
||||
memcpy(pmt->pbFormat, ((COutputPin*)This)->type.pbFormat, pmt->cbFormat);
|
||||
}
|
||||
*/
|
||||
//return E_NOTIMPL;
|
||||
return 0;// XXXXXXXXXXXXX CHECKME XXXXXXXXXXXXXXX
|
||||
// if I put return 0; here, it crashes
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief IPin::ReceiveConnection (accepts a connection from another pin)
|
||||
*
|
||||
* \param[in] This pointer to IPin interface
|
||||
* \param[in] pConnector connecting pin's IPin interface
|
||||
* \param[in] pmt suggested media type for connection
|
||||
*
|
||||
* \return S_OK - success
|
||||
* \return E_POINTER - Null pointer
|
||||
* \return VFW_E_ALREADY_CONNECTED - pin already connected
|
||||
* \return VFW_E_NOT_STOPPED - filter is active
|
||||
* \return VFW_E_TYPE_NOT_ACCEPT - type is not acceptable
|
||||
*
|
||||
* \note
|
||||
* When returning S_OK method should also do the following:
|
||||
* - store media type and return the same type in IPin::ConnectionMediaType
|
||||
* - store pConnector and return it in IPin::ConnectedTo
|
||||
*
|
||||
*/
|
||||
static HRESULT STDCALL COutputPin_ReceiveConnection(IPin * This,
|
||||
/* [in] */ IPin *pConnector,
|
||||
/* [in] */ const AM_MEDIA_TYPE *pmt)
|
||||
{
|
||||
Debug printf("COutputPin_ReceiveConnection(%p) called\n", This);
|
||||
((COutputPin*)This)->remote = pConnector;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief IPin::Disconnect (accepts a connection from another pin)
|
||||
*
|
||||
* \param[in] This pointer to IPin interface
|
||||
*
|
||||
* \return S_OK - success
|
||||
* \return S_FALSE - pin was not connected
|
||||
* \return VFW_E_NOT_STOPPED - filter is active
|
||||
*
|
||||
* \note
|
||||
* To break connection you have to also call Disconnect on other pin
|
||||
*/
|
||||
static HRESULT STDCALL COutputPin_Disconnect(IPin * This)
|
||||
{
|
||||
Debug printf("COutputPin_Disconnect(%p) called\n", This);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief IPin::ConnectedTo (retrieves pointer to the connected pin, if such exist)
|
||||
*
|
||||
* \param[in] This pointer to IPin interface
|
||||
* \param[out] pPin pointer to remote pin's IPin interface
|
||||
*
|
||||
* \return S_OK - success
|
||||
* \return E_POINTER - Null pointer
|
||||
* \return VFW_E_NOT_CONNECTED - pin is not connected
|
||||
*
|
||||
* \note
|
||||
* Caller must call Release on received IPin, when done
|
||||
*/
|
||||
static HRESULT STDCALL COutputPin_ConnectedTo(IPin * This,
|
||||
/* [out] */ IPin **pPin)
|
||||
{
|
||||
Debug printf("COutputPin_ConnectedTo(%p) called\n", This);
|
||||
if (!pPin)
|
||||
return E_INVALIDARG;
|
||||
*pPin = ((COutputPin*)This)->remote;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief IPin::ConnectionMediaType (retrieves media type for connection, if such exist)
|
||||
*
|
||||
* \param[in] This pointer to IPin interface
|
||||
* \param[out] pmt pointer to AM_MEDIA_TYPE, that receives connection media type
|
||||
*
|
||||
* \return S_OK - success
|
||||
* \return E_POINTER - Null pointer
|
||||
* \return VFW_E_NOT_CONNECTED - pin is not connected
|
||||
*
|
||||
*/
|
||||
static HRESULT STDCALL COutputPin_ConnectionMediaType(IPin * This,
|
||||
/* [out] */ AM_MEDIA_TYPE *pmt)
|
||||
{
|
||||
Debug printf("COutputPin_ConnectionMediaType(%p) called\n",This);
|
||||
if (!pmt)
|
||||
return E_INVALIDARG;
|
||||
CopyMediaType(pmt,&(((COutputPin*)This)->type));
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief IPin::QueryPinInfo (retrieves information about the pin)
|
||||
*
|
||||
* \param[in] This pointer to IPin interface
|
||||
* \param[out] pInfo pointer to PIN_INFO structure, that receives pin info
|
||||
*
|
||||
* \return S_OK - success
|
||||
* \return E_POINTER - Null pointer
|
||||
*
|
||||
* \note
|
||||
* If pInfo->pFilter is not NULL, then caller must call Release on pInfo->pFilter when done
|
||||
*
|
||||
*/
|
||||
static HRESULT STDCALL COutputPin_QueryPinInfo(IPin * This,
|
||||
/* [out] */ PIN_INFO *pInfo)
|
||||
{
|
||||
return output_unimplemented("COutputPin_QueryPinInfo", This);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief IPin::QueryDirection (retrieves pin direction)
|
||||
*
|
||||
* \param[in] This pointer to IPin interface
|
||||
* \param[out] pPinDir pointer to variable, that receives pin direction (PINDIR_INPUT,PINDIR_OUTPUT)
|
||||
*
|
||||
* \return S_OK - success
|
||||
* \return E_POINTER - Null pointer
|
||||
*
|
||||
*/
|
||||
static HRESULT STDCALL COutputPin_QueryDirection(IPin * This,
|
||||
/* [out] */ PIN_DIRECTION *pPinDir)
|
||||
{
|
||||
Debug printf("COutputPin_QueryDirection(%p) called\n", This);
|
||||
if (!pPinDir)
|
||||
return E_INVALIDARG;
|
||||
*pPinDir = PINDIR_INPUT;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief IPin::QueryId (retrieves pin identificator)
|
||||
*
|
||||
* \param[in] This pointer to IPin interface
|
||||
* \param[out] Id adress of variable, that receives string with pin's Id.
|
||||
*
|
||||
* \return S_OK - success
|
||||
* \return E_OUTOFMEMORY - Insufficient memory
|
||||
* \return E_POINTER - Null pointer
|
||||
*
|
||||
* \note
|
||||
* Pin's Id is not the same as pin's name
|
||||
*
|
||||
*/
|
||||
static HRESULT STDCALL COutputPin_QueryId(IPin * This,
|
||||
/* [out] */ LPWSTR *Id)
|
||||
{
|
||||
return output_unimplemented("COutputPin_QueryId", This);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief IPin::QueryAccept (determines can media type be accepted or not)
|
||||
*
|
||||
* \param[in] This pointer to IPin interface
|
||||
* \param[in] pmt Media type to check
|
||||
*
|
||||
* \return S_OK - success
|
||||
* \return S_FALSE - pin rejects media type
|
||||
*
|
||||
*/
|
||||
static HRESULT STDCALL COutputPin_QueryAccept(IPin * This,
|
||||
/* [in] */ const AM_MEDIA_TYPE *pmt)
|
||||
{
|
||||
return output_unimplemented("COutputPin_QueryAccept", This);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief IPin::EnumMediaTypes (enumerates the pin's preferred media types)
|
||||
*
|
||||
* \param[in] This pointer to IPin interface
|
||||
* \param[out] ppEnum adress of variable that receives pointer to IEnumMEdiaTypes interface
|
||||
*
|
||||
* \return S_OK - success
|
||||
* \return E_OUTOFMEMORY - Insufficient memory
|
||||
* \return E_POINTER - Null pointer
|
||||
*
|
||||
* \note
|
||||
* Caller must call Release on received interface when done
|
||||
*
|
||||
*/
|
||||
static HRESULT STDCALL COutputPin_EnumMediaTypes(IPin * This,
|
||||
/* [out] */ IEnumMediaTypes **ppEnum)
|
||||
{
|
||||
Debug printf("COutputPin_EnumMediaTypes(%p) called\n",This);
|
||||
if (!ppEnum)
|
||||
return E_INVALIDARG;
|
||||
*ppEnum = (IEnumMediaTypes*) CEnumMediaTypesCreate(&((COutputPin*)This)->type);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief IPin::QueryInternalConnections (retries pin's internal connections)
|
||||
*
|
||||
* \param[in] This pointer to IPin interface
|
||||
* \param[out] apPin Array that receives pins, internally connected to this
|
||||
* \param[in,out] nPint Size of an array
|
||||
*
|
||||
* \return S_OK - success
|
||||
* \return S_FALSE - pin rejects media type
|
||||
* \return E_NOTIMPL - not implemented
|
||||
*
|
||||
*/
|
||||
static HRESULT STDCALL COutputPin_QueryInternalConnections(IPin * This,
|
||||
/* [out] */ IPin **apPin,
|
||||
/* [out][in] */ ULONG *nPin)
|
||||
{
|
||||
return output_unimplemented("COutputPin_QueryInternalConnections", This);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief IPin::EndOfStream (notifies pin, that no data is expected, until new run command)
|
||||
*
|
||||
* \param[in] This pointer to IPin interface
|
||||
*
|
||||
* \return S_OK - success
|
||||
* \return E_UNEXPECTED - The pin is output pin
|
||||
*
|
||||
* \note
|
||||
* IMemoryInputPin::Receive,IMemoryInputPin::ReceiveMultiple, IMemoryInputPin::EndOfStream,
|
||||
* IMemAllocator::GetBuffer runs in different (streaming) thread then other
|
||||
* methods (application thread).
|
||||
* IMemoryInputPin::NewSegment runs either in streaming or application thread.
|
||||
* Developer must use critical sections for thread-safing work.
|
||||
*
|
||||
*/
|
||||
static HRESULT STDCALL COutputPin_EndOfStream(IPin * This)
|
||||
{
|
||||
return output_unimplemented("COutputPin_EndOfStream", This);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief IPin::BeginFlush (begins a flush operation)
|
||||
*
|
||||
* \param[in] This pointer to IPin interface
|
||||
*
|
||||
* \return S_OK - success
|
||||
* \return E_UNEXPECTED - The pin is output pin
|
||||
*
|
||||
*/
|
||||
static HRESULT STDCALL COutputPin_BeginFlush(IPin * This)
|
||||
{
|
||||
return output_unimplemented("COutputPin_BeginFlush", This);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief IPin::EndFlush (ends a flush operation)
|
||||
*
|
||||
* \param[in] This pointer to IPin interface
|
||||
*
|
||||
* \return S_OK - success
|
||||
* \return E_UNEXPECTED - The pin is output pin
|
||||
*
|
||||
*/
|
||||
static HRESULT STDCALL COutputPin_EndFlush(IPin * This)
|
||||
{
|
||||
return output_unimplemented("COutputPin_EndFlush", This);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief IPin::NewSegment (media sample received after this call grouped as segment with common
|
||||
* start,stop time and rate)
|
||||
*
|
||||
* \param[in] This pointer to IPin interface
|
||||
* \param[in] tStart start time of new segment
|
||||
* \param[in] tStop end time of new segment
|
||||
* \param[in] dRate rate at wich segment should be processed
|
||||
*
|
||||
* \return S_OK - success
|
||||
* \return E_UNEXPECTED - The pin is output pin
|
||||
*
|
||||
*/
|
||||
static HRESULT STDCALL COutputPin_NewSegment(IPin * This,
|
||||
/* [in] */ REFERENCE_TIME tStart,
|
||||
/* [in] */ REFERENCE_TIME tStop,
|
||||
/* [in] */ double dRate)
|
||||
{
|
||||
Debug printf("COutputPin_NewSegment(%d,%d,%f) called\n",
|
||||
(int)tStart, (int)tStop, dRate);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// IMemInputPin->IUnknown methods
|
||||
|
||||
/**
|
||||
* \brief IUnknown::QueryInterface (query object for interface)
|
||||
*
|
||||
* \param[in] This pointer to IUnknown interface
|
||||
* \param[in] iid GUID of requested interface
|
||||
* \param[out] ppv receives pointer to interface
|
||||
*
|
||||
* \return S_OK - success (and *ppv contains valid pointer)
|
||||
* \return E_NOINTERFACE - interface not found (and *ppv was set NULL)
|
||||
*
|
||||
* \note
|
||||
* Make sure to call Release on received interface when you are done
|
||||
*
|
||||
*/
|
||||
static HRESULT STDCALL COutputMemPin_QueryInterface(IUnknown* This, const GUID* iid, void** ppv)
|
||||
{
|
||||
COutputMemPin* p = (COutputMemPin*)This;
|
||||
|
||||
Debug printf("COutputMemPin_QueryInterface(%p) called\n", This);
|
||||
if (!ppv)
|
||||
return E_INVALIDARG;
|
||||
|
||||
if(!memcmp(iid, &IID_IUnknown, 16))
|
||||
{
|
||||
*ppv = p;
|
||||
p->vt->AddRef(This);
|
||||
return 0;
|
||||
}
|
||||
/*if(!memcmp(iid, &IID_IPin, 16))
|
||||
{
|
||||
COutputPin* ptr=(COutputPin*)(This-1);
|
||||
*ppv=(void*)ptr;
|
||||
AddRef((IUnknown*)ptr);
|
||||
return 0;
|
||||
}*/
|
||||
if(!memcmp(iid, &IID_IMemInputPin, 16))
|
||||
{
|
||||
*ppv = p;
|
||||
p->vt->AddRef(This);
|
||||
return 0;
|
||||
}
|
||||
Debug printf("Unknown interface : %08x-%04x-%04x-%02x%02x-" \
|
||||
"%02x%02x%02x%02x%02x%02x\n",
|
||||
iid->f1, iid->f2, iid->f3,
|
||||
(unsigned char)iid->f4[1], (unsigned char)iid->f4[0],
|
||||
(unsigned char)iid->f4[2], (unsigned char)iid->f4[3],
|
||||
(unsigned char)iid->f4[4], (unsigned char)iid->f4[5],
|
||||
(unsigned char)iid->f4[6], (unsigned char)iid->f4[7]);
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
// IMemInputPin methods
|
||||
|
||||
/**
|
||||
* \brief IMemInputPin::GetAllocator (retrives memory allocator, proposed by pin)
|
||||
*
|
||||
* \param[in] This pointer to IMemInputPin interface
|
||||
* \param[out] ppAllocator address of variable that receives allocator's IMemAllocator interface
|
||||
*
|
||||
* \return S_OK - success
|
||||
* \return VFW_E_NO_ALLOCATOR - No allocator
|
||||
*
|
||||
* \note
|
||||
* Make sure to call Release on received interface when you are done
|
||||
*
|
||||
*/
|
||||
static HRESULT STDCALL COutputMemPin_GetAllocator(IMemInputPin* This,
|
||||
/* [out] */ IMemAllocator** ppAllocator)
|
||||
{
|
||||
Debug printf("COutputMemPin_GetAllocator(%p, %p) called\n", This->vt, ppAllocator);
|
||||
*ppAllocator = (IMemAllocator*) MemAllocatorCreate();
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* \brief IMemInputPin::NotifyAllocator (specifies an allocator for the connection)
|
||||
*
|
||||
* \param[in] This pointer to IMemInputPin interface
|
||||
* \param[in] pAllocator allocator's IMemAllocator interface
|
||||
* \param[in] bReadOnly specifies whether samples from allocator are readonly
|
||||
*
|
||||
* \return S_OK - success
|
||||
* \return Apropriate error code otherwise
|
||||
*
|
||||
*/
|
||||
static HRESULT STDCALL COutputMemPin_NotifyAllocator(IMemInputPin* This,
|
||||
/* [in] */ IMemAllocator* pAllocator,
|
||||
/* [in] */ int bReadOnly)
|
||||
{
|
||||
Debug printf("COutputMemPin_NotifyAllocator(%p, %p) called\n", This, pAllocator);
|
||||
((COutputMemPin*)This)->pAllocator = (MemAllocator*) pAllocator;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief IMemInputPin::GetAllocatorRequirements (retrieves allocator properties requested by
|
||||
* input pin)
|
||||
*
|
||||
* \param[in] This pointer to IMemInputPin interface
|
||||
* \param[out] pProps pointer to a structure that receives allocator properties
|
||||
*
|
||||
* \return S_OK - success
|
||||
* \return E_NOTIMPL - Not implemented
|
||||
* \return E_POINTER - Null pointer
|
||||
*
|
||||
*/
|
||||
static HRESULT STDCALL COutputMemPin_GetAllocatorRequirements(IMemInputPin* This,
|
||||
/* [out] */ ALLOCATOR_PROPERTIES* pProps)
|
||||
{
|
||||
return output_unimplemented("COutputMemPin_GetAllocatorRequirements", This);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief IMemInputPin::Receive (receives the next media sample int thre stream)
|
||||
*
|
||||
* \param[in] This pointer to IMemInputPin interface
|
||||
* \param[in] pSample pointer to sample's IMediaSample interface
|
||||
*
|
||||
* \return S_OK - success
|
||||
* \return S_FALSE - The sample was rejected
|
||||
* \return E_POINTER - Null pointer
|
||||
* \return VFW_E_INVALIDMEDIATYPE - invalid media type
|
||||
* \return VFW_E_RUNTIME_ERROR - run-time error occured
|
||||
* \return VFW_E_WRONG_STATE - pin is stopped
|
||||
*
|
||||
* \remarks
|
||||
* Method san do on of the following:
|
||||
* - reject sample
|
||||
* - accept sample and process it in another thread
|
||||
* - accept sample and process it before returning
|
||||
*
|
||||
* In second case method should increase reference count for sample (through AddRef)
|
||||
* In the last case method might block indefinitely. If this might
|
||||
* happen IMemInpuPin::ReceiveCAnBlock returns S_OK
|
||||
*
|
||||
* \note
|
||||
* IMemoryInputPin::Receive,IMemoryInputPin::ReceiveMultiple, IMemoryInputPin::EndOfStream,
|
||||
* IMemAllocator::GetBuffer runs in different (streaming) thread then other
|
||||
* methods (application thread).
|
||||
* IMemoryInputPin::NewSegment runs either in streaming or application thread.
|
||||
* Developer must use critical sections for thread-safing work.
|
||||
*
|
||||
*/
|
||||
static HRESULT STDCALL COutputMemPin_Receive(IMemInputPin* This,
|
||||
/* [in] */ IMediaSample* pSample)
|
||||
{
|
||||
Debug printf("COutputMemPin_Receive(%p) called\n", This);
|
||||
if (!pSample)
|
||||
return E_INVALIDARG;
|
||||
|
||||
if(((COutputMemPin*)This)->parent->SampleProc)
|
||||
return ((COutputMemPin*)This)->parent->SampleProc(((COutputMemPin*)This)->parent->pUserData,pSample);
|
||||
//reject sample
|
||||
return S_FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief IMemInputPin::ReceiveMultiple (receives multiple samples in the stream)
|
||||
*
|
||||
* \param[in] This pointer to IMemInputPin interface
|
||||
* \param[in] pSamples pointer to array with samples
|
||||
* \param[in] nSamples number of samples in array
|
||||
* \param[out] nSamplesProcessed number of processed samples
|
||||
*
|
||||
* \return S_OK - success
|
||||
* \return S_FALSE - The sample was rejected
|
||||
* \return E_POINTER - Null pointer
|
||||
* \return VFW_E_INVALIDMEDIATYPE - invalid media type
|
||||
* \return VFW_E_RUNTIME_ERROR - run-time error occured
|
||||
* \return VFW_E_WRONG_STATE - pin is stopped
|
||||
*
|
||||
* \remarks
|
||||
* This method behaves like IMemInputPin::Receive but for array of samples
|
||||
*
|
||||
* \note
|
||||
* IMemoryInputPin::Receive,IMemoryInputPin::ReceiveMultiple, IMemoryInputPin::EndOfStream,
|
||||
* IMemAllocator::GetBuffer runs in different (streaming) thread then other
|
||||
* methods (application thread).
|
||||
* IMemoryInputPin::NewSegment runs either in streaming or application thread.
|
||||
* Developer must use critical sections for thread-safing work.
|
||||
*
|
||||
*/
|
||||
static HRESULT STDCALL COutputMemPin_ReceiveMultiple(IMemInputPin * This,
|
||||
/* [size_is][in] */ IMediaSample **pSamples,
|
||||
/* [in] */ long nSamples,
|
||||
/* [out] */ long *nSamplesProcessed)
|
||||
{
|
||||
HRESULT hr = 0;
|
||||
Debug printf("COutputMemPin_ReceiveMultiple(%p) %ld\n", This,nSamples);
|
||||
for(*nSamplesProcessed=0; *nSamplesProcessed < nSamples; *nSamplesProcessed++) {
|
||||
hr = This->vt->Receive(This,pSamples[*nSamplesProcessed]);
|
||||
if (hr != S_OK) break;
|
||||
}
|
||||
return hr;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief IMemInputPin::ReceiveCanBlock (determines whether IMemInputPin:::Receive might block)
|
||||
*
|
||||
* \param[in] This pointer to IMemInputPin interface
|
||||
*
|
||||
* \return S_OK - the pin might block
|
||||
* \return S_FALSE - the pin will not block
|
||||
*
|
||||
*/
|
||||
static HRESULT STDCALL COutputMemPin_ReceiveCanBlock(IMemInputPin * This)
|
||||
{
|
||||
return output_unimplemented("COutputMemPin_ReceiveCanBlock", This);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief COutputPin::SetNewFormat(sets new media format for the pin)
|
||||
*
|
||||
* \param[in] This pointer to COutputPin class
|
||||
* \param[in] amt new media format
|
||||
*
|
||||
*/
|
||||
static void COutputPin_SetNewFormat(COutputPin* This, const AM_MEDIA_TYPE* amt)
|
||||
{
|
||||
CopyMediaType(&(This->type),amt);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief COutputPin destructor
|
||||
*
|
||||
* \param[in] This pointer to COutputPin class
|
||||
*
|
||||
*/
|
||||
static void COutputPin_Destroy(COutputPin* This)
|
||||
{
|
||||
free(This->mempin->vt);
|
||||
free(This->mempin);
|
||||
free(This->vt);
|
||||
FreeMediaType(&(This->type));
|
||||
free(This);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief IUnknown::AddRef (increases reference counter for interface)
|
||||
*
|
||||
* \param[in] This pointer to IUnknown class
|
||||
*
|
||||
* \return new value of reference counter
|
||||
*
|
||||
* \remarks
|
||||
* Return value should be used only for debug purposes
|
||||
*
|
||||
*/
|
||||
static HRESULT STDCALL COutputPin_AddRef(IUnknown* This)
|
||||
{
|
||||
Debug printf("COutputPin_AddRef(%p) called (%d)\n", This, ((COutputPin*)This)->refcount);
|
||||
((COutputPin*)This)->refcount++;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief IUnknown::Release (desreases reference counter for interface)
|
||||
*
|
||||
* \param[in] This pointer to IUnknown class
|
||||
*
|
||||
* \return new value of reference counter
|
||||
*
|
||||
* \remarks
|
||||
* When reference counter reaches zero calls destructor
|
||||
* Return value should be used only for debug purposes
|
||||
*
|
||||
*/
|
||||
static HRESULT STDCALL COutputPin_Release(IUnknown* This)
|
||||
{
|
||||
Debug printf("COutputPin_Release(%p) called (%d)\n", This, ((COutputPin*)This)->refcount);
|
||||
if (--((COutputPin*)This)->refcount <= 0)
|
||||
COutputPin_Destroy((COutputPin*)This);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief IUnknown::AddRef (increases reference counter for interface)
|
||||
*
|
||||
* \param[in] This pointer to IUnknown class
|
||||
*
|
||||
* \return new value of reference counter
|
||||
*
|
||||
* \remarks
|
||||
* Return value should be used only for debug purposes
|
||||
*
|
||||
*/
|
||||
static HRESULT STDCALL COutputMemPin_AddRef(IUnknown* This)
|
||||
{
|
||||
COutputMemPin* p = (COutputMemPin*) This;
|
||||
Debug printf("COutputMemPin_AddRef(%p) called (%p, %d)\n", p, p->parent, p->parent->refcount);
|
||||
p->parent->refcount++;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief IUnknown::Release (desreases reference counter for interface)
|
||||
*
|
||||
* \param[in] This pointer to IUnknown class
|
||||
*
|
||||
* \return new value of reference counter
|
||||
*
|
||||
* \remarks
|
||||
* When reference counter reaches zero calls destructor
|
||||
* Return value should be used only for debug purposes
|
||||
*
|
||||
*/
|
||||
static HRESULT STDCALL COutputMemPin_Release(IUnknown* This)
|
||||
{
|
||||
COutputMemPin* p = (COutputMemPin*) This;
|
||||
Debug printf("COutputMemPin_Release(%p) called (%p, %d)\n",
|
||||
p, p->parent, p->parent->refcount);
|
||||
if (--p->parent->refcount <= 0)
|
||||
COutputPin_Destroy(p->parent);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief COutputPin constructor
|
||||
*
|
||||
* \param[in] amt media type for pin
|
||||
*
|
||||
* \return pointer to COutputPin if success
|
||||
* \return NULL if error occured
|
||||
*
|
||||
*/
|
||||
COutputPin* COutputPinCreate(const AM_MEDIA_TYPE* amt,SAMPLEPROC SampleProc,void* pUserData)
|
||||
{
|
||||
COutputPin* This = malloc(sizeof(COutputPin));
|
||||
IMemInputPin_vt* ivt;
|
||||
|
||||
if (!This)
|
||||
return NULL;
|
||||
|
||||
This->vt = malloc(sizeof(IPin_vt));
|
||||
This->mempin = malloc(sizeof(COutputMemPin));
|
||||
ivt = malloc(sizeof(IMemInputPin_vt));
|
||||
|
||||
if (!This->vt || !This->mempin || !ivt)
|
||||
{
|
||||
COutputPin_Destroy(This);
|
||||
free(ivt);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
This->SampleProc=SampleProc;
|
||||
This->pUserData=pUserData;
|
||||
|
||||
This->mempin->vt = ivt;
|
||||
|
||||
This->refcount = 1;
|
||||
This->remote = 0;
|
||||
CopyMediaType(&(This->type),amt);
|
||||
|
||||
This->vt->QueryInterface = COutputPin_QueryInterface;
|
||||
This->vt->AddRef = COutputPin_AddRef;
|
||||
This->vt->Release = COutputPin_Release;
|
||||
This->vt->Connect = COutputPin_Connect;
|
||||
This->vt->ReceiveConnection = COutputPin_ReceiveConnection;
|
||||
This->vt->Disconnect = COutputPin_Disconnect;
|
||||
This->vt->ConnectedTo = COutputPin_ConnectedTo;
|
||||
This->vt->ConnectionMediaType = COutputPin_ConnectionMediaType;
|
||||
This->vt->QueryPinInfo = COutputPin_QueryPinInfo;
|
||||
This->vt->QueryDirection = COutputPin_QueryDirection;
|
||||
This->vt->QueryId = COutputPin_QueryId;
|
||||
This->vt->QueryAccept = COutputPin_QueryAccept;
|
||||
This->vt->EnumMediaTypes = COutputPin_EnumMediaTypes;
|
||||
This->vt->QueryInternalConnections = COutputPin_QueryInternalConnections;
|
||||
This->vt->EndOfStream = COutputPin_EndOfStream;
|
||||
This->vt->BeginFlush = COutputPin_BeginFlush;
|
||||
This->vt->EndFlush = COutputPin_EndFlush;
|
||||
This->vt->NewSegment = COutputPin_NewSegment;
|
||||
|
||||
This->mempin->vt->QueryInterface = COutputMemPin_QueryInterface;
|
||||
This->mempin->vt->AddRef = COutputMemPin_AddRef;
|
||||
This->mempin->vt->Release = COutputMemPin_Release;
|
||||
This->mempin->vt->GetAllocator = COutputMemPin_GetAllocator;
|
||||
This->mempin->vt->NotifyAllocator = COutputMemPin_NotifyAllocator;
|
||||
This->mempin->vt->GetAllocatorRequirements = COutputMemPin_GetAllocatorRequirements;
|
||||
This->mempin->vt->Receive = COutputMemPin_Receive;
|
||||
This->mempin->vt->ReceiveMultiple = COutputMemPin_ReceiveMultiple;
|
||||
This->mempin->vt->ReceiveCanBlock = COutputMemPin_ReceiveCanBlock;
|
||||
|
||||
This->mempin->frame_size_pointer = 0;
|
||||
This->mempin->frame_pointer = 0;
|
||||
This->mempin->pAllocator = 0;
|
||||
This->mempin->refcount = 1;
|
||||
This->mempin->parent = This;
|
||||
|
||||
This->SetNewFormat = COutputPin_SetNewFormat;
|
||||
|
||||
return This;
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
#ifndef MPLAYER_OUTPUTPIN_H
|
||||
#define MPLAYER_OUTPUTPIN_H
|
||||
|
||||
/* "output pin" - the one that connects to output of filter. */
|
||||
|
||||
#include "allocator.h"
|
||||
|
||||
typedef struct COutputMemPin COutputMemPin;
|
||||
typedef struct COutputPin COutputPin;
|
||||
|
||||
/**
|
||||
Callback routine for copying samples from pin into filter
|
||||
\param pUserData pointer to user's data
|
||||
\param sample IMediaSample
|
||||
*/
|
||||
typedef HRESULT STDCALL (*SAMPLEPROC)(void* pUserData,IMediaSample*sample);
|
||||
|
||||
struct COutputPin
|
||||
{
|
||||
IPin_vt* vt;
|
||||
DECLARE_IUNKNOWN();
|
||||
COutputMemPin* mempin;
|
||||
AM_MEDIA_TYPE type;
|
||||
IPin* remote;
|
||||
SAMPLEPROC SampleProc;
|
||||
void* pUserData;
|
||||
void ( *SetNewFormat )(COutputPin*, const AM_MEDIA_TYPE* a);
|
||||
};
|
||||
|
||||
COutputPin* COutputPinCreate(const AM_MEDIA_TYPE* amt,SAMPLEPROC SampleProc,void* pUserData);
|
||||
|
||||
#endif /* MPLAYER_OUTPUTPIN_H */
|
||||
-292
@@ -1,292 +0,0 @@
|
||||
/*
|
||||
* Elf-dll loader functions
|
||||
*
|
||||
* Copyright 1999 Bertho A. Stultiens
|
||||
*
|
||||
* Modified for use with MPlayer, detailed changelog at
|
||||
* http://svn.mplayerhq.hu/mplayer/trunk/
|
||||
*
|
||||
*/
|
||||
#include "config.h"
|
||||
|
||||
#ifdef HAVE_LIBDL
|
||||
|
||||
#include "wine/windef.h"
|
||||
#include "wine/module.h"
|
||||
#include "wine/heap.h"
|
||||
#include "wine/elfdll.h"
|
||||
#include "wine/debugtools.h"
|
||||
#include "wine/winerror.h"
|
||||
#include "debug.h"
|
||||
#include "loader.h"
|
||||
#include "path.h"
|
||||
|
||||
//DEFAULT_DEBUG_CHANNEL(elfdll)
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <dlfcn.h>
|
||||
|
||||
|
||||
/*------------------ HACKS -----------------*/
|
||||
DWORD fixup_imports(WINE_MODREF *wm);
|
||||
void dump_exports(HMODULE hModule);
|
||||
/*---------------- END HACKS ---------------*/
|
||||
|
||||
struct elfdll_image
|
||||
{
|
||||
HMODULE pe_module_start;
|
||||
DWORD pe_module_size;
|
||||
};
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* ELFDLL_dlopen
|
||||
*
|
||||
* Wrapper for dlopen to search the EXTRA_LD_LIBRARY_PATH from wine.conf
|
||||
* manually because libdl.so caches the environment and does not accept our
|
||||
* changes.
|
||||
*/
|
||||
void *ELFDLL_dlopen(const char *libname, int flags)
|
||||
{
|
||||
char buffer[256];
|
||||
int namelen;
|
||||
void *handle;
|
||||
char *ldpath;
|
||||
|
||||
/* First try the default path search of dlopen() */
|
||||
handle = dlopen(libname, flags);
|
||||
if(handle)
|
||||
return handle;
|
||||
|
||||
/* Now try to construct searches through our extra search-path */
|
||||
namelen = strlen(libname);
|
||||
ldpath = codec_path;
|
||||
while(ldpath && *ldpath)
|
||||
{
|
||||
int len;
|
||||
char *cptr;
|
||||
char *from;
|
||||
|
||||
from = ldpath;
|
||||
cptr = strchr(ldpath, ':');
|
||||
if(!cptr)
|
||||
{
|
||||
len = strlen(ldpath);
|
||||
ldpath = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
len = cptr - ldpath;
|
||||
ldpath = cptr + 1;
|
||||
}
|
||||
|
||||
if(len + namelen + 1 >= sizeof(buffer))
|
||||
{
|
||||
ERR("Buffer overflow! Check EXTRA_LD_LIBRARY_PATH or increase buffer size.\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
strncpy(buffer, from, len);
|
||||
if(len)
|
||||
{
|
||||
buffer[len] = '/';
|
||||
strcpy(buffer + len + 1, libname);
|
||||
}
|
||||
else
|
||||
strcpy(buffer + len, libname);
|
||||
|
||||
TRACE("Trying dlopen('%s', %d)\n", buffer, flags);
|
||||
|
||||
handle = dlopen(buffer, flags);
|
||||
if(handle)
|
||||
return handle;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* get_sobasename (internal)
|
||||
*
|
||||
*/
|
||||
static LPSTR get_sobasename(LPCSTR path, LPSTR name)
|
||||
{
|
||||
char *cptr;
|
||||
|
||||
/* Strip the path from the library name */
|
||||
if((cptr = strrchr(path, '/')))
|
||||
{
|
||||
char *cp = strrchr(cptr+1, '\\');
|
||||
if(cp && cp > cptr)
|
||||
cptr = cp;
|
||||
}
|
||||
else
|
||||
cptr = strrchr(path, '\\');
|
||||
|
||||
if(!cptr)
|
||||
cptr = (char *)path; /* No '/' nor '\\' in path */
|
||||
else
|
||||
cptr++;
|
||||
|
||||
strcpy(name, cptr);
|
||||
cptr = strrchr(name, '.');
|
||||
if(cptr)
|
||||
*cptr = '\0'; /* Strip extension */
|
||||
|
||||
/* Convert to lower case.
|
||||
* This must be done manually because it is not sure that
|
||||
* other modules are accessible.
|
||||
*/
|
||||
for(cptr = name; *cptr; cptr++)
|
||||
*cptr = tolower(*cptr);
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* ELFDLL_CreateModref (internal)
|
||||
*
|
||||
* INPUT
|
||||
* hModule - the header from the elf-dll's data-segment
|
||||
* path - requested path from original call
|
||||
*
|
||||
* OUTPUT
|
||||
* A WINE_MODREF pointer to the new object
|
||||
*
|
||||
* BUGS
|
||||
* - Does not handle errors due to dependencies correctly
|
||||
* - path can be wrong
|
||||
*/
|
||||
#define RVA(base, va) (((DWORD)base) + ((DWORD)va))
|
||||
|
||||
static WINE_MODREF *ELFDLL_CreateModref(HMODULE hModule, LPCSTR path)
|
||||
{
|
||||
// IMAGE_NT_HEADERS *nt = PE_HEADER(hModule);
|
||||
// IMAGE_DATA_DIRECTORY *dir;
|
||||
// IMAGE_IMPORT_DESCRIPTOR *pe_import = NULL;
|
||||
WINE_MODREF *wm;
|
||||
// int len;
|
||||
HANDLE procheap = GetProcessHeap();
|
||||
|
||||
wm = (WINE_MODREF *)HeapAlloc(procheap, HEAP_ZERO_MEMORY, sizeof(*wm));
|
||||
if(!wm)
|
||||
return NULL;
|
||||
|
||||
wm->module = hModule;
|
||||
wm->type = MODULE32_ELF; /* FIXME */
|
||||
|
||||
// dir = nt->OptionalHeader.DataDirectory+IMAGE_DIRECTORY_ENTRY_EXPORT;
|
||||
// if(dir->Size)
|
||||
// wm->binfmt.pe.pe_export = (PIMAGE_EXPORT_DIRECTORY)RVA(hModule, dir->VirtualAddress);
|
||||
|
||||
// dir = nt->OptionalHeader.DataDirectory+IMAGE_DIRECTORY_ENTRY_IMPORT;
|
||||
// if(dir->Size)
|
||||
// pe_import = wm->binfmt.pe.pe_import = (PIMAGE_IMPORT_DESCRIPTOR)RVA(hModule, dir->VirtualAddress);
|
||||
|
||||
// dir = nt->OptionalHeader.DataDirectory+IMAGE_DIRECTORY_ENTRY_RESOURCE;
|
||||
// if(dir->Size)
|
||||
// wm->binfmt.pe.pe_resource = (PIMAGE_RESOURCE_DIRECTORY)RVA(hModule, dir->VirtualAddress);
|
||||
|
||||
|
||||
wm->filename = malloc(strlen(path)+1);
|
||||
strcpy(wm->filename, path);
|
||||
wm->modname = strrchr( wm->filename, '\\' );
|
||||
if (!wm->modname) wm->modname = wm->filename;
|
||||
else wm->modname++;
|
||||
/*
|
||||
len = GetShortPathNameA( wm->filename, NULL, 0 );
|
||||
wm->short_filename = (char *)HeapAlloc( procheap, 0, len+1 );
|
||||
GetShortPathNameA( wm->filename, wm->short_filename, len+1 );
|
||||
wm->short_modname = strrchr( wm->short_filename, '\\' );
|
||||
if (!wm->short_modname) wm->short_modname = wm->short_filename;
|
||||
else wm->short_modname++;
|
||||
*/
|
||||
/* Link MODREF into process list */
|
||||
|
||||
// EnterCriticalSection( &PROCESS_Current()->crit_section );
|
||||
|
||||
if(local_wm)
|
||||
{
|
||||
local_wm->next = malloc(sizeof(modref_list));
|
||||
local_wm->next->prev=local_wm;
|
||||
local_wm->next->next=NULL;
|
||||
local_wm->next->wm=wm;
|
||||
local_wm=local_wm->next;
|
||||
}
|
||||
else
|
||||
{
|
||||
local_wm = malloc(sizeof(modref_list));
|
||||
local_wm->next=local_wm->prev=NULL;
|
||||
local_wm->wm=wm;
|
||||
}
|
||||
|
||||
// LeaveCriticalSection( &PROCESS_Current()->crit_section );
|
||||
return wm;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* ELFDLL_LoadLibraryExA (internal)
|
||||
*
|
||||
* Implementation of elf-dll loading for PE modules
|
||||
*/
|
||||
WINE_MODREF *ELFDLL_LoadLibraryExA(LPCSTR path, DWORD flags)
|
||||
{
|
||||
LPVOID dlhandle;
|
||||
// struct elfdll_image *image;
|
||||
char name[129];
|
||||
char soname[129];
|
||||
WINE_MODREF *wm;
|
||||
|
||||
get_sobasename(path, name);
|
||||
strcpy(soname, name);
|
||||
strcat(soname, ".so");
|
||||
|
||||
/* Try to open the elf-dll */
|
||||
dlhandle = ELFDLL_dlopen(soname, RTLD_LAZY);
|
||||
if(!dlhandle)
|
||||
{
|
||||
WARN("Could not load %s (%s)\n", soname, dlerror());
|
||||
SetLastError( ERROR_FILE_NOT_FOUND );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Get the 'dllname_elfdll_image' variable */
|
||||
/* strcpy(soname, name);
|
||||
strcat(soname, "_elfdll_image");
|
||||
image = (struct elfdll_image *)dlsym(dlhandle, soname);
|
||||
if(!image)
|
||||
{
|
||||
ERR("Could not get elfdll image descriptor %s (%s)\n", soname, dlerror());
|
||||
dlclose(dlhandle);
|
||||
SetLastError( ERROR_BAD_FORMAT );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
*/
|
||||
wm = ELFDLL_CreateModref((int)dlhandle, path);
|
||||
if(!wm)
|
||||
{
|
||||
ERR("Could not create WINE_MODREF for %s\n", path);
|
||||
dlclose(dlhandle);
|
||||
SetLastError( ERROR_OUTOFMEMORY );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return wm;
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* ELFDLL_UnloadLibrary (internal)
|
||||
*
|
||||
* Unload an elf-dll completely from memory and deallocate the modref
|
||||
*/
|
||||
void ELFDLL_UnloadLibrary(WINE_MODREF *wm)
|
||||
{
|
||||
}
|
||||
|
||||
#endif /*HAVE_LIBDL*/
|
||||
-593
@@ -1,593 +0,0 @@
|
||||
/********************************************************
|
||||
*
|
||||
*
|
||||
* Stub functions for Wine module
|
||||
*
|
||||
*
|
||||
********************************************************/
|
||||
|
||||
/*
|
||||
* Modified for use with MPlayer, detailed changelog at
|
||||
* http://svn.mplayerhq.hu/mplayer/trunk/
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#ifdef HAVE_SYS_MMAN_H
|
||||
#include <sys/mman.h>
|
||||
#else
|
||||
#include "osdep/mmap.h"
|
||||
#endif
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "osdep/mmap_anon.h"
|
||||
#include "wine/windef.h"
|
||||
#include "wine/winbase.h"
|
||||
#include "wine/debugtools.h"
|
||||
#include "wine/heap.h"
|
||||
#include "ext.h"
|
||||
|
||||
#if 0
|
||||
//REMOVE SIMPLIFY
|
||||
static void* mymalloc(unsigned int size)
|
||||
{
|
||||
printf("malloc %d\n", size);
|
||||
return malloc(size);
|
||||
}
|
||||
|
||||
#undef malloc
|
||||
#define malloc mymalloc
|
||||
#endif
|
||||
|
||||
int dbg_header_err( const char *dbg_channel, const char *func )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
int dbg_header_warn( const char *dbg_channel, const char *func )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
int dbg_header_fixme( const char *dbg_channel, const char *func )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
int dbg_header_trace( const char *dbg_channel, const char *func )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
int dbg_vprintf( const char *format, va_list args )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
int __vprintf( const char *format, ... )
|
||||
{
|
||||
#ifdef DETAILED_OUT
|
||||
va_list va;
|
||||
va_start(va, format);
|
||||
vprintf(format, va);
|
||||
va_end(va);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
HANDLE WINAPI GetProcessHeap(void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
LPVOID WINAPI HeapAlloc(HANDLE heap, DWORD flags, DWORD size)
|
||||
{
|
||||
//static int i = 5;
|
||||
void* m = (flags & 0x8) ? calloc(size, 1) : malloc(size);
|
||||
//printf("HeapAlloc %p %d (%d)\n", m, size, flags);
|
||||
//if (--i == 0)
|
||||
// abort();
|
||||
return m;
|
||||
}
|
||||
|
||||
WIN_BOOL WINAPI HeapFree(HANDLE heap, DWORD flags, LPVOID mem)
|
||||
{
|
||||
free(mem);
|
||||
//printf("HeapFree %p\n", mem);
|
||||
//if (!mem)
|
||||
// abort();
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int last_error;
|
||||
|
||||
DWORD WINAPI GetLastError(void)
|
||||
{
|
||||
return last_error;
|
||||
}
|
||||
|
||||
VOID WINAPI SetLastError(DWORD error)
|
||||
{
|
||||
last_error=error;
|
||||
}
|
||||
|
||||
WIN_BOOL WINAPI ReadFile(HANDLE handle, LPVOID mem, DWORD size, LPDWORD result, LPOVERLAPPED flags)
|
||||
{
|
||||
*result=read(handle, mem, size);
|
||||
return *result;
|
||||
}
|
||||
INT WINAPI lstrcmpiA(LPCSTR c1, LPCSTR c2)
|
||||
{
|
||||
return strcasecmp(c1,c2);
|
||||
}
|
||||
LPSTR WINAPI lstrcpynA(LPSTR dest, LPCSTR src, INT num)
|
||||
{
|
||||
return strncpy(dest,src,num);
|
||||
}
|
||||
INT WINAPI lstrlenA(LPCSTR s)
|
||||
{
|
||||
return strlen(s);
|
||||
}
|
||||
INT WINAPI lstrlenW(LPCWSTR s)
|
||||
{
|
||||
int l;
|
||||
if(!s)
|
||||
return 0;
|
||||
l=0;
|
||||
while(s[l])
|
||||
l++;
|
||||
return l;
|
||||
}
|
||||
LPSTR WINAPI lstrcpynWtoA(LPSTR dest, LPCWSTR src, INT count)
|
||||
{
|
||||
LPSTR result = dest;
|
||||
int moved=0;
|
||||
if((dest==0) || (src==0))
|
||||
return 0;
|
||||
while(moved<count)
|
||||
{
|
||||
*dest=*src;
|
||||
moved++;
|
||||
if(*src==0)
|
||||
break;
|
||||
src++;
|
||||
dest++;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
/* i stands here for ignore case! */
|
||||
int wcsnicmp(const unsigned short* s1, const unsigned short* s2, int n)
|
||||
{
|
||||
/*
|
||||
if(s1==0)
|
||||
return;
|
||||
if(s2==0)
|
||||
return;
|
||||
*/
|
||||
while(n>0)
|
||||
{
|
||||
if (((*s1 | *s2) & 0xff00) || toupper((char)*s1) != toupper((char)*s2))
|
||||
{
|
||||
|
||||
if(*s1<*s2)
|
||||
return -1;
|
||||
else
|
||||
if(*s1>*s2)
|
||||
return 1;
|
||||
else
|
||||
if(*s1==0)
|
||||
return 0;
|
||||
}
|
||||
s1++;
|
||||
s2++;
|
||||
n--;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
WIN_BOOL WINAPI IsBadReadPtr(LPCVOID data, UINT size)
|
||||
{
|
||||
if(size==0)
|
||||
return 0;
|
||||
if(data==NULL)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
LPSTR HEAP_strdupA(HANDLE heap, DWORD flags, LPCSTR string)
|
||||
{
|
||||
// return strdup(string);
|
||||
char* answ = malloc(strlen(string) + 1);
|
||||
strcpy(answ, string);
|
||||
return answ;
|
||||
}
|
||||
LPWSTR HEAP_strdupAtoW(HANDLE heap, DWORD flags, LPCSTR string)
|
||||
{
|
||||
int size, i;
|
||||
WCHAR* answer;
|
||||
if(string==0)
|
||||
return 0;
|
||||
size=strlen(string);
|
||||
answer = malloc(sizeof(WCHAR) * (size + 1));
|
||||
for(i=0; i<=size; i++)
|
||||
answer[i]=(short)string[i];
|
||||
return answer;
|
||||
}
|
||||
LPSTR HEAP_strdupWtoA(HANDLE heap, DWORD flags, LPCWSTR string)
|
||||
{
|
||||
int size, i;
|
||||
char* answer;
|
||||
if(string==0)
|
||||
return 0;
|
||||
size=0;
|
||||
while(string[size])
|
||||
size++;
|
||||
answer = malloc(size + 2);
|
||||
for(i=0; i<=size; i++)
|
||||
answer[i]=(char)string[i];
|
||||
return answer;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* FILE_dommap
|
||||
*/
|
||||
|
||||
//#define MAP_PRIVATE
|
||||
//#define MAP_SHARED
|
||||
LPVOID FILE_dommap( int unix_handle, LPVOID start,
|
||||
DWORD size_high, DWORD size_low,
|
||||
DWORD offset_high, DWORD offset_low,
|
||||
int prot, int flags )
|
||||
{
|
||||
int fd = -1;
|
||||
int pos;
|
||||
LPVOID ret;
|
||||
|
||||
if (size_high || offset_high)
|
||||
printf("offsets larger than 4Gb not supported\n");
|
||||
|
||||
if (unix_handle == -1)
|
||||
{
|
||||
ret = mmap_anon( start, size_low, prot, flags, offset_low );
|
||||
}
|
||||
else
|
||||
{
|
||||
fd = unix_handle;
|
||||
ret = mmap( start, size_low, prot, flags, fd, offset_low );
|
||||
}
|
||||
|
||||
if (ret != (LPVOID)-1)
|
||||
{
|
||||
// printf("address %08x\n", *(int*)ret);
|
||||
// printf("%x\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
// printf("mmap %d\n", errno);
|
||||
|
||||
/* mmap() failed; if this is because the file offset is not */
|
||||
/* page-aligned (EINVAL), or because the underlying filesystem */
|
||||
/* does not support mmap() (ENOEXEC), we do it by hand. */
|
||||
|
||||
if (unix_handle == -1) return ret;
|
||||
if ((errno != ENOEXEC) && (errno != EINVAL)) return ret;
|
||||
if (prot & PROT_WRITE)
|
||||
{
|
||||
/* We cannot fake shared write mappings */
|
||||
#ifdef MAP_SHARED
|
||||
if (flags & MAP_SHARED) return ret;
|
||||
#endif
|
||||
#ifdef MAP_PRIVATE
|
||||
if (!(flags & MAP_PRIVATE)) return ret;
|
||||
#endif
|
||||
}
|
||||
/* printf( "FILE_mmap: mmap failed (%d), faking it\n", errno );*/
|
||||
/* Reserve the memory with an anonymous mmap */
|
||||
ret = FILE_dommap( -1, start, size_high, size_low, 0, 0,
|
||||
PROT_READ | PROT_WRITE, flags );
|
||||
if (ret == (LPVOID)-1)
|
||||
// {
|
||||
// perror(
|
||||
return ret;
|
||||
/* Now read in the file */
|
||||
if ((pos = lseek( fd, offset_low, SEEK_SET )) == -1)
|
||||
{
|
||||
FILE_munmap( ret, size_high, size_low );
|
||||
// printf("lseek\n");
|
||||
return (LPVOID)-1;
|
||||
}
|
||||
read( fd, ret, size_low );
|
||||
lseek( fd, pos, SEEK_SET ); /* Restore the file pointer */
|
||||
mprotect( ret, size_low, prot ); /* Set the right protection */
|
||||
// printf("address %08x\n", *(int*)ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* FILE_munmap
|
||||
*/
|
||||
int FILE_munmap( LPVOID start, DWORD size_high, DWORD size_low )
|
||||
{
|
||||
if (size_high)
|
||||
printf("offsets larger than 4Gb not supported\n");
|
||||
return munmap( start, size_low );
|
||||
}
|
||||
|
||||
struct file_mapping_s;
|
||||
typedef struct file_mapping_s
|
||||
{
|
||||
int mapping_size;
|
||||
char* name;
|
||||
LPVOID handle;
|
||||
struct file_mapping_s* next;
|
||||
struct file_mapping_s* prev;
|
||||
}file_mapping;
|
||||
static file_mapping* fm=0;
|
||||
|
||||
|
||||
|
||||
#define PAGE_NOACCESS 0x01
|
||||
#define PAGE_READONLY 0x02
|
||||
#define PAGE_READWRITE 0x04
|
||||
#define PAGE_WRITECOPY 0x08
|
||||
#define PAGE_EXECUTE 0x10
|
||||
#define PAGE_EXECUTE_READ 0x20
|
||||
#define PAGE_EXECUTE_READWRITE 0x40
|
||||
#define PAGE_EXECUTE_WRITECOPY 0x80
|
||||
#define PAGE_GUARD 0x100
|
||||
#define PAGE_NOCACHE 0x200
|
||||
|
||||
HANDLE WINAPI CreateFileMappingA(HANDLE handle, LPSECURITY_ATTRIBUTES lpAttr,
|
||||
DWORD flProtect,
|
||||
DWORD dwMaxHigh, DWORD dwMaxLow,
|
||||
LPCSTR name)
|
||||
{
|
||||
int hFile = (int)handle;
|
||||
unsigned int len;
|
||||
LPVOID answer;
|
||||
int anon=0;
|
||||
int mmap_access=0;
|
||||
if(hFile<0)
|
||||
anon=1;
|
||||
|
||||
if(!anon)
|
||||
{
|
||||
len=lseek(hFile, 0, SEEK_END);
|
||||
lseek(hFile, 0, SEEK_SET);
|
||||
}
|
||||
else len=dwMaxLow;
|
||||
|
||||
if(flProtect & PAGE_READONLY)
|
||||
mmap_access |=PROT_READ;
|
||||
else
|
||||
mmap_access |=PROT_READ|PROT_WRITE;
|
||||
|
||||
if(anon)
|
||||
answer=mmap_anon(NULL, len, mmap_access, MAP_PRIVATE, 0);
|
||||
else
|
||||
answer=mmap(NULL, len, mmap_access, MAP_PRIVATE, hFile, 0);
|
||||
|
||||
if(answer!=(LPVOID)-1)
|
||||
{
|
||||
if(fm==0)
|
||||
{
|
||||
fm = malloc(sizeof(file_mapping));
|
||||
fm->prev=NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
fm->next = malloc(sizeof(file_mapping));
|
||||
fm->next->prev=fm;
|
||||
fm=fm->next;
|
||||
}
|
||||
fm->next=NULL;
|
||||
fm->handle=answer;
|
||||
if(name)
|
||||
{
|
||||
fm->name = malloc(strlen(name)+1);
|
||||
strcpy(fm->name, name);
|
||||
}
|
||||
else
|
||||
fm->name=NULL;
|
||||
fm->mapping_size=len;
|
||||
|
||||
return (HANDLE)answer;
|
||||
}
|
||||
return (HANDLE)0;
|
||||
}
|
||||
WIN_BOOL WINAPI UnmapViewOfFile(LPVOID handle)
|
||||
{
|
||||
file_mapping* p;
|
||||
int result;
|
||||
if(fm==0)
|
||||
return 0;
|
||||
for(p=fm; p; p=p->next)
|
||||
{
|
||||
if(p->handle==handle)
|
||||
{
|
||||
result=munmap((void*)handle, p->mapping_size);
|
||||
if(p->next)p->next->prev=p->prev;
|
||||
if(p->prev)p->prev->next=p->next;
|
||||
free(p->name);
|
||||
if(p==fm)
|
||||
fm=p->prev;
|
||||
free(p);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
//static int va_size=0;
|
||||
struct virt_alloc_s;
|
||||
typedef struct virt_alloc_s
|
||||
{
|
||||
int mapping_size;
|
||||
char* address;
|
||||
struct virt_alloc_s* next;
|
||||
struct virt_alloc_s* prev;
|
||||
int state;
|
||||
}virt_alloc;
|
||||
static virt_alloc* vm=0;
|
||||
#define MEM_COMMIT 0x00001000
|
||||
#define MEM_RESERVE 0x00002000
|
||||
|
||||
LPVOID WINAPI VirtualAlloc(LPVOID address, DWORD size, DWORD type, DWORD protection)
|
||||
{
|
||||
void* answer;
|
||||
long pgsz;
|
||||
|
||||
//printf("VirtualAlloc(0x%08X, %u, 0x%08X, 0x%08X)\n", (unsigned)address, size, type, protection);
|
||||
|
||||
if ((type&(MEM_RESERVE|MEM_COMMIT)) == 0) return NULL;
|
||||
|
||||
if (type&MEM_RESERVE && (unsigned)address&0xffff) {
|
||||
size += (unsigned)address&0xffff;
|
||||
address = (void*)((unsigned)address&~0xffff);
|
||||
}
|
||||
pgsz = sysconf(_SC_PAGESIZE);
|
||||
if (type&MEM_COMMIT && (unsigned)address%pgsz) {
|
||||
size += (unsigned)address%pgsz;
|
||||
address = (void*)((unsigned)address - (unsigned)address%pgsz);
|
||||
}
|
||||
|
||||
if (type&MEM_RESERVE && size<0x10000) size = 0x10000;
|
||||
if (size%pgsz) size += pgsz - size%pgsz;
|
||||
|
||||
if(address!=0)
|
||||
{
|
||||
//check whether we can allow to allocate this
|
||||
virt_alloc* str=vm;
|
||||
while(str)
|
||||
{
|
||||
if((unsigned)address>=(unsigned)str->address+str->mapping_size)
|
||||
{
|
||||
str=str->prev;
|
||||
continue;
|
||||
}
|
||||
if((unsigned)address+size<=(unsigned)str->address)
|
||||
{
|
||||
str=str->prev;
|
||||
continue;
|
||||
}
|
||||
if(str->state==0)
|
||||
{
|
||||
// FIXME
|
||||
if( ((unsigned)address >= (unsigned)str->address)
|
||||
&& ((unsigned)address+size<=(unsigned)str->address+str->mapping_size)
|
||||
&& (type & MEM_COMMIT))
|
||||
{
|
||||
return address; //returning previously reserved memory
|
||||
}
|
||||
//printf(" VirtualAlloc(...) does not commit or not entirely within reserved, and\n");
|
||||
}
|
||||
/*printf(" VirtualAlloc(...) (0x%08X, %u) overlaps with (0x%08X, %u, state=%d)\n",
|
||||
(unsigned)address, size, (unsigned)str->address, str->mapping_size, str->state);*/
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
answer=mmap_anon(address, size, PROT_READ | PROT_WRITE | PROT_EXEC,
|
||||
MAP_PRIVATE, 0);
|
||||
// answer=FILE_dommap(-1, address, 0, size, 0, 0,
|
||||
// PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE);
|
||||
|
||||
if (answer != (void *)-1 && address && answer != address) {
|
||||
/* It is dangerous to try mmap() with MAP_FIXED since it does not
|
||||
always detect conflicts or non-allocation and chaos ensues after
|
||||
a successful call but an overlapping or non-allocated region. */
|
||||
munmap(answer, size);
|
||||
answer = (void *) -1;
|
||||
errno = EINVAL;
|
||||
//printf(" VirtualAlloc(...) cannot satisfy requested address but address=NULL would work.\n");
|
||||
}
|
||||
if(answer==(void*)-1)
|
||||
{
|
||||
/*printf(" VirtualAlloc(...) mmap(0x%08X, %u, ...) failed with errno=%d (\"%s\")\n",
|
||||
(unsigned)address, size, errno, strerror(errno));*/
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
virt_alloc *new_vm = malloc(sizeof(virt_alloc));
|
||||
new_vm->mapping_size=size;
|
||||
new_vm->address=(char*)answer;
|
||||
new_vm->prev=vm;
|
||||
if(type == MEM_RESERVE)
|
||||
new_vm->state=0;
|
||||
else
|
||||
new_vm->state=1;
|
||||
if(vm)
|
||||
vm->next=new_vm;
|
||||
vm=new_vm;
|
||||
vm->next=0;
|
||||
//if(va_size!=0)
|
||||
// printf("Multiple VirtualAlloc!\n");
|
||||
//printf(" VirtualAlloc(...) provides (0x%08X, %u)\n", (unsigned)answer, size);
|
||||
return answer;
|
||||
}
|
||||
}
|
||||
|
||||
WIN_BOOL WINAPI VirtualFree(LPVOID address, SIZE_T dwSize, DWORD dwFreeType)//not sure
|
||||
{
|
||||
virt_alloc* str=vm;
|
||||
|
||||
//printf("VirtualFree(0x%08X, %d, 0x%08X)\n", (unsigned)address, dwSize, dwFreeType);
|
||||
while(str)
|
||||
{
|
||||
if(address!=str->address)
|
||||
{
|
||||
str=str->prev;
|
||||
continue;
|
||||
}
|
||||
//printf(" VirtualFree(...) munmap(0x%08X, %d)\n", (unsigned)str->address, str->mapping_size);
|
||||
munmap(str->address, str->mapping_size);
|
||||
if(str->next)str->next->prev=str->prev;
|
||||
if(str->prev)str->prev->next=str->next;
|
||||
if(vm==str)vm=str->prev;
|
||||
free(str);
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
INT WINAPI WideCharToMultiByte(UINT codepage, DWORD flags, LPCWSTR src,
|
||||
INT srclen,LPSTR dest, INT destlen, LPCSTR defch, WIN_BOOL* used_defch)
|
||||
{
|
||||
int i;
|
||||
if(srclen==-1){srclen=0; while(src[srclen++]);}
|
||||
if(destlen==0)
|
||||
return srclen;
|
||||
if(used_defch)
|
||||
*used_defch=0;
|
||||
for(i=0; i<min(srclen, destlen); i++)
|
||||
*dest++=(char)*src++;
|
||||
return min(srclen, destlen);
|
||||
}
|
||||
INT WINAPI MultiByteToWideChar(UINT codepage,DWORD flags, LPCSTR src, INT srclen,
|
||||
LPWSTR dest, INT destlen)
|
||||
{
|
||||
int i;
|
||||
if(srclen==-1){srclen=0; while(src[srclen++]);}
|
||||
if(destlen==0)
|
||||
return srclen;
|
||||
for(i=0; i<min(srclen, destlen); i++)
|
||||
*dest++=(WCHAR)*src++;
|
||||
return min(srclen, destlen);
|
||||
}
|
||||
HANDLE WINAPI OpenFileMappingA(DWORD access, WIN_BOOL prot, LPCSTR name)
|
||||
{
|
||||
file_mapping* p;
|
||||
if(fm==0)
|
||||
return (HANDLE)0;
|
||||
if(name==0)
|
||||
return (HANDLE)0;
|
||||
for(p=fm; p; p=p->prev)
|
||||
{
|
||||
if(p->name==0)
|
||||
continue;
|
||||
if(strcmp(p->name, name)==0)
|
||||
return (HANDLE)p->handle;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
/*
|
||||
* Modified for use with MPlayer, detailed changelog at
|
||||
* http://svn.mplayerhq.hu/mplayer/trunk/
|
||||
*/
|
||||
|
||||
#ifndef MPLAYER_EXT_H
|
||||
#define MPLAYER_EXT_H
|
||||
|
||||
#include "wine/windef.h"
|
||||
|
||||
LPVOID FILE_dommap( int unix_handle, LPVOID start,
|
||||
DWORD size_high, DWORD size_low,
|
||||
DWORD offset_high, DWORD offset_low,
|
||||
int prot, int flags );
|
||||
int FILE_munmap( LPVOID start, DWORD size_high, DWORD size_low );
|
||||
int wcsnicmp( const unsigned short* s1, const unsigned short* s2, int n );
|
||||
int __vprintf( const char *format, ... );
|
||||
|
||||
#endif /* MPLAYER_EXT_H */
|
||||
@@ -1,275 +0,0 @@
|
||||
/**
|
||||
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
* This file MUST be in main library because LDT must
|
||||
* be modified before program creates first thread
|
||||
* - avifile includes this file from C++ code
|
||||
* and initializes it at the start of player!
|
||||
* it might sound like a hack and it really is - but
|
||||
* as aviplay is deconding video with more than just one
|
||||
* thread currently it's necessary to do it this way
|
||||
* this might change in the future
|
||||
*/
|
||||
|
||||
/* applied some modification to make make our xine friend more happy */
|
||||
|
||||
/*
|
||||
* Modified for use with MPlayer, detailed changelog at
|
||||
* http://svn.mplayerhq.hu/mplayer/trunk/
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "ldt_keeper.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#ifdef HAVE_SYS_MMAN_H
|
||||
#include <sys/mman.h>
|
||||
#else
|
||||
#include "osdep/mmap.h"
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include "osdep/mmap_anon.h"
|
||||
#include "mp_msg.h"
|
||||
#ifdef __linux__
|
||||
#include <asm/unistd.h>
|
||||
#include <asm/ldt.h>
|
||||
// 2.5.xx+ calls this user_desc:
|
||||
#include <linux/version.h>
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,47)
|
||||
#define modify_ldt_ldt_s user_desc
|
||||
#endif
|
||||
/// declare modify_ldt with the _syscall3 macro for older glibcs
|
||||
#if defined(__GLIBC__) && (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ == 0))
|
||||
_syscall3( int, modify_ldt, int, func, void *, ptr, unsigned long, bytecount );
|
||||
#else
|
||||
int modify_ldt(int func, void *ptr, unsigned long bytecount);
|
||||
#endif
|
||||
#else
|
||||
#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
|
||||
#include <machine/segments.h>
|
||||
#include <machine/sysarch.h>
|
||||
#elif defined(__APPLE__)
|
||||
#include <architecture/i386/table.h>
|
||||
#include <i386/user_ldt.h>
|
||||
#elif defined(__svr4__)
|
||||
#include <sys/segment.h>
|
||||
#include <sys/sysi86.h>
|
||||
|
||||
/* solaris x86: add missing prototype for sysi86(), but only when sysi86(int, void*) is known to be valid */
|
||||
#ifdef HAVE_SYSI86_iv
|
||||
int sysi86(int, void*);
|
||||
#endif
|
||||
|
||||
#ifndef NUMSYSLDTS /* SunOS 2.5.1 does not define NUMSYSLDTS */
|
||||
#define NUMSYSLDTS 6 /* Let's hope the SunOS 5.8 value is OK */
|
||||
#endif
|
||||
|
||||
#define TEB_SEL_IDX NUMSYSLDTS
|
||||
#endif
|
||||
|
||||
#define LDT_ENTRIES 8192
|
||||
#define LDT_ENTRY_SIZE 8
|
||||
#pragma pack(4)
|
||||
struct modify_ldt_ldt_s {
|
||||
unsigned int entry_number;
|
||||
unsigned long base_addr;
|
||||
unsigned int limit;
|
||||
unsigned int seg_32bit:1;
|
||||
unsigned int contents:2;
|
||||
unsigned int read_exec_only:1;
|
||||
unsigned int limit_in_pages:1;
|
||||
unsigned int seg_not_present:1;
|
||||
unsigned int useable:1;
|
||||
};
|
||||
|
||||
#define MODIFY_LDT_CONTENTS_DATA 0
|
||||
#define MODIFY_LDT_CONTENTS_STACK 1
|
||||
#define MODIFY_LDT_CONTENTS_CODE 2
|
||||
#endif
|
||||
|
||||
|
||||
/* user level (privilege level: 3) ldt (1<<2) segment selector */
|
||||
#define LDT_SEL(idx) ((idx) << 3 | 1 << 2 | 3)
|
||||
|
||||
/* i got this value from wine sources, it's the first free LDT entry */
|
||||
#if (defined(__APPLE__) || defined(__FreeBSD__)) && defined(LDT_AUTO_ALLOC)
|
||||
#define TEB_SEL_IDX LDT_AUTO_ALLOC
|
||||
#define USE_LDT_AA
|
||||
#endif
|
||||
|
||||
#ifndef TEB_SEL_IDX
|
||||
#define TEB_SEL_IDX 17
|
||||
#endif
|
||||
|
||||
static unsigned int fs_ldt = TEB_SEL_IDX;
|
||||
|
||||
|
||||
/**
|
||||
* here is a small logical problem with Restore for multithreaded programs -
|
||||
* in C++ we use static class for this...
|
||||
*/
|
||||
|
||||
void Setup_FS_Segment(void)
|
||||
{
|
||||
unsigned int ldt_desc = LDT_SEL(fs_ldt);
|
||||
|
||||
__asm__ volatile(
|
||||
"movl %0,%%eax; movw %%ax, %%fs" : : "r" (ldt_desc)
|
||||
:"eax"
|
||||
);
|
||||
}
|
||||
|
||||
/* we don't need this - use modify_ldt instead */
|
||||
#if 0
|
||||
#ifdef __linux__
|
||||
/* XXX: why is this routine from libc redefined here? */
|
||||
/* NOTE: the redefined version ignores the count param, count is hardcoded as 16 */
|
||||
static int LDT_Modify( int func, struct modify_ldt_ldt_s *ptr,
|
||||
unsigned long count )
|
||||
{
|
||||
int res;
|
||||
#ifdef __PIC__
|
||||
__asm__ volatile( "pushl %%ebx\n\t"
|
||||
"movl %2,%%ebx\n\t"
|
||||
"int $0x80\n\t"
|
||||
"popl %%ebx"
|
||||
: "=a" (res)
|
||||
: "0" (__NR_modify_ldt),
|
||||
"r" (func),
|
||||
"c" (ptr),
|
||||
"d"(16)//sizeof(*ptr) from kernel point of view
|
||||
:"esi" );
|
||||
#else
|
||||
__asm__ volatile("int $0x80"
|
||||
: "=a" (res)
|
||||
: "0" (__NR_modify_ldt),
|
||||
"b" (func),
|
||||
"c" (ptr),
|
||||
"d"(16)
|
||||
:"esi");
|
||||
#endif /* __PIC__ */
|
||||
if (res >= 0) return res;
|
||||
errno = -res;
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__APPLE__)
|
||||
static void LDT_EntryToBytes( unsigned long *buffer, const struct modify_ldt_ldt_s *content )
|
||||
{
|
||||
*buffer++ = ((content->base_addr & 0x0000ffff) << 16) |
|
||||
(content->limit & 0x0ffff);
|
||||
*buffer = (content->base_addr & 0xff000000) |
|
||||
((content->base_addr & 0x00ff0000)>>16) |
|
||||
(content->limit & 0xf0000) |
|
||||
(content->contents << 10) |
|
||||
((content->read_exec_only == 0) << 9) |
|
||||
((content->seg_32bit != 0) << 22) |
|
||||
((content->limit_in_pages != 0) << 23) |
|
||||
0xf000;
|
||||
}
|
||||
#endif
|
||||
|
||||
void* fs_seg=0;
|
||||
|
||||
ldt_fs_t* Setup_LDT_Keeper(void)
|
||||
{
|
||||
struct modify_ldt_ldt_s array;
|
||||
int ret;
|
||||
ldt_fs_t* ldt_fs = malloc(sizeof(ldt_fs_t));
|
||||
|
||||
if (!ldt_fs)
|
||||
return NULL;
|
||||
|
||||
#ifdef __APPLE__
|
||||
if (getenv("DYLD_BIND_AT_LAUNCH") == NULL)
|
||||
mp_tmsg(MSGT_LOADER, MSGL_WARN, "WARNING: Attempting to use DLL codecs but environment variable\n DYLD_BIND_AT_LAUNCH not set. This will likely crash.\n");
|
||||
#endif /* __APPLE__ */
|
||||
|
||||
fs_seg=
|
||||
ldt_fs->fs_seg = mmap_anon(NULL, getpagesize(), PROT_READ | PROT_WRITE, MAP_PRIVATE, 0);
|
||||
if (ldt_fs->fs_seg == (void*)-1)
|
||||
{
|
||||
perror("ERROR: Couldn't allocate memory for fs segment");
|
||||
free(ldt_fs);
|
||||
return NULL;
|
||||
}
|
||||
*(void**)((char*)ldt_fs->fs_seg+0x18) = ldt_fs->fs_seg;
|
||||
memset(&array, 0, sizeof(array));
|
||||
array.base_addr=(int)ldt_fs->fs_seg;
|
||||
array.entry_number=TEB_SEL_IDX;
|
||||
array.limit=array.base_addr+getpagesize()-1;
|
||||
array.seg_32bit=1;
|
||||
array.read_exec_only=0;
|
||||
array.seg_not_present=0;
|
||||
array.contents=MODIFY_LDT_CONTENTS_DATA;
|
||||
array.limit_in_pages=0;
|
||||
#ifdef __linux__
|
||||
//ret=LDT_Modify(0x1, &array, sizeof(struct modify_ldt_ldt_s));
|
||||
ret=modify_ldt(0x1, &array, sizeof(struct modify_ldt_ldt_s));
|
||||
if(ret<0)
|
||||
{
|
||||
perror("install_fs");
|
||||
printf("Couldn't install fs segment, expect segfault\n");
|
||||
}
|
||||
#elif defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__APPLE__)
|
||||
{
|
||||
unsigned long d[2];
|
||||
|
||||
LDT_EntryToBytes( d, &array );
|
||||
#ifdef USE_LDT_AA
|
||||
ret = i386_set_ldt(LDT_AUTO_ALLOC, (union descriptor *)d, 1);
|
||||
array.entry_number = ret;
|
||||
fs_ldt = ret;
|
||||
#else
|
||||
ret = i386_set_ldt(array.entry_number, (union descriptor *)d, 1);
|
||||
#endif
|
||||
if (ret < 0)
|
||||
{
|
||||
perror("install_fs");
|
||||
printf("Couldn't install fs segment, expect segfault\n");
|
||||
printf("Did you reconfigure the kernel with \"options USER_LDT\"?\n");
|
||||
#ifdef __OpenBSD__
|
||||
printf("On newer OpenBSD systems did you set machdep.userldt to 1?\n");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#elif defined(__svr4__)
|
||||
{
|
||||
struct ssd ssd;
|
||||
ssd.sel = LDT_SEL(TEB_SEL_IDX);
|
||||
ssd.bo = array.base_addr;
|
||||
ssd.ls = array.limit - array.base_addr;
|
||||
ssd.acc1 = ((array.read_exec_only == 0) << 1) |
|
||||
(array.contents << 2) |
|
||||
0xf0; /* P(resent) | DPL3 | S */
|
||||
ssd.acc2 = 0x4; /* byte limit, 32-bit segment */
|
||||
if (sysi86(SI86DSCR, &ssd) < 0) {
|
||||
perror("sysi86(SI86DSCR)");
|
||||
printf("Couldn't install fs segment, expect segfault\n");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
Setup_FS_Segment();
|
||||
|
||||
ldt_fs->prev_struct = malloc(8);
|
||||
*(void**)array.base_addr = ldt_fs->prev_struct;
|
||||
|
||||
return ldt_fs;
|
||||
}
|
||||
|
||||
void Restore_LDT_Keeper(ldt_fs_t* ldt_fs)
|
||||
{
|
||||
if (ldt_fs == NULL || ldt_fs->fs_seg == 0)
|
||||
return;
|
||||
free(ldt_fs->prev_struct);
|
||||
munmap((char*)ldt_fs->fs_seg, getpagesize());
|
||||
ldt_fs->fs_seg = 0;
|
||||
free(ldt_fs);
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
#ifndef MPLAYER_LDT_KEEPER_H
|
||||
#define MPLAYER_LDT_KEEPER_H
|
||||
|
||||
extern void *fs_seg;
|
||||
|
||||
typedef struct {
|
||||
void* fs_seg;
|
||||
char* prev_struct;
|
||||
} ldt_fs_t;
|
||||
|
||||
void Setup_FS_Segment(void);
|
||||
ldt_fs_t* Setup_LDT_Keeper(void);
|
||||
void Restore_LDT_Keeper(ldt_fs_t* ldt_fs);
|
||||
|
||||
#endif /* MPLAYER_LDT_KEEPER_H */
|
||||
@@ -1,36 +0,0 @@
|
||||
/********************************************************
|
||||
|
||||
Win32 binary loader interface
|
||||
Copyright 2000 Eugene Kuznetsov (divx@euro.ru)
|
||||
Shamelessly stolen from Wine project
|
||||
|
||||
*********************************************************/
|
||||
|
||||
/*
|
||||
* Modified for use with MPlayer, detailed changelog at
|
||||
* http://svn.mplayerhq.hu/mplayer/trunk/
|
||||
*/
|
||||
|
||||
#ifndef MPLAYER_LOADER_H
|
||||
#define MPLAYER_LOADER_H
|
||||
|
||||
#include "wine/windef.h"
|
||||
#include "wine/driver.h"
|
||||
#include "wine/mmreg.h"
|
||||
#include "wine/vfw.h"
|
||||
#include "wine/msacm.h"
|
||||
#include "wine/module.h"
|
||||
|
||||
|
||||
extern modref_list* local_wm;
|
||||
|
||||
unsigned int GetPrivateProfileIntA_(const char* appname, const char* keyname, int default_value, const char* filename);
|
||||
int GetPrivateProfileStringA_(const char* appname, const char* keyname,
|
||||
const char* def_val, char* dest, unsigned int len, const char* filename);
|
||||
int WritePrivateProfileStringA_(const char* appname, const char* keyname,
|
||||
const char* string, const char* filename);
|
||||
|
||||
INT WINAPI LoadStringA( HINSTANCE instance, UINT resource_id,
|
||||
LPSTR buffer, INT buflen );
|
||||
|
||||
#endif /* MPLAYER_LOADER_H */
|
||||
-1075
File diff suppressed because it is too large
Load Diff
@@ -1,949 +0,0 @@
|
||||
/*
|
||||
* Copyright 1994 Eric Youndale & Erik Bos
|
||||
* Copyright 1995 Martin von Löwis
|
||||
* Copyright 1996-98 Marcus Meissner
|
||||
*
|
||||
* based on Eric Youndale's pe-test and:
|
||||
*
|
||||
* ftp.microsoft.com:/pub/developer/MSDN/CD8/PEFILE.ZIP
|
||||
* make that:
|
||||
* ftp.microsoft.com:/developr/MSDN/OctCD/PEFILE.ZIP
|
||||
*
|
||||
* Modified for use with MPlayer, detailed changelog at
|
||||
* http://svn.mplayerhq.hu/mplayer/trunk/
|
||||
*
|
||||
*/
|
||||
/* Notes:
|
||||
* Before you start changing something in this file be aware of the following:
|
||||
*
|
||||
* - There are several functions called recursively. In a very subtle and
|
||||
* obscure way. DLLs can reference each other recursively etc.
|
||||
* - If you want to enhance, speed up or clean up something in here, think
|
||||
* twice WHY it is implemented in that strange way. There is usually a reason.
|
||||
* Though sometimes it might just be lazyness ;)
|
||||
* - In PE_MapImage, right before fixup_imports() all external and internal
|
||||
* state MUST be correct since this function can be called with the SAME image
|
||||
* AGAIN. (Thats recursion for you.) That means MODREF.module and
|
||||
* NE_MODULE.module32.
|
||||
* - Sometimes, we can't use Linux mmap() to mmap() the images directly.
|
||||
*
|
||||
* The problem is, that there is not direct 1:1 mapping from a diskimage and
|
||||
* a memoryimage. The headers at the start are mapped linear, but the sections
|
||||
* are not. Older x86 pe binaries are 512 byte aligned in file and 4096 byte
|
||||
* aligned in memory. Linux likes them 4096 byte aligned in memory (due to
|
||||
* x86 pagesize, this cannot be fixed without a rather large kernel rewrite)
|
||||
* and 'blocksize' file-aligned (offsets). Since we have 512/1024/2048 (CDROM)
|
||||
* and other byte blocksizes, we can't always do this. We *can* do this for
|
||||
* newer pe binaries produced by MSVC 5 and later, since they are also aligned
|
||||
* to 4096 byte boundaries on disk.
|
||||
*/
|
||||
#include "config.h"
|
||||
#include "debug.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#ifdef HAVE_SYS_MMAN_H
|
||||
#include <sys/mman.h>
|
||||
#else
|
||||
#include "osdep/mmap.h"
|
||||
#endif
|
||||
#include "wine/windef.h"
|
||||
#include "wine/winbase.h"
|
||||
#include "wine/winerror.h"
|
||||
#include "wine/heap.h"
|
||||
#include "wine/pe_image.h"
|
||||
#include "wine/module.h"
|
||||
#include "wine/debugtools.h"
|
||||
#include "ext.h"
|
||||
#include "win32.h"
|
||||
|
||||
#define RVA(x) ((void *)((char *)load_addr+(unsigned int)(x)))
|
||||
|
||||
#define AdjustPtr(ptr,delta) ((char *)(ptr) + (delta))
|
||||
|
||||
static void dump_exports( HMODULE hModule )
|
||||
{
|
||||
char *Module;
|
||||
unsigned int i, j;
|
||||
unsigned short *ordinal;
|
||||
unsigned long *function;
|
||||
unsigned char **name;
|
||||
unsigned int load_addr = hModule;
|
||||
|
||||
DWORD rva_start = PE_HEADER(hModule)->OptionalHeader
|
||||
.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].VirtualAddress;
|
||||
DWORD rva_end = rva_start + PE_HEADER(hModule)->OptionalHeader
|
||||
.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].Size;
|
||||
IMAGE_EXPORT_DIRECTORY *pe_exports = (IMAGE_EXPORT_DIRECTORY*)RVA(rva_start);
|
||||
|
||||
Module = (char*)RVA(pe_exports->Name);
|
||||
(void)Module; //silence compiler warning
|
||||
TRACE("*******EXPORT DATA*******\n");
|
||||
TRACE("Module name is %s, %ld functions, %ld names\n",
|
||||
Module, pe_exports->NumberOfFunctions, pe_exports->NumberOfNames);
|
||||
|
||||
ordinal=(unsigned short*) RVA(pe_exports->AddressOfNameOrdinals);
|
||||
function=(unsigned long*) RVA(pe_exports->AddressOfFunctions);
|
||||
name=(unsigned char**) RVA(pe_exports->AddressOfNames);
|
||||
|
||||
(void)name; //silence compiler warning
|
||||
|
||||
TRACE(" Ord RVA Addr Name\n" );
|
||||
for (i=0;i<pe_exports->NumberOfFunctions;i++, function++)
|
||||
{
|
||||
if (!*function) continue;
|
||||
if (TRACE_ON(win32))
|
||||
{
|
||||
dbg_printf( "%4ld %08lx %p", i + pe_exports->Base, *function, RVA(*function) );
|
||||
|
||||
for (j = 0; j < pe_exports->NumberOfNames; j++)
|
||||
if (ordinal[j] == i)
|
||||
{
|
||||
dbg_printf( " %s", (char*)RVA(name[j]) );
|
||||
break;
|
||||
}
|
||||
if ((*function >= rva_start) && (*function <= rva_end))
|
||||
dbg_printf(" (forwarded -> %s)", (char *)RVA(*function));
|
||||
dbg_printf("\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Look up the specified function or ordinal in the exportlist:
|
||||
* If it is a string:
|
||||
* - look up the name in the Name list.
|
||||
* - look up the ordinal with that index.
|
||||
* - use the ordinal as offset into the functionlist
|
||||
* If it is a ordinal:
|
||||
* - use ordinal-pe_export->Base as offset into the functionlist
|
||||
*/
|
||||
FARPROC PE_FindExportedFunction(
|
||||
WINE_MODREF *wm,
|
||||
LPCSTR funcName,
|
||||
WIN_BOOL snoop )
|
||||
{
|
||||
unsigned short * ordinals;
|
||||
unsigned long * function;
|
||||
unsigned char ** name;
|
||||
const char *ename = NULL;
|
||||
int i, ordinal;
|
||||
PE_MODREF *pem = &(wm->binfmt.pe);
|
||||
IMAGE_EXPORT_DIRECTORY *exports = pem->pe_export;
|
||||
unsigned int load_addr = wm->module;
|
||||
unsigned long rva_start, rva_end, addr;
|
||||
|
||||
if (HIWORD(funcName))
|
||||
TRACE("(%s)\n",funcName);
|
||||
else
|
||||
TRACE("(%d)\n",(int)funcName);
|
||||
if (!exports) {
|
||||
/* Not a fatal problem, some apps do
|
||||
* GetProcAddress(0,"RegisterPenApp") which triggers this
|
||||
* case.
|
||||
*/
|
||||
WARN("Module %08x(%s)/MODREF %p doesn't have a exports table.\n",wm->module,wm->modname,pem);
|
||||
return NULL;
|
||||
}
|
||||
ordinals= (unsigned short*) RVA(exports->AddressOfNameOrdinals);
|
||||
function= (unsigned long*) RVA(exports->AddressOfFunctions);
|
||||
name = (unsigned char **) RVA(exports->AddressOfNames);
|
||||
rva_start = PE_HEADER(wm->module)->OptionalHeader
|
||||
.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].VirtualAddress;
|
||||
rva_end = rva_start + PE_HEADER(wm->module)->OptionalHeader
|
||||
.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].Size;
|
||||
|
||||
if (HIWORD(funcName))
|
||||
{
|
||||
|
||||
int min = 0, max = exports->NumberOfNames - 1;
|
||||
while (min <= max)
|
||||
{
|
||||
int res, pos = (min + max) / 2;
|
||||
ename = (const char*) RVA(name[pos]);
|
||||
if (!(res = strcmp( ename, funcName )))
|
||||
{
|
||||
ordinal = ordinals[pos];
|
||||
goto found;
|
||||
}
|
||||
if (res > 0) max = pos - 1;
|
||||
else min = pos + 1;
|
||||
}
|
||||
|
||||
for (i = 0; i < exports->NumberOfNames; i++)
|
||||
{
|
||||
ename = (const char*) RVA(name[i]);
|
||||
if (!strcmp( ename, funcName ))
|
||||
{
|
||||
ERR( "%s.%s required a linear search\n", wm->modname, funcName );
|
||||
ordinal = ordinals[i];
|
||||
goto found;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
ordinal = LOWORD(funcName) - exports->Base;
|
||||
if (snoop && name)
|
||||
{
|
||||
for (i = 0; i < exports->NumberOfNames; i++)
|
||||
if (ordinals[i] == ordinal)
|
||||
{
|
||||
ename = RVA(name[i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
found:
|
||||
if (ordinal >= exports->NumberOfFunctions)
|
||||
{
|
||||
TRACE(" ordinal %ld out of range!\n", ordinal + exports->Base );
|
||||
return NULL;
|
||||
}
|
||||
addr = function[ordinal];
|
||||
if (!addr) return NULL;
|
||||
if ((addr < rva_start) || (addr >= rva_end))
|
||||
{
|
||||
FARPROC proc = RVA(addr);
|
||||
if (snoop)
|
||||
{
|
||||
if (!ename) ename = "@";
|
||||
// proc = SNOOP_GetProcAddress(wm->module,ename,ordinal,proc);
|
||||
TRACE("SNOOP_GetProcAddress n/a\n");
|
||||
|
||||
}
|
||||
return proc;
|
||||
}
|
||||
else
|
||||
{
|
||||
WINE_MODREF *wm;
|
||||
char *forward = RVA(addr);
|
||||
char module[256];
|
||||
char *end = strchr(forward, '.');
|
||||
|
||||
if (!end) return NULL;
|
||||
if (end - forward >= sizeof(module)) return NULL;
|
||||
memcpy( module, forward, end - forward );
|
||||
module[end-forward] = 0;
|
||||
if (!(wm = MODULE_FindModule( module )))
|
||||
{
|
||||
ERR("module not found for forward '%s'\n", forward );
|
||||
return NULL;
|
||||
}
|
||||
return MODULE_GetProcAddress( wm->module, end + 1, snoop );
|
||||
}
|
||||
}
|
||||
|
||||
static DWORD fixup_imports( WINE_MODREF *wm )
|
||||
{
|
||||
IMAGE_IMPORT_DESCRIPTOR *pe_imp;
|
||||
PE_MODREF *pem;
|
||||
unsigned int load_addr = wm->module;
|
||||
int i,characteristics_detection=1;
|
||||
|
||||
assert(wm->type==MODULE32_PE);
|
||||
pem = &(wm->binfmt.pe);
|
||||
|
||||
|
||||
TRACE("Dumping imports list\n");
|
||||
|
||||
|
||||
pe_imp = pem->pe_import;
|
||||
if (!pe_imp) return 0;
|
||||
|
||||
/* We assume that we have at least one import with !0 characteristics and
|
||||
* detect broken imports with all characteristsics 0 (notably Borland) and
|
||||
* switch the detection off for them.
|
||||
*/
|
||||
for (i = 0; pe_imp->Name ; pe_imp++) {
|
||||
if (!i && !pe_imp->u.Characteristics)
|
||||
characteristics_detection = 0;
|
||||
if (characteristics_detection && !pe_imp->u.Characteristics)
|
||||
break;
|
||||
i++;
|
||||
}
|
||||
if (!i) return 0;
|
||||
|
||||
|
||||
wm->nDeps = i;
|
||||
wm->deps = HeapAlloc( GetProcessHeap(), 0, i*sizeof(WINE_MODREF *) );
|
||||
|
||||
/* load the imported modules. They are automatically
|
||||
* added to the modref list of the process.
|
||||
*/
|
||||
|
||||
for (i = 0, pe_imp = pem->pe_import; pe_imp->Name ; pe_imp++) {
|
||||
IMAGE_IMPORT_BY_NAME *pe_name;
|
||||
PIMAGE_THUNK_DATA import_list,thunk_list;
|
||||
char *name = (char *) RVA(pe_imp->Name);
|
||||
|
||||
if (characteristics_detection && !pe_imp->u.Characteristics)
|
||||
break;
|
||||
|
||||
/* FIXME: here we should fill imports */
|
||||
TRACE("Loading imports for %s.dll\n", name);
|
||||
|
||||
if (pe_imp->u.OriginalFirstThunk != 0) {
|
||||
TRACE("Microsoft style imports used\n");
|
||||
import_list =(PIMAGE_THUNK_DATA) RVA(pe_imp->u.OriginalFirstThunk);
|
||||
thunk_list = (PIMAGE_THUNK_DATA) RVA(pe_imp->FirstThunk);
|
||||
|
||||
while (import_list->u1.Ordinal) {
|
||||
if (IMAGE_SNAP_BY_ORDINAL(import_list->u1.Ordinal)) {
|
||||
int ordinal = IMAGE_ORDINAL(import_list->u1.Ordinal);
|
||||
|
||||
// TRACE("--- Ordinal %s,%d\n", name, ordinal);
|
||||
|
||||
thunk_list->u1.Function=LookupExternal(name, ordinal);
|
||||
} else {
|
||||
pe_name = (PIMAGE_IMPORT_BY_NAME)RVA(import_list->u1.AddressOfData);
|
||||
// TRACE("--- %s %s.%d\n", pe_name->Name, name, pe_name->Hint);
|
||||
thunk_list->u1.Function=LookupExternalByName(name, pe_name->Name);
|
||||
}
|
||||
import_list++;
|
||||
thunk_list++;
|
||||
}
|
||||
} else {
|
||||
TRACE("Borland style imports used\n");
|
||||
thunk_list = (PIMAGE_THUNK_DATA) RVA(pe_imp->FirstThunk);
|
||||
while (thunk_list->u1.Ordinal) {
|
||||
if (IMAGE_SNAP_BY_ORDINAL(thunk_list->u1.Ordinal)) {
|
||||
|
||||
int ordinal = IMAGE_ORDINAL(thunk_list->u1.Ordinal);
|
||||
|
||||
TRACE("--- Ordinal %s.%d\n",name,ordinal);
|
||||
thunk_list->u1.Function=LookupExternal(
|
||||
name, ordinal);
|
||||
} else {
|
||||
pe_name=(PIMAGE_IMPORT_BY_NAME) RVA(thunk_list->u1.AddressOfData);
|
||||
TRACE("--- %s %s.%d\n",
|
||||
pe_name->Name,name,pe_name->Hint);
|
||||
thunk_list->u1.Function=LookupExternalByName(
|
||||
name, pe_name->Name);
|
||||
}
|
||||
thunk_list++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int calc_vma_size( HMODULE hModule )
|
||||
{
|
||||
int i,vma_size = 0;
|
||||
IMAGE_SECTION_HEADER *pe_seg = PE_SECTIONS(hModule);
|
||||
|
||||
TRACE("Dump of segment table\n");
|
||||
TRACE(" Name VSz Vaddr SzRaw Fileadr *Reloc *Lineum #Reloc #Linum Char\n");
|
||||
for (i = 0; i< PE_HEADER(hModule)->FileHeader.NumberOfSections; i++)
|
||||
{
|
||||
TRACE("%8s: %4.4lx %8.8lx %8.8lx %8.8lx %8.8lx %8.8lx %4.4x %4.4x %8.8lx\n",
|
||||
pe_seg->Name,
|
||||
pe_seg->Misc.VirtualSize,
|
||||
pe_seg->VirtualAddress,
|
||||
pe_seg->SizeOfRawData,
|
||||
pe_seg->PointerToRawData,
|
||||
pe_seg->PointerToRelocations,
|
||||
pe_seg->PointerToLinenumbers,
|
||||
pe_seg->NumberOfRelocations,
|
||||
pe_seg->NumberOfLinenumbers,
|
||||
pe_seg->Characteristics);
|
||||
vma_size=max(vma_size, pe_seg->VirtualAddress+pe_seg->SizeOfRawData);
|
||||
vma_size=max(vma_size, pe_seg->VirtualAddress+pe_seg->Misc.VirtualSize);
|
||||
pe_seg++;
|
||||
}
|
||||
return vma_size;
|
||||
}
|
||||
|
||||
static void do_relocations( unsigned int load_addr, IMAGE_BASE_RELOCATION *r )
|
||||
{
|
||||
int delta = load_addr - PE_HEADER(load_addr)->OptionalHeader.ImageBase;
|
||||
int hdelta = (delta >> 16) & 0xFFFF;
|
||||
int ldelta = delta & 0xFFFF;
|
||||
|
||||
if(delta == 0)
|
||||
|
||||
return;
|
||||
while(r->VirtualAddress)
|
||||
{
|
||||
char *page = (char*) RVA(r->VirtualAddress);
|
||||
int count = (r->SizeOfBlock - 8)/2;
|
||||
int i;
|
||||
TRACE_(fixup)("%x relocations for page %lx\n",
|
||||
count, r->VirtualAddress);
|
||||
|
||||
for(i=0;i<count;i++)
|
||||
{
|
||||
int offset = r->TypeOffset[i] & 0xFFF;
|
||||
int type = r->TypeOffset[i] >> 12;
|
||||
// TRACE_(fixup)("patching %x type %x\n", offset, type);
|
||||
switch(type)
|
||||
{
|
||||
case IMAGE_REL_BASED_ABSOLUTE: break;
|
||||
case IMAGE_REL_BASED_HIGH:
|
||||
*(short*)(page+offset) += hdelta;
|
||||
break;
|
||||
case IMAGE_REL_BASED_LOW:
|
||||
*(short*)(page+offset) += ldelta;
|
||||
break;
|
||||
case IMAGE_REL_BASED_HIGHLOW:
|
||||
*(int*)(page+offset) += delta;
|
||||
|
||||
break;
|
||||
case IMAGE_REL_BASED_HIGHADJ:
|
||||
FIXME("Don't know what to do with IMAGE_REL_BASED_HIGHADJ\n");
|
||||
break;
|
||||
case IMAGE_REL_BASED_MIPS_JMPADDR:
|
||||
FIXME("Is this a MIPS machine ???\n");
|
||||
break;
|
||||
default:
|
||||
FIXME("Unknown fixup type\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
r = (IMAGE_BASE_RELOCATION*)((char*)r + r->SizeOfBlock);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* PE_LoadImage
|
||||
* Load one PE format DLL/EXE into memory
|
||||
*
|
||||
* Unluckily we can't just mmap the sections where we want them, for
|
||||
* (at least) Linux does only support offsets which are page-aligned.
|
||||
*
|
||||
* BUT we have to map the whole image anyway, for Win32 programs sometimes
|
||||
* want to access them. (HMODULE32 point to the start of it)
|
||||
*/
|
||||
HMODULE PE_LoadImage( int handle, LPCSTR filename, WORD *version )
|
||||
{
|
||||
HMODULE hModule;
|
||||
HANDLE mapping;
|
||||
|
||||
IMAGE_NT_HEADERS *nt;
|
||||
IMAGE_SECTION_HEADER *pe_sec;
|
||||
IMAGE_DATA_DIRECTORY *dir;
|
||||
// BY_HANDLE_FILE_INFORMATION bhfi;
|
||||
int i, rawsize, lowest_va, vma_size, file_size = 0;
|
||||
DWORD load_addr = 0, aoep, reloc = 0;
|
||||
// struct get_read_fd_request *req = get_req_buffer();
|
||||
int unix_handle = handle;
|
||||
int page_size = getpagesize();
|
||||
|
||||
|
||||
// if ( GetFileInformationByHandle( hFile, &bhfi ) )
|
||||
// file_size = bhfi.nFileSizeLow;
|
||||
file_size=lseek(handle, 0, SEEK_END);
|
||||
lseek(handle, 0, SEEK_SET);
|
||||
|
||||
// fix CreateFileMappingA
|
||||
mapping = CreateFileMappingA( handle, NULL, PAGE_READONLY | SEC_COMMIT,
|
||||
0, 0, NULL );
|
||||
if (!mapping)
|
||||
{
|
||||
WARN("CreateFileMapping error %ld\n", GetLastError() );
|
||||
return 0;
|
||||
}
|
||||
// hModule = (HMODULE)MapViewOfFile( mapping, FILE_MAP_READ, 0, 0, 0 );
|
||||
hModule=(HMODULE)mapping;
|
||||
// CloseHandle( mapping );
|
||||
if (!hModule)
|
||||
{
|
||||
WARN("MapViewOfFile error %ld\n", GetLastError() );
|
||||
return 0;
|
||||
}
|
||||
if ( *(WORD*)hModule !=IMAGE_DOS_SIGNATURE)
|
||||
{
|
||||
WARN("%s image doesn't have DOS signature, but 0x%04x\n", filename,*(WORD*)hModule);
|
||||
goto error;
|
||||
}
|
||||
|
||||
nt = PE_HEADER( hModule );
|
||||
|
||||
|
||||
if ( nt->Signature != IMAGE_NT_SIGNATURE )
|
||||
{
|
||||
WARN("%s image doesn't have PE signature, but 0x%08lx\n", filename, nt->Signature );
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
||||
if ( nt->FileHeader.Machine != IMAGE_FILE_MACHINE_I386 )
|
||||
{
|
||||
dbg_printf("Trying to load PE image for unsupported architecture (");
|
||||
switch (nt->FileHeader.Machine)
|
||||
{
|
||||
case IMAGE_FILE_MACHINE_UNKNOWN: dbg_printf("Unknown"); break;
|
||||
case IMAGE_FILE_MACHINE_I860: dbg_printf("I860"); break;
|
||||
case IMAGE_FILE_MACHINE_R3000: dbg_printf("R3000"); break;
|
||||
case IMAGE_FILE_MACHINE_R4000: dbg_printf("R4000"); break;
|
||||
case IMAGE_FILE_MACHINE_R10000: dbg_printf("R10000"); break;
|
||||
case IMAGE_FILE_MACHINE_ALPHA: dbg_printf("Alpha"); break;
|
||||
case IMAGE_FILE_MACHINE_POWERPC: dbg_printf("PowerPC"); break;
|
||||
default: dbg_printf("Unknown-%04x", nt->FileHeader.Machine); break;
|
||||
}
|
||||
dbg_printf(")\n");
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
||||
pe_sec = PE_SECTIONS( hModule );
|
||||
rawsize = 0; lowest_va = 0x10000;
|
||||
for (i = 0; i < nt->FileHeader.NumberOfSections; i++)
|
||||
{
|
||||
if (lowest_va > pe_sec[i].VirtualAddress)
|
||||
lowest_va = pe_sec[i].VirtualAddress;
|
||||
if (pe_sec[i].Characteristics & IMAGE_SCN_CNT_UNINITIALIZED_DATA)
|
||||
continue;
|
||||
if (pe_sec[i].PointerToRawData+pe_sec[i].SizeOfRawData > rawsize)
|
||||
rawsize = pe_sec[i].PointerToRawData+pe_sec[i].SizeOfRawData;
|
||||
}
|
||||
|
||||
|
||||
if ( file_size && file_size < rawsize )
|
||||
{
|
||||
ERR("PE module is too small (header: %d, filesize: %d), "
|
||||
"probably truncated download?\n",
|
||||
rawsize, file_size );
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
||||
aoep = nt->OptionalHeader.AddressOfEntryPoint;
|
||||
if (aoep && (aoep < lowest_va))
|
||||
FIXME("VIRUS WARNING: '%s' has an invalid entrypoint (0x%08lx) "
|
||||
"below the first virtual address (0x%08x) "
|
||||
"(possibly infected by Tchernobyl/SpaceFiller virus)!\n",
|
||||
filename, aoep, lowest_va );
|
||||
|
||||
|
||||
/* FIXME: Hack! While we don't really support shared sections yet,
|
||||
* this checks for those special cases where the whole DLL
|
||||
* consists only of shared sections and is mapped into the
|
||||
* shared address space > 2GB. In this case, we assume that
|
||||
* the module got mapped at its base address. Thus we simply
|
||||
* check whether the module has actually been mapped there
|
||||
* and use it, if so. This is needed to get Win95 USER32.DLL
|
||||
* to work (until we support shared sections properly).
|
||||
*/
|
||||
|
||||
if ( nt->OptionalHeader.ImageBase & 0x80000000 &&
|
||||
!strstr(filename, "xanlib.dll"))
|
||||
{
|
||||
HMODULE sharedMod = (HMODULE)nt->OptionalHeader.ImageBase;
|
||||
IMAGE_NT_HEADERS *sharedNt = (PIMAGE_NT_HEADERS)
|
||||
( (LPBYTE)sharedMod + ((LPBYTE)nt - (LPBYTE)hModule) );
|
||||
|
||||
/* Well, this check is not really comprehensive,
|
||||
but should be good enough for now ... */
|
||||
if ( !IsBadReadPtr( (LPBYTE)sharedMod, sizeof(IMAGE_DOS_HEADER) )
|
||||
&& memcmp( (LPBYTE)sharedMod, (LPBYTE)hModule, sizeof(IMAGE_DOS_HEADER) ) == 0
|
||||
&& !IsBadReadPtr( sharedNt, sizeof(IMAGE_NT_HEADERS) )
|
||||
&& memcmp( sharedNt, nt, sizeof(IMAGE_NT_HEADERS) ) == 0 )
|
||||
{
|
||||
UnmapViewOfFile( (LPVOID)hModule );
|
||||
return sharedMod;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
load_addr = nt->OptionalHeader.ImageBase;
|
||||
vma_size = calc_vma_size( hModule );
|
||||
|
||||
load_addr = (DWORD)VirtualAlloc( (void*)load_addr, vma_size,
|
||||
MEM_RESERVE | MEM_COMMIT,
|
||||
PAGE_EXECUTE_READWRITE );
|
||||
if (load_addr == 0)
|
||||
{
|
||||
|
||||
FIXME("We need to perform base relocations for %s\n", filename);
|
||||
dir = nt->OptionalHeader.DataDirectory+IMAGE_DIRECTORY_ENTRY_BASERELOC;
|
||||
if (dir->Size)
|
||||
reloc = dir->VirtualAddress;
|
||||
else
|
||||
{
|
||||
FIXME( "FATAL: Need to relocate %s, but no relocation records present (%s). Try to run that file directly !\n",
|
||||
filename,
|
||||
(nt->FileHeader.Characteristics&IMAGE_FILE_RELOCS_STRIPPED)?
|
||||
"stripped during link" : "unknown reason" );
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* FIXME: If we need to relocate a system DLL (base > 2GB) we should
|
||||
* really make sure that the *new* base address is also > 2GB.
|
||||
* Some DLLs really check the MSB of the module handle :-/
|
||||
*/
|
||||
if ( nt->OptionalHeader.ImageBase & 0x80000000 )
|
||||
ERR( "Forced to relocate system DLL (base > 2GB). This is not good.\n" );
|
||||
|
||||
load_addr = (DWORD)VirtualAlloc( NULL, vma_size,
|
||||
MEM_RESERVE | MEM_COMMIT,
|
||||
PAGE_EXECUTE_READWRITE );
|
||||
if (!load_addr) {
|
||||
FIXME_(win32)(
|
||||
"FATAL: Couldn't load module %s (out of memory, %d needed)!\n", filename, vma_size);
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
|
||||
TRACE("Load addr is %lx (base %lx), range %x\n",
|
||||
load_addr, nt->OptionalHeader.ImageBase, vma_size );
|
||||
TRACE_(segment)("Loading %s at %lx, range %x\n",
|
||||
filename, load_addr, vma_size );
|
||||
|
||||
#if 0
|
||||
|
||||
*(PIMAGE_DOS_HEADER)load_addr = *(PIMAGE_DOS_HEADER)hModule;
|
||||
*PE_HEADER( load_addr ) = *nt;
|
||||
memcpy( PE_SECTIONS(load_addr), PE_SECTIONS(hModule),
|
||||
sizeof(IMAGE_SECTION_HEADER) * nt->FileHeader.NumberOfSections );
|
||||
|
||||
|
||||
memcpy( load_addr, hModule, lowest_fa );
|
||||
#endif
|
||||
|
||||
if ((void*)FILE_dommap( handle, (void *)load_addr, 0, nt->OptionalHeader.SizeOfHeaders,
|
||||
0, 0, PROT_EXEC | PROT_WRITE | PROT_READ,
|
||||
MAP_PRIVATE | MAP_FIXED ) != (void*)load_addr)
|
||||
{
|
||||
ERR_(win32)( "Critical Error: failed to map PE header to necessary address.\n");
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
||||
pe_sec = PE_SECTIONS( hModule );
|
||||
for (i = 0; i < nt->FileHeader.NumberOfSections; i++, pe_sec++)
|
||||
{
|
||||
if (!pe_sec->SizeOfRawData || !pe_sec->PointerToRawData) continue;
|
||||
TRACE("%s: mmaping section %s at %p off %lx size %lx/%lx\n",
|
||||
filename, pe_sec->Name, (void*)RVA(pe_sec->VirtualAddress),
|
||||
pe_sec->PointerToRawData, pe_sec->SizeOfRawData, pe_sec->Misc.VirtualSize );
|
||||
if ((void*)FILE_dommap( unix_handle, (void*)RVA(pe_sec->VirtualAddress),
|
||||
0, pe_sec->SizeOfRawData, 0, pe_sec->PointerToRawData,
|
||||
PROT_EXEC | PROT_WRITE | PROT_READ,
|
||||
MAP_PRIVATE | MAP_FIXED ) != (void*)RVA(pe_sec->VirtualAddress))
|
||||
{
|
||||
|
||||
ERR_(win32)( "Critical Error: failed to map PE section to necessary address.\n");
|
||||
goto error;
|
||||
}
|
||||
if ((pe_sec->SizeOfRawData < pe_sec->Misc.VirtualSize) &&
|
||||
(pe_sec->SizeOfRawData & (page_size-1)))
|
||||
{
|
||||
DWORD end = (pe_sec->SizeOfRawData & ~(page_size-1)) + page_size;
|
||||
if (end > pe_sec->Misc.VirtualSize) end = pe_sec->Misc.VirtualSize;
|
||||
TRACE("clearing %p - %p\n",
|
||||
RVA(pe_sec->VirtualAddress) + pe_sec->SizeOfRawData,
|
||||
RVA(pe_sec->VirtualAddress) + end );
|
||||
memset( (char*)RVA(pe_sec->VirtualAddress) + pe_sec->SizeOfRawData, 0,
|
||||
end - pe_sec->SizeOfRawData );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ( reloc )
|
||||
do_relocations( load_addr, (IMAGE_BASE_RELOCATION *)RVA(reloc) );
|
||||
|
||||
|
||||
*version = ( (nt->OptionalHeader.MajorSubsystemVersion & 0xff) << 8 )
|
||||
| (nt->OptionalHeader.MinorSubsystemVersion & 0xff);
|
||||
|
||||
|
||||
UnmapViewOfFile( (LPVOID)hModule );
|
||||
return (HMODULE)load_addr;
|
||||
|
||||
error:
|
||||
if (unix_handle != -1) close( unix_handle );
|
||||
if (load_addr)
|
||||
VirtualFree( (LPVOID)load_addr, 0, MEM_RELEASE );
|
||||
UnmapViewOfFile( (LPVOID)hModule );
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* PE_CreateModule
|
||||
*
|
||||
* Create WINE_MODREF structure for loaded HMODULE32, link it into
|
||||
* process modref_list, and fixup all imports.
|
||||
*
|
||||
* Note: hModule must point to a correctly allocated PE image,
|
||||
* with base relocations applied; the 16-bit dummy module
|
||||
* associated to hModule must already exist.
|
||||
*
|
||||
* Note: This routine must always be called in the context of the
|
||||
* process that is to own the module to be created.
|
||||
*/
|
||||
WINE_MODREF *PE_CreateModule( HMODULE hModule,
|
||||
LPCSTR filename, DWORD flags, WIN_BOOL builtin )
|
||||
{
|
||||
DWORD load_addr = (DWORD)hModule;
|
||||
IMAGE_NT_HEADERS *nt = PE_HEADER(hModule);
|
||||
IMAGE_DATA_DIRECTORY *dir;
|
||||
IMAGE_IMPORT_DESCRIPTOR *pe_import = NULL;
|
||||
IMAGE_EXPORT_DIRECTORY *pe_export = NULL;
|
||||
IMAGE_RESOURCE_DIRECTORY *pe_resource = NULL;
|
||||
WINE_MODREF *wm;
|
||||
|
||||
|
||||
|
||||
|
||||
dir = nt->OptionalHeader.DataDirectory+IMAGE_DIRECTORY_ENTRY_EXPORT;
|
||||
if (dir->Size)
|
||||
pe_export = (PIMAGE_EXPORT_DIRECTORY)RVA(dir->VirtualAddress);
|
||||
|
||||
dir = nt->OptionalHeader.DataDirectory+IMAGE_DIRECTORY_ENTRY_IMPORT;
|
||||
if (dir->Size)
|
||||
pe_import = (PIMAGE_IMPORT_DESCRIPTOR)RVA(dir->VirtualAddress);
|
||||
|
||||
dir = nt->OptionalHeader.DataDirectory+IMAGE_DIRECTORY_ENTRY_RESOURCE;
|
||||
if (dir->Size)
|
||||
pe_resource = (PIMAGE_RESOURCE_DIRECTORY)RVA(dir->VirtualAddress);
|
||||
|
||||
dir = nt->OptionalHeader.DataDirectory+IMAGE_DIRECTORY_ENTRY_EXCEPTION;
|
||||
if (dir->Size) FIXME("Exception directory ignored\n" );
|
||||
|
||||
dir = nt->OptionalHeader.DataDirectory+IMAGE_DIRECTORY_ENTRY_SECURITY;
|
||||
if (dir->Size) FIXME("Security directory ignored\n" );
|
||||
|
||||
|
||||
|
||||
|
||||
dir = nt->OptionalHeader.DataDirectory+IMAGE_DIRECTORY_ENTRY_DEBUG;
|
||||
if (dir->Size) TRACE("Debug directory ignored\n" );
|
||||
|
||||
dir = nt->OptionalHeader.DataDirectory+IMAGE_DIRECTORY_ENTRY_COPYRIGHT;
|
||||
if (dir->Size) FIXME("Copyright string ignored\n" );
|
||||
|
||||
dir = nt->OptionalHeader.DataDirectory+IMAGE_DIRECTORY_ENTRY_GLOBALPTR;
|
||||
if (dir->Size) FIXME("Global Pointer (MIPS) ignored\n" );
|
||||
|
||||
|
||||
|
||||
dir = nt->OptionalHeader.DataDirectory+IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG;
|
||||
if (dir->Size) FIXME("Load Configuration directory ignored\n" );
|
||||
|
||||
dir = nt->OptionalHeader.DataDirectory+IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT;
|
||||
if (dir->Size) TRACE("Bound Import directory ignored\n" );
|
||||
|
||||
dir = nt->OptionalHeader.DataDirectory+IMAGE_DIRECTORY_ENTRY_IAT;
|
||||
if (dir->Size) TRACE("Import Address Table directory ignored\n" );
|
||||
|
||||
dir = nt->OptionalHeader.DataDirectory+IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT;
|
||||
if (dir->Size)
|
||||
{
|
||||
TRACE("Delayed import, stub calls LoadLibrary\n" );
|
||||
/*
|
||||
* Nothing to do here.
|
||||
*/
|
||||
|
||||
#ifdef ImgDelayDescr
|
||||
/*
|
||||
* This code is useful to observe what the heck is going on.
|
||||
*/
|
||||
{
|
||||
ImgDelayDescr *pe_delay = NULL;
|
||||
pe_delay = (PImgDelayDescr)RVA(dir->VirtualAddress);
|
||||
TRACE_(delayhlp)("pe_delay->grAttrs = %08x\n", pe_delay->grAttrs);
|
||||
TRACE_(delayhlp)("pe_delay->szName = %s\n", pe_delay->szName);
|
||||
TRACE_(delayhlp)("pe_delay->phmod = %08x\n", pe_delay->phmod);
|
||||
TRACE_(delayhlp)("pe_delay->pIAT = %08x\n", pe_delay->pIAT);
|
||||
TRACE_(delayhlp)("pe_delay->pINT = %08x\n", pe_delay->pINT);
|
||||
TRACE_(delayhlp)("pe_delay->pBoundIAT = %08x\n", pe_delay->pBoundIAT);
|
||||
TRACE_(delayhlp)("pe_delay->pUnloadIAT = %08x\n", pe_delay->pUnloadIAT);
|
||||
TRACE_(delayhlp)("pe_delay->dwTimeStamp = %08x\n", pe_delay->dwTimeStamp);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
dir = nt->OptionalHeader.DataDirectory+IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR;
|
||||
if (dir->Size) FIXME("Unknown directory 14 ignored\n" );
|
||||
|
||||
dir = nt->OptionalHeader.DataDirectory+15;
|
||||
if (dir->Size) FIXME("Unknown directory 15 ignored\n" );
|
||||
|
||||
|
||||
|
||||
|
||||
wm = (WINE_MODREF *)HeapAlloc( GetProcessHeap(),
|
||||
HEAP_ZERO_MEMORY, sizeof(*wm) );
|
||||
wm->module = hModule;
|
||||
|
||||
if ( builtin )
|
||||
wm->flags |= WINE_MODREF_INTERNAL;
|
||||
if ( flags & DONT_RESOLVE_DLL_REFERENCES )
|
||||
wm->flags |= WINE_MODREF_DONT_RESOLVE_REFS;
|
||||
if ( flags & LOAD_LIBRARY_AS_DATAFILE )
|
||||
wm->flags |= WINE_MODREF_LOAD_AS_DATAFILE;
|
||||
|
||||
wm->type = MODULE32_PE;
|
||||
wm->binfmt.pe.pe_export = pe_export;
|
||||
wm->binfmt.pe.pe_import = pe_import;
|
||||
wm->binfmt.pe.pe_resource = pe_resource;
|
||||
wm->binfmt.pe.tlsindex = -1;
|
||||
|
||||
wm->filename = malloc(strlen(filename)+1);
|
||||
strcpy(wm->filename, filename );
|
||||
wm->modname = strrchr( wm->filename, '\\' );
|
||||
if (!wm->modname) wm->modname = wm->filename;
|
||||
else wm->modname++;
|
||||
|
||||
if ( pe_export )
|
||||
dump_exports( hModule );
|
||||
|
||||
/* Fixup Imports */
|
||||
|
||||
if ( pe_import
|
||||
&& !( wm->flags & WINE_MODREF_LOAD_AS_DATAFILE )
|
||||
&& !( wm->flags & WINE_MODREF_DONT_RESOLVE_REFS )
|
||||
&& fixup_imports( wm ) )
|
||||
{
|
||||
/* remove entry from modref chain */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return wm;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* The PE Library Loader frontend.
|
||||
* FIXME: handle the flags.
|
||||
*/
|
||||
WINE_MODREF *PE_LoadLibraryExA (LPCSTR name, DWORD flags)
|
||||
{
|
||||
HMODULE hModule32;
|
||||
WINE_MODREF *wm;
|
||||
char filename[256];
|
||||
int hFile;
|
||||
WORD version = 0;
|
||||
|
||||
|
||||
strncpy(filename, name, sizeof(filename));
|
||||
hFile=open(filename, O_RDONLY);
|
||||
if(hFile==-1)
|
||||
return NULL;
|
||||
|
||||
|
||||
hModule32 = PE_LoadImage( hFile, filename, &version );
|
||||
if (!hModule32)
|
||||
{
|
||||
SetLastError( ERROR_OUTOFMEMORY );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ( !(wm = PE_CreateModule( hModule32, filename, flags, FALSE )) )
|
||||
{
|
||||
ERR( "can't load %s\n", filename );
|
||||
SetLastError( ERROR_OUTOFMEMORY );
|
||||
return NULL;
|
||||
}
|
||||
close(hFile);
|
||||
//printf("^^^^^^^^^^^^^^^^Alloc VM1 %p\n", wm);
|
||||
return wm;
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* PE_UnloadLibrary
|
||||
*
|
||||
* Unload the library unmapping the image and freeing the modref structure.
|
||||
*/
|
||||
void PE_UnloadLibrary(WINE_MODREF *wm)
|
||||
{
|
||||
TRACE(" unloading %s\n", wm->filename);
|
||||
|
||||
free(wm->filename);
|
||||
free(wm->short_filename);
|
||||
HeapFree( GetProcessHeap(), 0, wm->deps );
|
||||
VirtualFree( (LPVOID)wm->module, 0, MEM_RELEASE );
|
||||
HeapFree( GetProcessHeap(), 0, wm );
|
||||
//printf("^^^^^^^^^^^^^^^^Free VM1 %p\n", wm);
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
* Load the PE main .EXE. All other loading is done by PE_LoadLibraryExA
|
||||
* FIXME: this function should use PE_LoadLibraryExA, but currently can't
|
||||
* due to the PROCESS_Create stuff.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* This is a dirty hack.
|
||||
* The win32 DLLs contain an alloca routine, that first probes the soon
|
||||
* to be allocated new memory *below* the current stack pointer in 4KByte
|
||||
* increments. After the mem probing below the current %esp, the stack
|
||||
* pointer is finally decremented to make room for the "alloca"ed memory.
|
||||
* Maybe the probing code is intended to extend the stack on a windows box.
|
||||
* Anyway, the linux kernel does *not* extend the stack by simply accessing
|
||||
* memory below %esp; it segfaults.
|
||||
* The extend_stack_for_dll_alloca() routine just preallocates a big chunk
|
||||
* of memory on the stack, for use by the DLLs alloca routine.
|
||||
* Added the noinline attribute as e.g. gcc 3.2.2 inlines this function
|
||||
* in a way that breaks it.
|
||||
*/
|
||||
static void __attribute__((noinline)) extend_stack_for_dll_alloca(void)
|
||||
{
|
||||
#if !defined(__FreeBSD__) && !defined(__DragonFly__)
|
||||
volatile int* mem=alloca(0x20000);
|
||||
*mem=0x1234;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Called if the library is loaded or freed.
|
||||
* NOTE: if a thread attaches a DLL, the current thread will only do
|
||||
* DLL_PROCESS_ATTACH. Only new created threads do DLL_THREAD_ATTACH
|
||||
* (SDK)
|
||||
*/
|
||||
WIN_BOOL PE_InitDLL( WINE_MODREF *wm, DWORD type, LPVOID lpReserved )
|
||||
{
|
||||
WIN_BOOL retv = TRUE;
|
||||
assert( wm->type == MODULE32_PE );
|
||||
|
||||
|
||||
if ((PE_HEADER(wm->module)->FileHeader.Characteristics & IMAGE_FILE_DLL) &&
|
||||
(PE_HEADER(wm->module)->OptionalHeader.AddressOfEntryPoint)
|
||||
) {
|
||||
DLLENTRYPROC entry ;
|
||||
entry = (void*)PE_FindExportedFunction(wm, "DllMain", 0);
|
||||
if(entry==NULL)
|
||||
entry = (void*)RVA_PTR( wm->module,OptionalHeader.AddressOfEntryPoint );
|
||||
|
||||
TRACE_(relay)("CallTo32(entryproc=%p,module=%08x,type=%ld,res=%p)\n",
|
||||
entry, wm->module, type, lpReserved );
|
||||
|
||||
|
||||
TRACE("Entering DllMain(");
|
||||
switch(type)
|
||||
{
|
||||
case DLL_PROCESS_DETACH:
|
||||
TRACE("DLL_PROCESS_DETACH) ");
|
||||
break;
|
||||
case DLL_PROCESS_ATTACH:
|
||||
TRACE("DLL_PROCESS_ATTACH) ");
|
||||
break;
|
||||
case DLL_THREAD_DETACH:
|
||||
TRACE("DLL_THREAD_DETACH) ");
|
||||
break;
|
||||
case DLL_THREAD_ATTACH:
|
||||
TRACE("DLL_THREAD_ATTACH) ");
|
||||
break;
|
||||
}
|
||||
TRACE("for %s\n", wm->filename);
|
||||
extend_stack_for_dll_alloca();
|
||||
retv = entry( wm->module, type, lpReserved );
|
||||
}
|
||||
|
||||
return retv;
|
||||
}
|
||||
@@ -1,396 +0,0 @@
|
||||
/*
|
||||
* PE (Portable Execute) File Resources
|
||||
*
|
||||
* Copyright 1995 Thomas Sandford
|
||||
* Copyright 1996 Martin von Loewis
|
||||
*
|
||||
* Based on the Win16 resource handling code in loader/resource.c
|
||||
* Copyright 1993 Robert J. Amstadt
|
||||
* Copyright 1995 Alexandre Julliard
|
||||
* Copyright 1997 Marcus Meissner
|
||||
*
|
||||
* Modified for use with MPlayer, detailed changelog at
|
||||
* http://svn.mplayerhq.hu/mplayer/trunk/
|
||||
*
|
||||
*/
|
||||
#include "config.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include "wine/winestring.h"
|
||||
#include "wine/windef.h"
|
||||
#include "wine/pe_image.h"
|
||||
#include "wine/module.h"
|
||||
#include "wine/heap.h"
|
||||
//#include "task.h"
|
||||
//#include "process.h"
|
||||
//#include "stackframe.h"
|
||||
#include "wine/debugtools.h"
|
||||
#include "ext.h"
|
||||
|
||||
/**********************************************************************
|
||||
* HMODULE32toPE_MODREF
|
||||
*
|
||||
* small helper function to get a PE_MODREF from a passed HMODULE32
|
||||
*/
|
||||
static PE_MODREF*
|
||||
HMODULE32toPE_MODREF(HMODULE hmod) {
|
||||
WINE_MODREF *wm;
|
||||
|
||||
wm = MODULE32_LookupHMODULE( hmod );
|
||||
if (!wm || wm->type!=MODULE32_PE)
|
||||
return NULL;
|
||||
return &(wm->binfmt.pe);
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* GetResDirEntryW
|
||||
*
|
||||
* Helper function - goes down one level of PE resource tree
|
||||
*
|
||||
*/
|
||||
PIMAGE_RESOURCE_DIRECTORY GetResDirEntryW(PIMAGE_RESOURCE_DIRECTORY resdirptr,
|
||||
LPCWSTR name,DWORD root,
|
||||
WIN_BOOL allowdefault)
|
||||
{
|
||||
int entrynum;
|
||||
PIMAGE_RESOURCE_DIRECTORY_ENTRY entryTable;
|
||||
int namelen;
|
||||
|
||||
if (HIWORD(name)) {
|
||||
if (name[0]=='#') {
|
||||
char buf[10];
|
||||
|
||||
lstrcpynWtoA(buf,name+1,10);
|
||||
return GetResDirEntryW(resdirptr,(LPCWSTR)atoi(buf),root,allowdefault);
|
||||
}
|
||||
entryTable = (PIMAGE_RESOURCE_DIRECTORY_ENTRY) (
|
||||
(BYTE *) resdirptr +
|
||||
sizeof(IMAGE_RESOURCE_DIRECTORY));
|
||||
namelen = lstrlenW(name);
|
||||
for (entrynum = 0; entrynum < resdirptr->NumberOfNamedEntries; entrynum++)
|
||||
{
|
||||
PIMAGE_RESOURCE_DIR_STRING_U str =
|
||||
(PIMAGE_RESOURCE_DIR_STRING_U) (root +
|
||||
entryTable[entrynum].u1.s.NameOffset);
|
||||
if(namelen != str->Length)
|
||||
continue;
|
||||
if(wcsnicmp(name,str->NameString,str->Length)==0)
|
||||
return (PIMAGE_RESOURCE_DIRECTORY) (
|
||||
root +
|
||||
entryTable[entrynum].u2.s.OffsetToDirectory);
|
||||
}
|
||||
return NULL;
|
||||
} else {
|
||||
entryTable = (PIMAGE_RESOURCE_DIRECTORY_ENTRY) (
|
||||
(BYTE *) resdirptr +
|
||||
sizeof(IMAGE_RESOURCE_DIRECTORY) +
|
||||
resdirptr->NumberOfNamedEntries * sizeof(IMAGE_RESOURCE_DIRECTORY_ENTRY));
|
||||
for (entrynum = 0; entrynum < resdirptr->NumberOfIdEntries; entrynum++)
|
||||
if ((DWORD)entryTable[entrynum].u1.Name == (DWORD)name)
|
||||
return (PIMAGE_RESOURCE_DIRECTORY) (
|
||||
root +
|
||||
entryTable[entrynum].u2.s.OffsetToDirectory);
|
||||
/* just use first entry if no default can be found */
|
||||
if (allowdefault && !name && resdirptr->NumberOfIdEntries)
|
||||
return (PIMAGE_RESOURCE_DIRECTORY) (
|
||||
root +
|
||||
entryTable[0].u2.s.OffsetToDirectory);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* GetResDirEntryA
|
||||
*/
|
||||
PIMAGE_RESOURCE_DIRECTORY GetResDirEntryA( PIMAGE_RESOURCE_DIRECTORY resdirptr,
|
||||
LPCSTR name, DWORD root,
|
||||
WIN_BOOL allowdefault )
|
||||
{
|
||||
PIMAGE_RESOURCE_DIRECTORY retv;
|
||||
LPWSTR nameW = HIWORD(name)? HEAP_strdupAtoW( GetProcessHeap(), 0, name )
|
||||
: (LPWSTR)name;
|
||||
|
||||
retv = GetResDirEntryW( resdirptr, nameW, root, allowdefault );
|
||||
|
||||
if ( HIWORD(name) ) HeapFree( GetProcessHeap(), 0, nameW );
|
||||
|
||||
return retv;
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* PE_FindResourceEx32W
|
||||
*/
|
||||
HANDLE PE_FindResourceExW(
|
||||
WINE_MODREF *wm,LPCWSTR name,LPCWSTR type,WORD lang
|
||||
) {
|
||||
PIMAGE_RESOURCE_DIRECTORY resdirptr;
|
||||
DWORD root;
|
||||
HANDLE result;
|
||||
PE_MODREF *pem = &(wm->binfmt.pe);
|
||||
|
||||
if (!pem || !pem->pe_resource)
|
||||
return 0;
|
||||
|
||||
resdirptr = pem->pe_resource;
|
||||
root = (DWORD) resdirptr;
|
||||
if ((resdirptr = GetResDirEntryW(resdirptr, type, root, FALSE)) == NULL)
|
||||
return 0;
|
||||
if ((resdirptr = GetResDirEntryW(resdirptr, name, root, FALSE)) == NULL)
|
||||
return 0;
|
||||
result = (HANDLE)GetResDirEntryW(resdirptr, (LPCWSTR)(UINT)lang, root, FALSE);
|
||||
/* Try LANG_NEUTRAL, too */
|
||||
if(!result)
|
||||
return (HANDLE)GetResDirEntryW(resdirptr, (LPCWSTR)0, root, TRUE);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* PE_LoadResource32
|
||||
*/
|
||||
HANDLE PE_LoadResource( WINE_MODREF *wm, HANDLE hRsrc )
|
||||
{
|
||||
if (!hRsrc || !wm || wm->type!=MODULE32_PE)
|
||||
return 0;
|
||||
return (HANDLE) (wm->module + ((PIMAGE_RESOURCE_DATA_ENTRY)hRsrc)->OffsetToData);
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* PE_SizeofResource32
|
||||
*/
|
||||
DWORD PE_SizeofResource( HINSTANCE hModule, HANDLE hRsrc )
|
||||
{
|
||||
/* we don't need hModule */
|
||||
if (!hRsrc)
|
||||
return 0;
|
||||
return ((PIMAGE_RESOURCE_DATA_ENTRY)hRsrc)->Size;
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* PE_EnumResourceTypes32A
|
||||
*/
|
||||
WIN_BOOL
|
||||
PE_EnumResourceTypesA(HMODULE hmod,ENUMRESTYPEPROCA lpfun,LONG lparam) {
|
||||
PE_MODREF *pem = HMODULE32toPE_MODREF(hmod);
|
||||
int i;
|
||||
PIMAGE_RESOURCE_DIRECTORY resdir;
|
||||
PIMAGE_RESOURCE_DIRECTORY_ENTRY et;
|
||||
WIN_BOOL ret;
|
||||
HANDLE heap = GetProcessHeap();
|
||||
|
||||
if (!pem || !pem->pe_resource)
|
||||
return FALSE;
|
||||
|
||||
resdir = (PIMAGE_RESOURCE_DIRECTORY)pem->pe_resource;
|
||||
et =(PIMAGE_RESOURCE_DIRECTORY_ENTRY)((LPBYTE)resdir+sizeof(IMAGE_RESOURCE_DIRECTORY));
|
||||
ret = FALSE;
|
||||
for (i=0;i<resdir->NumberOfNamedEntries+resdir->NumberOfIdEntries;i++) {
|
||||
LPSTR name;
|
||||
|
||||
if (et[i].u1.s.NameIsString)
|
||||
name = HEAP_strdupWtoA(heap,0,(LPWSTR)((LPBYTE)pem->pe_resource+et[i].u1.s.NameOffset));
|
||||
else
|
||||
name = (LPSTR)(int)et[i].u1.Id;
|
||||
ret = lpfun(hmod,name,lparam);
|
||||
if (HIWORD(name))
|
||||
HeapFree(heap,0,name);
|
||||
if (!ret)
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* PE_EnumResourceTypes32W
|
||||
*/
|
||||
WIN_BOOL
|
||||
PE_EnumResourceTypesW(HMODULE hmod,ENUMRESTYPEPROCW lpfun,LONG lparam) {
|
||||
PE_MODREF *pem = HMODULE32toPE_MODREF(hmod);
|
||||
int i;
|
||||
PIMAGE_RESOURCE_DIRECTORY resdir;
|
||||
PIMAGE_RESOURCE_DIRECTORY_ENTRY et;
|
||||
WIN_BOOL ret;
|
||||
|
||||
if (!pem || !pem->pe_resource)
|
||||
return FALSE;
|
||||
|
||||
resdir = (PIMAGE_RESOURCE_DIRECTORY)pem->pe_resource;
|
||||
et =(PIMAGE_RESOURCE_DIRECTORY_ENTRY)((LPBYTE)resdir+sizeof(IMAGE_RESOURCE_DIRECTORY));
|
||||
ret = FALSE;
|
||||
for (i=0;i<resdir->NumberOfNamedEntries+resdir->NumberOfIdEntries;i++) {
|
||||
LPWSTR type;
|
||||
if (et[i].u1.s.NameIsString)
|
||||
type = (LPWSTR)((LPBYTE)pem->pe_resource+et[i].u1.s.NameOffset);
|
||||
else
|
||||
type = (LPWSTR)(int)et[i].u1.Id;
|
||||
|
||||
ret = lpfun(hmod,type,lparam);
|
||||
if (!ret)
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* PE_EnumResourceNames32A
|
||||
*/
|
||||
WIN_BOOL
|
||||
PE_EnumResourceNamesA(
|
||||
HMODULE hmod,LPCSTR type,ENUMRESNAMEPROCA lpfun,LONG lparam
|
||||
) {
|
||||
PE_MODREF *pem = HMODULE32toPE_MODREF(hmod);
|
||||
int i;
|
||||
PIMAGE_RESOURCE_DIRECTORY resdir;
|
||||
PIMAGE_RESOURCE_DIRECTORY_ENTRY et;
|
||||
WIN_BOOL ret;
|
||||
HANDLE heap = GetProcessHeap();
|
||||
LPWSTR typeW;
|
||||
|
||||
if (!pem || !pem->pe_resource)
|
||||
return FALSE;
|
||||
resdir = (PIMAGE_RESOURCE_DIRECTORY)pem->pe_resource;
|
||||
if (HIWORD(type))
|
||||
typeW = HEAP_strdupAtoW(heap,0,type);
|
||||
else
|
||||
typeW = (LPWSTR)type;
|
||||
resdir = GetResDirEntryW(resdir,typeW,(DWORD)pem->pe_resource,FALSE);
|
||||
if (HIWORD(typeW))
|
||||
HeapFree(heap,0,typeW);
|
||||
if (!resdir)
|
||||
return FALSE;
|
||||
et =(PIMAGE_RESOURCE_DIRECTORY_ENTRY)((LPBYTE)resdir+sizeof(IMAGE_RESOURCE_DIRECTORY));
|
||||
ret = FALSE;
|
||||
for (i=0;i<resdir->NumberOfNamedEntries+resdir->NumberOfIdEntries;i++) {
|
||||
LPSTR name;
|
||||
|
||||
if (et[i].u1.s.NameIsString)
|
||||
name = HEAP_strdupWtoA(heap,0,(LPWSTR)((LPBYTE)pem->pe_resource+et[i].u1.s.NameOffset));
|
||||
else
|
||||
name = (LPSTR)(int)et[i].u1.Id;
|
||||
ret = lpfun(hmod,type,name,lparam);
|
||||
if (HIWORD(name)) HeapFree(heap,0,name);
|
||||
if (!ret)
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* PE_EnumResourceNames32W
|
||||
*/
|
||||
WIN_BOOL
|
||||
PE_EnumResourceNamesW(
|
||||
HMODULE hmod,LPCWSTR type,ENUMRESNAMEPROCW lpfun,LONG lparam
|
||||
) {
|
||||
PE_MODREF *pem = HMODULE32toPE_MODREF(hmod);
|
||||
int i;
|
||||
PIMAGE_RESOURCE_DIRECTORY resdir;
|
||||
PIMAGE_RESOURCE_DIRECTORY_ENTRY et;
|
||||
WIN_BOOL ret;
|
||||
|
||||
if (!pem || !pem->pe_resource)
|
||||
return FALSE;
|
||||
|
||||
resdir = (PIMAGE_RESOURCE_DIRECTORY)pem->pe_resource;
|
||||
resdir = GetResDirEntryW(resdir,type,(DWORD)pem->pe_resource,FALSE);
|
||||
if (!resdir)
|
||||
return FALSE;
|
||||
et =(PIMAGE_RESOURCE_DIRECTORY_ENTRY)((LPBYTE)resdir+sizeof(IMAGE_RESOURCE_DIRECTORY));
|
||||
ret = FALSE;
|
||||
for (i=0;i<resdir->NumberOfNamedEntries+resdir->NumberOfIdEntries;i++) {
|
||||
LPWSTR name;
|
||||
if (et[i].u1.s.NameIsString)
|
||||
name = (LPWSTR)((LPBYTE)pem->pe_resource+et[i].u1.s.NameOffset);
|
||||
else
|
||||
name = (LPWSTR)(int)et[i].u1.Id;
|
||||
ret = lpfun(hmod,type,name,lparam);
|
||||
if (!ret)
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* PE_EnumResourceNames32A
|
||||
*/
|
||||
WIN_BOOL
|
||||
PE_EnumResourceLanguagesA(
|
||||
HMODULE hmod,LPCSTR name,LPCSTR type,ENUMRESLANGPROCA lpfun,
|
||||
LONG lparam
|
||||
) {
|
||||
PE_MODREF *pem = HMODULE32toPE_MODREF(hmod);
|
||||
int i;
|
||||
PIMAGE_RESOURCE_DIRECTORY resdir;
|
||||
PIMAGE_RESOURCE_DIRECTORY_ENTRY et;
|
||||
WIN_BOOL ret;
|
||||
HANDLE heap = GetProcessHeap();
|
||||
LPWSTR nameW,typeW;
|
||||
|
||||
if (!pem || !pem->pe_resource)
|
||||
return FALSE;
|
||||
|
||||
resdir = (PIMAGE_RESOURCE_DIRECTORY)pem->pe_resource;
|
||||
if (HIWORD(name))
|
||||
nameW = HEAP_strdupAtoW(heap,0,name);
|
||||
else
|
||||
nameW = (LPWSTR)name;
|
||||
resdir = GetResDirEntryW(resdir,nameW,(DWORD)pem->pe_resource,FALSE);
|
||||
if (HIWORD(nameW))
|
||||
HeapFree(heap,0,nameW);
|
||||
if (!resdir)
|
||||
return FALSE;
|
||||
if (HIWORD(type))
|
||||
typeW = HEAP_strdupAtoW(heap,0,type);
|
||||
else
|
||||
typeW = (LPWSTR)type;
|
||||
resdir = GetResDirEntryW(resdir,typeW,(DWORD)pem->pe_resource,FALSE);
|
||||
if (HIWORD(typeW))
|
||||
HeapFree(heap,0,typeW);
|
||||
if (!resdir)
|
||||
return FALSE;
|
||||
et =(PIMAGE_RESOURCE_DIRECTORY_ENTRY)((LPBYTE)resdir+sizeof(IMAGE_RESOURCE_DIRECTORY));
|
||||
ret = FALSE;
|
||||
for (i=0;i<resdir->NumberOfNamedEntries+resdir->NumberOfIdEntries;i++) {
|
||||
/* languages are just ids... I hopem */
|
||||
ret = lpfun(hmod,name,type,et[i].u1.Id,lparam);
|
||||
if (!ret)
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* PE_EnumResourceLanguages32W
|
||||
*/
|
||||
WIN_BOOL
|
||||
PE_EnumResourceLanguagesW(
|
||||
HMODULE hmod,LPCWSTR name,LPCWSTR type,ENUMRESLANGPROCW lpfun,
|
||||
LONG lparam
|
||||
) {
|
||||
PE_MODREF *pem = HMODULE32toPE_MODREF(hmod);
|
||||
int i;
|
||||
PIMAGE_RESOURCE_DIRECTORY resdir;
|
||||
PIMAGE_RESOURCE_DIRECTORY_ENTRY et;
|
||||
WIN_BOOL ret;
|
||||
|
||||
if (!pem || !pem->pe_resource)
|
||||
return FALSE;
|
||||
|
||||
resdir = (PIMAGE_RESOURCE_DIRECTORY)pem->pe_resource;
|
||||
resdir = GetResDirEntryW(resdir,name,(DWORD)pem->pe_resource,FALSE);
|
||||
if (!resdir)
|
||||
return FALSE;
|
||||
resdir = GetResDirEntryW(resdir,type,(DWORD)pem->pe_resource,FALSE);
|
||||
if (!resdir)
|
||||
return FALSE;
|
||||
et =(PIMAGE_RESOURCE_DIRECTORY_ENTRY)((LPBYTE)resdir+sizeof(IMAGE_RESOURCE_DIRECTORY));
|
||||
ret = FALSE;
|
||||
for (i=0;i<resdir->NumberOfNamedEntries+resdir->NumberOfIdEntries;i++) {
|
||||
ret = lpfun(hmod,name,type,et[i].u1.Id,lparam);
|
||||
if (!ret)
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
DECL_COMPONENT(sorenson3,"SMD_ComponentDispatch",1)
|
||||
DECL_COMPONENT(sorenson,"SorensonYUV9Dispatcher",1)
|
||||
DECL_COMPONENT(sorenson1,"SVD_ComponentDispatch",1)
|
||||
DECL_COMPONENT(genericd,"GenericComponentDispatch",0)
|
||||
DECL_COMPONENT(stmedia,"STMediaComponentDispatch",0)
|
||||
DECL_COMPONENT(handlecd,"HandleComponentDispatch",0)
|
||||
DECL_COMPONENT(pcxcd,"PCExchangeComponentDispatch",0)
|
||||
DECL_COMPONENT(capcd,"CapComponentDispatch",0)
|
||||
DECL_COMPONENT(videocd,"VideoComponentDispatch",0)
|
||||
DECL_COMPONENT(soundcd,"SoundComponentDispatch",0)
|
||||
DECL_COMPONENT(scalingcd,"ScalingCodecDispatcher",0)
|
||||
DECL_COMPONENT(formatcnv,"FormatConverterDispatch",0)
|
||||
|
||||
DECL_COMPONENT(basecd,"Base_CDComponentDispatch",1)
|
||||
DECL_COMPONENT(ddcd,"DD_CDComponentDispatch",0)
|
||||
DECL_COMPONENT(fakergb,"FakeRGBDispatcher",0)
|
||||
DECL_COMPONENT(rawcd,"RAW_CDComponentDispatch",0)
|
||||
DECL_COMPONENT(yuvsgi,"YUVSGI_CDComponentDispatch",0)
|
||||
DECL_COMPONENT(yuvs,"YUVS_CDComponentDispatch",0)
|
||||
DECL_COMPONENT(yuvu,"YUVU_CDComponentDispatch",0)
|
||||
|
||||
DECL_COMPONENT(qdm2d,"QDM2Decompressor",0)
|
||||
DECL_COMPONENT(mace3d,"Mace3DecompDispatch",0)
|
||||
|
||||
DECL_COMPONENT(prores,"IcpDecompressorComponentDispatch",0)
|
||||
|
||||
//DECL_COMPONENT(,"",0)
|
||||
-1593
File diff suppressed because it is too large
Load Diff
@@ -1,757 +0,0 @@
|
||||
#ifndef MPLAYER_COMPONENTS_H
|
||||
#define MPLAYER_COMPONENTS_H
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
// Basic types:
|
||||
|
||||
typedef char * Ptr;
|
||||
typedef Ptr * Handle;
|
||||
typedef int32_t Size;
|
||||
typedef unsigned char Boolean;
|
||||
typedef unsigned char Str31[32];
|
||||
typedef int32_t Fixed;
|
||||
|
||||
typedef int16_t OSErr;
|
||||
typedef int OSType;
|
||||
|
||||
typedef int32_t ComponentResult;
|
||||
typedef unsigned char UInt8;
|
||||
typedef signed char SInt8;
|
||||
typedef unsigned short UInt16;
|
||||
typedef signed short SInt16;
|
||||
typedef uint32_t UInt32;
|
||||
typedef int32_t SInt32;
|
||||
|
||||
#define FOUR_CHAR_CODE(a,b,c,d) ((uint32_t)(a)<<24 | (uint32_t)(b)<<16 | (uint32_t)(c)<<8 | (uint32_t)(d)) /* otherwise compiler will complain about values with high bit set */
|
||||
|
||||
// codec private shit:
|
||||
typedef void *GlobalsPtr;
|
||||
typedef void **Globals;
|
||||
|
||||
enum {
|
||||
kInitializeQTMLNoSoundFlag = (1L << 0),
|
||||
kInitializeQTMLUseGDIFlag = (1L << 1),
|
||||
kInitializeQTMLDisableDirectSound = (1L << 2),
|
||||
kInitializeQTMLUseExclusiveFullScreenModeFlag = (1L << 3),
|
||||
kInitializeQTMLDisableDDClippers = (1L << 4)
|
||||
};
|
||||
|
||||
//==================== COMPONENTS ===========================
|
||||
|
||||
struct __attribute__((__packed__)) ComponentParameters {
|
||||
UInt8 flags; /* call modifiers: sync/async, deferred, immed, etc */
|
||||
UInt8 paramSize; /* size in bytes of actual parameters passed to this call */
|
||||
short what; /* routine selector, negative for Component management calls */
|
||||
int32_t params[1]; /* actual parameters for the indicated routine */
|
||||
};
|
||||
typedef struct ComponentParameters ComponentParameters;
|
||||
|
||||
|
||||
struct __attribute__((__packed__)) ComponentDescription {
|
||||
OSType componentType; /* A unique 4-byte code indentifying the command set */
|
||||
OSType componentSubType; /* Particular flavor of this instance */
|
||||
OSType componentManufacturer; /* Vendor indentification */
|
||||
uint32_t componentFlags; /* 8 each for Component,Type,SubType,Manuf/revision */
|
||||
uint32_t componentFlagsMask; /* Mask for specifying which flags to consider in search, zero during registration */
|
||||
};
|
||||
typedef struct ComponentDescription ComponentDescription;
|
||||
|
||||
|
||||
struct __attribute__((__packed__)) ResourceSpec {
|
||||
OSType resType; /* 4-byte code */
|
||||
short resID; /* */
|
||||
};
|
||||
typedef struct ResourceSpec ResourceSpec;
|
||||
|
||||
|
||||
struct __attribute__((__packed__)) ComponentResource {
|
||||
ComponentDescription cd; /* Registration parameters */
|
||||
ResourceSpec component; /* resource where Component code is found */
|
||||
ResourceSpec componentName; /* name string resource */
|
||||
ResourceSpec componentInfo; /* info string resource */
|
||||
ResourceSpec componentIcon; /* icon resource */
|
||||
};
|
||||
typedef struct ComponentResource ComponentResource;
|
||||
typedef ComponentResource * ComponentResourcePtr;
|
||||
typedef ComponentResourcePtr * ComponentResourceHandle;
|
||||
|
||||
|
||||
struct __attribute__((__packed__)) ComponentRecord {
|
||||
int32_t data[1];
|
||||
};
|
||||
typedef struct ComponentRecord ComponentRecord;
|
||||
typedef ComponentRecord * Component;
|
||||
|
||||
|
||||
struct __attribute__((__packed__)) ComponentInstanceRecord {
|
||||
int32_t data[1];
|
||||
};
|
||||
typedef struct ComponentInstanceRecord ComponentInstanceRecord;
|
||||
|
||||
typedef ComponentInstanceRecord * ComponentInstance;
|
||||
|
||||
// ========================= QUICKDRAW =========================
|
||||
|
||||
struct __attribute__((__packed__)) Rect {
|
||||
short top;
|
||||
short left;
|
||||
short bottom;
|
||||
short right;
|
||||
};
|
||||
typedef struct Rect Rect;
|
||||
typedef Rect * RectPtr;
|
||||
|
||||
struct __attribute__((__packed__)) RGBColor {
|
||||
unsigned short red; /*magnitude of red component*/
|
||||
unsigned short green; /*magnitude of green component*/
|
||||
unsigned short blue; /*magnitude of blue component*/
|
||||
};
|
||||
typedef struct RGBColor RGBColor;
|
||||
typedef RGBColor * RGBColorPtr;
|
||||
typedef RGBColorPtr * RGBColorHdl;
|
||||
|
||||
struct __attribute__((__packed__)) ColorSpec {
|
||||
short value; /*index or other value*/
|
||||
RGBColor rgb; /*true color*/
|
||||
};
|
||||
typedef struct ColorSpec ColorSpec;
|
||||
typedef ColorSpec * ColorSpecPtr;
|
||||
typedef ColorSpec CSpecArray[1];
|
||||
|
||||
struct __attribute__((__packed__)) ColorTable {
|
||||
int32_t ctSeed; /*unique identifier for table*/
|
||||
short ctFlags; /*high bit: 0 = PixMap; 1 = device*/
|
||||
short ctSize; /*number of entries in CTTable*/
|
||||
CSpecArray ctTable; /*array [0..0] of ColorSpec*/
|
||||
};
|
||||
typedef struct ColorTable ColorTable;
|
||||
typedef ColorTable * CTabPtr;
|
||||
typedef CTabPtr * CTabHandle;
|
||||
|
||||
struct __attribute__((__packed__)) MatrixRecord {
|
||||
Fixed matrix[3][3];
|
||||
};
|
||||
typedef struct MatrixRecord MatrixRecord;
|
||||
typedef MatrixRecord * MatrixRecordPtr;
|
||||
|
||||
typedef int32_t ImageSequence;
|
||||
typedef OSType CodecType;
|
||||
typedef unsigned short CodecFlags;
|
||||
typedef uint32_t CodecQ;
|
||||
|
||||
struct __attribute__((__packed__)) ImageDescription {
|
||||
int32_t idSize; /* total size of ImageDescription including extra data ( CLUTs and other per sequence data ) */
|
||||
CodecType cType; /* what kind of codec compressed this data */
|
||||
int32_t resvd1; /* reserved for Apple use */
|
||||
short resvd2; /* reserved for Apple use */
|
||||
short dataRefIndex; /* set to zero */
|
||||
short version; /* which version is this data */
|
||||
short revisionLevel; /* what version of that codec did this */
|
||||
int32_t vendor; /* whose codec compressed this data */
|
||||
CodecQ temporalQuality; /* what was the temporal quality factor */
|
||||
CodecQ spatialQuality; /* what was the spatial quality factor */
|
||||
short width; /* how many pixels wide is this data */
|
||||
short height; /* how many pixels high is this data */
|
||||
Fixed hRes; /* horizontal resolution */
|
||||
Fixed vRes; /* vertical resolution */
|
||||
int32_t dataSize; /* if known, the size of data for this image descriptor */
|
||||
short frameCount; /* number of frames this description applies to */
|
||||
Str31 name; /* name of codec ( in case not installed ) */
|
||||
short depth; /* what depth is this data (1-32) or ( 33-40 grayscale ) */
|
||||
short clutID; /* clut id or if 0 clut follows or -1 if no clut */
|
||||
};
|
||||
typedef struct ImageDescription ImageDescription;
|
||||
typedef ImageDescription * ImageDescriptionPtr;
|
||||
typedef ImageDescriptionPtr * ImageDescriptionHandle;
|
||||
|
||||
/* values for PixMap.pixelFormat*/
|
||||
enum {
|
||||
k16LE555PixelFormat = FOUR_CHAR_CODE('L','5','5','5'), /* 16 bit LE rgb 555 (PC)*/
|
||||
k16LE5551PixelFormat = FOUR_CHAR_CODE('5','5','5','1'), /* 16 bit LE rgb 5551*/
|
||||
k16BE565PixelFormat = FOUR_CHAR_CODE('B','5','6','5'), /* 16 bit BE rgb 565*/
|
||||
k16LE565PixelFormat = FOUR_CHAR_CODE('L','5','6','5'), /* 16 bit LE rgb 565*/
|
||||
k24BGRPixelFormat = FOUR_CHAR_CODE('2','4','B','G'), /* 24 bit bgr */
|
||||
k32BGRAPixelFormat = FOUR_CHAR_CODE('B','G','R','A'), /* 32 bit bgra (Matrox)*/
|
||||
k32ABGRPixelFormat = FOUR_CHAR_CODE('A','B','G','R'), /* 32 bit abgr */
|
||||
k32RGBAPixelFormat = FOUR_CHAR_CODE('R','G','B','A'), /* 32 bit rgba */
|
||||
kYUVSPixelFormat = FOUR_CHAR_CODE('y','u','v','s'), /* YUV 4:2:2 byte ordering 16-unsigned = 'YUY2'*/
|
||||
kYUVUPixelFormat = FOUR_CHAR_CODE('y','u','v','u'), /* YUV 4:2:2 byte ordering 16-signed*/
|
||||
kYVU9PixelFormat = FOUR_CHAR_CODE('Y','V','U','9'), /* YVU9 Planar 9*/
|
||||
kYUV411PixelFormat = FOUR_CHAR_CODE('Y','4','1','1'), /* YUV 4:1:1 Interleaved 16*/
|
||||
kYVYU422PixelFormat = FOUR_CHAR_CODE('Y','V','Y','U'), /* YVYU 4:2:2 byte ordering 16*/
|
||||
kUYVY422PixelFormat = FOUR_CHAR_CODE('U','Y','V','Y'), /* UYVY 4:2:2 byte ordering 16*/
|
||||
kYUV211PixelFormat = FOUR_CHAR_CODE('Y','2','1','1'), /* YUV 2:1:1 Packed 8*/
|
||||
k2vuyPixelFormat = FOUR_CHAR_CODE('2','v','u','y') /* UYVY 4:2:2 byte ordering 16*/
|
||||
};
|
||||
|
||||
struct __attribute__((__packed__)) PixMapExtension {
|
||||
int32_t extSize; /*size of struct, duh!*/
|
||||
uint32_t pmBits; /*pixmap attributes bitfield*/
|
||||
void * pmGD; /*this is a GDHandle*/
|
||||
int32_t pmSeed;
|
||||
Fixed gammaLevel; /*pixmap gammalevel*/
|
||||
Fixed requestedGammaLevel;
|
||||
uint32_t reserved2;
|
||||
int32_t longRowBytes; /*used when rowBytes > 16382*/
|
||||
uint32_t signature;
|
||||
Handle baseAddrHandle;
|
||||
};
|
||||
typedef struct PixMapExtension PixMapExtension;
|
||||
|
||||
typedef PixMapExtension * PixMapExtPtr;
|
||||
typedef PixMapExtPtr * PixMapExtHandle;
|
||||
|
||||
|
||||
struct __attribute__((__packed__)) PixMap {
|
||||
Ptr baseAddr; /*pointer to pixels*/
|
||||
short rowBytes; /*offset to next line*/
|
||||
Rect bounds; /*encloses bitmap*/
|
||||
short pmVersion; /*pixMap version number*/
|
||||
short packType; /*defines packing format*/
|
||||
int32_t packSize; /*length of pixel data*/
|
||||
Fixed hRes; /*horiz. resolution (ppi)*/
|
||||
Fixed vRes; /*vert. resolution (ppi)*/
|
||||
short pixelType; /*defines pixel type*/
|
||||
short pixelSize; /*# bits in pixel*/
|
||||
short cmpCount; /*# components in pixel*/
|
||||
short cmpSize; /*# bits per component*/
|
||||
OSType pixelFormat; /*fourCharCode representation*/
|
||||
CTabHandle pmTable; /*color map for this pixMap*/
|
||||
PixMapExtHandle pmExt; /*Handle to pixMap extension*/
|
||||
};
|
||||
typedef struct PixMap PixMap;
|
||||
typedef PixMap * PixMapPtr;
|
||||
typedef PixMapPtr * PixMapHandle;
|
||||
|
||||
|
||||
struct __attribute__((__packed__)) BitMap {
|
||||
Ptr baseAddr;
|
||||
short rowBytes;
|
||||
Rect bounds;
|
||||
};
|
||||
typedef struct BitMap BitMap;
|
||||
typedef BitMap * BitMapPtr;
|
||||
typedef BitMapPtr * BitMapHandle;
|
||||
typedef struct OpaqueRgnHandle* RgnHandle;
|
||||
|
||||
struct Pattern {
|
||||
UInt8 pat[8];
|
||||
};
|
||||
typedef struct Pattern Pattern;
|
||||
typedef unsigned char Style;
|
||||
typedef Style StyleField;
|
||||
struct __attribute__((__packed__)) Point {
|
||||
short v;
|
||||
short h;
|
||||
};
|
||||
typedef struct Point Point;
|
||||
struct __attribute__((__packed__)) GrafPort {
|
||||
short device;
|
||||
BitMap portBits;
|
||||
Rect portRect;
|
||||
RgnHandle visRgn;
|
||||
RgnHandle clipRgn;
|
||||
Pattern bkPat;
|
||||
Pattern fillPat;
|
||||
Point pnLoc;
|
||||
Point pnSize;
|
||||
short pnMode;
|
||||
Pattern pnPat;
|
||||
short pnVis;
|
||||
short txFont;
|
||||
StyleField txFace; /*StyleField occupies 16-bits, but only first 8-bits are used*/
|
||||
UInt8 txFlags; /* QuickTime uses second 8 bits of StyleField for txFlags */
|
||||
short txMode;
|
||||
short txSize;
|
||||
Fixed spExtra;
|
||||
int32_t fgColor;
|
||||
int32_t bkColor;
|
||||
short colrBit;
|
||||
short patStretch;
|
||||
Handle picSave;
|
||||
Handle rgnSave;
|
||||
Handle polySave;
|
||||
/*QDProcsPtr*/void* grafProcs;
|
||||
};
|
||||
typedef struct GrafPort GrafPort;
|
||||
typedef GrafPort *GWorldPtr;
|
||||
typedef GWorldPtr *GWorldHandle;
|
||||
#define anyCodec ((CodecComponent)0)
|
||||
enum {
|
||||
/* transfer modes */
|
||||
srcCopy = 0, /*the 16 transfer modes*/
|
||||
srcOr = 1,
|
||||
srcXor = 2,
|
||||
srcBic = 3,
|
||||
notSrcCopy = 4,
|
||||
notSrcOr = 5,
|
||||
notSrcXor = 6,
|
||||
notSrcBic = 7,
|
||||
patCopy = 8,
|
||||
patOr = 9,
|
||||
patXor = 10,
|
||||
patBic = 11,
|
||||
notPatCopy = 12,
|
||||
notPatOr = 13,
|
||||
notPatXor = 14,
|
||||
notPatBic = 15, /* Special Text Transfer Mode */
|
||||
grayishTextOr = 49,
|
||||
hilitetransfermode = 50,
|
||||
hilite = 50, /* Arithmetic transfer modes */
|
||||
blend = 32,
|
||||
addPin = 33,
|
||||
addOver = 34,
|
||||
subPin = 35,
|
||||
addMax = 37,
|
||||
adMax = 37,
|
||||
subOver = 38,
|
||||
adMin = 39,
|
||||
ditherCopy = 64, /* Transparent mode constant */
|
||||
transparent = 36
|
||||
};
|
||||
|
||||
typedef uint32_t GWorldFlags;
|
||||
|
||||
|
||||
|
||||
// ============================== CODECS ===========================
|
||||
|
||||
typedef Component CompressorComponent;
|
||||
typedef Component DecompressorComponent;
|
||||
typedef Component CodecComponent;
|
||||
|
||||
enum {
|
||||
codecLosslessQuality = 0x00000400,
|
||||
codecMaxQuality = 0x000003FF,
|
||||
codecMinQuality = 0x00000000,
|
||||
codecLowQuality = 0x00000100,
|
||||
codecNormalQuality = 0x00000200,
|
||||
codecHighQuality = 0x00000300
|
||||
};
|
||||
|
||||
|
||||
|
||||
// callbacks:
|
||||
typedef void* ImageCodecDrawBandCompleteUPP;
|
||||
typedef int64_t ICMProgressProcRecord;
|
||||
typedef int64_t ICMCompletionProcRecord;
|
||||
typedef ICMCompletionProcRecord* ICMCompletionProcRecordPtr;
|
||||
typedef int64_t ICMDataProcRecord;
|
||||
typedef void* ICMFrameTimePtr;
|
||||
typedef void* CDSequenceDataSourcePtr;
|
||||
typedef void* ICMFrameTimeInfoPtr;
|
||||
|
||||
// graphics port
|
||||
typedef struct OpaqueGrafPtr* GrafPtr;
|
||||
typedef GrafPtr CGrafPtr;
|
||||
|
||||
|
||||
/* codec capabilities flags */
|
||||
enum {
|
||||
codecCanScale = 1L << 0, // 1
|
||||
codecCanMask = 1L << 1, // 2
|
||||
codecCanMatte = 1L << 2, // 4
|
||||
codecCanTransform = 1L << 3, // 8
|
||||
codecCanTransferMode = 1L << 4, // 10
|
||||
codecCanCopyPrev = 1L << 5, // 20
|
||||
codecCanSpool = 1L << 6, // 40
|
||||
codecCanClipVertical = 1L << 7, // 80
|
||||
codecCanClipRectangular = 1L << 8, // 100
|
||||
codecCanRemapColor = 1L << 9, // 200
|
||||
codecCanFastDither = 1L << 10, // 400
|
||||
codecCanSrcExtract = 1L << 11, // 800
|
||||
codecCanCopyPrevComp = 1L << 12, // 1000
|
||||
codecCanAsync = 1L << 13, // 2000
|
||||
codecCanMakeMask = 1L << 14, // 4000
|
||||
codecCanShift = 1L << 15, // 8000
|
||||
codecCanAsyncWhen = 1L << 16, // 10000
|
||||
codecCanShieldCursor = 1L << 17, // 20000
|
||||
codecCanManagePrevBuffer = 1L << 18, // 40000
|
||||
codecHasVolatileBuffer = 1L << 19, // 80000 /* codec requires redraw after window movement */
|
||||
codecWantsRegionMask = 1L << 20, // 100000
|
||||
codecImageBufferIsOnScreen = 1L << 21, // 200000 /* old def of codec using overlay surface, = ( codecIsDirectToScreenOnly | codecUsesOverlaySurface | codecImageBufferIsOverlaySurface | codecSrcMustBeImageBuffer ) */
|
||||
codecWantsDestinationPixels = 1L << 22, // 400000
|
||||
codecWantsSpecialScaling = 1L << 23, // 800000
|
||||
codecHandlesInputs = 1L << 24, // 1000000
|
||||
codecCanDoIndirectSurface = 1L << 25, /* codec can handle indirect surface (GDI) */
|
||||
codecIsSequenceSensitive = 1L << 26,
|
||||
codecRequiresOffscreen = 1L << 27,
|
||||
codecRequiresMaskBits = 1L << 28,
|
||||
codecCanRemapResolution = 1L << 29,
|
||||
codecIsDirectToScreenOnly = 1L << 30, /* codec can only decompress data to the screen */
|
||||
codecCanLockSurface = 1L << 31 /* codec can lock destination surface, icm doesn't lock for you */
|
||||
};
|
||||
|
||||
/* codec capabilities flags2 */
|
||||
enum {
|
||||
codecUsesOverlaySurface = 1L << 0, /* codec uses overlay surface */
|
||||
codecImageBufferIsOverlaySurface = 1L << 1, /* codec image buffer is overlay surface, the bits in the buffer are on the screen */
|
||||
codecSrcMustBeImageBuffer = 1L << 2, /* codec can only source data from an image buffer */
|
||||
codecImageBufferIsInAGPMemory = 1L << 4, /* codec image buffer is in AGP space, byte writes are OK */
|
||||
codecImageBufferIsInPCIMemory = 1L << 5 /* codec image buffer is across a PCI bus; byte writes are bad */
|
||||
};
|
||||
|
||||
/* codec condition flags */
|
||||
// FFD = 13 = 8+4+1
|
||||
enum {
|
||||
codecConditionFirstBand = 1L << 0, // 1
|
||||
codecConditionLastBand = 1L << 1, // 2
|
||||
codecConditionFirstFrame = 1L << 2, // 4
|
||||
codecConditionNewDepth = 1L << 3, // 8
|
||||
codecConditionNewTransform = 1L << 4, // 10
|
||||
codecConditionNewSrcRect = 1L << 5, // 20
|
||||
codecConditionNewMask = 1L << 6, // 40
|
||||
codecConditionNewMatte = 1L << 7, // 80
|
||||
codecConditionNewTransferMode = 1L << 8, // 100
|
||||
codecConditionNewClut = 1L << 9, // 200
|
||||
codecConditionNewAccuracy = 1L << 10, // 400
|
||||
codecConditionNewDestination = 1L << 11, // 800
|
||||
codecConditionFirstScreen = 1L << 12, // 1000
|
||||
codecConditionDoCursor = 1L << 13, // 2000
|
||||
codecConditionCatchUpDiff = 1L << 14, // 4000
|
||||
codecConditionMaskMayBeChanged = 1L << 15, // 8000
|
||||
codecConditionToBuffer = 1L << 16, // 10000
|
||||
codecConditionCodecChangedMask = 1L << 31 // 20000
|
||||
};
|
||||
|
||||
|
||||
|
||||
struct __attribute__((__packed__)) CodecCapabilities {
|
||||
int32_t flags;
|
||||
short wantedPixelSize;
|
||||
short extendWidth;
|
||||
short extendHeight;
|
||||
short bandMin;
|
||||
short bandInc;
|
||||
short pad;
|
||||
uint32_t time;
|
||||
int32_t flags2; /* field new in QuickTime 4.0 */
|
||||
};
|
||||
typedef struct CodecCapabilities CodecCapabilities;
|
||||
|
||||
struct __attribute__((__packed__)) CodecDecompressParams {
|
||||
ImageSequence sequenceID; /* predecompress,banddecompress */
|
||||
ImageDescriptionHandle imageDescription; /* predecompress,banddecompress */
|
||||
Ptr data;
|
||||
int32_t bufferSize;
|
||||
|
||||
int32_t frameNumber;
|
||||
int32_t startLine;
|
||||
int32_t stopLine;
|
||||
int32_t conditionFlags;
|
||||
|
||||
CodecFlags callerFlags; // short
|
||||
CodecCapabilities * capabilities; /* predecompress,banddecompress */
|
||||
ICMProgressProcRecord progressProcRecord;
|
||||
ICMCompletionProcRecord completionProcRecord;
|
||||
|
||||
ICMDataProcRecord dataProcRecord;
|
||||
CGrafPtr port; /* predecompress,banddecompress */
|
||||
PixMap dstPixMap; /* predecompress,banddecompress */
|
||||
BitMapPtr maskBits;
|
||||
PixMapPtr mattePixMap;
|
||||
Rect srcRect; /* predecompress,banddecompress */
|
||||
MatrixRecord * matrix; /* predecompress,banddecompress */
|
||||
CodecQ accuracy; /* predecompress,banddecompress */
|
||||
short transferMode; /* predecompress,banddecompress */
|
||||
ICMFrameTimePtr frameTime; /* banddecompress */
|
||||
int32_t reserved[1];
|
||||
|
||||
/* The following fields only exist for QuickTime 2.0 and greater */
|
||||
SInt8 matrixFlags; /* high bit set if 2x resize */
|
||||
SInt8 matrixType;
|
||||
Rect dstRect; /* only valid for simple transforms */
|
||||
|
||||
/* The following fields only exist for QuickTime 2.1 and greater */
|
||||
UInt16 majorSourceChangeSeed;
|
||||
UInt16 minorSourceChangeSeed;
|
||||
CDSequenceDataSourcePtr sourceData;
|
||||
|
||||
RgnHandle maskRegion;
|
||||
|
||||
/* The following fields only exist for QuickTime 2.5 and greater */
|
||||
OSType ** wantedDestinationPixelTypes; /* Handle to 0-terminated list of OSTypes */
|
||||
|
||||
int32_t screenFloodMethod;
|
||||
int32_t screenFloodValue;
|
||||
short preferredOffscreenPixelSize;
|
||||
|
||||
/* The following fields only exist for QuickTime 3.0 and greater */
|
||||
ICMFrameTimeInfoPtr syncFrameTime; /* banddecompress */
|
||||
Boolean needUpdateOnTimeChange; /* banddecompress */
|
||||
Boolean enableBlackLining;
|
||||
Boolean needUpdateOnSourceChange; /* band decompress */
|
||||
Boolean pad;
|
||||
|
||||
int32_t unused;
|
||||
|
||||
CGrafPtr finalDestinationPort;
|
||||
|
||||
int32_t requestedBufferWidth; /* must set codecWantsSpecialScaling to indicate this field is valid*/
|
||||
int32_t requestedBufferHeight; /* must set codecWantsSpecialScaling to indicate this field is valid*/
|
||||
|
||||
/* The following fields only exist for QuickTime 4.0 and greater */
|
||||
Rect displayableAreaOfRequestedBuffer; /* set in predecompress*/
|
||||
Boolean requestedSingleField;
|
||||
Boolean needUpdateOnNextIdle;
|
||||
Boolean pad2[2];
|
||||
Fixed bufferGammaLevel;
|
||||
|
||||
/* The following fields only exist for QuickTime 5.0 and greater */
|
||||
UInt32 taskWeight; /* preferred weight for MP tasks implementing this operation*/
|
||||
OSType taskName; /* preferred name (type) for MP tasks implementing this operation*/
|
||||
};
|
||||
typedef struct CodecDecompressParams CodecDecompressParams;
|
||||
|
||||
|
||||
|
||||
struct __attribute__((__packed__)) ImageSubCodecDecompressCapabilities {
|
||||
int32_t recordSize; /* sizeof(ImageSubCodecDecompressCapabilities)*/
|
||||
int32_t decompressRecordSize; /* size of your codec's decompress record*/
|
||||
Boolean canAsync; /* default true*/
|
||||
UInt8 pad0;
|
||||
|
||||
/* The following fields only exist for QuickTime 4.0 and greater */
|
||||
UInt16 suggestedQueueSize;
|
||||
Boolean canProvideTrigger;
|
||||
|
||||
/* The following fields only exist for QuickTime 5.0 and greater */
|
||||
Boolean subCodecFlushesScreen; /* only used on Mac OS X*/
|
||||
Boolean subCodecCallsDrawBandComplete;
|
||||
UInt8 pad2[1];
|
||||
|
||||
/* The following fields only exist for QuickTime 5.1 and greater */
|
||||
Boolean isChildCodec; /* set by base codec before calling Initialize*/
|
||||
UInt8 pad3[3];
|
||||
};
|
||||
typedef struct ImageSubCodecDecompressCapabilities ImageSubCodecDecompressCapabilities;
|
||||
|
||||
|
||||
struct __attribute__((__packed__)) ImageSubCodecDecompressRecord {
|
||||
Ptr baseAddr;
|
||||
int32_t rowBytes;
|
||||
Ptr codecData;
|
||||
ICMProgressProcRecord progressProcRecord;
|
||||
ICMDataProcRecord dataProcRecord;
|
||||
void * userDecompressRecord; /* pointer to codec-specific per-band data*/
|
||||
UInt8 frameType;
|
||||
Boolean inhibitMP; /* set this in BeginBand to tell the base decompressor not to call DrawBand from an MP task for this frame. (Only has any effect for MP-capable subcodecs. New in QuickTime 5.0.)*/
|
||||
UInt8 pad[2];
|
||||
int32_t priv[2];
|
||||
|
||||
/* The following fields only exist for QuickTime 5.0 and greater */
|
||||
ImageCodecDrawBandCompleteUPP drawBandCompleteUPP; /* only used if subcodec set subCodecCallsDrawBandComplete; if drawBandCompleteUPP is non-nil, codec must call it when a frame is finished, but may return from DrawBand before the frame is finished. */
|
||||
void * drawBandCompleteRefCon; /* Note: do not call drawBandCompleteUPP directly from a hardware interrupt; instead, use DTInstall to run a function at deferred task time, and call drawBandCompleteUPP from that. */
|
||||
};
|
||||
typedef struct ImageSubCodecDecompressRecord ImageSubCodecDecompressRecord;
|
||||
|
||||
|
||||
/* These are the bits that are set in the Component flags, and also in the codecInfo struct. */
|
||||
enum {
|
||||
codecInfoDoes1 = (1L << 0), /* codec can work with 1-bit pixels */
|
||||
codecInfoDoes2 = (1L << 1), /* codec can work with 2-bit pixels */
|
||||
codecInfoDoes4 = (1L << 2), /* codec can work with 4-bit pixels */
|
||||
codecInfoDoes8 = (1L << 3), /* codec can work with 8-bit pixels */
|
||||
codecInfoDoes16 = (1L << 4), /* codec can work with 16-bit pixels */
|
||||
codecInfoDoes32 = (1L << 5), /* codec can work with 32-bit pixels */
|
||||
codecInfoDoesDither = (1L << 6), /* codec can do ditherMode */
|
||||
codecInfoDoesStretch = (1L << 7), /* codec can stretch to arbitrary sizes */
|
||||
codecInfoDoesShrink = (1L << 8), /* codec can shrink to arbitrary sizes */
|
||||
codecInfoDoesMask = (1L << 9), /* codec can mask to clipping regions */
|
||||
codecInfoDoesTemporal = (1L << 10), /* codec can handle temporal redundancy */
|
||||
codecInfoDoesDouble = (1L << 11), /* codec can stretch to double size exactly */
|
||||
codecInfoDoesQuad = (1L << 12), /* codec can stretch to quadruple size exactly */
|
||||
codecInfoDoesHalf = (1L << 13), /* codec can shrink to half size */
|
||||
codecInfoDoesQuarter = (1L << 14), /* codec can shrink to quarter size */
|
||||
codecInfoDoesRotate = (1L << 15), /* codec can rotate on decompress */
|
||||
codecInfoDoesHorizFlip = (1L << 16), /* codec can flip horizontally on decompress */
|
||||
codecInfoDoesVertFlip = (1L << 17), /* codec can flip vertically on decompress */
|
||||
codecInfoHasEffectParameterList = (1L << 18), /* codec implements get effects parameter list call, once was codecInfoDoesSkew */
|
||||
codecInfoDoesBlend = (1L << 19), /* codec can blend on decompress */
|
||||
codecInfoDoesWarp = (1L << 20), /* codec can warp arbitrarily on decompress */
|
||||
codecInfoDoesRecompress = (1L << 21), /* codec can recompress image without accumulating errors */
|
||||
codecInfoDoesSpool = (1L << 22), /* codec can spool image data */
|
||||
codecInfoDoesRateConstrain = (1L << 23) /* codec can data rate constrain */
|
||||
};
|
||||
|
||||
|
||||
enum {
|
||||
codecInfoDepth1 = (1L << 0), /* compressed data at 1 bpp depth available */
|
||||
codecInfoDepth2 = (1L << 1), /* compressed data at 2 bpp depth available */
|
||||
codecInfoDepth4 = (1L << 2), /* compressed data at 4 bpp depth available */
|
||||
codecInfoDepth8 = (1L << 3), /* compressed data at 8 bpp depth available */
|
||||
codecInfoDepth16 = (1L << 4), /* compressed data at 16 bpp depth available */
|
||||
codecInfoDepth32 = (1L << 5), /* compressed data at 32 bpp depth available */
|
||||
codecInfoDepth24 = (1L << 6), /* compressed data at 24 bpp depth available */
|
||||
codecInfoDepth33 = (1L << 7), /* compressed data at 1 bpp monochrome depth available */
|
||||
codecInfoDepth34 = (1L << 8), /* compressed data at 2 bpp grayscale depth available */
|
||||
codecInfoDepth36 = (1L << 9), /* compressed data at 4 bpp grayscale depth available */
|
||||
codecInfoDepth40 = (1L << 10), /* compressed data at 8 bpp grayscale depth available */
|
||||
codecInfoStoresClut = (1L << 11), /* compressed data can have custom cluts */
|
||||
codecInfoDoesLossless = (1L << 12), /* compressed data can be stored in lossless format */
|
||||
codecInfoSequenceSensitive = (1L << 13) /* compressed data is sensitive to out of sequence decoding */
|
||||
};
|
||||
|
||||
struct __attribute__((__packed__)) CodecInfo {
|
||||
Str31 typeName; /* name of the codec type i.e.: 'Apple Image Compression' */
|
||||
short version; /* version of the codec data that this codec knows about */
|
||||
short revisionLevel; /* revision level of this codec i.e: 0x00010001 (1.0.1) */
|
||||
int32_t vendor; /* Maker of this codec i.e: 'appl' */
|
||||
int32_t decompressFlags; /* codecInfo flags for decompression capabilities */
|
||||
int32_t compressFlags; /* codecInfo flags for compression capabilities */
|
||||
int32_t formatFlags; /* codecInfo flags for compression format details */
|
||||
UInt8 compressionAccuracy; /* measure (1-255) of accuracy of this codec for compress (0 if unknown) */
|
||||
UInt8 decompressionAccuracy; /* measure (1-255) of accuracy of this codec for decompress (0 if unknown) */
|
||||
unsigned short compressionSpeed; /* ( millisecs for compressing 320x240 on base mac II) (0 if unknown) */
|
||||
unsigned short decompressionSpeed; /* ( millisecs for decompressing 320x240 on mac II)(0 if unknown) */
|
||||
UInt8 compressionLevel; /* measure (1-255) of compression level of this codec (0 if unknown) */
|
||||
UInt8 resvd; /* pad */
|
||||
short minimumHeight; /* minimum height of image (block size) */
|
||||
short minimumWidth; /* minimum width of image (block size) */
|
||||
short decompressPipelineLatency; /* in milliseconds ( for asynchronous codecs ) */
|
||||
short compressPipelineLatency; /* in milliseconds ( for asynchronous codecs ) */
|
||||
int32_t privateData;
|
||||
};
|
||||
typedef struct CodecInfo CodecInfo;
|
||||
|
||||
enum {
|
||||
codecFlagUseImageBuffer = (1L << 0), /* decompress*/
|
||||
codecFlagUseScreenBuffer = (1L << 1), /* decompress*/
|
||||
codecFlagUpdatePrevious = (1L << 2), /* compress*/
|
||||
codecFlagNoScreenUpdate = (1L << 3), /* decompress*/
|
||||
codecFlagWasCompressed = (1L << 4), /* compress*/
|
||||
codecFlagDontOffscreen = (1L << 5), /* decompress*/
|
||||
codecFlagUpdatePreviousComp = (1L << 6), /* compress*/
|
||||
codecFlagForceKeyFrame = (1L << 7), /* compress*/
|
||||
codecFlagOnlyScreenUpdate = (1L << 8), /* decompress*/
|
||||
codecFlagLiveGrab = (1L << 9), /* compress*/
|
||||
codecFlagDiffFrame = (1L << 9), /* decompress*/
|
||||
codecFlagDontUseNewImageBuffer = (1L << 10), /* decompress*/
|
||||
codecFlagInterlaceUpdate = (1L << 11), /* decompress*/
|
||||
codecFlagCatchUpDiff = (1L << 12), /* decompress*/
|
||||
codecFlagSupportDisable = (1L << 13), /* decompress*/
|
||||
codecFlagReenable = (1L << 14) /* decompress*/
|
||||
};
|
||||
|
||||
static inline void dump_ImageDescription(void* xxx){
|
||||
ImageDescription* id=(ImageDescription*)xxx;
|
||||
unsigned char* x;
|
||||
int i;
|
||||
|
||||
for(i=0;i<id->idSize;i++){
|
||||
printf(" %02X",((unsigned char*)id)[i]);
|
||||
if((i%16)==15) printf("\n");
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
|
||||
printf("=============== ImageDescription at %p ==================\n",xxx);
|
||||
printf("idSize=0x%X fourcc=0x%08X\n",id->idSize,id->cType);
|
||||
printf("ver=%d rev=%d vendor=0x%08X\n",id->version,id->revisionLevel,id->vendor);
|
||||
printf("tempQ=%d spatQ=%d dim: %d x %d dpi: %.2f x %.2f depth: %d\n",
|
||||
id->temporalQuality,id->spatialQuality,
|
||||
id->width, id->height,
|
||||
id->hRes / 65536.0, id->vRes / 65536.0,
|
||||
id->depth);
|
||||
printf("dataSize=%d frameCount=%d clutID=%d\n",id->dataSize, id->frameCount, id->clutID);
|
||||
printf("name='%.*s'\n",((char*)(&id->name))[0],((char*)(&id->name))+1);
|
||||
x=((char*)(&id->clutID))+2;
|
||||
if(id->idSize>sizeof(ImageDescription)){
|
||||
printf("%02X %02X %02X %02X | %02X %02X %02X %02X | %02X %02X %02X %02X | %02X %02X %02X %02X\n",
|
||||
x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15]);
|
||||
}
|
||||
printf("=========================================================\n");
|
||||
}
|
||||
|
||||
#if 0
|
||||
static inline void dump_Rect(char* title,Rect *r){
|
||||
printf("%s: %d;%d - %d;%d\n",title,
|
||||
(int)r->top,(int)r->left,(int)r->bottom,(int)r->right);
|
||||
}
|
||||
|
||||
static inline void dump_MatrixRecord(char* title, MatrixRecord *m){
|
||||
printf("%s: [%d %d %d][%d %d %d][%d %d %d]\n",title,
|
||||
m->matrix[0][0],m->matrix[0][1],m->matrix[0][2],
|
||||
m->matrix[1][0],m->matrix[1][1],m->matrix[1][2],
|
||||
m->matrix[2][0],m->matrix[2][1],m->matrix[2][2]);
|
||||
}
|
||||
|
||||
static inline void dump_PixMap(void* xxx){
|
||||
PixMap *p=xxx;
|
||||
printf("=============== PixMap at %p ==================\n",xxx);
|
||||
printf("base=%p stride=%d\n",p->baseAddr, p->rowBytes);
|
||||
dump_Rect("bounds",&p->bounds);
|
||||
printf("pmVersion=0x%X packType=0x%X\n packSize=0x%X\n",
|
||||
p->pmVersion,p->packType, p->packSize);
|
||||
printf("hRes=0x%X vRes=0x%X pixelType=0x%X pixelSize=0x%X\n",
|
||||
p->hRes,p->vRes,p->pixelType,p->pixelSize);
|
||||
printf("cmpCount=0x%X cmpSize=0x%X pixelFormat=0x%X\n",
|
||||
p->cmpCount,p->cmpSize,p->pixelFormat);
|
||||
printf("pmTable=%p pmExt=%p\n",p->pmTable,p->pmExt);
|
||||
printf("=========================================================\n");
|
||||
}
|
||||
|
||||
static inline void dump_CodecCapabilities(void* xxx){
|
||||
CodecCapabilities* cc=xxx;
|
||||
if(!xxx) return;
|
||||
printf("=============== CodecCapabilities at %p =================\n",xxx);
|
||||
printf("flags=0x%X flags2=0x%X\n",cc->flags,cc->flags2);
|
||||
printf("wantedPixelSize=%d extendWidth=%d extendHeight=%d band=%d+%d\n",
|
||||
cc->wantedPixelSize,cc->extendWidth,cc->extendHeight,
|
||||
cc->bandMin,cc->bandInc);
|
||||
printf("pad=0x%X time=0x%X\n",cc->pad,cc->time);
|
||||
printf("=========================================================\n");
|
||||
}
|
||||
|
||||
static inline void dump_CodecDecompressParams(void* xxx){
|
||||
CodecDecompressParams* cd=xxx;
|
||||
ImageDescription **idh;
|
||||
int i;
|
||||
if(!xxx) return;
|
||||
printf("=============== CodecDecompressParams at %p ==================\n",xxx);
|
||||
printf("sequenceID=%d\n",cd->sequenceID);
|
||||
idh=cd->imageDescription;
|
||||
if(idh && idh[0]) dump_ImageDescription(idh[0]);
|
||||
|
||||
for(i=0;i<sizeof(CodecDecompressParams);i++){
|
||||
printf(" %02X",((unsigned char*)cd)[i]);
|
||||
if((i%16)==15) printf("\n");
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
printf("data=%p size=%d\n",cd->data,cd->bufferSize);
|
||||
printf("frameno=%d lines: %d .. %d condflags=0x%X callerflags=0x%X\n",
|
||||
cd->frameNumber, cd->startLine, cd->stopLine, cd->conditionFlags,cd->callerFlags);
|
||||
// printf("maskBits=%p mattePixMap=%p\n",
|
||||
// cd->maskBits,cd->mattePixMap);
|
||||
dump_PixMap(&cd->dstPixMap);
|
||||
// if(cd->mattePixMap) dump_PixMap(cd->mattePixMap);
|
||||
if(cd->matrix) dump_MatrixRecord("matrix",cd->matrix);
|
||||
if(cd->capabilities) dump_CodecCapabilities(cd->capabilities);
|
||||
printf("accuracy=%d transferMode=%d matrixFlags=0x%X matrixType=%d\n",
|
||||
(int)cd->accuracy, (int)cd->transferMode, (int)cd->matrixFlags, (int)cd->matrixType);
|
||||
printf("srcrect: %d;%d - %d;%d\n",cd->srcRect.top,cd->srcRect.left,cd->srcRect.bottom,cd->srcRect.right);
|
||||
printf("dstrect: %d;%d - %d;%d\n",cd->dstRect.top,cd->dstRect.left,cd->dstRect.bottom,cd->dstRect.right);
|
||||
printf("wantedDestinationPixelTypes=%p\n",cd->wantedDestinationPixelTypes);
|
||||
if(cd->wantedDestinationPixelTypes){
|
||||
unsigned int* p=cd->wantedDestinationPixelTypes;
|
||||
while(p[0]){
|
||||
printf(" 0x%08X %.4s\n",p[0],&p[0]);
|
||||
++p;
|
||||
}
|
||||
}
|
||||
printf("screenFloodMethod=%d value=%d preferredOffscreenPixelSize=%d\n",
|
||||
cd->screenFloodMethod, cd->screenFloodValue, cd->preferredOffscreenPixelSize);
|
||||
printf("callbacks: progress=%p compl=%p data=%p ftime=%p srcdata=%p sync=%p\n",
|
||||
cd->progressProcRecord, cd->completionProcRecord,
|
||||
cd->dataProcRecord, cd->frameTime, cd->sourceData, cd->syncFrameTime);
|
||||
// printf("\n");
|
||||
|
||||
printf("=========================================================\n");
|
||||
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* MPLAYER_COMPONENTS_H */
|
||||
@@ -1,72 +0,0 @@
|
||||
#ifndef MPLAYER_SELECT_H
|
||||
#define MPLAYER_SELECT_H
|
||||
|
||||
enum {
|
||||
kComponentOpenSelect = -1, /* ComponentInstance for this open */
|
||||
kComponentCloseSelect = -2, /* ComponentInstance for this close */
|
||||
kComponentCanDoSelect = -3, /* selector # being queried */
|
||||
kComponentVersionSelect = -4, /* no params */
|
||||
kComponentRegisterSelect = -5, /* no params */
|
||||
kComponentTargetSelect = -6, /* ComponentInstance for top of call chain */
|
||||
kComponentUnregisterSelect = -7, /* no params */
|
||||
kComponentGetMPWorkFunctionSelect = -8, /* some params */
|
||||
kComponentExecuteWiredActionSelect = -9, /* QTAtomContainer actionContainer, QTAtom actionAtom, QTCustomActionTargetPtr target, QTEventRecordPtr event */
|
||||
kComponentGetPublicResourceSelect = -10 /* OSType resourceType, short resourceId, Handle *resource */
|
||||
};
|
||||
|
||||
/* selectors for component calls */
|
||||
enum {
|
||||
kImageCodecGetCodecInfoSelect = 0x0000,
|
||||
kImageCodecGetCompressionTimeSelect = 0x0001,
|
||||
kImageCodecGetMaxCompressionSizeSelect = 0x0002,
|
||||
kImageCodecPreCompressSelect = 0x0003,
|
||||
kImageCodecBandCompressSelect = 0x0004,
|
||||
kImageCodecPreDecompressSelect = 0x0005,
|
||||
kImageCodecBandDecompressSelect = 0x0006,
|
||||
kImageCodecBusySelect = 0x0007,
|
||||
kImageCodecGetCompressedImageSizeSelect = 0x0008,
|
||||
kImageCodecGetSimilaritySelect = 0x0009,
|
||||
kImageCodecTrimImageSelect = 0x000A,
|
||||
kImageCodecRequestSettingsSelect = 0x000B,
|
||||
kImageCodecGetSettingsSelect = 0x000C,
|
||||
kImageCodecSetSettingsSelect = 0x000D,
|
||||
kImageCodecFlushSelect = 0x000E,
|
||||
kImageCodecSetTimeCodeSelect = 0x000F,
|
||||
kImageCodecIsImageDescriptionEquivalentSelect = 0x0010,
|
||||
kImageCodecNewMemorySelect = 0x0011,
|
||||
kImageCodecDisposeMemorySelect = 0x0012,
|
||||
kImageCodecHitTestDataSelect = 0x0013,
|
||||
kImageCodecNewImageBufferMemorySelect = 0x0014,
|
||||
kImageCodecExtractAndCombineFieldsSelect = 0x0015,
|
||||
kImageCodecGetMaxCompressionSizeWithSourcesSelect = 0x0016,
|
||||
kImageCodecSetTimeBaseSelect = 0x0017,
|
||||
kImageCodecSourceChangedSelect = 0x0018,
|
||||
kImageCodecFlushFrameSelect = 0x0019,
|
||||
kImageCodecGetSettingsAsTextSelect = 0x001A,
|
||||
kImageCodecGetParameterListHandleSelect = 0x001B,
|
||||
kImageCodecGetParameterListSelect = 0x001C,
|
||||
kImageCodecCreateStandardParameterDialogSelect = 0x001D,
|
||||
kImageCodecIsStandardParameterDialogEventSelect = 0x001E,
|
||||
kImageCodecDismissStandardParameterDialogSelect = 0x001F,
|
||||
kImageCodecStandardParameterDialogDoActionSelect = 0x0020,
|
||||
kImageCodecNewImageGWorldSelect = 0x0021,
|
||||
kImageCodecDisposeImageGWorldSelect = 0x0022,
|
||||
kImageCodecHitTestDataWithFlagsSelect = 0x0023,
|
||||
kImageCodecValidateParametersSelect = 0x0024,
|
||||
kImageCodecGetBaseMPWorkFunctionSelect = 0x0025,
|
||||
kImageCodecRequestGammaLevelSelect = 0x0028,
|
||||
kImageCodecGetSourceDataGammaLevelSelect = 0x0029,
|
||||
kImageCodecGetDecompressLatencySelect = 0x002B,
|
||||
kImageCodecPreflightSelect = 0x0200,
|
||||
kImageCodecInitializeSelect = 0x0201,
|
||||
kImageCodecBeginBandSelect = 0x0202,
|
||||
kImageCodecDrawBandSelect = 0x0203,
|
||||
kImageCodecEndBandSelect = 0x0204,
|
||||
kImageCodecQueueStartingSelect = 0x0205,
|
||||
kImageCodecQueueStoppingSelect = 0x0206,
|
||||
kImageCodecDroppingFrameSelect = 0x0207,
|
||||
kImageCodecScheduleFrameSelect = 0x0208,
|
||||
kImageCodecCancelTriggerSelect = 0x0209
|
||||
};
|
||||
|
||||
#endif /* MPLAYER_SELECT_H */
|
||||
@@ -1,531 +0,0 @@
|
||||
/*
|
||||
* Modified for use with MPlayer, detailed changelog at
|
||||
* http://svn.mplayerhq.hu/mplayer/trunk/
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "debug.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <pwd.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "wine/winbase.h"
|
||||
#include "wine/winreg.h"
|
||||
#include "wine/winnt.h"
|
||||
#include "wine/winerror.h"
|
||||
|
||||
#include "ext.h"
|
||||
#include "registry.h"
|
||||
|
||||
#include "path.h"
|
||||
|
||||
//#undef TRACE
|
||||
//#define TRACE printf
|
||||
|
||||
// ...can be set before init_registry() call
|
||||
char* regpathname = NULL;
|
||||
|
||||
static char* localregpathname = NULL;
|
||||
|
||||
typedef struct reg_handle_s
|
||||
{
|
||||
int handle;
|
||||
char* name;
|
||||
struct reg_handle_s* next;
|
||||
struct reg_handle_s* prev;
|
||||
} reg_handle_t;
|
||||
|
||||
struct reg_value
|
||||
{
|
||||
int type;
|
||||
char* name;
|
||||
int len;
|
||||
char* value;
|
||||
};
|
||||
|
||||
static struct reg_value* regs = NULL;
|
||||
static int reg_size;
|
||||
static reg_handle_t* head = NULL;
|
||||
|
||||
#define DIR -25
|
||||
|
||||
static void create_registry(void);
|
||||
static void open_registry(void);
|
||||
static void save_registry(void);
|
||||
static void init_registry(void);
|
||||
|
||||
|
||||
static void create_registry(void){
|
||||
if(regs)
|
||||
{
|
||||
printf("Logic error: create_registry() called with existing registry\n");
|
||||
save_registry();
|
||||
return;
|
||||
}
|
||||
regs=malloc(3*sizeof(struct reg_value));
|
||||
regs[0].type=regs[1].type=DIR;
|
||||
regs[0].name=malloc(5);
|
||||
strcpy(regs[0].name, "HKLM");
|
||||
regs[1].name=malloc(5);
|
||||
strcpy(regs[1].name, "HKCU");
|
||||
regs[0].value=regs[1].value=NULL;
|
||||
regs[0].len=regs[1].len=0;
|
||||
reg_size=2;
|
||||
head = 0;
|
||||
save_registry();
|
||||
}
|
||||
|
||||
static void open_registry(void)
|
||||
{
|
||||
int fd;
|
||||
int i;
|
||||
unsigned int len;
|
||||
if(regs)
|
||||
{
|
||||
printf("Multiple open_registry(>\n");
|
||||
return;
|
||||
}
|
||||
fd = open(localregpathname, O_RDONLY);
|
||||
if (fd == -1)
|
||||
{
|
||||
printf("Creating new registry\n");
|
||||
create_registry();
|
||||
return;
|
||||
}
|
||||
read(fd, ®_size, 4);
|
||||
regs=malloc(reg_size*sizeof(struct reg_value));
|
||||
head = 0;
|
||||
for(i=0; i<reg_size; i++)
|
||||
{
|
||||
read(fd,®s[i].type,4);
|
||||
read(fd,&len,4);
|
||||
regs[i].name=malloc(len+1);
|
||||
if(regs[i].name==0)
|
||||
{
|
||||
reg_size=i+1;
|
||||
goto error;
|
||||
}
|
||||
read(fd, regs[i].name, len);
|
||||
regs[i].name[len]=0;
|
||||
read(fd,®s[i].len,4);
|
||||
regs[i].value=malloc(regs[i].len+1);
|
||||
if(regs[i].value==0)
|
||||
{
|
||||
free(regs[i].name);
|
||||
reg_size=i+1;
|
||||
goto error;
|
||||
}
|
||||
read(fd, regs[i].value, regs[i].len);
|
||||
regs[i].value[regs[i].len]=0;
|
||||
}
|
||||
error:
|
||||
close(fd);
|
||||
return;
|
||||
}
|
||||
|
||||
static void save_registry(void)
|
||||
{
|
||||
int fd, i;
|
||||
if (!regs)
|
||||
init_registry();
|
||||
fd = open(localregpathname, O_WRONLY | O_CREAT, 00666);
|
||||
if (fd == -1)
|
||||
{
|
||||
printf("Failed to open registry file '%s' for writing.\n",
|
||||
localregpathname);
|
||||
return;
|
||||
}
|
||||
write(fd, ®_size, 4);
|
||||
for(i=0; i<reg_size; i++)
|
||||
{
|
||||
unsigned len=strlen(regs[i].name);
|
||||
write(fd, ®s[i].type, 4);
|
||||
write(fd, &len, 4);
|
||||
write(fd, regs[i].name, len);
|
||||
write(fd, ®s[i].len, 4);
|
||||
write(fd, regs[i].value, regs[i].len);
|
||||
}
|
||||
close(fd);
|
||||
}
|
||||
|
||||
void free_registry(void)
|
||||
{
|
||||
reg_handle_t* t = head;
|
||||
while (t)
|
||||
{
|
||||
reg_handle_t* f = t;
|
||||
free(t->name);
|
||||
t=t->prev;
|
||||
free(f);
|
||||
}
|
||||
head = 0;
|
||||
if (regs)
|
||||
{
|
||||
int i;
|
||||
for(i=0; i<reg_size; i++)
|
||||
{
|
||||
free(regs[i].name);
|
||||
free(regs[i].value);
|
||||
}
|
||||
free(regs);
|
||||
regs = 0;
|
||||
}
|
||||
|
||||
if (localregpathname && localregpathname != regpathname)
|
||||
free(localregpathname);
|
||||
localregpathname = 0;
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
static reg_handle_t* find_handle_by_name(const char* name)
|
||||
{
|
||||
reg_handle_t* t;
|
||||
for(t=head; t; t=t->prev)
|
||||
{
|
||||
if(!strcmp(t->name, name))
|
||||
{
|
||||
return t;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
static struct reg_value* find_value_by_name(const char* name)
|
||||
{
|
||||
int i;
|
||||
for(i=0; i<reg_size; i++)
|
||||
if(!strcmp(regs[i].name, name))
|
||||
return regs+i;
|
||||
return 0;
|
||||
}
|
||||
static reg_handle_t* find_handle(int handle)
|
||||
{
|
||||
reg_handle_t* t;
|
||||
for(t=head; t; t=t->prev)
|
||||
{
|
||||
if(t->handle==handle)
|
||||
{
|
||||
return t;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
static int generate_handle(void)
|
||||
{
|
||||
static unsigned int zz=249;
|
||||
zz++;
|
||||
while((zz==HKEY_LOCAL_MACHINE) || (zz==HKEY_CURRENT_USER))
|
||||
zz++;
|
||||
return zz;
|
||||
}
|
||||
|
||||
static reg_handle_t* insert_handle(long handle, const char* name)
|
||||
{
|
||||
reg_handle_t* t;
|
||||
t=malloc(sizeof(reg_handle_t));
|
||||
if(head==0)
|
||||
{
|
||||
t->prev=0;
|
||||
}
|
||||
else
|
||||
{
|
||||
head->next=t;
|
||||
t->prev=head;
|
||||
}
|
||||
t->next=0;
|
||||
t->name=malloc(strlen(name)+1);
|
||||
strcpy(t->name, name);
|
||||
t->handle=handle;
|
||||
head=t;
|
||||
return t;
|
||||
}
|
||||
static char* build_keyname(long key, const char* subkey)
|
||||
{
|
||||
char* full_name;
|
||||
reg_handle_t* t;
|
||||
if((t=find_handle(key))==0)
|
||||
{
|
||||
TRACE("Invalid key\n");
|
||||
return NULL;
|
||||
}
|
||||
if(subkey==NULL)
|
||||
subkey="<default>";
|
||||
full_name=malloc(strlen(t->name)+strlen(subkey)+10);
|
||||
strcpy(full_name, t->name);
|
||||
strcat(full_name, "\\");
|
||||
strcat(full_name, subkey);
|
||||
return full_name;
|
||||
}
|
||||
static struct reg_value* insert_reg_value(int handle, const char* name, int type, const void* value, int len)
|
||||
{
|
||||
struct reg_value* v;
|
||||
char* fullname;
|
||||
if((fullname=build_keyname(handle, name))==NULL)
|
||||
{
|
||||
TRACE("Invalid handle\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if((v=find_value_by_name(fullname))==0)
|
||||
//creating new value in registry
|
||||
{
|
||||
if(regs==0)
|
||||
create_registry();
|
||||
regs = realloc(regs, sizeof(struct reg_value) * (reg_size +1 ));
|
||||
//regs=(struct reg_value*)my_realloc(regs, sizeof(struct reg_value)*(reg_size+1));
|
||||
v=regs+reg_size;
|
||||
reg_size++;
|
||||
}
|
||||
else
|
||||
//replacing old one
|
||||
{
|
||||
free(v->value);
|
||||
free(v->name);
|
||||
}
|
||||
TRACE("RegInsert '%s' %p v:%d len:%d\n", name, value, *(int*)value, len);
|
||||
v->type=type;
|
||||
v->len=len;
|
||||
v->value=malloc(len);
|
||||
memcpy(v->value, value, len);
|
||||
v->name=malloc(strlen(fullname)+1);
|
||||
strcpy(v->name, fullname);
|
||||
free(fullname);
|
||||
save_registry();
|
||||
return v;
|
||||
}
|
||||
|
||||
static void init_registry(void)
|
||||
{
|
||||
TRACE("Initializing registry\n");
|
||||
// can't be free-ed - it's static and probably thread
|
||||
// unsafe structure which is stored in glibc
|
||||
|
||||
regpathname = get_path("registry");
|
||||
localregpathname = regpathname;
|
||||
|
||||
open_registry();
|
||||
insert_handle(HKEY_LOCAL_MACHINE, "HKLM");
|
||||
insert_handle(HKEY_CURRENT_USER, "HKCU");
|
||||
}
|
||||
|
||||
#if 0
|
||||
static reg_handle_t* find_handle_2(long key, const char* subkey)
|
||||
{
|
||||
char* full_name;
|
||||
reg_handle_t* t;
|
||||
if((t=find_handle(key))==0)
|
||||
{
|
||||
TRACE("Invalid key\n");
|
||||
return (reg_handle_t*)-1;
|
||||
}
|
||||
if(subkey==NULL)
|
||||
return t;
|
||||
full_name=malloc(strlen(t->name)+strlen(subkey)+10);
|
||||
strcpy(full_name, t->name);
|
||||
strcat(full_name, "\\");
|
||||
strcat(full_name, subkey);
|
||||
t=find_handle_by_name(full_name);
|
||||
free(full_name);
|
||||
return t;
|
||||
}
|
||||
#endif
|
||||
|
||||
long __stdcall RegOpenKeyExA(long key, const char* subkey, long reserved, long access, int* newkey)
|
||||
{
|
||||
char* full_name;
|
||||
reg_handle_t* t;
|
||||
TRACE("Opening key %s\n", subkey);
|
||||
|
||||
if(!regs)
|
||||
init_registry()
|
||||
;
|
||||
/* t=find_handle_2(key, subkey);
|
||||
|
||||
if(t==0)
|
||||
return -1;
|
||||
|
||||
if(t==(reg_handle_t*)-1)
|
||||
return -1;
|
||||
*/
|
||||
full_name=build_keyname(key, subkey);
|
||||
if(!full_name)
|
||||
return -1;
|
||||
TRACE("Opening key Fullname %s\n", full_name);
|
||||
find_value_by_name(full_name);
|
||||
|
||||
t=insert_handle(generate_handle(), full_name);
|
||||
*newkey=t->handle;
|
||||
free(full_name);
|
||||
|
||||
return 0;
|
||||
}
|
||||
long __stdcall RegCloseKey(long key)
|
||||
{
|
||||
reg_handle_t *handle;
|
||||
if(key==(long)HKEY_LOCAL_MACHINE)
|
||||
return 0;
|
||||
if(key==(long)HKEY_CURRENT_USER)
|
||||
return 0;
|
||||
handle=find_handle(key);
|
||||
if(handle==0)
|
||||
return 0;
|
||||
if(handle->prev)
|
||||
handle->prev->next=handle->next;
|
||||
if(handle->next)
|
||||
handle->next->prev=handle->prev;
|
||||
free(handle->name);
|
||||
if(handle==head)
|
||||
head=head->prev;
|
||||
free(handle);
|
||||
return 0;
|
||||
}
|
||||
|
||||
long __stdcall RegQueryValueExA(long key, const char* value, int* reserved, int* type, int* data, int* count)
|
||||
{
|
||||
struct reg_value* t;
|
||||
char* c;
|
||||
TRACE("Querying value %s\n", value);
|
||||
if(!regs)
|
||||
init_registry();
|
||||
|
||||
c=build_keyname(key, value);
|
||||
if (!c)
|
||||
return 1;
|
||||
t=find_value_by_name(c);
|
||||
if (t==0) {
|
||||
// Hacks for CineForm.
|
||||
if (strcmp(c, "HKCU\\SOFTWARE\\CineForm\\DecoderProperties\\Resolution") == 0) {
|
||||
if (data)
|
||||
*data = 1000;
|
||||
if (type)
|
||||
*type = REG_DWORD;
|
||||
if (count)
|
||||
*count = sizeof(DWORD);
|
||||
free(c);
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
if (strcmp(c, "HKCU\\SOFTWARE\\CineForm\\DecoderProperties\\PixelFormats") == 0) {
|
||||
if (data)
|
||||
*data = 0xffff;
|
||||
if (type)
|
||||
*type = REG_DWORD;
|
||||
if (count)
|
||||
*count = sizeof(DWORD);
|
||||
free(c);
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
free(c);
|
||||
return ERROR_FILE_NOT_FOUND;
|
||||
}
|
||||
free(c);
|
||||
if (type)
|
||||
*type=t->type;
|
||||
if (data)
|
||||
{
|
||||
memcpy(data, t->value, (t->len<*count)?t->len:*count);
|
||||
TRACE("returning %d bytes: %d\n", t->len, *(int*)data);
|
||||
}
|
||||
if(*count<t->len)
|
||||
{
|
||||
*count=t->len;
|
||||
return ERROR_MORE_DATA;
|
||||
}
|
||||
else
|
||||
{
|
||||
*count=t->len;
|
||||
}
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
long __stdcall RegCreateKeyExA(long key, const char* name, long reserved,
|
||||
void* classs, long options, long security,
|
||||
void* sec_attr, int* newkey, int* status)
|
||||
{
|
||||
reg_handle_t* t;
|
||||
char* fullname;
|
||||
struct reg_value* v;
|
||||
// TRACE("Creating/Opening key %s\n", name);
|
||||
if(!regs)
|
||||
init_registry();
|
||||
|
||||
fullname=build_keyname(key, name);
|
||||
if (!fullname)
|
||||
return 1;
|
||||
TRACE("Creating/Opening key %s\n", fullname);
|
||||
v=find_value_by_name(fullname);
|
||||
if(v==0)
|
||||
{
|
||||
int qw=45708;
|
||||
v=insert_reg_value(key, name, DIR, &qw, 4);
|
||||
if (status) *status=REG_CREATED_NEW_KEY;
|
||||
// return 0;
|
||||
}
|
||||
|
||||
t=insert_handle(generate_handle(), fullname);
|
||||
*newkey=t->handle;
|
||||
free(fullname);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
LONG RegEnumValue(
|
||||
HKEY hKey, // handle to key to query
|
||||
DWORD dwIndex, // index of value to query
|
||||
LPTSTR lpValueName, // address of buffer for value string
|
||||
LPDWORD lpcbValueName, // address for size of value buffer
|
||||
LPDWORD lpReserved, // reserved
|
||||
LPDWORD lpType, // address of buffer for type code
|
||||
LPBYTE lpData, // address of buffer for value data
|
||||
LPDWORD lpcbData // address for size of data buffer
|
||||
);
|
||||
*/
|
||||
|
||||
long __stdcall RegEnumValueA(HKEY hkey, DWORD index, LPSTR value, LPDWORD val_count,
|
||||
LPDWORD reserved, LPDWORD type, LPBYTE data, LPDWORD count)
|
||||
{
|
||||
// currenly just made to support MSZH & ZLIB
|
||||
//printf("Reg Enum 0x%x %d %s %d data: %p %d %d >%s<\n", hkey, index,
|
||||
// value, *val_count, data, *count, reg_size, data);
|
||||
reg_handle_t* t = find_handle(hkey);
|
||||
if (t && index < 10)
|
||||
{
|
||||
struct reg_value* v=find_value_by_name(t->name);
|
||||
if (v)
|
||||
{
|
||||
memcpy(data, v->value, (v->len < *count) ? v->len : *count);
|
||||
if(*count < v->len)
|
||||
*count = v->len;
|
||||
if (type)
|
||||
*type = v->type;
|
||||
//printf("Found handle %s\n", v->name);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return ERROR_NO_MORE_ITEMS;
|
||||
}
|
||||
|
||||
long __stdcall RegSetValueExA(long key, const char* name, long v1, long v2, const void* data, long size)
|
||||
{
|
||||
char* c;
|
||||
TRACE("Request to set value %s %d\n", name, *(const int*)data);
|
||||
if(!regs)
|
||||
init_registry();
|
||||
|
||||
c=build_keyname(key, name);
|
||||
if(c==NULL)
|
||||
return 1;
|
||||
insert_reg_value(key, name, v2, data, size);
|
||||
free(c);
|
||||
return 0;
|
||||
}
|
||||
|
||||
long __stdcall RegEnumKeyExA(HKEY hKey, DWORD dwIndex, LPSTR lpName, LPDWORD lpcbName,
|
||||
LPDWORD lpReserved, LPSTR lpClass, LPDWORD lpcbClass,
|
||||
LPFILETIME lpftLastWriteTime)
|
||||
{
|
||||
return ERROR_NO_MORE_ITEMS;
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
#ifndef MPLAYER_REGISTRY_H
|
||||
#define MPLAYER_REGISTRY_H
|
||||
|
||||
/********************************************************
|
||||
*
|
||||
* Declaration of registry access functions
|
||||
* Copyright 2000 Eugene Kuznetsov (divx@euro.ru)
|
||||
*
|
||||
********************************************************/
|
||||
|
||||
/*
|
||||
* Modified for use with MPlayer, detailed changelog at
|
||||
* http://svn.mplayerhq.hu/mplayer/trunk/
|
||||
*/
|
||||
|
||||
#include "wine/winbase.h"
|
||||
|
||||
void free_registry(void);
|
||||
|
||||
long __stdcall RegOpenKeyExA(long key, const char* subkey, long reserved,
|
||||
long access, int* newkey);
|
||||
long __stdcall RegCloseKey(long key);
|
||||
long __stdcall RegQueryValueExA(long key, const char* value, int* reserved,
|
||||
int* type, int* data, int* count);
|
||||
long __stdcall RegCreateKeyExA(long key, const char* name, long reserved,
|
||||
void* classs, long options, long security,
|
||||
void* sec_attr, int* newkey, int* status);
|
||||
long __stdcall RegSetValueExA(long key, const char* name, long v1, long v2,
|
||||
const void* data, long size);
|
||||
|
||||
#ifdef MPLAYER_WINERROR_H
|
||||
|
||||
long __stdcall RegEnumKeyExA(HKEY hKey, DWORD dwIndex, LPSTR lpName, LPDWORD lpcbName,
|
||||
LPDWORD lpReserved, LPSTR lpClass, LPDWORD lpcbClass,
|
||||
LPFILETIME lpftLastWriteTime);
|
||||
long __stdcall RegEnumValueA(HKEY hkey, DWORD index, LPSTR value, LPDWORD val_count,
|
||||
LPDWORD reserved, LPDWORD type, LPBYTE data, LPDWORD count);
|
||||
#endif
|
||||
|
||||
#endif /* MPLAYER_REGISTRY_H */
|
||||
@@ -1,487 +0,0 @@
|
||||
/*
|
||||
* Resources
|
||||
*
|
||||
* Copyright 1993 Robert J. Amstadt
|
||||
* Copyright 1995 Alexandre Julliard
|
||||
*
|
||||
* Modified for use with MPlayer, detailed changelog at
|
||||
* http://svn.mplayerhq.hu/mplayer/trunk/
|
||||
*
|
||||
*/
|
||||
#include "config.h"
|
||||
#include "debug.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "wine/winbase.h"
|
||||
#include "wine/windef.h"
|
||||
#include "wine/winuser.h"
|
||||
#include "wine/heap.h"
|
||||
#include "wine/module.h"
|
||||
#include "wine/debugtools.h"
|
||||
#include "wine/winerror.h"
|
||||
#include "loader.h"
|
||||
|
||||
#define CP_ACP 0
|
||||
|
||||
WORD WINE_LanguageId=0x409;//english
|
||||
|
||||
#define HRSRC_MAP_BLOCKSIZE 16
|
||||
|
||||
typedef struct HRSRC_ELEM
|
||||
{
|
||||
HANDLE hRsrc;
|
||||
WORD type;
|
||||
} HRSRC_ELEM;
|
||||
|
||||
typedef struct HRSRC_MAP
|
||||
{
|
||||
int nAlloc;
|
||||
int nUsed;
|
||||
HRSRC_ELEM *elem;
|
||||
} HRSRC_MAP;
|
||||
|
||||
static HRSRC RES_FindResource2( HMODULE hModule, LPCSTR type,
|
||||
LPCSTR name, WORD lang, int unicode)
|
||||
{
|
||||
HRSRC hRsrc = 0;
|
||||
LPWSTR typeStr, nameStr;
|
||||
WINE_MODREF *wm = MODULE32_LookupHMODULE( hModule );
|
||||
|
||||
if(!wm)
|
||||
return 0;
|
||||
/* 32-bit PE module */
|
||||
|
||||
|
||||
if ( HIWORD( type ) && (!unicode))
|
||||
typeStr = HEAP_strdupAtoW( GetProcessHeap(), 0, type );
|
||||
else
|
||||
typeStr = (LPWSTR)type;
|
||||
if ( HIWORD( name ) && (!unicode))
|
||||
nameStr = HEAP_strdupAtoW( GetProcessHeap(), 0, name );
|
||||
else
|
||||
nameStr = (LPWSTR)name;
|
||||
|
||||
hRsrc = PE_FindResourceExW( wm, nameStr, typeStr, lang );
|
||||
|
||||
if ( HIWORD( type ) && (!unicode))
|
||||
HeapFree( GetProcessHeap(), 0, typeStr );
|
||||
if ( HIWORD( name ) && (!unicode))
|
||||
HeapFree( GetProcessHeap(), 0, nameStr );
|
||||
|
||||
return hRsrc;
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* RES_FindResource
|
||||
*/
|
||||
|
||||
static HRSRC RES_FindResource( HMODULE hModule, LPCSTR type,
|
||||
LPCSTR name, WORD lang, int unicode )
|
||||
{
|
||||
HRSRC hRsrc;
|
||||
// __TRY
|
||||
// {
|
||||
hRsrc = RES_FindResource2(hModule, type, name, lang, unicode);
|
||||
// }
|
||||
// __EXCEPT(page_fault)
|
||||
// {
|
||||
// WARN("page fault\n");
|
||||
// SetLastError(ERROR_INVALID_PARAMETER);
|
||||
// return 0;
|
||||
// }
|
||||
// __ENDTRY
|
||||
return hRsrc;
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* RES_SizeofResource
|
||||
*/
|
||||
static DWORD RES_SizeofResource( HMODULE hModule, HRSRC hRsrc)
|
||||
{
|
||||
DWORD size = 0;
|
||||
// HRSRC hRsrc32;
|
||||
|
||||
// HMODULE16 hMod16 = MapHModuleLS( hModule );
|
||||
// NE_MODULE *pModule = NE_GetPtr( hMod16 );
|
||||
// WINE_MODREF *wm = pModule && pModule->module32?
|
||||
// MODULE32_LookupHMODULE( pModule->module32 ) : NULL;
|
||||
// WINE_MODREF *wm = MODULE32_LookupHMODULE( hModule );
|
||||
|
||||
if ( !hModule || !hRsrc ) return 0;
|
||||
|
||||
/* 32-bit PE module */
|
||||
/* If we got a 16-bit hRsrc, convert it */
|
||||
// hRsrc32 = HIWORD(hRsrc)? hRsrc : MapHRsrc16To32( pModule, hRsrc );
|
||||
if(!HIWORD(hRsrc))
|
||||
{
|
||||
printf("16-bit hRsrcs not supported\n");
|
||||
return 0;
|
||||
}
|
||||
size = PE_SizeofResource( hModule, hRsrc );
|
||||
return size;
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* RES_AccessResource
|
||||
*/
|
||||
static HFILE RES_AccessResource( HMODULE hModule, HRSRC hRsrc )
|
||||
{
|
||||
HFILE hFile = HFILE_ERROR;
|
||||
|
||||
// WINE_MODREF *wm = MODULE32_LookupHMODULE( hModule );
|
||||
|
||||
if ( !hModule || !hRsrc ) return HFILE_ERROR;
|
||||
|
||||
/* 32-bit PE module */
|
||||
FIXME("32-bit modules not yet supported.\n" );
|
||||
hFile = HFILE_ERROR;
|
||||
|
||||
return hFile;
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* RES_LoadResource
|
||||
*/
|
||||
static HGLOBAL RES_LoadResource( HMODULE hModule, HRSRC hRsrc)
|
||||
{
|
||||
HGLOBAL hMem = 0;
|
||||
// HRSRC hRsrc32;
|
||||
WINE_MODREF *wm = MODULE32_LookupHMODULE( hModule );
|
||||
|
||||
|
||||
if ( !hModule || !hRsrc ) return 0;
|
||||
|
||||
/* 32-bit PE module */
|
||||
|
||||
/* If we got a 16-bit hRsrc, convert it */
|
||||
// hRsrc32 = HIWORD(hRsrc)? hRsrc : MapHRsrc16To32( pModule, hRsrc );
|
||||
if(!HIWORD(hRsrc))
|
||||
{
|
||||
printf("16-bit hRsrcs not supported\n");
|
||||
return 0;
|
||||
}
|
||||
hMem = PE_LoadResource( wm, hRsrc );
|
||||
|
||||
return hMem;
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* RES_LockResource
|
||||
*/
|
||||
static LPVOID RES_LockResource( HGLOBAL handle )
|
||||
{
|
||||
LPVOID bits = NULL;
|
||||
|
||||
TRACE("(%08x, %s)\n", handle, "PE" );
|
||||
|
||||
bits = (LPVOID)handle;
|
||||
|
||||
return bits;
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* RES_FreeResource
|
||||
*/
|
||||
static WIN_BOOL RES_FreeResource( HGLOBAL handle )
|
||||
{
|
||||
HGLOBAL retv = handle;
|
||||
return (WIN_BOOL)retv;
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* FindResourceA (KERNEL32.128)
|
||||
*/
|
||||
HANDLE WINAPI FindResourceA( HMODULE hModule, LPCSTR name, LPCSTR type )
|
||||
{
|
||||
return RES_FindResource( hModule, type, name,
|
||||
WINE_LanguageId, 0);
|
||||
}
|
||||
HANDLE WINAPI FindResourceW( HMODULE hModule, LPCWSTR name, LPCWSTR type )
|
||||
{
|
||||
return RES_FindResource( hModule, (LPCSTR)type, (LPCSTR)name,
|
||||
WINE_LanguageId, 1);
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* FindResourceExA (KERNEL32.129)
|
||||
*/
|
||||
HANDLE WINAPI FindResourceExA( HMODULE hModule,
|
||||
LPCSTR type, LPCSTR name, WORD lang )
|
||||
{
|
||||
return RES_FindResource( hModule, type, name,
|
||||
lang, 0 );
|
||||
}
|
||||
|
||||
HANDLE WINAPI FindResourceExW( HMODULE hModule,
|
||||
LPCWSTR type, LPCWSTR name, WORD lang )
|
||||
{
|
||||
return RES_FindResource( hModule, (LPCSTR)type, (LPCSTR)name,
|
||||
lang, 1 );
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* LockResource (KERNEL32.384)
|
||||
*/
|
||||
LPVOID WINAPI LockResource( HGLOBAL handle )
|
||||
{
|
||||
return RES_LockResource( handle );
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* FreeResource (KERNEL32.145)
|
||||
*/
|
||||
WIN_BOOL WINAPI FreeResource( HGLOBAL handle )
|
||||
{
|
||||
return RES_FreeResource( handle );
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* AccessResource (KERNEL32.64)
|
||||
*/
|
||||
INT WINAPI AccessResource( HMODULE hModule, HRSRC hRsrc )
|
||||
{
|
||||
return RES_AccessResource( hModule, hRsrc );
|
||||
}
|
||||
/**********************************************************************
|
||||
* SizeofResource (KERNEL32.522)
|
||||
*/
|
||||
DWORD WINAPI SizeofResource( HINSTANCE hModule, HRSRC hRsrc )
|
||||
{
|
||||
return RES_SizeofResource( hModule, hRsrc );
|
||||
}
|
||||
|
||||
|
||||
INT WINAPI LoadStringW( HINSTANCE instance, UINT resource_id,
|
||||
LPWSTR buffer, INT buflen );
|
||||
|
||||
/**********************************************************************
|
||||
* LoadStringA (USER32.375)
|
||||
*/
|
||||
INT WINAPI LoadStringA( HINSTANCE instance, UINT resource_id,
|
||||
LPSTR buffer, INT buflen )
|
||||
{
|
||||
INT retval;
|
||||
INT wbuflen;
|
||||
INT abuflen;
|
||||
LPWSTR wbuf = NULL;
|
||||
LPSTR abuf = NULL;
|
||||
|
||||
if ( buffer != NULL && buflen > 0 )
|
||||
*buffer = 0;
|
||||
|
||||
wbuflen = LoadStringW(instance,resource_id,NULL,0);
|
||||
if ( !wbuflen )
|
||||
return 0;
|
||||
wbuflen ++;
|
||||
|
||||
retval = 0;
|
||||
wbuf = (LPWSTR) HeapAlloc( GetProcessHeap(), 0, wbuflen * sizeof(WCHAR) );
|
||||
wbuflen = LoadStringW(instance,resource_id,wbuf,wbuflen);
|
||||
if ( wbuflen > 0 )
|
||||
{
|
||||
abuflen = WideCharToMultiByte(CP_ACP,0,wbuf,wbuflen,NULL,0,NULL,NULL);
|
||||
if ( abuflen > 0 )
|
||||
{
|
||||
if ( buffer == NULL || buflen == 0 )
|
||||
retval = abuflen;
|
||||
else
|
||||
{
|
||||
abuf = (LPSTR) HeapAlloc( GetProcessHeap(), 0, abuflen * sizeof(CHAR) );
|
||||
abuflen = WideCharToMultiByte(CP_ACP,0,wbuf,wbuflen,abuf,abuflen,NULL,NULL);
|
||||
if ( abuflen > 0 )
|
||||
{
|
||||
abuflen = min(abuflen,buflen - 1);
|
||||
memcpy( buffer, abuf, abuflen );
|
||||
buffer[abuflen] = 0;
|
||||
retval = abuflen;
|
||||
}
|
||||
HeapFree( GetProcessHeap(), 0, abuf );
|
||||
}
|
||||
}
|
||||
}
|
||||
HeapFree( GetProcessHeap(), 0, wbuf );
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* LoadStringW (USER32.376)
|
||||
*/
|
||||
INT WINAPI LoadStringW( HINSTANCE instance, UINT resource_id,
|
||||
LPWSTR buffer, INT buflen )
|
||||
{
|
||||
HGLOBAL hmem;
|
||||
HRSRC hrsrc;
|
||||
WCHAR *p;
|
||||
int string_num;
|
||||
int i;
|
||||
|
||||
if (HIWORD(resource_id)==0xFFFF) /* netscape 3 passes this */
|
||||
resource_id = (UINT)(-((INT)resource_id));
|
||||
TRACE("instance = %04x, id = %04x, buffer = %08x, "
|
||||
"length = %d\n", instance, (int)resource_id, (int) buffer, buflen);
|
||||
|
||||
/* Use bits 4 - 19 (incremented by 1) as resourceid, mask out
|
||||
* 20 - 31. */
|
||||
hrsrc = FindResourceW( instance, (LPCWSTR)(((resource_id>>4)&0xffff)+1),
|
||||
RT_STRINGW );
|
||||
if (!hrsrc) return 0;
|
||||
hmem = LoadResource( instance, hrsrc );
|
||||
if (!hmem) return 0;
|
||||
|
||||
p = (WCHAR*) LockResource(hmem);
|
||||
string_num = resource_id & 0x000f;
|
||||
for (i = 0; i < string_num; i++)
|
||||
p += *p + 1;
|
||||
|
||||
TRACE("strlen = %d\n", (int)*p );
|
||||
|
||||
if (buffer == NULL) return *p;
|
||||
i = min(buflen - 1, *p);
|
||||
if (i > 0) {
|
||||
memcpy(buffer, p + 1, i * sizeof (WCHAR));
|
||||
buffer[i] = (WCHAR) 0;
|
||||
} else {
|
||||
if (buflen > 1) {
|
||||
buffer[0] = (WCHAR) 0;
|
||||
return 0;
|
||||
}
|
||||
#if 0
|
||||
WARN("Don't know why caller give buflen=%d *p=%d trying to obtain string '%s'\n", buflen, *p, p + 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
TRACE("String loaded !\n");
|
||||
return i;
|
||||
}
|
||||
|
||||
/* Messages...used by FormatMessage32* (KERNEL32.something)
|
||||
*
|
||||
* They can be specified either directly or using a message ID and
|
||||
* loading them from the resource.
|
||||
*
|
||||
* The resourcedata has following format:
|
||||
* start:
|
||||
* 0: DWORD nrofentries
|
||||
* nrofentries * subentry:
|
||||
* 0: DWORD firstentry
|
||||
* 4: DWORD lastentry
|
||||
* 8: DWORD offset from start to the stringentries
|
||||
*
|
||||
* (lastentry-firstentry) * stringentry:
|
||||
* 0: WORD len (0 marks end)
|
||||
* 2: WORD flags
|
||||
* 4: CHAR[len-4]
|
||||
* (stringentry i of a subentry refers to the ID 'firstentry+i')
|
||||
*
|
||||
* Yes, ANSI strings in win32 resources. Go figure.
|
||||
*/
|
||||
|
||||
/**********************************************************************
|
||||
* LoadMessageA (internal)
|
||||
*/
|
||||
INT WINAPI LoadMessageA( HMODULE instance, UINT id, WORD lang,
|
||||
LPSTR buffer, INT buflen )
|
||||
{
|
||||
HGLOBAL hmem;
|
||||
HRSRC hrsrc;
|
||||
PMESSAGE_RESOURCE_DATA mrd;
|
||||
PMESSAGE_RESOURCE_BLOCK mrb;
|
||||
PMESSAGE_RESOURCE_ENTRY mre;
|
||||
int i,slen;
|
||||
|
||||
TRACE("instance = %08lx, id = %08lx, buffer = %p, length = %ld\n", (DWORD)instance, (DWORD)id, buffer, (DWORD)buflen);
|
||||
|
||||
/*FIXME: I am not sure about the '1' ... But I've only seen those entries*/
|
||||
hrsrc = FindResourceExW(instance,RT_MESSAGELISTW,(LPWSTR)1,lang);
|
||||
if (!hrsrc) return 0;
|
||||
hmem = LoadResource( instance, hrsrc );
|
||||
if (!hmem) return 0;
|
||||
|
||||
mrd = (PMESSAGE_RESOURCE_DATA)LockResource(hmem);
|
||||
mre = NULL;
|
||||
mrb = &(mrd->Blocks[0]);
|
||||
for (i=mrd->NumberOfBlocks;i--;) {
|
||||
if ((id>=mrb->LowId) && (id<=mrb->HighId)) {
|
||||
mre = (PMESSAGE_RESOURCE_ENTRY)(((char*)mrd)+mrb->OffsetToEntries);
|
||||
id -= mrb->LowId;
|
||||
break;
|
||||
}
|
||||
mrb++;
|
||||
}
|
||||
if (!mre)
|
||||
return 0;
|
||||
for (i=id;i--;) {
|
||||
if (!mre->Length)
|
||||
return 0;
|
||||
mre = (PMESSAGE_RESOURCE_ENTRY)(((char*)mre)+(mre->Length));
|
||||
}
|
||||
slen=mre->Length;
|
||||
TRACE(" - strlen=%d\n",slen);
|
||||
i = min(buflen - 1, slen);
|
||||
if (buffer == NULL)
|
||||
return slen;
|
||||
if (i>0) {
|
||||
lstrcpynA(buffer,(char*)mre->Text,i);
|
||||
buffer[i]=0;
|
||||
} else {
|
||||
if (buflen>1) {
|
||||
buffer[0]=0;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
if (buffer)
|
||||
TRACE("'%s' copied !\n", buffer);
|
||||
return i;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* EnumResourceTypesA (KERNEL32.90)
|
||||
*/
|
||||
WIN_BOOL WINAPI EnumResourceTypesA( HMODULE hmodule,ENUMRESTYPEPROCA lpfun,
|
||||
LONG lParam)
|
||||
{
|
||||
/* FIXME: move WINE_MODREF stuff here */
|
||||
return PE_EnumResourceTypesA(hmodule,lpfun,lParam);
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* EnumResourceNamesA (KERNEL32.88)
|
||||
*/
|
||||
WIN_BOOL WINAPI EnumResourceNamesA( HMODULE hmodule, LPCSTR type,
|
||||
ENUMRESNAMEPROCA lpfun, LONG lParam )
|
||||
{
|
||||
/* FIXME: move WINE_MODREF stuff here */
|
||||
return PE_EnumResourceNamesA(hmodule,type,lpfun,lParam);
|
||||
}
|
||||
/**********************************************************************
|
||||
* EnumResourceLanguagesA (KERNEL32.86)
|
||||
*/
|
||||
WIN_BOOL WINAPI EnumResourceLanguagesA( HMODULE hmodule, LPCSTR type,
|
||||
LPCSTR name, ENUMRESLANGPROCA lpfun,
|
||||
LONG lParam)
|
||||
{
|
||||
/* FIXME: move WINE_MODREF stuff here */
|
||||
return PE_EnumResourceLanguagesA(hmodule,type,name,lpfun,lParam);
|
||||
}
|
||||
/**********************************************************************
|
||||
* LoadResource (KERNEL32.370)
|
||||
*/
|
||||
HGLOBAL WINAPI LoadResource( HINSTANCE hModule, HRSRC hRsrc )
|
||||
{
|
||||
return RES_LoadResource( hModule, hRsrc);
|
||||
}
|
||||
-228
@@ -1,228 +0,0 @@
|
||||
/*
|
||||
* Copyright 1998 Marcus Meissner
|
||||
*
|
||||
* Modified for use with MPlayer, detailed changelog at
|
||||
* http://svn.mplayerhq.hu/mplayer/trunk/
|
||||
*
|
||||
*/
|
||||
#include <config.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "win32.h"
|
||||
#include "loader.h"
|
||||
|
||||
#include "wine/winbase.h"
|
||||
#include "wine/windef.h"
|
||||
#include "wine/winuser.h"
|
||||
#include "wine/vfw.h"
|
||||
#include "wine/winestring.h"
|
||||
#include "wine/driver.h"
|
||||
#include "wine/avifmt.h"
|
||||
#include "drv.h"
|
||||
|
||||
#define OpenDriverA DrvOpen
|
||||
#define CloseDriver DrvClose
|
||||
|
||||
/***********************************************************************
|
||||
* VideoForWindowsVersion [MSVFW.2][MSVIDEO.2]
|
||||
* Returns the version in major.minor form.
|
||||
* In Windows95 this returns 0x040003b6 (4.950)
|
||||
*/
|
||||
long VFWAPI VideoForWindowsVersion(void) {
|
||||
return 0x040003B6; /* 4.950 */
|
||||
}
|
||||
|
||||
/* system.ini: [drivers] */
|
||||
|
||||
/***********************************************************************
|
||||
* ICInfo [MSVFW.33]
|
||||
* Get information about an installable compressor. Return TRUE if there
|
||||
* is one.
|
||||
*/
|
||||
int VFWAPI
|
||||
ICInfo(
|
||||
long fccType, /* [in] type of compressor ('vidc') */
|
||||
long fccHandler, /* [in] <n>th compressor */
|
||||
ICINFO *lpicinfo /* [out] information about compressor */
|
||||
) {
|
||||
/* does OpenDriver/CloseDriver */
|
||||
lpicinfo->dwSize = sizeof(ICINFO);
|
||||
lpicinfo->fccType = fccType;
|
||||
lpicinfo->dwFlags = 0;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* ICOpen [MSVFW.37]
|
||||
* Opens an installable compressor. Return special handle.
|
||||
*/
|
||||
HIC VFWAPI
|
||||
//ICOpen(long fccType,long fccHandler,unsigned int wMode) {
|
||||
ICOpen(long filename,long fccHandler,unsigned int wMode) {
|
||||
ICOPEN icopen;
|
||||
HDRVR hdrv;
|
||||
WINE_HIC *whic;
|
||||
|
||||
/* Well, lParam2 is in fact a LPVIDEO_OPEN_PARMS, but it has the
|
||||
* same layout as ICOPEN
|
||||
*/
|
||||
icopen.fccType = 0x63646976; // "vidc" //fccType;
|
||||
icopen.fccHandler = fccHandler;
|
||||
icopen.dwSize = sizeof(ICOPEN);
|
||||
icopen.dwFlags = wMode;
|
||||
icopen.pV1Reserved = (void*)filename;
|
||||
/* FIXME: do we need to fill out the rest too? */
|
||||
hdrv=OpenDriverA((long)&icopen);
|
||||
if (!hdrv) return 0;
|
||||
whic = malloc(sizeof(WINE_HIC));
|
||||
whic->hdrv = hdrv;
|
||||
whic->driverproc= ((DRVR*)hdrv)->DriverProc;
|
||||
// whic->private = ICSendMessage((HIC)whic,DRV_OPEN,0,(long)&icopen);
|
||||
whic->driverid = ((DRVR*)hdrv)->dwDriverID;
|
||||
return (HIC)whic;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* ICGetInfo [MSVFW.30]
|
||||
*/
|
||||
LRESULT VFWAPI
|
||||
ICGetInfo(HIC hic,ICINFO *picinfo,long cb) {
|
||||
LRESULT ret;
|
||||
|
||||
ret = ICSendMessage(hic,ICM_GETINFO,(long)picinfo,cb);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* ICCompress [MSVFW.23]
|
||||
*/
|
||||
long VFWAPIV
|
||||
ICCompress(
|
||||
HIC hic,long dwFlags,LPBITMAPINFOHEADER lpbiOutput,void* lpData,
|
||||
LPBITMAPINFOHEADER lpbiInput,void* lpBits,long* lpckid,
|
||||
long* lpdwFlags,long lFrameNum,long dwFrameSize,long dwQuality,
|
||||
LPBITMAPINFOHEADER lpbiPrev,void* lpPrev
|
||||
) {
|
||||
ICCOMPRESS iccmp;
|
||||
|
||||
iccmp.dwFlags = dwFlags;
|
||||
|
||||
iccmp.lpbiOutput = lpbiOutput;
|
||||
iccmp.lpOutput = lpData;
|
||||
iccmp.lpbiInput = lpbiInput;
|
||||
iccmp.lpInput = lpBits;
|
||||
|
||||
iccmp.lpckid = lpckid;
|
||||
iccmp.lpdwFlags = lpdwFlags;
|
||||
iccmp.lFrameNum = lFrameNum;
|
||||
iccmp.dwFrameSize = dwFrameSize;
|
||||
iccmp.dwQuality = dwQuality;
|
||||
iccmp.lpbiPrev = lpbiPrev;
|
||||
iccmp.lpPrev = lpPrev;
|
||||
return ICSendMessage(hic,ICM_COMPRESS,(long)&iccmp,sizeof(iccmp));
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* ICDecompress [MSVFW.26]
|
||||
*/
|
||||
long VFWAPIV
|
||||
ICDecompress(HIC hic,long dwFlags,LPBITMAPINFOHEADER lpbiFormat,void* lpData,LPBITMAPINFOHEADER lpbi,void* lpBits) {
|
||||
ICDECOMPRESS icd;
|
||||
int result;
|
||||
icd.dwFlags = dwFlags;
|
||||
icd.lpbiInput = lpbiFormat;
|
||||
icd.lpInput = lpData;
|
||||
|
||||
icd.lpbiOutput = lpbi;
|
||||
icd.lpOutput = lpBits;
|
||||
icd.ckid = 0;
|
||||
result=ICSendMessage(hic,ICM_DECOMPRESS,(long)&icd,sizeof(icd));
|
||||
return result;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* ICDecompressEx [MSVFW.26]
|
||||
*/
|
||||
long VFWAPIV
|
||||
ICDecompressEx(HIC hic,long dwFlags,LPBITMAPINFOHEADER lpbiFormat,void* lpData,LPBITMAPINFOHEADER lpbi,void* lpBits) {
|
||||
ICDECOMPRESSEX icd;
|
||||
int result;
|
||||
|
||||
icd.dwFlags = dwFlags;
|
||||
|
||||
icd.lpbiSrc = lpbiFormat;
|
||||
icd.lpSrc = lpData;
|
||||
|
||||
icd.lpbiDst = lpbi;
|
||||
icd.lpDst = lpBits;
|
||||
|
||||
icd.xSrc=icd.ySrc=0;
|
||||
icd.dxSrc=lpbiFormat->biWidth;
|
||||
icd.dySrc=abs(lpbiFormat->biHeight);
|
||||
|
||||
icd.xDst=icd.yDst=0;
|
||||
icd.dxDst=lpbi->biWidth;
|
||||
icd.dyDst=abs(lpbi->biHeight);
|
||||
|
||||
//icd.ckid = 0;
|
||||
result=ICSendMessage(hic,ICM_DECOMPRESSEX,(long)&icd,sizeof(icd));
|
||||
return result;
|
||||
}
|
||||
|
||||
long VFWAPIV
|
||||
ICUniversalEx(HIC hic,int command,LPBITMAPINFOHEADER lpbiFormat,LPBITMAPINFOHEADER lpbi) {
|
||||
ICDECOMPRESSEX icd;
|
||||
int result;
|
||||
|
||||
icd.dwFlags = 0;
|
||||
|
||||
icd.lpbiSrc = lpbiFormat;
|
||||
icd.lpSrc = 0;
|
||||
|
||||
icd.lpbiDst = lpbi;
|
||||
icd.lpDst = 0;
|
||||
|
||||
icd.xSrc=icd.ySrc=0;
|
||||
icd.dxSrc=lpbiFormat->biWidth;
|
||||
icd.dySrc=abs(lpbiFormat->biHeight);
|
||||
|
||||
icd.xDst=icd.yDst=0;
|
||||
icd.dxDst=lpbi->biWidth;
|
||||
icd.dyDst=abs(lpbi->biHeight);
|
||||
|
||||
//icd.ckid = 0;
|
||||
result=ICSendMessage(hic,command,(long)&icd,sizeof(icd));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* ICSendMessage [MSVFW.40]
|
||||
*/
|
||||
LRESULT VFWAPI
|
||||
ICSendMessage(HIC hic,unsigned int msg,long lParam1,long lParam2) {
|
||||
WINE_HIC *whic = (WINE_HIC*)hic;
|
||||
return SendDriverMessage(whic->hdrv, msg, lParam1,lParam2);
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* ICClose [MSVFW.22]
|
||||
*/
|
||||
LRESULT VFWAPI ICClose(HIC hic) {
|
||||
WINE_HIC *whic = (WINE_HIC*)hic;
|
||||
/* FIXME: correct? */
|
||||
// CloseDriver(whic->hdrv,0,0);
|
||||
DrvClose(whic->hdrv);
|
||||
free(whic);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int VFWAPI ICDoSomething(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
-5779
File diff suppressed because it is too large
Load Diff
@@ -1,34 +0,0 @@
|
||||
/*
|
||||
* Modified for use with MPlayer, detailed changelog at
|
||||
* http://svn.mplayerhq.hu/mplayer/trunk/
|
||||
*/
|
||||
|
||||
#ifndef MPLAYER_WIN32_H
|
||||
#define MPLAYER_WIN32_H
|
||||
|
||||
#include <time.h>
|
||||
|
||||
#include "wine/windef.h"
|
||||
#include "wine/winbase.h"
|
||||
#include "com.h"
|
||||
|
||||
void my_garbagecollection(void);
|
||||
|
||||
typedef struct {
|
||||
UINT uDriverSignature;
|
||||
HINSTANCE hDriverModule;
|
||||
DRIVERPROC DriverProc;
|
||||
DWORD dwDriverID;
|
||||
} DRVR;
|
||||
|
||||
typedef DRVR *PDRVR;
|
||||
typedef DRVR *NPDRVR;
|
||||
typedef DRVR *LPDRVR;
|
||||
|
||||
typedef struct tls_s tls_t;
|
||||
|
||||
|
||||
void* LookupExternal(const char* library, int ordinal);
|
||||
void* LookupExternalByName(const char* library, const char* name);
|
||||
|
||||
#endif /* MPLAYER_WIN32_H */
|
||||
@@ -1,240 +0,0 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* AVIFMT - AVI file format definitions
|
||||
*
|
||||
****************************************************************************/
|
||||
#ifndef MPLAYER_AVIFMT_H
|
||||
#define MPLAYER_AVIFMT_H
|
||||
|
||||
#ifndef MPLAYER_NOAVIFMT_H
|
||||
|
||||
#include "windef.h"
|
||||
|
||||
#ifndef MPLAYER_MSACM_H
|
||||
typedef DWORD FOURCC;
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable:4200)
|
||||
#endif
|
||||
|
||||
/* The following is a short description of the AVI file format. Please
|
||||
* see the accompanying documentation for a full explanation.
|
||||
*
|
||||
* An AVI file is the following RIFF form:
|
||||
*
|
||||
* RIFF('AVI'
|
||||
* LIST('hdrl'
|
||||
* avih(<MainAVIHeader>)
|
||||
* LIST ('strl'
|
||||
* strh(<Stream header>)
|
||||
* strf(<Stream format>)
|
||||
* ... additional header data
|
||||
* LIST('movi'
|
||||
* { LIST('rec'
|
||||
* SubChunk...
|
||||
* )
|
||||
* | SubChunk } ....
|
||||
* )
|
||||
* [ <AVIIndex> ]
|
||||
* )
|
||||
*
|
||||
* The main file header specifies how many streams are present. For
|
||||
* each one, there must be a stream header chunk and a stream format
|
||||
* chunk, enlosed in a 'strl' LIST chunk. The 'strf' chunk contains
|
||||
* type-specific format information; for a video stream, this should
|
||||
* be a BITMAPINFO structure, including palette. For an audio stream,
|
||||
* this should be a WAVEFORMAT (or PCMWAVEFORMAT) structure.
|
||||
*
|
||||
* The actual data is contained in subchunks within the 'movi' LIST
|
||||
* chunk. The first two characters of each data chunk are the
|
||||
* stream number with which that data is associated.
|
||||
*
|
||||
* Some defined chunk types:
|
||||
* Video Streams:
|
||||
* ##db: RGB DIB bits
|
||||
* ##dc: RLE8 compressed DIB bits
|
||||
* ##pc: Palette Change
|
||||
*
|
||||
* Audio Streams:
|
||||
* ##wb: waveform audio bytes
|
||||
*
|
||||
* The grouping into LIST 'rec' chunks implies only that the contents of
|
||||
* the chunk should be read into memory at the same time. This
|
||||
* grouping is used for files specifically intended to be played from
|
||||
* CD-ROM.
|
||||
*
|
||||
* The index chunk at the end of the file should contain one entry for
|
||||
* each data chunk in the file.
|
||||
*
|
||||
* Limitations for the current software:
|
||||
* Only one video stream and one audio stream are allowed.
|
||||
* The streams must start at the beginning of the file.
|
||||
*
|
||||
*
|
||||
* To register codec types please obtain a copy of the Multimedia
|
||||
* Developer Registration Kit from:
|
||||
*
|
||||
* Microsoft Corporation
|
||||
* Multimedia Systems Group
|
||||
* Product Marketing
|
||||
* One Microsoft Way
|
||||
* Redmond, WA 98052-6399
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef mmioFOURCC
|
||||
#define mmioFOURCC( ch0, ch1, ch2, ch3 ) \
|
||||
( (DWORD)(BYTE)(ch0) | ( (DWORD)(BYTE)(ch1) << 8 ) | \
|
||||
( (DWORD)(BYTE)(ch2) << 16 ) | ( (DWORD)(BYTE)(ch3) << 24 ) )
|
||||
#endif
|
||||
|
||||
/* Macro to make a TWOCC out of two characters */
|
||||
#ifndef aviTWOCC
|
||||
#define aviTWOCC(ch0, ch1) ((WORD)(BYTE)(ch0) | ((WORD)(BYTE)(ch1) << 8))
|
||||
#endif
|
||||
|
||||
typedef WORD TWOCC;
|
||||
|
||||
/* form types, list types, and chunk types */
|
||||
#define formtypeAVI mmioFOURCC('A', 'V', 'I', ' ')
|
||||
#define listtypeAVIHEADER mmioFOURCC('h', 'd', 'r', 'l')
|
||||
#define ckidAVIMAINHDR mmioFOURCC('a', 'v', 'i', 'h')
|
||||
#define listtypeSTREAMHEADER mmioFOURCC('s', 't', 'r', 'l')
|
||||
#define ckidSTREAMHEADER mmioFOURCC('s', 't', 'r', 'h')
|
||||
#define ckidSTREAMFORMAT mmioFOURCC('s', 't', 'r', 'f')
|
||||
#define ckidSTREAMHANDLERDATA mmioFOURCC('s', 't', 'r', 'd')
|
||||
#define ckidSTREAMNAME mmioFOURCC('s', 't', 'r', 'n')
|
||||
|
||||
#define listtypeAVIMOVIE mmioFOURCC('m', 'o', 'v', 'i')
|
||||
#define listtypeAVIRECORD mmioFOURCC('r', 'e', 'c', ' ')
|
||||
|
||||
#define ckidAVINEWINDEX mmioFOURCC('i', 'd', 'x', '1')
|
||||
|
||||
/*
|
||||
** Stream types for the <fccType> field of the stream header.
|
||||
*/
|
||||
#define streamtypeVIDEO mmioFOURCC('v', 'i', 'd', 's')
|
||||
#define streamtypeAUDIO mmioFOURCC('a', 'u', 'd', 's')
|
||||
#define streamtypeMIDI mmioFOURCC('m', 'i', 'd', 's')
|
||||
#define streamtypeTEXT mmioFOURCC('t', 'x', 't', 's')
|
||||
|
||||
/* Basic chunk types */
|
||||
#define cktypeDIBbits aviTWOCC('d', 'b')
|
||||
#define cktypeDIBcompressed aviTWOCC('d', 'c')
|
||||
#define cktypePALchange aviTWOCC('p', 'c')
|
||||
#define cktypeWAVEbytes aviTWOCC('w', 'b')
|
||||
|
||||
/* Chunk id to use for extra chunks for padding. */
|
||||
#define ckidAVIPADDING mmioFOURCC('J', 'U', 'N', 'K')
|
||||
|
||||
/*
|
||||
** Useful macros
|
||||
**
|
||||
** Warning: These are nasty macro, and MS C 6.0 compiles some of them
|
||||
** incorrectly if optimizations are on. Ack.
|
||||
*/
|
||||
|
||||
/* Macro to get stream number out of a FOURCC ckid */
|
||||
#define FromHex(n) (((n) >= 'A') ? ((n) + 10 - 'A') : ((n) - '0'))
|
||||
#define StreamFromFOURCC(fcc) ((WORD) ((FromHex(LOBYTE(LOWORD(fcc))) << 4) + \
|
||||
(FromHex(HIBYTE(LOWORD(fcc))))))
|
||||
|
||||
/* Macro to get TWOCC chunk type out of a FOURCC ckid */
|
||||
#define TWOCCFromFOURCC(fcc) HIWORD(fcc)
|
||||
|
||||
/* Macro to make a ckid for a chunk out of a TWOCC and a stream number
|
||||
** from 0-255.
|
||||
*/
|
||||
#define ToHex(n) ((BYTE) (((n) > 9) ? ((n) - 10 + 'A') : ((n) + '0')))
|
||||
#define MAKEAVICKID(tcc, stream) \
|
||||
MAKELONG((ToHex((stream) & 0x0f) << 8) | \
|
||||
(ToHex(((stream) & 0xf0) >> 4)), tcc)
|
||||
|
||||
/*
|
||||
** Main AVI File Header
|
||||
*/
|
||||
|
||||
/* flags for use in <dwFlags> in AVIFileHdr */
|
||||
#define AVIF_HASINDEX 0x00000010 // Index at end of file?
|
||||
#define AVIF_MUSTUSEINDEX 0x00000020
|
||||
#define AVIF_ISINTERLEAVED 0x00000100
|
||||
#define AVIF_TRUSTCKTYPE 0x00000800 // Use CKType to find key frames?
|
||||
#define AVIF_WASCAPTUREFILE 0x00010000
|
||||
#define AVIF_COPYRIGHTED 0x00020000
|
||||
|
||||
/* The AVI File Header LIST chunk should be padded to this size */
|
||||
#define AVI_HEADERSIZE 2048 // size of AVI header list
|
||||
|
||||
typedef struct
|
||||
{
|
||||
DWORD dwMicroSecPerFrame; // frame display rate (or 0L)
|
||||
DWORD dwMaxBytesPerSec; // max. transfer rate
|
||||
DWORD dwPaddingGranularity; // pad to multiples of this
|
||||
// size; normally 2K.
|
||||
DWORD dwFlags; // the ever-present flags
|
||||
DWORD dwTotalFrames; // # frames in file
|
||||
DWORD dwInitialFrames;
|
||||
DWORD dwStreams;
|
||||
DWORD dwSuggestedBufferSize;
|
||||
|
||||
DWORD dwWidth;
|
||||
DWORD dwHeight;
|
||||
|
||||
DWORD dwReserved[4];
|
||||
} MainAVIHeader;
|
||||
|
||||
/*
|
||||
** Stream header
|
||||
*/
|
||||
|
||||
#define AVISF_DISABLED 0x00000001
|
||||
|
||||
#define AVISF_VIDEO_PALCHANGES 0x00010000
|
||||
|
||||
|
||||
typedef struct {
|
||||
FOURCC fccType;
|
||||
FOURCC fccHandler;
|
||||
DWORD dwFlags; /* Contains AVITF_* flags */
|
||||
WORD wPriority;
|
||||
WORD wLanguage;
|
||||
DWORD dwInitialFrames;
|
||||
DWORD dwScale;
|
||||
DWORD dwRate; /* dwRate / dwScale == samples/second */
|
||||
DWORD dwStart;
|
||||
DWORD dwLength; /* In units above... */
|
||||
DWORD dwSuggestedBufferSize;
|
||||
DWORD dwQuality;
|
||||
DWORD dwSampleSize;
|
||||
RECT rcFrame;
|
||||
} AVIStreamHeader;
|
||||
|
||||
/* Flags for index */
|
||||
#define AVIIF_LIST 0x00000001L // chunk is a 'LIST'
|
||||
#define AVIIF_KEYFRAME 0x00000010L // this frame is a key frame.
|
||||
|
||||
#define AVIIF_NOTIME 0x00000100L // this frame doesn't take any time
|
||||
#define AVIIF_COMPUSE 0x0FFF0000L // these bits are for compressor use
|
||||
|
||||
#define FOURCC_RIFF mmioFOURCC('R', 'I', 'F', 'F')
|
||||
#define FOURCC_LIST mmioFOURCC('L', 'I', 'S', 'T')
|
||||
|
||||
typedef struct
|
||||
{
|
||||
DWORD ckid;
|
||||
DWORD dwFlags;
|
||||
DWORD dwChunkOffset; // Position of chunk
|
||||
DWORD dwChunkLength; // Length of chunk
|
||||
} AVIINDEXENTRY;
|
||||
|
||||
#define AVISTREAMREAD_CONVENIENT (-1L)
|
||||
|
||||
/*
|
||||
** Palette change chunk
|
||||
**
|
||||
** Used in video streams.
|
||||
*/
|
||||
#endif /* MPLAYER_NOAVIFMT_H */
|
||||
#endif /* MPLAYER_AVIFMT_H */
|
||||
@@ -1,152 +0,0 @@
|
||||
/*
|
||||
* Compilers that uses ILP32, LP64 or P64 type models
|
||||
* for both Win32 and Win64 are supported by this file.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Modified for use with MPlayer, detailed changelog at
|
||||
* http://svn.mplayerhq.hu/mplayer/trunk/
|
||||
*/
|
||||
|
||||
#ifndef MPLAYER_BASETSD_H
|
||||
#define MPLAYER_BASETSD_H
|
||||
|
||||
#include "config.h"
|
||||
|
||||
/*
|
||||
* Win32 was easy to implement under Unix since most (all?) 32-bit
|
||||
* Unices uses the same type model (ILP32) as Win32, where int, long
|
||||
* and pointer are 32-bit.
|
||||
*
|
||||
* Win64, however, will cause some problems when implemented under Unix.
|
||||
* Linux/{Alpha, Sparc64} and most (all?) other 64-bit Unices uses
|
||||
* the LP64 type model where int is 32-bit and long and pointer are
|
||||
* 64-bit. Win64 on the other hand uses the P64 (sometimes called LLP64)
|
||||
* type model where int and long are 32 bit and pointer is 64-bit.
|
||||
*/
|
||||
|
||||
/* Type model indepent typedefs */
|
||||
|
||||
#ifndef __INTEL_COMPILER
|
||||
|
||||
#ifndef __int8
|
||||
typedef char __int8;
|
||||
#endif
|
||||
#ifndef __uint8
|
||||
typedef unsigned char __uint8;
|
||||
#endif
|
||||
|
||||
#ifndef __int16
|
||||
typedef short __int16;
|
||||
#endif
|
||||
#ifndef __uint16
|
||||
typedef unsigned short __uint16;
|
||||
#endif
|
||||
|
||||
#ifndef __int32
|
||||
typedef int __int32;
|
||||
#endif
|
||||
#ifndef __uint32
|
||||
typedef unsigned int __uint32;
|
||||
#endif
|
||||
|
||||
#ifndef __int64
|
||||
typedef long long __int64;
|
||||
#endif
|
||||
#ifndef __uint64
|
||||
typedef unsigned long long __uint64;
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
typedef unsigned __int8 __uint8;
|
||||
typedef unsigned __int16 __uint16;
|
||||
typedef unsigned __int32 __uint32;
|
||||
typedef unsigned __int64 __uint64;
|
||||
|
||||
#endif /* __INTEL_COMPILER */
|
||||
|
||||
/* Always signed and 32 bit wide */
|
||||
|
||||
typedef __int32 LONG32;
|
||||
//typedef __int32 INT32;
|
||||
|
||||
typedef LONG32 *PLONG32;
|
||||
//typedef INT32 *PINT32;
|
||||
|
||||
/* Always unsigned and 32 bit wide */
|
||||
|
||||
typedef __uint32 ULONG32;
|
||||
typedef __uint32 DWORD32;
|
||||
typedef __uint32 UINT32;
|
||||
|
||||
typedef ULONG32 *PULONG32;
|
||||
typedef DWORD32 *PDWORD32;
|
||||
typedef UINT32 *PUINT32;
|
||||
|
||||
/* Always signed and 64 bit wide */
|
||||
|
||||
typedef __int64 LONG64;
|
||||
typedef __int64 INT64;
|
||||
|
||||
typedef LONG64 *PLONG64;
|
||||
typedef INT64 *PINT64;
|
||||
|
||||
/* Always unsigned and 64 bit wide */
|
||||
|
||||
typedef __uint64 ULONG64;
|
||||
typedef __uint64 DWORD64;
|
||||
typedef __uint64 UINT64;
|
||||
|
||||
typedef ULONG64 *PULONG64;
|
||||
typedef DWORD64 *PDWORD64;
|
||||
typedef UINT64 *PUINT64;
|
||||
|
||||
/* Win32 or Win64 dependent typedef/defines. */
|
||||
|
||||
#ifdef _WIN64
|
||||
|
||||
typedef __int64 INT_PTR, *PINT_PTR;
|
||||
typedef __uint64 UINT_PTR, *PUINT_PTR;
|
||||
|
||||
#define MAXINT_PTR 0x7fffffffffffffff
|
||||
#define MININT_PTR 0x8000000000000000
|
||||
#define MAXUINT_PTR 0xffffffffffffffff
|
||||
|
||||
typedef __int32 HALF_PTR, *PHALF_PTR;
|
||||
typedef __int32 UHALF_PTR, *PUHALF_PTR;
|
||||
|
||||
#define MAXHALF_PTR 0x7fffffff
|
||||
#define MINHALF_PTR 0x80000000
|
||||
#define MAXUHALF_PTR 0xffffffff
|
||||
|
||||
typedef __int64 LONG_PTR, *PLONG_PTR;
|
||||
typedef __uint64 ULONG_PTR, *PULONG_PTR;
|
||||
typedef __uint64 DWORD_PTR, *PDWORD_PTR;
|
||||
|
||||
#else /* FIXME: defined(_WIN32) */
|
||||
|
||||
typedef __int32 INT_PTR, *PINT_PTR;
|
||||
typedef __uint32 UINT_PTR, *PUINT_PTR;
|
||||
|
||||
#define MAXINT_PTR 0x7fffffff
|
||||
#define MININT_PTR 0x80000000
|
||||
#define MAXUINT_PTR 0xffffffff
|
||||
|
||||
typedef __int16 HALF_PTR, *PHALF_PTR;
|
||||
typedef __uint16 UHALF_PTR, *PUHALF_PTR;
|
||||
|
||||
#define MAXUHALF_PTR 0xffff
|
||||
#define MAXHALF_PTR 0x7fff
|
||||
#define MINHALF_PTR 0x8000
|
||||
|
||||
typedef __int32 LONG_PTR, *PLONG_PTR;
|
||||
typedef __uint32 ULONG_PTR, *PULONG_PTR;
|
||||
typedef __uint32 DWORD_PTR, *PDWORD_PTR;
|
||||
|
||||
#endif /* defined(_WIN64) || defined(_WIN32) */
|
||||
|
||||
typedef INT_PTR SSIZE_T, *PSSIZE_T;
|
||||
typedef UINT_PTR SIZE_T, *PSIZE_T;
|
||||
|
||||
#endif /* MPLAYER_BASETSD_H */
|
||||
@@ -1,71 +0,0 @@
|
||||
#ifndef MPLAYER_DEBUGTOOLS_H
|
||||
#define MPLAYER_DEBUGTOOLS_H
|
||||
|
||||
#include <stdarg.h>
|
||||
#include "config.h"
|
||||
#include "windef.h"
|
||||
|
||||
struct GUID;
|
||||
|
||||
/* Internal definitions (do not use these directly) */
|
||||
|
||||
enum DEBUG_CLASS { DBCL_FIXME, DBCL_ERR, DBCL_WARN, DBCL_TRACE, DBCL_COUNT };
|
||||
|
||||
#ifndef NO_TRACE_MSGS
|
||||
# define GET_DEBUGGING_trace(dbch) ((dbch)[0] & (1 << DBCL_TRACE))
|
||||
#else
|
||||
# define GET_DEBUGGING_trace(dbch) 0
|
||||
#endif
|
||||
|
||||
#ifndef NO_DEBUG_MSGS
|
||||
# define GET_DEBUGGING_warn(dbch) ((dbch)[0] & (1 << DBCL_WARN))
|
||||
# define GET_DEBUGGING_fixme(dbch) ((dbch)[0] & (1 << DBCL_FIXME))
|
||||
#else
|
||||
# define GET_DEBUGGING_warn(dbch) 0
|
||||
# define GET_DEBUGGING_fixme(dbch) 0
|
||||
#endif
|
||||
|
||||
/* define error macro regardless of what is configured */
|
||||
#define GET_DEBUGGING_err(dbch) ((dbch)[0] & (1 << DBCL_ERR))
|
||||
|
||||
#define GET_DEBUGGING(dbcl,dbch) GET_DEBUGGING_##dbcl(dbch)
|
||||
#define SET_DEBUGGING(dbcl,dbch,on) \
|
||||
((on) ? ((dbch)[0] |= 1 << (dbcl)) : ((dbch)[0] &= ~(1 << (dbcl))))
|
||||
|
||||
/* Exported definitions and macros */
|
||||
|
||||
/* These function return a printable version of a string, including
|
||||
quotes. The string will be valid for some time, but not indefinitely
|
||||
as strings are re-used. */
|
||||
LPCSTR debugstr_an( LPCSTR s, int n );
|
||||
LPCSTR debugstr_wn( LPCWSTR s, int n );
|
||||
LPCSTR debugres_a( LPCSTR res );
|
||||
LPCSTR debugres_w( LPCWSTR res );
|
||||
LPCSTR debugstr_guid( const struct GUID *id );
|
||||
LPCSTR debugstr_hex_dump( const void *ptr, int len );
|
||||
int dbg_header_err( const char *dbg_channel, const char *func );
|
||||
int dbg_header_warn( const char *dbg_channel, const char *func );
|
||||
int dbg_header_fixme( const char *dbg_channel, const char *func );
|
||||
int dbg_header_trace( const char *dbg_channel, const char *func );
|
||||
int dbg_vprintf( const char *format, va_list args );
|
||||
|
||||
static inline LPCSTR debugstr_a( LPCSTR s ) { return debugstr_an( s, 80 ); }
|
||||
static inline LPCSTR debugstr_w( LPCWSTR s ) { return debugstr_wn( s, 80 ); }
|
||||
|
||||
#define TRACE_(X) TRACE
|
||||
#define WARN_(X) TRACE
|
||||
#define WARN TRACE
|
||||
#define ERR_(X) printf
|
||||
#define ERR printf
|
||||
#define FIXME_(X) TRACE
|
||||
#define FIXME TRACE
|
||||
|
||||
#define TRACE_ON(X) 1
|
||||
#define ERR_ON(X) 1
|
||||
|
||||
#define DECLARE_DEBUG_CHANNEL(ch) \
|
||||
extern char dbch_##ch[];
|
||||
#define DEFAULT_DEBUG_CHANNEL(ch) \
|
||||
extern char dbch_##ch[]; static char * const __dbch_default = dbch_##ch;
|
||||
|
||||
#endif /* MPLAYER_DEBUGTOOLS_H */
|
||||
@@ -1,110 +0,0 @@
|
||||
/*
|
||||
* Drivers definitions
|
||||
*/
|
||||
|
||||
#ifndef MPLAYER_DRIVER_H
|
||||
#define MPLAYER_DRIVER_H
|
||||
|
||||
#include "windef.h"
|
||||
|
||||
#define MMSYSERR_BASE 0
|
||||
|
||||
#define MMSYSERR_NOERROR 0 /* no error */
|
||||
#define MMSYSERR_ERROR (MMSYSERR_BASE + 1) /* unspecified error */
|
||||
#define MMSYSERR_BADDEVICEID (MMSYSERR_BASE + 2) /* device ID out of range */
|
||||
#define MMSYSERR_NOTENABLED (MMSYSERR_BASE + 3) /* driver failed enable */
|
||||
#define MMSYSERR_ALLOCATED (MMSYSERR_BASE + 4) /* device already allocated */
|
||||
#define MMSYSERR_INVALHANDLE (MMSYSERR_BASE + 5) /* device handle is invalid */
|
||||
#define MMSYSERR_NODRIVER (MMSYSERR_BASE + 6) /* no device driver present */
|
||||
#define MMSYSERR_NOMEM (MMSYSERR_BASE + 7) /* memory allocation error */
|
||||
#define MMSYSERR_NOTSUPPORTED (MMSYSERR_BASE + 8) /* function isn't supported */
|
||||
#define MMSYSERR_BADERRNUM (MMSYSERR_BASE + 9) /* error value out of range */
|
||||
#define MMSYSERR_INVALFLAG (MMSYSERR_BASE + 10) /* invalid flag passed */
|
||||
#define MMSYSERR_INVALPARAM (MMSYSERR_BASE + 11) /* invalid parameter passed */
|
||||
#define MMSYSERR_LASTERROR (MMSYSERR_BASE + 11) /* last error in range */
|
||||
|
||||
#define DRV_LOAD 0x0001
|
||||
#define DRV_ENABLE 0x0002
|
||||
#define DRV_OPEN 0x0003
|
||||
#define DRV_CLOSE 0x0004
|
||||
#define DRV_DISABLE 0x0005
|
||||
#define DRV_FREE 0x0006
|
||||
#define DRV_CONFIGURE 0x0007
|
||||
#define DRV_QUERYCONFIGURE 0x0008
|
||||
#define DRV_INSTALL 0x0009
|
||||
#define DRV_REMOVE 0x000A
|
||||
#define DRV_EXITSESSION 0x000B
|
||||
#define DRV_EXITAPPLICATION 0x000C
|
||||
#define DRV_POWER 0x000F
|
||||
|
||||
#define DRV_RESERVED 0x0800
|
||||
#define DRV_USER 0x4000
|
||||
|
||||
#define DRVCNF_CANCEL 0x0000
|
||||
#define DRVCNF_OK 0x0001
|
||||
#define DRVCNF_RESTART 0x0002
|
||||
|
||||
#define DRVEA_NORMALEXIT 0x0001
|
||||
#define DRVEA_ABNORMALEXIT 0x0002
|
||||
|
||||
#define DRV_SUCCESS 0x0001
|
||||
#define DRV_FAILURE 0x0000
|
||||
|
||||
#define GND_FIRSTINSTANCEONLY 0x00000001
|
||||
|
||||
#define GND_FORWARD 0x00000000
|
||||
#define GND_REVERSE 0x00000002
|
||||
|
||||
typedef struct {
|
||||
DWORD dwDCISize;
|
||||
LPCSTR lpszDCISectionName;
|
||||
LPCSTR lpszDCIAliasName;
|
||||
} DRVCONFIGINFO16, *LPDRVCONFIGINFO16;
|
||||
|
||||
typedef struct {
|
||||
DWORD dwDCISize;
|
||||
LPCWSTR lpszDCISectionName;
|
||||
LPCWSTR lpszDCIAliasName;
|
||||
} DRVCONFIGINFO, *LPDRVCONFIGINFO;
|
||||
|
||||
|
||||
/* GetDriverInfo16 references this structure, so this a struct defined
|
||||
* in the Win16 API.
|
||||
* GetDriverInfo has been deprecated in Win32.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
UINT16 length;
|
||||
HDRVR16 hDriver;
|
||||
HINSTANCE16 hModule;
|
||||
CHAR szAliasName[128];
|
||||
} DRIVERINFOSTRUCT16, *LPDRIVERINFOSTRUCT16;
|
||||
|
||||
LRESULT WINAPI DefDriverProc16(DWORD dwDevID, HDRVR16 hDriv, UINT16 wMsg,
|
||||
LPARAM dwParam1, LPARAM dwParam2);
|
||||
LRESULT WINAPI DefDriverProc(DWORD dwDriverIdentifier, HDRVR hdrvr,
|
||||
UINT Msg, LPARAM lParam1, LPARAM lParam2);
|
||||
HDRVR16 WINAPI OpenDriver16(LPCSTR szDriverName, LPCSTR szSectionName,
|
||||
LPARAM lParam2);
|
||||
HDRVR WINAPI OpenDriverA(LPCSTR szDriverName, LPCSTR szSectionName,
|
||||
LPARAM lParam2);
|
||||
HDRVR WINAPI OpenDriverW(LPCWSTR szDriverName, LPCWSTR szSectionName,
|
||||
LPARAM lParam2);
|
||||
#define OpenDriver WINELIB_NAME_AW(OpenDriver)
|
||||
LRESULT WINAPI CloseDriver16(HDRVR16 hDriver, LPARAM lParam1, LPARAM lParam2);
|
||||
LRESULT WINAPI CloseDriver(HDRVR hDriver, LPARAM lParam1, LPARAM lParam2);
|
||||
LRESULT WINAPI SendDriverMessage16( HDRVR16 hDriver, UINT16 message,
|
||||
LPARAM lParam1, LPARAM lParam2 );
|
||||
LRESULT WINAPI SendDriverMessage( HDRVR hDriver, UINT message,
|
||||
LPARAM lParam1, LPARAM lParam2 );
|
||||
HMODULE16 WINAPI GetDriverModuleHandle16(HDRVR16 hDriver);
|
||||
HMODULE WINAPI GetDriverModuleHandle(HDRVR hDriver);
|
||||
|
||||
DWORD WINAPI GetDriverFlags( HDRVR hDriver );
|
||||
/* this call (GetDriverFlags) is not documented, nor the flags returned.
|
||||
* here are Wine only definitions
|
||||
*/
|
||||
#define WINE_GDF_EXIST 0x80000000
|
||||
#define WINE_GDF_16BIT 0x10000000
|
||||
|
||||
#endif /* MPLAYER_DRIVER_H */
|
||||
@@ -1,13 +0,0 @@
|
||||
#ifndef MPLAYER_ELFDLL_H
|
||||
#define MPLAYER_ELFDLL_H
|
||||
|
||||
#include "module.h"
|
||||
#include "windef.h"
|
||||
|
||||
WINE_MODREF *ELFDLL_LoadLibraryExA(LPCSTR libname, DWORD flags);
|
||||
HINSTANCE16 ELFDLL_LoadModule16(LPCSTR libname);
|
||||
void ELFDLL_UnloadLibrary(WINE_MODREF *wm);
|
||||
|
||||
void *ELFDLL_dlopen(const char *libname, int flags);
|
||||
|
||||
#endif /* MPLAYER_ELFDLL_H */
|
||||
@@ -1,56 +0,0 @@
|
||||
/*
|
||||
* Win32 heap definitions
|
||||
*
|
||||
* Copyright 1996 Alexandre Julliard
|
||||
*/
|
||||
|
||||
#ifndef MPLAYER_HEAP_H
|
||||
#define MPLAYER_HEAP_H
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "winbase.h"
|
||||
|
||||
extern HANDLE SystemHeap;
|
||||
extern HANDLE SegptrHeap;
|
||||
|
||||
int HEAP_IsInsideHeap( HANDLE heap, DWORD flags, LPCVOID ptr );
|
||||
SEGPTR HEAP_GetSegptr( HANDLE heap, DWORD flags, LPCVOID ptr );
|
||||
LPSTR HEAP_strdupA( HANDLE heap, DWORD flags, LPCSTR str );
|
||||
LPWSTR HEAP_strdupW( HANDLE heap, DWORD flags, LPCWSTR str );
|
||||
LPWSTR HEAP_strdupAtoW( HANDLE heap, DWORD flags, LPCSTR str );
|
||||
LPSTR HEAP_strdupWtoA( HANDLE heap, DWORD flags, LPCWSTR str );
|
||||
|
||||
/* SEGPTR helper macros */
|
||||
|
||||
#define SEGPTR_ALLOC(size) \
|
||||
(HeapAlloc( SegptrHeap, 0, (size) ))
|
||||
#define SEGPTR_NEW(type) \
|
||||
((type *)HeapAlloc( SegptrHeap, 0, sizeof(type) ))
|
||||
#define SEGPTR_STRDUP(str) \
|
||||
(HIWORD(str) ? HEAP_strdupA( SegptrHeap, 0, (str) ) : (LPSTR)(str))
|
||||
#define SEGPTR_STRDUP_WtoA(str) \
|
||||
(HIWORD(str) ? HEAP_strdupWtoA( SegptrHeap, 0, (str) ) : (LPSTR)(str))
|
||||
/* define an inline function, a macro won't do */
|
||||
static inline SEGPTR WINE_UNUSED SEGPTR_Get(LPCVOID ptr) {
|
||||
return HIWORD(ptr) ? HEAP_GetSegptr( SegptrHeap, 0, ptr ) : (SEGPTR)ptr;
|
||||
}
|
||||
#define SEGPTR_GET(ptr) SEGPTR_Get(ptr)
|
||||
#define SEGPTR_FREE(ptr) \
|
||||
(HIWORD(ptr) ? HeapFree( SegptrHeap, 0, (ptr) ) : 0)
|
||||
|
||||
/* system heap private data */
|
||||
/* you must lock the system heap before using this structure */
|
||||
typedef struct
|
||||
{
|
||||
void *gdi; /* GDI heap */
|
||||
void *user; /* USER handle table */
|
||||
void *cursor; /* cursor information */
|
||||
void *queue; /* message queues descriptor */
|
||||
void *win; /* windows descriptor */
|
||||
void *root; /* X11 root window */
|
||||
} SYSTEM_HEAP_DESCR;
|
||||
|
||||
extern SYSTEM_HEAP_DESCR *SystemHeapDescr;
|
||||
|
||||
#endif /* MPLAYER_HEAP_H */
|
||||
@@ -1,92 +0,0 @@
|
||||
/*
|
||||
* LDT copy
|
||||
*
|
||||
* Copyright 1995 Alexandre Julliard
|
||||
*/
|
||||
|
||||
#ifndef MPLAYER_LDT_H
|
||||
#define MPLAYER_LDT_H
|
||||
|
||||
#include "windef.h"
|
||||
enum seg_type
|
||||
{
|
||||
SEGMENT_DATA = 0,
|
||||
SEGMENT_STACK = 1,
|
||||
SEGMENT_CODE = 2
|
||||
};
|
||||
|
||||
/* This structure represents a real LDT entry. */
|
||||
/* It is used by get_ldt_entry() and set_ldt_entry(). */
|
||||
typedef struct
|
||||
{
|
||||
unsigned long base; /* base address */
|
||||
unsigned long limit; /* segment limit (in pages or bytes) */
|
||||
int seg_32bit; /* is segment 32-bit? */
|
||||
int read_only; /* is segment read-only? */
|
||||
int limit_in_pages; /* is the limit in pages or bytes? */
|
||||
enum seg_type type; /* segment type */
|
||||
} ldt_entry;
|
||||
void LDT_BytesToEntry( const unsigned long *buffer, ldt_entry *content );
|
||||
void LDT_EntryToBytes( unsigned long *buffer, const ldt_entry *content );
|
||||
int LDT_GetEntry( int entry, ldt_entry *content );
|
||||
int LDT_SetEntry( int entry, const ldt_entry *content );
|
||||
void LDT_Print( int start, int length );
|
||||
|
||||
|
||||
/* This structure is used to build the local copy of the LDT. */
|
||||
typedef struct
|
||||
{
|
||||
unsigned long base; /* base address or 0 if entry is free */
|
||||
unsigned long limit; /* limit in bytes or 0 if entry is free */
|
||||
} ldt_copy_entry;
|
||||
|
||||
#define LDT_SIZE 8192
|
||||
|
||||
extern ldt_copy_entry ldt_copy[LDT_SIZE];
|
||||
|
||||
#define AHSHIFT 3 /* don't change! */
|
||||
#define AHINCR (1 << AHSHIFT)
|
||||
|
||||
#define SELECTOR_TO_ENTRY(sel) (((int)(sel) & 0xffff) >> AHSHIFT)
|
||||
#define ENTRY_TO_SELECTOR(i) ((i) ? (((int)(i) << AHSHIFT) | 7) : 0)
|
||||
#define IS_LDT_ENTRY_FREE(i) (!(ldt_flags_copy[(i)] & LDT_FLAGS_ALLOCATED))
|
||||
#define IS_SELECTOR_FREE(sel) (IS_LDT_ENTRY_FREE(SELECTOR_TO_ENTRY(sel)))
|
||||
#define GET_SEL_BASE(sel) (ldt_copy[SELECTOR_TO_ENTRY(sel)].base)
|
||||
#define GET_SEL_LIMIT(sel) (ldt_copy[SELECTOR_TO_ENTRY(sel)].limit)
|
||||
|
||||
/* Convert a segmented ptr (16:16) to a linear (32) pointer */
|
||||
|
||||
#define PTR_SEG_OFF_TO_LIN(seg,off) \
|
||||
((void*)(GET_SEL_BASE(seg) + (unsigned int)(off)))
|
||||
#define PTR_SEG_TO_LIN(ptr) \
|
||||
PTR_SEG_OFF_TO_LIN(SELECTOROF(ptr),OFFSETOF(ptr))
|
||||
#define PTR_SEG_OFF_TO_SEGPTR(seg,off) \
|
||||
((SEGPTR)MAKELONG(off,seg))
|
||||
#define PTR_SEG_OFF_TO_HUGEPTR(seg,off) \
|
||||
PTR_SEG_OFF_TO_SEGPTR( (seg) + (HIWORD(off) << AHSHIFT), LOWORD(off) )
|
||||
|
||||
#define W32S_APPLICATION() (PROCESS_Current()->flags & PDB32_WIN32S_PROC)
|
||||
#define W32S_OFFSET 0x10000
|
||||
#define W32S_APP2WINE(addr, offset) ((addr)? (DWORD)(addr) + (DWORD)(offset) : 0)
|
||||
#define W32S_WINE2APP(addr, offset) ((addr)? (DWORD)(addr) - (DWORD)(offset) : 0)
|
||||
|
||||
extern unsigned char ldt_flags_copy[LDT_SIZE];
|
||||
|
||||
#define LDT_FLAGS_TYPE 0x03 /* Mask for segment type */
|
||||
#define LDT_FLAGS_READONLY 0x04 /* Segment is read-only (data) */
|
||||
#define LDT_FLAGS_EXECONLY 0x04 /* Segment is execute-only (code) */
|
||||
#define LDT_FLAGS_32BIT 0x08 /* Segment is 32-bit (code or stack) */
|
||||
#define LDT_FLAGS_BIG 0x10 /* Segment is big (limit is in pages) */
|
||||
#define LDT_FLAGS_ALLOCATED 0x80 /* Segment is allocated (no longer free) */
|
||||
|
||||
#define GET_SEL_FLAGS(sel) (ldt_flags_copy[SELECTOR_TO_ENTRY(sel)])
|
||||
|
||||
#define FIRST_LDT_ENTRY_TO_ALLOC 17
|
||||
|
||||
/* Determine if sel is a system selector (i.e. not managed by Wine) */
|
||||
#define IS_SELECTOR_SYSTEM(sel) \
|
||||
(!((sel) & 4) || (SELECTOR_TO_ENTRY(sel) < FIRST_LDT_ENTRY_TO_ALLOC))
|
||||
#define IS_SELECTOR_32BIT(sel) \
|
||||
(IS_SELECTOR_SYSTEM(sel) || (GET_SEL_FLAGS(sel) & LDT_FLAGS_32BIT))
|
||||
|
||||
#endif /* MPLAYER_LDT_H */
|
||||
@@ -1,249 +0,0 @@
|
||||
/*
|
||||
* mmreg.h - Declarations for ???
|
||||
*
|
||||
* Modified for use with MPlayer, detailed changelog at
|
||||
* http://svn.mplayerhq.hu/mplayer/trunk/
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef MPLAYER_MMREG_H
|
||||
#define MPLAYER_MMREG_H
|
||||
|
||||
/***********************************************************************
|
||||
* Defines/Enums
|
||||
*/
|
||||
|
||||
#ifndef ACM_WAVEFILTER
|
||||
#define ACM_WAVEFILTER
|
||||
|
||||
#include "windef.h"
|
||||
|
||||
#define WAVE_FILTER_UNKNOWN 0x0000
|
||||
#define WAVE_FILTER_DEVELOPMENT 0xFFFF
|
||||
|
||||
typedef struct __attribute__((__packed__)) WAVEFILTER {
|
||||
DWORD cbStruct;
|
||||
DWORD dwFilterTag;
|
||||
DWORD fdwFilter;
|
||||
DWORD dwReserved[5];
|
||||
} WAVEFILTER, *PWAVEFILTER, *NPWAVEFILTER, *LPWAVEFILTER;
|
||||
#endif /* ACM_WAVEFILTER */
|
||||
|
||||
#ifndef WAVE_FILTER_VOLUME
|
||||
#define WAVE_FILTER_VOLUME 0x0001
|
||||
|
||||
typedef struct __attribute__((__packed__)) WAVEFILTER_VOLUME {
|
||||
WAVEFILTER wfltr;
|
||||
DWORD dwVolume;
|
||||
} VOLUMEWAVEFILTER, *PVOLUMEWAVEFILTER, *NPVOLUMEWAVEFILTER, *LPVOLUMEWAVEFILTER;
|
||||
#endif /* WAVE_FILTER_VOLUME */
|
||||
|
||||
#ifndef WAVE_FILTER_ECHO
|
||||
#define WAVE_FILTER_ECHO 0x0002
|
||||
|
||||
typedef struct __attribute__((__packed__)) WAVEFILTER_ECHO {
|
||||
WAVEFILTER wfltr;
|
||||
DWORD dwVolume;
|
||||
DWORD dwDelay;
|
||||
} ECHOWAVEFILTER, *PECHOWAVEFILTER, *NPECHOWAVEFILTER, *LPECHOWAVEFILTER;
|
||||
#endif /* WAVEFILTER_ECHO */
|
||||
|
||||
#ifndef _WAVEFORMATEX_
|
||||
#define _WAVEFORMATEX_
|
||||
typedef struct __attribute__((__packed__)) WAVEFORMATEX {
|
||||
WORD wFormatTag;
|
||||
WORD nChannels;
|
||||
DWORD nSamplesPerSec;
|
||||
DWORD nAvgBytesPerSec;
|
||||
WORD nBlockAlign;
|
||||
WORD wBitsPerSample;
|
||||
WORD cbSize;
|
||||
} WAVEFORMATEX, *PWAVEFORMATEX, *NPWAVEFORMATEX, *LPWAVEFORMATEX;
|
||||
#endif /* _WAVEFORMATEX_ */
|
||||
|
||||
#ifndef GUID_TYPE
|
||||
#define GUID_TYPE
|
||||
typedef struct
|
||||
{
|
||||
unsigned long f1;
|
||||
unsigned short f2;
|
||||
unsigned short f3;
|
||||
unsigned char f4[8];
|
||||
} GUID;
|
||||
#endif
|
||||
|
||||
#ifndef _WAVEFORMATEXTENSIBLE_
|
||||
#define _WAVEFORMATEXTENSIBLE_
|
||||
typedef struct {
|
||||
WAVEFORMATEX Format;
|
||||
union {
|
||||
WORD wValidBitsPerSample; /* bits of precision */
|
||||
WORD wSamplesPerBlock; /* valid if wBitsPerSample==0 */
|
||||
WORD wReserved; /* If neither applies, set to zero. */
|
||||
} Samples;
|
||||
DWORD dwChannelMask; /* which channels are */
|
||||
/* present in stream */
|
||||
GUID SubFormat;
|
||||
} WAVEFORMATEXTENSIBLE, *PWAVEFORMATEXTENSIBLE;
|
||||
#endif // !_WAVEFORMATEXTENSIBLE_
|
||||
|
||||
#ifndef _MPEGLAYER3WAVEFORMAT_
|
||||
#define _MPEGLAYER3WAVEFORMAT_
|
||||
typedef struct WINE_PACKED mpeglayer3waveformat_tag {
|
||||
WORD wFormatTag;
|
||||
WORD nChannels;
|
||||
DWORD nSamplesPerSec;
|
||||
DWORD nAvgBytesPerSec;
|
||||
WORD nBlockAlign;
|
||||
WORD wBitsPerSample;
|
||||
WORD cbSize;
|
||||
WORD wID;
|
||||
DWORD fdwFlags;
|
||||
WORD nBlockSize;
|
||||
WORD nFramesPerBlock;
|
||||
WORD nCodecDelay;
|
||||
} MPEGLAYER3WAVEFORMAT;
|
||||
#endif /* !_MPEGLAYER3WAVEFORMAT_ */
|
||||
|
||||
/* WAVE form wFormatTag IDs */
|
||||
|
||||
#define WAVE_FORMAT_UNKNOWN 0x0000 /* Microsoft Corporation */
|
||||
#define WAVE_FORMAT_ADPCM 0x0002 /* Microsoft Corporation */
|
||||
#define WAVE_FORMAT_IEEE_FLOAT 0x0003 /* Microsoft Corporation */
|
||||
#define WAVE_FORMAT_VSELP 0x0004 /* Compaq Computer Corp. */
|
||||
#define WAVE_FORMAT_IBM_CVSD 0x0005 /* IBM Corporation */
|
||||
#define WAVE_FORMAT_ALAW 0x0006 /* Microsoft Corporation */
|
||||
#define WAVE_FORMAT_MULAW 0x0007 /* Microsoft Corporation */
|
||||
#define WAVE_FORMAT_DTS 0x0008 /* Microsoft Corporation */
|
||||
#define WAVE_FORMAT_OKI_ADPCM 0x0010 /* OKI */
|
||||
#define WAVE_FORMAT_DVI_ADPCM 0x0011 /* Intel Corporation */
|
||||
#define WAVE_FORMAT_IMA_ADPCM (WAVE_FORMAT_DVI_ADPCM) /* Intel Corporation */
|
||||
#define WAVE_FORMAT_MEDIASPACE_ADPCM 0x0012 /* Videologic */
|
||||
#define WAVE_FORMAT_SIERRA_ADPCM 0x0013 /* Sierra Semiconductor Corp */
|
||||
#define WAVE_FORMAT_G723_ADPCM 0x0014 /* Antex Electronics Corporation */
|
||||
#define WAVE_FORMAT_DIGISTD 0x0015 /* DSP Solutions, Inc. */
|
||||
#define WAVE_FORMAT_DIGIFIX 0x0016 /* DSP Solutions, Inc. */
|
||||
#define WAVE_FORMAT_DIALOGIC_OKI_ADPCM 0x0017 /* Dialogic Corporation */
|
||||
#define WAVE_FORMAT_MEDIAVISION_ADPCM 0x0018 /* Media Vision, Inc. */
|
||||
#define WAVE_FORMAT_CU_CODEC 0x0019 /* Hewlett-Packard Company */
|
||||
#define WAVE_FORMAT_YAMAHA_ADPCM 0x0020 /* Yamaha Corporation of America */
|
||||
#define WAVE_FORMAT_SONARC 0x0021 /* Speech Compression */
|
||||
#define WAVE_FORMAT_DSPGROUP_TRUESPEECH 0x0022 /* DSP Group, Inc */
|
||||
#define WAVE_FORMAT_ECHOSC1 0x0023 /* Echo Speech Corporation */
|
||||
#define WAVE_FORMAT_AUDIOFILE_AF36 0x0024 /* Virtual Music, Inc. */
|
||||
#define WAVE_FORMAT_APTX 0x0025 /* Audio Processing Technology */
|
||||
#define WAVE_FORMAT_AUDIOFILE_AF10 0x0026 /* Virtual Music, Inc. */
|
||||
#define WAVE_FORMAT_PROSODY_1612 0x0027 /* Aculab plc */
|
||||
#define WAVE_FORMAT_LRC 0x0028 /* Merging Technologies S.A. */
|
||||
#define WAVE_FORMAT_DOLBY_AC2 0x0030 /* Dolby Laboratories */
|
||||
#define WAVE_FORMAT_GSM610 0x0031 /* Microsoft Corporation */
|
||||
#define WAVE_FORMAT_MSNAUDIO 0x0032 /* Microsoft Corporation */
|
||||
#define WAVE_FORMAT_ANTEX_ADPCME 0x0033 /* Antex Electronics Corporation */
|
||||
#define WAVE_FORMAT_CONTROL_RES_VQLPC 0x0034 /* Control Resources Limited */
|
||||
#define WAVE_FORMAT_DIGIREAL 0x0035 /* DSP Solutions, Inc. */
|
||||
#define WAVE_FORMAT_DIGIADPCM 0x0036 /* DSP Solutions, Inc. */
|
||||
#define WAVE_FORMAT_CONTROL_RES_CR10 0x0037 /* Control Resources Limited */
|
||||
#define WAVE_FORMAT_NMS_VBXADPCM 0x0038 /* Natural MicroSystems */
|
||||
#define WAVE_FORMAT_CS_IMAADPCM 0x0039 /* Crystal Semiconductor IMA ADPCM */
|
||||
#define WAVE_FORMAT_ECHOSC3 0x003A /* Echo Speech Corporation */
|
||||
#define WAVE_FORMAT_ROCKWELL_ADPCM 0x003B /* Rockwell International */
|
||||
#define WAVE_FORMAT_ROCKWELL_DIGITALK 0x003C /* Rockwell International */
|
||||
#define WAVE_FORMAT_XEBEC 0x003D /* Xebec Multimedia Solutions Limited */
|
||||
#define WAVE_FORMAT_G721_ADPCM 0x0040 /* Antex Electronics Corporation */
|
||||
#define WAVE_FORMAT_G728_CELP 0x0041 /* Antex Electronics Corporation */
|
||||
#define WAVE_FORMAT_MSG723 0x0042 /* Microsoft Corporation */
|
||||
#define WAVE_FORMAT_MPEG 0x0050 /* Microsoft Corporation */
|
||||
#define WAVE_FORMAT_RT24 0x0052 /* InSoft, Inc. */
|
||||
#define WAVE_FORMAT_PAC 0x0053 /* InSoft, Inc. */
|
||||
#define WAVE_FORMAT_MPEGLAYER3 0x0055 /* ISO/MPEG Layer3 Format Tag */
|
||||
#define WAVE_FORMAT_LUCENT_G723 0x0059 /* Lucent Technologies */
|
||||
#define WAVE_FORMAT_CIRRUS 0x0060 /* Cirrus Logic */
|
||||
#define WAVE_FORMAT_ESPCM 0x0061 /* ESS Technology */
|
||||
#define WAVE_FORMAT_VOXWARE 0x0062 /* Voxware Inc */
|
||||
#define WAVE_FORMAT_CANOPUS_ATRAC 0x0063 /* Canopus, co., Ltd. */
|
||||
#define WAVE_FORMAT_G726_ADPCM 0x0064 /* APICOM */
|
||||
#define WAVE_FORMAT_G722_ADPCM 0x0065 /* APICOM */
|
||||
#define WAVE_FORMAT_DSAT_DISPLAY 0x0067 /* Microsoft Corporation */
|
||||
#define WAVE_FORMAT_VOXWARE_BYTE_ALIGNED 0x0069 /* Voxware Inc */
|
||||
#define WAVE_FORMAT_VOXWARE_AC8 0x0070 /* Voxware Inc */
|
||||
#define WAVE_FORMAT_VOXWARE_AC10 0x0071 /* Voxware Inc */
|
||||
#define WAVE_FORMAT_VOXWARE_AC16 0x0072 /* Voxware Inc */
|
||||
#define WAVE_FORMAT_VOXWARE_AC20 0x0073 /* Voxware Inc */
|
||||
#define WAVE_FORMAT_VOXWARE_RT24 0x0074 /* Voxware Inc */
|
||||
#define WAVE_FORMAT_VOXWARE_RT29 0x0075 /* Voxware Inc */
|
||||
#define WAVE_FORMAT_VOXWARE_RT29HW 0x0076 /* Voxware Inc */
|
||||
#define WAVE_FORMAT_VOXWARE_VR12 0x0077 /* Voxware Inc */
|
||||
#define WAVE_FORMAT_VOXWARE_VR18 0x0078 /* Voxware Inc */
|
||||
#define WAVE_FORMAT_VOXWARE_TQ40 0x0079 /* Voxware Inc */
|
||||
#define WAVE_FORMAT_SOFTSOUND 0x0080 /* Softsound, Ltd. */
|
||||
#define WAVE_FORMAT_VOXWARE_TQ60 0x0081 /* Voxware Inc */
|
||||
#define WAVE_FORMAT_MSRT24 0x0082 /* Microsoft Corporation */
|
||||
#define WAVE_FORMAT_G729A 0x0083 /* AT&T Labs, Inc. */
|
||||
#define WAVE_FORMAT_MVI_MVI2 0x0084 /* Motion Pixels */
|
||||
#define WAVE_FORMAT_DF_G726 0x0085 /* DataFusion Systems (Pty) (Ltd) */
|
||||
#define WAVE_FORMAT_DF_GSM610 0x0086 /* DataFusion Systems (Pty) (Ltd) */
|
||||
#define WAVE_FORMAT_ISIAUDIO 0x0088 /* Iterated Systems, Inc. */
|
||||
#define WAVE_FORMAT_ONLIVE 0x0089 /* OnLive! Technologies, Inc. */
|
||||
#define WAVE_FORMAT_SBC24 0x0091 /* Siemens Business Communications Sys */
|
||||
#define WAVE_FORMAT_DOLBY_AC3_SPDIF 0x0092 /* Sonic Foundry */
|
||||
#define WAVE_FORMAT_MEDIASONIC_G723 0x0093 /* MediaSonic */
|
||||
#define WAVE_FORMAT_PROSODY_8KBPS 0x0094 /* Aculab plc */
|
||||
#define WAVE_FORMAT_ZYXEL_ADPCM 0x0097 /* ZyXEL Communications, Inc. */
|
||||
#define WAVE_FORMAT_PHILIPS_LPCBB 0x0098 /* Philips Speech Processing */
|
||||
#define WAVE_FORMAT_PACKED 0x0099 /* Studer Professional Audio AG */
|
||||
#define WAVE_FORMAT_MALDEN_PHONYTALK 0x00A0 /* Malden Electronics Ltd. */
|
||||
#define WAVE_FORMAT_RHETOREX_ADPCM 0x0100 /* Rhetorex Inc. */
|
||||
#define WAVE_FORMAT_IRAT 0x0101 /* BeCubed Software Inc. */
|
||||
#define WAVE_FORMAT_VIVO_G723 0x0111 /* Vivo Software */
|
||||
#define WAVE_FORMAT_VIVO_SIREN 0x0112 /* Vivo Software */
|
||||
#define WAVE_FORMAT_DIGITAL_G723 0x0123 /* Digital Equipment Corporation */
|
||||
#define WAVE_FORMAT_SANYO_LD_ADPCM 0x0125 /* Sanyo Electric Co., Ltd. */
|
||||
#define WAVE_FORMAT_SIPROLAB_ACEPLNET 0x0130 /* Sipro Lab Telecom Inc. */
|
||||
#define WAVE_FORMAT_SIPROLAB_ACELP4800 0x0131 /* Sipro Lab Telecom Inc. */
|
||||
#define WAVE_FORMAT_SIPROLAB_ACELP8V3 0x0132 /* Sipro Lab Telecom Inc. */
|
||||
#define WAVE_FORMAT_SIPROLAB_G729 0x0133 /* Sipro Lab Telecom Inc. */
|
||||
#define WAVE_FORMAT_SIPROLAB_G729A 0x0134 /* Sipro Lab Telecom Inc. */
|
||||
#define WAVE_FORMAT_SIPROLAB_KELVIN 0x0135 /* Sipro Lab Telecom Inc. */
|
||||
#define WAVE_FORMAT_G726ADPCM 0x0140 /* Dictaphone Corporation */
|
||||
#define WAVE_FORMAT_QUALCOMM_PUREVOICE 0x0150 /* Qualcomm, Inc. */
|
||||
#define WAVE_FORMAT_QUALCOMM_HALFRATE 0x0151 /* Qualcomm, Inc. */
|
||||
#define WAVE_FORMAT_TUBGSM 0x0155 /* Ring Zero Systems, Inc. */
|
||||
#define WAVE_FORMAT_MSAUDIO1 0x0160 /* Microsoft Corporation */
|
||||
#define WAVE_FORMAT_CREATIVE_ADPCM 0x0200 /* Creative Labs, Inc */
|
||||
#define WAVE_FORMAT_CREATIVE_FASTSPEECH8 0x0202 /* Creative Labs, Inc */
|
||||
#define WAVE_FORMAT_CREATIVE_FASTSPEECH10 0x0203 /* Creative Labs, Inc */
|
||||
#define WAVE_FORMAT_UHER_ADPCM 0x0210 /* UHER informatic GmbH */
|
||||
#define WAVE_FORMAT_QUARTERDECK 0x0220 /* Quarterdeck Corporation */
|
||||
#define WAVE_FORMAT_ILINK_VC 0x0230 /* I-link Worldwide */
|
||||
#define WAVE_FORMAT_RAW_SPORT 0x0240 /* Aureal Semiconductor */
|
||||
#define WAVE_FORMAT_IPI_HSX 0x0250 /* Interactive Products, Inc. */
|
||||
#define WAVE_FORMAT_IPI_RPELP 0x0251 /* Interactive Products, Inc. */
|
||||
#define WAVE_FORMAT_CS2 0x0260 /* Consistent Software */
|
||||
#define WAVE_FORMAT_SONY_SCX 0x0270 /* Sony Corp. */
|
||||
#define WAVE_FORMAT_FM_TOWNS_SND 0x0300 /* Fujitsu Corp. */
|
||||
#define WAVE_FORMAT_BTV_DIGITAL 0x0400 /* Brooktree Corporation */
|
||||
#define WAVE_FORMAT_QDESIGN_MUSIC 0x0450 /* QDesign Corporation */
|
||||
#define WAVE_FORMAT_VME_VMPCM 0x0680 /* AT&T Labs, Inc. */
|
||||
#define WAVE_FORMAT_TPC 0x0681 /* AT&T Labs, Inc. */
|
||||
#define WAVE_FORMAT_OLIGSM 0x1000 /* Ing C. Olivetti & C., S.p.A. */
|
||||
#define WAVE_FORMAT_OLIADPCM 0x1001 /* Ing C. Olivetti & C., S.p.A. */
|
||||
#define WAVE_FORMAT_OLICELP 0x1002 /* Ing C. Olivetti & C., S.p.A. */
|
||||
#define WAVE_FORMAT_OLISBC 0x1003 /* Ing C. Olivetti & C., S.p.A. */
|
||||
#define WAVE_FORMAT_OLIOPR 0x1004 /* Ing C. Olivetti & C., S.p.A. */
|
||||
#define WAVE_FORMAT_LH_CODEC 0x1100 /* Lernout & Hauspie */
|
||||
#define WAVE_FORMAT_NORRIS 0x1400 /* Norris Communications, Inc. */
|
||||
#define WAVE_FORMAT_SOUNDSPACE_MUSICOMPRESS 0x1500 /* AT&T Labs, Inc. */
|
||||
#define WAVE_FORMAT_DVM 0x2000 /* FAST Multimedia AG */
|
||||
|
||||
#if !defined(WAVE_FORMAT_EXTENSIBLE)
|
||||
#define WAVE_FORMAT_EXTENSIBLE 0xFFFE /* Microsoft */
|
||||
#endif // !defined(WAVE_FORMAT_EXTENSIBLE)
|
||||
//
|
||||
// the WAVE_FORMAT_DEVELOPMENT format tag can be used during the
|
||||
// development phase of a new wave format. Before shipping, you MUST
|
||||
// acquire an official format tag from Microsoft.
|
||||
//
|
||||
#define WAVE_FORMAT_DEVELOPMENT (0xFFFF)
|
||||
|
||||
|
||||
#endif /* MPLAYER_MMREG_H */
|
||||
@@ -1,149 +0,0 @@
|
||||
/*
|
||||
* Module definitions
|
||||
*
|
||||
* Copyright 1995 Alexandre Julliard
|
||||
*/
|
||||
|
||||
#ifndef MPLAYER_MODULE_H
|
||||
#define MPLAYER_MODULE_H
|
||||
|
||||
#include "windef.h"
|
||||
#include "pe_image.h"
|
||||
|
||||
|
||||
typedef struct {
|
||||
BYTE type;
|
||||
BYTE flags;
|
||||
BYTE segnum;
|
||||
WORD offs WINE_PACKED;
|
||||
} ET_ENTRY;
|
||||
|
||||
typedef struct {
|
||||
WORD first; /* ordinal */
|
||||
WORD last; /* ordinal */
|
||||
WORD next; /* bundle */
|
||||
} ET_BUNDLE;
|
||||
|
||||
|
||||
/* In-memory segment table */
|
||||
typedef struct
|
||||
{
|
||||
WORD filepos; /* Position in file, in sectors */
|
||||
WORD size; /* Segment size on disk */
|
||||
WORD flags; /* Segment flags */
|
||||
WORD minsize; /* Min. size of segment in memory */
|
||||
HANDLE16 hSeg; /* Selector or handle (selector - 1) */
|
||||
/* of segment in memory */
|
||||
} SEGTABLEENTRY;
|
||||
|
||||
|
||||
/* Self-loading modules contain this structure in their first segment */
|
||||
|
||||
#include "pshpack1.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
WORD version; /* Must be "A0" (0x3041) */
|
||||
WORD reserved;
|
||||
FARPROC16 BootApp; /* startup procedure */
|
||||
FARPROC16 LoadAppSeg; /* procedure to load a segment */
|
||||
FARPROC16 reserved2;
|
||||
FARPROC16 MyAlloc; /* memory allocation procedure,
|
||||
* wine must write this field */
|
||||
FARPROC16 EntryAddrProc;
|
||||
FARPROC16 ExitProc; /* exit procedure */
|
||||
WORD reserved3[4];
|
||||
FARPROC16 SetOwner; /* Set Owner procedure, exported by wine */
|
||||
} SELFLOADHEADER;
|
||||
|
||||
/* Parameters for LoadModule() */
|
||||
typedef struct
|
||||
{
|
||||
HGLOBAL16 hEnvironment; /* Environment segment */
|
||||
SEGPTR cmdLine WINE_PACKED; /* Command-line */
|
||||
SEGPTR showCmd WINE_PACKED; /* Code for ShowWindow() */
|
||||
SEGPTR reserved WINE_PACKED;
|
||||
} LOADPARAMS16;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
LPSTR lpEnvAddress;
|
||||
LPSTR lpCmdLine;
|
||||
UINT16 *lpCmdShow;
|
||||
DWORD dwReserved;
|
||||
} LOADPARAMS;
|
||||
|
||||
#include "poppack.h"
|
||||
|
||||
/* internal representation of 32bit modules. per process. */
|
||||
typedef enum {
|
||||
MODULE32_PE = 1,
|
||||
MODULE32_ELF,
|
||||
MODULE32_ELFDLL
|
||||
} MODULE32_TYPE;
|
||||
|
||||
typedef struct wine_modref
|
||||
{
|
||||
struct wine_modref *next;
|
||||
struct wine_modref *prev;
|
||||
MODULE32_TYPE type;
|
||||
union {
|
||||
PE_MODREF pe;
|
||||
ELF_MODREF elf;
|
||||
} binfmt;
|
||||
|
||||
HMODULE module;
|
||||
|
||||
int nDeps;
|
||||
struct wine_modref **deps;
|
||||
|
||||
int flags;
|
||||
int refCount;
|
||||
|
||||
char *filename;
|
||||
char *modname;
|
||||
char *short_filename;
|
||||
char *short_modname;
|
||||
} WINE_MODREF;
|
||||
|
||||
#define WINE_MODREF_INTERNAL 0x00000001
|
||||
#define WINE_MODREF_NO_DLL_CALLS 0x00000002
|
||||
#define WINE_MODREF_PROCESS_ATTACHED 0x00000004
|
||||
#define WINE_MODREF_LOAD_AS_DATAFILE 0x00000010
|
||||
#define WINE_MODREF_DONT_RESOLVE_REFS 0x00000020
|
||||
#define WINE_MODREF_MARKER 0x80000000
|
||||
|
||||
|
||||
|
||||
/* Resource types */
|
||||
typedef struct resource_typeinfo_s NE_TYPEINFO;
|
||||
typedef struct resource_nameinfo_s NE_NAMEINFO;
|
||||
|
||||
#define NE_SEG_TABLE(pModule) \
|
||||
((SEGTABLEENTRY *)((char *)(pModule) + (pModule)->seg_table))
|
||||
|
||||
#define NE_MODULE_TABLE(pModule) \
|
||||
((WORD *)((char *)(pModule) + (pModule)->modref_table))
|
||||
|
||||
#define NE_MODULE_NAME(pModule) \
|
||||
(((OFSTRUCT *)((char*)(pModule) + (pModule)->fileinfo))->szPathName)
|
||||
|
||||
struct modref_list_t;
|
||||
|
||||
typedef struct modref_list_t
|
||||
{
|
||||
WINE_MODREF* wm;
|
||||
struct modref_list_t *next;
|
||||
struct modref_list_t *prev;
|
||||
} modref_list;
|
||||
|
||||
|
||||
/* module.c */
|
||||
FARPROC MODULE_GetProcAddress( HMODULE hModule, LPCSTR function, WIN_BOOL snoop );
|
||||
WINE_MODREF *MODULE32_LookupHMODULE( HMODULE hModule );
|
||||
WINE_MODREF *MODULE_FindModule( LPCSTR path );
|
||||
|
||||
/* resource.c */
|
||||
INT WINAPI AccessResource( HMODULE, HRSRC );
|
||||
|
||||
#endif /* MPLAYER_MODULE_H */
|
||||
@@ -1,935 +0,0 @@
|
||||
/*
|
||||
* msacm.h - Declarations for MSACM
|
||||
*/
|
||||
|
||||
#ifndef MPLAYER_MSACM_H
|
||||
#define MPLAYER_MSACM_H
|
||||
|
||||
#include "windef.h"
|
||||
#include "driver.h"
|
||||
#include "mmreg.h"
|
||||
|
||||
//typedef WORD VERSION; /* major (high byte), minor (low byte) */
|
||||
|
||||
typedef UINT16 MMVERSION16;
|
||||
typedef UINT MMVERSION;
|
||||
typedef UINT16 MCIDEVICEID16;
|
||||
typedef UINT MCIDEVICEID;
|
||||
typedef UINT16 MMRESULT16;
|
||||
typedef UINT MMRESULT;
|
||||
typedef DWORD FOURCC; /* a four character code */
|
||||
|
||||
|
||||
|
||||
#if !defined(WAVE_FORMAT_PCM)
|
||||
#define WAVE_FORMAT_PCM 1
|
||||
#endif
|
||||
|
||||
/***********************************************************************
|
||||
* Defines/Enums
|
||||
*/
|
||||
|
||||
#define ACMERR_BASE 512
|
||||
#define ACMERR_NOTPOSSIBLE (ACMERR_BASE + 0)
|
||||
#define ACMERR_BUSY (ACMERR_BASE + 1)
|
||||
#define ACMERR_UNPREPARED (ACMERR_BASE + 2)
|
||||
#define ACMERR_CANCELED (ACMERR_BASE + 3)
|
||||
|
||||
#define MM_ACM_OPEN MM_STREAM_OPEN
|
||||
#define MM_ACM_CLOSE MM_STREAM_CLOSE
|
||||
#define MM_ACM_DONE MM_STREAM_DONE
|
||||
|
||||
#define ACM_DRIVERADDF_FUNCTION 0x00000003L
|
||||
#define ACM_DRIVERADDF_NOTIFYHWND 0x00000004L
|
||||
#define ACM_DRIVERADDF_TYPEMASK 0x00000007L
|
||||
#define ACM_DRIVERADDF_LOCAL 0x00000000L
|
||||
#define ACM_DRIVERADDF_GLOBAL 0x00000008L
|
||||
|
||||
#define ACMDRIVERDETAILS_SHORTNAME_CHARS 32
|
||||
#define ACMDRIVERDETAILS_LONGNAME_CHARS 128
|
||||
#define ACMDRIVERDETAILS_COPYRIGHT_CHARS 80
|
||||
#define ACMDRIVERDETAILS_LICENSING_CHARS 128
|
||||
#define ACMDRIVERDETAILS_FEATURES_CHARS 512
|
||||
|
||||
#define ACMDRIVERDETAILS_FCCTYPE_AUDIOCODEC mmioFOURCC('a', 'u', 'd', 'c')
|
||||
#define ACMDRIVERDETAILS_FCCCOMP_UNDEFINED mmioFOURCC('\0', '\0', '\0', '\0')
|
||||
|
||||
#define ACMDRIVERDETAILS_SUPPORTF_CODEC 0x00000001L
|
||||
#define ACMDRIVERDETAILS_SUPPORTF_CONVERTER 0x00000002L
|
||||
#define ACMDRIVERDETAILS_SUPPORTF_FILTER 0x00000004L
|
||||
#define ACMDRIVERDETAILS_SUPPORTF_HARDWARE 0x00000008L
|
||||
#define ACMDRIVERDETAILS_SUPPORTF_ASYNC 0x00000010L
|
||||
#define ACMDRIVERDETAILS_SUPPORTF_LOCAL 0x40000000L
|
||||
#define ACMDRIVERDETAILS_SUPPORTF_DISABLED 0x80000000L
|
||||
|
||||
#define ACM_DRIVERENUMF_NOLOCAL 0x40000000L
|
||||
#define ACM_DRIVERENUMF_DISABLED 0x80000000L
|
||||
|
||||
#define ACM_DRIVERPRIORITYF_ENABLE 0x00000001L
|
||||
#define ACM_DRIVERPRIORITYF_DISABLE 0x00000002L
|
||||
#define ACM_DRIVERPRIORITYF_ABLEMASK 0x00000003L
|
||||
#define ACM_DRIVERPRIORITYF_BEGIN 0x00010000L
|
||||
#define ACM_DRIVERPRIORITYF_END 0x00020000L
|
||||
#define ACM_DRIVERPRIORITYF_DEFERMASK 0x00030000L
|
||||
|
||||
#define MM_ACM_FILTERCHOOSE 0x8000
|
||||
|
||||
#define FILTERCHOOSE_MESSAGE 0
|
||||
#define FILTERCHOOSE_FILTERTAG_VERIFY (FILTERCHOOSE_MESSAGE+0)
|
||||
#define FILTERCHOOSE_FILTER_VERIFY (FILTERCHOOSE_MESSAGE+1)
|
||||
#define FILTERCHOOSE_CUSTOM_VERIFY (FILTERCHOOSE_MESSAGE+2)
|
||||
|
||||
#define ACMFILTERCHOOSE_STYLEF_SHOWHELP 0x00000004L
|
||||
#define ACMFILTERCHOOSE_STYLEF_ENABLEHOOK 0x00000008L
|
||||
#define ACMFILTERCHOOSE_STYLEF_ENABLETEMPLATE 0x00000010L
|
||||
#define ACMFILTERCHOOSE_STYLEF_ENABLETEMPLATEHANDLE 0x00000020L
|
||||
#define ACMFILTERCHOOSE_STYLEF_INITTOFILTERSTRUCT 0x00000040L
|
||||
#define ACMFILTERCHOOSE_STYLEF_CONTEXTHELP 0x00000080L
|
||||
|
||||
#define ACMFILTERDETAILS_FILTER_CHARS 128
|
||||
|
||||
#define ACM_FILTERDETAILSF_INDEX 0x00000000L
|
||||
#define ACM_FILTERDETAILSF_FILTER 0x00000001L
|
||||
#define ACM_FILTERDETAILSF_QUERYMASK 0x0000000FL
|
||||
|
||||
#define ACMFILTERTAGDETAILS_FILTERTAG_CHARS 48
|
||||
|
||||
#define ACM_FILTERTAGDETAILSF_INDEX 0x00000000L
|
||||
#define ACM_FILTERTAGDETAILSF_FILTERTAG 0x00000001L
|
||||
#define ACM_FILTERTAGDETAILSF_LARGESTSIZE 0x00000002L
|
||||
#define ACM_FILTERTAGDETAILSF_QUERYMASK 0x0000000FL
|
||||
|
||||
#define ACM_FILTERENUMF_DWFILTERTAG 0x00010000L
|
||||
|
||||
#define ACMHELPMSGSTRINGA "acmchoose_help"
|
||||
#define ACMHELPMSGSTRINGW L"acmchoose_help"
|
||||
#define ACMHELPMSGSTRING16 "acmchoose_help"
|
||||
|
||||
#define ACMHELPMSGCONTEXTMENUA "acmchoose_contextmenu"
|
||||
#define ACMHELPMSGCONTEXTMENUW L"acmchoose_contextmenu"
|
||||
#define ACMHELPMSGCONTEXTMENU16 "acmchoose_contextmenu"
|
||||
|
||||
#define ACMHELPMSGCONTEXTHELPA "acmchoose_contexthelp"
|
||||
#define ACMHELPMSGCONTEXTHELPW L"acmchoose_contexthelp"
|
||||
#define ACMHELPMSGCONTEXTHELP16 "acmchoose_contexthelp"
|
||||
|
||||
#define MM_ACM_FORMATCHOOSE 0x8000
|
||||
|
||||
#define FORMATCHOOSE_MESSAGE 0
|
||||
#define FORMATCHOOSE_FORMATTAG_VERIFY (FORMATCHOOSE_MESSAGE+0)
|
||||
#define FORMATCHOOSE_FORMAT_VERIFY (FORMATCHOOSE_MESSAGE+1)
|
||||
#define FORMATCHOOSE_CUSTOM_VERIFY (FORMATCHOOSE_MESSAGE+2)
|
||||
|
||||
#define ACMFORMATCHOOSE_STYLEF_SHOWHELP 0x00000004L
|
||||
#define ACMFORMATCHOOSE_STYLEF_ENABLEHOOK 0x00000008L
|
||||
#define ACMFORMATCHOOSE_STYLEF_ENABLETEMPLATE 0x00000010L
|
||||
#define ACMFORMATCHOOSE_STYLEF_ENABLETEMPLATEHANDLE 0x00000020L
|
||||
#define ACMFORMATCHOOSE_STYLEF_INITTOWFXSTRUCT 0x00000040L
|
||||
#define ACMFORMATCHOOSE_STYLEF_CONTEXTHELP 0x00000080L
|
||||
|
||||
#define ACMFORMATDETAILS_FORMAT_CHARS 128
|
||||
|
||||
#define ACM_FORMATDETAILSF_INDEX 0x00000000L
|
||||
#define ACM_FORMATDETAILSF_FORMAT 0x00000001L
|
||||
#define ACM_FORMATDETAILSF_QUERYMASK 0x0000000FL
|
||||
|
||||
#define ACM_FORMATENUMF_WFORMATTAG 0x00010000L
|
||||
#define ACM_FORMATENUMF_NCHANNELS 0x00020000L
|
||||
#define ACM_FORMATENUMF_NSAMPLESPERSEC 0x00040000L
|
||||
#define ACM_FORMATENUMF_WBITSPERSAMPLE 0x00080000L
|
||||
#define ACM_FORMATENUMF_CONVERT 0x00100000L
|
||||
#define ACM_FORMATENUMF_SUGGEST 0x00200000L
|
||||
#define ACM_FORMATENUMF_HARDWARE 0x00400000L
|
||||
#define ACM_FORMATENUMF_INPUT 0x00800000L
|
||||
#define ACM_FORMATENUMF_OUTPUT 0x01000000L
|
||||
|
||||
#define ACM_FORMATSUGGESTF_WFORMATTAG 0x00010000L
|
||||
#define ACM_FORMATSUGGESTF_NCHANNELS 0x00020000L
|
||||
#define ACM_FORMATSUGGESTF_NSAMPLESPERSEC 0x00040000L
|
||||
#define ACM_FORMATSUGGESTF_WBITSPERSAMPLE 0x00080000L
|
||||
#define ACM_FORMATSUGGESTF_TYPEMASK 0x00FF0000L
|
||||
|
||||
#define ACMFORMATTAGDETAILS_FORMATTAG_CHARS 48
|
||||
|
||||
#define ACM_FORMATTAGDETAILSF_INDEX 0x00000000L
|
||||
#define ACM_FORMATTAGDETAILSF_FORMATTAG 0x00000001L
|
||||
#define ACM_FORMATTAGDETAILSF_LARGESTSIZE 0x00000002L
|
||||
#define ACM_FORMATTAGDETAILSF_QUERYMASK 0x0000000FL
|
||||
|
||||
#define ACM_METRIC_COUNT_DRIVERS 1
|
||||
#define ACM_METRIC_COUNT_CODECS 2
|
||||
#define ACM_METRIC_COUNT_CONVERTERS 3
|
||||
#define ACM_METRIC_COUNT_FILTERS 4
|
||||
#define ACM_METRIC_COUNT_DISABLED 5
|
||||
#define ACM_METRIC_COUNT_HARDWARE 6
|
||||
#define ACM_METRIC_COUNT_LOCAL_DRIVERS 20
|
||||
#define ACM_METRIC_COUNT_LOCAL_CODECS 21
|
||||
#define ACM_METRIC_COUNT_LOCAL_CONVERTERS 22
|
||||
#define ACM_METRIC_COUNT_LOCAL_FILTERS 23
|
||||
#define ACM_METRIC_COUNT_LOCAL_DISABLED 24
|
||||
#define ACM_METRIC_HARDWARE_WAVE_INPUT 30
|
||||
#define ACM_METRIC_HARDWARE_WAVE_OUTPUT 31
|
||||
#define ACM_METRIC_MAX_SIZE_FORMAT 50
|
||||
#define ACM_METRIC_MAX_SIZE_FILTER 51
|
||||
#define ACM_METRIC_DRIVER_SUPPORT 100
|
||||
#define ACM_METRIC_DRIVER_PRIORITY 101
|
||||
|
||||
#define ACM_STREAMCONVERTF_BLOCKALIGN 0x00000004
|
||||
#define ACM_STREAMCONVERTF_START 0x00000010
|
||||
#define ACM_STREAMCONVERTF_END 0x00000020
|
||||
|
||||
#define ACMSTREAMHEADER_STATUSF_DONE 0x00010000L
|
||||
#define ACMSTREAMHEADER_STATUSF_PREPARED 0x00020000L
|
||||
#define ACMSTREAMHEADER_STATUSF_INQUEUE 0x00100000L
|
||||
|
||||
#define ACM_STREAMOPENF_QUERY 0x00000001
|
||||
#define ACM_STREAMOPENF_ASYNC 0x00000002
|
||||
#define ACM_STREAMOPENF_NONREALTIME 0x00000004
|
||||
|
||||
#define ACM_STREAMSIZEF_SOURCE 0x00000000L
|
||||
#define ACM_STREAMSIZEF_DESTINATION 0x00000001L
|
||||
#define ACM_STREAMSIZEF_QUERYMASK 0x0000000FL
|
||||
|
||||
#define ACMDM_USER (DRV_USER + 0x0000)
|
||||
#define ACMDM_RESERVED_LOW (DRV_USER + 0x2000)
|
||||
#define ACMDM_RESERVED_HIGH (DRV_USER + 0x2FFF)
|
||||
|
||||
#define ACMDM_BASE ACMDM_RESERVED_LOW
|
||||
|
||||
#define ACMDM_DRIVER_ABOUT (ACMDM_BASE + 11)
|
||||
|
||||
/***********************************************************************
|
||||
* Callbacks
|
||||
*/
|
||||
|
||||
typedef WIN_BOOL CALLBACK ( *ACMDRIVERENUMCB)(
|
||||
HACMDRIVERID hadid, DWORD dwInstance, DWORD fdwSupport
|
||||
);
|
||||
|
||||
typedef WIN_BOOL16 CALLBACK ( *ACMDRIVERENUMCB16)(
|
||||
HACMDRIVERID16 hadid, DWORD dwInstance, DWORD fdwSupport
|
||||
);
|
||||
|
||||
typedef UINT CALLBACK ( *ACMFILTERCHOOSEHOOKPROCA)(
|
||||
HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam
|
||||
);
|
||||
|
||||
typedef UINT CALLBACK ( *ACMFILTERCHOOSEHOOKPROCW)(
|
||||
HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam
|
||||
);
|
||||
|
||||
typedef UINT CALLBACK ( *ACMFILTERCHOOSEHOOKPROC16)(
|
||||
HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam
|
||||
);
|
||||
|
||||
typedef UINT CALLBACK ( *ACMFORMATCHOOSEHOOKPROCA)(
|
||||
HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam
|
||||
);
|
||||
|
||||
typedef UINT CALLBACK ( *ACMFORMATCHOOSEHOOKPROCW)(
|
||||
HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam
|
||||
);
|
||||
|
||||
typedef UINT16 CALLBACK ( *ACMFORMATCHOOSEHOOKPROC16)(
|
||||
HWND16 hwnd, UINT16 uMsg, WPARAM16 wParam, LPARAM lParam
|
||||
);
|
||||
|
||||
/***********************************************************************
|
||||
* Structures
|
||||
*/
|
||||
|
||||
typedef struct ACMDRIVERDETAILSA
|
||||
{
|
||||
DWORD cbStruct;
|
||||
|
||||
FOURCC fccType;
|
||||
FOURCC fccComp;
|
||||
|
||||
WORD wMid;
|
||||
WORD wPid;
|
||||
|
||||
DWORD vdwACM;
|
||||
DWORD vdwDriver;
|
||||
|
||||
DWORD fdwSupport;
|
||||
DWORD cFormatTags;
|
||||
DWORD cFilterTags;
|
||||
|
||||
HICON hicon;
|
||||
|
||||
CHAR szShortName[ACMDRIVERDETAILS_SHORTNAME_CHARS];
|
||||
CHAR szLongName[ACMDRIVERDETAILS_LONGNAME_CHARS];
|
||||
CHAR szCopyright[ACMDRIVERDETAILS_COPYRIGHT_CHARS];
|
||||
CHAR szLicensing[ACMDRIVERDETAILS_LICENSING_CHARS];
|
||||
CHAR szFeatures[ACMDRIVERDETAILS_FEATURES_CHARS];
|
||||
} ACMDRIVERDETAILSA, *PACMDRIVERDETAILSA;
|
||||
|
||||
typedef struct ACMDRIVERDETAILSW
|
||||
{
|
||||
DWORD cbStruct;
|
||||
|
||||
FOURCC fccType;
|
||||
FOURCC fccComp;
|
||||
|
||||
WORD wMid;
|
||||
WORD wPid;
|
||||
|
||||
DWORD vdwACM;
|
||||
DWORD vdwDriver;
|
||||
|
||||
DWORD fdwSupport;
|
||||
DWORD cFormatTags;
|
||||
DWORD cFilterTags;
|
||||
|
||||
HICON hicon;
|
||||
|
||||
WCHAR szShortName[ACMDRIVERDETAILS_SHORTNAME_CHARS];
|
||||
WCHAR szLongName[ACMDRIVERDETAILS_LONGNAME_CHARS];
|
||||
WCHAR szCopyright[ACMDRIVERDETAILS_COPYRIGHT_CHARS];
|
||||
WCHAR szLicensing[ACMDRIVERDETAILS_LICENSING_CHARS];
|
||||
WCHAR szFeatures[ACMDRIVERDETAILS_FEATURES_CHARS];
|
||||
} ACMDRIVERDETAILSW, *PACMDRIVERDETAILSW;
|
||||
|
||||
typedef struct ACMDRIVERDETAILS16
|
||||
{
|
||||
DWORD cbStruct;
|
||||
|
||||
FOURCC fccType;
|
||||
FOURCC fccComp;
|
||||
|
||||
WORD wMid;
|
||||
WORD wPid;
|
||||
|
||||
DWORD vdwACM;
|
||||
DWORD vdwDriver;
|
||||
|
||||
DWORD fdwSupport;
|
||||
DWORD cFormatTags;
|
||||
DWORD cFilterTags;
|
||||
|
||||
HICON16 hicon;
|
||||
|
||||
CHAR szShortName[ACMDRIVERDETAILS_SHORTNAME_CHARS];
|
||||
CHAR szLongName[ACMDRIVERDETAILS_LONGNAME_CHARS];
|
||||
CHAR szCopyright[ACMDRIVERDETAILS_COPYRIGHT_CHARS];
|
||||
CHAR szLicensing[ACMDRIVERDETAILS_LICENSING_CHARS];
|
||||
CHAR szFeatures[ACMDRIVERDETAILS_FEATURES_CHARS];
|
||||
} ACMDRIVERDETAILS16, *NPACMDRIVERDETAILS16, *LPACMDRIVERDETAILS16;
|
||||
|
||||
typedef struct ACMFILTERCHOOSEA
|
||||
{
|
||||
DWORD cbStruct;
|
||||
DWORD fdwStyle;
|
||||
|
||||
HWND hwndOwner;
|
||||
|
||||
PWAVEFILTER pwfltr;
|
||||
DWORD cbwfltr;
|
||||
|
||||
LPCSTR pszTitle;
|
||||
|
||||
CHAR szFilterTag[ACMFILTERTAGDETAILS_FILTERTAG_CHARS];
|
||||
CHAR szFilter[ACMFILTERDETAILS_FILTER_CHARS];
|
||||
LPSTR pszName;
|
||||
DWORD cchName;
|
||||
|
||||
DWORD fdwEnum;
|
||||
PWAVEFILTER pwfltrEnum;
|
||||
|
||||
HINSTANCE hInstance;
|
||||
LPCSTR pszTemplateName;
|
||||
LPARAM lCustData;
|
||||
ACMFILTERCHOOSEHOOKPROCA pfnHook;
|
||||
} ACMFILTERCHOOSEA, *PACMFILTERCHOOSEA;
|
||||
|
||||
typedef struct ACMFILTERCHOOSEW
|
||||
{
|
||||
DWORD cbStruct;
|
||||
DWORD fdwStyle;
|
||||
|
||||
HWND hwndOwner;
|
||||
|
||||
PWAVEFILTER pwfltr;
|
||||
DWORD cbwfltr;
|
||||
|
||||
LPCWSTR pszTitle;
|
||||
|
||||
WCHAR szFilterTag[ACMFILTERTAGDETAILS_FILTERTAG_CHARS];
|
||||
WCHAR szFilter[ACMFILTERDETAILS_FILTER_CHARS];
|
||||
LPWSTR pszName;
|
||||
DWORD cchName;
|
||||
|
||||
DWORD fdwEnum;
|
||||
PWAVEFILTER pwfltrEnum;
|
||||
|
||||
HINSTANCE hInstance;
|
||||
LPCWSTR pszTemplateName;
|
||||
LPARAM lCustData;
|
||||
ACMFILTERCHOOSEHOOKPROCW pfnHook;
|
||||
} ACMFILTERCHOOSEW, *PACMFILTERCHOOSEW;
|
||||
|
||||
typedef struct ACMFILTERCHOOSE16
|
||||
{
|
||||
DWORD cbStruct;
|
||||
DWORD fdwStyle;
|
||||
|
||||
HWND16 hwndOwner;
|
||||
|
||||
LPWAVEFILTER pwfltr;
|
||||
DWORD cbwfltr;
|
||||
|
||||
LPCSTR pszTitle;
|
||||
|
||||
char szFilterTag[ACMFILTERTAGDETAILS_FILTERTAG_CHARS];
|
||||
char szFilter[ACMFILTERDETAILS_FILTER_CHARS];
|
||||
LPSTR pszName;
|
||||
DWORD cchName;
|
||||
|
||||
DWORD fdwEnum;
|
||||
LPWAVEFILTER pwfltrEnum;
|
||||
|
||||
HINSTANCE16 hInstance;
|
||||
LPCSTR pszTemplateName;
|
||||
LPARAM lCustData;
|
||||
ACMFILTERCHOOSEHOOKPROC16 pfnHook;
|
||||
} ACMFILTERCHOOSE16, *NPACMFILTERCHOOSE16, *LPACMFILTERCHOOSE16;
|
||||
|
||||
typedef struct ACMFILTERDETAILSA
|
||||
{
|
||||
DWORD cbStruct;
|
||||
DWORD dwFilterIndex;
|
||||
DWORD dwFilterTag;
|
||||
DWORD fdwSupport;
|
||||
PWAVEFILTER pwfltr;
|
||||
DWORD cbwfltr;
|
||||
CHAR szFilter[ACMFILTERDETAILS_FILTER_CHARS];
|
||||
} ACMFILTERDETAILSA, *PACMFILTERDETAILSA;
|
||||
|
||||
typedef struct ACMFILTERDETAILSW
|
||||
{
|
||||
DWORD cbStruct;
|
||||
DWORD dwFilterIndex;
|
||||
DWORD dwFilterTag;
|
||||
DWORD fdwSupport;
|
||||
PWAVEFILTER pwfltr;
|
||||
DWORD cbwfltr;
|
||||
WCHAR szFilter[ACMFILTERDETAILS_FILTER_CHARS];
|
||||
} ACMFILTERDETAILSW, *PACMFILTERDETAILSW;
|
||||
|
||||
typedef struct ACMFILTERDETAILS16
|
||||
{
|
||||
DWORD cbStruct;
|
||||
DWORD dwFilterIndex;
|
||||
DWORD dwFilterTag;
|
||||
DWORD fdwSupport;
|
||||
LPWAVEFILTER pwfltr;
|
||||
DWORD cbwfltr;
|
||||
CHAR szFilter[ACMFILTERDETAILS_FILTER_CHARS];
|
||||
} ACMFILTERDETAILS16, *NPACMFILTERDETAILS16, *LPACMFILTERDETAILS16;
|
||||
|
||||
typedef struct ACMFILTERTAGDETAILSA
|
||||
{
|
||||
DWORD cbStruct;
|
||||
DWORD dwFilterTagIndex;
|
||||
DWORD dwFilterTag;
|
||||
DWORD cbFilterSize;
|
||||
DWORD fdwSupport;
|
||||
DWORD cStandardFilters;
|
||||
CHAR szFilterTag[ACMFILTERTAGDETAILS_FILTERTAG_CHARS];
|
||||
} ACMFILTERTAGDETAILSA, *PACMFILTERTAGDETAILSA;
|
||||
|
||||
typedef struct ACMFILTERTAGDETAILSW
|
||||
{
|
||||
DWORD cbStruct;
|
||||
DWORD dwFilterTagIndex;
|
||||
DWORD dwFilterTag;
|
||||
DWORD cbFilterSize;
|
||||
DWORD fdwSupport;
|
||||
DWORD cStandardFilters;
|
||||
WCHAR szFilterTag[ACMFILTERTAGDETAILS_FILTERTAG_CHARS];
|
||||
} ACMFILTERTAGDETAILSW, *PACMFILTERTAGDETAILSW;
|
||||
|
||||
typedef struct ACMFILTERTAGDETAILS16
|
||||
{
|
||||
DWORD cbStruct;
|
||||
DWORD dwFilterTagIndex;
|
||||
DWORD dwFilterTag;
|
||||
DWORD cbFilterSize;
|
||||
DWORD fdwSupport;
|
||||
DWORD cStandardFilters;
|
||||
CHAR szFilterTag[ACMFILTERTAGDETAILS_FILTERTAG_CHARS];
|
||||
} ACMFILTERTAGDETAILS16, *NPACMFILTERTAGDETAILS16, *LPACMFILTERTAGDETAILS16;
|
||||
|
||||
typedef struct ACMFORMATCHOOSEA
|
||||
{
|
||||
DWORD cbStruct;
|
||||
DWORD fdwStyle;
|
||||
|
||||
HWND hwndOwner;
|
||||
|
||||
PWAVEFORMATEX pwfx;
|
||||
DWORD cbwfx;
|
||||
LPCSTR pszTitle;
|
||||
|
||||
CHAR szFormatTag[ACMFORMATTAGDETAILS_FORMATTAG_CHARS];
|
||||
CHAR szFormat[ACMFORMATDETAILS_FORMAT_CHARS];
|
||||
|
||||
LPSTR pszName;
|
||||
DWORD cchName;
|
||||
|
||||
DWORD fdwEnum;
|
||||
PWAVEFORMATEX pwfxEnum;
|
||||
|
||||
HINSTANCE hInstance;
|
||||
LPCSTR pszTemplateName;
|
||||
LPARAM lCustData;
|
||||
ACMFORMATCHOOSEHOOKPROCA pfnHook;
|
||||
} ACMFORMATCHOOSEA, *PACMFORMATCHOOSEA;
|
||||
|
||||
typedef struct ACMFORMATCHOOSEW
|
||||
{
|
||||
DWORD cbStruct;
|
||||
DWORD fdwStyle;
|
||||
|
||||
HWND hwndOwner;
|
||||
|
||||
PWAVEFORMATEX pwfx;
|
||||
DWORD cbwfx;
|
||||
LPCWSTR pszTitle;
|
||||
|
||||
WCHAR szFormatTag[ACMFORMATTAGDETAILS_FORMATTAG_CHARS];
|
||||
WCHAR szFormat[ACMFORMATDETAILS_FORMAT_CHARS];
|
||||
|
||||
LPWSTR pszName;
|
||||
DWORD cchName;
|
||||
|
||||
DWORD fdwEnum;
|
||||
LPWAVEFORMATEX pwfxEnum;
|
||||
|
||||
HINSTANCE hInstance;
|
||||
LPCWSTR pszTemplateName;
|
||||
LPARAM lCustData;
|
||||
ACMFORMATCHOOSEHOOKPROCW pfnHook;
|
||||
} ACMFORMATCHOOSEW, *PACMFORMATCHOOSEW;
|
||||
|
||||
typedef struct ACMFORMATCHOOSE16
|
||||
{
|
||||
DWORD cbStruct;
|
||||
DWORD fdwStyle;
|
||||
|
||||
HWND16 hwndOwner;
|
||||
|
||||
LPWAVEFORMATEX pwfx;
|
||||
DWORD cbwfx;
|
||||
LPCSTR pszTitle;
|
||||
|
||||
CHAR szFormatTag[ACMFORMATTAGDETAILS_FORMATTAG_CHARS];
|
||||
CHAR szFormat[ACMFORMATDETAILS_FORMAT_CHARS];
|
||||
|
||||
LPSTR pszName;
|
||||
DWORD cchName;
|
||||
|
||||
DWORD fdwEnum;
|
||||
LPWAVEFORMATEX pwfxEnum;
|
||||
|
||||
HINSTANCE16 hInstance;
|
||||
LPCSTR pszTemplateName;
|
||||
LPARAM lCustData;
|
||||
ACMFORMATCHOOSEHOOKPROC16 pfnHook;
|
||||
} ACMFORMATCHOOSE16, *NPACMFORMATCHOOSE16, *LPACMFORMATCHOOSE16;
|
||||
|
||||
typedef struct ACMFORMATDETAILSA
|
||||
{
|
||||
DWORD cbStruct;
|
||||
DWORD dwFormatIndex;
|
||||
DWORD dwFormatTag;
|
||||
DWORD fdwSupport;
|
||||
PWAVEFORMATEX pwfx;
|
||||
DWORD cbwfx;
|
||||
CHAR szFormat[ACMFORMATDETAILS_FORMAT_CHARS];
|
||||
} ACMFORMATDETAILSA, *PACMFORMATDETAILSA;
|
||||
|
||||
typedef struct ACMFORMATDETAILSW
|
||||
{
|
||||
DWORD cbStruct;
|
||||
DWORD dwFormatIndex;
|
||||
DWORD dwFormatTag;
|
||||
DWORD fdwSupport;
|
||||
PWAVEFORMATEX pwfx;
|
||||
DWORD cbwfx;
|
||||
WCHAR szFormat[ACMFORMATDETAILS_FORMAT_CHARS];
|
||||
} ACMFORMATDETAILSW, *PACMFORMATDETAILSW;
|
||||
|
||||
typedef struct ACMFORMATDETAILS16
|
||||
{
|
||||
DWORD cbStruct;
|
||||
DWORD dwFormatIndex;
|
||||
DWORD dwFormatTag;
|
||||
DWORD fdwSupport;
|
||||
LPWAVEFORMATEX pwfx;
|
||||
DWORD cbwfx;
|
||||
CHAR szFormat[ACMFORMATDETAILS_FORMAT_CHARS];
|
||||
} ACMFORMATDETAILS16, *NPACMFORMATDETAILS16, *LPACMFORMATDETAILS16;
|
||||
|
||||
typedef struct ACMFORMATTAGDETAILSA
|
||||
{
|
||||
DWORD cbStruct;
|
||||
DWORD dwFormatTagIndex;
|
||||
DWORD dwFormatTag;
|
||||
DWORD cbFormatSize;
|
||||
DWORD fdwSupport;
|
||||
DWORD cStandardFormats;
|
||||
CHAR szFormatTag[ACMFORMATTAGDETAILS_FORMATTAG_CHARS];
|
||||
} ACMFORMATTAGDETAILSA, *PACMFORMATTAGDETAILSA;
|
||||
|
||||
typedef struct ACMFORMATTAGDETAILSW
|
||||
{
|
||||
DWORD cbStruct;
|
||||
DWORD dwFormatTagIndex;
|
||||
DWORD dwFormatTag;
|
||||
DWORD cbFormatSize;
|
||||
DWORD fdwSupport;
|
||||
DWORD cStandardFormats;
|
||||
WCHAR szFormatTag[ACMFORMATTAGDETAILS_FORMATTAG_CHARS];
|
||||
} ACMFORMATTAGDETAILSW, *PACMFORMATTAGDETAILSW;
|
||||
|
||||
typedef struct ACMFORMATTAGDETAILS16
|
||||
{
|
||||
DWORD cbStruct;
|
||||
DWORD dwFormatTagIndex;
|
||||
DWORD dwFormatTag;
|
||||
DWORD cbFormatSize;
|
||||
DWORD fdwSupport;
|
||||
DWORD cStandardFormats;
|
||||
CHAR szFormatTag[ACMFORMATTAGDETAILS_FORMATTAG_CHARS];
|
||||
} ACMFORMATTAGDETAILS16, *NPACMFORMATTAGDETAILS16, *LPACMFORMATTAGDETAILS16;
|
||||
|
||||
typedef struct ACMSTREAMHEADER
|
||||
{
|
||||
DWORD cbStruct;
|
||||
DWORD fdwStatus;
|
||||
DWORD dwUser;
|
||||
LPBYTE pbSrc;
|
||||
DWORD cbSrcLength;
|
||||
DWORD cbSrcLengthUsed;
|
||||
DWORD dwSrcUser;
|
||||
LPBYTE pbDst;
|
||||
DWORD cbDstLength;
|
||||
DWORD cbDstLengthUsed;
|
||||
DWORD dwDstUser;
|
||||
DWORD dwReservedDriver[10];
|
||||
} ACMSTREAMHEADER16, *NPACMSTREAMHEADER16, *LPACMSTREAMHEADER16,
|
||||
ACMSTREAMHEADER, *PACMSTREAMHEADER;
|
||||
|
||||
/***********************************************************************
|
||||
* Callbacks 2
|
||||
*/
|
||||
|
||||
typedef WIN_BOOL CALLBACK ( *ACMFILTERENUMCBA)(
|
||||
HACMDRIVERID hadid, PACMFILTERDETAILSA pafd,
|
||||
DWORD dwInstance, DWORD fdwSupport
|
||||
);
|
||||
|
||||
typedef WIN_BOOL CALLBACK ( *ACMFILTERENUMCBW)(
|
||||
HACMDRIVERID hadid, PACMFILTERDETAILSW pafd,
|
||||
DWORD dwInstance, DWORD fdwSupport
|
||||
);
|
||||
|
||||
typedef WIN_BOOL16 CALLBACK ( *ACMFILTERENUMCB16)(
|
||||
HACMDRIVERID16 hadid, LPACMFILTERDETAILS16 pafd,
|
||||
DWORD dwInstance, DWORD fdwSupport
|
||||
);
|
||||
|
||||
typedef WIN_BOOL CALLBACK ( *ACMFILTERTAGENUMCBA)(
|
||||
HACMDRIVERID hadid, PACMFILTERTAGDETAILSA paftd,
|
||||
DWORD dwInstance, DWORD fdwSupport
|
||||
);
|
||||
|
||||
typedef WIN_BOOL CALLBACK ( *ACMFILTERTAGENUMCBW)(
|
||||
HACMDRIVERID hadid, PACMFILTERTAGDETAILSW paftd,
|
||||
DWORD dwInstance, DWORD fdwSupport
|
||||
);
|
||||
|
||||
typedef WIN_BOOL16 CALLBACK ( *ACMFILTERTAGENUMCB16)(
|
||||
HACMDRIVERID16 hadid, LPACMFILTERTAGDETAILS16 paftd,
|
||||
DWORD dwInstance, DWORD fdwSupport
|
||||
);
|
||||
|
||||
typedef WIN_BOOL CALLBACK ( *ACMFORMATENUMCBA)(
|
||||
HACMDRIVERID hadid, PACMFORMATDETAILSA pafd,
|
||||
DWORD dwInstance, DWORD fdwSupport
|
||||
);
|
||||
|
||||
typedef WIN_BOOL CALLBACK ( *ACMFORMATENUMCBW)(
|
||||
HACMDRIVERID hadid, PACMFORMATDETAILSW pafd,
|
||||
DWORD dwInstance, DWORD fdwSupport
|
||||
);
|
||||
|
||||
typedef WIN_BOOL16 CALLBACK ( *ACMFORMATENUMCB16)(
|
||||
HACMDRIVERID16 hadid, LPACMFORMATDETAILS16 pafd,
|
||||
DWORD dwInstance, DWORD fdwSupport
|
||||
);
|
||||
|
||||
typedef WIN_BOOL CALLBACK ( *ACMFORMATTAGENUMCBA)(
|
||||
HACMDRIVERID hadid, PACMFORMATTAGDETAILSA paftd,
|
||||
DWORD dwInstance, DWORD fdwSupport
|
||||
);
|
||||
|
||||
typedef WIN_BOOL CALLBACK ( *ACMFORMATTAGENUMCBW)(
|
||||
HACMDRIVERID hadid, PACMFORMATTAGDETAILSW paftd,
|
||||
DWORD dwInstance, DWORD fdwSupport
|
||||
);
|
||||
|
||||
typedef WIN_BOOL16 CALLBACK ( *ACMFORMATTAGENUMCB16)(
|
||||
HACMDRIVERID16 hadid, LPACMFORMATTAGDETAILS16 paftd,
|
||||
DWORD dwInstance, DWORD fdwSupport
|
||||
);
|
||||
|
||||
/***********************************************************************
|
||||
* Functions - Win16
|
||||
*/
|
||||
|
||||
DWORD WINAPI acmGetVersion16(
|
||||
void
|
||||
);
|
||||
MMRESULT16 WINAPI acmMetrics16(
|
||||
HACMOBJ16 hao, UINT16 uMetric, LPVOID pMetric
|
||||
);
|
||||
MMRESULT16 WINAPI acmDriverEnum16(
|
||||
ACMDRIVERENUMCB16 fnCallback, DWORD dwInstance, DWORD fdwEnum
|
||||
);
|
||||
MMRESULT16 WINAPI acmDriverDetails16(
|
||||
HACMDRIVERID16 hadid, LPACMDRIVERDETAILS16 padd, DWORD fdwDetails
|
||||
);
|
||||
MMRESULT16 WINAPI acmDriverAdd16(
|
||||
LPHACMDRIVERID16 phadid, HINSTANCE16 hinstModule,
|
||||
LPARAM lParam, DWORD dwPriority, DWORD fdwAdd
|
||||
);
|
||||
MMRESULT16 WINAPI acmDriverRemove16(
|
||||
HACMDRIVERID16 hadid, DWORD fdwRemove
|
||||
);
|
||||
MMRESULT16 WINAPI acmDriverOpen16(
|
||||
LPHACMDRIVER16 phad, HACMDRIVERID16 hadid, DWORD fdwOpen
|
||||
);
|
||||
MMRESULT16 WINAPI acmDriverClose16(
|
||||
HACMDRIVER16 had, DWORD fdwClose
|
||||
);
|
||||
LRESULT WINAPI acmDriverMessage16(
|
||||
HACMDRIVER16 had, UINT16 uMsg, LPARAM lParam1, LPARAM lParam2
|
||||
);
|
||||
MMRESULT16 WINAPI acmDriverID16(
|
||||
HACMOBJ16 hao, LPHACMDRIVERID16 phadid, DWORD fdwDriverID
|
||||
);
|
||||
MMRESULT16 WINAPI acmDriverPriority16(
|
||||
HACMDRIVERID16 hadid, DWORD dwPriority, DWORD fdwPriority
|
||||
);
|
||||
MMRESULT16 WINAPI acmFormatTagDetails16(
|
||||
HACMDRIVER16 had, LPACMFORMATTAGDETAILS16 paftd, DWORD fdwDetails
|
||||
);
|
||||
MMRESULT16 WINAPI acmFormatTagEnum16(
|
||||
HACMDRIVER16 had, LPACMFORMATTAGDETAILS16 paftd,
|
||||
ACMFORMATTAGENUMCB16 fnCallback, DWORD dwInstance, DWORD fdwEnum
|
||||
);
|
||||
MMRESULT16 WINAPI acmFormatChoose16(
|
||||
LPACMFORMATCHOOSE16 pafmtc
|
||||
);
|
||||
MMRESULT16 WINAPI acmFormatDetails16(
|
||||
HACMDRIVER16 had, LPACMFORMATDETAILS16 pafd, DWORD fdwDetails
|
||||
);
|
||||
MMRESULT16 WINAPI acmFormatEnum16(
|
||||
HACMDRIVER16 had, LPACMFORMATDETAILS16 pafd,
|
||||
ACMFORMATENUMCB16 fnCallback, DWORD dwInstance, DWORD fdwEnum
|
||||
);
|
||||
MMRESULT16 WINAPI acmFormatSuggest16(
|
||||
HACMDRIVER16 had, LPWAVEFORMATEX pwfxSrc,
|
||||
LPWAVEFORMATEX pwfxDst, DWORD cbwfxDst, DWORD fdwSuggest
|
||||
);
|
||||
MMRESULT16 WINAPI acmFilterTagDetails16(
|
||||
HACMDRIVER16 had, LPACMFILTERTAGDETAILS16 paftd, DWORD fdwDetails
|
||||
);
|
||||
MMRESULT16 WINAPI acmFilterTagEnum16(
|
||||
HACMDRIVER16 had, LPACMFILTERTAGDETAILS16 paftd,
|
||||
ACMFILTERTAGENUMCB16 fnCallback, DWORD dwInstance, DWORD fdwEnum
|
||||
);
|
||||
MMRESULT16 WINAPI acmFilterChoose16(
|
||||
LPACMFILTERCHOOSE16 pafltrc
|
||||
);
|
||||
MMRESULT16 WINAPI acmFilterDetails16(
|
||||
HACMDRIVER16 had, LPACMFILTERDETAILS16 pafd, DWORD fdwDetails
|
||||
);
|
||||
MMRESULT16 WINAPI acmFilterEnum16(
|
||||
HACMDRIVER16 had, LPACMFILTERDETAILS16 pafd,
|
||||
ACMFILTERENUMCB16 fnCallback, DWORD dwInstance, DWORD fdwEnum
|
||||
);
|
||||
MMRESULT16 WINAPI acmStreamOpen16(
|
||||
LPHACMSTREAM16 phas, HACMDRIVER16 had,
|
||||
LPWAVEFORMATEX pwfxSrc, LPWAVEFORMATEX pwfxDst,
|
||||
LPWAVEFILTER pwfltr, DWORD dwCallback,
|
||||
DWORD dwInstance, DWORD fdwOpen
|
||||
);
|
||||
MMRESULT16 WINAPI acmStreamClose16(
|
||||
HACMSTREAM16 has, DWORD fdwClose
|
||||
);
|
||||
MMRESULT16 WINAPI acmStreamSize16(
|
||||
HACMSTREAM16 has, DWORD cbInput,
|
||||
LPDWORD pdwOutputBytes, DWORD fdwSize
|
||||
);
|
||||
MMRESULT16 WINAPI acmStreamConvert16(
|
||||
HACMSTREAM16 has, LPACMSTREAMHEADER16 pash, DWORD fdwConvert
|
||||
);
|
||||
MMRESULT16 WINAPI acmStreamReset16(
|
||||
HACMSTREAM16 has, DWORD fdwReset
|
||||
);
|
||||
MMRESULT16 WINAPI acmStreamPrepareHeader16(
|
||||
HACMSTREAM16 has, LPACMSTREAMHEADER16 pash, DWORD fdwPrepare
|
||||
);
|
||||
MMRESULT16 WINAPI acmStreamUnprepareHeader16(
|
||||
HACMSTREAM16 has, LPACMSTREAMHEADER16 pash, DWORD fdwUnprepare
|
||||
);
|
||||
|
||||
/***********************************************************************
|
||||
* Functions - Win32
|
||||
*/
|
||||
|
||||
MMRESULT WINAPI acmDriverAddA(
|
||||
PHACMDRIVERID phadid, HINSTANCE hinstModule,
|
||||
LPARAM lParam, DWORD dwPriority, DWORD fdwAdd
|
||||
);
|
||||
MMRESULT WINAPI acmDriverAddW(
|
||||
PHACMDRIVERID phadid, HINSTANCE hinstModule,
|
||||
LPARAM lParam, DWORD dwPriority, DWORD fdwAdd
|
||||
);
|
||||
MMRESULT WINAPI acmDriverClose(
|
||||
HACMDRIVER had, DWORD fdwClose
|
||||
);
|
||||
MMRESULT WINAPI acmDriverDetailsA(
|
||||
HACMDRIVERID hadid, PACMDRIVERDETAILSA padd, DWORD fdwDetails
|
||||
);
|
||||
MMRESULT WINAPI acmDriverDetailsW(
|
||||
HACMDRIVERID hadid, PACMDRIVERDETAILSW padd, DWORD fdwDetails
|
||||
);
|
||||
MMRESULT WINAPI acmDriverEnum(
|
||||
ACMDRIVERENUMCB fnCallback, DWORD dwInstance, DWORD fdwEnum
|
||||
);
|
||||
MMRESULT WINAPI acmDriverID(
|
||||
HACMOBJ hao, PHACMDRIVERID phadid, DWORD fdwDriverID
|
||||
);
|
||||
LRESULT WINAPI acmDriverMessage(
|
||||
HACMDRIVER had, UINT uMsg, LPARAM lParam1, LPARAM lParam2
|
||||
);
|
||||
MMRESULT WINAPI acmDriverOpen(
|
||||
PHACMDRIVER phad, HACMDRIVERID hadid, DWORD fdwOpen
|
||||
);
|
||||
MMRESULT WINAPI acmDriverPriority(
|
||||
HACMDRIVERID hadid, DWORD dwPriority, DWORD fdwPriority
|
||||
);
|
||||
MMRESULT WINAPI acmDriverRemove(
|
||||
HACMDRIVERID hadid, DWORD fdwRemove
|
||||
);
|
||||
MMRESULT WINAPI acmFilterChooseA(
|
||||
PACMFILTERCHOOSEA pafltrc
|
||||
);
|
||||
MMRESULT WINAPI acmFilterChooseW(
|
||||
PACMFILTERCHOOSEW pafltrc
|
||||
);
|
||||
MMRESULT WINAPI acmFilterDetailsA(
|
||||
HACMDRIVER had, PACMFILTERDETAILSA pafd, DWORD fdwDetails
|
||||
);
|
||||
MMRESULT WINAPI acmFilterDetailsW(
|
||||
HACMDRIVER had, PACMFILTERDETAILSW pafd, DWORD fdwDetails
|
||||
);
|
||||
MMRESULT WINAPI acmFilterEnumA(
|
||||
HACMDRIVER had, PACMFILTERDETAILSA pafd,
|
||||
ACMFILTERENUMCBA fnCallback, DWORD dwInstance, DWORD fdwEnum
|
||||
);
|
||||
MMRESULT WINAPI acmFilterEnumW(
|
||||
HACMDRIVER had, PACMFILTERDETAILSW pafd,
|
||||
ACMFILTERENUMCBW fnCallback, DWORD dwInstance, DWORD fdwEnum
|
||||
);
|
||||
MMRESULT WINAPI acmFilterTagDetailsA(
|
||||
HACMDRIVER had, PACMFILTERTAGDETAILSA paftd, DWORD fdwDetails
|
||||
);
|
||||
MMRESULT WINAPI acmFilterTagDetailsW(
|
||||
HACMDRIVER had, PACMFILTERTAGDETAILSW paftd, DWORD fdwDetails
|
||||
);
|
||||
MMRESULT WINAPI acmFilterTagEnumA(
|
||||
HACMDRIVER had, PACMFILTERTAGDETAILSA paftd,
|
||||
ACMFILTERTAGENUMCBA fnCallback, DWORD dwInstance, DWORD fdwEnum
|
||||
);
|
||||
MMRESULT WINAPI acmFilterTagEnumW(
|
||||
HACMDRIVER had, PACMFILTERTAGDETAILSW paftd,
|
||||
ACMFILTERTAGENUMCBW fnCallback, DWORD dwInstance, DWORD fdwEnum
|
||||
);
|
||||
MMRESULT WINAPI acmFormatChooseA(
|
||||
PACMFORMATCHOOSEA pafmtc
|
||||
);
|
||||
MMRESULT WINAPI acmFormatChooseW(
|
||||
PACMFORMATCHOOSEW pafmtc
|
||||
);
|
||||
MMRESULT WINAPI acmFormatDetailsA(
|
||||
HACMDRIVER had, PACMFORMATDETAILSA pafd, DWORD fdwDetails
|
||||
);
|
||||
MMRESULT WINAPI acmFormatDetailsW(
|
||||
HACMDRIVER had, PACMFORMATDETAILSW pafd, DWORD fdwDetails
|
||||
);
|
||||
MMRESULT WINAPI acmFormatEnumA(
|
||||
HACMDRIVER had, PACMFORMATDETAILSA pafd,
|
||||
ACMFORMATENUMCBA fnCallback, DWORD dwInstance, DWORD fdwEnum
|
||||
);
|
||||
MMRESULT WINAPI acmFormatEnumW(
|
||||
HACMDRIVER had, PACMFORMATDETAILSW pafd,
|
||||
ACMFORMATENUMCBW fnCallback, DWORD dwInstance, DWORD fdwEnum
|
||||
);
|
||||
MMRESULT WINAPI acmFormatSuggest(
|
||||
HACMDRIVER had, PWAVEFORMATEX pwfxSrc, PWAVEFORMATEX pwfxDst,
|
||||
DWORD cbwfxDst, DWORD fdwSuggest
|
||||
);
|
||||
MMRESULT WINAPI acmFormatTagDetailsA(
|
||||
HACMDRIVER had, PACMFORMATTAGDETAILSA paftd, DWORD fdwDetails
|
||||
);
|
||||
MMRESULT WINAPI acmFormatTagDetailsW(
|
||||
HACMDRIVER had, PACMFORMATTAGDETAILSW paftd, DWORD fdwDetails
|
||||
);
|
||||
MMRESULT WINAPI acmFormatTagEnumA(
|
||||
HACMDRIVER had, PACMFORMATTAGDETAILSA paftd,
|
||||
ACMFORMATTAGENUMCBA fnCallback, DWORD dwInstance, DWORD fdwEnum
|
||||
);
|
||||
MMRESULT WINAPI acmFormatTagEnumW(
|
||||
HACMDRIVER had, PACMFORMATTAGDETAILSW paftd,
|
||||
ACMFORMATTAGENUMCBW fnCallback, DWORD dwInstance, DWORD fdwEnum
|
||||
);
|
||||
DWORD WINAPI acmGetVersion(
|
||||
void
|
||||
);
|
||||
MMRESULT WINAPI acmMetrics(
|
||||
HACMOBJ hao, UINT uMetric, LPVOID pMetric
|
||||
);
|
||||
MMRESULT WINAPI acmStreamClose(
|
||||
HACMSTREAM has, DWORD fdwClose
|
||||
);
|
||||
MMRESULT WINAPI acmStreamConvert(
|
||||
HACMSTREAM has, PACMSTREAMHEADER pash, DWORD fdwConvert
|
||||
);
|
||||
MMRESULT WINAPI acmStreamMessage(
|
||||
HACMSTREAM has, UINT uMsg, LPARAM lParam1, LPARAM lParam2
|
||||
);
|
||||
MMRESULT WINAPI acmStreamOpen(
|
||||
PHACMSTREAM phas, HACMDRIVER had, PWAVEFORMATEX pwfxSrc,
|
||||
PWAVEFORMATEX pwfxDst, PWAVEFILTER pwfltr, DWORD dwCallback,
|
||||
DWORD dwInstance, DWORD fdwOpen
|
||||
);
|
||||
MMRESULT WINAPI acmStreamPrepareHeader(
|
||||
HACMSTREAM has, PACMSTREAMHEADER pash, DWORD fdwPrepare
|
||||
);
|
||||
MMRESULT WINAPI acmStreamReset(
|
||||
HACMSTREAM has, DWORD fdwReset
|
||||
);
|
||||
MMRESULT WINAPI acmStreamSize(
|
||||
HACMSTREAM has, DWORD cbInput,
|
||||
LPDWORD pdwOutputBytes, DWORD fdwSize
|
||||
);
|
||||
MMRESULT WINAPI acmStreamUnprepareHeader(
|
||||
HACMSTREAM has, PACMSTREAMHEADER pash, DWORD fdwUnprepare
|
||||
);
|
||||
|
||||
#endif /* MPLAYER_MSACM_H */
|
||||
@@ -1,203 +0,0 @@
|
||||
/*
|
||||
* msacmdrv.h - Declarations for MSACM driver
|
||||
*/
|
||||
|
||||
#ifndef MPLAYER_MSACMDRV_H
|
||||
#define MPLAYER_MSACMDRV_H
|
||||
|
||||
#include "windef.h"
|
||||
#include "msacm.h"
|
||||
|
||||
/***********************************************************************
|
||||
* Types
|
||||
*/
|
||||
|
||||
/***********************************************************************
|
||||
* Defines/Enums
|
||||
*/
|
||||
|
||||
#define MAKE_ACM_VERSION(mjr, mnr, bld) \
|
||||
(((long)(mjr)<<24) | ((long)(mnr)<<16) | ((long)bld))
|
||||
|
||||
#define ACMDRVOPENDESC_SECTIONNAME_CHARS
|
||||
|
||||
#define ACMDM_DRIVER_NOTIFY (ACMDM_BASE + 1)
|
||||
#define ACMDM_DRIVER_DETAILS (ACMDM_BASE + 10)
|
||||
|
||||
#define ACMDM_HARDWARE_WAVE_CAPS_INPUT (ACMDM_BASE + 20)
|
||||
#define ACMDM_HARDWARE_WAVE_CAPS_OUTPUT (ACMDM_BASE + 21)
|
||||
|
||||
#define ACMDM_FORMATTAG_DETAILS (ACMDM_BASE + 25)
|
||||
#define ACMDM_FORMAT_DETAILS (ACMDM_BASE + 26)
|
||||
#define ACMDM_FORMAT_SUGGEST (ACMDM_BASE + 27)
|
||||
|
||||
#define ACMDM_FILTERTAG_DETAILS (ACMDM_BASE + 50)
|
||||
#define ACMDM_FILTER_DETAILS (ACMDM_BASE + 51)
|
||||
|
||||
#define ACMDM_STREAM_OPEN (ACMDM_BASE + 76)
|
||||
#define ACMDM_STREAM_CLOSE (ACMDM_BASE + 77)
|
||||
#define ACMDM_STREAM_SIZE (ACMDM_BASE + 78)
|
||||
#define ACMDM_STREAM_CONVERT (ACMDM_BASE + 79)
|
||||
#define ACMDM_STREAM_RESET (ACMDM_BASE + 80)
|
||||
#define ACMDM_STREAM_PREPARE (ACMDM_BASE + 81)
|
||||
#define ACMDM_STREAM_UNPREPARE (ACMDM_BASE + 82)
|
||||
#define ACMDM_STREAM_UPDATE (ACMDM_BASE + 83)
|
||||
|
||||
/***********************************************************************
|
||||
* Structures
|
||||
*/
|
||||
|
||||
typedef struct ACMDRVOPENDESCA
|
||||
{
|
||||
DWORD cbStruct;
|
||||
FOURCC fccType;
|
||||
FOURCC fccComp;
|
||||
DWORD dwVersion;
|
||||
DWORD dwFlags;
|
||||
DWORD dwError;
|
||||
LPCSTR pszSectionName;
|
||||
LPCSTR pszAliasName;
|
||||
DWORD dnDevNode;
|
||||
} ACMDRVOPENDESCA, *PACMDRVOPENDESCA;
|
||||
|
||||
typedef struct ACMDRVOPENDESCW
|
||||
{
|
||||
DWORD cbStruct;
|
||||
FOURCC fccType;
|
||||
FOURCC fccComp;
|
||||
DWORD dwVersion;
|
||||
DWORD dwFlags;
|
||||
DWORD dwError;
|
||||
LPCWSTR pszSectionName;
|
||||
LPCWSTR pszAliasName;
|
||||
DWORD dnDevNode;
|
||||
} ACMDRVOPENDESCW, *PACMDRVOPENDESCW;
|
||||
|
||||
typedef struct ACMDRVOPENDESC16
|
||||
{
|
||||
DWORD cbStruct;
|
||||
FOURCC fccType;
|
||||
FOURCC fccComp;
|
||||
DWORD dwVersion;
|
||||
DWORD dwFlags;
|
||||
DWORD dwError;
|
||||
LPCSTR pszSectionName;
|
||||
LPCSTR pszAliasName;
|
||||
DWORD dnDevNode;
|
||||
} ACMDRVOPENDESC16, *NPACMDRVOPENDESC16, *LPACMDRVOPENDESC16;
|
||||
|
||||
typedef struct ACMDRVSTREAMINSTANCE16
|
||||
{
|
||||
DWORD cbStruct;
|
||||
LPWAVEFORMATEX pwfxSrc;
|
||||
LPWAVEFORMATEX pwfxDst;
|
||||
LPWAVEFILTER pwfltr;
|
||||
DWORD dwCallback;
|
||||
DWORD dwInstance;
|
||||
DWORD fdwOpen;
|
||||
DWORD fdwDriver;
|
||||
DWORD dwDriver;
|
||||
HACMSTREAM16 has;
|
||||
} ACMDRVSTREAMINSTANCE16, *NPACMDRVSTREAMINSTANCE16, *LPACMDRVSTREAMINSTANCE16;
|
||||
|
||||
typedef struct ACMDRVSTREAMINSTANCE
|
||||
{
|
||||
DWORD cbStruct;
|
||||
PWAVEFORMATEX pwfxSrc;
|
||||
PWAVEFORMATEX pwfxDst;
|
||||
PWAVEFILTER pwfltr;
|
||||
DWORD dwCallback;
|
||||
DWORD dwInstance;
|
||||
DWORD fdwOpen;
|
||||
DWORD fdwDriver;
|
||||
DWORD dwDriver;
|
||||
HACMSTREAM has;
|
||||
} ACMDRVSTREAMINSTANCE, *PACMDRVSTREAMINSTANCE;
|
||||
|
||||
|
||||
typedef struct ACMDRVSTREAMHEADER16 *LPACMDRVSTREAMHEADER16;
|
||||
typedef struct ACMDRVSTREAMHEADER16 {
|
||||
DWORD cbStruct;
|
||||
DWORD fdwStatus;
|
||||
DWORD dwUser;
|
||||
LPBYTE pbSrc;
|
||||
DWORD cbSrcLength;
|
||||
DWORD cbSrcLengthUsed;
|
||||
DWORD dwSrcUser;
|
||||
LPBYTE pbDst;
|
||||
DWORD cbDstLength;
|
||||
DWORD cbDstLengthUsed;
|
||||
DWORD dwDstUser;
|
||||
|
||||
DWORD fdwConvert;
|
||||
LPACMDRVSTREAMHEADER16 *padshNext;
|
||||
DWORD fdwDriver;
|
||||
DWORD dwDriver;
|
||||
|
||||
/* Internal fields for ACM */
|
||||
DWORD fdwPrepared;
|
||||
DWORD dwPrepared;
|
||||
LPBYTE pbPreparedSrc;
|
||||
DWORD cbPreparedSrcLength;
|
||||
LPBYTE pbPreparedDst;
|
||||
DWORD cbPreparedDstLength;
|
||||
} ACMDRVSTREAMHEADER16, *NPACMDRVSTREAMHEADER16;
|
||||
|
||||
typedef struct ACMDRVSTREAMHEADER *PACMDRVSTREAMHEADER;
|
||||
typedef struct ACMDRVSTREAMHEADER {
|
||||
DWORD cbStruct;
|
||||
DWORD fdwStatus;
|
||||
DWORD dwUser;
|
||||
LPBYTE pbSrc;
|
||||
DWORD cbSrcLength;
|
||||
DWORD cbSrcLengthUsed;
|
||||
DWORD dwSrcUser;
|
||||
LPBYTE pbDst;
|
||||
DWORD cbDstLength;
|
||||
DWORD cbDstLengthUsed;
|
||||
DWORD dwDstUser;
|
||||
|
||||
DWORD fdwConvert;
|
||||
PACMDRVSTREAMHEADER *padshNext;
|
||||
DWORD fdwDriver;
|
||||
DWORD dwDriver;
|
||||
|
||||
/* Internal fields for ACM */
|
||||
DWORD fdwPrepared;
|
||||
DWORD dwPrepared;
|
||||
LPBYTE pbPreparedSrc;
|
||||
DWORD cbPreparedSrcLength;
|
||||
LPBYTE pbPreparedDst;
|
||||
DWORD cbPreparedDstLength;
|
||||
} ACMDRVSTREAMHEADER;
|
||||
|
||||
typedef struct ACMDRVSTREAMSIZE
|
||||
{
|
||||
DWORD cbStruct;
|
||||
DWORD fdwSize;
|
||||
DWORD cbSrcLength;
|
||||
DWORD cbDstLength;
|
||||
} ACMDRVSTREAMSIZE16, *NPACMDRVSTREAMSIZE16, *LPACMDRVSTREAMSIZE16,
|
||||
ACMDRVSTREAMSIZE, *PACMDRVSTREAMSIZE;
|
||||
|
||||
typedef struct ACMDRVFORMATSUGGEST16
|
||||
{
|
||||
DWORD cbStruct;
|
||||
DWORD fdwSuggest;
|
||||
LPWAVEFORMATEX pwfxSrc;
|
||||
DWORD cbwfxSrc;
|
||||
LPWAVEFORMATEX pwfxDst;
|
||||
DWORD cbwfxDst;
|
||||
} ACMDRVFORMATSUGGEST16, *NPACMDRVFORMATSUGGEST, *LPACMDRVFORMATSUGGEST;
|
||||
|
||||
typedef struct ACMDRVFORMATSUGGEST
|
||||
{
|
||||
DWORD cbStruct;
|
||||
DWORD fdwSuggest;
|
||||
PWAVEFORMATEX pwfxSrc;
|
||||
DWORD cbwfxSrc;
|
||||
PWAVEFORMATEX pwfxDst;
|
||||
DWORD cbwfxDst;
|
||||
} ACMDRVFORMATSUGGEST, *PACMDRVFORMATSUGGEST;
|
||||
|
||||
#endif /* MPLAYER_MSACMDRV_H */
|
||||
@@ -1,93 +0,0 @@
|
||||
#ifndef MPLAYER_NTDEF_H
|
||||
#define MPLAYER_NTDEF_H
|
||||
|
||||
#include "basetsd.h"
|
||||
#include "windef.h"
|
||||
|
||||
#include "pshpack1.h"
|
||||
|
||||
#define NTAPI __stdcall
|
||||
|
||||
#ifndef IN
|
||||
#define IN
|
||||
#endif
|
||||
|
||||
#ifndef OUT
|
||||
#define OUT
|
||||
#endif
|
||||
|
||||
#ifndef OPTIONAL
|
||||
#define OPTIONAL
|
||||
#endif
|
||||
|
||||
#ifndef VOID
|
||||
#define VOID void
|
||||
#endif
|
||||
|
||||
typedef LONG NTSTATUS;
|
||||
typedef NTSTATUS *PNTSTATUS;
|
||||
|
||||
typedef short CSHORT;
|
||||
typedef CSHORT *PCSHORT;
|
||||
|
||||
typedef WCHAR * PWCHAR;
|
||||
|
||||
/* NT lowlevel Strings (handled by Rtl* functions in NTDLL)
|
||||
* If they are zero terminated, Length does not include the terminating 0.
|
||||
*/
|
||||
|
||||
typedef struct STRING {
|
||||
USHORT Length;
|
||||
USHORT MaximumLength;
|
||||
PSTR Buffer;
|
||||
} STRING,*PSTRING,ANSI_STRING,*PANSI_STRING;
|
||||
|
||||
typedef struct CSTRING {
|
||||
USHORT Length;
|
||||
USHORT MaximumLength;
|
||||
PCSTR Buffer;
|
||||
} CSTRING,*PCSTRING;
|
||||
|
||||
typedef struct UNICODE_STRING {
|
||||
USHORT Length; /* bytes */
|
||||
USHORT MaximumLength; /* bytes */
|
||||
PWSTR Buffer;
|
||||
} UNICODE_STRING,*PUNICODE_STRING;
|
||||
|
||||
/*
|
||||
Objects
|
||||
*/
|
||||
|
||||
#define OBJ_INHERIT 0x00000002L
|
||||
#define OBJ_PERMANENT 0x00000010L
|
||||
#define OBJ_EXCLUSIVE 0x00000020L
|
||||
#define OBJ_CASE_INSENSITIVE 0x00000040L
|
||||
#define OBJ_OPENIF 0x00000080L
|
||||
#define OBJ_OPENLINK 0x00000100L
|
||||
#define OBJ_KERNEL_HANDLE 0x00000200L
|
||||
#define OBJ_VALID_ATTRIBUTES 0x000003F2L
|
||||
|
||||
typedef struct OBJECT_ATTRIBUTES
|
||||
{ ULONG Length;
|
||||
HANDLE RootDirectory;
|
||||
PUNICODE_STRING ObjectName;
|
||||
ULONG Attributes;
|
||||
PVOID SecurityDescriptor; /* type SECURITY_DESCRIPTOR */
|
||||
PVOID SecurityQualityOfService; /* type SECURITY_QUALITY_OF_SERVICE */
|
||||
} OBJECT_ATTRIBUTES;
|
||||
|
||||
typedef OBJECT_ATTRIBUTES *POBJECT_ATTRIBUTES;
|
||||
|
||||
#define InitializeObjectAttributes(p,n,a,r,s) \
|
||||
{ (p)->Length = sizeof(OBJECT_ATTRIBUTES); \
|
||||
(p)->RootDirectory = r; \
|
||||
(p)->Attributes = a; \
|
||||
(p)->ObjectName = n; \
|
||||
(p)->SecurityDescriptor = s; \
|
||||
(p)->SecurityQualityOfService = NULL; \
|
||||
}
|
||||
|
||||
|
||||
#include "poppack.h"
|
||||
|
||||
#endif /* MPLAYER_NTDEF_H */
|
||||
@@ -1,22 +0,0 @@
|
||||
#ifndef MPLAYER_OBJBASE_H
|
||||
#define MPLAYER_OBJBASE_H
|
||||
|
||||
#include "windef.h"
|
||||
|
||||
#ifndef STDCALL
|
||||
#define STDCALL __attribute__((__stdcall__))
|
||||
#endif
|
||||
|
||||
/* from objbase.h needed for ve_vfw.c */
|
||||
typedef enum tagCOINIT {
|
||||
COINIT_APARTMENTTHREADED = 0x2,
|
||||
COINIT_MULTITHREADED = 0x0,
|
||||
COINIT_DISABLE_OLE1DDE = 0x4,
|
||||
COINIT_SPEED_OVER_MEMORY = 0x8
|
||||
} COINIT;
|
||||
|
||||
HRESULT STDCALL CoInitialize(LPVOID pvReserved);
|
||||
HRESULT STDCALL CoInitializeEx(LPVOID pvReserved, DWORD dwCoinit);
|
||||
void STDCALL CoUninitialize(void);
|
||||
|
||||
#endif /* MPLAYER_OBJBASE_H */
|
||||
@@ -1,81 +0,0 @@
|
||||
#ifndef MPLAYER_PE_IMAGE_H
|
||||
#define MPLAYER_PE_IMAGE_H
|
||||
|
||||
#include "winnt.h"
|
||||
#include "winbase.h"
|
||||
|
||||
#define PE_HEADER(module) \
|
||||
((IMAGE_NT_HEADERS*)((LPBYTE)(module) + \
|
||||
(((IMAGE_DOS_HEADER*)(module))->e_lfanew)))
|
||||
|
||||
#define PE_SECTIONS(module) \
|
||||
((IMAGE_SECTION_HEADER*)((LPBYTE)&PE_HEADER(module)->OptionalHeader + \
|
||||
PE_HEADER(module)->FileHeader.SizeOfOptionalHeader))
|
||||
|
||||
#define RVA_PTR(module,field) ((LPBYTE)(module) + PE_HEADER(module)->field)
|
||||
|
||||
/* modreference used for attached processes
|
||||
* all section are calculated here, relocations etc.
|
||||
*/
|
||||
typedef struct {
|
||||
PIMAGE_IMPORT_DESCRIPTOR pe_import;
|
||||
PIMAGE_EXPORT_DIRECTORY pe_export;
|
||||
PIMAGE_RESOURCE_DIRECTORY pe_resource;
|
||||
int tlsindex;
|
||||
} PE_MODREF;
|
||||
|
||||
struct wine_modref;
|
||||
int PE_unloadImage(HMODULE hModule);
|
||||
FARPROC PE_FindExportedFunction(struct wine_modref *wm, LPCSTR funcName, WIN_BOOL snoop);
|
||||
WIN_BOOL PE_EnumResourceTypesA(HMODULE, ENUMRESTYPEPROCA, LONG);
|
||||
WIN_BOOL PE_EnumResourceTypesW(HMODULE, ENUMRESTYPEPROCW, LONG);
|
||||
WIN_BOOL PE_EnumResourceNamesA(HMODULE, LPCSTR, ENUMRESNAMEPROCA, LONG);
|
||||
WIN_BOOL PE_EnumResourceNamesW(HMODULE, LPCWSTR, ENUMRESNAMEPROCW, LONG);
|
||||
WIN_BOOL PE_EnumResourceLanguagesA(HMODULE, LPCSTR, LPCSTR, ENUMRESLANGPROCA, LONG);
|
||||
WIN_BOOL PE_EnumResourceLanguagesW(HMODULE, LPCWSTR, LPCWSTR, ENUMRESLANGPROCW, LONG);
|
||||
HRSRC PE_FindResourceExW(struct wine_modref*, LPCWSTR, LPCWSTR, WORD);
|
||||
DWORD PE_SizeofResource(HMODULE, HRSRC);
|
||||
struct wine_modref *PE_LoadLibraryExA(LPCSTR, DWORD);
|
||||
void PE_UnloadLibrary(struct wine_modref *);
|
||||
HGLOBAL PE_LoadResource(struct wine_modref *wm, HRSRC);
|
||||
HMODULE PE_LoadImage(int hFile, LPCSTR filename, WORD *version);
|
||||
struct wine_modref *PE_CreateModule(HMODULE hModule, LPCSTR filename,
|
||||
DWORD flags, WIN_BOOL builtin);
|
||||
WIN_BOOL PE_CreateProcess(HANDLE hFile, LPCSTR filename, LPCSTR cmd_line, LPCSTR env,
|
||||
LPSECURITY_ATTRIBUTES psa, LPSECURITY_ATTRIBUTES tsa,
|
||||
WIN_BOOL inherit, DWORD flags, LPSTARTUPINFOA startup,
|
||||
LPPROCESS_INFORMATION info);
|
||||
|
||||
void PE_InitTls(void);
|
||||
WIN_BOOL PE_InitDLL(struct wine_modref *wm, DWORD type, LPVOID lpReserved);
|
||||
|
||||
PIMAGE_RESOURCE_DIRECTORY GetResDirEntryA(PIMAGE_RESOURCE_DIRECTORY, LPCSTR, DWORD, WIN_BOOL);
|
||||
PIMAGE_RESOURCE_DIRECTORY GetResDirEntryW(PIMAGE_RESOURCE_DIRECTORY, LPCWSTR, DWORD, WIN_BOOL);
|
||||
|
||||
typedef DWORD CALLBACK (*DLLENTRYPROC)(HMODULE,DWORD,LPVOID);
|
||||
|
||||
typedef struct WINE_PACKED {
|
||||
WORD popl; /* 0x8f 0x05 */
|
||||
DWORD addr_popped; /* ... */
|
||||
BYTE pushl1; /* 0x68 */
|
||||
DWORD newret; /* ... */
|
||||
BYTE pushl2; /* 0x68 */
|
||||
DWORD origfun; /* original function */
|
||||
BYTE ret1; /* 0xc3 */
|
||||
WORD addesp; /* 0x83 0xc4 */
|
||||
BYTE nrofargs; /* nr of arguments to add esp, */
|
||||
BYTE pushl3; /* 0x68 */
|
||||
DWORD oldret; /* Filled out from popl above */
|
||||
BYTE ret2; /* 0xc3 */
|
||||
} ELF_STDCALL_STUB;
|
||||
|
||||
typedef struct {
|
||||
void* dlhandle;
|
||||
ELF_STDCALL_STUB *stubs;
|
||||
} ELF_MODREF;
|
||||
|
||||
struct wine_modref *ELF_LoadLibraryExA( LPCSTR libname, DWORD flags);
|
||||
void ELF_UnloadLibrary(struct wine_modref *);
|
||||
FARPROC ELF_FindExportedFunction(struct wine_modref *wm, LPCSTR funcName);
|
||||
|
||||
#endif /* MPLAYER_PE_IMAGE_H */
|
||||
@@ -1,15 +0,0 @@
|
||||
#ifdef MPLAYER_PSHPACK_H
|
||||
#undef MPLAYER_PSHPACK_H
|
||||
|
||||
#if (defined(__GNUC__) || defined(__SUNPRO_C)) && !defined(__APPLE__)
|
||||
#pragma pack()
|
||||
#elif defined(__SUNPRO_CC) || defined(__APPLE__)
|
||||
#warning "Assumes default alignment is 4"
|
||||
#pragma pack(4)
|
||||
#elif !defined(RC_INVOKED)
|
||||
#error "Restoration of the previous alignment isn't supported by the compiler"
|
||||
#endif /* defined(__GNUC__) || defined(__SUNPRO_C) ; !defined(RC_INVOKED) */
|
||||
|
||||
#else /* MPLAYER_PSHPACK_H */
|
||||
#error "Popping alignment isn't possible since no alignment has been pushed"
|
||||
#endif /* MPLAYER_PSHPACK_H */
|
||||
@@ -1,12 +0,0 @@
|
||||
#ifndef MPLAYER_PSHPACK_H
|
||||
#define MPLAYER_PSHPACK_H 1
|
||||
|
||||
#if defined(__GNUC__) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
|
||||
//#pragma pack(1)
|
||||
#elif !defined(RC_INVOKED)
|
||||
#error "1 as alignment isn't supported by the compiler"
|
||||
#endif /* defined(__GNUC__) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) ; !defined(RC_INVOKED) */
|
||||
|
||||
#else /* MPLAYER_PSHPACK_H */
|
||||
#error "Nested pushing of alignment isn't supported by the compiler"
|
||||
#endif /* MPLAYER_PSHPACK_H */
|
||||
@@ -1,12 +0,0 @@
|
||||
#ifndef MPLAYER_PSHPACK_H
|
||||
#define MPLAYER_PSHPACK_H 2
|
||||
|
||||
#if defined(__GNUC__) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
|
||||
//#pragma pack(2)
|
||||
#elif !defined(RC_INVOKED)
|
||||
#error "2 as alignment isn't supported by the compiler"
|
||||
#endif /* defined(__GNUC__) || defined(__SUNPRO_CC) ; !defined(RC_INVOKED) */
|
||||
|
||||
#else /* MPLAYER_PSHPACK_H */
|
||||
#error "Nested pushing of alignment isn't supported by the compiler"
|
||||
#endif /* MPLAYER_PSHPACK_H */
|
||||
@@ -1,14 +0,0 @@
|
||||
#ifndef MPLAYER_PSHPACK_H
|
||||
#define MPLAYER_PSHPACK_H 4
|
||||
|
||||
#if defined(__GNUC__) || defined(__SUNPRO_CC)
|
||||
//#pragma pack(4)
|
||||
#elif defined(__SUNPRO_C)
|
||||
//#pragma pack()
|
||||
#elif !defined(RC_INVOKED)
|
||||
#error "4 as alignment isn't supported by the compiler"
|
||||
#endif /* defined(__GNUC__) || defined(__SUNPRO_CC) ; !defined(RC_INVOKED) */
|
||||
|
||||
#else /* MPLAYER_PSHPACK_H */
|
||||
#error "Nested pushing of alignment isn't supported by the compiler"
|
||||
#endif /* MPLAYER_PSHPACK_H */
|
||||
@@ -1,12 +0,0 @@
|
||||
#ifndef MPLAYER_PSHPACK_H
|
||||
#define MPLAYER_PSHPACK_H 8
|
||||
|
||||
#if 0
|
||||
//#pragma pack(8)
|
||||
#elif !defined(RC_INVOKED)
|
||||
#error "8 as alignment is not supported"
|
||||
#endif /* 0 ; !defined(RC_INVOKED) */
|
||||
|
||||
#else /* MPLAYER_PSHPACK_H */
|
||||
#error "Nested pushing of alignment isn't supported by the compiler"
|
||||
#endif /* MPLAYER_PSHPACK_H */
|
||||
@@ -1,669 +0,0 @@
|
||||
/*
|
||||
* Modified for use with MPlayer, detailed changelog at
|
||||
* http://svn.mplayerhq.hu/mplayer/trunk/
|
||||
*/
|
||||
|
||||
#ifndef MPLAYER_VFW_H
|
||||
#define MPLAYER_VFW_H
|
||||
//#include "pshpack1.h"
|
||||
#include "windef.h"
|
||||
|
||||
typedef struct __attribute__((__packed__))
|
||||
{
|
||||
short bfType;
|
||||
long bfSize;
|
||||
short bfReserved1;
|
||||
short bfReserved2;
|
||||
long bfOffBits;
|
||||
} BITMAPFILEHEADER;
|
||||
|
||||
#ifndef _BITMAPINFOHEADER_
|
||||
#define _BITMAPINFOHEADER_
|
||||
typedef struct __attribute__((__packed__))
|
||||
{
|
||||
long biSize;
|
||||
long biWidth;
|
||||
long biHeight;
|
||||
short biPlanes;
|
||||
short biBitCount;
|
||||
long biCompression;
|
||||
long biSizeImage;
|
||||
long biXPelsPerMeter;
|
||||
long biYPelsPerMeter;
|
||||
long biClrUsed;
|
||||
long biClrImportant;
|
||||
} BITMAPINFOHEADER, *PBITMAPINFOHEADER, *LPBITMAPINFOHEADER;
|
||||
typedef struct {
|
||||
BITMAPINFOHEADER bmiHeader;
|
||||
int bmiColors[1];
|
||||
} BITMAPINFO, *LPBITMAPINFO;
|
||||
#endif
|
||||
|
||||
#define VFWAPI
|
||||
#define VFWAPIV
|
||||
#ifndef MPLAYER_WINDEF_H
|
||||
typedef long (__stdcall__ *DRIVERPROC)(long,HDRVR,unsigned int,long,long);
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#ifndef mmioFOURCC
|
||||
#define mmioFOURCC( ch0, ch1, ch2, ch3 ) \
|
||||
( (long)(unsigned char)(ch0) | ( (long)(unsigned char)(ch1) << 8 ) | \
|
||||
( (long)(unsigned char)(ch2) << 16 ) | ( (long)(unsigned char)(ch3) << 24 ) )
|
||||
#endif
|
||||
|
||||
#ifndef aviTWOCC
|
||||
#define aviTWOCC(ch0, ch1) ((short)(unsigned char)(ch0) | ((short)(unsigned char)(ch1) << 8))
|
||||
#endif
|
||||
|
||||
#define ICTYPE_VIDEO mmioFOURCC('v', 'i', 'd', 'c')
|
||||
#define ICTYPE_AUDIO mmioFOURCC('a', 'u', 'd', 'c')
|
||||
|
||||
|
||||
/* Installable Compressor M? */
|
||||
|
||||
/* HIC struct (same layout as Win95 one) */
|
||||
typedef struct tagWINE_HIC {
|
||||
long magic; /* 00: 'Smag' */
|
||||
HANDLE curthread; /* 04: */
|
||||
long type; /* 08: */
|
||||
long handler; /* 0C: */
|
||||
HDRVR hdrv; /* 10: */
|
||||
long driverid; /* 14:(handled by SendDriverMessage)*/
|
||||
DRIVERPROC driverproc; /* 18:(handled by SendDriverMessage)*/
|
||||
long x1; /* 1c: name? */
|
||||
short x2; /* 20: */
|
||||
long x3; /* 22: */
|
||||
/* 26: */
|
||||
} WINE_HIC;
|
||||
|
||||
/* error return codes */
|
||||
#define ICERR_OK 0
|
||||
#define ICERR_DONTDRAW 1
|
||||
#define ICERR_NEWPALETTE 2
|
||||
#define ICERR_GOTOKEYFRAME 3
|
||||
#define ICERR_STOPDRAWING 4
|
||||
|
||||
#define ICERR_UNSUPPORTED -1
|
||||
#define ICERR_BADFORMAT -2
|
||||
#define ICERR_MEMORY -3
|
||||
#define ICERR_INTERNAL -4
|
||||
#define ICERR_BADFLAGS -5
|
||||
#define ICERR_BADPARAM -6
|
||||
#define ICERR_BADSIZE -7
|
||||
#define ICERR_BADHANDLE -8
|
||||
#define ICERR_CANTUPDATE -9
|
||||
#define ICERR_ABORT -10
|
||||
#define ICERR_ERROR -100
|
||||
#define ICERR_BADBITDEPTH -200
|
||||
#define ICERR_BADIMAGESIZE -201
|
||||
|
||||
#define ICERR_CUSTOM -400
|
||||
|
||||
/* ICM Messages */
|
||||
#define ICM_USER (DRV_USER+0x0000)
|
||||
|
||||
/* ICM driver message range */
|
||||
#define ICM_RESERVED_LOW (DRV_USER+0x1000)
|
||||
#define ICM_RESERVED_HIGH (DRV_USER+0x2000)
|
||||
#define ICM_RESERVED ICM_RESERVED_LOW
|
||||
|
||||
#define ICM_GETSTATE (ICM_RESERVED+0)
|
||||
#define ICM_SETSTATE (ICM_RESERVED+1)
|
||||
#define ICM_GETINFO (ICM_RESERVED+2)
|
||||
|
||||
#define ICM_CONFIGURE (ICM_RESERVED+10)
|
||||
#define ICM_ABOUT (ICM_RESERVED+11)
|
||||
/* */
|
||||
|
||||
#define ICM_GETDEFAULTQUALITY (ICM_RESERVED+30)
|
||||
#define ICM_GETQUALITY (ICM_RESERVED+31)
|
||||
#define ICM_SETQUALITY (ICM_RESERVED+32)
|
||||
|
||||
#define ICM_SET (ICM_RESERVED+40)
|
||||
#define ICM_GET (ICM_RESERVED+41)
|
||||
|
||||
/* 2 constant FOURCC codes */
|
||||
#define ICM_FRAMERATE mmioFOURCC('F','r','m','R')
|
||||
#define ICM_KEYFRAMERATE mmioFOURCC('K','e','y','R')
|
||||
|
||||
#define ICM_COMPRESS_GET_FORMAT (ICM_USER+4)
|
||||
#define ICM_COMPRESS_GET_SIZE (ICM_USER+5)
|
||||
#define ICM_COMPRESS_QUERY (ICM_USER+6)
|
||||
#define ICM_COMPRESS_BEGIN (ICM_USER+7)
|
||||
#define ICM_COMPRESS (ICM_USER+8)
|
||||
#define ICM_COMPRESS_END (ICM_USER+9)
|
||||
|
||||
#define ICM_DECOMPRESS_GET_FORMAT (ICM_USER+10)
|
||||
#define ICM_DECOMPRESS_QUERY (ICM_USER+11)
|
||||
#define ICM_DECOMPRESS_BEGIN (ICM_USER+12)
|
||||
#define ICM_DECOMPRESS (ICM_USER+13)
|
||||
#define ICM_DECOMPRESS_END (ICM_USER+14)
|
||||
#define ICM_DECOMPRESS_SET_PALETTE (ICM_USER+29)
|
||||
#define ICM_DECOMPRESS_GET_PALETTE (ICM_USER+30)
|
||||
|
||||
#define ICM_DRAW_QUERY (ICM_USER+31)
|
||||
#define ICM_DRAW_BEGIN (ICM_USER+15)
|
||||
#define ICM_DRAW_GET_PALETTE (ICM_USER+16)
|
||||
#define ICM_DRAW_START (ICM_USER+18)
|
||||
#define ICM_DRAW_STOP (ICM_USER+19)
|
||||
#define ICM_DRAW_END (ICM_USER+21)
|
||||
#define ICM_DRAW_GETTIME (ICM_USER+32)
|
||||
#define ICM_DRAW (ICM_USER+33)
|
||||
#define ICM_DRAW_WINDOW (ICM_USER+34)
|
||||
#define ICM_DRAW_SETTIME (ICM_USER+35)
|
||||
#define ICM_DRAW_REALIZE (ICM_USER+36)
|
||||
#define ICM_DRAW_FLUSH (ICM_USER+37)
|
||||
#define ICM_DRAW_RENDERBUFFER (ICM_USER+38)
|
||||
|
||||
#define ICM_DRAW_START_PLAY (ICM_USER+39)
|
||||
#define ICM_DRAW_STOP_PLAY (ICM_USER+40)
|
||||
|
||||
#define ICM_DRAW_SUGGESTFORMAT (ICM_USER+50)
|
||||
#define ICM_DRAW_CHANGEPALETTE (ICM_USER+51)
|
||||
|
||||
#define ICM_GETBUFFERSWANTED (ICM_USER+41)
|
||||
|
||||
#define ICM_GETDEFAULTKEYFRAMERATE (ICM_USER+42)
|
||||
|
||||
#define ICM_DECOMPRESSEX_BEGIN (ICM_USER+60)
|
||||
#define ICM_DECOMPRESSEX_QUERY (ICM_USER+61)
|
||||
#define ICM_DECOMPRESSEX (ICM_USER+62)
|
||||
#define ICM_DECOMPRESSEX_END (ICM_USER+63)
|
||||
|
||||
#define ICM_COMPRESS_FRAMES_INFO (ICM_USER+70)
|
||||
#define ICM_SET_STATUS_PROC (ICM_USER+72)
|
||||
|
||||
/* structs */
|
||||
|
||||
typedef struct {
|
||||
long dwSize; /* 00: size */
|
||||
long fccType; /* 04: type 'vidc' usually */
|
||||
long fccHandler; /* 08: */
|
||||
long dwVersion; /* 0c: version of compman opening you */
|
||||
long dwFlags; /* 10: LOshort is type specific */
|
||||
LRESULT dwError; /* 14: */
|
||||
void* pV1Reserved; /* 18: */
|
||||
void* pV2Reserved; /* 1c: */
|
||||
long dnDevNode; /* 20: */
|
||||
/* 24: */
|
||||
} ICOPEN,*LPICOPEN;
|
||||
|
||||
#define ICCOMPRESS_KEYFRAME 0x00000001L
|
||||
|
||||
typedef struct {
|
||||
long dwFlags;
|
||||
LPBITMAPINFOHEADER lpbiOutput;
|
||||
void* lpOutput;
|
||||
LPBITMAPINFOHEADER lpbiInput;
|
||||
const void* lpInput;
|
||||
long* lpckid;
|
||||
long* lpdwFlags;
|
||||
long lFrameNum;
|
||||
long dwFrameSize;
|
||||
long dwQuality;
|
||||
LPBITMAPINFOHEADER lpbiPrev;
|
||||
void* lpPrev;
|
||||
} ICCOMPRESS;
|
||||
|
||||
|
||||
long VFWAPI VideoForWindowsVersion(void);
|
||||
|
||||
long VFWAPIV ICCompress(
|
||||
HIC hic,long dwFlags,LPBITMAPINFOHEADER lpbiOutput,void* lpData,
|
||||
LPBITMAPINFOHEADER lpbiInput,void* lpBits,long* lpckid,
|
||||
long* lpdwFlags,long lFrameNum,long dwFrameSize,long dwQuality,
|
||||
LPBITMAPINFOHEADER lpbiPrev,void* lpPrev
|
||||
);
|
||||
|
||||
|
||||
#define ICCompressGetFormat(hic, lpbiInput, lpbiOutput) \
|
||||
ICSendMessage( \
|
||||
hic,ICM_COMPRESS_GET_FORMAT,(long)(void*)(lpbiInput), \
|
||||
(long)(void*)(lpbiOutput) \
|
||||
)
|
||||
|
||||
#define ICCompressGetFormatSize(hic,lpbi) ICCompressGetFormat(hic,lpbi,NULL)
|
||||
|
||||
#define ICGetDefaultKeyFrameRate(hic,lpint) \
|
||||
ICSendMessage( \
|
||||
hic, ICM_GETDEFAULTKEYFRAMERATE, \
|
||||
(long)(void*)(lpint), \
|
||||
0 )
|
||||
|
||||
#define ICGetDefaultQuality(hic,lpint) \
|
||||
ICSendMessage( \
|
||||
hic, ICM_GETDEFAULTQUALITY, \
|
||||
(long)(void*)(lpint), \
|
||||
0 )
|
||||
|
||||
|
||||
#define ICCompressBegin(hic, lpbiInput, lpbiOutput) \
|
||||
ICSendMessage( \
|
||||
hic, ICM_COMPRESS_BEGIN, (long)(void*)(lpbiInput), \
|
||||
(long)(void*)(lpbiOutput) \
|
||||
)
|
||||
|
||||
#define ICCompressGetSize(hic, lpbiInput, lpbiOutput) \
|
||||
ICSendMessage( \
|
||||
hic, ICM_COMPRESS_GET_SIZE, (long)(void*)(lpbiInput), \
|
||||
(long)(void*)(lpbiOutput) \
|
||||
)
|
||||
|
||||
#define ICCompressQuery(hic, lpbiInput, lpbiOutput) \
|
||||
ICSendMessage( \
|
||||
hic, ICM_COMPRESS_QUERY, (long)(void*)(lpbiInput), \
|
||||
(long)(void*)(lpbiOutput) \
|
||||
)
|
||||
|
||||
|
||||
#define ICCompressEnd(hic) ICSendMessage(hic, ICM_COMPRESS_END, 0, 0)
|
||||
|
||||
/* ICCOMPRESSFRAMES.dwFlags */
|
||||
#define ICCOMPRESSFRAMES_PADDING 0x00000001
|
||||
typedef struct {
|
||||
long dwFlags;
|
||||
LPBITMAPINFOHEADER lpbiOutput;
|
||||
LPARAM lOutput;
|
||||
LPBITMAPINFOHEADER lpbiInput;
|
||||
LPARAM lInput;
|
||||
long lStartFrame;
|
||||
long lFrameCount;
|
||||
long lQuality;
|
||||
long lDataRate;
|
||||
long lKeyRate;
|
||||
long dwRate;
|
||||
long dwScale;
|
||||
long dwOverheadPerFrame;
|
||||
long dwReserved2;
|
||||
long CALLBACK (*GetData)(LPARAM lInput,long lFrame,void* lpBits,long len);
|
||||
long CALLBACK (*PutData)(LPARAM lOutput,long lFrame,void* lpBits,long len);
|
||||
} ICCOMPRESSFRAMES;
|
||||
|
||||
/* Values for wMode of ICOpen() */
|
||||
#define ICMODE_COMPRESS 1
|
||||
#define ICMODE_DECOMPRESS 2
|
||||
#define ICMODE_FASTDECOMPRESS 3
|
||||
#define ICMODE_QUERY 4
|
||||
#define ICMODE_FASTCOMPRESS 5
|
||||
#define ICMODE_DRAW 8
|
||||
|
||||
/* quality flags */
|
||||
#define ICQUALITY_LOW 0
|
||||
#define ICQUALITY_HIGH 10000
|
||||
#define ICQUALITY_DEFAULT -1
|
||||
|
||||
typedef struct {
|
||||
long dwSize; /* 00: */
|
||||
long fccType; /* 04:compressor type 'vidc' 'audc' */
|
||||
long fccHandler; /* 08:compressor sub-type 'rle ' 'jpeg' 'pcm '*/
|
||||
long dwFlags; /* 0c:flags LOshort is type specific */
|
||||
long dwVersion; /* 10:version of the driver */
|
||||
long dwVersionICM; /* 14:version of the ICM used */
|
||||
/*
|
||||
* under Win32, the driver always returns UNICODE strings.
|
||||
*/
|
||||
WCHAR szName[16]; /* 18:short name */
|
||||
WCHAR szDescription[128]; /* 38:long name */
|
||||
WCHAR szDriver[128]; /* 138:driver that contains compressor*/
|
||||
/* 238: */
|
||||
} ICINFO;
|
||||
|
||||
/* ICINFO.dwFlags */
|
||||
#define VIDCF_QUALITY 0x0001 /* supports quality */
|
||||
#define VIDCF_CRUNCH 0x0002 /* supports crunching to a frame size */
|
||||
#define VIDCF_TEMPORAL 0x0004 /* supports inter-frame compress */
|
||||
#define VIDCF_COMPRESSFRAMES 0x0008 /* wants the compress all frames message */
|
||||
#define VIDCF_DRAW 0x0010 /* supports drawing */
|
||||
#define VIDCF_FASTTEMPORALC 0x0020 /* does not need prev frame on compress */
|
||||
#define VIDCF_FASTTEMPORALD 0x0080 /* does not need prev frame on decompress */
|
||||
#define VIDCF_QUALITYTIME 0x0040 /* supports temporal quality */
|
||||
|
||||
#define VIDCF_FASTTEMPORAL (VIDCF_FASTTEMPORALC|VIDCF_FASTTEMPORALD)
|
||||
|
||||
|
||||
/* function shortcuts */
|
||||
/* ICM_ABOUT */
|
||||
#define ICMF_ABOUT_QUERY 0x00000001
|
||||
|
||||
#define ICQueryAbout(hic) \
|
||||
(ICSendMessage(hic,ICM_ABOUT,(long)-1,ICMF_ABOUT_QUERY)==ICERR_OK)
|
||||
|
||||
#define ICAbout(hic, hwnd) ICSendMessage(hic,ICM_ABOUT,(long)(unsigned int)(hwnd),0)
|
||||
|
||||
/* ICM_CONFIGURE */
|
||||
#define ICMF_CONFIGURE_QUERY 0x00000001
|
||||
#define ICQueryConfigure(hic) \
|
||||
(ICSendMessage(hic,ICM_CONFIGURE,(long)-1,ICMF_CONFIGURE_QUERY)==ICERR_OK)
|
||||
|
||||
#define ICConfigure(hic,hwnd) \
|
||||
ICSendMessage(hic,ICM_CONFIGURE,(long)(unsigned int)(hwnd),0)
|
||||
|
||||
/* Decompression stuff */
|
||||
#define ICDECOMPRESS_HURRYUP 0x80000000 /* don't draw just buffer (hurry up!) */
|
||||
#define ICDECOMPRESS_UPDATE 0x40000000 /* don't draw just update screen */
|
||||
#define ICDECOMPRESS_PREROL 0x20000000 /* this frame is before real start */
|
||||
#define ICDECOMPRESS_NULLFRAME 0x10000000 /* repeat last frame */
|
||||
#define ICDECOMPRESS_NOTKEYFRAME 0x08000000 /* this frame is not a key frame */
|
||||
|
||||
typedef struct {
|
||||
long dwFlags; /* flags (from AVI index...) */
|
||||
LPBITMAPINFOHEADER lpbiInput; /* BITMAPINFO of compressed data */
|
||||
const void* lpInput; /* compressed data */
|
||||
LPBITMAPINFOHEADER lpbiOutput; /* DIB to decompress to */
|
||||
void* lpOutput;
|
||||
long ckid; /* ckid from AVI file */
|
||||
} ICDECOMPRESS;
|
||||
|
||||
typedef struct {
|
||||
long dwFlags;
|
||||
LPBITMAPINFOHEADER lpbiSrc;
|
||||
const void* lpSrc;
|
||||
LPBITMAPINFOHEADER lpbiDst;
|
||||
void* lpDst;
|
||||
|
||||
/* changed for ICM_DECOMPRESSEX */
|
||||
INT xDst; /* destination rectangle */
|
||||
INT yDst;
|
||||
INT dxDst;
|
||||
INT dyDst;
|
||||
|
||||
INT xSrc; /* source rectangle */
|
||||
INT ySrc;
|
||||
INT dxSrc;
|
||||
INT dySrc;
|
||||
} ICDECOMPRESSEX;
|
||||
|
||||
|
||||
long VFWAPIV ICDecompress(HIC hic,long dwFlags,LPBITMAPINFOHEADER lpbiFormat,void* lpData,LPBITMAPINFOHEADER lpbi,void* lpBits);
|
||||
long VFWAPIV ICDecompressEx(HIC hic,long dwFlags,LPBITMAPINFOHEADER lpbiFormat,void* lpData,LPBITMAPINFOHEADER lpbi,void* lpBits);
|
||||
long VFWAPIV ICUniversalEx(HIC hic,int command,LPBITMAPINFOHEADER lpbiFormat,LPBITMAPINFOHEADER lpbi);
|
||||
|
||||
|
||||
#define ICDecompressBegin(hic, lpbiInput, lpbiOutput) \
|
||||
ICSendMessage( \
|
||||
hic, ICM_DECOMPRESS_BEGIN, (long)(void*)(lpbiInput), \
|
||||
(long)(void*)(lpbiOutput) \
|
||||
)
|
||||
|
||||
#define ICDecompressBeginEx(hic, lpbiInput, lpbiOutput) \
|
||||
ICUniversalEx( \
|
||||
hic, ICM_DECOMPRESSEX_BEGIN, (lpbiInput), \
|
||||
(lpbiOutput) \
|
||||
)
|
||||
|
||||
#define ICDecompressQuery(hic, lpbiInput, lpbiOutput) \
|
||||
ICSendMessage( \
|
||||
hic,ICM_DECOMPRESS_QUERY, (long)(void*)(lpbiInput), \
|
||||
(long) (void*)(lpbiOutput) \
|
||||
)
|
||||
|
||||
#define ICDecompressQueryEx(hic, lpbiInput, lpbiOutput) \
|
||||
ICUniversalEx( \
|
||||
hic,ICM_DECOMPRESSEX_QUERY, (lpbiInput), \
|
||||
(lpbiOutput) \
|
||||
)
|
||||
|
||||
#define ICDecompressGetFormat(hic, lpbiInput, lpbiOutput) \
|
||||
((long)ICSendMessage( \
|
||||
hic,ICM_DECOMPRESS_GET_FORMAT, (long)(void*)(lpbiInput), \
|
||||
(long)(void*)(lpbiOutput) \
|
||||
))
|
||||
|
||||
#define ICDecompressGetFormatSize(hic, lpbi) \
|
||||
ICDecompressGetFormat(hic, lpbi, NULL)
|
||||
|
||||
#define ICDecompressGetPalette(hic, lpbiInput, lpbiOutput) \
|
||||
ICSendMessage( \
|
||||
hic, ICM_DECOMPRESS_GET_PALETTE, (long)(void*)(lpbiInput), \
|
||||
(long)(void*)(lpbiOutput) \
|
||||
)
|
||||
|
||||
#define ICDecompressSetPalette(hic,lpbiPalette) \
|
||||
ICSendMessage( \
|
||||
hic,ICM_DECOMPRESS_SET_PALETTE, \
|
||||
(long)(void*)(lpbiPalette),0 \
|
||||
)
|
||||
|
||||
#define ICDecompressEnd(hic) ICSendMessage(hic, ICM_DECOMPRESS_END, 0, 0)
|
||||
#define ICDecompressEndEx(hic) ICSendMessage(hic,ICM_DECOMPRESSEX_END, 0, 0)
|
||||
|
||||
#define ICDRAW_QUERY 0x00000001L /* test for support */
|
||||
#define ICDRAW_FULLSCREEN 0x00000002L /* draw to full screen */
|
||||
#define ICDRAW_HDC 0x00000004L /* draw to a HDC/HWND */
|
||||
|
||||
|
||||
WIN_BOOL VFWAPI ICInfo(long fccType, long fccHandler, ICINFO * lpicinfo);
|
||||
LRESULT VFWAPI ICGetInfo(HIC hic,ICINFO *picinfo, long cb);
|
||||
HIC VFWAPI ICOpen(long fccType, long fccHandler, UINT wMode);
|
||||
//HIC VFWAPI ICOpenFunction(long fccType, long fccHandler, unsigned int wMode, void* lpfnHandler);
|
||||
|
||||
LRESULT VFWAPI ICClose(HIC hic);
|
||||
LRESULT VFWAPI ICSendMessage(HIC hic, unsigned int msg, long dw1, long dw2);
|
||||
//HIC VFWAPI ICLocate(long fccType, long fccHandler, LPBITMAPINFOHEADER lpbiIn, LPBITMAPINFOHEADER lpbiOut, short wFlags);
|
||||
|
||||
int VFWAPI ICDoSomething(void);
|
||||
|
||||
long VFWAPIV ICDrawBegin(
|
||||
HIC hic,
|
||||
long dwFlags,/* flags */
|
||||
HPALETTE hpal, /* palette to draw with */
|
||||
HWND hwnd, /* window to draw to */
|
||||
HDC hdc, /* HDC to draw to */
|
||||
INT xDst, /* destination rectangle */
|
||||
INT yDst,
|
||||
INT dxDst,
|
||||
INT dyDst,
|
||||
LPBITMAPINFOHEADER lpbi, /* format of frame to draw */
|
||||
INT xSrc, /* source rectangle */
|
||||
INT ySrc,
|
||||
INT dxSrc,
|
||||
INT dySrc,
|
||||
long dwRate, /* frames/second = (dwRate/dwScale) */
|
||||
long dwScale
|
||||
);
|
||||
|
||||
/* as passed to ICM_DRAW_BEGIN (FIXME: correct only for Win32?) */
|
||||
typedef struct {
|
||||
long dwFlags;
|
||||
HPALETTE hpal;
|
||||
HWND hwnd;
|
||||
HDC hdc;
|
||||
INT xDst;
|
||||
INT yDst;
|
||||
INT dxDst;
|
||||
INT dyDst;
|
||||
LPBITMAPINFOHEADER lpbi;
|
||||
INT xSrc;
|
||||
INT ySrc;
|
||||
INT dxSrc;
|
||||
INT dySrc;
|
||||
long dwRate;
|
||||
long dwScale;
|
||||
} ICDRAWBEGIN;
|
||||
|
||||
#define ICDRAW_HURRYUP 0x80000000L /* don't draw just buffer (hurry up!) */
|
||||
#define ICDRAW_UPDATE 0x40000000L /* don't draw just update screen */
|
||||
#define ICDRAW_PREROLL 0x20000000L /* this frame is before real start */
|
||||
#define ICDRAW_NULLFRAME 0x10000000L /* repeat last frame */
|
||||
#define ICDRAW_NOTKEYFRAME 0x08000000L /* this frame is not a key frame */
|
||||
|
||||
typedef struct {
|
||||
long dwFlags;
|
||||
void* lpFormat;
|
||||
void* lpData;
|
||||
long cbData;
|
||||
long lTime;
|
||||
} ICDRAW;
|
||||
|
||||
long VFWAPIV ICDraw(HIC hic,long dwFlags,void* lpFormat,void* lpData,long cbData,long lTime);
|
||||
|
||||
|
||||
#define AVIGETFRAMEF_BESTDISPLAYFMT 1
|
||||
|
||||
typedef struct AVISTREAMINFOA {
|
||||
long fccType;
|
||||
long fccHandler;
|
||||
long dwFlags; /* AVIIF_* */
|
||||
long dwCaps;
|
||||
short wPriority;
|
||||
short wLanguage;
|
||||
long dwScale;
|
||||
long dwRate; /* dwRate / dwScale == samples/second */
|
||||
long dwStart;
|
||||
long dwLength; /* In units above... */
|
||||
long dwInitialFrames;
|
||||
long dwSuggestedBufferSize;
|
||||
long dwQuality;
|
||||
long dwSampleSize;
|
||||
RECT rcFrame;
|
||||
long dwEditCount;
|
||||
long dwFormatChangeCount;
|
||||
char szName[64];
|
||||
} AVISTREAMINFOA, * LPAVISTREAMINFOA, *PAVISTREAMINFOA;
|
||||
|
||||
typedef struct AVISTREAMINFOW {
|
||||
long fccType;
|
||||
long fccHandler;
|
||||
long dwFlags;
|
||||
long dwCaps;
|
||||
short wPriority;
|
||||
short wLanguage;
|
||||
long dwScale;
|
||||
long dwRate; /* dwRate / dwScale == samples/second */
|
||||
long dwStart;
|
||||
long dwLength; /* In units above... */
|
||||
long dwInitialFrames;
|
||||
long dwSuggestedBufferSize;
|
||||
long dwQuality;
|
||||
long dwSampleSize;
|
||||
RECT rcFrame;
|
||||
long dwEditCount;
|
||||
long dwFormatChangeCount;
|
||||
short szName[64];
|
||||
} AVISTREAMINFOW, * LPAVISTREAMINFOW, *PAVISTREAMINFOW;
|
||||
DECL_WINELIB_TYPE_AW(AVISTREAMINFO)
|
||||
DECL_WINELIB_TYPE_AW(LPAVISTREAMINFO)
|
||||
DECL_WINELIB_TYPE_AW(PAVISTREAMINFO)
|
||||
|
||||
#define AVISTREAMINFO_DISABLED 0x00000001
|
||||
#define AVISTREAMINFO_FORMATCHANGES 0x00010000
|
||||
|
||||
/* AVIFILEINFO.dwFlags */
|
||||
#define AVIFILEINFO_HASINDEX 0x00000010
|
||||
#define AVIFILEINFO_MUSTUSEINDEX 0x00000020
|
||||
#define AVIFILEINFO_ISINTERLEAVED 0x00000100
|
||||
#define AVIFILEINFO_WASCAPTUREFILE 0x00010000
|
||||
#define AVIFILEINFO_COPYRIGHTED 0x00020000
|
||||
|
||||
/* AVIFILEINFO.dwCaps */
|
||||
#define AVIFILECAPS_CANREAD 0x00000001
|
||||
#define AVIFILECAPS_CANWRITE 0x00000002
|
||||
#define AVIFILECAPS_ALLKEYFRAMES 0x00000010
|
||||
#define AVIFILECAPS_NOCOMPRESSION 0x00000020
|
||||
|
||||
typedef struct AVIFILEINFOW {
|
||||
long dwMaxBytesPerSec;
|
||||
long dwFlags;
|
||||
long dwCaps;
|
||||
long dwStreams;
|
||||
long dwSuggestedBufferSize;
|
||||
long dwWidth;
|
||||
long dwHeight;
|
||||
long dwScale;
|
||||
long dwRate;
|
||||
long dwLength;
|
||||
long dwEditCount;
|
||||
short szFileType[64];
|
||||
} AVIFILEINFOW, * LPAVIFILEINFOW, *PAVIFILEINFOW;
|
||||
|
||||
typedef struct AVIFILEINFOA {
|
||||
long dwMaxBytesPerSec;
|
||||
long dwFlags;
|
||||
long dwCaps;
|
||||
long dwStreams;
|
||||
long dwSuggestedBufferSize;
|
||||
long dwWidth;
|
||||
long dwHeight;
|
||||
long dwScale;
|
||||
long dwRate;
|
||||
long dwLength;
|
||||
long dwEditCount;
|
||||
char szFileType[64];
|
||||
} AVIFILEINFOA, * LPAVIFILEINFOA, *PAVIFILEINFOA;
|
||||
|
||||
DECL_WINELIB_TYPE_AW(AVIFILEINFO)
|
||||
DECL_WINELIB_TYPE_AW(PAVIFILEINFO)
|
||||
DECL_WINELIB_TYPE_AW(LPAVIFILEINFO)
|
||||
|
||||
/* AVICOMPRESSOPTIONS.dwFlags. determines presence of fields in below struct */
|
||||
#define AVICOMPRESSF_INTERLEAVE 0x00000001
|
||||
#define AVICOMPRESSF_DATARATE 0x00000002
|
||||
#define AVICOMPRESSF_KEYFRAMES 0x00000004
|
||||
#define AVICOMPRESSF_VALID 0x00000008
|
||||
|
||||
typedef struct {
|
||||
long fccType; /* stream type, for consistency */
|
||||
long fccHandler; /* compressor */
|
||||
long dwKeyFrameEvery; /* keyframe rate */
|
||||
long dwQuality; /* compress quality 0-10,000 */
|
||||
long dwBytesPerSecond; /* unsigned chars per second */
|
||||
long dwFlags; /* flags... see below */
|
||||
void* lpFormat; /* save format */
|
||||
long cbFormat;
|
||||
void* lpParms; /* compressor options */
|
||||
long cbParms;
|
||||
long dwInterleaveEvery; /* for non-video streams only */
|
||||
} AVICOMPRESSOPTIONS, *LPAVICOMPRESSOPTIONS,*PAVICOMPRESSOPTIONS;
|
||||
|
||||
|
||||
|
||||
typedef struct {
|
||||
long cbSize; // set to sizeof(COMPVARS) before
|
||||
// calling ICCompressorChoose
|
||||
long dwFlags; // see below...
|
||||
HIC hic; // HIC of chosen compressor
|
||||
long fccType; // basically ICTYPE_VIDEO
|
||||
long fccHandler; // handler of chosen compressor or
|
||||
// "" or "DIB "
|
||||
LPBITMAPINFO lpbiIn; // input format
|
||||
LPBITMAPINFO lpbiOut; // output format - will compress to this
|
||||
void* lpBitsOut;
|
||||
void* lpBitsPrev;
|
||||
long lFrame;
|
||||
long lKey; // key frames how often?
|
||||
long lDataRate; // desired data rate KB/Sec
|
||||
long lQ; // desired quality
|
||||
long lKeyCount;
|
||||
void* lpState; // state of compressor
|
||||
long cbState; // size of the state
|
||||
} COMPVARS, *PCOMPVARS;
|
||||
|
||||
// FLAGS for dwFlags element of COMPVARS structure:
|
||||
|
||||
|
||||
#define AVIERR_OK 0
|
||||
#define MAKE_AVIERR(error) MAKE_SCODE(SEVERITY_ERROR,FACILITY_ITF,0x4000+error)
|
||||
|
||||
#define AVIERR_UNSUPPORTED MAKE_AVIERR(101)
|
||||
#define AVIERR_BADFORMAT MAKE_AVIERR(102)
|
||||
#define AVIERR_MEMORY MAKE_AVIERR(103)
|
||||
#define AVIERR_INTERNAL MAKE_AVIERR(104)
|
||||
#define AVIERR_BADFLAGS MAKE_AVIERR(105)
|
||||
#define AVIERR_BADPARAM MAKE_AVIERR(106)
|
||||
#define AVIERR_BADSIZE MAKE_AVIERR(107)
|
||||
#define AVIERR_BADHANDLE MAKE_AVIERR(108)
|
||||
#define AVIERR_FILEREAD MAKE_AVIERR(109)
|
||||
#define AVIERR_FILEWRITE MAKE_AVIERR(110)
|
||||
#define AVIERR_FILEOPEN MAKE_AVIERR(111)
|
||||
#define AVIERR_COMPRESSOR MAKE_AVIERR(112)
|
||||
#define AVIERR_NOCOMPRESSOR MAKE_AVIERR(113)
|
||||
#define AVIERR_READONLY MAKE_AVIERR(114)
|
||||
#define AVIERR_NODATA MAKE_AVIERR(115)
|
||||
#define AVIERR_BUFFERTOOSMALL MAKE_AVIERR(116)
|
||||
#define AVIERR_CANTCOMPRESS MAKE_AVIERR(117)
|
||||
#define AVIERR_USERABORT MAKE_AVIERR(198)
|
||||
#define AVIERR_ERROR MAKE_AVIERR(199)
|
||||
|
||||
#endif /* MPLAYER_VFW_H */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,628 +0,0 @@
|
||||
/*
|
||||
* Basic types definitions
|
||||
*
|
||||
* Copyright 1996 Alexandre Julliard
|
||||
*
|
||||
* Modified for use with MPlayer, detailed changelog at
|
||||
* http://svn.mplayerhq.hu/mplayer/trunk/
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef MPLAYER_WINDEF_H
|
||||
#define MPLAYER_WINDEF_H
|
||||
|
||||
# include "config.h"
|
||||
|
||||
/* Misc. constants. */
|
||||
|
||||
#ifdef FALSE
|
||||
#undef FALSE
|
||||
#endif
|
||||
#define FALSE 0
|
||||
|
||||
#ifdef TRUE
|
||||
#undef TRUE
|
||||
#endif
|
||||
#define TRUE 1
|
||||
|
||||
#ifdef NULL
|
||||
#undef NULL
|
||||
#endif
|
||||
#define NULL 0
|
||||
|
||||
/* Macros to map Winelib names to the correct implementation name */
|
||||
/* Note that Winelib is purely Win32. */
|
||||
|
||||
# define WINELIB_NAME_AW(func) \
|
||||
func##_must_be_suffixed_with_W_or_A_in_this_context \
|
||||
func##_must_be_suffixed_with_W_or_A_in_this_context
|
||||
|
||||
# define DECL_WINELIB_TYPE_AW(type) /* nothing */
|
||||
|
||||
#ifndef NONAMELESSSTRUCT
|
||||
# define NONAMELESSSTRUCT
|
||||
#endif /* !defined(NONAMELESSSTRUCT) */
|
||||
|
||||
#ifndef NONAMELESSUNION
|
||||
# define NONAMELESSUNION
|
||||
#endif /* !defined(NONAMELESSUNION) */
|
||||
|
||||
#if 0
|
||||
|
||||
#ifndef NONAMELESSSTRUCT
|
||||
#define DUMMYSTRUCTNAME
|
||||
#define DUMMYSTRUCTNAME1
|
||||
#define DUMMYSTRUCTNAME2
|
||||
#define DUMMYSTRUCTNAME3
|
||||
#define DUMMYSTRUCTNAME4
|
||||
#define DUMMYSTRUCTNAME5
|
||||
#else /* !defined(NONAMELESSSTRUCT) */
|
||||
#define DUMMYSTRUCTNAME s
|
||||
#define DUMMYSTRUCTNAME1 s1
|
||||
#define DUMMYSTRUCTNAME2 s2
|
||||
#define DUMMYSTRUCTNAME3 s3
|
||||
#define DUMMYSTRUCTNAME4 s4
|
||||
#define DUMMYSTRUCTNAME5 s5
|
||||
#endif /* !defined(NONAMELESSSTRUCT) */
|
||||
|
||||
#ifndef NONAMELESSUNION
|
||||
#define DUMMYUNIONNAME
|
||||
#define DUMMYUNIONNAME1
|
||||
#define DUMMYUNIONNAME2
|
||||
#define DUMMYUNIONNAME3
|
||||
#define DUMMYUNIONNAME4
|
||||
#define DUMMYUNIONNAME5
|
||||
#else /* !defined(NONAMELESSUNION) */
|
||||
#define DUMMYUNIONNAME u
|
||||
#define DUMMYUNIONNAME1 u1
|
||||
#define DUMMYUNIONNAME2 u2
|
||||
#define DUMMYUNIONNAME3 u3
|
||||
#define DUMMYUNIONNAME4 u4
|
||||
#define DUMMYUNIONNAME5 u5
|
||||
#endif /* !defined(NONAMELESSUNION) */
|
||||
|
||||
#endif
|
||||
|
||||
/* Calling conventions definitions */
|
||||
|
||||
#ifdef __i386__
|
||||
# if defined(__GNUC__) && ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 7)))
|
||||
#define __stdcall __attribute__((__stdcall__))
|
||||
#define __cdecl __attribute__((__cdecl__))
|
||||
# define RESTORE_ES __asm__ volatile("pushl %ds\n\tpopl %es")
|
||||
# else
|
||||
// # error You need gcc >= 2.7 to build Wine on a 386
|
||||
# endif
|
||||
#else
|
||||
# define __stdcall
|
||||
# define __cdecl
|
||||
# define RESTORE_ES
|
||||
#endif
|
||||
|
||||
#define CALLBACK __stdcall
|
||||
#define WINAPI __stdcall
|
||||
#define APIPRIVATE __stdcall
|
||||
#define PASCAL __stdcall
|
||||
#define pascal __stdcall
|
||||
#define _pascal __stdcall
|
||||
#if !defined(__CYGWIN__) && !defined(__MINGW32__)
|
||||
#define _stdcall __stdcall
|
||||
#define _fastcall __stdcall
|
||||
#define __fastcall __stdcall
|
||||
#endif
|
||||
#define __export __stdcall
|
||||
#define CDECL __cdecl
|
||||
#define _CDECL __cdecl
|
||||
#define cdecl __cdecl
|
||||
#if !defined(__CYGWIN__) && !defined(__MINGW32__)
|
||||
#define _cdecl __cdecl
|
||||
#endif
|
||||
#define WINAPIV __cdecl
|
||||
#define APIENTRY WINAPI
|
||||
|
||||
#if !defined(__CYGWIN__) && !defined(__MINGW32__)
|
||||
#define __declspec(x)
|
||||
#endif
|
||||
#define dllimport
|
||||
#define dllexport
|
||||
|
||||
#define CONST const
|
||||
|
||||
/* Standard data types. These are the same for emulator and library. */
|
||||
|
||||
typedef void VOID;
|
||||
typedef int INT;
|
||||
typedef unsigned int UINT;
|
||||
typedef unsigned short WORD;
|
||||
typedef unsigned long DWORD;
|
||||
typedef unsigned long ULONG;
|
||||
typedef unsigned char BYTE;
|
||||
typedef long LONG;
|
||||
typedef short SHORT;
|
||||
typedef unsigned short USHORT;
|
||||
typedef char CHAR;
|
||||
typedef unsigned char UCHAR;
|
||||
|
||||
typedef LONG SCODE;
|
||||
|
||||
/* Some systems might have wchar_t, but we really need 16 bit characters */
|
||||
typedef unsigned short WCHAR;
|
||||
typedef int WIN_BOOL;
|
||||
typedef double DATE;
|
||||
typedef double DOUBLE;
|
||||
typedef long long LONGLONG;
|
||||
typedef unsigned long long ULONGLONG;
|
||||
|
||||
/* FIXME: Wine does not compile with strict on, therefore strict
|
||||
* handles are presently only usable on machines where sizeof(UINT) ==
|
||||
* sizeof(void*). HANDLEs are supposed to be void* but a large amount
|
||||
* of WINE code operates on HANDLES as if they are UINTs. So to WINE
|
||||
* they exist as UINTs but to the Winelib user who turns on strict,
|
||||
* they exist as void*. If there is a size difference between UINT and
|
||||
* void* then things get ugly. */
|
||||
#ifdef STRICT
|
||||
typedef VOID* HANDLE;
|
||||
#else
|
||||
typedef UINT HANDLE;
|
||||
#endif
|
||||
|
||||
|
||||
typedef HANDLE *LPHANDLE;
|
||||
|
||||
/* Integer types. These are the same for emulator and library. */
|
||||
typedef UINT WPARAM;
|
||||
typedef LONG LPARAM;
|
||||
typedef LONG HRESULT;
|
||||
typedef LONG LRESULT;
|
||||
typedef WORD ATOM;
|
||||
typedef WORD CATCHBUF[9];
|
||||
typedef WORD *LPCATCHBUF;
|
||||
typedef HANDLE HHOOK;
|
||||
typedef HANDLE HMONITOR;
|
||||
typedef DWORD LCID;
|
||||
typedef WORD LANGID;
|
||||
typedef DWORD LCTYPE;
|
||||
typedef float FLOAT;
|
||||
|
||||
/* Pointers types. These are the same for emulator and library. */
|
||||
/* winnt types */
|
||||
typedef VOID *PVOID;
|
||||
typedef const void *PCVOID;
|
||||
typedef CHAR *PCHAR;
|
||||
typedef UCHAR *PUCHAR;
|
||||
typedef BYTE *PBYTE;
|
||||
typedef WORD *PWORD;
|
||||
typedef USHORT *PUSHORT;
|
||||
typedef SHORT *PSHORT;
|
||||
typedef ULONG *PULONG;
|
||||
typedef LONG *PLONG;
|
||||
typedef DWORD *PDWORD;
|
||||
/* common win32 types */
|
||||
typedef CHAR *LPSTR;
|
||||
typedef CHAR *PSTR;
|
||||
typedef const CHAR *LPCSTR;
|
||||
typedef const CHAR *PCSTR;
|
||||
typedef WCHAR *LPWSTR;
|
||||
typedef WCHAR *PWSTR;
|
||||
typedef const WCHAR *LPCWSTR;
|
||||
typedef const WCHAR *PCWSTR;
|
||||
typedef BYTE *LPBYTE;
|
||||
typedef WORD *LPWORD;
|
||||
typedef DWORD *LPDWORD;
|
||||
typedef LONG *LPLONG;
|
||||
typedef VOID *LPVOID;
|
||||
typedef const VOID *LPCVOID;
|
||||
typedef INT *PINT;
|
||||
typedef INT *LPINT;
|
||||
typedef UINT *PUINT;
|
||||
typedef UINT *LPUINT;
|
||||
typedef FLOAT *PFLOAT;
|
||||
typedef FLOAT *LPFLOAT;
|
||||
typedef WIN_BOOL *PWIN_BOOL;
|
||||
typedef WIN_BOOL *LPWIN_BOOL;
|
||||
|
||||
/* Special case: a segmented pointer is just a pointer in the user's code. */
|
||||
|
||||
typedef DWORD SEGPTR;
|
||||
|
||||
/* Handle types that exist both in Win16 and Win32. */
|
||||
|
||||
#ifdef STRICT
|
||||
#define DECLARE_HANDLE(a) \
|
||||
typedef struct a##__ { int unused; } *a; \
|
||||
typedef a *P##a; \
|
||||
typedef a *LP##a
|
||||
#else /*STRICT*/
|
||||
#define DECLARE_HANDLE(a) \
|
||||
typedef HANDLE a; \
|
||||
typedef a *P##a; \
|
||||
typedef a *LP##a
|
||||
#endif /*STRICT*/
|
||||
|
||||
DECLARE_HANDLE(HACMDRIVERID);
|
||||
DECLARE_HANDLE(HACMDRIVER);
|
||||
DECLARE_HANDLE(HACMOBJ);
|
||||
DECLARE_HANDLE(HACMSTREAM);
|
||||
DECLARE_HANDLE(HMETAFILEPICT);
|
||||
|
||||
DECLARE_HANDLE(HACCEL);
|
||||
DECLARE_HANDLE(HBITMAP);
|
||||
DECLARE_HANDLE(HBRUSH);
|
||||
DECLARE_HANDLE(HCOLORSPACE);
|
||||
DECLARE_HANDLE(HCURSOR);
|
||||
DECLARE_HANDLE(HDC);
|
||||
DECLARE_HANDLE(HDROP);
|
||||
DECLARE_HANDLE(HDRVR);
|
||||
DECLARE_HANDLE(HDWP);
|
||||
DECLARE_HANDLE(HENHMETAFILE);
|
||||
DECLARE_HANDLE(HFILE);
|
||||
DECLARE_HANDLE(HFONT);
|
||||
DECLARE_HANDLE(HICON);
|
||||
DECLARE_HANDLE(HINSTANCE);
|
||||
DECLARE_HANDLE(HKEY);
|
||||
DECLARE_HANDLE(HMENU);
|
||||
DECLARE_HANDLE(HMETAFILE);
|
||||
DECLARE_HANDLE(HMIDI);
|
||||
DECLARE_HANDLE(HMIDIIN);
|
||||
DECLARE_HANDLE(HMIDIOUT);
|
||||
DECLARE_HANDLE(HMIDISTRM);
|
||||
DECLARE_HANDLE(HMIXER);
|
||||
DECLARE_HANDLE(HMIXEROBJ);
|
||||
DECLARE_HANDLE(HMMIO);
|
||||
DECLARE_HANDLE(HPALETTE);
|
||||
DECLARE_HANDLE(HPEN);
|
||||
DECLARE_HANDLE(HQUEUE);
|
||||
DECLARE_HANDLE(HRGN);
|
||||
DECLARE_HANDLE(HRSRC);
|
||||
DECLARE_HANDLE(HTASK);
|
||||
DECLARE_HANDLE(HWAVE);
|
||||
DECLARE_HANDLE(HWAVEIN);
|
||||
DECLARE_HANDLE(HWAVEOUT);
|
||||
DECLARE_HANDLE(HWINSTA);
|
||||
DECLARE_HANDLE(HDESK);
|
||||
DECLARE_HANDLE(HWND);
|
||||
DECLARE_HANDLE(HKL);
|
||||
DECLARE_HANDLE(HIC);
|
||||
DECLARE_HANDLE(HRASCONN);
|
||||
|
||||
/* Handle types that must remain interchangeable even with strict on */
|
||||
|
||||
typedef HINSTANCE HMODULE;
|
||||
typedef HANDLE HGDIOBJ;
|
||||
typedef HANDLE HGLOBAL;
|
||||
typedef HANDLE HLOCAL;
|
||||
typedef HANDLE GLOBALHANDLE;
|
||||
typedef HANDLE LOCALHANDLE;
|
||||
|
||||
/* Callback function pointers types */
|
||||
//WIN_BOOL CALLBACK DATEFMT_ENUMPROCA(LPSTR);
|
||||
|
||||
typedef WIN_BOOL CALLBACK (* DATEFMT_ENUMPROCA)(LPSTR);
|
||||
typedef WIN_BOOL CALLBACK (* DATEFMT_ENUMPROCW)(LPWSTR);
|
||||
DECL_WINELIB_TYPE_AW(DATEFMT_ENUMPROC)
|
||||
typedef WIN_BOOL CALLBACK (*DLGPROC)(HWND,UINT,WPARAM,LPARAM);
|
||||
typedef LRESULT CALLBACK (*DRIVERPROC)(DWORD,HDRVR,UINT,LPARAM,LPARAM);
|
||||
typedef INT CALLBACK (*EDITWORDBREAKPROCA)(LPSTR,INT,INT,INT);
|
||||
typedef INT CALLBACK (*EDITWORDBREAKPROCW)(LPWSTR,INT,INT,INT);
|
||||
DECL_WINELIB_TYPE_AW(EDITWORDBREAKPROC)
|
||||
typedef LRESULT CALLBACK (*FARPROC)(void);
|
||||
typedef INT CALLBACK (*PROC)(void);
|
||||
typedef WIN_BOOL CALLBACK (*GRAYSTRINGPROC)(HDC,LPARAM,INT);
|
||||
typedef LRESULT CALLBACK (*HOOKPROC)(INT,WPARAM,LPARAM);
|
||||
typedef WIN_BOOL CALLBACK (*PROPENUMPROCA)(HWND,LPCSTR,HANDLE);
|
||||
typedef WIN_BOOL CALLBACK (*PROPENUMPROCW)(HWND,LPCWSTR,HANDLE);
|
||||
DECL_WINELIB_TYPE_AW(PROPENUMPROC)
|
||||
typedef WIN_BOOL CALLBACK (*PROPENUMPROCEXA)(HWND,LPCSTR,HANDLE,LPARAM);
|
||||
typedef WIN_BOOL CALLBACK (*PROPENUMPROCEXW)(HWND,LPCWSTR,HANDLE,LPARAM);
|
||||
DECL_WINELIB_TYPE_AW(PROPENUMPROCEX)
|
||||
typedef WIN_BOOL CALLBACK (* TIMEFMT_ENUMPROCA)(LPSTR);
|
||||
typedef WIN_BOOL CALLBACK (* TIMEFMT_ENUMPROCW)(LPWSTR);
|
||||
DECL_WINELIB_TYPE_AW(TIMEFMT_ENUMPROC)
|
||||
typedef VOID CALLBACK (*TIMERPROC)(HWND,UINT,UINT,DWORD);
|
||||
typedef WIN_BOOL CALLBACK (*WNDENUMPROC)(HWND,LPARAM);
|
||||
typedef LRESULT CALLBACK (*WNDPROC)(HWND,UINT,WPARAM,LPARAM);
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
** FIXME: Better isolate Wine's reliance on the xxx16 type definitions.
|
||||
** For now, we just isolate them to make the situation clear.
|
||||
**--------------------------------------------------------------------------*/
|
||||
/*
|
||||
* Basic type definitions for 16 bit variations on Windows types.
|
||||
* These types are provided mostly to insure compatibility with
|
||||
* 16 bit windows code.
|
||||
*/
|
||||
|
||||
#ifndef MPLAYER_WINDEF16_H
|
||||
#define MPLAYER_WINDEF16_H
|
||||
|
||||
#include "windef.h"
|
||||
|
||||
/* Standard data types */
|
||||
|
||||
typedef short INT16;
|
||||
typedef unsigned short UINT16;
|
||||
typedef unsigned short WIN_BOOL16;
|
||||
|
||||
typedef UINT16 HANDLE16;
|
||||
typedef HANDLE16 *LPHANDLE16;
|
||||
|
||||
typedef UINT16 WPARAM16;
|
||||
typedef INT16 *LPINT16;
|
||||
typedef UINT16 *LPUINT16;
|
||||
|
||||
#define DECLARE_HANDLE16(a) \
|
||||
typedef HANDLE16 a##16; \
|
||||
typedef a##16 *P##a##16; \
|
||||
typedef a##16 *NP##a##16; \
|
||||
typedef a##16 *LP##a##16
|
||||
|
||||
DECLARE_HANDLE16(HACMDRIVERID);
|
||||
DECLARE_HANDLE16(HACMDRIVER);
|
||||
DECLARE_HANDLE16(HACMOBJ);
|
||||
DECLARE_HANDLE16(HACMSTREAM);
|
||||
DECLARE_HANDLE16(HMETAFILEPICT);
|
||||
|
||||
DECLARE_HANDLE16(HACCEL);
|
||||
DECLARE_HANDLE16(HBITMAP);
|
||||
DECLARE_HANDLE16(HBRUSH);
|
||||
DECLARE_HANDLE16(HCOLORSPACE);
|
||||
DECLARE_HANDLE16(HCURSOR);
|
||||
DECLARE_HANDLE16(HDC);
|
||||
DECLARE_HANDLE16(HDROP);
|
||||
DECLARE_HANDLE16(HDRVR);
|
||||
DECLARE_HANDLE16(HDWP);
|
||||
DECLARE_HANDLE16(HENHMETAFILE);
|
||||
DECLARE_HANDLE16(HFILE);
|
||||
DECLARE_HANDLE16(HFONT);
|
||||
DECLARE_HANDLE16(HICON);
|
||||
DECLARE_HANDLE16(HINSTANCE);
|
||||
DECLARE_HANDLE16(HKEY);
|
||||
DECLARE_HANDLE16(HMENU);
|
||||
DECLARE_HANDLE16(HMETAFILE);
|
||||
DECLARE_HANDLE16(HMIDI);
|
||||
DECLARE_HANDLE16(HMIDIIN);
|
||||
DECLARE_HANDLE16(HMIDIOUT);
|
||||
DECLARE_HANDLE16(HMIDISTRM);
|
||||
DECLARE_HANDLE16(HMIXER);
|
||||
DECLARE_HANDLE16(HMIXEROBJ);
|
||||
DECLARE_HANDLE16(HMMIO);
|
||||
DECLARE_HANDLE16(HPALETTE);
|
||||
DECLARE_HANDLE16(HPEN);
|
||||
DECLARE_HANDLE16(HQUEUE);
|
||||
DECLARE_HANDLE16(HRGN);
|
||||
DECLARE_HANDLE16(HRSRC);
|
||||
DECLARE_HANDLE16(HTASK);
|
||||
DECLARE_HANDLE16(HWAVE);
|
||||
DECLARE_HANDLE16(HWAVEIN);
|
||||
DECLARE_HANDLE16(HWAVEOUT);
|
||||
DECLARE_HANDLE16(HWINSTA);
|
||||
DECLARE_HANDLE16(HDESK);
|
||||
DECLARE_HANDLE16(HWND);
|
||||
DECLARE_HANDLE16(HKL);
|
||||
DECLARE_HANDLE16(HIC);
|
||||
DECLARE_HANDLE16(HRASCONN);
|
||||
#undef DECLARE_HANDLE16
|
||||
|
||||
typedef HINSTANCE16 HMODULE16;
|
||||
typedef HANDLE16 HGDIOBJ16;
|
||||
typedef HANDLE16 HGLOBAL16;
|
||||
typedef HANDLE16 HLOCAL16;
|
||||
|
||||
/* The SIZE structure */
|
||||
typedef struct
|
||||
{
|
||||
INT16 cx;
|
||||
INT16 cy;
|
||||
} SIZE16, *PSIZE16, *LPSIZE16;
|
||||
|
||||
/* The POINT structure */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
INT16 x;
|
||||
INT16 y;
|
||||
} POINT16, *PPOINT16, *LPPOINT16;
|
||||
|
||||
/* The RECT structure */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
INT16 left;
|
||||
INT16 top;
|
||||
INT16 right;
|
||||
INT16 bottom;
|
||||
} RECT16, *LPRECT16;
|
||||
|
||||
/* Callback function pointers types */
|
||||
|
||||
typedef LRESULT CALLBACK (*DRIVERPROC16)(DWORD,HDRVR16,UINT16,LPARAM,LPARAM);
|
||||
typedef WIN_BOOL16 CALLBACK (*DLGPROC16)(HWND16,UINT16,WPARAM16,LPARAM);
|
||||
typedef INT16 CALLBACK (*EDITWORDBREAKPROC16)(LPSTR,INT16,INT16,INT16);
|
||||
typedef LRESULT CALLBACK (*FARPROC16)(void);
|
||||
typedef INT16 CALLBACK (*PROC16)(void);
|
||||
typedef WIN_BOOL16 CALLBACK (*GRAYSTRINGPROC16)(HDC16,LPARAM,INT16);
|
||||
typedef LRESULT CALLBACK (*HOOKPROC16)(INT16,WPARAM16,LPARAM);
|
||||
typedef WIN_BOOL16 CALLBACK (*PROPENUMPROC16)(HWND16,SEGPTR,HANDLE16);
|
||||
typedef VOID CALLBACK (*TIMERPROC16)(HWND16,UINT16,UINT16,DWORD);
|
||||
typedef LRESULT CALLBACK (*WNDENUMPROC16)(HWND16,LPARAM);
|
||||
typedef LRESULT CALLBACK (*WNDPROC16)(HWND16,UINT16,WPARAM16,LPARAM);
|
||||
|
||||
#endif /* MPLAYER_WINDEF16_H */
|
||||
|
||||
/* Define some empty macros for compatibility with Windows code. */
|
||||
|
||||
/* Macro for structure packing. */
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define WINE_PACKED __attribute__((packed))
|
||||
#define WINE_UNUSED __attribute__((unused))
|
||||
#define WINE_NORETURN __attribute__((noreturn))
|
||||
#else
|
||||
#define WINE_PACKED /* nothing */
|
||||
#define WINE_UNUSED /* nothing */
|
||||
#define WINE_NORETURN /* nothing */
|
||||
#endif
|
||||
|
||||
/* Macros to split words and longs. */
|
||||
|
||||
#define LOBYTE(w) ((BYTE)(WORD)(w))
|
||||
#define HIBYTE(w) ((BYTE)((WORD)(w) >> 8))
|
||||
|
||||
#define LOWORD(l) ((WORD)(DWORD)(l))
|
||||
#define HIWORD(l) ((WORD)((DWORD)(l) >> 16))
|
||||
|
||||
#define SLOWORD(l) ((INT16)(LONG)(l))
|
||||
#define SHIWORD(l) ((INT16)((LONG)(l) >> 16))
|
||||
|
||||
#define MAKEWORD(low,high) ((WORD)(((BYTE)(low)) | ((WORD)((BYTE)(high))) << 8))
|
||||
#define MAKELONG(low,high) ((LONG)(((WORD)(low)) | (((DWORD)((WORD)(high))) << 16)))
|
||||
#define MAKELPARAM(low,high) ((LPARAM)MAKELONG(low,high))
|
||||
#define MAKEWPARAM(low,high) ((WPARAM)MAKELONG(low,high))
|
||||
#define MAKELRESULT(low,high) ((LRESULT)MAKELONG(low,high))
|
||||
#define MAKEINTATOM(atom) ((LPCSTR)MAKELONG((atom),0))
|
||||
|
||||
#define SELECTOROF(ptr) (HIWORD(ptr))
|
||||
#define OFFSETOF(ptr) (LOWORD(ptr))
|
||||
|
||||
/* macros to set parts of a DWORD (not in the Windows API) */
|
||||
#define SET_LOWORD(dw,val) ((dw) = ((dw) & 0xffff0000) | LOWORD(val))
|
||||
#define SET_LOBYTE(dw,val) ((dw) = ((dw) & 0xffffff00) | LOBYTE(val))
|
||||
#define SET_HIBYTE(dw,val) ((dw) = ((dw) & 0xffff00ff) | (LOWORD(val) & 0xff00))
|
||||
#define ADD_LOWORD(dw,val) ((dw) = ((dw) & 0xffff0000) | LOWORD((DWORD)(dw)+(val)))
|
||||
|
||||
/* Macros to access unaligned or wrong-endian WORDs and DWORDs. */
|
||||
/* Note: These macros are semantically broken, at least for wrc. wrc
|
||||
spits out data in the platform's current binary format, *not* in
|
||||
little-endian format. These macros are used throughout the resource
|
||||
code to load and store data to the resources. Since it is unlikely
|
||||
that we'll ever be dealing with little-endian resource data, the
|
||||
byte-swapping nature of these macros has been disabled. Rather than
|
||||
remove the use of these macros from the resource loading code, the
|
||||
macros have simply been disabled. In the future, someone may want
|
||||
to reactivate these macros for other purposes. In that case, the
|
||||
resource code will have to be modified to use different macros. */
|
||||
|
||||
#if 1
|
||||
#define PUT_WORD(ptr,w) (*(WORD *)(ptr) = (w))
|
||||
#define GET_WORD(ptr) (*(WORD *)(ptr))
|
||||
#define PUT_DWORD(ptr,dw) (*(DWORD *)(ptr) = (dw))
|
||||
#define GET_DWORD(ptr) (*(DWORD *)(ptr))
|
||||
#else
|
||||
#define PUT_WORD(ptr,w) (*(BYTE *)(ptr) = LOBYTE(w), \
|
||||
*((BYTE *)(ptr) + 1) = HIBYTE(w))
|
||||
#define GET_WORD(ptr) ((WORD)(*(BYTE *)(ptr) | \
|
||||
(WORD)(*((BYTE *)(ptr)+1) << 8)))
|
||||
#define PUT_DWORD(ptr,dw) (PUT_WORD((ptr),LOWORD(dw)), \
|
||||
PUT_WORD((WORD *)(ptr)+1,HIWORD(dw)))
|
||||
#define GET_DWORD(ptr) ((DWORD)(GET_WORD(ptr) | \
|
||||
((DWORD)GET_WORD((WORD *)(ptr)+1) << 16)))
|
||||
#endif /* 1 */
|
||||
|
||||
/* min and max macros */
|
||||
#define __max(a,b) (((a) > (b)) ? (a) : (b))
|
||||
#define __min(a,b) (((a) < (b)) ? (a) : (b))
|
||||
#ifndef max
|
||||
#define max(a,b) (((a) > (b)) ? (a) : (b))
|
||||
#endif
|
||||
#ifndef min
|
||||
#define min(a,b) (((a) < (b)) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
#ifndef _MAX_PATH
|
||||
#define _MAX_PATH 260
|
||||
#endif
|
||||
#ifndef MAX_PATH
|
||||
#define MAX_PATH 260
|
||||
#endif
|
||||
#ifndef _MAX_DRIVE
|
||||
#define _MAX_DRIVE 3
|
||||
#endif
|
||||
#ifndef _MAX_DIR
|
||||
#define _MAX_DIR 256
|
||||
#endif
|
||||
#ifndef _MAX_FNAME
|
||||
#define _MAX_FNAME 255
|
||||
#endif
|
||||
#ifndef _MAX_EXT
|
||||
#define _MAX_EXT 256
|
||||
#endif
|
||||
|
||||
#define HFILE_ERROR16 ((HFILE16)-1)
|
||||
#define HFILE_ERROR ((HFILE)-1)
|
||||
|
||||
/* The SIZE structure */
|
||||
typedef struct tagSIZE
|
||||
{
|
||||
INT cx;
|
||||
INT cy;
|
||||
} SIZE, *PSIZE, *LPSIZE;
|
||||
|
||||
|
||||
typedef SIZE SIZEL, *PSIZEL, *LPSIZEL;
|
||||
|
||||
#define CONV_SIZE16TO32(s16,s32) \
|
||||
((s32)->cx = (INT)(s16)->cx, (s32)->cy = (INT)(s16)->cy)
|
||||
#define CONV_SIZE32TO16(s32,s16) \
|
||||
((s16)->cx = (INT16)(s32)->cx, (s16)->cy = (INT16)(s32)->cy)
|
||||
|
||||
/* The POINT structure */
|
||||
typedef struct tagPOINT
|
||||
{
|
||||
LONG x;
|
||||
LONG y;
|
||||
} POINT, *PPOINT, *LPPOINT;
|
||||
|
||||
typedef struct POINTL
|
||||
{
|
||||
LONG x;
|
||||
LONG y;
|
||||
} POINTL;
|
||||
|
||||
#define CONV_POINT16TO32(p16,p32) \
|
||||
((p32)->x = (INT)(p16)->x, (p32)->y = (INT)(p16)->y)
|
||||
#define CONV_POINT32TO16(p32,p16) \
|
||||
((p16)->x = (INT16)(p32)->x, (p16)->y = (INT16)(p32)->y)
|
||||
|
||||
#define MAKEPOINT16(l) (*((POINT16 *)&(l)))
|
||||
|
||||
/* The POINTS structure */
|
||||
|
||||
typedef struct tagPOINTS
|
||||
{
|
||||
SHORT x;
|
||||
SHORT y;
|
||||
} POINTS, *PPOINTS, *LPPOINTS;
|
||||
|
||||
|
||||
#define MAKEPOINTS(l) (*((POINTS *)&(l)))
|
||||
|
||||
|
||||
/* The RECT structure */
|
||||
typedef struct tagRECT
|
||||
{
|
||||
short left;
|
||||
short top;
|
||||
short right;
|
||||
short bottom;
|
||||
} RECT, *PRECT, *LPRECT;
|
||||
typedef const RECT *LPCRECT;
|
||||
|
||||
|
||||
typedef struct tagRECTL
|
||||
{
|
||||
LONG left;
|
||||
LONG top;
|
||||
LONG right;
|
||||
LONG bottom;
|
||||
} RECTL, *PRECTL, *LPRECTL;
|
||||
|
||||
typedef const RECTL *LPCRECTL;
|
||||
|
||||
#define CONV_RECT16TO32(r16,r32) \
|
||||
((r32)->left = (INT)(r16)->left, (r32)->top = (INT)(r16)->top, \
|
||||
(r32)->right = (INT)(r16)->right, (r32)->bottom = (INT)(r16)->bottom)
|
||||
#define CONV_RECT32TO16(r32,r16) \
|
||||
((r16)->left = (INT16)(r32)->left, (r16)->top = (INT16)(r32)->top, \
|
||||
(r16)->right = (INT16)(r32)->right, (r16)->bottom = (INT16)(r32)->bottom)
|
||||
|
||||
#endif /* MPLAYER_WINDEF_H */
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user