From 97372dab4f0c500cfef3522b5359a313dfa627ca Mon Sep 17 00:00:00 2001 From: faust3 Date: Mon, 17 Jan 2005 20:57:48 +0000 Subject: [PATCH] preload quicktime.qts, this allows us to ignore the hardcoded path inside the dlls so that quicktime.qts doesn't need to be in the windows system dir, patch by Gianluigi Tiesi , comments by myself git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@14529 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpcodecs/ad_qtaudio.c | 12 +++++++++++- libmpcodecs/vd_qtvideo.c | 9 ++++++++- libmpcodecs/ve_qtvideo.c | 8 ++++++++ 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/libmpcodecs/ad_qtaudio.c b/libmpcodecs/ad_qtaudio.c index 75d60acfe4..c865b68568 100644 --- a/libmpcodecs/ad_qtaudio.c +++ b/libmpcodecs/ad_qtaudio.c @@ -68,6 +68,7 @@ typedef int (__cdecl* LPFUNC8)(SoundConverter sc, 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; @@ -91,10 +92,17 @@ static int loader_init() #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 dll\n" ); + mp_msg(MSGT_DECAUDIO,MSGL_ERR,"failed loading qtmlClient.dll\n" ); return 1; } #if 1 @@ -269,6 +277,8 @@ static void uninit(sh_audio_t *sh){ // 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 MACOSX ExitMovies(); diff --git a/libmpcodecs/vd_qtvideo.c b/libmpcodecs/vd_qtvideo.c index 8ef37d6101..960fd09f19 100644 --- a/libmpcodecs/vd_qtvideo.c +++ b/libmpcodecs/vd_qtvideo.c @@ -52,7 +52,7 @@ 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 HINSTANCE qtml_dll; +static HINSTANCE qtime_qts; // handle to the preloaded quicktime.qts static HMODULE handler; #if defined(USE_QTX_CODECS) && !defined(MACOSX) @@ -116,6 +116,13 @@ static int init(sh_video_t *sh){ 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"); diff --git a/libmpcodecs/ve_qtvideo.c b/libmpcodecs/ve_qtvideo.c index be10d86942..ead04fd123 100644 --- a/libmpcodecs/ve_qtvideo.c +++ b/libmpcodecs/ve_qtvideo.c @@ -34,6 +34,7 @@ HMODULE WINAPI LoadLibraryA(LPCSTR); FARPROC WINAPI GetProcAddress(HMODULE,LPCSTR); int WINAPI FreeLibrary(HMODULE); +static HINSTANCE qtime_qts; //handle to preloaded quicktime.qts static HMODULE handler; static OSErr (*FindCodec)(CodecType cType, @@ -296,6 +297,13 @@ static int vf_open(vf_instance_t *vf, char* args){ #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_MENCODER,MSGL_ERR,"unable to load QuickTime.qts\n" ); + return 0; + } + handler = LoadLibraryA("qtmlClient.dll"); if(!handler){ mp_msg(MSGT_MENCODER,MSGL_ERR,"unable to load qtmlClient.dll\n");