Commit 4251a30f authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont
Browse files

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.
parent e1eb563f
...@@ -669,4 +669,10 @@ VLC_API void input_resource_TerminateVout( input_resource_t * ); ...@@ -669,4 +669,10 @@ VLC_API void input_resource_TerminateVout( input_resource_t * );
*/ */
VLC_API void input_resource_Terminate( 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 #endif
...@@ -50,12 +50,7 @@ static audio_output_t *GetAOut( libvlc_media_player_t *mp ) ...@@ -50,12 +50,7 @@ static audio_output_t *GetAOut( libvlc_media_player_t *mp )
{ {
assert( mp != NULL ); assert( mp != NULL );
input_thread_t *p_input = libvlc_get_input_thread( mp ); audio_output_t *p_aout = input_resource_HoldAout( mp->input.p_resource );
if( p_input == NULL )
return NULL;
audio_output_t * p_aout = input_GetAout( p_input );
vlc_object_release( p_input );
if( p_aout == NULL ) if( p_aout == NULL )
libvlc_printerr( "No active audio output" ); libvlc_printerr( "No active audio output" );
return p_aout; return p_aout;
......
...@@ -46,13 +46,6 @@ audio_output_t *input_resource_GetAout( input_resource_t * ); ...@@ -46,13 +46,6 @@ audio_output_t *input_resource_GetAout( input_resource_t * );
*/ */
void input_resource_PutAout( input_resource_t *, audio_output_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. * This function handles vout request.
*/ */
......
...@@ -208,6 +208,7 @@ input_resource_New ...@@ -208,6 +208,7 @@ input_resource_New
input_resource_Release input_resource_Release
input_resource_TerminateVout input_resource_TerminateVout
input_resource_Terminate input_resource_Terminate
input_resource_HoldAout
input_Start input_Start
input_Stop input_Stop
input_vaControl input_vaControl
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment