[FFmpeg-devel] [PATCH] ADTS AAC with ID3v2

Justin Ruggles justin.ruggles
Fri Jan 23 22:47:48 CET 2009


David DeHaven wrote:
> Hopefully final patch attached.
> 
> -DrD-
> Index: libavformat/raw.c
> ===================================================================
> --- libavformat/raw.c	(revision 16729)
> +++ libavformat/raw.c	(working copy)
> @@ -289,6 +289,19 @@
>      st->codec->codec_id = s->iformat->value;
>      st->need_parsing = AVSTREAM_PARSE_FULL;
>      /* the parameters will be extracted from the compressed bitstream */
> +
> +    if(st->codec->codec_id == CODEC_ID_FLAC) {
> +        /* skip ID3v2 header if found */
> +        uint8_t buf[ID3v2_HEADER_SIZE];
> +        int ret = get_buffer(s->pb, buf, ID3v2_HEADER_SIZE);
> +        if (ret == ID3v2_HEADER_SIZE && ff_id3v2_match(buf)) {
> +            /* FIXME: parse ID3v2 info instead of skipping */
> +            int len = ff_id3v2_tag_len(buf);
> +            url_fseek(s->pb, len - ID3v2_HEADER_SIZE, SEEK_CUR);
> +        } else {
> +            url_fseek(s->pb, 0, SEEK_SET);
> +        }
> +    }
>      return 0;
>  }

The only thing I have an issue with is the FIXME comment.  I don't see
why we should ever support actually reading the ID3 from FLAC files.
FLAC has a proper way to store metadata.

This chunk of code will probably move to a future flac_read_header()
function. But that doesn't affect the patch as it is now. It looks good
to me.

-Justin





More information about the ffmpeg-devel mailing list