[vlc-devel] [PATCH 5/5] libvlc: player: use vlc_player
Rémi Denis-Courmont
remi at remlab.net
Thu May 9 18:48:56 CEST 2019
Le torstaina 9. toukokuuta 2019, 18.56.58 EEST Romain Vimont a écrit :
> Implement the old libvlc player API using the new vlc_player.
> ---
> lib/audio.c | 95 +--
> lib/media_player.c | 1518 +++++++++++++++--------------------
> lib/media_player_internal.h | 21 +-
> lib/video.c | 266 ++----
> 4 files changed, 763 insertions(+), 1137 deletions(-)
>
> diff --git a/lib/audio.c b/lib/audio.c
> index 751584d0f1..f5e4493138 100644
> --- a/lib/audio.c
> +++ b/lib/audio.c
> @@ -50,7 +50,7 @@ static audio_output_t *GetAOut( libvlc_media_player_t *mp
> ) {
> assert( mp != NULL );
>
> - audio_output_t *p_aout = input_resource_HoldAout( mp->input.p_resource
> ); + audio_output_t *p_aout = vlc_player_aout_Hold(mp->player);
> if( p_aout == NULL )
> libvlc_printerr( "No active audio output" );
> return p_aout;
> @@ -131,14 +131,6 @@ int libvlc_audio_output_set( libvlc_media_player_t *mp,
> const char *psz_name ) var_SetString( mp, "aout", value );
> free( value );
>
> - /* Forget the existing audio output */
> - input_resource_ResetAout(mp->input.p_resource);
> -
> - /* Create a new audio output */
> - audio_output_t *aout = input_resource_GetAout(mp->input.p_resource);
> - if( aout != NULL )
> - input_resource_PutAout(mp->input.p_resource, aout);
> -
> return 0;
> }
>
> @@ -340,16 +332,13 @@ int libvlc_audio_set_volume( libvlc_media_player_t
> *mp, int volume )
> ***************************************************************************
> **/ int libvlc_audio_get_track_count( libvlc_media_player_t *p_mi )
> {
> - input_thread_t *p_input_thread = libvlc_get_input_thread( p_mi );
> - int i_track_count;
> + vlc_player_t *player = p_mi->player;
> + vlc_player_Lock(player);
>
> - if( !p_input_thread )
> - return -1;
> + int ret = vlc_player_GetTrackCount(p_mi->player, AUDIO_ES);
>
> - i_track_count = var_CountChoices( p_input_thread, "audio-es" );
> -
> - input_Release(p_input_thread);
> - return i_track_count;
> + vlc_player_Unlock(player);
> + return ret;
> }
Application should (still) be allowed to call this, and most* other functions
further down the patch, from within event callbacks. But this leads to
deadlock or abort depending on build type.
* Exceptions exist such _stop(), which would necessarily deadlock.
--
雷米‧德尼-库尔蒙
http://www.remlab.net/
More information about the vlc-devel
mailing list