On Wed, 21 Oct 2015 15:55:09 +0200 Julian Scheel <jul...@jusst.de> wrote:
> 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 <jul...@jusst.de> > --- > 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; > MMAL_EVENT_FORMAT_CHANGED does not always happen. Some streams start decoding without it. So you'd need to delay this somehow. Maybe when the first decode call is done? (Other places also would work, but to make fallback from hw decoding work well, it should happen when the first packet is being consumed.) I'd also like to test this with opaque formats first. _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel