[vlc-commits] Inline and simplify aout_FormatNbChannels

Rémi Denis-Courmont git at videolan.org
Wed Apr 13 19:36:06 CEST 2011


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Apr 13 20:34:18 2011 +0300| [53aeaf92ec7283b97383acfc709bb5e983f2b0e4] | committer: Rémi Denis-Courmont

Inline and simplify aout_FormatNbChannels

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

 include/vlc_aout.h        |    6 +++++-
 src/audio_output/common.c |   19 -------------------
 src/libvlccore.sym        |    1 -
 3 files changed, 5 insertions(+), 21 deletions(-)

diff --git a/include/vlc_aout.h b/include/vlc_aout.h
index 0f69e5f..181e769 100644
--- a/include/vlc_aout.h
+++ b/include/vlc_aout.h
@@ -295,7 +295,11 @@ VLC_EXPORT( bool, aout_CheckChannelExtraction, ( int *pi_selection, uint32_t *pi
 VLC_EXPORT( void, aout_ChannelExtract, ( void *p_dst, int i_dst_channels, const void *p_src, int i_src_channels, int i_sample_count, const int *pi_selection, int i_bits_per_sample ) );
 
 /* */
-VLC_EXPORT( unsigned int, aout_FormatNbChannels, ( const audio_sample_format_t * p_format ) LIBVLC_USED );
+static inline unsigned aout_FormatNbChannels(const audio_sample_format_t *fmt)
+{
+    return popcount(fmt->i_physical_channels & AOUT_CHAN_PHYSMASK);
+}
+
 VLC_EXPORT( unsigned int, aout_BitsPerSample, ( vlc_fourcc_t i_format ) LIBVLC_USED );
 VLC_EXPORT( void, aout_FormatPrepare, ( audio_sample_format_t * p_format ) );
 VLC_EXPORT( void, aout_FormatPrint, ( aout_instance_t * p_aout, const char * psz_text, const audio_sample_format_t * p_format ) );
diff --git a/src/audio_output/common.c b/src/audio_output/common.c
index b073426..1c3cb27 100644
--- a/src/audio_output/common.c
+++ b/src/audio_output/common.c
@@ -179,25 +179,6 @@ void aout_unlock (unsigned i)
  */
 
 /*****************************************************************************
- * aout_FormatNbChannels : return the number of channels
- *****************************************************************************/
-unsigned int aout_FormatNbChannels( const audio_sample_format_t * p_format )
-{
-    static const uint32_t pi_channels[] =
-        { AOUT_CHAN_CENTER, AOUT_CHAN_LEFT, AOUT_CHAN_RIGHT,
-          AOUT_CHAN_REARCENTER, AOUT_CHAN_REARLEFT, AOUT_CHAN_REARRIGHT,
-          AOUT_CHAN_MIDDLELEFT, AOUT_CHAN_MIDDLERIGHT, AOUT_CHAN_LFE };
-    unsigned int i_nb = 0, i;
-
-    for ( i = 0; i < sizeof(pi_channels)/sizeof(uint32_t); i++ )
-    {
-        if ( p_format->i_physical_channels & pi_channels[i] ) i_nb++;
-    }
-
-    return i_nb;
-}
-
-/*****************************************************************************
  * aout_BitsPerSample : get the number of bits per sample
  *****************************************************************************/
 unsigned int aout_BitsPerSample( vlc_fourcc_t i_format )
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index cabfea2..44d1a32 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -16,7 +16,6 @@ aout_EnableFilter
 aout_FifoFirstDate
 aout_FifoPop
 aout_filter_RequestVout
-aout_FormatNbChannels
 aout_FormatPrepare
 aout_FormatPrint
 aout_FormatPrintChannels



More information about the vlc-commits mailing list