mirror of
https://github.com/mpv-player/mpv
synced 2025-01-03 05:22:23 +00:00
Get rid of pointless def_path variable; use codec_path directly instead.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30949 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
cb26eaf0bb
commit
5e480c7b81
@ -252,9 +252,9 @@ static int preinit(sh_audio_t *sh){
|
||||
unsigned int result;
|
||||
char *path;
|
||||
|
||||
path = malloc(strlen(def_path) + strlen(sh->codec->dll) + 2);
|
||||
path = malloc(strlen(codecs_path) + strlen(sh->codec->dll) + 2);
|
||||
if (!path) return 0;
|
||||
sprintf(path, "%s/%s", def_path, sh->codec->dll);
|
||||
sprintf(path, "%s/%s", codecs_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 */
|
||||
@ -278,8 +278,8 @@ static int preinit(sh_audio_t *sh){
|
||||
if(raSetDLLAccessPath){
|
||||
#endif
|
||||
// used by 'SIPR'
|
||||
path = realloc(path, strlen(def_path) + 13);
|
||||
sprintf(path, "DT_Codecs=%s", def_path);
|
||||
path = realloc(path, strlen(codecs_path) + 13);
|
||||
sprintf(path, "DT_Codecs=%s", codecs_path);
|
||||
if(path[strlen(path)-1]!='/'){
|
||||
path[strlen(path)+1]=0;
|
||||
path[strlen(path)]='/';
|
||||
@ -301,14 +301,14 @@ static int preinit(sh_audio_t *sh){
|
||||
#ifdef CONFIG_WIN32DLL
|
||||
if (dll_type == 1){
|
||||
if (wraOpenCodec2) {
|
||||
sprintf(path, "%s\\", def_path);
|
||||
sprintf(path, "%s\\", codecs_path);
|
||||
result = wraOpenCodec2(&sh->context, path);
|
||||
} else
|
||||
result=wraOpenCodec(&sh->context);
|
||||
} else
|
||||
#endif
|
||||
if (raOpenCodec2) {
|
||||
sprintf(path, "%s/", def_path);
|
||||
sprintf(path, "%s/", codecs_path);
|
||||
result = raOpenCodec2(&sh->context, path);
|
||||
} else
|
||||
result=raOpenCodec(&sh->context);
|
||||
|
@ -274,9 +274,9 @@ static int init(sh_video_t *sh){
|
||||
|
||||
mp_msg(MSGT_DECVIDEO,MSGL_V,"realvideo codec id: 0x%08X sub-id: 0x%08X\n",be2me_32(((unsigned int*)extrahdr)[1]),be2me_32(((unsigned int*)extrahdr)[0]));
|
||||
|
||||
path = malloc(strlen(def_path) + strlen(sh->codec->dll) + 2);
|
||||
path = malloc(strlen(codecs_path) + strlen(sh->codec->dll) + 2);
|
||||
if (!path) return 0;
|
||||
sprintf(path, "%s/%s", def_path, sh->codec->dll);
|
||||
sprintf(path, "%s/%s", codecs_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 */
|
||||
|
@ -682,7 +682,7 @@ static int init(sh_video_t *sh)
|
||||
for (i=0; i < XA_CLOSE_FUNCS; i++)
|
||||
xa_close_func[i] = NULL;
|
||||
|
||||
snprintf(dll, 1024, "%s/%s", def_path, sh->codec->dll);
|
||||
snprintf(dll, 1024, "%s/%s", codec_path, sh->codec->dll);
|
||||
if (xacodec_load(sh, dll) == 0)
|
||||
return 0;
|
||||
|
||||
|
@ -68,7 +68,7 @@ void *ELFDLL_dlopen(const char *libname, int flags)
|
||||
|
||||
/* Now try to construct searches through our extra search-path */
|
||||
namelen = strlen(libname);
|
||||
ldpath = def_path;
|
||||
ldpath = codec_path;
|
||||
while(ldpath && *ldpath)
|
||||
{
|
||||
int len;
|
||||
|
@ -393,9 +393,9 @@ HMODULE WINAPI LoadLibraryExA(LPCSTR libname, HANDLE hfile, DWORD flags)
|
||||
strncpy(path, libname, 511);
|
||||
else
|
||||
/* check default user path */
|
||||
strncpy(path, def_path, 300);
|
||||
strncpy(path, codec_path, 300);
|
||||
}
|
||||
else if (strcmp(def_path, listpath[i]))
|
||||
else if (strcmp(codec_path, listpath[i]))
|
||||
/* path from the list */
|
||||
strncpy(path, listpath[i], 300);
|
||||
else
|
||||
|
@ -2575,7 +2575,8 @@ static int WINAPI expLoadLibraryA(char* name)
|
||||
return MODULE_HANDLE_psapi;
|
||||
|
||||
result=LoadLibraryA(name);
|
||||
dbgprintf("Returned LoadLibraryA(0x%x='%s'), def_path=%s => 0x%x\n", name, name, def_path, result);
|
||||
dbgprintf("Returned LoadLibraryA(0x%x='%s'), codec_path=%s => 0x%x\n",
|
||||
name, name, codec_path, result);
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -3589,13 +3590,15 @@ static HANDLE WINAPI expFindFirstFileA(LPCSTR s, LPWIN32_FIND_DATAA lpfd)
|
||||
#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);
|
||||
qtx_dir=opendir(def_path);
|
||||
dbgprintf("\n### Searching for QuickTime plugins (*.qtx) at %s...\n",
|
||||
codec_path);
|
||||
qtx_dir = opendir(codec_path);
|
||||
if(!qtx_dir) return (HANDLE)-1;
|
||||
memset(lpfd,0,sizeof(*lpfd));
|
||||
if(expFindNextFileA(FILE_HANDLE_quicktimeqtx,lpfd))
|
||||
return FILE_HANDLE_quicktimeqtx;
|
||||
printf("loader: Couldn't find the QuickTime plugins (.qtx files) at %s\n",def_path);
|
||||
printf("loader: Couldn't find the QuickTime plugins (.qtx files) at %s\n",
|
||||
codec_path);
|
||||
return (HANDLE)-1;
|
||||
}
|
||||
#if 0
|
||||
@ -3732,8 +3735,8 @@ static HANDLE WINAPI expCreateFileA(LPCSTR cs1,DWORD i1,DWORD i2,
|
||||
if(strstr(cs1, "QuickTime.qts"))
|
||||
{
|
||||
int result;
|
||||
char* tmp=malloc(strlen(def_path)+50);
|
||||
strcpy(tmp, def_path);
|
||||
char* tmp = malloc(strlen(codec_path) + 50);
|
||||
strcpy(tmp, codec_path);
|
||||
strcat(tmp, "/");
|
||||
strcat(tmp, "QuickTime.qts");
|
||||
result=open(tmp, O_RDONLY);
|
||||
@ -3743,9 +3746,9 @@ static HANDLE WINAPI expCreateFileA(LPCSTR cs1,DWORD i1,DWORD i2,
|
||||
if(strstr(cs1, ".qtx"))
|
||||
{
|
||||
int result;
|
||||
char* tmp=malloc(strlen(def_path)+250);
|
||||
char* tmp = malloc(strlen(codec_path) + 250);
|
||||
char* x=strrchr(cs1,'\\');
|
||||
sprintf(tmp,"%s/%s",def_path,x?(x+1):cs1);
|
||||
sprintf(tmp, "%s/%s", codec_path, x ? (x + 1) : cs1);
|
||||
// printf("### Open: %s -> %s\n",cs1,tmp);
|
||||
result=open(tmp, O_RDONLY);
|
||||
free(tmp);
|
||||
@ -3756,8 +3759,8 @@ static HANDLE WINAPI expCreateFileA(LPCSTR cs1,DWORD i1,DWORD i2,
|
||||
if(strncmp(cs1, "AP", 2) == 0)
|
||||
{
|
||||
int result;
|
||||
char* tmp=malloc(strlen(def_path)+50);
|
||||
strcpy(tmp, def_path);
|
||||
char* tmp = malloc(strlen(codec_path) + 50);
|
||||
strcpy(tmp, codec_path);
|
||||
strcat(tmp, "/");
|
||||
strcat(tmp, "APmpg4v1.apl");
|
||||
result=open(tmp, O_RDONLY);
|
||||
|
@ -314,5 +314,3 @@ const m_option_t noconfig_opts[] = {
|
||||
{NULL, NULL, 0, 0, 0, 0, NULL}
|
||||
};
|
||||
|
||||
char *codec_path = NULL;
|
||||
|
||||
|
@ -37,6 +37,4 @@ void set_osd_subtitle(subtitle *subs);
|
||||
extern int disable_system_conf;
|
||||
extern int disable_user_conf;
|
||||
|
||||
extern char *codec_path;
|
||||
|
||||
#endif /* MPLAYER_MPCOMMON_H */
|
||||
|
10
path.c
10
path.c
@ -176,20 +176,20 @@ void set_path_env(void)
|
||||
}
|
||||
#endif /* (defined(__MINGW32__) || defined(__CYGWIN__)) && defined(CONFIG_WIN32DLL) */
|
||||
|
||||
char *def_path = BINARY_CODECS_PATH;
|
||||
char *codec_path = BINARY_CODECS_PATH;
|
||||
|
||||
static int needs_free = 0;
|
||||
|
||||
void set_codec_path(const char *path)
|
||||
{
|
||||
if (needs_free)
|
||||
free(def_path);
|
||||
free(codec_path);
|
||||
if (path == 0) {
|
||||
def_path = BINARY_CODECS_PATH;
|
||||
codec_path = BINARY_CODECS_PATH;
|
||||
needs_free = 0;
|
||||
return;
|
||||
}
|
||||
def_path = malloc(strlen(path) + 1);
|
||||
strcpy(def_path, path);
|
||||
codec_path = malloc(strlen(path) + 1);
|
||||
strcpy(codec_path, path);
|
||||
needs_free = 1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user