[vlc-commits] core: playlist: add OSD support

Victorien Le Couviour--Tuffet git at videolan.org
Thu Nov 15 17:29:15 CET 2018


vlc | branch: master | Victorien Le Couviour--Tuffet <victorien.lecouviour.tuffet at gmail.com> | Tue Nov 13 16:28:24 2018 +0100| [3db1fc281bc45a1996877db447ead3a045c2f31d] | committer: Thomas Guillem

core: playlist: add OSD support

Using the player OSD.

Signed-off-by: Thomas Guillem <thomas at gllm.fr>

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

 src/playlist/control.c | 31 +++++++++++++++++++++++++++++++
 src/playlist/player.h  |  7 +++++++
 2 files changed, 38 insertions(+)

diff --git a/src/playlist/control.c b/src/playlist/control.c
index 99c975bf64..b84fa6f2e1 100644
--- a/src/playlist/control.c
+++ b/src/playlist/control.c
@@ -27,6 +27,7 @@
 #include "item.h"
 #include "notify.h"
 #include "playlist.h"
+#include "player.h"
 
 static void
 vlc_playlist_PlaybackOrderChanged(vlc_playlist_t *playlist)
@@ -53,6 +54,19 @@ vlc_playlist_PlaybackOrderChanged(vlc_playlist_t *playlist)
 
     vlc_playlist_Notify(playlist, on_playback_order_changed, playlist->order);
     vlc_playlist_state_NotifyChanges(playlist, &state);
+
+    char const *state_text = NULL;
+    switch (playlist->order)
+    {
+        case VLC_PLAYLIST_PLAYBACK_ORDER_NORMAL:
+            state_text = N_("Off");
+            break;
+        case VLC_PLAYLIST_PLAYBACK_ORDER_RANDOM:
+            state_text = N_("On");
+            break;
+    }
+    vlc_playlist_PlayerOSDMessage(playlist,
+                                  _("Random: %s"), vlc_gettext(state_text));
 }
 
 static void
@@ -72,6 +86,21 @@ vlc_playlist_PlaybackRepeatChanged(vlc_playlist_t *playlist)
 
     vlc_playlist_Notify(playlist, on_playback_repeat_changed, playlist->repeat);
     vlc_playlist_state_NotifyChanges(playlist, &state);
+
+    char const *mode = NULL;
+    switch (playlist->repeat)
+    {
+        case VLC_PLAYLIST_PLAYBACK_REPEAT_NONE:
+            mode = N_("Off");
+            break;
+        case VLC_PLAYLIST_PLAYBACK_REPEAT_ALL:
+            mode = N_("All");
+            break;
+        case VLC_PLAYLIST_PLAYBACK_REPEAT_CURRENT:
+            mode = N_("One");
+            break;
+    }
+    vlc_playlist_PlayerOSDMessage(playlist, _("Loop: %s"), vlc_gettext(mode));
 }
 
 enum vlc_playlist_playback_repeat
@@ -335,6 +364,7 @@ vlc_playlist_Prev(vlc_playlist_t *playlist)
     }
 
     vlc_playlist_SetCurrentIndex(playlist, index);
+    vlc_playlist_PlayerOSDMessage(playlist, _("Previous"));
     return VLC_SUCCESS;
 }
 
@@ -362,6 +392,7 @@ vlc_playlist_Next(vlc_playlist_t *playlist)
     }
 
     vlc_playlist_SetCurrentIndex(playlist, index);
+    vlc_playlist_PlayerOSDMessage(playlist, _("Next"));
     return VLC_SUCCESS;
 }
 
diff --git a/src/playlist/player.h b/src/playlist/player.h
index f6f54b792d..2566890315 100644
--- a/src/playlist/player.h
+++ b/src/playlist/player.h
@@ -31,4 +31,11 @@ vlc_playlist_PlayerInit(vlc_playlist_t *playlist, vlc_object_t *parent);
 void
 vlc_playlist_PlayerDestroy(vlc_playlist_t *playlist);
 
+#ifdef TEST_PLAYLIST
+#define vlc_playlist_PlayerOSDMessage(playlist, fmt...)
+#else
+#define vlc_playlist_PlayerOSDMessage(playlist, fmt...) \
+    vlc_player_vout_OSDMessage(playlist->player, fmt)
+#endif
+
 #endif



More information about the vlc-commits mailing list