Commit a37d8716 authored by Steve Lhomme's avatar Steve Lhomme

dxva: store the decoder GUID in each decoder

parent 5eabbd75
......@@ -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;
......
......@@ -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;
}
......
......@@ -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);
......
......@@ -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,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment