[vlc-commits] avcodec: va: let the VA module set the output i_chroma
Steve Lhomme
git at videolan.org
Wed Jan 8 08:28:18 CET 2020
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Wed Dec 18 13:39:27 2019 +0100| [11a20146e12ead48db7cf4da9c6f46088e0a8d26] | committer: Steve Lhomme
avcodec: va: let the VA module set the output i_chroma
lavc_UpdateVideoFormat() is only called for the VA module just before the VA
opened, in which case the VA sets it's actual i_chroma. No need to set it
afterwards.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=11a20146e12ead48db7cf4da9c6f46088e0a8d26
---
modules/codec/avcodec/video.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
index 3714f1eb9b..8e35104e8b 100644
--- a/modules/codec/avcodec/video.c
+++ b/modules/codec/avcodec/video.c
@@ -364,7 +364,7 @@ static int lavc_UpdateVideoFormat(decoder_t *dec, AVCodecContext *ctx,
if (fmt == swfmt)
i_chroma = fmt_out.i_chroma;
else
- i_chroma = vlc_va_GetChroma(fmt, swfmt);
+ i_chroma = 0;
es_format_Change(&dec->fmt_out, VIDEO_ES, i_chroma);
dec->fmt_out.video = fmt_out;
dec->fmt_out.video.i_chroma = i_chroma;
@@ -1748,7 +1748,6 @@ no_reuse:
if (!vlc_va_MightDecode(hwfmt, swfmt))
continue; /* Unknown brand of hardware acceleration */
- p_dec->fmt_out.video.i_chroma = vlc_va_GetChroma(hwfmt, swfmt);
if (p_context->width == 0 || p_context->height == 0)
{ /* should never happen */
msg_Err(p_dec, "unspecified video dimensions");
@@ -1762,6 +1761,7 @@ no_reuse:
continue; /* Unsupported brand of hardware acceleration */
vlc_mutex_unlock(&p_sys->lock);
+ p_dec->fmt_out.video.i_chroma = 0; // make sure the va sets its output chroma
vlc_video_context *vctx_out;
vlc_va_t *va = vlc_va_New(VLC_OBJECT(p_dec), p_context, hwfmt, src_desc,
&p_dec->fmt_in, init_device,
@@ -1771,7 +1771,9 @@ no_reuse:
vlc_mutex_lock(&p_sys->lock);
if (va == NULL)
continue; /* Unsupported codec profile or such */
+ assert(p_dec->fmt_out.video.i_chroma != 0);
assert(vctx_out != NULL);
+ p_dec->fmt_out.i_codec = p_dec->fmt_out.video.i_chroma;
if (decoder_UpdateVideoOutput(p_dec, vctx_out))
{
More information about the vlc-commits
mailing list