On Thu, 13 Dec 2012 12:30:21 +0100, Janne Grunau <[email protected]> wrote:
> Direct rendering capable decoders call get_buffer() which will set the
> frame parameters.
> 
> Prevents frames with wrong parameters when a decoder outputs delayed
> frames after a resolution or pixel format change.
> ---
> Using CODEC_CAP_DR1 instead of CODEC_CAP_DELAY. get_buffer() sets the
> frame parameters already
> 
>  libavcodec/utils.c | 13 ++++++++-----
>  1 file changed, 8 insertions(+), 5 deletions(-)
> 
> diff --git a/libavcodec/utils.c b/libavcodec/utils.c
> index 1185a35..b226ac0 100644
> --- a/libavcodec/utils.c
> +++ b/libavcodec/utils.c
> @@ -1282,11 +1282,14 @@ 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;
> +            /* get_buffer is supposed to set frame parameters */
> +            if (!(avctx->codec->capabilities & CODEC_CAP_DR1)) {
> +                picture->sample_aspect_ratio = avctx->sample_aspect_ratio;
> +                picture->width               = avctx->width;
> +                picture->height              = avctx->height;
> +                picture->format              = avctx->pix_fmt;
> +            }
>          }
>  
>          emms_c(); //needed to avoid an emms_c() call before every return;
> -- 
> 1.7.12.4
> 

LGTM

-- 
Anton Khirnov
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to