[Ffmpeg-devel] [PATCH] mp4 codecs objecttype handling

Michael Niedermayer michaelni
Sat Feb 11 13:37:26 CET 2006


Hi

On Sat, Feb 11, 2006 at 01:38:40AM +0100, Baptiste COUDURIER wrote:
> Hi,
> 
> This patch adds mp4 specific codec objecttype handling is esds atom.

[...]

>  
> +/* http://gpac.sourceforge.net/tutorial/mediatypes.htm */
> +static const CodecTag mp4_codec_tags[] = {
> +    { CODEC_ID_MPEG4     , 0x01 }, /* MPEG4 Systems 1 */
> +    { CODEC_ID_MPEG4     , 0x02 }, /* MPEG4 Systems 2 */
> +    { CODEC_ID_MPEG4     , 0x20 }, /* MPEG4 */
> +    { CODEC_ID_AAC       , 0x40 }, /* MPEG4 Audio */
> +    { CODEC_ID_MPEG2VIDEO, 0x60 }, /* MPEG2 Simple */
> +    { CODEC_ID_MPEG2VIDEO, 0x61 }, /* MPEG2 Main */
> +    { CODEC_ID_MPEG2VIDEO, 0x62 }, /* MPEG2 SNR */
> +    { CODEC_ID_MPEG2VIDEO, 0x63 }, /* MPEG2 Spatial */
> +    { CODEC_ID_MPEG2VIDEO, 0x64 }, /* MPEG2 High */
> +    { CODEC_ID_MPEG2VIDEO, 0x65 }, /* MPEG2 422 */
> +    { CODEC_ID_AAC       , 0x66 }, /* MPEG2 AAC Main */
> +    { CODEC_ID_AAC       , 0x67 }, /* MPEG2 AAC Low */
> +    { CODEC_ID_AAC       , 0x68 }, /* MPEG2 AAC SSR */
> +    { CODEC_ID_MP3       , 0x69 }, /* MP3 */
> +    { CODEC_ID_MPEG1VIDEO, 0x6A }, /* MPEG1 Video */
> +    { CODEC_ID_MP2       , 0x6B }, /* MPEG1 Audio */
> +    { CODEC_ID_MJPEG     , 0x6C }, /* JPEG Video */
> +};

duplicate of ff_mov_obj_type


[...]

> @@ -650,12 +671,22 @@ static int mov_read_esds(MOVContext *c, 
>  
>      len = mov_mp4_read_descr(pb, &tag);
>      if (tag == MP4DecConfigDescrTag) {
> +        enum CodecID id;
> +
>          sc->esds.object_type_id = get_byte(pb);
>          sc->esds.stream_type = get_byte(pb);
>          sc->esds.buffer_size_db = get_be24(pb);
>          sc->esds.max_bitrate = get_be32(pb);
>          sc->esds.avg_bitrate = get_be32(pb);
>  
> +        id = codec_get_id(mp4_codec_tags, sc->esds.object_type_id);
> +        if (id >= 0) {
> +            AVCodec *codec;
> +            codec = avcodec_find_decoder(id);
> +            if (codec)
> +                st->codec->codec_id = id;
> +        }

wth is this supposed to do? why not:

if(st->codec->codec_id <= 0)
    st->codec->codec_id= codec_get_id(mp4_codec_tags, sc->esds.object_type_id);


[...]

-- 
Michael





More information about the ffmpeg-devel mailing list