[FFmpeg-cvslog] h263dec: call get_format after setting resolution and profile

Rémi Denis-Courmont git at videolan.org
Tue Oct 14 00:03:19 CEST 2014


ffmpeg | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Oct  8 20:37:00 2014 +0300| [1f29e5d7a2b0950f3b6820896e97e2c02e6a10a9] | committer: Janne Grunau

h263dec: call get_format after setting resolution and profile

Bug-Id: 541

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1f29e5d7a2b0950f3b6820896e97e2c02e6a10a9
---

 libavcodec/h263dec.c |   17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
index a6252f2..29634b0 100644
--- a/libavcodec/h263dec.c
+++ b/libavcodec/h263dec.c
@@ -40,6 +40,14 @@
 #include "qpeldsp.h"
 #include "thread.h"
 
+static enum AVPixelFormat h263_get_format(AVCodecContext *avctx)
+{
+    if (avctx->codec->id == AV_CODEC_ID_MSS2)
+        return AV_PIX_FMT_YUV420P;
+
+    return avctx->pix_fmt = ff_get_format(avctx, avctx->codec->pix_fmts);
+}
+
 av_cold int ff_h263_decode_init(AVCodecContext *avctx)
 {
     MpegEncContext *s = avctx->priv_data;
@@ -56,10 +64,6 @@ av_cold int ff_h263_decode_init(AVCodecContext *avctx)
     s->quant_precision = 5;
     s->decode_mb       = ff_h263_decode_mb;
     s->low_delay       = 1;
-    if (avctx->codec->id == AV_CODEC_ID_MSS2)
-        avctx->pix_fmt = AV_PIX_FMT_YUV420P;
-    else
-        avctx->pix_fmt = ff_get_format(avctx, avctx->codec->pix_fmts);
     s->unrestricted_mv = 1;
 
     /* select sub codec */
@@ -114,6 +118,7 @@ av_cold int ff_h263_decode_init(AVCodecContext *avctx)
     /* for h263, we allocate the images after having read the header */
     if (avctx->codec->id != AV_CODEC_ID_H263 &&
         avctx->codec->id != AV_CODEC_ID_MPEG4) {
+        avctx->pix_fmt = h263_get_format(avctx);
         ff_mpv_idct_init(s);
         if ((ret = ff_mpv_common_init(s)) < 0)
             return ret;
@@ -454,9 +459,11 @@ int ff_h263_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
         return ret;
     }
 
-    if (!s->context_initialized)
+    if (!s->context_initialized) {
+        avctx->pix_fmt = h263_get_format(avctx);
         if ((ret = ff_mpv_common_init(s)) < 0)
             return ret;
+    }
 
     if (!s->current_picture_ptr || s->current_picture_ptr->f->data[0]) {
         int i = ff_find_unused_picture(s, 0);



More information about the ffmpeg-cvslog mailing list