diff options
author | Janne Grunau <janne-libav@jannau.net> | 2012-12-12 16:36:20 +0100 |
---|---|---|
committer | Janne Grunau <janne-libav@jannau.net> | 2012-12-13 21:02:42 +0100 |
commit | bd255f9feb4deea4c990e582f0ba3b90d7b64b4c (patch) | |
tree | 7f37145ed6308e02cb5d5337993d13c8501b12a5 /libavcodec | |
parent | 072be3e8969f24113d599444be4d6a0ed04a6602 (diff) | |
download | ffmpeg-bd255f9feb4deea4c990e582f0ba3b90d7b64b4c.tar.gz |
lavc: set frame parameters after decoding only if necessary
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.
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/utils.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 1185a35e9d..b226ac0efe 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; |