From 3f7582cca2200c5552c98c2c0e548bab647d5508 Mon Sep 17 00:00:00 2001 From: nicodvb Date: Mon, 26 Feb 2007 21:54:52 +0000 Subject: copy the content of QDM2 atom as extradata for ffqdm2 playback; patch by Carl Eugen Hoyos git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@22354 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpdemux/demux_rtp_codec.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'libmpdemux') diff --git a/libmpdemux/demux_rtp_codec.cpp b/libmpdemux/demux_rtp_codec.cpp index 78d8a7b522..59173fba2b 100644 --- a/libmpdemux/demux_rtp_codec.cpp +++ b/libmpdemux/demux_rtp_codec.cpp @@ -238,6 +238,25 @@ void rtpCodecInitialize_audio(demuxer_t* demuxer, wf->wFormatTag = sh_audio->format = fourcc; wf->nChannels = numChannels; + + uint8_t *pos = (uint8_t*)qtRTPSource->qtState.sdAtom + 52; + uint8_t *endpos = (uint8_t*)qtRTPSource->qtState.sdAtom + + qtRTPSource->qtState.sdAtomSize; + while (pos+8 < endpos) { + unsigned atomLength = pos[0]<<24 | pos[1]<<16 | pos[2]<<8 | pos[3]; + if (atomLength == 0 || atomLength > endpos-pos) break; + if (!memcmp(pos+4, "wave", 4) && fourcc==mmioFOURCC('Q','D','M','2') && + atomLength > 8 && + atomLength <= INT_MAX) { + sh_audio->codecdata = (unsigned char*) malloc(atomLength-8); + if (sh_audio->codecdata) { + memcpy(sh_audio->codecdata, pos+8, atomLength-8); + sh_audio->codecdata_len = atomLength-8; + } + break; + } + pos += atomLength; + } } else { fprintf(stderr, "Unknown MPlayer format code for MIME type \"audio/%s\"\n", -- cgit v1.2.3