diff options
author | mosu <mosu@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2005-05-01 10:40:42 +0000 |
---|---|---|
committer | mosu <mosu@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2005-05-01 10:40:42 +0000 |
commit | 9e5531f861ead12be512a70ee5c2ec04461d932b (patch) | |
tree | d0a2c0bb1dcf07e01fa14558b224818d5e48bd5c | |
parent | e331e6b94ff10325c2569cb8f1b5469ebed46f4f (diff) |
Nasty workaround for codec initialization data. In _at least_ one case (AAC) the stream_header.size element seems to be four bytes off. Skip those bytes but only for known cases (again AAC) and not for all.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@15314 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r-- | libmpdemux/demux_ogg.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/libmpdemux/demux_ogg.c b/libmpdemux/demux_ogg.c index 60fbf4b2aa..4a00232ea1 100644 --- a/libmpdemux/demux_ogg.c +++ b/libmpdemux/demux_ogg.c @@ -973,8 +973,21 @@ int demux_ogg_open(demuxer_t* demuxer) { } else if(strncmp(st->streamtype,"audio",5) == 0) { char buffer[5]; unsigned int extra_size = get_uint32 (&st->size) - sizeof(stream_header); + unsigned int extra_offset = 0; + memcpy(buffer,st->subtype,4); buffer[4] = '\0'; + + /* Nasty workaround. stream_header.size seems not to contain the real + size in all cases. There are four extra bytes that are unaccounted + for in front of the real codec initialization data _at least_ for + AAC. So far I've only seen those bytes being all 0, so we can + just skip them here. */ + if ((strtol(buffer, NULL, 16) == 0xff) && (extra_size >= 4)) { + extra_size -= 4; + extra_offset = 4; + } + sh_a = new_sh_audio(demuxer,ogg_d->num_sub); sh_a->wf = (WAVEFORMATEX*)calloc(1,sizeof(WAVEFORMATEX)+extra_size); sh_a->format = sh_a->wf->wFormatTag = strtol(buffer, NULL, 16); @@ -986,7 +999,7 @@ int demux_ogg_open(demuxer_t* demuxer) { sh_a->samplesize = (sh_a->wf->wBitsPerSample+7)/8; sh_a->wf->cbSize = extra_size; if(extra_size) - memcpy(((char *)sh_a->wf)+sizeof(WAVEFORMATEX),st+1,extra_size); + memcpy(((char *)sh_a->wf)+sizeof(WAVEFORMATEX),((char *)(st+1))+extra_offset,extra_size); ogg_d->subs[ogg_d->num_sub].samplerate = sh_a->samplerate; // * sh_a->channels; if (identify) |