[FFmpeg-devel] [PATCH] png parser

Peter Holik peter
Wed May 27 15:16:26 CEST 2009


> On Wed, May 27, 2009 at 02:32:40PM +0200, Peter Holik wrote:
>>
>> This patch adds a png parser to ffmpeg.
>
> There are two patches that should really be one.
>
>> --- /dev/null
>> +++ b/libavcodec/png_parser.c
>> @@ -0,0 +1,95 @@
>> +/**
>> + * @file libavcodec/png_parser.c
>> + * PNG parser.
>
> Drop the period.
>
>> +/**
>> + * finds the end of the current frame in the bitstream.
>
> Capitalize.
>
>> + * @return the position of the first byte of the next frame, or -1
>> + */
>> +static int find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size){
>> +    int i=0;
>> +    uint64_t state= pc->state64;
>> +
>> +    if(!pc->frame_start_found){
>> +        for(i=0; i<buf_size; i++){
>> +            state= (state<<8) | buf[i];
>> +            if(state == PNGSIG || state == MNGSIG){
>> +                i++;
>> +                pc->frame_start_found=1;
>> +                break;
>
> K&R coding style please, i.e. space between if/for/.. and ( and between
> ) and {, spaces around operators and the { on the next line for function
> declarations.
>
>> +static int png_parse(AVCodecParserContext *s,
>> +                           AVCodecContext *avctx,
>> +                           const uint8_t **poutbuf, int *poutbuf_size,
>> +                           const uint8_t *buf, int buf_size)
>
> weird indentation

Ok, I've taken this format out of other ffmpeg source files (unluckily)

For Makefile i was unsure, because usually configure creates Makefiles and therefor
a separated patchfile.

cu Peter



More information about the ffmpeg-devel mailing list