[vlc-devel] [RFC PATCH 6/6] a52: handle new decoder_RequestAudioPassthrough

Thomas Guillem thomas at gllm.fr
Fri Jul 1 18:14:55 CEST 2016


---
 modules/codec/a52.c | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

diff --git a/modules/codec/a52.c b/modules/codec/a52.c
index 044905b..4e37767 100644
--- a/modules/codec/a52.c
+++ b/modules/codec/a52.c
@@ -45,12 +45,13 @@
  *****************************************************************************/
 static int  OpenDecoder   ( vlc_object_t * );
 static int  OpenPacketizer( vlc_object_t * );
+static void CloseDecoder  ( vlc_object_t * );
 static void CloseCommon   ( vlc_object_t * );
 
 vlc_module_begin ()
     set_description( N_("A/52 parser") )
     set_capability( "decoder", 100 )
-    set_callbacks( OpenDecoder, CloseCommon )
+    set_callbacks( OpenDecoder, CloseDecoder )
     set_category( CAT_INPUT )
     set_subcategory( SUBCAT_INPUT_ACODEC )
 
@@ -151,10 +152,16 @@ static int OpenCommon( vlc_object_t *p_this, bool b_packetizer )
 
 static int OpenDecoder( vlc_object_t *p_this )
 {
-    /* HACK: Don't use this codec if we don't have an a52 audio filter */
-    if( !module_exists( "a52tofloat32" ) )
+    decoder_t *p_dec = (decoder_t*)p_this;
+
+    if( !decoder_RequestAudioPassthrough( p_dec, true ) )
         return VLC_EGENERIC;
-    return OpenCommon( p_this, false );
+
+    int i_ret = OpenCommon( p_this, false );
+    if( i_ret != VLC_SUCCESS )
+        decoder_RequestAudioPassthrough( p_dec, false );
+    fprintf(stderr, "A52: OpenDecoder!\n");
+    return i_ret;
 }
 
 static int OpenPacketizer( vlc_object_t *p_this )
@@ -347,6 +354,13 @@ static void CloseCommon( vlc_object_t *p_this )
     free( p_sys );
 }
 
+static void CloseDecoder( vlc_object_t *p_this )
+{
+    decoder_t *p_dec = (decoder_t*)p_this;
+    decoder_RequestAudioPassthrough( p_dec, false );
+    CloseCommon( p_this );
+}
+
 /*****************************************************************************
  * GetOutBuffer:
  *****************************************************************************/
-- 
2.8.1



More information about the vlc-devel mailing list