summaryrefslogtreecommitdiff
path: root/libavcodec/flac.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2014-05-25 11:12:33 +0200
committerAnton Khirnov <anton@khirnov.net>2014-05-28 07:46:04 +0200
commitf13ffb6636fdecb5e3e0ddcff48f096e7b3db362 (patch)
treed72988d01c0d85178df4a04a66972bcbafec3e8e /libavcodec/flac.c
parent9767d7c092c890ecc5953452e8a951fd902dd67b (diff)
flacdec: do not overwrite a channel layout set by the caller
The channel layout mask for non-standard layouts is typically stored at the container level (as a vorbiscomment tag) for FLAC.
Diffstat (limited to 'libavcodec/flac.c')
-rw-r--r--libavcodec/flac.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libavcodec/flac.c b/libavcodec/flac.c
index b3e38472ae..e6a8ab8370 100644
--- a/libavcodec/flac.c
+++ b/libavcodec/flac.c
@@ -225,7 +225,10 @@ void avpriv_flac_parse_streaminfo(AVCodecContext *avctx, struct FLACStreaminfo *
avctx->channels = s->channels;
avctx->sample_rate = s->samplerate;
avctx->bits_per_raw_sample = s->bps;
- ff_flac_set_channel_layout(avctx);
+
+ if (!avctx->channel_layout ||
+ av_get_channel_layout_nb_channels(avctx->channel_layout) != avctx->channels)
+ ff_flac_set_channel_layout(avctx);
s->samples = get_bits_long(&gb, 32) << 4;
s->samples |= get_bits(&gb, 4);