[vlc-devel] [PATCH 3/3] libvlc: add libvlc_MediaPlayerTitleListChanged event
Thomas Guillem
thomas at gllm.fr
Tue Apr 28 13:46:46 CEST 2020
---
include/vlc/libvlc_events.h | 5 +++++
lib/media_player.c | 16 ++++++++++++++++
2 files changed, 21 insertions(+)
diff --git a/include/vlc/libvlc_events.h b/include/vlc/libvlc_events.h
index 167e4f00c1..20508eb8a3 100644
--- a/include/vlc/libvlc_events.h
+++ b/include/vlc/libvlc_events.h
@@ -119,6 +119,11 @@ enum libvlc_event_e {
libvlc_MediaPlayerUnmuted,
libvlc_MediaPlayerAudioVolume,
libvlc_MediaPlayerAudioDevice,
+ /**
+ * The title list changed, call
+ * libvlc_media_player_get_full_title_descriptions() to get the new list.
+ */
+ libvlc_MediaPlayerTitleListChanged,
/**
* The title selection changed, cf media_player_title_selection_changed in
* \ref libvlc_event_t.u
diff --git a/lib/media_player.c b/lib/media_player.c
index 271c244740..68e6e62b1a 100644
--- a/lib/media_player.c
+++ b/lib/media_player.c
@@ -332,6 +332,21 @@ on_program_selection_changed(vlc_player_t *player, int unselected_id,
libvlc_event_send(&mp->event_manager, &event);
}
+static void
+on_titles_changed(vlc_player_t *player,
+ vlc_player_title_list *titles, void *data)
+{
+ (void) player;
+ (void) titles;
+
+ libvlc_media_player_t *mp = data;
+
+ libvlc_event_t event;
+ event.type = libvlc_MediaPlayerTitleListChanged;
+
+ libvlc_event_send(&mp->event_manager, &event);
+}
+
static void
on_title_selection_changed(vlc_player_t *player,
const struct vlc_player_title *new_title,
@@ -490,6 +505,7 @@ static const struct vlc_player_cbs vlc_player_cbs = {
.on_track_selection_changed = on_track_selection_changed,
.on_program_list_changed = on_program_list_changed,
.on_program_selection_changed = on_program_selection_changed,
+ .on_titles_changed = on_titles_changed,
.on_title_selection_changed = on_title_selection_changed,
.on_chapter_selection_changed = on_chapter_selection_changed,
.on_media_subitems_changed = on_media_subitems_changed,
--
2.20.1
More information about the vlc-devel
mailing list