summaryrefslogtreecommitdiff
path: root/libavformat
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2010-09-06 21:52:11 +0000
committerJustin Ruggles <justin.ruggles@gmail.com>2010-09-06 21:52:11 +0000
commitbdecdd2bfcdfa2cdad10befc73b94ec3e624066f (patch)
tree834170df4b91eca2dec14ea45e52ef77f79ce3cb /libavformat
parent0f146263aadd2bbae69c4927f573b7f869612e23 (diff)
Read the number of channels from the 'dac3' tag for AC-3 in MP4.
Originally committed as revision 25054 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/mov.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c
index bf986b337d..7cb8c7b51b 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -559,6 +559,21 @@ static int mov_read_esds(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
return ff_mov_read_esds(c->fc, pb, atom);
}
+static int mov_read_dac3(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
+{
+ AVStream *st;
+ int ac3info, acmod, lfeon;
+
+ st = c->fc->streams[c->fc->nb_streams-1];
+
+ ac3info = get_be24(pb);
+ acmod = (ac3info >> 11) & 0x7;
+ lfeon = (ac3info >> 10) & 0x1;
+ st->codec->channels = ((int[]){2,1,2,3,3,4,4,5})[acmod] + lfeon;
+
+ return 0;
+}
+
static int mov_read_pasp(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
{
const int num = get_be32(pb);
@@ -2245,6 +2260,7 @@ static const MOVParseTableEntry mov_default_parse_table[] = {
{ MKTAG('u','d','t','a'), mov_read_default },
{ MKTAG('w','a','v','e'), mov_read_wave },
{ MKTAG('e','s','d','s'), mov_read_esds },
+{ MKTAG('d','a','c','3'), mov_read_dac3 }, /* AC-3 info */
{ MKTAG('w','i','d','e'), mov_read_wide }, /* place holder */
{ MKTAG('c','m','o','v'), mov_read_cmov },
{ 0, NULL }