[FFmpeg-devel] [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:43:44 CEST 2010


Help further refactoring.
---
 libavcodec/avcodec.h     |    6 ++++++
 libavdevice/alsa-audio.h |    6 +-----
 2 files changed, 7 insertions(+), 5 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;
-- 
1.7.0.4




More information about the ffmpeg-devel mailing list