[vlc-commits] libvlc: media: deprecate libvlc_Buffering state

Thomas Guillem git at videolan.org
Tue Apr 12 09:33:41 CEST 2016


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Tue Apr 12 09:27:12 2016 +0200| [ec03185b0f27045ab10adf18648d1a62678261a6] | committer: Thomas Guillem

libvlc: media: deprecate libvlc_Buffering state

This state was never set or used. If it was set, it would have overridden the
media state since a media can be buffering while opening or during playback
(while seeking).

PS: Listen to the libvlc_MediaPlayerBuffering event if you want to know if a
media player is buffering.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ec03185b0f27045ab10adf18648d1a62678261a6
---

 include/vlc/libvlc_media.h |    6 ++++--
 lib/media_list_player.c    |    3 +--
 lib/media_player.c         |    9 +++------
 3 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/include/vlc/libvlc_media.h b/include/vlc/libvlc_media.h
index 3e7c637..20b28c6 100644
--- a/include/vlc/libvlc_media.h
+++ b/include/vlc/libvlc_media.h
@@ -85,14 +85,16 @@ typedef enum libvlc_meta_t {
  * and VideoLAN.LibVLC.State (at bindings/cil/src/media.cs).
  *
  * Expected states by web plugins are:
- * IDLE/CLOSE=0, OPENING=1, BUFFERING=2, PLAYING=3, PAUSED=4,
+ * IDLE/CLOSE=0, OPENING=1, PLAYING=3, PAUSED=4,
  * STOPPING=5, ENDED=6, ERROR=7
  */
 typedef enum libvlc_state_t
 {
     libvlc_NothingSpecial=0,
     libvlc_Opening,
-    libvlc_Buffering,
+    libvlc_Buffering, /* XXX: Deprecated value. Check the
+                       * libvlc_MediaPlayerBuffering event to know the
+                       * buffering state of a libvlc_media_player */
     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;
 }
 
 /**************************************************************************



More information about the vlc-commits mailing list