[vlc-devel] [PATCH 2/2] libvlc: add a new event fired if the chapter changes

Felix Paul Kühne fkuehne at videolan.org
Tue Nov 24 16:58:39 CET 2015


---
 include/vlc/libvlc_events.h | 5 +++++
 lib/media_player.c          | 6 ++++++
 2 files changed, 11 insertions(+)

diff --git a/include/vlc/libvlc_events.h b/include/vlc/libvlc_events.h
index a770b06..4da43f6 100644
--- a/include/vlc/libvlc_events.h
+++ b/include/vlc/libvlc_events.h
@@ -83,6 +83,7 @@ enum libvlc_event_e {
     libvlc_MediaPlayerUnmuted,
     libvlc_MediaPlayerAudioVolume,
     libvlc_MediaPlayerAudioDevice,
+    libvlc_MediaPlayerChapterChanged,
 
     libvlc_MediaListItemAdded=0x200,
     libvlc_MediaListWillAddItem,
@@ -161,6 +162,10 @@ typedef struct libvlc_event_t
         } media_player_buffering;
         struct
         {
+            int new_chapter;
+        } media_player_chapter_changed;
+        struct
+        {
             float new_position;
         } media_player_position_changed;
         struct
diff --git a/lib/media_player.c b/lib/media_player.c
index cdbe432..8b6938c 100644
--- a/lib/media_player.c
+++ b/lib/media_player.c
@@ -372,6 +372,12 @@ input_event_changed( vlc_object_t * p_this, char const * psz_cmd,
         event.u.media_player_title_changed.new_title = var_GetInteger( p_input, "title" );
         libvlc_event_send( p_mi->p_event_manager, &event );
     }
+    else if ( newval.i_int == INPUT_EVENT_CHAPTER )
+    {
+        event.type = libvlc_MediaPlayerChapterChanged;
+        event.u.media_player_chapter_changed.new_chapter = var_GetInteger( p_input, "chapter" );
+        libvlc_event_send( p_mi->p_event_manager, &event );
+    }
 
     return VLC_SUCCESS;
 }
-- 
2.6.0



More information about the vlc-devel mailing list