From 016eab220971ecd3d4509bb4936cb579e9b4a7c3 Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 29 Apr 2016 23:13:24 +0200 Subject: d3d11va, dxva2: simplify decoder selection In particular, this moves the depth test to common code. Should be functionally equivalent, except that for DXVA2, the IDirectXVideoDecoderService_GetDecoderRenderTargets API is called more often potentially. --- video/decode/d3d.h | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'video/decode/d3d.h') diff --git a/video/decode/d3d.h b/video/decode/d3d.h index bbd6bdfd2a..21b930528a 100644 --- a/video/decode/d3d.h +++ b/video/decode/d3d.h @@ -24,6 +24,13 @@ struct mp_image; struct lavc_ctx; +struct d3d_decoded_format { + DWORD dxfmt; // D3DFORMAT or DXGI_FORMAT + const char *name; // informational string repr. of dxfmt_decoded + int depth; // significant bits (not full size) + int mpfmt; // IMGFMT_ with compatible memory layout and semantics +}; + struct d3d_decoder_fmt { const GUID *guid; int mpfmt_decoded; @@ -31,9 +38,12 @@ struct d3d_decoder_fmt { }; int d3d_probe_codec(const char *codec); + struct d3d_decoder_fmt d3d_select_decoder_mode( struct lavc_ctx *s, const GUID *device_guids, UINT n_guids, - DWORD (*get_dxfmt_cb)(struct lavc_ctx *s, const GUID *guid, int depth)); + const struct d3d_decoded_format *formats, int n_formats, + bool (*test_fmt_cb)(struct lavc_ctx *s, const GUID *guid, + const struct d3d_decoded_format *fmt)); char *d3d_decoder_guid_to_desc_buf(char *buf, size_t buf_size, const GUID *mode_guid); -- cgit v1.2.3 From 64f9e48bf1d67ed22f2488f7135a082a8ffbe716 Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 29 Apr 2016 23:28:15 +0200 Subject: d3d11va, dxva2: return the format struct directly Slight simplification, IMHO. --- video/decode/d3d.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'video/decode/d3d.h') diff --git a/video/decode/d3d.h b/video/decode/d3d.h index 21b930528a..3f5b8aebe7 100644 --- a/video/decode/d3d.h +++ b/video/decode/d3d.h @@ -33,8 +33,7 @@ struct d3d_decoded_format { struct d3d_decoder_fmt { const GUID *guid; - int mpfmt_decoded; - DWORD dxfmt_decoded; // D3DFORMAT or DXGI_FORMAT + const struct d3d_decoded_format *format; }; int d3d_probe_codec(const char *codec); -- cgit v1.2.3 From a02d77ba0df747b60ffad7d2a5eacfc6528aabef Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 17 May 2016 11:57:28 +0200 Subject: d3d: simplify DLL loading For some reason, the d3d9/dxva2/d3d11 DLLs are still optional. But we don't need to try so hard to keep exact references. In fact, there's no reason to unload them at all. So load them once in a central place. For simplicity, the d3d9/d3d11 backends both load all DLLs. (They will error out only if the required DLLs could not be loaded.) In theory, we could just call LoadLibrary multiple times (without calling FreeLibrary), but I'm slightly worried that this could be detected as a "bug", or that the reference count could even have a low static limit that could be hit soon. --- video/decode/d3d.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'video/decode/d3d.h') diff --git a/video/decode/d3d.h b/video/decode/d3d.h index 3f5b8aebe7..15c423ab8c 100644 --- a/video/decode/d3d.h +++ b/video/decode/d3d.h @@ -36,6 +36,12 @@ struct d3d_decoder_fmt { const struct d3d_decoded_format *format; }; +// Must call d3d_load_dlls() before accessing. Once this is done, the DLLs +// remain loaded forever. +extern HMODULE d3d11_dll, d3d9_dll, dxva2_dll; + +void d3d_load_dlls(void); + int d3d_probe_codec(const char *codec); struct d3d_decoder_fmt d3d_select_decoder_mode( -- cgit v1.2.3