[FFmpeg-devel] [PATCH] Parse bext metadata in wav (BWF)
Tomas Härdin
tomas.hardin
Thu Mar 3 13:01:48 CET 2011
Michael Niedermayer skrev 2011-03-03 00:44:
> On Wed, Mar 02, 2011 at 05:52:22PM +0100, Benjamin Larsson wrote:
>> On 03/02/2011 04:14 PM, Tomas H?rdin wrote:
>>> Hi
>>>
>>> The following patch set makes the wav demuxer parse the bext tag used in
>>> the Broadcast Wave Format (BWF). Doing so requires reworking the wav
>>> demuxer a bit, since it stops parsing the file once the data tag has
>>> been found. I have a sample where said tag is in the footer.
>>>
>>> In short, it'll parse the entire file if the file is seekable. If it's
>>> non-seekable then only the header is parsed. Any tags encountered are
>>> handled by the same switch statement, so tags before the fmt tag won't
>>> get ignored.
>>>
>>> I have no idea how to git-send-mail work on Windows, so mailing all
>>> patches might take a minute or two.
>>>
>>> /Tomas
>>
>
>> @@ -258,7 +265,21 @@ static int wav_read_header(AVFormatContext *s,
>> return AVERROR_INVALIDDATA;
>> }
>>
>> + if (!rf64)
>> + data_size = size;
>> + if (!data_size) {
>> + wav->data_end = INT64_MAX;
>> + } else
>> + wav->data_end= url_ftell(pb) + data_size;
>> +
>> + /* we can't look for metadata past the data tag if streaming, so stop parsing */
>> + if (pb->is_streamed)
>> goto break_loop;
>> +
>> + /* keep going in order to parse footer metadata chunks */
>> + data_ofs = url_ftell(pb);
>> + next_tag_ofs = wav->data_end;
>> + break;
>> case MKTAG('f','a','c','t'):
>> if(!sample_count)
>> sample_count = avio_rl32(pb);
> [...]
>> Looks ok.
>
> no comment
Please elaborate. This is equivalent to the old code AFAICT. I just
rearranged and dropped the useless size < 0 check (it never is).
Should I refactor it some more?
/Tomas
More information about the ffmpeg-devel
mailing list