[vlc-devel] [PATCH 1/2] player: stop: return a status

Steve Lhomme robux4 at ycbcr.xyz
Thu Nov 7 12:46:15 CET 2019


both LGTM

On 2019-11-07 11:42, Thomas Guillem wrote:
> In order to notify the user if he should wait for the stopped event.
> ---
>   include/vlc_player.h | 8 +++++---
>   src/player/player.c  | 6 +++---
>   2 files changed, 8 insertions(+), 6 deletions(-)
> 
> diff --git a/include/vlc_player.h b/include/vlc_player.h
> index db19966080e..3e382db2484 100644
> --- a/include/vlc_player.h
> +++ b/include/vlc_player.h
> @@ -443,12 +443,14 @@ vlc_player_Start(vlc_player_t *player);
>   /**
>    * Stop the playback of the current media
>    *
> - * @note This function is asynchronous. Users should wait on
> - * STOPPED state event to know when the stop is finished.
> + * @note This function is asynchronous. In case of success, the user should wait
> + * for the STOPPED state event to know when the stop is finished.
>    *
>    * @param player locked player instance
> + * @return VLC_SUCCESS if the player is being stopped, VLC_EGENERIC otherwise
> + * (no-op)
>    */
> -VLC_API void
> +VLC_API int
>   vlc_player_Stop(vlc_player_t *player);
>   
>   /**
> diff --git a/src/player/player.c b/src/player/player.c
> index 22dad216cc7..d624f7e3456 100644
> --- a/src/player/player.c
> +++ b/src/player/player.c
> @@ -1148,7 +1148,7 @@ vlc_player_Start(vlc_player_t *player)
>       return ret;
>   }
>   
> -void
> +int
>   vlc_player_Stop(vlc_player_t *player)
>   {
>       struct vlc_player_input *input = vlc_player_get_input_locked(player);
> @@ -1158,12 +1158,12 @@ vlc_player_Stop(vlc_player_t *player)
>       vlc_player_InvalidateNextMedia(player);
>   
>       if (!input || !player->started)
> -        return;
> +        return VLC_EGENERIC;
>       player->started = false;
>   
>       vlc_player_destructor_AddInput(player, input);
>       player->input = NULL;
> -
> +    return VLC_SUCCESS;
>   }
>   
>   void
> -- 
> 2.20.1
> 
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
> 


More information about the vlc-devel mailing list