diff options
author | Justin Ruggles | 2011-04-19 19:03:47 -0400 |
---|---|---|
committer | Justin Ruggles | 2011-04-27 12:57:43 -0400 |
commit | 688b09fa597804ab4708271ce467a6ae025f0c17 (patch) | |
tree | 331a6f75ff5bb97c48e5249703d3370ec9cf5f2b /libavcodec | |
parent | 168f9e8c40cf383802c8c8059f283a6ea789ec1e (diff) |
If AVCodecContext.channels is 0 and AVCodecContext.channel_layout is
non-zero, set channels based on channel_layout.
This allows the user to set only channel_layout and not channels.
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/utils.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c index e4ea1e5bf7..68441881de 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -584,6 +584,8 @@ int attribute_align_arg avcodec_open(AVCodecContext *avctx, AVCodec *codec) ret = AVERROR(EINVAL); goto free_and_end; } + } else if (avctx->channel_layout) { + avctx->channels = av_get_channel_layout_nb_channels(avctx->channel_layout); } } |