[vlc-commits] dxva: store the decoder GUID in each decoder
Steve Lhomme
git at videolan.org
Mon Sep 2 15:43:16 CEST 2019
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Mon Sep 2 09:41:28 2019 +0200| [a37d87162379f228c83cba071432934f9d17e9ca] | committer: Steve Lhomme
dxva: store the decoder GUID in each decoder
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a37d87162379f228c83cba071432934f9d17e9ca
---
modules/codec/avcodec/d3d11va.c | 11 ++++++-----
modules/codec/avcodec/directx_va.c | 11 ++++++-----
modules/codec/avcodec/directx_va.h | 5 +----
modules/codec/avcodec/dxva2.c | 9 +++++----
4 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/modules/codec/avcodec/d3d11va.c b/modules/codec/avcodec/d3d11va.c
index f204226c29..8ffbbd8f51 100644
--- a/modules/codec/avcodec/d3d11va.c
+++ b/modules/codec/avcodec/d3d11va.c
@@ -114,6 +114,7 @@ struct vlc_va_sys_t
/* Video decoder */
D3D11_VIDEO_DECODER_CONFIG cfg;
+ GUID decoder_guid;
ID3D11VideoDevice *d3ddec;
ID3D11VideoDecoder *dxdecoder;
@@ -148,7 +149,7 @@ static void SetupAVCodecContext(vlc_va_sys_t *sys)
sys->hw.surface = sys->hw_surface;
sys->hw.context_mutex = sys->d3d_dev.context_mutex;
- if (IsEqualGUID(&dx_sys->input, &DXVA_Intel_H264_NoFGT_ClearVideo))
+ if (IsEqualGUID(&sys->decoder_guid, &DXVA_Intel_H264_NoFGT_ClearVideo))
sys->hw.workaround |= FF_DXVA2_WORKAROUND_INTEL_CLEARVIDEO;
}
@@ -259,7 +260,7 @@ static int Get(vlc_va_t *va, picture_t *pic, uint8_t **data)
HRESULT hr;
D3D11_VIDEO_DECODER_OUTPUT_VIEW_DESC viewDesc;
ZeroMemory(&viewDesc, sizeof(viewDesc));
- viewDesc.DecodeProfile = sys->dx_sys.input;
+ viewDesc.DecodeProfile = sys->decoder_guid;
viewDesc.ViewDimension = D3D11_VDOV_DIMENSION_TEXTURE2D;
viewDesc.Texture2D.ArraySlice = p_sys->slice_index;
@@ -391,7 +392,7 @@ static int Open(vlc_va_t *va, AVCodecContext *ctx, enum PixelFormat pix_fmt,
if (err!=VLC_SUCCESS)
goto error;
- err = directx_va_Setup(va, &sys->dx_sys, ctx, fmt, isXboxHardware(sys->d3d_dev.d3ddevice));
+ err = directx_va_Setup(va, &sys->dx_sys, ctx, fmt, isXboxHardware(sys->d3d_dev.d3ddevice), &sys->decoder_guid);
if (err != VLC_SUCCESS)
goto error;
@@ -708,7 +709,7 @@ static int DxCreateDecoderSurfaces(vlc_va_t *va, int codec_id,
D3D11_VIDEO_DECODER_OUTPUT_VIEW_DESC viewDesc;
ZeroMemory(&viewDesc, sizeof(viewDesc));
- viewDesc.DecodeProfile = dx_sys->input;
+ viewDesc.DecodeProfile = sys->decoder_guid;
viewDesc.ViewDimension = D3D11_VDOV_DIMENSION_TEXTURE2D;
const d3d_format_t *textureFmt = NULL;
@@ -851,7 +852,7 @@ static int DxCreateDecoderSurfaces(vlc_va_t *va, int codec_id,
D3D11_VIDEO_DECODER_DESC decoderDesc;
ZeroMemory(&decoderDesc, sizeof(decoderDesc));
- decoderDesc.Guid = dx_sys->input;
+ decoderDesc.Guid = sys->decoder_guid;
decoderDesc.SampleWidth = fmt->i_width;
decoderDesc.SampleHeight = fmt->i_height;
decoderDesc.OutputFormat = sys->render;
diff --git a/modules/codec/avcodec/directx_va.c b/modules/codec/avcodec/directx_va.c
index 49a4d2f513..768b048953 100644
--- a/modules/codec/avcodec/directx_va.c
+++ b/modules/codec/avcodec/directx_va.c
@@ -263,7 +263,7 @@ static const directx_va_mode_t DXVA_MODES[] = {
{ NULL, NULL, 0, NULL }
};
-static int FindVideoServiceConversion(vlc_va_t *, directx_sys_t *, const es_format_t *, const AVCodecContext *);
+static int FindVideoServiceConversion(vlc_va_t *, directx_sys_t *, const es_format_t *, const AVCodecContext *, GUID *found_guid);
char *directx_va_GetDecoderName(const GUID *guid)
{
@@ -280,10 +280,10 @@ char *directx_va_GetDecoderName(const GUID *guid)
/* */
int directx_va_Setup(vlc_va_t *va, directx_sys_t *dx_sys, const AVCodecContext *avctx,
- const es_format_t *fmt, int flag_xbox)
+ const es_format_t *fmt, int flag_xbox, GUID *found_guid)
{
/* */
- if (FindVideoServiceConversion(va, dx_sys, fmt, avctx)) {
+ if (FindVideoServiceConversion(va, dx_sys, fmt, avctx, found_guid)) {
msg_Err(va, "FindVideoServiceConversion failed");
return VLC_EGENERIC;
}
@@ -379,7 +379,8 @@ static bool profile_supported(const directx_va_mode_t *mode, const es_format_t *
* Find the best suited decoder mode GUID and render format.
*/
static int FindVideoServiceConversion(vlc_va_t *va, directx_sys_t *dx_sys,
- const es_format_t *fmt, const AVCodecContext *avctx)
+ const es_format_t *fmt, const AVCodecContext *avctx,
+ GUID *found_guid)
{
input_list_t p_list = { 0 };
int err = dx_sys->pf_get_input_list(va, &p_list);
@@ -428,7 +429,7 @@ static int FindVideoServiceConversion(vlc_va_t *va, directx_sys_t *dx_sys,
msg_Dbg(va, "Trying to use '%s' as input", mode->name);
if (dx_sys->pf_setup_output(va, mode->guid, &fmt->video)==VLC_SUCCESS)
{
- dx_sys->input = *mode->guid;
+ *found_guid = *mode->guid;
err = VLC_SUCCESS;
break;
}
diff --git a/modules/codec/avcodec/directx_va.h b/modules/codec/avcodec/directx_va.h
index 3e8e957d6c..000ea907a4 100644
--- a/modules/codec/avcodec/directx_va.h
+++ b/modules/codec/avcodec/directx_va.h
@@ -55,9 +55,6 @@ typedef struct
va_pool_t va_pool;
bool can_extern_pool;
- /* Video service */
- GUID input;
-
/**
* Read the list of possible input GUIDs
*/
@@ -72,7 +69,7 @@ typedef struct
int directx_va_Open(vlc_va_t *, const struct va_pool_cfg *, 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 *, int flag_xbox);
+int directx_va_Setup(vlc_va_t *, directx_sys_t *, const AVCodecContext *avctx, const es_format_t *, int flag_xbox, GUID *found_guid);
char *directx_va_GetDecoderName(const GUID *guid);
bool directx_va_canUseDecoder(vlc_va_t *, UINT VendorId, UINT DeviceId, const GUID *pCodec, UINT driverBuild);
diff --git a/modules/codec/avcodec/dxva2.c b/modules/codec/avcodec/dxva2.c
index b353066699..ef88bee6f6 100644
--- a/modules/codec/avcodec/dxva2.c
+++ b/modules/codec/avcodec/dxva2.c
@@ -124,6 +124,7 @@ struct vlc_va_sys_t
/* Video decoder */
DXVA2_ConfigPictureDecode cfg;
+ GUID decoder_guid;
IDirectXVideoDecoderService *d3ddec;
IDirectXVideoDecoder *dxdecoder;
@@ -155,7 +156,7 @@ static void SetupAVCodecContext(vlc_va_sys_t *sys)
sys->hw.surface_count = dx_sys->va_pool.surface_count;
sys->hw.surface = sys->hw_surface;
- if (IsEqualGUID(&dx_sys->input, &DXVA_Intel_H264_NoFGT_ClearVideo))
+ if (IsEqualGUID(&sys->decoder_guid, &DXVA_Intel_H264_NoFGT_ClearVideo))
sys->hw.workaround |= FF_DXVA2_WORKAROUND_INTEL_CLEARVIDEO;
}
@@ -318,7 +319,7 @@ static int Open(vlc_va_t *va, AVCodecContext *ctx, enum PixelFormat pix_fmt,
if (err!=VLC_SUCCESS)
goto error;
- err = directx_va_Setup(va, &sys->dx_sys, ctx, fmt, 0);
+ err = directx_va_Setup(va, &sys->dx_sys, ctx, fmt, 0, &sys->decoder_guid);
if (err != VLC_SUCCESS)
goto error;
@@ -592,7 +593,7 @@ static int DxCreateVideoDecoder(vlc_va_t *va, int codec_id,
UINT cfg_count = 0;
DXVA2_ConfigPictureDecode *cfg_list = NULL;
hr = IDirectXVideoDecoderService_GetDecoderConfigurations(p_sys->d3ddec,
- &sys->input,
+ &p_sys->decoder_guid,
&dsc,
NULL,
&cfg_count,
@@ -637,7 +638,7 @@ static int DxCreateVideoDecoder(vlc_va_t *va, int codec_id,
/* Create the decoder */
/* adds a reference on each decoder surface */
if (FAILED(IDirectXVideoDecoderService_CreateVideoDecoder(p_sys->d3ddec,
- &sys->input,
+ &p_sys->decoder_guid,
&dsc,
&p_sys->cfg,
p_sys->hw_surface,
More information about the vlc-commits
mailing list