[vlc-commits] Added libvlc_MediaPlayerVout event.

Laurent Aimar git at videolan.org
Mon Sep 5 19:52:28 CEST 2011


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Mon Sep  5 19:37:35 2011 +0200| [37f89f654417a8b5d60d1d07bd27184cf388c3c4] | committer: Laurent Aimar

Added libvlc_MediaPlayerVout event.

It is send on vout count changes (close #5277).

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

 include/vlc/libvlc_events.h |    5 +++++
 lib/media_player.c          |   19 +++++++++++++++++++
 2 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/include/vlc/libvlc_events.h b/include/vlc/libvlc_events.h
index 7b29541..7d27054 100644
--- a/include/vlc/libvlc_events.h
+++ b/include/vlc/libvlc_events.h
@@ -71,6 +71,7 @@ enum libvlc_event_e {
     libvlc_MediaPlayerTitleChanged,
     libvlc_MediaPlayerSnapshotTaken,
     libvlc_MediaPlayerLengthChanged,
+    libvlc_MediaPlayerVout,
 
     libvlc_MediaListItemAdded=0x200,
     libvlc_MediaListWillAddItem,
@@ -162,6 +163,10 @@ typedef struct libvlc_event_t
         {
             int new_pausable;
         } media_player_pausable_changed;
+        struct
+        {
+            int new_count;
+        } media_player_vout;
 
         /* media list */
         struct
diff --git a/lib/media_player.c b/lib/media_player.c
index 4b40730..88e151a 100644
--- a/lib/media_player.c
+++ b/lib/media_player.c
@@ -316,6 +316,25 @@ input_event_changed( vlc_object_t * p_this, char const * psz_cmd,
             var_GetFloat( p_input, "cache" ));
         libvlc_event_send( p_mi->p_event_manager, &event );
     }
+    else if( newval.i_int == INPUT_EVENT_VOUT )
+    {
+        vout_thread_t **pp_vout;
+        size_t i_vout;
+        if( input_Control( p_input, INPUT_GET_VOUTS, &pp_vout, &i_vout ) )
+        {
+            i_vout  = 0;
+        }
+        else
+        {
+            for( size_t i = 0; i < i_vout; i++ )
+                vlc_object_release( pp_vout[i] );
+            free( pp_vout );
+        }
+
+        event.type = libvlc_MediaPlayerVout;
+        event.u.media_player_vout.new_count = i_vout;
+        libvlc_event_send( p_mi->p_event_manager, &event );
+    }
 
     return VLC_SUCCESS;
 }



More information about the vlc-commits mailing list