[vlc-commits] core: playlist: Make player calls mocks consistent

Romain Vimont git at videolan.org
Tue Nov 20 10:43:30 CET 2018


vlc | branch: master | Romain Vimont <rom1v at videolabs.io> | Fri Nov 16 12:14:14 2018 +0100| [f8f8358f80ef560898cf4c6d66bc2f4f383c896f] | committer: Thomas Guillem

core: playlist: Make player calls mocks consistent

Disable vlc_player_vout_OSDMessage() calls for tests the same way as the
other player calls, and silent unused variable warnings.

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

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

 src/playlist/control.c  | 23 ++++++++++++++---------
 src/playlist/player.h   |  7 -------
 src/playlist/playlist.h |  1 +
 3 files changed, 15 insertions(+), 16 deletions(-)

diff --git a/src/playlist/control.c b/src/playlist/control.c
index b84fa6f2e1..eb1ee18a52 100644
--- a/src/playlist/control.c
+++ b/src/playlist/control.c
@@ -65,8 +65,10 @@ vlc_playlist_PlaybackOrderChanged(vlc_playlist_t *playlist)
             state_text = N_("On");
             break;
     }
-    vlc_playlist_PlayerOSDMessage(playlist,
-                                  _("Random: %s"), vlc_gettext(state_text));
+    vlc_player_vout_OSDMessage(playlist->player,
+                               _("Random: %s"), vlc_gettext(state_text));
+    /* vlc_player_vout_OSDMessage() does nothing in tests */
+    VLC_UNUSED(state_text);
 }
 
 static void
@@ -87,20 +89,23 @@ 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;
+    char const *state_text = NULL;
     switch (playlist->repeat)
     {
         case VLC_PLAYLIST_PLAYBACK_REPEAT_NONE:
-            mode = N_("Off");
+            state_text = N_("Off");
             break;
         case VLC_PLAYLIST_PLAYBACK_REPEAT_ALL:
-            mode = N_("All");
+            state_text = N_("All");
             break;
         case VLC_PLAYLIST_PLAYBACK_REPEAT_CURRENT:
-            mode = N_("One");
+            state_text = N_("One");
             break;
     }
-    vlc_playlist_PlayerOSDMessage(playlist, _("Loop: %s"), vlc_gettext(mode));
+    vlc_player_vout_OSDMessage(playlist->player,
+                               _("Loop: %s"), vlc_gettext(state_text));
+    /* vlc_player_vout_OSDMessage() does nothing in tests */
+    VLC_UNUSED(state_text);
 }
 
 enum vlc_playlist_playback_repeat
@@ -364,7 +369,7 @@ vlc_playlist_Prev(vlc_playlist_t *playlist)
     }
 
     vlc_playlist_SetCurrentIndex(playlist, index);
-    vlc_playlist_PlayerOSDMessage(playlist, _("Previous"));
+    vlc_player_vout_OSDMessage(playlist->player, _("Previous"));
     return VLC_SUCCESS;
 }
 
@@ -392,7 +397,7 @@ vlc_playlist_Next(vlc_playlist_t *playlist)
     }
 
     vlc_playlist_SetCurrentIndex(playlist, index);
-    vlc_playlist_PlayerOSDMessage(playlist, _("Next"));
+    vlc_player_vout_OSDMessage(playlist->player, _("Next"));
     return VLC_SUCCESS;
 }
 
diff --git a/src/playlist/player.h b/src/playlist/player.h
index 2566890315..f6f54b792d 100644
--- a/src/playlist/player.h
+++ b/src/playlist/player.h
@@ -31,11 +31,4 @@ 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
diff --git a/src/playlist/playlist.h b/src/playlist/playlist.h
index 7af25b65bd..1090d2146b 100644
--- a/src/playlist/playlist.h
+++ b/src/playlist/playlist.h
@@ -39,6 +39,7 @@ typedef struct input_item_t input_item_t;
 # define vlc_player_RemoveListener(a,b) free(b)
 # define vlc_player_SetCurrentMedia(a,b) (VLC_UNUSED(b), VLC_SUCCESS)
 # define vlc_player_InvalidateNextMedia(p) VLC_UNUSED(p)
+# define vlc_player_vout_OSDMessage(p, fmt...) VLC_UNUSED(p)
 #endif /* TEST_PLAYLIST */
 
 typedef struct VLC_VECTOR(vlc_playlist_item_t *) playlist_item_vector_t;



More information about the vlc-commits mailing list