[vlc-commits] libvlc: do not depend on input thread to obtain the aout

Rémi Denis-Courmont git at videolan.org
Thu Nov 1 18:26:11 CET 2012


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu Nov  1 18:16:27 2012 +0200| [4251a30f52fb1d29de02c298ec74dff13079850f] | committer: Rémi Denis-Courmont

libvlc: do not depend on input thread to obtain the aout

The aout can exist even if the input thread is stopped. This makes
audio-related functions work in case where they would previously fail.

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

 include/vlc_input.h  |    6 ++++++
 lib/audio.c          |    7 +------
 src/input/resource.h |    7 -------
 src/libvlccore.sym   |    1 +
 4 files changed, 8 insertions(+), 13 deletions(-)

diff --git a/include/vlc_input.h b/include/vlc_input.h
index a96c92d..7882b6c 100644
--- a/include/vlc_input.h
+++ b/include/vlc_input.h
@@ -669,4 +669,10 @@ VLC_API void input_resource_TerminateVout( input_resource_t * );
  */
 VLC_API void input_resource_Terminate( input_resource_t * );
 
+/**
+ * \return the current audio output if any.
+ * Use vlc_object_release() to drop the reference.
+ */
+VLC_API audio_output_t *input_resource_HoldAout( input_resource_t * );
+
 #endif
diff --git a/lib/audio.c b/lib/audio.c
index e529954..7ae1966 100644
--- a/lib/audio.c
+++ b/lib/audio.c
@@ -50,12 +50,7 @@ static audio_output_t *GetAOut( libvlc_media_player_t *mp )
 {
     assert( mp != NULL );
 
-    input_thread_t *p_input = libvlc_get_input_thread( mp );
-    if( p_input == NULL )
-        return NULL;
-
-    audio_output_t * p_aout = input_GetAout( p_input );
-    vlc_object_release( p_input );
+    audio_output_t *p_aout = input_resource_HoldAout( mp->input.p_resource );
     if( p_aout == NULL )
         libvlc_printerr( "No active audio output" );
     return p_aout;
diff --git a/src/input/resource.h b/src/input/resource.h
index 915a1c4..f1ae4ef 100644
--- a/src/input/resource.h
+++ b/src/input/resource.h
@@ -47,13 +47,6 @@ audio_output_t *input_resource_GetAout( input_resource_t * );
 void input_resource_PutAout( input_resource_t *, audio_output_t * );
 
 /**
- * This function returns the current aout if any.
- *
- * You must call vlc_object_release on the value returned (if non NULL).
- */
-audio_output_t *input_resource_HoldAout( input_resource_t *p_resource );
-
-/**
  * This function handles vout request.
  */
 vout_thread_t *input_resource_RequestVout( input_resource_t *, vout_thread_t *, video_format_t *, unsigned dpb_size, bool b_recycle );
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index 01d4260..f54fc3c 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -208,6 +208,7 @@ input_resource_New
 input_resource_Release
 input_resource_TerminateVout
 input_resource_Terminate
+input_resource_HoldAout
 input_Start
 input_Stop
 input_vaControl



More information about the vlc-commits mailing list