[vlc-devel] [PATCH 1/9] aout: channel mask can be 0

Thomas Guillem thomas at gllm.fr
Wed Oct 5 18:37:44 CEST 2016


Audio outputs don't need the channel mask for S/PDIF or HDMI passthrough.
---
 src/audio_output/common.c | 5 ++++-
 src/audio_output/dec.c    | 3 ++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/audio_output/common.c b/src/audio_output/common.c
index 60438c6..4914d53 100644
--- a/src/audio_output/common.c
+++ b/src/audio_output/common.c
@@ -87,7 +87,10 @@ unsigned int aout_BitsPerSample( vlc_fourcc_t i_format )
  *****************************************************************************/
 void aout_FormatPrepare( audio_sample_format_t * p_format )
 {
-    p_format->i_channels = aout_FormatNbChannels( p_format );
+
+    unsigned i_channels = aout_FormatNbChannels( p_format );
+    if( i_channels > 0 )
+        p_format->i_channels = i_channels;
     p_format->i_bitspersample = aout_BitsPerSample( p_format->i_format );
     if( p_format->i_bitspersample > 0 )
     {
diff --git a/src/audio_output/dec.c b/src/audio_output/dec.c
index 1751e30..925afaf 100644
--- a/src/audio_output/dec.c
+++ b/src/audio_output/dec.c
@@ -46,7 +46,8 @@ int aout_DecNew( audio_output_t *p_aout,
                  const aout_request_vout_t *p_request_vout )
 {
     /* Sanitize audio format */
-    if( p_format->i_channels != aout_FormatNbChannels( p_format ) )
+    unsigned i_channels = aout_FormatNbChannels( p_format );
+    if( i_channels > 0 && p_format->i_channels != i_channels )
     {
         msg_Err( p_aout, "incompatible audio channels count with layout mask" );
         return -1;
-- 
2.9.3



More information about the vlc-devel mailing list