[vlc-commits] [Git][videolan/vlc][master] 7 commits: winvlc: always call SetDefaultDllDirectories() directly
Steve Lhomme (@robUx4)
gitlab at videolan.org
Tue Feb 4 07:29:56 UTC 2025
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
150ebf4c by Steve Lhomme at 2025-02-04T06:58:20+00:00
winvlc: always call SetDefaultDllDirectories() directly
It is found in Windows 7 with KB2533623 [^1].
This KB is required on VLC 4 since 64707300b9367013d289cf6ca762531f8ef39675.
[^1]: https://learn.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-libloaderapi-setdefaultdlldirectories#requirements
- - - - -
2b66a9aa by Steve Lhomme at 2025-02-04T06:58:20+00:00
dxva2: link with dxva2.lib
The DXVA2 code is enabled for non-UWP targets and all Windows targets
have this DLL (since Vista).
If for some reason the DLL is not there, the plugin won't be loaded
and it will rightfully be skipped.
- - - - -
e263d60a by Steve Lhomme at 2025-02-04T06:58:20+00:00
d3d9_filters: link with dxva2.lib
The DXVA2 code is enabled for non-UWP targets and all Windows targets
have this DLL (since Vista).
If for some reason the DLL is not there, the plugin won't be loaded
and it will rightfully be skipped.
- - - - -
a99578da by Steve Lhomme at 2025-02-04T06:58:20+00:00
d3d9_fmt: link with d3d9.lib
The Direct3D9 code is enabled for non-UWP targets and all Windows targets
have this DLL (since Vista).
If for some reason the DLL is not there, the plugin won't be loaded
and it will rightfully be skipped.
Direct3DCreate9Ex() is available since Vista [^1]:
> Direct3DCreate9Ex is supported only in Windows Vista, Windows Server 2008, and Windows 7. Earlier versions of the D3D9.dll library do not include Direct3D9Ex and Direct3DCreate9Ex.
We fallback to Direct3DCreate9() just in case it fails for maximum compatibility.
[^1]: https://learn.microsoft.com/en-us/windows/win32/api/d3d9/nf-d3d9-direct3dcreate9ex#remarks
- - - - -
b9045def by Steve Lhomme at 2025-02-04T06:58:20+00:00
direct3d9: link with dxva2.lib
The Direct3D9 code is enabled for non-UWP targets and all Windows targets
have this DLL (since Vista).
DXVAHD_CreateDevice is available since Windows 7 [^1].
If for some reason the DLL is not there, the plugin won't be loaded
and it will rightfully be skipped.
[^1]: https://learn.microsoft.com/en-us/windows/win32/api/dxvahd/nf-dxvahd-dxvahd_createdevice
- - - - -
c2ca20f3 by Steve Lhomme at 2025-02-04T06:58:20+00:00
interop_dxva2: link with dxva2.lib
The Direct3D9 code is enabled for non-UWP targets and all Windows targets
have this DLL (since Vista).
DXVAHD_CreateDevice is available since Windows 7 [^1].
If for some reason the DLL is not there, the plugin won't be loaded
and it will rightfully be skipped.
[^1]: https://learn.microsoft.com/en-us/windows/win32/api/dxvahd/nf-dxvahd-dxvahd_createdevice
- - - - -
24712de5 by Steve Lhomme at 2025-02-04T06:58:20+00:00
interop_dxva2: fix unused warning
- - - - -
16 changed files:
- bin/winvlc.c
- modules/codec/Makefile.am
- modules/codec/avcodec/dxva2.c
- modules/codec/meson.build
- modules/hw/d3d9/Makefile.am
- modules/hw/d3d9/d3d9_filters.c
- modules/hw/d3d9/dxva2_deinterlace.c
- modules/hw/d3d9/meson.build
- modules/video_chroma/d3d9_fmt.c
- modules/video_chroma/d3d9_fmt.h
- modules/video_chroma/meson.build
- modules/video_output/Makefile.am
- modules/video_output/opengl/interop_dxva2.c
- modules/video_output/opengl/meson.build
- modules/video_output/win32/direct3d9.c
- modules/video_output/win32/meson.build
Changes:
=====================================
bin/winvlc.c
=====================================
@@ -59,26 +59,6 @@ static char *FromWide (const wchar_t *wide)
return out;
}
-#if (_WIN32_WINNT < _WIN32_WINNT_WIN8)
-static BOOL SetDefaultDllDirectories_(DWORD flags)
-{
- HMODULE h = GetModuleHandle(TEXT("kernel32.dll"));
- if (h == NULL)
- return FALSE;
-
- BOOL (WINAPI * SetDefaultDllDirectoriesReal)(DWORD);
-
- SetDefaultDllDirectoriesReal = (BOOL (WINAPI *)(DWORD))
- GetProcAddress(h, "SetDefaultDllDirectories");
- if (SetDefaultDllDirectoriesReal == NULL)
- return FALSE;
-
- return SetDefaultDllDirectoriesReal(flags);
-}
-# define SetDefaultDllDirectories SetDefaultDllDirectories_
-
-#endif
-
static void PrioritizeSystem32(void)
{
#if _WIN32_WINNT < _WIN32_WINNT_WIN8
=====================================
modules/codec/Makefile.am
=====================================
@@ -433,7 +433,7 @@ libdxva2_plugin_la_SOURCES = \
packetizer/hevc_nal.c packetizer/hevc_nal.h \
packetizer/h26x_nal_common.h \
codec/avcodec/dxva_blocklist.c
-libdxva2_plugin_la_LIBADD = libd3d9_common.la $(LIBCOM) -luuid
+libdxva2_plugin_la_LIBADD = libd3d9_common.la -ld3d9 $(LIBCOM) -luuid -ldxva2
if !HAVE_WINSTORE
if HAVE_AVCODEC_DXVA2
codec_LTLIBRARIES += libdxva2_plugin.la
=====================================
modules/codec/avcodec/dxva2.c
=====================================
@@ -41,7 +41,6 @@ struct dxva2_pic_context
{
struct d3d9_pic_context ctx;
struct vlc_va_surface_t *va_surface;
- HINSTANCE dxva2_dll;
};
#define DXVA2_PICCONTEXT_FROM_PICCTX(pic_ctx) \
@@ -64,9 +63,6 @@ typedef struct
/* Direct3D */
vlc_video_context *vctx;
- /* DLL */
- HINSTANCE dxva2_dll;
-
/* Device manager */
IDirect3DDeviceManager9 *devmng;
HANDLE device;
@@ -113,12 +109,10 @@ static void dxva2_pic_context_destroy(picture_context_t *ctx)
{
struct dxva2_pic_context *pic_ctx = DXVA2_PICCONTEXT_FROM_PICCTX(ctx);
struct vlc_va_surface_t *va_surface = pic_ctx->va_surface;
- HINSTANCE dxva2_dll = pic_ctx->dxva2_dll;
static_assert(offsetof(struct dxva2_pic_context, ctx.s) == 0,
"Cast assumption failure");
d3d9_pic_context_destroy(ctx);
va_surface_Release(va_surface);
- FreeLibrary(dxva2_dll);
}
static picture_context_t *dxva2_pic_context_copy(picture_context_t *ctx)
@@ -128,7 +122,6 @@ static picture_context_t *dxva2_pic_context_copy(picture_context_t *ctx)
if (unlikely(pic_ctx==NULL))
return NULL;
*pic_ctx = *src_ctx;
- pic_ctx->dxva2_dll = LoadLibrary(TEXT("DXVA2.DLL"));
vlc_video_context_Hold(pic_ctx->ctx.s.vctx);
va_surface_AddRef(pic_ctx->va_surface);
AcquireD3D9PictureSys(&pic_ctx->ctx.picsys);
@@ -156,7 +149,6 @@ static picture_context_t* NewSurfacePicContext(vlc_va_t *va, vlc_va_surface_t *v
if (unlikely(pic_ctx==NULL))
return NULL;
pic_ctx->va_surface = va_surface;
- pic_ctx->dxva2_dll = LoadLibrary(TEXT("DXVA2.DLL"));
return &pic_ctx->ctx.s;
}
@@ -245,15 +237,6 @@ static int Open(vlc_va_t *va, struct vlc_va_cfg *cfg)
va->sys = sys;
/* Load dll*/
- sys->dxva2_dll = LoadLibrary(TEXT("DXVA2.DLL"));
- if (!sys->dxva2_dll) {
- msg_Warn(va, "cannot load DXVA2 decoder DLL");
- if (sys->vctx)
- vlc_video_context_Release(sys->vctx);
- free( sys );
- return VLC_EGENERIC;
- }
-
struct va_pool_cfg pool_cfg = {
D3dCreateDevice,
DxDestroyVideoDecoder,
@@ -318,20 +301,8 @@ static int D3dCreateDevice(vlc_va_t *va)
d3d9_decoder_device_t *d3d9_decoder = GetD3D9OpaqueContext(sys->vctx);
- HRESULT (WINAPI *CreateDeviceManager9)(UINT *pResetToken,
- IDirect3DDeviceManager9 **);
- CreateDeviceManager9 =
- (void *)GetProcAddress(sys->dxva2_dll,
- "DXVA2CreateDirect3DDeviceManager9");
-
- if (!CreateDeviceManager9) {
- msg_Err(va, "cannot load function");
- return VLC_EGENERIC;
- }
- msg_Dbg(va, "got CreateDeviceManager9");
-
UINT token;
- if (FAILED(CreateDeviceManager9(&token, &sys->devmng))) {
+ if (FAILED(DXVA2CreateDirect3DDeviceManager9(&token, &sys->devmng))) {
msg_Err(va, " OurDirect3DCreateDeviceManager9 failed");
return VLC_EGENERIC;
}
@@ -623,8 +594,6 @@ static void DxDestroyVideoDecoder(void *opaque)
IDirect3DDeviceManager9_CloseDeviceHandle(sys->devmng, sys->device);
IDirectXVideoDecoderService_Release(sys->d3ddec);
IDirect3DDeviceManager9_Release(sys->devmng);
- if (sys->dxva2_dll)
- FreeLibrary(sys->dxva2_dll);
free(sys);
}
=====================================
modules/codec/meson.build
=====================================
@@ -696,7 +696,7 @@ if host_system == 'windows'
vlc_include_dirs,
include_directories('avcodec')
],
- 'dependencies' : [avcodec_dep, avutil_dep],
+ 'dependencies' : [avcodec_dep, avutil_dep, cc.find_library('dxva2')],
}
endif
=====================================
modules/hw/d3d9/Makefile.am
=====================================
@@ -6,7 +6,7 @@ libdirect3d9_filters_plugin_la_SOURCES = hw/d3d9/d3d9_filters.h \
hw/d3d9/dxa9.c \
hw/d3d9/d3d9_device.c
libdirect3d9_filters_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(d3d9dir)'
-libdirect3d9_filters_plugin_la_LIBADD = libchroma_copy.la libdeinterlace_common.la libd3d9_common.la $(LIBCOM)
+libdirect3d9_filters_plugin_la_LIBADD = libchroma_copy.la libdeinterlace_common.la libd3d9_common.la -ld3d9 $(LIBCOM) -ldxva2
if HAVE_WIN32_DESKTOP
d3d9_LTLIBRARIES = $(LTLIBdirect3d9_filters)
=====================================
modules/hw/d3d9/d3d9_filters.c
=====================================
@@ -54,7 +54,6 @@ struct filter_level
typedef struct
{
- HINSTANCE hdecoder_dll;
IDirectXVideoProcessor *processor;
IDirect3DSurface9 *hw_surface;
@@ -261,7 +260,6 @@ static void D3D9CloseAdjust(filter_t *filter)
IDirect3DSurface9_Release( sys->hw_surface );
IDirectXVideoProcessor_Release( sys->processor );
- FreeLibrary( sys->hdecoder_dll );
vlc_video_context_Release(filter->vctx_out);
free(sys);
@@ -274,7 +272,6 @@ static const struct vlc_filter_operations filter_ops = {
static int D3D9OpenAdjust(filter_t *filter)
{
filter_sys_t *sys = NULL;
- HINSTANCE hdecoder_dll = NULL;
HRESULT hr;
GUID *processorGUIDs = NULL;
GUID *processorGUID = NULL;
@@ -293,26 +290,11 @@ static int D3D9OpenAdjust(filter_t *filter)
if (unlikely(sys == NULL))
return VLC_ENOMEM;
- hdecoder_dll = LoadLibrary(TEXT("DXVA2.DLL"));
- if (!hdecoder_dll)
- goto error;
-
d3d9_video_context_t *vtcx_sys = GetD3D9ContextPrivate( filter->vctx_in );
D3DFORMAT format = vtcx_sys->format;
- HRESULT (WINAPI *CreateVideoService)(IDirect3DDevice9 *,
- REFIID riid,
- void **ppService);
- CreateVideoService =
- (void *)GetProcAddress(hdecoder_dll, "DXVA2CreateVideoService");
- if (CreateVideoService == NULL)
- {
- msg_Err(filter, "Can't create video service");
- goto error;
- }
-
d3d9_decoder_device_t *d3d9_decoder = GetD3D9OpaqueContext(filter->vctx_in);
- hr = CreateVideoService( d3d9_decoder->d3ddev.dev,
+ hr = DXVA2CreateVideoService( d3d9_decoder->d3ddev.dev,
&IID_IDirectXVideoProcessorService, &pv);
if (FAILED(hr))
{
@@ -459,8 +441,6 @@ static int D3D9OpenAdjust(filter_t *filter)
CoTaskMemFree(processorGUIDs);
IDirectXVideoProcessorService_Release(processor);
- sys->hdecoder_dll = hdecoder_dll;
-
filter->ops = &filter_ops;
filter->p_sys = sys;
filter->vctx_out = vlc_video_context_Hold(filter->vctx_in);
@@ -472,8 +452,6 @@ error:
IDirectXVideoProcessor_Release( sys->processor );
if (processor)
IDirectXVideoProcessorService_Release(processor);
- if (hdecoder_dll)
- FreeLibrary(hdecoder_dll);
free(sys);
return VLC_EGENERIC;
=====================================
modules/hw/d3d9/dxva2_deinterlace.c
=====================================
@@ -42,7 +42,6 @@
typedef struct
{
- HINSTANCE hdecoder_dll;
IDirectXVideoProcessor *processor;
IDirect3DSurface9 *hw_surface;
@@ -329,7 +328,6 @@ static void D3D9CloseDeinterlace(filter_t *filter)
Flush(filter);
IDirect3DSurface9_Release( sys->hw_surface );
IDirectXVideoProcessor_Release( sys->processor );
- FreeLibrary( sys->hdecoder_dll );
vlc_video_context_Release(filter->vctx_out);
free(sys);
@@ -342,7 +340,6 @@ static const struct vlc_filter_operations filter_ops = {
int D3D9OpenDeinterlace(filter_t *filter)
{
filter_sys_t *sys;
- HINSTANCE hdecoder_dll = NULL;
HRESULT hr;
GUID *processorGUIDs = NULL;
GUID *processorGUID = NULL;
@@ -361,22 +358,11 @@ int D3D9OpenDeinterlace(filter_t *filter)
if (unlikely(sys == NULL))
return VLC_ENOMEM;
- hdecoder_dll = LoadLibrary(TEXT("DXVA2.DLL"));
- if (!hdecoder_dll)
- goto error;
-
d3d9_video_context_t *vtcx_sys = GetD3D9ContextPrivate( filter->vctx_in );
d3d9_decoder_device_t *d3d9_decoder = GetD3D9OpaqueContext( filter->vctx_in );
- HRESULT (WINAPI *CreateVideoService)(IDirect3DDevice9 *,
- REFIID riid,
- void **ppService);
- CreateVideoService =
- (void *)GetProcAddress(hdecoder_dll, "DXVA2CreateVideoService");
- if (CreateVideoService == NULL)
- goto error;
- hr = CreateVideoService( d3d9_decoder->d3ddev.dev,
+ hr = DXVA2CreateVideoService( d3d9_decoder->d3ddev.dev,
&IID_IDirectXVideoProcessorService, &pv );
if (FAILED(hr))
goto error;
@@ -493,7 +479,6 @@ int D3D9OpenDeinterlace(filter_t *filter)
goto error;
sys->Saturation = Range.DefaultValue.Value;
- sys->hdecoder_dll = hdecoder_dll;
sys->decoder_caps = best_caps;
InitDeinterlacingContext( &sys->context );
@@ -532,8 +517,6 @@ error:
IDirectXVideoProcessor_Release( sys->processor );
if (processor)
IDirectXVideoProcessorService_Release(processor);
- if (hdecoder_dll)
- FreeLibrary(hdecoder_dll);
free(sys);
return VLC_EGENERIC;
=====================================
modules/hw/d3d9/meson.build
=====================================
@@ -12,6 +12,7 @@ vlc_modules += {
'd3d9_device.c',
),
'link_with' : [ d3d9_common_lib, chroma_copy_lib, deinterlacecommon_lib ],
+ 'dependencies' : [ cc.find_library('dxva2') ],
'include_directories' : [vlc_include_dirs],
'enabled' : get_option('directx').allowed()
}
=====================================
modules/video_chroma/d3d9_fmt.c
=====================================
@@ -98,11 +98,6 @@ static void D3D9_Destroy(d3d9_handle_t *hd3d)
IDirect3D9_Release(hd3d->obj);
hd3d->obj = NULL;
}
- if (hd3d->hdll)
- {
- FreeLibrary(hd3d->hdll);
- hd3d->hdll = NULL;
- }
}
/**
@@ -110,37 +105,17 @@ static void D3D9_Destroy(d3d9_handle_t *hd3d)
*/
static int D3D9_Create(vlc_object_t *o, d3d9_handle_t *hd3d)
{
- hd3d->hdll = LoadLibrary(TEXT("D3D9.DLL"));
- if (!hd3d->hdll) {
- msg_Warn(o, "cannot load d3d9.dll, aborting");
- return VLC_EGENERIC;
- }
-
- IDirect3D9 *(WINAPI *OurDirect3DCreate9)(UINT SDKVersion);
- OurDirect3DCreate9 =
- (void *)GetProcAddress(hd3d->hdll, "Direct3DCreate9");
- if (!OurDirect3DCreate9) {
- msg_Err(o, "Cannot locate reference to Direct3DCreate9 ABI in DLL");
- goto error;
- }
-
- HRESULT (WINAPI *OurDirect3DCreate9Ex)(UINT SDKVersion, IDirect3D9Ex **ppD3D);
- OurDirect3DCreate9Ex =
- (void *)GetProcAddress(hd3d->hdll, "Direct3DCreate9Ex");
-
/* Create the D3D object. */
hd3d->use_ex = false;
- if (OurDirect3DCreate9Ex) {
- HRESULT hr = OurDirect3DCreate9Ex(D3D_SDK_VERSION, &hd3d->objex);
- if(!FAILED(hr)) {
- msg_Dbg(o, "Using Direct3D9 Extended API!");
- hd3d->use_ex = true;
- }
+ HRESULT hr = Direct3DCreate9Ex(D3D_SDK_VERSION, &hd3d->objex);
+ if(!FAILED(hr)) {
+ msg_Dbg(o, "Using Direct3D9 Extended API!");
+ hd3d->use_ex = true;
}
if (!hd3d->obj)
{
- hd3d->obj = OurDirect3DCreate9(D3D_SDK_VERSION);
+ hd3d->obj = Direct3DCreate9(D3D_SDK_VERSION);
if (!hd3d->obj) {
msg_Err(o, "Could not create Direct3D9 instance.");
goto error;
@@ -156,7 +131,6 @@ static void D3D9_CloneExternal(d3d9_handle_t *hd3d, IDirect3D9 *dev)
{
hd3d->obj = dev;
IDirect3D9_AddRef( hd3d->obj );
- hd3d->hdll = NULL;
void *pv = NULL;
hd3d->use_ex = SUCCEEDED(IDirect3D9_QueryInterface(dev, &IID_IDirect3D9Ex, &pv));
=====================================
modules/video_chroma/d3d9_fmt.h
=====================================
@@ -47,7 +47,6 @@ struct d3d9_pic_context
typedef struct
{
- HINSTANCE hdll; /* handle of the opened d3d9 dll */
union {
IDirect3D9 *obj;
IDirect3D9Ex *objex;
=====================================
modules/video_chroma/meson.build
=====================================
@@ -134,6 +134,7 @@ if host_system == 'windows'
'dxgi_fmt.c',
),
include_directories: [vlc_include_dirs],
+ dependencies: [ cc.find_library('d3d9') ],
pic: true,
install: false,
)
=====================================
modules/video_output/Makefile.am
=====================================
@@ -195,13 +195,13 @@ libdirect3d9_plugin_la_SOURCES = video_output/win32/direct3d9.c \
video_output/win32/events.c video_output/win32/events.h \
video_output/win32/builtin_shaders.h \
video_output/win32/win32touch.c video_output/win32/win32touch.h
-libdirect3d9_plugin_la_LIBADD = libchroma_copy.la libd3d9_common.la -lgdi32 -luser32 $(LIBCOM) -luuid
+libdirect3d9_plugin_la_LIBADD = libchroma_copy.la libd3d9_common.la -ld3d9 -lgdi32 -luser32 $(LIBCOM) -luuid -ldxva2
libdirect3d9_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(voutdir)'
libglinterop_dxva2_plugin_la_SOURCES = video_output/opengl/interop_dxva2.c \
video_output/opengl/interop.h
libglinterop_dxva2_plugin_la_CFLAGS = $(AM_CFLAGS) $(GL_CFLAGS)
-libglinterop_dxva2_plugin_la_LIBADD = libd3d9_common.la -lopengl32
+libglinterop_dxva2_plugin_la_LIBADD = libd3d9_common.la -ld3d9 -lopengl32 -ldxva2
if HAVE_WIN32_DESKTOP
vout_LTLIBRARIES += $(LTLIBdirect3d9)
=====================================
modules/video_output/opengl/interop_dxva2.c
=====================================
@@ -75,7 +75,6 @@ struct glpriv
/* range converter */
struct {
- HMODULE dll;
IDXVAHD_VideoProcessor *proc;
} processor;
};
@@ -183,6 +182,7 @@ GLConvAllocateTextures(const struct vlc_gl_interop *interop, uint32_t textures[]
static void
GLConvDeallocateTextures(const struct vlc_gl_interop *interop, uint32_t textures[])
{
+ (void)textures;
struct glpriv *priv = interop->priv;
if (priv->gl_handle_d3d && priv->gl_render)
@@ -205,7 +205,6 @@ GLConvClose(struct vlc_gl_interop *interop)
if (priv->processor.proc)
{
IDXVAHD_VideoProcessor_Release(priv->processor.proc);
- FreeLibrary(priv->processor.dll);
}
if (priv->dx_render)
@@ -272,28 +271,10 @@ static int InitRangeProcessor(struct vlc_gl_interop *interop, IDirect3DDevice9Ex
HRESULT hr;
- sys->processor.dll = LoadLibrary(TEXT("DXVA2.DLL"));
- if (unlikely(!sys->processor.dll))
- {
- msg_Err(interop, "Failed to load DXVA2.DLL");
- return VLC_EGENERIC;
- }
-
D3DFORMAT *formatsList = NULL;
DXVAHD_VPCAPS *capsList = NULL;
IDXVAHD_Device *hd_device = NULL;
-#ifdef __MINGW64_VERSION_MAJOR
- typedef HRESULT (WINAPI* PDXVAHD_CreateDevice)(IDirect3DDevice9Ex *,const DXVAHD_CONTENT_DESC *,DXVAHD_DEVICE_USAGE,PDXVAHDSW_Plugin,IDXVAHD_Device **);
-#endif
- PDXVAHD_CreateDevice CreateDevice;
- CreateDevice = (PDXVAHD_CreateDevice)GetProcAddress(sys->processor.dll, "DXVAHD_CreateDevice");
- if (CreateDevice == NULL)
- {
- msg_Err(interop, "Can't create HD device (not Windows 7+)");
- goto error;
- }
-
DXVAHD_CONTENT_DESC desc;
desc.InputFrameFormat = DXVAHD_FRAME_FORMAT_PROGRESSIVE;
GetFrameRate( &desc.InputFrameRate, &interop->fmt_in );
@@ -303,7 +284,7 @@ static int InitRangeProcessor(struct vlc_gl_interop *interop, IDirect3DDevice9Ex
desc.OutputWidth = interop->fmt_in.i_visible_width;
desc.OutputHeight = interop->fmt_in.i_visible_height;
- hr = CreateDevice(devex, &desc, DXVAHD_DEVICE_USAGE_PLAYBACK_NORMAL, NULL, &hd_device);
+ hr = DXVAHD_CreateDevice(devex, &desc, DXVAHD_DEVICE_USAGE_PLAYBACK_NORMAL, NULL, &hd_device);
if (FAILED(hr))
{
msg_Dbg(interop, "Failed to create the device (error 0x%lX)", hr);
@@ -404,7 +385,6 @@ error:
free(formatsList);
if (hd_device)
IDXVAHD_Device_Release(hd_device);
- FreeLibrary(sys->processor.dll);
return VLC_EGENERIC;
}
=====================================
modules/video_output/opengl/meson.build
=====================================
@@ -77,7 +77,7 @@ if have_win_desktop
'name' : 'glinterop_dxva2',
'sources' : files('interop_dxva2.c'),
'c_args' : [ contrib_inc_args ],
- 'dependencies' : [ opengl32_lib ],
+ 'dependencies' : [ opengl32_lib, cc.find_library('dxva2') ],
'link_with' : [ d3d9_common_lib ]
}
endif
=====================================
modules/video_output/win32/direct3d9.c
=====================================
@@ -159,7 +159,6 @@ typedef struct vout_display_sys_t
/* range converter */
struct {
- HMODULE dll;
IDXVAHD_VideoProcessor *proc;
} processor;
} vout_display_sys_t;
@@ -1270,7 +1269,6 @@ static void Direct3D9Destroy(vout_display_sys_t *sys)
if (sys->processor.proc)
{
IDXVAHD_VideoProcessor_Release(sys->processor.proc);
- FreeLibrary(sys->processor.dll);
}
if (sys->dec_device)
vlc_decoder_device_Release(sys->dec_device);
@@ -1448,28 +1446,10 @@ static int InitRangeProcessor(vout_display_t *vd, const d3d9_format_t *d3dfmt,
HRESULT hr;
- sys->processor.dll = LoadLibrary(TEXT("DXVA2.DLL"));
- if (unlikely(!sys->processor.dll))
- {
- msg_Err(vd, "Failed to load DXVA2.DLL");
- return VLC_EGENERIC;
- }
-
D3DFORMAT *formatsList = NULL;
DXVAHD_VPCAPS *capsList = NULL;
IDXVAHD_Device *hd_device = NULL;
-#ifdef __MINGW64_VERSION_MAJOR
- typedef HRESULT (WINAPI* PDXVAHD_CreateDevice)(IDirect3DDevice9Ex *,const DXVAHD_CONTENT_DESC *,DXVAHD_DEVICE_USAGE,PDXVAHDSW_Plugin,IDXVAHD_Device **);
-#endif
- PDXVAHD_CreateDevice CreateDevice;
- CreateDevice = (PDXVAHD_CreateDevice)GetProcAddress(sys->processor.dll, "DXVAHD_CreateDevice");
- if (CreateDevice == NULL)
- {
- msg_Err(vd, "Can't create HD device (not Windows 7+)");
- goto error;
- }
-
DXVAHD_CONTENT_DESC desc;
desc.InputFrameFormat = DXVAHD_FRAME_FORMAT_PROGRESSIVE;
GetFrameRate( &desc.InputFrameRate, vd->source );
@@ -1479,7 +1459,7 @@ static int InitRangeProcessor(vout_display_t *vd, const d3d9_format_t *d3dfmt,
desc.OutputWidth = vd->source->i_visible_width;
desc.OutputHeight = vd->source->i_visible_height;
- hr = CreateDevice(sys->d3d9_device->d3ddev.devex, &desc, DXVAHD_DEVICE_USAGE_PLAYBACK_NORMAL, NULL, &hd_device);
+ hr = DXVAHD_CreateDevice(sys->d3d9_device->d3ddev.devex, &desc, DXVAHD_DEVICE_USAGE_PLAYBACK_NORMAL, NULL, &hd_device);
if (FAILED(hr))
{
msg_Dbg(vd, "Failed to create the device (error 0x%lX)", hr);
@@ -1580,7 +1560,6 @@ error:
free(formatsList);
if (hd_device)
IDXVAHD_Device_Release(hd_device);
- FreeLibrary(sys->processor.dll);
return VLC_EGENERIC;
}
=====================================
modules/video_output/win32/meson.build
=====================================
@@ -46,7 +46,8 @@ if have_win_desktop
'sources' : files('direct3d9.c', 'common.c', 'events.c', 'sensors.cpp', 'win32touch.c'),
'link_with' : [ d3d9_common_lib, chroma_copy_lib ],
'dependencies' : [
- cc.find_library('user32')
+ cc.find_library('user32'),
+ cc.find_library('dxva2'),
]
}
endif
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/a926c0558f84f11953dccc548a8146b4cf0a322a...24712de5d916c3563476d70c18fe5da7a590200f
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/a926c0558f84f11953dccc548a8146b4cf0a322a...24712de5d916c3563476d70c18fe5da7a590200f
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list