[FFmpeg-devel] [PATCH] FLAC parser

Justin Ruggles justin.ruggles
Thu Nov 4 15:44:44 CET 2010


Michael Chinen wrote:

> On Mon, Oct 25, 2010 at 4:39 AM, Michael Chinen <mchinen at gmail.com> wrote:
>> Hi,
>>
>> On Sun, Oct 24, 2010 at 3:27 PM, Michael Niedermayer <michaelni at gmx.at> wrote:
>>> On Sat, Oct 23, 2010 at 04:08:59AM +0200, Michael Chinen wrote:
>>> [...]
>>>> +static int find_new_headers(FLACParseContext *fpc, int search_start)
>>>> +{
>>>> +    FLACHeaderMarker *end;
>>>> +    int search_end, size = 0, read_len, temp;
>>>> +    uint8_t *buf;
>>>> +    fpc->nb_headers_found = 0;
>>>> +
>>>> +    /* Search for a new header of at most 16 bytes. */
>>>> +    search_end = av_fifo_size(fpc->fifo_buf) - (MAX_FRAME_HEADER_SIZE - 1);
>>>> +    read_len   = search_end - search_start + 1;
>>>> +    buf        = flac_fifo_read(fpc, search_start, &read_len);
>>>> +    size       = find_headers_search(fpc, buf, read_len, search_start);
>>>> +    search_start += read_len - 1;
>>>> +
>>>> +    /* if we hit the fifo end we need a wrap buffer for the two byte wrap around */
>>>> +    if (search_start != search_end) {
>>>> +        buf  = flac_fifo_read_wrap(fpc, search_start, 2,
>>>> +                                  &fpc->wrap_buf, &fpc->wrap_buf_allocated_size);
>>>> +        temp = find_headers_search(fpc, buf, 2, search_start);
>>>> +        size = FFMAX(size, temp);
>>>> +        search_start += 1;
>>>> +    }
>>> the 2 bytes can be checked directly and find_headers_search_validate() be called
>> ok, I added this.
>>
>>> also i leave further review to the flac maintainer
>>>
>>> a bit of further simplification and cleanup would be nice though
>> Also removed the error codes and used offsets for logs where applicable.
> 
> Ping.

Sorry for the delay.  I'll review when I get back from vacation on Tuesday.

-Justin



More information about the ffmpeg-devel mailing list