Commit 47d63b2e authored by Steve Lhomme's avatar Steve Lhomme Committed by Jean-Baptiste Kempf

avcodec: favor D3D11VA over DXVA2

The order in which the vout are tried depends on which is the best for the
first video acceleration. Since we want D3D11 when possible we need to have
the matching VA by default too. On systems where D3D11VA doesn't work it will
fallback normally to DXVA2 and will use D3D9 with it.
Signed-off-by: Jean-Baptiste Kempf's avatarJean-Baptiste Kempf <jb@videolan.org>
parent 3d76af6d
......@@ -1472,12 +1472,13 @@ static enum PixelFormat ffmpeg_GetFormat( AVCodecContext *p_context,
decoder_t *p_dec = p_context->opaque;
decoder_sys_t *p_sys = p_dec->p_sys;
video_format_t fmt;
size_t i;
/* Enumerate available formats */
enum PixelFormat swfmt = avcodec_default_get_format(p_context, pi_fmt);
bool can_hwaccel = false;
for( size_t i = 0; pi_fmt[i] != AV_PIX_FMT_NONE; i++ )
for( i = 0; pi_fmt[i] != AV_PIX_FMT_NONE; i++ )
{
const AVPixFmtDescriptor *dsc = av_pix_fmt_desc_get(pi_fmt[i]);
if (dsc == NULL)
......@@ -1489,6 +1490,18 @@ static enum PixelFormat ffmpeg_GetFormat( AVCodecContext *p_context,
if (hwaccel)
can_hwaccel = true;
}
#if defined(_WIN32) && LIBAVUTIL_VERSION_CHECK(54, 13, 1, 24, 100)
enum PixelFormat p_fmts[i+1];
if (i > 1 && pi_fmt[0] == AV_PIX_FMT_DXVA2_VLD && pi_fmt[1] == AV_PIX_FMT_D3D11VA_VLD)
{
/* favor D3D11VA over DXVA2 as the order will decide which vout will be
* used */
memcpy(p_fmts, pi_fmt, sizeof(p_fmts));
p_fmts[0] = AV_PIX_FMT_D3D11VA_VLD;
p_fmts[1] = AV_PIX_FMT_DXVA2_VLD;
pi_fmt = p_fmts;
}
#endif
/* If the format did not actually change (e.g. seeking), try to reuse the
* existing output format, and if present, hardware acceleration back-end.
......
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