[FFmpeg-devel] [PATCH] Split raw.c

Aurelien Jacobs aurel
Tue May 22 19:31:24 CEST 2007


On Mon, 21 May 2007 17:35:21 +0200
Panagiotis Issaris <takis.issaris at uhasselt.be> wrote:

> Hi,
> 
> The attached patch splits raw.c into several parts. The pixel format
> related functions are split into a separate rawpixfmt.[ch] pair and the
> encoder and decoder are put into separate files. Three arrays and a
> function had to be made global and were prefixed with ff_.
> 
> rawpixfmt.c is compiled unconditionally, rawdec.c en rawenc.c are only
> compiled when needed.
> 
>  Makefile    |    4 -
>  raw.h       |  200
> +----------------------------------------------------------
>  rawdec.c    |  127 +++----------------------------------
>  rawenc.c    |  178 ----------------------------------------------------
>  rawpixfmt.c |  148 ++-----------------------------------------
>  rawpixfmt.h |  202
> ++----------------------------------------------------------
>  6 files changed, 39 insertions(+), 820 deletions(-)
>
> Index: libavcodec/rawdec.c
> ===================================================================
> --- libavcodec/rawdec.c	(revision 9092)
> +++ libavcodec/rawdec.c	(working copy)
> @@ -20,102 +20,27 @@
>   */
>  
>  /**
> - * @file raw.c
> - * Raw Video Codec
> + * @file rawdec.c
> + * Raw Video decoder
>   */
>  
> -#include "avcodec.h"
> +#include "raw.h"
> +#include "rawpixfmt.h"
>  
> -typedef struct RawVideoContext {
> -    unsigned char * buffer;  /* block of memory for holding one frame */
> -    int             length;  /* number of bytes in buffer */
> -    AVFrame pic;             ///< AVCodecContext.coded_frame
> -} RawVideoContext;
> +extern const PixelFormatTag ff_pixelFormatTags[];

This extern should be in rawpixfmt.h

> +extern const PixelFormatTag ff_pixelFormatBpsAVI[];
> +extern const PixelFormatTag ff_pixelFormatBpsMOV[];

Don't need to be extern. They are only used by the decoder...

> -static int findPixelFormat(const PixelFormatTag *tags, unsigned int fourcc)
> -{

AFAICT findPixelFormat is only used by the decoder, so it should stay as a
static in rawdec.c

> @@ -223,4 +118,4 @@
>      raw_close_decoder,
>      raw_decode,
>  };
> -#endif // CONFIG_RAWVIDEO_DECODER
> +

Cosmetics (adding useless empty line ;-)

Also as a general remark, the content of rawpixfmt.c might also be moved directly
in utils.c (but that might as well be ugly, and anyway, I'm fine with rawpixfmt.c).

Aurel




More information about the ffmpeg-devel mailing list