[FFmpeg-devel] [PATCH 3] add tag/comment support to the raw flac demuxer

Justin Ruggles justin.ruggles
Sun Dec 14 09:29:27 CET 2008


Jim Radford wrote:
> On Wed, Dec 10, 2008 at 10:08:15AM +0100, Reimar D?ffinger wrote:
>> On Tue, Dec 09, 2008 at 01:38:33PM -0800, Jim Radford wrote:
>>> On Thu, 4 Dec 2008 at 21:44:51, Reimar D?ffinger wrote:
>>>> On Mon, Dec 01, 2008 at 02:18:02PM -0800, Jim Radford wrote:
>>>>> This patch adds support for parsing vorbis comments in plain flac
>>>>> streams.  Only metadata packets are parsed leaving the frame data to
>>>>> be parsed in raw 1024 byte chunks like before.
>>>>> +        init_get_bits(&gb, header, ret*8);
>>>>> +        flac->metadata_done = get_bits(&gb, 1);
>>>>> +        type = get_bits(&gb, 7);
>>>>> +        length = get_bits(&gb, 24);
>>>> Seems very much like overkill to use get_bits here. Actually
>>>> get_be32 to me seems much more appropriate than get_buffer to get
>>>> the header anyway.
>>> I thought so too, but given that I need to copy the data back into the
>>> stream where it needs to be in its original endian, so the code
>>> doesn't get any simpler.
>> Nonsense, AV_WB32 is simpler and possibly a lot faster than memcpy
>> (depends on whether the compiler inlines his own memcpy variant).
> Ahh, I hadn't seen AV_WB32() and friends.  How's this version?

The code to read the header needs to be in the read_header function.
For example, create a new flac_read_header().  There, you can set the
metadata with the vorbiscomment and fill the codec extradata with the
STREAMINFO.  That way none of the header data will need to be passed in
the packets, but decoding will work fine because the needed info is in
the extradata.


More information about the ffmpeg-devel mailing list