[vlc-commits] tizen_audio: use new 2.4 functions dynamically

Thomas Guillem git at videolan.org
Thu Oct 15 10:06:21 CEST 2015


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Oct 15 09:43:28 2015 +0200| [fdaa7f76a81f2ce05af645d34e5f0cc15fb88426] | committer: Thomas Guillem

tizen_audio: use new 2.4 functions dynamically

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

 modules/audio_output/tizen_audio.c |   38 +++++++++++++++++++++---------------
 1 file changed, 22 insertions(+), 16 deletions(-)

diff --git a/modules/audio_output/tizen_audio.c b/modules/audio_output/tizen_audio.c
index 6859781..56293dd 100644
--- a/modules/audio_output/tizen_audio.c
+++ b/modules/audio_output/tizen_audio.c
@@ -35,10 +35,6 @@
 #include "audio_io.h"
 #include "sound_manager.h"
 
-#if TIZEN_SDK_MAJOR >= 3 || (TIZEN_SDK_MAJOR >= 2 && TIZEN_SDK_MINOR >= 4)
-#define AUDIO_IO_HAS_FLUSH
-#endif
-
 static int  Open( vlc_object_t * );
 static void Close( vlc_object_t * );
 
@@ -53,6 +49,9 @@ struct aout_sys_t {
     unsigned int        i_rate;
     audio_sample_type_e i_sample_type;
     audio_channel_e     i_channel;
+
+    int (*pf_audio_out_drain)( audio_out_h output );
+    int (*pf_audio_out_flush)( audio_out_h output );
 };
 
 /* Soft volume helper */
@@ -276,19 +275,22 @@ Flush( audio_output_t *p_aout, bool b_wait )
     if( !p_sys->out )
         return;
 
-#ifdef AUDIO_IO_HAS_FLUSH
-    if( b_wait )
-        VLCRET( audio_out_drain( p_aout ) );
+    if( p_sys->pf_audio_out_drain || p_sys->pf_audio_out_flush )
+    {
+        if( b_wait )
+            VLCRET( p_sys->pf_audio_out_drain( p_sys->out ) );
+        else
+            VLCRET( p_sys->pf_audio_out_flush( p_sys->out ) );
+    }
     else
-        VLCRET( audio_out_flush( p_aout ) );
-#else
-    (void) b_wait;
-    if( AudioIO_Unprepare( p_aout ) )
-        return;
-    audio_out_destroy( p_sys->out );
-    p_sys->out = NULL;
-    AudioIO_Start( p_aout );
-#endif
+    {
+        (void) b_wait;
+        if( AudioIO_Unprepare( p_aout ) )
+            return;
+        audio_out_destroy( p_sys->out );
+        p_sys->out = NULL;
+        AudioIO_Start( p_aout );
+    }
 }
 
 static int
@@ -309,6 +311,10 @@ Open( vlc_object_t *obj )
     p_aout->flush = Flush;
     /* p_aout->time_get = TimeGet; FIXME */
 
+    /* Available only on 2.4 */
+    p_sys->pf_audio_out_drain = dlsym( RTLD_DEFAULT, "audio_out_drain" );
+    p_sys->pf_audio_out_flush = dlsym( RTLD_DEFAULT, "audio_out_flush" );
+
     aout_SoftVolumeInit( p_aout );
 
     return VLC_SUCCESS;



More information about the vlc-commits mailing list