On 08/24/2011 08:08 PM, Alex Converse wrote:
> ---
> libavformat/isom.c | 16 ++++++++++++++++
> libavformat/isom.h | 1 +
> libavformat/mov.c | 3 +--
> libavformat/mpegts.c | 3 +--
> 4 files changed, 19 insertions(+), 4 deletions(-)
>
> diff --git a/libavformat/isom.c b/libavformat/isom.c
> index eb17e25..7d42e80 100644
> --- a/libavformat/isom.c
> +++ b/libavformat/isom.c
> @@ -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 */
> diff --git a/libavformat/isom.h b/libavformat/isom.h
> index ef3fe14..838eb42 100644
> --- a/libavformat/isom.h
> +++ b/libavformat/isom.h
> @@ -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
> diff --git a/libavformat/mov.c b/libavformat/mov.c
> index 92b1b14..35cd9a8 100644
> --- a/libavformat/mov.c
> +++ b/libavformat/mov.c
> @@ -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 */
>
> diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
> index fa5bd4c..a723418 100644
> --- a/libavformat/mpegts.c
> +++ b/libavformat/mpegts.c
> @@ -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);
>From what I can tell, this looks correct according to the spec.
-Justin
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel