[vlc-commits] player: add GetSelectedProgram() helper
Romain Vimont
git at videolan.org
Fri May 3 09:52:34 CEST 2019
vlc | branch: master | Romain Vimont <rom1v at videolabs.io> | Thu May 2 13:36:59 2019 +0200| [beeb4a1c37260aceb169c450418235a19ebef2db] | committer: Thomas Guillem
player: add GetSelectedProgram() helper
There were helpers for retrieving the selected title, chapter or track,
but a helper for the selected program was missing.
Signed-off-by: Thomas Guillem <thomas at gllm.fr>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=beeb4a1c37260aceb169c450418235a19ebef2db
---
include/vlc_player.h | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/include/vlc_player.h b/include/vlc_player.h
index ad170f3306..a055c842cc 100644
--- a/include/vlc_player.h
+++ b/include/vlc_player.h
@@ -1966,6 +1966,24 @@ VLC_API void
vlc_player_SelectPrevProgram(vlc_player_t *player);
/**
+ * Helper to get the current selected program
+ */
+static inline const struct vlc_player_program *
+vlc_player_GetSelectedProgram(vlc_player_t *player)
+{
+ size_t count = vlc_player_GetProgramCount(player);
+ for (size_t i = 0; i < count; ++i)
+ {
+ const struct vlc_player_program *program =
+ vlc_player_GetProgramAt(player, i);
+ assert(program);
+ if (program->selected)
+ return program;
+ }
+ return NULL;
+}
+
+/**
* Check if the media has a teletext menu
*
* @see vlc_player_cbs.on_teletext_menu_changed
More information about the vlc-commits
mailing list