[FFmpeg-cvslog] h264: ensure that get_format() is called when changing format but not otherwise.

Michael Niedermayer git at videolan.org
Fri Feb 22 23:21:38 CET 2013


ffmpeg | branch: release/1.1 | Michael Niedermayer <michaelni at gmx.at> | Thu Feb 21 02:46:02 2013 +0100| [a642be972d4861159f8bf4ef47afcc8f60a2f02b] | committer: Michael Niedermayer

h264: ensure that get_format() is called when changing format but not otherwise.

Fixes Ticket2288

Tested-by: Stefano Pigozzi <stefano.pigozzi at gmail.com>
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
(cherry picked from commit 04220b473e9d7b22d737405348f9904f22bcfb96)

Conflicts:

	libavcodec/h264.c

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

 libavcodec/h264.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index da749a2..f5d4f1b 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -2475,7 +2475,7 @@ static int h264_set_parameter_from_sps(H264Context *h)
     return 0;
 }
 
-static enum PixelFormat get_pixel_format(H264Context *h)
+static enum PixelFormat get_pixel_format(H264Context *h, int force_callback)
 {
     MpegEncContext *const s  = &h->s;
     switch (h->sps.bit_depth_luma) {
@@ -2545,7 +2545,7 @@ static enum PixelFormat get_pixel_format(H264Context *h)
                                         ff_hwaccel_pixfmt_list_420;
 
             for (i=0; fmt[i] != AV_PIX_FMT_NONE; i++)
-                if (fmt[i] == s->avctx->pix_fmt)
+                if (fmt[i] == s->avctx->pix_fmt && !force_callback)
                     return fmt[i];
             return s->avctx->get_format(s->avctx, fmt);
         }
@@ -2771,7 +2771,7 @@ static int decode_slice_header(H264Context *h, H264Context *h0)
                      || s->avctx->bits_per_raw_sample != h->sps.bit_depth_luma
                      || h->cur_chroma_format_idc != h->sps.chroma_format_idc
                      || av_cmp_q(h->sps.sar, s->avctx->sample_aspect_ratio)));
-    if (h0->s.avctx->pix_fmt != get_pixel_format(h0))
+    if (h0->s.avctx->pix_fmt != get_pixel_format(h0, 0))
         must_reinit = 1;
 
     s->mb_width  = h->sps.mb_width;
@@ -2809,7 +2809,7 @@ static int decode_slice_header(H264Context *h, H264Context *h0)
 
         flush_change(h);
 
-        if ((ret = get_pixel_format(h)) < 0)
+        if ((ret = get_pixel_format(h, 1)) < 0)
             return ret;
         s->avctx->pix_fmt = ret;
 
@@ -2830,7 +2830,7 @@ static int decode_slice_header(H264Context *h, H264Context *h0)
             return -1;
         }
 
-        if ((ret = get_pixel_format(h)) < 0)
+        if ((ret = get_pixel_format(h, 1)) < 0)
             return ret;
         s->avctx->pix_fmt = ret;
 



More information about the ffmpeg-cvslog mailing list