[vlc-commits] directx_va: do not load the DLL if it's already loaded

Steve Lhomme git at videolan.org
Mon Nov 20 19:14:07 CET 2017


vlc | branch: master | Steve Lhomme <robUx4 at videolabs.io> | Sat Nov 18 14:29:26 2017 +0100| [8245920db976689f81f2212c1db7c08e4867d73c] | committer: Jean-Baptiste Kempf

directx_va: do not load the DLL if it's already loaded

For D3D11 we always load it.

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=8245920db976689f81f2212c1db7c08e4867d73c
---

 modules/codec/avcodec/d3d11va.c    | 7 +------
 modules/codec/avcodec/directx_va.c | 4 ++--
 modules/codec/avcodec/directx_va.h | 2 +-
 modules/codec/avcodec/dxva2.c      | 2 +-
 4 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/modules/codec/avcodec/d3d11va.c b/modules/codec/avcodec/d3d11va.c
index b17dd45cdf..8e8afe9858 100644
--- a/modules/codec/avcodec/d3d11va.c
+++ b/modules/codec/avcodec/d3d11va.c
@@ -354,7 +354,6 @@ static int Open(vlc_va_t *va, AVCodecContext *ctx, enum PixelFormat pix_fmt,
     dx_sys->va_pool.pf_new_surface_context     = NewSurfacePicContext;
     dx_sys->pf_get_input_list          = DxGetInputList;
     dx_sys->pf_setup_output            = DxSetupOutput;
-    dx_sys->psz_decoder_dll            = TEXT("D3D11.DLL");
 
     va->sys = sys;
 
@@ -398,11 +397,7 @@ static int Open(vlc_va_t *va, AVCodecContext *ctx, enum PixelFormat pix_fmt,
     if (err != VLC_SUCCESS)
         goto error;
 
-#if VLC_WINSTORE_APP
-    err = directx_va_Open(va, &sys->dx_sys, false);
-#else
-    err = directx_va_Open(va, &sys->dx_sys, true);
-#endif
+    err = directx_va_Open(va, &sys->dx_sys);
     if (err!=VLC_SUCCESS)
         goto error;
 
diff --git a/modules/codec/avcodec/directx_va.c b/modules/codec/avcodec/directx_va.c
index 4962aa7b5e..0c96876e5e 100644
--- a/modules/codec/avcodec/directx_va.c
+++ b/modules/codec/avcodec/directx_va.c
@@ -335,9 +335,9 @@ void directx_va_Close(vlc_va_t *va, directx_sys_t *dx_sys)
         FreeLibrary(dx_sys->hdecoder_dll);
 }
 
-int directx_va_Open(vlc_va_t *va, directx_sys_t *dx_sys, bool b_dll)
+int directx_va_Open(vlc_va_t *va, directx_sys_t *dx_sys)
 {
-    if (b_dll) {
+    if (dx_sys->psz_decoder_dll) {
         /* Load dll*/
         dx_sys->hdecoder_dll = LoadLibrary(dx_sys->psz_decoder_dll);
         if (!dx_sys->hdecoder_dll) {
diff --git a/modules/codec/avcodec/directx_va.h b/modules/codec/avcodec/directx_va.h
index df745298f3..19f31ca938 100644
--- a/modules/codec/avcodec/directx_va.h
+++ b/modules/codec/avcodec/directx_va.h
@@ -85,7 +85,7 @@ typedef struct
 
 } directx_sys_t;
 
-int directx_va_Open(vlc_va_t *, directx_sys_t *, bool b_dll);
+int directx_va_Open(vlc_va_t *, directx_sys_t *);
 void directx_va_Close(vlc_va_t *, directx_sys_t *);
 int directx_va_Setup(vlc_va_t *, directx_sys_t *, const AVCodecContext *avctx, const es_format_t *);
 char *directx_va_GetDecoderName(const GUID *guid);
diff --git a/modules/codec/avcodec/dxva2.c b/modules/codec/avcodec/dxva2.c
index 2758cbea7e..9bdd4ac47d 100644
--- a/modules/codec/avcodec/dxva2.c
+++ b/modules/codec/avcodec/dxva2.c
@@ -296,7 +296,7 @@ static int Open(vlc_va_t *va, AVCodecContext *ctx, enum PixelFormat pix_fmt,
         sys->d3d_dev.owner = false;
     }
 
-    err = directx_va_Open(va, &sys->dx_sys, true);
+    err = directx_va_Open(va, &sys->dx_sys);
     if (err!=VLC_SUCCESS)
         goto error;
 



More information about the vlc-commits mailing list