[vlc-devel] commit: Adding a libvlc_MediaPlayerLengthChanged event ( Hugo Beauzee-Luyssen )

git version control git at videolan.org
Thu May 14 20:16:57 CEST 2009


vlc | branch: master | Hugo Beauzee-Luyssen <beauze.h at gmail.com> | Thu May 14 14:52:32 2009 +0200| [a5b3becf4c21e8083bdda6cb96349022ad313ad3] | committer: Laurent Aimar 

Adding a libvlc_MediaPlayerLengthChanged event

Signed-off-by: Laurent Aimar <fenrir at videolan.org>

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

 include/vlc/libvlc_events.h |    6 ++++++
 src/control/media_player.c  |    9 +++++++++
 2 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/include/vlc/libvlc_events.h b/include/vlc/libvlc_events.h
index 1004989..57bb9a6 100644
--- a/include/vlc/libvlc_events.h
+++ b/include/vlc/libvlc_events.h
@@ -88,6 +88,7 @@ typedef enum libvlc_event_type_t {
 
     libvlc_MediaPlayerTitleChanged,
     libvlc_MediaPlayerSnapshotTaken,
+    libvlc_MediaPlayerLengthChanged,
     /* New event types HERE */
 } libvlc_event_type_t;
 
@@ -202,6 +203,11 @@ typedef struct libvlc_event_t
              char* psz_filename ;
         } media_player_snapshot_taken ;
 
+        /* Length changed */
+        struct
+        {
+            libvlc_time_t   new_length;
+        } media_player_length_changed;
     } u;
 } libvlc_event_t;
 
diff --git a/src/control/media_player.c b/src/control/media_player.c
index 41845ad..0ef1e65 100644
--- a/src/control/media_player.c
+++ b/src/control/media_player.c
@@ -232,6 +232,13 @@ input_event_changed( vlc_object_t * p_this, char const * psz_cmd,
                                                var_GetTime( p_input, "time" );
         libvlc_event_send( p_mi->p_event_manager, &event );
     }
+    else if( newval.i_int == INPUT_EVENT_LENGTH )
+    {
+        event.type = libvlc_MediaPlayerLengthChanged;
+        event.u.media_player_length_changed.new_length =
+                                               var_GetTime( p_input, "length" );
+        libvlc_event_send( p_mi->p_event_manager, &event );
+    }
 
     return VLC_SUCCESS;
 
@@ -314,6 +321,8 @@ libvlc_media_player_new( libvlc_instance_t * p_libvlc_instance,
     libvlc_event_manager_register_event_type( p_mi->p_event_manager,
             libvlc_MediaPlayerTimeChanged, p_e );
     libvlc_event_manager_register_event_type( p_mi->p_event_manager,
+            libvlc_MediaPlayerLengthChanged, p_e );
+    libvlc_event_manager_register_event_type( p_mi->p_event_manager,
             libvlc_MediaPlayerTitleChanged, p_e );
     libvlc_event_manager_register_event_type( p_mi->p_event_manager,
             libvlc_MediaPlayerSeekableChanged, p_e );




More information about the vlc-devel mailing list