mpegvideo: Initialize chroma_*_shift and codec_tag even if the size is 0
authorMartin Storsjö <martin@martin.st>
Tue, 24 Sep 2013 09:02:39 +0000 (12:02 +0300)
committerMartin Storsjö <martin@martin.st>
Tue, 24 Sep 2013 11:02:23 +0000 (14:02 +0300)
This fixes breakage in a few fate tests on certain setups
(that for some reason didn't break on OS X) after the previous
commit (8812a8057). Currently, some video streams are initialized
in ff_MPV_common_init with width/height set at 0 and only changed
to a proper video size with ff_MPV_common_frame_size_change later.

The breakage was diagnosed by Anton Khirnov.

Signed-off-by: Martin Storsjö <martin@martin.st>
libavcodec/mpegvideo.c

index 5b71d1b..192e27f 100644 (file)
@@ -1019,17 +1019,17 @@ av_cold int ff_MPV_common_init(MpegEncContext *s)
     s->flags  = s->avctx->flags;
     s->flags2 = s->avctx->flags2;
 
-    if (s->width && s->height) {
-        /* set chroma shifts */
-        av_pix_fmt_get_chroma_sub_sample(s->avctx->pix_fmt,
-                                         &s->chroma_x_shift,
-                                         &s->chroma_y_shift);
+    /* set chroma shifts */
+    av_pix_fmt_get_chroma_sub_sample(s->avctx->pix_fmt,
+                                     &s->chroma_x_shift,
+                                     &s->chroma_y_shift);
 
-        /* convert fourcc to upper case */
-        s->codec_tag          = avpriv_toupper4(s->avctx->codec_tag);
+    /* convert fourcc to upper case */
+    s->codec_tag          = avpriv_toupper4(s->avctx->codec_tag);
 
-        s->stream_codec_tag   = avpriv_toupper4(s->avctx->stream_codec_tag);
+    s->stream_codec_tag   = avpriv_toupper4(s->avctx->stream_codec_tag);
 
+    if (s->width && s->height) {
         s->avctx->coded_frame = &s->current_picture.f;
 
         if (s->encoding) {