diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2011-12-10 01:25:15 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-12-10 02:01:03 +0100 |
commit | c59b80c8d3e46f176172d582f27c14d772e306fc (patch) | |
tree | 8457ccf4abee25effcc243b22764b969127493d7 /libavformat/mov.c | |
parent | 5b98ea1b7309fd43694b92e990439636630f408a (diff) | |
parent | 4c386333529dd773e673e1366d1f6243d2c5af92 (diff) | |
download | ffmpeg-c59b80c8d3e46f176172d582f27c14d772e306fc.tar.gz |
Merge remote-tracking branch 'qatar/master'
* qatar/master:
isom: sort and pretty-print codec_movaudio_tags[]
isom: remove pointless comments in codec_movaudio_tags[]
isom: remove commented-out tag for vorbis
movenc: write 'chan' tag for AC-3 in MOV
mov: add support for reading and writing the 'chan' tag
audioconvert: add some additional channel and channel layout macros
audioconvert: change 7.1 "wide" layout to use side surround channels
movenc: simplify handling of pcm vs. adpcm vs. other compressed codecs
doc: update documentation to use avconv
doc: update demuxers section
doc: extend external library coverage
doc: split platform specific information
doc: port the git-howto to texinfo
doc: provide fallback css and customize @float
doc: document fate in a texinfo
doxy: change hue value to match our green
Conflicts:
doc/fate.txt
doc/ffserver.texi
doc/general.texi
doc/muxers.texi
doc/protocols.texi
doc/t2h.init
libavformat/isom.c
libavformat/mov.c
libavutil/avutil.h
tests/ref/acodec/pcm_s16be
tests/ref/acodec/pcm_s24be
tests/ref/acodec/pcm_s32be
tests/ref/acodec/pcm_s8
tests/ref/lavf/mov
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/mov.c')
-rw-r--r-- | libavformat/mov.c | 50 |
1 files changed, 48 insertions, 2 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c index 0bb7362179..12af19ed50 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -37,6 +37,7 @@ #include "isom.h" #include "libavcodec/get_bits.h" #include "id3v1.h" +#include "mov_chan.h" #if CONFIG_ZLIB #include <zlib.h> @@ -568,6 +569,51 @@ static int mov_read_dac3(MOVContext *c, AVIOContext *pb, MOVAtom atom) return 0; } +static int mov_read_chan(MOVContext *c, AVIOContext *pb, MOVAtom atom) +{ + AVStream *st; + uint8_t version; + uint32_t flags, layout_tag, bitmap, num_descr; + + if (c->fc->nb_streams < 1) + return 0; + st = c->fc->streams[c->fc->nb_streams-1]; + + if (atom.size < 16) + return 0; + + version = avio_r8(pb); + flags = avio_rb24(pb); + + layout_tag = avio_rb32(pb); + bitmap = avio_rb32(pb); + num_descr = avio_rb32(pb); + + if (atom.size < 16ULL + num_descr * 20ULL) + return 0; + + av_dlog(c->fc, "chan: size=%ld version=%u flags=%u layout=%u bitmap=%u num_descr=%u\n", + atom.size, version, flags, layout_tag, bitmap, num_descr); + +#if 0 + /* TODO: use the channel descriptions if the layout tag is 0 */ + int i; + for (i = 0; i < num_descr; i++) { + uint32_t label, cflags; + float coords[3]; + label = avio_rb32(pb); // mChannelLabel + cflags = avio_rb32(pb); // mChannelFlags + AV_WN32(&coords[0], avio_rl32(pb)); // mCoordinates[0] + AV_WN32(&coords[1], avio_rl32(pb)); // mCoordinates[1] + AV_WN32(&coords[2], avio_rl32(pb)); // mCoordinates[2] + } +#endif + + st->codec->channel_layout = ff_mov_get_channel_layout(layout_tag, bitmap); + + return 0; +} + static int mov_read_wfex(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; @@ -2346,7 +2392,7 @@ static int mov_read_elst(MOVContext *c, AVIOContext *pb, MOVAtom atom) return 0; } -static int mov_read_chan(MOVContext *c, AVIOContext *pb, MOVAtom atom) +static int mov_read_chan2(MOVContext *c, AVIOContext *pb, MOVAtom atom) { if (atom.size < 16) return 0; @@ -2409,7 +2455,7 @@ static const MOVParseTableEntry mov_default_parse_table[] = { { MKTAG('w','i','d','e'), mov_read_wide }, /* place holder */ { MKTAG('w','f','e','x'), mov_read_wfex }, { MKTAG('c','m','o','v'), mov_read_cmov }, -{ MKTAG('c','h','a','n'), mov_read_chan }, +{ MKTAG('c','h','a','n'), mov_read_chan }, /* channel layout */ { 0, NULL } }; |