diff options
author | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2010-01-03 17:00:51 +0000 |
---|---|---|
committer | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2010-01-03 17:00:51 +0000 |
commit | f31ed10742a2f195629b98bce6470c0aaa2bf232 (patch) | |
tree | 5abdc38893705c0b593890d541fe4926e1b52f13 | |
parent | 37f93a57e5116b0f0b88b835ee7106495a113688 (diff) | |
download | mpv-f31ed10742a2f195629b98bce6470c0aaa2bf232.tar.bz2 mpv-f31ed10742a2f195629b98bce6470c0aaa2bf232.tar.xz |
Modify -vo direct3d so we do not have to link against d3d9.dll, it might
not be available on some rare systems.
Based on patch used for builds by Gianluigi Tiesi [sherpya netfarm it]
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30190 b3059339-0415-0410-9bf9-f77b7e298cf2
-rwxr-xr-x | configure | 3 | ||||
-rw-r--r-- | libvo/vo_direct3d.c | 21 |
2 files changed, 20 insertions, 4 deletions
@@ -5334,11 +5334,10 @@ if test "$_direct3d" = auto ; then int main(void) { return 0; } EOF _direct3d=no - cc_check -ld3d9 && _direct3d=yes + cc_check && _direct3d=yes fi if test "$_direct3d" = yes ; then def_direct3d='#define CONFIG_DIRECT3D 1' - libs_mplayer="$libs_mplayer -ld3d9" _vomodules="direct3d $_vomodules" else def_direct3d='#undef CONFIG_DIRECT3D' diff --git a/libvo/vo_direct3d.c b/libvo/vo_direct3d.c index bfeb82e562..090f48bcf8 100644 --- a/libvo/vo_direct3d.c +++ b/libvo/vo_direct3d.c @@ -70,6 +70,10 @@ static struct global_priv { the movie's codec) */ D3DFORMAT desktop_fmt; /**< Desktop (screen) colorspace format. Usually XRGB */ + + HANDLE d3d9_dll; /**< d3d9 Library HANDLE */ + IDirect3D9 * (WINAPI *pDirect3DCreate9)(UINT); /**< pointer to Direct3DCreate9 function */ + LPDIRECT3D9 d3d_handle; /**< Direct3D Handle */ LPDIRECT3DDEVICE9 d3d_device; /**< The Direct3D Adapter */ IDirect3DSurface9 *d3d_surface; /**< Offscreen Direct3D Surface. MPlayer @@ -441,7 +445,7 @@ static int reconfigure_d3d(void) IDirect3D9_Release(priv->d3d_handle); /* Initialize Direct3D from the beginning */ - priv->d3d_handle = Direct3DCreate9(D3D_SDK_VERSION); + priv->d3d_handle = priv->pDirect3DCreate9(D3D_SDK_VERSION); if (!priv->d3d_handle) { mp_msg(MSGT_VO, MSGL_ERR, "<vo_direct3d>Initializing Direct3D failed.\n"); return 0; @@ -678,7 +682,19 @@ static int preinit(const char *arg) > an example of how to use it. */ - priv->d3d_handle = Direct3DCreate9(D3D_SDK_VERSION); + priv->d3d9_dll = LoadLibraryA("d3d9.dll"); + if (!priv->d3d9_dll) { + mp_msg(MSGT_VO, MSGL_ERR, "<vo_direct3d>Unable to dynamically load d3d9.dll\n"); + return -1; + } + + priv->pDirect3DCreate9 = (void *)GetProcAddress(priv->d3d9_dll, "Direct3DCreate9"); + if (!priv->pDirect3DCreate9) { + mp_msg(MSGT_VO, MSGL_ERR, "<vo_direct3d>Unable to find entry point of Direct3DCreate9\n"); + return -1; + } + + priv->d3d_handle = priv->pDirect3DCreate9(D3D_SDK_VERSION); if (!priv->d3d_handle) { mp_msg(MSGT_VO, MSGL_ERR, "<vo_direct3d>Initializing Direct3D failed.\n"); return -1; @@ -861,6 +877,7 @@ static void uninit(void) uninit_d3d(); vo_w32_uninit(); /* w32_common framework call */ + FreeLibrary(priv->d3d9_dll); free(priv); priv = NULL; } |