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

Stefano Sabatini stefano.sabatini-lala
Thu Aug 12 17:41:22 CEST 2010


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
+
 #if LIBAVCODEC_VERSION_MAJOR < 53
 #define CodecType AVMediaType
 
diff --git a/libavdevice/alsa-audio.h b/libavdevice/alsa-audio.h
index a90d5e7..e51a17e 100644
--- a/libavdevice/alsa-audio.h
+++ b/libavdevice/alsa-audio.h
@@ -37,11 +37,7 @@
 /* XXX: we make the assumption that the soundcard accepts this format */
 /* XXX: find better solution with "preinit" method, needed also in
         other formats */
-#if HAVE_BIGENDIAN
-#define DEFAULT_CODEC_ID CODEC_ID_PCM_S16BE
-#else
-#define DEFAULT_CODEC_ID CODEC_ID_PCM_S16LE
-#endif
+#define DEFAULT_CODEC_ID AV_CODEC_ID_NE(PCM_S16BE, PCM_S16LE)
 
 typedef struct {
     snd_pcm_t *h;
diff --git a/libavdevice/oss_audio.c b/libavdevice/oss_audio.c
index d382c03..675bf87 100644
--- a/libavdevice/oss_audio.c
+++ b/libavdevice/oss_audio.c
@@ -315,11 +315,7 @@ AVOutputFormat oss_muxer = {
     /* XXX: we make the assumption that the soundcard accepts this format */
     /* XXX: find better solution with "preinit" method, needed also in
        other formats */
-#if HAVE_BIGENDIAN
-    CODEC_ID_PCM_S16BE,
-#else
-    CODEC_ID_PCM_S16LE,
-#endif
+    AV_CODEC_ID_NE(PCM_S16BE, PCM_S16LE),
     CODEC_ID_NONE,
     audio_write_header,
     audio_write_packet,
-- 
1.7.0.4


--sgneBHv3152wZ8jf--



More information about the ffmpeg-devel mailing list