On Wed, 12 Dec 2012 21:30:03 +0100, Janne Grunau <[email protected]> wrote: > Decoders supporting frame parameter changes can return delayed frames > with the old parameters. > --- > libavcodec/utils.c | 15 ++++++++++----- > 1 file changed, 10 insertions(+), 5 deletions(-) > > diff --git a/libavcodec/utils.c b/libavcodec/utils.c > index 1185a35..97fa570 100644 > --- a/libavcodec/utils.c > +++ b/libavcodec/utils.c > @@ -1282,11 +1282,16 @@ int attribute_align_arg > avcodec_decode_video2(AVCodecContext *avctx, AVFrame *pi > else { > ret = avctx->codec->decode(avctx, picture, got_picture_ptr, > avpkt); > - picture->pkt_dts = avpkt->dts; > - picture->sample_aspect_ratio = avctx->sample_aspect_ratio; > - picture->width = avctx->width; > - picture->height = avctx->height; > - picture->format = avctx->pix_fmt; > + picture->pkt_dts = avpkt->dts; > + > + /* delayed pictures might have different parameters than > + * the context returning them */ > + if (!(avctx->codec->capabilities & CODEC_CAP_DELAY)) { > + picture->sample_aspect_ratio = avctx->sample_aspect_ratio; > + picture->width = avctx->width; > + picture->height = avctx->height; > + picture->format = avctx->pix_fmt; > + } > } >
Frame properties are also set in ff_get_buffer(), so this block does not need to be there at all for decoders using it. Which IIRC is everything except rawdec, so we could just move this to rawdec. -- Anton Khirnov _______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
