[FFmpeg-devel] [PATCH] png parser

Diego Biurrun diego
Wed May 27 14:47:52 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

Diego



More information about the ffmpeg-devel mailing list