summaryrefslogtreecommitdiff
path: root/libavformat
diff options
context:
space:
mode:
authorBenjamin Larsson <banan@ludd.ltu.se>2010-10-02 22:18:02 +0000
committerBenjamin Larsson <banan@ludd.ltu.se>2010-10-02 22:18:02 +0000
commit62784e3733ceb0f58007db8bb2e41e1abf62b85e (patch)
tree6bdcb530369c326b004fc78c8bcce3c8bfb9e5e9 /libavformat
parentae8c28db87c5bfb5721a91014a657e56983c6c57 (diff)
Add the CODEC_CAP_CHANNEL_CONF capability code and add
that flag to the dca codec. This capability when set will make sure the codec will initialize the channel configuration instead of trusting the container. This fixes issue 2137 and issue 850. Originally committed as revision 25320 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/utils.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 24dbd88feb..598551178c 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2167,6 +2167,7 @@ int av_find_stream_info(AVFormatContext *ic)
} info[MAX_STREAMS] = {{0}};
for(i=0;i<ic->nb_streams;i++) {
+ AVCodec *codec;
st = ic->streams[i];
if (st->codec->codec_id == CODEC_ID_AAC) {
st->codec->sample_rate = 0;
@@ -2187,9 +2188,17 @@ int av_find_stream_info(AVFormatContext *ic)
}
}
assert(!st->codec->codec);
+ codec = avcodec_find_decoder(st->codec->codec_id);
+
+ /* Force decoding of at least one frame of codec data
+ * this makes sure the codec initializes the channel configuration
+ * and does not trust the values from the container.
+ */
+ if (codec && codec->capabilities & CODEC_CAP_CHANNEL_CONF)
+ st->codec->channels = 0;
+
//try to just open decoders, in case this is enough to get parameters
if(!has_codec_parameters(st->codec)){
- AVCodec *codec = avcodec_find_decoder(st->codec->codec_id);
if (codec)
avcodec_open(st->codec, codec);
}