Split codec path related code into a separate file to fix Windows build.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30930 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
reimar 2010-03-18 20:44:01 +00:00
parent 70017fa388
commit a743c0a738
10 changed files with 45 additions and 28 deletions

View File

@ -315,6 +315,7 @@ SRCS_COMMON-$(WIN32DLL) += libmpcodecs/ad_acm.c \
libmpcodecs/vd_vfwex.c \
libmpdemux/demux_avs.c \
loader/afl.c \
loader/codecpath.c \
loader/drv.c \
loader/vfl.c \
loader/dshow/DS_AudioDecoder.c \

26
loader/codecpath.c Normal file
View File

@ -0,0 +1,26 @@
/*
* Modified for use with MPlayer, detailed changelog at
* http://svn.mplayerhq.hu/mplayer/trunk/
*/
#include <stdlib.h>
#include <string.h>
#include "config.h"
#include "codecpath.h"
char* def_path = BINARY_CODECS_PATH;
static int needs_free=0;
void SetCodecPath(const char* path)
{
if(needs_free)free(def_path);
if(path==0)
{
def_path = BINARY_CODECS_PATH;
needs_free=0;
return;
}
def_path = malloc(strlen(path)+1);
strcpy(def_path, path);
needs_free=1;
}

12
loader/codecpath.h Normal file
View File

@ -0,0 +1,12 @@
/*
* Modified for use with MPlayer, detailed changelog at
* http://svn.mplayerhq.hu/mplayer/trunk/
*/
#ifndef MPLAYER_CODECPATH_H
#define MPLAYER_CODECPATH_H
extern char *def_path;
void SetCodecPath(const char* path);
#endif /* MPLAYER_CODECPATH_H */

View File

@ -25,12 +25,7 @@
#ifndef __MINGW32__
#include "ext.h"
#endif
#ifndef WIN32_LOADER
char* def_path = BINARY_CODECS_PATH;
#else
extern char* def_path;
#endif
#include "codecpath.h"
#if 1
@ -65,21 +60,6 @@ extern char* def_path;
"pop %%ebx\n\t"::)
#endif
static int needs_free=0;
void SetCodecPath(const char* path)
{
if(needs_free)free(def_path);
if(path==0)
{
def_path = BINARY_CODECS_PATH;
needs_free=0;
return;
}
def_path = malloc(strlen(path)+1);
strcpy(def_path, path);
needs_free=1;
}
static DWORD dwDrvID = 0;
LRESULT WINAPI SendDriverMessage(HDRVR hDriver, UINT message,

View File

@ -9,7 +9,6 @@
#include "wine/windef.h"
#include "wine/driver.h"
void SetCodecPath(const char* path);
void CodecAlloc(void);
void CodecRelease(void);

View File

@ -18,6 +18,7 @@
#include "wine/debugtools.h"
#include "wine/winerror.h"
#include "debug.h"
#include "codecpath.h"
//DEFAULT_DEBUG_CHANNEL(elfdll)
@ -38,7 +39,6 @@ void dump_exports(HMODULE hModule);
/*---------------- END HACKS ---------------*/
//char *extra_ld_library_path = "/usr/lib/win32";
extern char* def_path;
struct elfdll_image
{

View File

@ -46,6 +46,7 @@
#endif
#include "win32.h"
#include "drv.h"
#include "codecpath.h"
#ifdef EMU_QTX_API
#include "wrapper.h"
@ -366,7 +367,6 @@ HMODULE WINAPI LoadLibraryExA(LPCSTR libname, HANDLE hfile, DWORD flags)
{
WINE_MODREF *wm = 0;
char* listpath[] = { "", "", "/usr/lib/win32", "/usr/local/lib/win32", 0 };
extern char* def_path;
char path[512];
char checked[2000];
int i = -1;

View File

@ -49,6 +49,7 @@ for DLL to know too much about its environment.
#include "loader.h"
#include "com.h"
#include "ext.h"
#include "codecpath.h"
#include <stdlib.h>
#include <assert.h>
@ -77,8 +78,6 @@ for DLL to know too much about its environment.
#include "osdep/mmap_anon.h"
#include "libavutil/avstring.h"
char* def_path = BINARY_CODECS_PATH;
static void do_cpuid(unsigned int ax, unsigned int *regs)
{
__asm__ volatile

View File

@ -66,7 +66,7 @@
#include "get_path.h"
#ifdef CONFIG_WIN32DLL
#include "loader/drv.h" // for SetCodecPath()
#include "loader/codecpath.h" // for SetCodecPath()
#endif
#include "stream/stream.h"

View File

@ -96,7 +96,7 @@
#include "input/input.h"
#ifdef CONFIG_WIN32DLL
#include "loader/drv.h" // for SetCodecPath()
#include "loader/codecpath.h" // for SetCodecPath()
#endif
int slave_mode=0;