aboutsummaryrefslogtreecommitdiffhomepage
path: root/libmpdemux
diff options
context:
space:
mode:
authorGravatar corey <corey@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-01-02 06:56:22 +0000
committerGravatar corey <corey@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-01-02 06:56:22 +0000
commitffb7208370d144b69053bc57327a14f8292f69ab (patch)
tree6bd386a91ac0f65d457ba6517005cc010dbce7de /libmpdemux
parentccd1c554518299dbf6eec6051475ab53913e46a6 (diff)
Partial support for QuickTime sound atom version 2.
This doesn't add support for parsing the sound atom itself, but does recognize the different offset at which the ESDS atom starts. Also, this patch supports "3" in the channels field, which indicates 6-channel (5.1) audio. For more information, see this mail: From: Corey Hickey <bugfood-ml@fatooh.org> To: mplayer-dev-eng@mplayerhq.hu Date: Wed, 28 Dec 2005 23:42:46 -0800 Subject: [PATCH] (partially) support QuickTime sound atom version 2 git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@17284 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpdemux')
-rw-r--r--libmpdemux/demux_mov.c38
1 files changed, 33 insertions, 5 deletions
diff --git a/libmpdemux/demux_mov.c b/libmpdemux/demux_mov.c
index 52879ee435..00bb5de271 100644
--- a/libmpdemux/demux_mov.c
+++ b/libmpdemux/demux_mov.c
@@ -616,6 +616,7 @@ static void lschunks(demuxer_t* demuxer,int level,off_t endpos,mov_track_t* trak
// ([int32_t size,int32_t type,some data ],repeat)
} my_stdata;
#endif
+ int version, adjust;
sh_audio_t* sh=new_sh_audio(demuxer,priv->track_db);
sh->format=trak->fourcc;
@@ -663,8 +664,27 @@ static void lschunks(demuxer_t* demuxer,int level,off_t endpos,mov_track_t* trak
// 36 char[] atom data (len=size-8)
// TODO: fix parsing for files using version 2.
+ version=char2short(trak->stdata,8);
+ if (version > 1)
+ mp_msg(MSGT_DEMUX, MSGL_WARN, "MOV: version %d sound atom may not parse correctly!\n", version);
trak->samplebytes=sh->samplesize=char2short(trak->stdata,18)/8;
- trak->nchannels=sh->channels=char2short(trak->stdata,16);
+
+ /* I can't find documentation, but so far this is the case. -Corey */
+ switch (char2short(trak->stdata,16)) {
+ case 1:
+ trak->nchannels = 1; break;
+ case 2:
+ trak->nchannels = 2; break;
+ case 3:
+ trak->nchannels = 6; break;
+ default:
+ mp_msg(MSGT_DEMUX, MSGL_WARN,
+ "MOV: unable to determine audio channels, assuming 2 (got %d)\n",
+ char2short(trak->stdata,16));
+ trak->nchannels = 2;
+ }
+ sh->channels = trak->nchannels;
+
/*printf("MOV: timescale: %d samplerate: %d durmap: %d (%d) -> %d (%d)\n",
trak->timescale, char2short(trak->stdata,24), trak->durmap[0].dur,
trak->durmap[0].num, trak->timescale/trak->durmap[0].dur,
@@ -720,10 +740,18 @@ static void lschunks(demuxer_t* demuxer,int level,off_t endpos,mov_track_t* trak
}
}
- if ((trak->stdata[9] == 0 && trak->stdata_len >= 36) ||
- (trak->stdata[9] == 1 && trak->stdata_len >= 36 + 48)) {
- // version 0 with extra atoms
- int adjust = (trak->stdata[9]==1)?48:0;
+ switch (version) {
+ case 0:
+ adjust = 0; break;
+ case 1:
+ adjust = 48; break;
+ case 2:
+ adjust = 68; break;
+ default:
+ mp_msg(MSGT_DEMUX, MSGL_WARN, "MOV: unknown sound atom version (%d); may not work!\n", version);
+ adjust = 68;
+ }
+ if (trak->stdata_len >= 36 + adjust) {
int atom_len = char2int(trak->stdata,28+adjust);
switch(char2int(trak->stdata,32+adjust)) { // atom type
case MOV_FOURCC('e','s','d','s'): {