Wait for the first decoded frame to be returned by mmal before setting
pix_fmt. This is important for avformat probing to work properly as it is one
of the criterions to decide whether to decode a frame or not for probing.

Signed-off-by: Julian Scheel <[email protected]>
---
 libavcodec/mmaldec.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/libavcodec/mmaldec.c b/libavcodec/mmaldec.c
index 7db90d2..429990a 100644
--- a/libavcodec/mmaldec.c
+++ b/libavcodec/mmaldec.c
@@ -338,11 +338,6 @@ static av_cold int ffmmal_init_decoder(AVCodecContext 
*avctx)
         return AVERROR(ENOSYS);
     }
 
-    if ((ret = ff_get_format(avctx, avctx->codec->pix_fmts)) < 0)
-        return ret;
-
-    avctx->pix_fmt = ret;
-
     if ((status = mmal_component_create(MMAL_COMPONENT_DEFAULT_VIDEO_DECODER, 
&ctx->decoder)))
         goto fail;
 
@@ -678,6 +673,11 @@ static int ffmmal_read_frame(AVCodecContext *avctx, 
AVFrame *frame, int *got_fra
 
             av_log(avctx, AV_LOG_INFO, "Changing output format.\n");
 
+            if ((ret = ff_get_format(avctx, avctx->codec->pix_fmts)) < 0)
+                return ret;
+
+            avctx->pix_fmt = ret;
+
             if ((status = mmal_port_disable(decoder->output[0])))
                 goto done;
 
-- 
2.6.0


_______________________________________________
ffmpeg-devel mailing list
[email protected]
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to