diff options
author | Stefano Sabatini <stefasab@gmail.com> | 2012-07-30 15:24:30 +0200 |
---|---|---|
committer | Stefano Sabatini <stefasab@gmail.com> | 2012-07-31 13:21:10 +0200 |
commit | 23fc4dd6e7e150ea163a867dfaee2062ade90b74 (patch) | |
tree | c7dde701e6c36d2f22454d69e2756ce35acccf12 /libavcodec/utils.c | |
parent | b4c3359828d232d8e81c1bff2dcbbca773dee2d7 (diff) | |
download | ffmpeg-23fc4dd6e7e150ea163a867dfaee2062ade90b74.tar.gz |
lavc: add channels field to AVFrame
This is required otherwise it is not always possible to guess the number
of channels from the layout, for example if the channel layout is
unknown.
Diffstat (limited to 'libavcodec/utils.c')
-rw-r--r-- | libavcodec/utils.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 53fda1f9b0..2f4cb5dbc8 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -427,6 +427,7 @@ static int audio_get_buffer(AVCodecContext *avctx, AVFrame *frame) frame->sample_rate = avctx->sample_rate; frame->format = avctx->sample_fmt; frame->channel_layout = avctx->channel_layout; + frame->channels = avctx->channels; if (avctx->debug & FF_DEBUG_BUFFERS) av_log(avctx, AV_LOG_DEBUG, "default_get_buffer called on frame %p, " @@ -724,6 +725,7 @@ MAKE_ACCESSORS(AVFrame, frame, int64_t, best_effort_timestamp) MAKE_ACCESSORS(AVFrame, frame, int64_t, pkt_duration) MAKE_ACCESSORS(AVFrame, frame, int64_t, pkt_pos) MAKE_ACCESSORS(AVFrame, frame, int64_t, channel_layout) +MAKE_ACCESSORS(AVFrame, frame, int, channels) MAKE_ACCESSORS(AVFrame, frame, int, sample_rate) MAKE_ACCESSORS(AVFrame, frame, AVDictionary *, metadata) MAKE_ACCESSORS(AVFrame, frame, int, decode_error_flags) @@ -1648,6 +1650,8 @@ int attribute_align_arg avcodec_decode_audio4(AVCodecContext *avctx, frame->format = avctx->sample_fmt; if (!frame->channel_layout) frame->channel_layout = avctx->channel_layout; + if (!frame->channels) + frame->channels = avctx->channels; if (!frame->sample_rate) frame->sample_rate = avctx->sample_rate; } |