diff options
-rw-r--r-- | Makefile | 11 | ||||
-rwxr-xr-x | configure | 24 | ||||
-rw-r--r-- | etc/codecs.conf | 10 | ||||
-rw-r--r-- | libmpcodecs/ad_speex.c | 2 | ||||
-rw-r--r-- | libmpdemux/demux_lavf.c | 24 | ||||
-rw-r--r-- | loader/com.h | 8 | ||||
-rw-r--r-- | loader/dmo/DMO_Filter.h | 8 | ||||
-rw-r--r-- | loader/drv.h | 8 | ||||
-rw-r--r-- | loader/dshow/DS_Filter.h | 8 | ||||
-rw-r--r-- | loader/ldt_keeper.c | 19 | ||||
-rw-r--r-- | loader/ldt_keeper.h | 8 | ||||
-rw-r--r-- | loader/loader.h | 8 | ||||
-rw-r--r-- | loader/module.c | 29 | ||||
-rw-r--r-- | loader/registry.h | 7 | ||||
-rw-r--r-- | loader/win32.c | 167 | ||||
-rw-r--r-- | loader/wine/basetsd.h | 8 | ||||
-rw-r--r-- | loader/wine/ldt.h | 7 | ||||
-rw-r--r-- | loader/wine/msacm.h | 8 | ||||
-rw-r--r-- | loader/wine/ntdef.h | 8 | ||||
-rw-r--r-- | loader/wine/vfw.h | 7 | ||||
-rw-r--r-- | loader/wine/winbase.h | 8 | ||||
-rw-r--r-- | loader/wine/windef.h | 16 | ||||
-rw-r--r-- | loader/wine/windows.h | 8 | ||||
-rw-r--r-- | loader/wine/winreg.h | 8 | ||||
-rw-r--r-- | loader/wine/winuser.h | 8 | ||||
-rw-r--r-- | loader/wineacm.h | 9 | ||||
-rw-r--r-- | mplayer.c | 7 |
27 files changed, 209 insertions, 234 deletions
@@ -245,7 +245,6 @@ 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-$(QTX_EMULATION) += loader/wrapper.S SRCS_COMMON-$(RADIO) += stream/stream_radio.c SRCS_COMMON-$(RADIO_CAPTURE) += stream/audio_in.c SRCS_COMMON-$(REAL_CODECS) += libmpcodecs/ad_realaud.c \ @@ -282,7 +281,9 @@ SRCS_COMMON-$(VCD) += stream/stream_vcd.c SRCS_COMMON-$(VORBIS) += libmpcodecs/ad_libvorbis.c \ libmpdemux/demux_ogg.c SRCS_COMMON-$(VSTREAM) += stream/stream_vstream.c -SRCS_COMMON-$(WIN32_EMULATION) += loader/elfdll.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 \ @@ -292,6 +293,8 @@ SRCS_COMMON-$(WIN32_EMULATION) += loader/elfdll.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 \ @@ -790,7 +793,7 @@ version.h: version.sh # Make sure all generated header files are created. codec-cfg.d codec-cfg.o: codecs.conf.h $(DEPS) $(MENCODER_DEPS) $(MPLAYER_DEPS): help_mp.h -$(call ADDSUFFIXES,.d .o,mpcommon vobsub stream/stream_cddb stream/network libmpdemux/muxer_avi): version.h +$(call ADDSUFFIXES,.d .o,mpcommon vobsub stream/stream_cddb stream/network libmpdemux/muxer_avi osdep/mplayer.rc): version.h # Files that depend on libswscale internals libvo/vo_mga.o libvo/vo_xmga.o libmpcodecs/vf_halfpack.o libmpcodecs/vf_palette.o libmpcodecs/vf_rgb2bgr.o libmpcodecs/vf_yuy2.o: CFLAGS := -I$(FFMPEG_SOURCE_PATH) $(CFLAGS) @@ -916,7 +919,7 @@ liba52/test$(EXESUF): cpudetect.o $(SRCS_LIBA52_INTERNAL:.c=.o) -lm libvo/aspecttest$(EXESUF): libvo/aspect.o libvo/geometry.o $(TEST_OBJS) -LOADER_TEST_OBJS = $(filter loader/%,$(SRCS_COMMON:.c=.o)) libmpdemux/aviprint.o osdep/mmap_anon.o cpudetect.o $(TEST_OBJS) +LOADER_TEST_OBJS = $(SRCS_WIN32_EMULATION:.c=.o) $(SRCS_QTX_EMULATION:.S=.o) libavutil/libavutil.a osdep/mmap_anon.o cpudetect.o $(TEST_OBJS) loader/qtx/list$(EXESUF) loader/qtx/qtxload$(EXESUF): CFLAGS += -g loader/qtx/list$(EXESUF) loader/qtx/qtxload$(EXESUF): $(LOADER_TEST_OBJS) @@ -6833,7 +6833,7 @@ if test "$_real" = auto ; then _real=no _res_comment="dynamic loader support needed" if test "$_dl" = yes || test "$_win32dll" = yes && - (linux || freebsd || netbsd || openbsd || dragonfly || darwin || win32) ; then + (linux || freebsd || netbsd || openbsd || dragonfly || darwin || win32 || os2) ; then _real=yes fi fi @@ -6946,7 +6946,7 @@ if test "$_libavutil" = auto ; then _libavutil=no cat > $TMPC << EOF #include <libavutil/common.h> -int main(void) { av_gcd(1,1); return 0; } +int main(void) { av_clip(1, 1, 1); return 0; } EOF if $_pkg_config --exists libavutil ; then _inc_libavutil=$($_pkg_config --cflags libavutil) @@ -8226,23 +8226,15 @@ $def_winsock2_h /* system functions */ -$def_exp2 -$def_exp2f $def_gethostbyname2 $def_gettimeofday $def_glob $def_langinfo -$def_llrint -$def_log2 -$def_log2f -$def_lrint $def_lrintf $def_map_memalign $def_memalign $def_nanosleep $def_posix_select -$def_round -$def_roundf $def_select $def_setenv $def_shm @@ -8252,7 +8244,6 @@ $def_sysi86 $def_sysi86_iv $def_termcap $def_termios -$def_truncf $def_vsscanf @@ -8260,6 +8251,7 @@ $def_vsscanf $def_asmalign_pot $def_builtin_expect $def_dl +$def_dos_paths $def_extern_asm $def_extern_prefix $def_iconv @@ -8531,16 +8523,24 @@ $def_arpa_inet_h $def_bswap $def_bzlib $def_dcbzl -$def_dos_paths +$def_exp2 +$def_exp2f $def_fast_64bit $def_fast_unaligned +$def_llrint +$def_log2 +$def_log2f +$def_lrint $def_memalign_hack $def_mlib $def_mkstemp $def_posix_memalign $def_pthreads +$def_round +$def_roundf $def_ten_operands $def_threads +$def_truncf $def_xform_asm $def_yasm diff --git a/etc/codecs.conf b/etc/codecs.conf index df379171da..4a05f15190 100644 --- a/etc/codecs.conf +++ b/etc/codecs.conf @@ -67,6 +67,16 @@ videocodec ffzmbv dll "zmbv" out RGB24 +videocodec geov + info "GeoCodec" + comment "crashes without -nosound, hangs on exit" + status buggy + fourcc GEOV + fourcc GEOX + driver vfw + dll "GeoCodec.dll" + out BGR24 flip + videocodec zmbv info "Zip Motion-Block Video" status working diff --git a/libmpcodecs/ad_speex.c b/libmpcodecs/ad_speex.c index 73655e5ac1..4eca5293df 100644 --- a/libmpcodecs/ad_speex.c +++ b/libmpcodecs/ad_speex.c @@ -28,7 +28,7 @@ #include <speex/speex_header.h> #include "ad_internal.h" -static const ad_info_t info ={ +static const ad_info_t info = { "Speex audio decoder", "speex", "Reimar Döffinger", diff --git a/libmpdemux/demux_lavf.c b/libmpdemux/demux_lavf.c index 6031b052fd..ec8b4e7a77 100644 --- a/libmpdemux/demux_lavf.c +++ b/libmpdemux/demux_lavf.c @@ -44,7 +44,8 @@ #include "mp_taglists.h" -#define PROBE_BUF_SIZE (32*1024) +#define INITIAL_PROBE_SIZE (32*1024) +#define PROBE_BUF_SIZE (2*1024*1024) static unsigned int opt_probesize = 0; static unsigned int opt_analyzeduration = 0; @@ -67,7 +68,7 @@ typedef struct lavf_priv_t{ AVInputFormat *avif; AVFormatContext *avfc; ByteIOContext *pb; - uint8_t buffer[FFMAX(BIO_BUFFER_SIZE, PROBE_BUF_SIZE)]; + uint8_t buffer[BIO_BUFFER_SIZE]; int audio_streams; int video_streams; int sub_streams; @@ -132,7 +133,8 @@ static void list_formats(void) { static int lavf_check_file(demuxer_t *demuxer){ AVProbeData avpd; lavf_priv_t *priv; - int probe_data_size; + int probe_data_size = 0; + int read_size = INITIAL_PROBE_SIZE; if(!demuxer->priv) demuxer->priv=calloc(sizeof(lavf_priv_t),1); @@ -154,16 +156,26 @@ static int lavf_check_file(demuxer_t *demuxer){ return DEMUXER_TYPE_LAVF; } - probe_data_size = stream_read(demuxer->stream, priv->buffer, PROBE_BUF_SIZE); - if(probe_data_size < 0) + avpd.buf = av_mallocz(FFMAX(BIO_BUFFER_SIZE, PROBE_BUF_SIZE) + + FF_INPUT_BUFFER_PADDING_SIZE); + do { + read_size = stream_read(demuxer->stream, avpd.buf + probe_data_size, read_size); + if(read_size < 0) { + av_free(avpd.buf); return 0; + } + probe_data_size += read_size; avpd.filename= demuxer->stream->url; if (!strncmp(avpd.filename, "ffmpeg://", 9)) avpd.filename += 9; - avpd.buf= priv->buffer; avpd.buf_size= probe_data_size; priv->avif= av_probe_input_format(&avpd, probe_data_size > 0); + read_size = FFMIN(2*read_size, PROBE_BUF_SIZE - probe_data_size); + } while (demuxer->desc->type != DEMUXER_TYPE_LAVF_PREFERRED && + !priv->avif && read_size > 0 && probe_data_size < PROBE_BUF_SIZE); + av_free(avpd.buf); + if(!priv->avif){ mp_msg(MSGT_HEADER,MSGL_V,"LAVF_check: no clue about this gibberish!\n"); return 0; diff --git a/loader/com.h b/loader/com.h index 6bbbc55b7d..3e9a94bd67 100644 --- a/loader/com.h +++ b/loader/com.h @@ -18,10 +18,6 @@ * Internal functions and structures for COM emulation code. */ -#ifdef __cplusplus -extern "C" { -#endif - #ifndef GUID_TYPE #define GUID_TYPE typedef struct @@ -83,8 +79,4 @@ void* STDCALL CoTaskMemAlloc(unsigned long); void STDCALL CoTaskMemFree(void*); #endif -#ifdef __cplusplus -}; -#endif /* __cplusplus */ - #endif /* MPLAYER_COM_H */ diff --git a/loader/dmo/DMO_Filter.h b/loader/dmo/DMO_Filter.h index ca04b2c4cd..0273245669 100644 --- a/loader/dmo/DMO_Filter.h +++ b/loader/dmo/DMO_Filter.h @@ -4,10 +4,6 @@ #include "dmo_guids.h" #include "dmo_interfaces.h" -#if defined(__cplusplus) -extern "C" { -#endif - typedef struct DMO_Filter { int m_iHandle; @@ -40,8 +36,4 @@ void DMO_Filter_Destroy(DMO_Filter* This); */ CMediaBuffer* CMediaBufferCreate(unsigned long maxlen, void* mem, unsigned long len, int copy); -#if defined(__cplusplus) -} -#endif - #endif /* MPLAYER_DMO_FILTER_H */ diff --git a/loader/drv.h b/loader/drv.h index b064b46802..9ae1f8fbec 100644 --- a/loader/drv.h +++ b/loader/drv.h @@ -6,10 +6,6 @@ #ifndef MPLAYER_DRV_H #define MPLAYER_DRV_H -#ifdef __cplusplus -extern "C" { -#endif - #include "wine/windef.h" #include "wine/driver.h" @@ -20,8 +16,4 @@ void CodecRelease(void); HDRVR DrvOpen(LPARAM lParam2); void DrvClose(HDRVR hdrvr); -#ifdef __cplusplus -} -#endif - #endif /* MPLAYER_DRV_H */ diff --git a/loader/dshow/DS_Filter.h b/loader/dshow/DS_Filter.h index 8fda4b4ef2..945321a153 100644 --- a/loader/dshow/DS_Filter.h +++ b/loader/dshow/DS_Filter.h @@ -4,10 +4,6 @@ #include "inputpin.h" #include "outputpin.h" -#if defined(__cplusplus) -extern "C" { -#endif - typedef struct { char* frame_pointer; long frame_size; @@ -43,8 +39,4 @@ 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); -#if defined(__cplusplus) -} -#endif - #endif /* MPLAYER_DS_FILTER_H */ diff --git a/loader/ldt_keeper.c b/loader/ldt_keeper.c index 35025888ca..c5fa434e80 100644 --- a/loader/ldt_keeper.c +++ b/loader/ldt_keeper.c @@ -43,19 +43,12 @@ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,47) #define modify_ldt_ldt_s user_desc #endif -/* prototype it here, so we won't depend on kernel headers */ -#ifdef __cplusplus -extern "C" { -#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 -#ifdef __cplusplus -} -#endif #else #if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) #include <machine/segments.h> @@ -69,13 +62,7 @@ int modify_ldt(int func, void *ptr, unsigned long bytecount); /* solaris x86: add missing prototype for sysi86(), but only when sysi86(int, void*) is known to be valid */ #ifdef HAVE_SYSI86_iv -#ifdef __cplusplus -extern "C" { -#endif int sysi86(int, void*); -#ifdef __cplusplus -} -#endif #endif #ifndef NUMSYSLDTS /* SunOS 2.5.1 does not define NUMSYSLDTS */ @@ -127,9 +114,6 @@ static unsigned int fs_ldt = TEB_SEL_IDX; * in C++ we use static class for this... */ -#ifdef __cplusplus -extern "C" -#endif void Setup_FS_Segment(void) { unsigned int ldt_desc = LDT_SEL(fs_ldt); @@ -271,6 +255,9 @@ ldt_fs_t* Setup_LDT_Keeper(void) printf("Couldn't install fs segment, expect segfault\n"); } } +#elif defined(__OS2__) + /* convert flat addr to sel idx for LDT_SEL() */ + fs_ldt = (uintptr_t)fs_seg >> 16; #endif Setup_FS_Segment(); diff --git a/loader/ldt_keeper.h b/loader/ldt_keeper.h index c339987635..9fff8de0c1 100644 --- a/loader/ldt_keeper.h +++ b/loader/ldt_keeper.h @@ -1,11 +1,6 @@ #ifndef MPLAYER_LDT_KEEPER_H #define MPLAYER_LDT_KEEPER_H -#ifdef __cplusplus -extern "C" -{ -#endif - typedef struct { void* fs_seg; char* prev_struct; @@ -14,8 +9,5 @@ typedef struct { void Setup_FS_Segment(void); ldt_fs_t* Setup_LDT_Keeper(void); void Restore_LDT_Keeper(ldt_fs_t* ldt_fs); -#ifdef __cplusplus -} -#endif #endif /* MPLAYER_LDT_KEEPER_H */ diff --git a/loader/loader.h b/loader/loader.h index 29c13ef522..48778e1882 100644 --- a/loader/loader.h +++ b/loader/loader.h @@ -14,10 +14,6 @@ #ifndef MPLAYER_LOADER_H #define MPLAYER_LOADER_H -#ifdef __cplusplus -extern "C" { -#endif - #include "wine/windef.h" #include "wine/driver.h" #include "wine/mmreg.h" @@ -33,8 +29,4 @@ int WritePrivateProfileStringA_(const char* appname, const char* keyname, INT WINAPI LoadStringA( HINSTANCE instance, UINT resource_id, LPSTR buffer, INT buflen ); -#ifdef __cplusplus -} -#endif - #endif /* MPLAYER_LOADER_H */ diff --git a/loader/module.c b/loader/module.c index 2bce928544..feaab14605 100644 --- a/loader/module.c +++ b/loader/module.c @@ -744,6 +744,31 @@ static int dump_component(char* name, int type, void* orig, ComponentParameters #ifdef EMU_QTX_API +#ifdef __OS2__ +uint32_t _System DosQueryMem(void *, uint32_t *, uint32_t *); +#endif + +static int is_invalid_ptr_handle(void *p) +{ +#ifdef __OS2__ + uint32_t cb = 1; + uint32_t fl; + + if(DosQueryMem(p, &cb, &fl)) + return 1; + + // Occasionally, ptr with 'EXEC' attr is passed. + // On OS/2, however, malloc() never sets 'EXEC' attr. + // So ptr with 'EXEC' attr is invalid. + if(fl & 0x04) + return 1; + + return 0; +#else + return (uint32_t)p >= 0x60000000; +#endif +} + static uint32_t ret_array[4096]; static int ret_i=0; @@ -844,10 +869,10 @@ static int report_func(void *stack_base, int stack_size, reg386_t *reg, uint32_t #endif return 1; case 0x15002f: //DisposePtr - if(((uint32_t *)stack_base)[1]>=0x60000000) + if(is_invalid_ptr_handle(((void **)stack_base)[1])) printf("WARNING! Invalid Ptr handle!\n"); else - free((void *)((uint32_t *)stack_base)[1]); + free(((void **)stack_base)[1]); reg->eax=0; #ifdef DEBUG_QTX_API printf("%*sLEAVE(%d): EMULATED! 0x%X\n",ret_i*2,"",ret_i, reg->eax); diff --git a/loader/registry.h b/loader/registry.h index 4f0d09f53d..1b2a12afd7 100644 --- a/loader/registry.h +++ b/loader/registry.h @@ -13,10 +13,6 @@ * http://svn.mplayerhq.hu/mplayer/trunk/ */ -#ifdef __cplusplus -extern "C" { -#endif - #include "wine/winbase.h" void free_registry(void); @@ -40,8 +36,5 @@ long __stdcall RegEnumKeyExA(HKEY hKey, DWORD dwIndex, LPSTR lpName, LPDWORD lpc long __stdcall RegEnumValueA(HKEY hkey, DWORD index, LPSTR value, LPDWORD val_count, LPDWORD reserved, LPDWORD type, LPBYTE data, LPDWORD count); #endif -#ifdef __cplusplus -}; -#endif #endif /* MPLAYER_REGISTRY_H */ diff --git a/loader/win32.c b/loader/win32.c index 3b0dd5bb3e..812815e699 100644 --- a/loader/win32.c +++ b/loader/win32.c @@ -19,13 +19,14 @@ for DLL to know too much about its environment. #include "config.h" #include "mangle.h" -#ifdef CONFIG_QTX_CODECS -#define QTX -#endif #define REALPLAYER //#define LOADLIB_TRY_NATIVE -#ifdef QTX +/* Hack to make sure the correct function declaration in com.h is used when + * this file is built for the test applications with WIN32_LOADER disabled. */ +#define WIN32_LOADER + +#ifdef CONFIG_QTX_CODECS #define PSEUDO_SCREEN_WIDTH /*640*/800 #define PSEUDO_SCREEN_HEIGHT /*480*/600 #endif @@ -72,6 +73,7 @@ for DLL to know too much about its environment. #include "osdep/mmap.h" #endif #include "osdep/mmap_anon.h" +#include "libavutil/avstring.h" char* def_path = WIN32_PATH; @@ -553,7 +555,7 @@ static HMODULE WINAPI expGetDriverModuleHandle(DRVR* pdrv) #define MODULE_HANDLE_kernel32 ((HMODULE)0x120) #define MODULE_HANDLE_user32 ((HMODULE)0x121) -#ifdef QTX +#ifdef CONFIG_QTX_CODECS #define MODULE_HANDLE_wininet ((HMODULE)0x122) #define MODULE_HANDLE_ddraw ((HMODULE)0x123) #define MODULE_HANDLE_advapi32 ((HMODULE)0x124) @@ -562,13 +564,14 @@ static HMODULE WINAPI expGetDriverModuleHandle(DRVR* pdrv) #define MODULE_HANDLE_msvcrt ((HMODULE)0x126) #define MODULE_HANDLE_ole32 ((HMODULE)0x127) #define MODULE_HANDLE_winmm ((HMODULE)0x128) +#define MODULE_HANDLE_psapi ((HMODULE)0x129) static HMODULE WINAPI expGetModuleHandleA(const char* name) { WINE_MODREF* wm; HMODULE result; if(!name) -#ifdef QTX +#ifdef CONFIG_QTX_CODECS result=1; #else result=0; @@ -584,7 +587,7 @@ static HMODULE WINAPI expGetModuleHandleA(const char* name) { if(name && (strcasecmp(name, "kernel32")==0 || !strcasecmp(name, "kernel32.dll"))) result=MODULE_HANDLE_kernel32; -#ifdef QTX +#ifdef CONFIG_QTX_CODECS if(name && strcasecmp(name, "user32")==0) result=MODULE_HANDLE_user32; #endif @@ -844,7 +847,7 @@ static void* WINAPI expWaitForSingleObject(void* object, int duration) return (void *)ret; } -#ifdef QTX +#ifdef CONFIG_QTX_CODECS static void* WINAPI expWaitForMultipleObjects(int count, const void** objects, int WaitAll, int duration) { @@ -884,7 +887,7 @@ static HANDLE WINAPI expCreateMutexA(void *pSecAttr, else dbgprintf("CreateMutexA(0x%x, %d, NULL) => 0x%x\n", pSecAttr, bInitialOwner, mlist); -#ifndef QTX +#ifndef CONFIG_QTX_CODECS /* 10l to QTX, if CreateMutex returns a real mutex, WaitForSingleObject waits for ever, else it works ;) */ return mlist; @@ -1133,6 +1136,10 @@ static WIN_BOOL WINAPI expIsProcessorFeaturePresent(DWORD v) return result; } +static WIN_BOOL WINAPI expIsDebuggerPresent(void) +{ + return 0; +} static long WINAPI expGetVersion(void) { @@ -1437,7 +1444,7 @@ static int WINAPI expGetCurrentProcess(void) return getpid(); } -#ifdef QTX +#ifdef CONFIG_QTX_CODECS // this version is required for Quicktime codecs (.qtx/.qts) to work. // (they assume some pointers at FS: segment) @@ -2201,7 +2208,7 @@ static int WINAPI expGetStdHandle(int z) return z+0x1234; } -#ifdef QTX +#ifdef CONFIG_QTX_CODECS #define FILE_HANDLE_quicktimeqts ((HANDLE)0x444) #define FILE_HANDLE_quicktimeqtx ((HANDLE)0x445) #endif @@ -2211,7 +2218,7 @@ static int WINAPI expGetFileType(int handle) dbgprintf("GetFileType(0x%x) => 0x3 = pipe\n", handle); return 0x3; } -#ifdef QTX +#ifdef CONFIG_QTX_CODECS static int WINAPI expGetFileAttributesA(char *filename) { dbgprintf("GetFileAttributesA(%s) => FILE_ATTR_NORMAL\n", filename); @@ -2269,6 +2276,21 @@ static int WINAPI expGetModuleFileNameA(int module, char* s, int len) return result; } +static int WINAPI expGetModuleBaseNameA(int process, int module, char* s, int len) +{ + int result = 0; + + if (s && len) { + av_strlcpy(s, "aviplay.dll", len); + result = strlen(s); + } + + dbgprintf("GetModuleBaseNameA(0x%x, 0x%x, 0x%x, %d) => %d\n", + process, module, s, len, result); + + return result; +} + static int WINAPI expSetUnhandledExceptionFilter(void* filter) { dbgprintf("SetUnhandledExceptionFilter(0x%x) => 1\n", filter); @@ -2312,7 +2334,7 @@ static int WINAPI expLoadLibraryA(char* name) // return MODULE_HANDLE_kernel32; return MODULE_HANDLE_user32; -#ifdef QTX +#ifdef CONFIG_QTX_CODECS if (strcasecmp(name, "wininet.dll") == 0 || strcasecmp(name, "wininet") == 0) return MODULE_HANDLE_wininet; if (strcasecmp(name, "ddraw.dll") == 0 || strcasecmp(name, "ddraw") == 0) @@ -2329,6 +2351,8 @@ static int WINAPI expLoadLibraryA(char* name) return MODULE_HANDLE_ole32; if (strcasecmp(name, "winmm.dll") == 0 || strcasecmp(name, "winmm") == 0) return MODULE_HANDLE_winmm; + if (strcasecmp(name, "psapi.dll") == 0 || strcasecmp(name, "psapi") == 0) + return MODULE_HANDLE_psapi; result=LoadLibraryA(name); dbgprintf("Returned LoadLibraryA(0x%x='%s'), def_path=%s => 0x%x\n", name, name, def_path, result); @@ -2338,7 +2362,7 @@ static int WINAPI expLoadLibraryA(char* name) static int WINAPI expFreeLibrary(int module) { -#ifdef QTX +#ifdef CONFIG_QTX_CODECS int result=0; /* FIXME:XXX: qtx svq3 frees up qt.qts */ #else int result=FreeLibrary(module); @@ -2355,7 +2379,7 @@ static void* WINAPI expGetProcAddress(HMODULE mod, char* name) result=LookupExternalByName("kernel32.dll", name); break; case MODULE_HANDLE_user32: result=LookupExternalByName("user32.dll", name); break; -#ifdef QTX +#ifdef CONFIG_QTX_CODECS case MODULE_HANDLE_wininet: result=LookupExternalByName("wininet.dll", name); break; case MODULE_HANDLE_ddraw: @@ -2371,6 +2395,8 @@ static void* WINAPI expGetProcAddress(HMODULE mod, char* name) result=LookupExternalByName("ole32.dll", name); break; case MODULE_HANDLE_winmm: result=LookupExternalByName("winmm.dll", name); break; + case MODULE_HANDLE_psapi: + result=LookupExternalByName("psapi.dll", name); break; default: result=GetProcAddress(mod, name); } @@ -2450,7 +2476,7 @@ static int WINAPI expCreateCompatibleDC(int hdc) static int WINAPI expGetDeviceCaps(int hdc, int unk) { dbgprintf("GetDeviceCaps(0x%x, %d) => 0\n", hdc, unk); -#ifdef QTX +#ifdef CONFIG_QTX_CODECS #define BITSPIXEL 12 #define PLANES 14 if (unk == BITSPIXEL) @@ -2483,7 +2509,7 @@ static void* WINAPI expGetWindowDC(int hdc) return 0; } -#ifdef QTX +#ifdef CONFIG_QTX_CODECS static int WINAPI expGetWindowRect(HWND win, RECT *r) { dbgprintf("GetWindowRect(0x%x, 0x%x) => 1\n", win, r); @@ -2937,7 +2963,7 @@ static int WINAPI expGetCursorPos(void *cursor) dbgprintf("GetCursorPos(0x%x) => 0x%x\n", cursor, cursor); return 1; } -#ifdef QTX +#ifdef CONFIG_QTX_CODECS static int show_cursor = 0; static int WINAPI expShowCursor(int show) { @@ -2975,7 +3001,7 @@ static int WINAPI expGetCPInfo(int cp,void *info) dbgprintf("GetCPInfo()\n"); return 0; } -#ifdef QTX +#ifdef CONFIG_QTX_CODECS #define SM_CXSCREEN 0 #define SM_CYSCREEN 1 #define SM_XVIRTUALSCREEN 76 @@ -2987,7 +3013,7 @@ static int WINAPI expGetCPInfo(int cp,void *info) static int WINAPI expGetSystemMetrics(int index) { dbgprintf("GetSystemMetrics(%d)\n", index); -#ifdef QTX +#ifdef CONFIG_QTX_CODECS switch(index) { case SM_XVIRTUALSCREEN: @@ -3314,7 +3340,7 @@ static DIR* qtx_dir=NULL; static WIN_BOOL WINAPI expFindNextFileA(HANDLE h,LPWIN32_FIND_DATAA lpfd) { -#ifdef QTX +#ifdef CONFIG_QTX_CODECS dbgprintf("FindNextFileA(0x%x, 0x%x) => 0\n", h, lpfd); if(h==FILE_HANDLE_quicktimeqtx){ struct dirent* d; @@ -3340,7 +3366,7 @@ static HANDLE WINAPI expFindFirstFileA(LPCSTR s, LPWIN32_FIND_DATAA lpfd) { dbgprintf("FindFirstFileA(0x%x='%s', 0x%x) => 0\n", s, s, lpfd); // printf("\n### FindFirstFileA('%s')...\n",s); -#ifdef QTX +#ifdef CONFIG_QTX_CODECS if(strstr(s, "quicktime\\*.QTX")){ dbgprintf("FindFirstFileA(0x%x='%s', 0x%x) => QTX\n", s, s, lpfd); dbgprintf("\n### Searching for QuickTime plugins (*.qtx) at %s...\n",def_path); @@ -3376,7 +3402,7 @@ static HANDLE WINAPI expFindFirstFileA(LPCSTR s, LPWIN32_FIND_DATAA lpfd) static WIN_BOOL WINAPI expFindClose(HANDLE h) { dbgprintf("FindClose(0x%x) => 0\n", h); -#ifdef QTX +#ifdef CONFIG_QTX_CODECS // if(h==FILE_HANDLE_quicktimeqtx && qtx_dir){ // closedir(qtx_dir); // qtx_dir=NULL; @@ -3398,7 +3424,7 @@ static UINT WINAPI expGetWindowsDirectoryA(LPSTR s,UINT c) dbgprintf("GetWindowsDirectoryA(0x%x, %d) => %d\n", s, c, result); return result; } -#ifdef QTX +#ifdef CONFIG_QTX_CODECS static UINT WINAPI expGetCurrentDirectoryA(UINT c, LPSTR s) { char curdir[]="c:\\"; @@ -3482,7 +3508,7 @@ static HANDLE WINAPI expCreateFileA(LPCSTR cs1,DWORD i1,DWORD i2, i2, p1, i3, i4, i5); if((!cs1) || (strlen(cs1)<2))return -1; -#ifdef QTX +#ifdef CONFIG_QTX_CODECS if(strstr(cs1, "QuickTime.qts")) { int result; @@ -3598,7 +3624,7 @@ static DWORD WINAPI expGetFullPathNameA dbgprintf("GetFullPathNameA('%s',%d,%p,%p)\n",lpFileName,nBufferLength, lpBuffer, lpFilePart); #if 0 -#ifdef QTX +#ifdef CONFIG_QTX_CODECS strcpy(lpFilePart, "Quick123.qts"); #else strcpy(lpFilePart, lpFileName); @@ -3662,7 +3688,7 @@ static DWORD WINAPI expSetFilePointer(HANDLE h, LONG val, LPLONG ext, DWORD whe default: return -1; } -#ifdef QTX +#ifdef CONFIG_QTX_CODECS if (val == 0 && ext != 0) val = val&(*ext); #endif @@ -3768,7 +3794,7 @@ static void WINAPI expInitCommonControls(void) return; } -#ifdef QTX +#ifdef CONFIG_QTX_CODECS /* needed by QuickTime.qts */ static HWND WINAPI expCreateUpDownControl (DWORD style, INT x, INT y, INT cx, INT cy, HWND parent, INT id, HINSTANCE inst, @@ -4427,7 +4453,7 @@ static MMRESULT WINAPI exptimeBeginPeriod(UINT wPeriod) return 0; } -#ifdef QTX +#ifdef CONFIG_QTX_CODECS static MMRESULT WINAPI exptimeEndPeriod(UINT wPeriod) { dbgprintf("timeEndPeriod(%u) !\n", wPeriod); @@ -4543,6 +4569,12 @@ static WIN_BOOL WINAPI expSetThreadPriority( return TRUE; } +static void WINAPI expTerminateProcess( DWORD process, DWORD status ) +{ + printf("EXIT - process %ld code %ld\n", process, status); + exit(status); +} + static void WINAPI expExitProcess( DWORD status ) { printf("EXIT - code %ld\n",status); @@ -4551,7 +4583,7 @@ static void WINAPI expExitProcess( DWORD status ) static INT WINAPI expMessageBoxA(HWND hWnd, LPCSTR text, LPCSTR title, UINT type){ printf("MSGBOX '%s' '%s' (%d)\n",text,title,type); -#ifdef QTX +#ifdef CONFIG_QTX_CODECS if (type == MB_ICONHAND && !strlen(text) && !strlen(title)) return IDIGNORE; #endif @@ -4592,6 +4624,28 @@ static WINAPI inline unsigned long int expntohl(unsigned long int netlong) // dbgprintf("ntohl(%x) => %x\n", netlong, ntohl(netlong)); return ntohl(netlong); } + +static char* WINAPI expSysAllocStringLen(char *pch, unsigned cch) +{ + char *str; + dbgprintf("SysAllocStringLen('%s', %d)\n", pch, cch); + str = malloc(cch * 2 + sizeof(unsigned) + 2); + *(unsigned *)str = cch; + str += sizeof(unsigned); + if (pch) + memcpy(str, pch, cch * 2); + str[cch * 2] = 0; + str[cch * 2 + 1] = 0; + return str; +} + +static void WINAPI expSysFreeString(char *str) +{ + if (str) { + free(str - sizeof(unsigned)); + } +} + static void WINAPI expVariantInit(void* p) { printf("InitCommonControls called!\n"); @@ -4610,7 +4664,7 @@ static int WINAPI expUnregisterClassA(const char *className, HINSTANCE hInstance return 0; } |