[PATCH 1/1] Define macro AV_NE() and use it in libavdevice.
Stefano Sabatini
stefano.sabatini-lala
Thu Aug 12 17:41:22 CEST 2010
Help further refactoring.
---
libavdevice/alsa-audio.h | 6 +-----
libavdevice/oss_audio.c | 6 +-----
libavutil/common.h | 6 ++++++
3 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/libavdevice/alsa-audio.h b/libavdevice/alsa-audio.h
index a90d5e7..9493831 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_NE(CODEC_ID_PCM_S16BE, CODEC_ID_PCM_S16LE)
typedef struct {
snd_pcm_t *h;
diff --git a/libavdevice/oss_audio.c b/libavdevice/oss_audio.c
index d382c03..9d00710 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_NE(CODEC_ID_PCM_S16BE, CODEC_ID_PCM_S16LE),
CODEC_ID_NONE,
audio_write_header,
audio_write_packet,
diff --git a/libavutil/common.h b/libavutil/common.h
index f9c03db..76fabfb 100644
--- a/libavutil/common.h
+++ b/libavutil/common.h
@@ -36,6 +36,12 @@
#include <string.h>
#include "attributes.h"
+#if AV_HAVE_BIGENDIAN
+# define AV_NE(be, le) be
+#else
+# define AV_NE(be, le) le
+#endif
+
//rounded division & shift
#define RSHIFT(a,b) ((a) > 0 ? ((a) + ((1<<(b))>>1))>>(b) : ((a) + ((1<<(b))>>1)-1)>>(b))
/* assume b>0 */
--
1.7.0.4
--IJpNTDwzlM2Ie8A6--
More information about the ffmpeg-devel
mailing list