[vlc-commits] libvlc: add libvlc_MediaPlayerTitleListChanged event

Thomas Guillem git at videolan.org
Mon May 4 10:08:54 CEST 2020


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Tue Apr 28 13:45:38 2020 +0200| [d0dc667f278bfc495bd387597410f610f132d4f9] | committer: Thomas Guillem

libvlc: add libvlc_MediaPlayerTitleListChanged event

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

 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 f1a5974d15..73bddb9de9 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,



More information about the vlc-commits mailing list