1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-21 10:55:51 +02:00

mp4: Handle non-trivial ES Descriptors.

This commit is contained in:
Alex Converse 2011-08-24 16:59:30 -07:00
parent d4b9974465
commit ad6c7c1b52
4 changed files with 19 additions and 4 deletions

View File

@ -372,6 +372,22 @@ int ff_mp4_read_descr(AVFormatContext *fc, AVIOContext *pb, int *tag)
return len;
}
void ff_mp4_parse_es_descr(AVIOContext *pb, int *es_id)
{
int flags;
if (es_id) *es_id = avio_rb16(pb);
else avio_rb16(pb);
flags = avio_r8(pb);
if (flags & 0x80) //streamDependenceFlag
avio_rb16(pb);
if (flags & 0x40) { //URL_Flag
int len = avio_r8(pb);
avio_skip(pb, len);
}
if (flags & 0x20) //OCRstreamFlag
avio_rb16(pb);
}
static const AVCodecTag mp4_audio_types[] = {
{ CODEC_ID_MP3ON4, AOT_PS }, /* old mp3on4 draft */
{ CODEC_ID_MP3ON4, AOT_L1 }, /* layer 1 */

View File

@ -146,6 +146,7 @@ typedef struct MOVContext {
int ff_mp4_read_descr_len(AVIOContext *pb);
int ff_mp4_read_descr(AVFormatContext *fc, AVIOContext *pb, int *tag);
int ff_mp4_read_dec_config_descr(AVFormatContext *fc, AVStream *st, AVIOContext *pb);
void ff_mp4_parse_es_descr(AVIOContext *pb, int *es_id);
#define MP4IODescrTag 0x02
#define MP4ESDescrTag 0x03

View File

@ -473,8 +473,7 @@ int ff_mov_read_esds(AVFormatContext *fc, AVIOContext *pb, MOVAtom atom)
avio_rb32(pb); /* version + flags */
ff_mp4_read_descr(fc, pb, &tag);
if (tag == MP4ESDescrTag) {
avio_rb16(pb); /* ID */
avio_r8(pb); /* priority */
ff_mp4_parse_es_descr(pb, NULL);
} else
avio_rb16(pb); /* ID */

View File

@ -886,9 +886,8 @@ static int mp4_read_iods(AVFormatContext *s, const uint8_t *buf, unsigned size,
avio_r8(&pb);
len = ff_mp4_read_descr(s, &pb, &tag);
if (tag == MP4ESDescrTag) {
*es_id = avio_rb16(&pb); /* ES_ID */
ff_mp4_parse_es_descr(&pb, es_id);
av_dlog(s, "ES_ID %#x\n", *es_id);
avio_r8(&pb); /* priority */
len = ff_mp4_read_descr(s, &pb, &tag);
if (tag == MP4DecConfigDescrTag) {
*dec_config_descr = av_malloc(len);