<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta http-equiv="Content-Style-Type" content="text/css" />
  <meta name="generator" content="pandoc" />
  <title></title>
  <style type="text/css">
      code{white-space: pre-wrap;}
      span.smallcaps{font-variant: small-caps;}
      span.underline{text-decoration: underline;}
      div.column{display: inline-block; vertical-align: top; width: 50%;}
  </style>
</head>
<body>
<p>Hi Zhao,</p>
<p>On 2018-07-17 17:27, Zhao Zhili wrote:</p>
<blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;color:#500050">
<pre><code> On 2018年07月13日 21:32, Zhao Zhili wrote:</code></pre>
<blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;color:#500050">
<pre><code> Due to d3c6ad0b, pictures may have different chroma. All frames are
 dropped.
 ---
   modules/codec/avcodec/video.c | 22 +++++++++++++++++++++-
   1 file changed, 21 insertions(+), 1 deletion(-)

 diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
 index 375b9d1..425f267 100644
 --- a/modules/codec/avcodec/video.c
 +++ b/modules/codec/avcodec/video.c
 @@ -369,6 +369,26 @@ static int lavc_UpdateVideoFormat(decoder_t *dec, AVCodecContext *ctx,
       return decoder_UpdateVideoFormat(dec);
   }
 +static bool chroma_compatible(vlc_fourcc_t a, vlc_fourcc_t b)
 +{
 +    static vlc_fourcc_t compat_lists[][2] = {
 +        {VLC_CODEC_J420, VLC_CODEC_I420},
 +        {VLC_CODEC_J422, VLC_CODEC_I422},
 +        {VLC_CODEC_J440, VLC_CODEC_I440},
 +        {VLC_CODEC_J444, VLC_CODEC_I444},
 +    };</code></pre>
</blockquote>
</blockquote>
<p><code>compat_list</code> in the above should be <code>const</code>.</p>
<blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;color:#500050">
<blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;color:#500050">
<pre><code> +
 +    if (a == b)
 +        return true;
 +
 +    for (size_t i = 0; i < ARRAY_SIZE(compat_lists); i++) {
 +        if ((a == compat_lists[i][0] || a == compat_lists[i][1]) &&
 +            (b == compat_lists[i][0] || b == compat_lists[i][1]))
 +            return true;
 +    }
 +    return false;
 +}
 +
   /**
    * Copies a picture from the libavcodec-allocate buffer to a picture_t.
    * This is used when not in direct rendering mode.
 @@ -385,7 +405,7 @@ static int lavc_CopyPicture(decoder_t *dec, picture_t *pic, AVFrame *frame)
           msg_Err(dec, "Unsupported decoded output format %d (%s)",
                   sys->p_context->pix_fmt, (name != NULL) ? name : "unknown");
           return VLC_EGENERIC;
 -    } else if (fourcc != pic->format.i_chroma
 +    } else if (!chroma_compatible(fourcc, pic->format.i_chroma)
        || frame->width > (int) pic->format.i_width
        || frame->height > (int) pic->format.i_height)
       {</code></pre>
</blockquote>
</blockquote>
</body>
</html>