]> git.sesse.net Git - vlc/commitdiff
libvlc: do not depend on input thread to obtain the aout
authorRémi Denis-Courmont <remi@remlab.net>
Thu, 1 Nov 2012 16:16:27 +0000 (18:16 +0200)
committerRémi Denis-Courmont <remi@remlab.net>
Thu, 1 Nov 2012 16:59:09 +0000 (18:59 +0200)
The aout can exist even if the input thread is stopped. This makes
audio-related functions work in case where they would previously fail.

include/vlc_input.h
lib/audio.c
src/input/resource.h
src/libvlccore.sym

index a96c92d79da2d849ad2b45e7f156eee6a5493a86..7882b6c8e461e3cf9e7b9a01e5b55924979b95f3 100644 (file)
@@ -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
index e529954f95472993e96e9a44c5a1d44513f2c874..7ae1966ad6947a37b6c4339154b1e3a9b7632c98 100644 (file)
@@ -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;
index 915a1c417742b841b7a714429764d30f207ae195..f1ae4ef5dd18f22beab0f2e0081f8b89599496ad 100644 (file)
@@ -46,13 +46,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.
  */
index 01d4260cc0e9697284547b8bcbd2d692e39bf2c5..f54fc3c240d568916bb84bf8bed42d6acc1b1d77 100644 (file)
@@ -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