[FFmpeg-devel] [PATCH 1/1] Define macro AV_CODEC_ID_NE() and use it in alsa-audio.h.

Aurelien Jacobs aurel
Tue Aug 17 00:19:01 CEST 2010


On Tue, Aug 17, 2010 at 12:15:37AM +0200, Stefano Sabatini wrote:
> On date Thursday 2010-08-12 17:43:44 +0200, Stefano Sabatini encoded:
> > Help further refactoring.
> 
> Also OSS benefits from the macro, updated.

> From a4344b1be22dc575a21adf749e3424424e0d2071 Mon Sep 17 00:00:00 2001
> From: Stefano Sabatini <stefano.sabatini-lala at poste.it>
> Date: Thu, 12 Aug 2010 17:41:22 +0200
> Subject: [PATCH 1/1] Define macro AV_CODEC_ID_NE() and use it in alsa-audio.h.
> 
> Help further refactoring.
> ---
>  libavcodec/avcodec.h     |    6 ++++++
>  libavdevice/alsa-audio.h |    6 +-----
>  libavdevice/oss_audio.c  |    6 +-----
>  3 files changed, 8 insertions(+), 10 deletions(-)
> 
> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> index 7fba268..49b4842 100644
> --- a/libavcodec/avcodec.h
> +++ b/libavcodec/avcodec.h
> @@ -359,6 +359,12 @@ enum CodecID {
>                                  * stream (only used by libavformat) */
>  };
>  
> +#if AV_HAVE_BIGENDIAN
> +#   define AV_CODEC_ID_NE(be, le) CODEC_ID_##be
> +#else
> +#   define AV_CODEC_ID_NE(be, le) CODEC_ID_##le
> +#endif

Maybe it could be defined in a more generic way, in libavutil, such as:

#if AV_HAVE_BIGENDIAN
#   define AV_NE(be, le) be
#else
#   define AV_NE(be, le) le
#endif

I have no example right now, but I guess it could be useful for
something else than CODEC_ID...

Aurel



More information about the ffmpeg-devel mailing list