Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2013-02-11 11:09:02 +0400
committerAnton Khirnov <anton@khirnov.net>2013-03-08 10:39:44 +0400
commit15ec0450b4ae891f3e6ababa03c777a4443b94ca (patch)
treeea3fce9ca16792ee79824358a57d314311c8acc0 /libavcodec/utils.c
parent3b199d29cd597a3518136d78860e172060b9e83d (diff)
lavc: allow decoders to override frame parameters.
Diffstat (limited to 'libavcodec/utils.c')
-rw-r--r--libavcodec/utils.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 7e451bfa0b..90f25377f6 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -552,18 +552,25 @@ int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
switch (avctx->codec_type) {
case AVMEDIA_TYPE_VIDEO:
- frame->width = avctx->width;
- frame->height = avctx->height;
- frame->format = avctx->pix_fmt;
- frame->sample_aspect_ratio = avctx->sample_aspect_ratio;
+ if (!frame->width)
+ frame->width = avctx->width;
+ if (!frame->height)
+ frame->height = avctx->height;
+ if (frame->format < 0)
+ frame->format = avctx->pix_fmt;
+ if (!frame->sample_aspect_ratio.num)
+ frame->sample_aspect_ratio = avctx->sample_aspect_ratio;
if ((ret = av_image_check_size(avctx->width, avctx->height, 0, avctx)) < 0)
return ret;
break;
case AVMEDIA_TYPE_AUDIO:
- frame->sample_rate = avctx->sample_rate;
- frame->format = avctx->sample_fmt;
- frame->channel_layout = avctx->channel_layout;
+ if (!frame->sample_rate)
+ frame->sample_rate = avctx->sample_rate;
+ if (frame->format < 0)
+ frame->format = avctx->sample_fmt;
+ if (!frame->channel_layout)
+ frame->channel_layout = avctx->channel_layout;
break;
default: return AVERROR(EINVAL);
}