[FFmpeg-devel] [PATCH] change semantic of CONFIG_*

Diego Biurrun diego
Tue Jan 13 14:47:08 CET 2009


On Tue, Jan 13, 2009 at 12:01:43PM +0100, Aurelien Jacobs wrote:
> 
> Attached patch replaces each occurrence of #ifdef CONFIG_ by #if CONFIG_
> and ensure CONFIG_* are always defined to 0/1.
> I guess this one should please everyone.

This is much better, yes.

> --- libavcodec/vcr1.c	(revision 16570)
> +++ libavcodec/vcr1.c	(working copy)
> @@ -32,6 +32,7 @@
>  
>  /* Disable the encoder. */
>  #undef CONFIG_VCR1_ENCODER
> +#define CONFIG_VCR1_ENCODER 0

This looks like a hack that should be eliminated.
No, I'm not saying it's your fault but now that we have noticed
it, we should find a better solution.

> --- libavcodec/libfaad.c	(revision 16570)
> +++ libavcodec/libfaad.c	(working copy)
> @@ -35,12 +35,13 @@
>  
>  /*
> - * when CONFIG_LIBFAADBIN is defined the libfaad will be opened at runtime
> + * when CONFIG_LIBFAADBIN is true the libfaad will be opened at runtime

s/the// while you're at it..

> -//#undef CONFIG_LIBFAADBIN
> +//#undef  CONFIG_LIBFAADBIN

IMO pointless, but no, I do not care..

> --- libavcodec/cljr.c	(revision 16570)
> +++ libavcodec/cljr.c	(working copy)
> @@ -30,6 +30,7 @@
>  
>  /* Disable the encoder. */
>  #undef CONFIG_CLJR_ENCODER
> +#define CONFIG_CLJR_ENCODER 0

same situation as above, hmmm

> --- libavcodec/mpegaudiodec.c	(revision 16570)
> +++ libavcodec/mpegaudiodec.c	(working copy)
> @@ -36,7 +36,7 @@
>  
>  /* define USE_HIGHPRECISION to have a bit exact (but slower) mpeg
>     audio decoder */
> -#ifdef CONFIG_MPEGAUDIO_HP
> +#if CONFIG_MPEGAUDIO_HP
>  #   define USE_HIGHPRECISION
>  #endif

This is another hack that should be avoided: The indirection is
pointless.

> --- libavcodec/msmpeg4.c	(revision 16570)
> +++ libavcodec/msmpeg4.c	(working copy)
> @@ -79,7 +79,7 @@
>  
> -#ifdef CONFIG_ENCODERS //strangely gcc includes this even if it is not references
> +#if CONFIG_ENCODERS //strangely gcc includes this even if it is not references

referenceD, while you're at it..

> @@ -109,7 +109,7 @@
> -#if defined(CONFIG_WMV3_DECODER)||defined(CONFIG_VC1_DECODER)
> +#if CONFIG_WMV3_DECODER||CONFIG_VC1_DECODER

Add spaces around the ||.

> --- libavcodec/mpc7.c	(revision 16570)
> +++ libavcodec/mpc7.c	(working copy)
> @@ -30,7 +30,7 @@
>  
> -#ifdef CONFIG_MPEGAUDIO_HP
> +#if CONFIG_MPEGAUDIO_HP
>  #define USE_HIGHPRECISION
>  #endif

see above

> --- libavcodec/mpc.c	(revision 16570)
> +++ libavcodec/mpc.c	(working copy)
> @@ -30,7 +30,7 @@
>  
> -#ifdef CONFIG_MPEGAUDIO_HP
> +#if CONFIG_MPEGAUDIO_HP
>  #define USE_HIGHPRECISION
>  #endif
> --- libavcodec/mpc.h	(revision 16570)
> +++ libavcodec/mpc.h	(working copy)
> @@ -33,7 +33,7 @@
>  
> -#ifdef CONFIG_MPEGAUDIO_HP
> +#if CONFIG_MPEGAUDIO_HP
>  #define USE_HIGHPRECISION
>  #endif
> --- libavcodec/mpc8.c	(revision 16570)
> +++ libavcodec/mpc8.c	(working copy)
> @@ -30,7 +30,7 @@
>  
> -#ifdef CONFIG_MPEGAUDIO_HP
> +#if CONFIG_MPEGAUDIO_HP
>  #define USE_HIGHPRECISION
>  #endif
> --- libavcodec/qdm2.c	(revision 16570)
> +++ libavcodec/qdm2.c	(working copy)
> @@ -39,7 +39,7 @@
>  
> -#ifdef CONFIG_MPEGAUDIO_HP
> +#if CONFIG_MPEGAUDIO_HP
>  #define USE_HIGHPRECISION
>  #endif

and again and again..

> --- cmdutils.c	(revision 16570)
> +++ cmdutils.c	(working copy)
> @@ -30,19 +30,19 @@
>  
>  #include "config.h"
>  #include "libavformat/avformat.h"
> -#ifdef CONFIG_AVFILTER
> +#if CONFIG_AVFILTER
>  #include "libavfilter/avfilter.h"
>  #endif
>  #include "libavdevice/avdevice.h"
>  #include "libswscale/swscale.h"
> -#ifdef CONFIG_POSTPROC
> +#if CONFIG_POSTPROC
>  #include "libpostproc/postprocess.h"
>  #endif
>  #include "libavutil/avstring.h"
>  #include "libavcodec/opt.h"
>  #include "cmdutils.h"
>  #include "version.h"
> -#ifdef CONFIG_NETWORK
> +#if CONFIG_NETWORK
>  #include "libavformat/network.h"
>  #endif

These #ifs look pointless, I think we can drop them.

Diego




More information about the ffmpeg-devel mailing list