[vlc-devel] [PATCH] libvlc: media: remove libvlc_Buffering state

Thomas Guillem thomas at gllm.fr
Fri Apr 8 18:44:32 CEST 2016



On Fri, Apr 8, 2016, at 18:28, Thomas Guillem wrote:
> This state was never set or used. If it was set, it would have overridden
> the
> media state. Indeed, a media can be buffering while opening or during
> playback
> (if you seek).
> 
> PS: Listen to the libvlc_MediaPlayerBuffering event if you want to know
> if a
> media player is buffering.
> 
> PPS: libvlc_Buffering is renamed to libvlc_Unused in order to don't break
> the
> API.

I mean, ABI. This commit break the API. We don't want that, right ? So I
should put a deprecated comment instead, no ?

> ---
>  include/vlc/libvlc_media.h | 2 +-
>  lib/media_list_player.c    | 3 +--
>  lib/media_player.c         | 9 +++------
>  3 files changed, 5 insertions(+), 9 deletions(-)
> 
> diff --git a/include/vlc/libvlc_media.h b/include/vlc/libvlc_media.h
> index 3e7c637..c1c0d6c 100644
> --- a/include/vlc/libvlc_media.h
> +++ b/include/vlc/libvlc_media.h
> @@ -92,7 +92,7 @@ typedef enum libvlc_state_t
>  {
>      libvlc_NothingSpecial=0,
>      libvlc_Opening,
> -    libvlc_Buffering,
> +    libvlc_Unused,
>      libvlc_Playing,
>      libvlc_Paused,
>      libvlc_Stopped,
> diff --git a/lib/media_list_player.c b/lib/media_list_player.c
> index a2c4875..6f4ecb0 100644
> --- a/lib/media_list_player.c
> +++ b/lib/media_list_player.c
> @@ -666,8 +666,7 @@ int
>  libvlc_media_list_player_is_playing(libvlc_media_list_player_t * p_mlp)
>  {
>      libvlc_state_t state = libvlc_media_player_get_state(p_mlp->p_mi);
> -    return (state == libvlc_Opening) || (state == libvlc_Buffering) ||
> -           (state == libvlc_Playing);
> +    return (state == libvlc_Opening) || (state == libvlc_Playing);
>  }
>  
>  /**************************************************************************
> diff --git a/lib/media_player.c b/lib/media_player.c
> index 2a8eb5f..4761fee 100644
> --- a/lib/media_player.c
> +++ b/lib/media_player.c
> @@ -954,7 +954,7 @@ void libvlc_media_player_set_pause(
> libvlc_media_player_t *p_mi, int paused )
>          return;
>  
>      libvlc_state_t state = libvlc_media_player_get_state( p_mi );
> -    if( state == libvlc_Playing || state == libvlc_Buffering )
> +    if( state == libvlc_Playing )
>      {
>          if( paused )
>          {
> @@ -978,10 +978,7 @@ void libvlc_media_player_set_pause(
> libvlc_media_player_t *p_mi, int paused )
>   **************************************************************************/
>  void libvlc_media_player_pause( libvlc_media_player_t *p_mi )
>  {
> -    libvlc_state_t state = libvlc_media_player_get_state( p_mi );
> -    bool playing = (state == libvlc_Playing || state ==
> libvlc_Buffering);
> -
> -    libvlc_media_player_set_pause( p_mi, playing );
> +    libvlc_media_player_set_pause( p_mi, libvlc_media_player_is_playing(
> p_mi ) );
>  }
>  
>  /**************************************************************************
> @@ -992,7 +989,7 @@ void libvlc_media_player_pause( libvlc_media_player_t
> *p_mi )
>  int libvlc_media_player_is_playing( libvlc_media_player_t *p_mi )
>  {
>      libvlc_state_t state = libvlc_media_player_get_state( p_mi );
> -    return (libvlc_Playing == state) || (libvlc_Buffering == state);
> +    return libvlc_Playing == state;
>  }
>  
>  /**************************************************************************
> -- 
> 2.8.0.rc3
> 
> _______________________________________________
> 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