[vlc-commits] aout: internal helper for endianess conversion

Rémi Denis-Courmont git at videolan.org
Thu Nov 15 21:42:22 CET 2012


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu Nov 15 22:01:31 2012 +0200| [66ede74c7a08001ae1e0c43838f8792cef46c706] | committer: Rémi Denis-Courmont

aout: internal helper for endianess conversion

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=66ede74c7a08001ae1e0c43838f8792cef46c706
---

 src/audio_output/aout_internal.h |    1 +
 src/audio_output/common.c        |   40 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 41 insertions(+)

diff --git a/src/audio_output/aout_internal.h b/src/audio_output/aout_internal.h
index b241ca2..c4e001c 100644
--- a/src/audio_output/aout_internal.h
+++ b/src/audio_output/aout_internal.h
@@ -123,6 +123,7 @@ void aout_OutputDelete( audio_output_t * p_aout );
 
 
 /* From common.c : */
+vlc_fourcc_t aout_NativeEndian(vlc_fourcc_t);
 void aout_FormatsPrint(vlc_object_t *, const char *,
                        const audio_sample_format_t *,
                        const audio_sample_format_t *);
diff --git a/src/audio_output/common.c b/src/audio_output/common.c
index 3f16894..79c9bc5 100644
--- a/src/audio_output/common.c
+++ b/src/audio_output/common.c
@@ -79,6 +79,46 @@ unsigned int aout_BitsPerSample( vlc_fourcc_t i_format )
     }
 }
 
+vlc_fourcc_t aout_NativeEndian( vlc_fourcc_t i_format )
+{
+    switch( i_format )
+    {
+        case VLC_CODEC_F64B:
+        case VLC_CODEC_F64L:
+            return VLC_CODEC_FL64;
+
+        case VLC_CODEC_F32B:
+        case VLC_CODEC_F32L:
+            return VLC_CODEC_FL32;
+
+        case VLC_CODEC_S32B:
+        case VLC_CODEC_S32L:
+            return VLC_CODEC_S32N;
+
+        case VLC_CODEC_U32B:
+        case VLC_CODEC_U32L:
+            return VLC_CODEC_U32N;
+
+        case VLC_CODEC_S24B:
+        case VLC_CODEC_S24L:
+            return VLC_CODEC_S24N;
+
+        case VLC_CODEC_U24B:
+        case VLC_CODEC_U24L:
+            return VLC_CODEC_U24N;
+
+        case VLC_CODEC_S16B:
+        case VLC_CODEC_S16L:
+            return VLC_CODEC_S16N;
+
+        case VLC_CODEC_U16B:
+        case VLC_CODEC_U16L:
+            return VLC_CODEC_U16N;
+    }
+    return 0;
+}
+
+
 /*****************************************************************************
  * aout_FormatPrepare : compute the number of bytes per frame & frame length
  *****************************************************************************/



More information about the vlc-commits mailing list