]> git.sesse.net Git - vlc/commitdiff
libvlc: add libvlc_MediaInstanceStopped
authorTanguy Krotoff <tkrotoff@gmail.com>
Mon, 31 Mar 2008 04:35:07 +0000 (06:35 +0200)
committerPierre d'Herbemont <pdherbemont@videolan.org>
Mon, 31 Mar 2008 10:18:44 +0000 (12:18 +0200)
Signed-off-by: Pierre d'Herbemont <pdherbemont@videolan.org>
bindings/java/core/src/main/java/org/videolan/jvlc/event/MediaInstanceCallback.java
bindings/java/core/src/main/java/org/videolan/jvlc/internal/LibVlcEventType.java
bindings/java/core/src/main/java/org/videolan/jvlc/internal/LibVlcImpl.java
include/vlc/libvlc_events.h
projects/macosx/framework/Sources/VLCMediaPlayer.m
src/control/event.c
src/control/media_list_player.c
src/control/media_player.c
src/control/testapi.c

index ab1aa0ef22097176b79ef2d604b3fe367730ce63..8c36e68d37897c26747c8ae102e55381e447dd2d 100644 (file)
@@ -60,7 +60,7 @@ public class MediaInstanceCallback implements LibVlcCallback
         {
             listener.paused(mediaInstance);
         }
-        else if (libvlc_event.type == LibVlcEventType.libvlc_MediaInstanceReachedEnd.ordinal())
+        else if (libvlc_event.type == LibVlcEventType.libvlc_MediaInstanceEndReached.ordinal())
         {
             listener.endReached(mediaInstance);
         }
index 776c84bc6bb4a8cde08948cff75144a287accac0..32615d01bf3e644a62e37d4404c9b7ee993a67fe 100644 (file)
@@ -36,7 +36,8 @@ public enum LibVlcEventType {
     libvlc_MediaDescriptorStateChanged,
     libvlc_MediaInstancePlayed,
     libvlc_MediaInstancePaused,
-    libvlc_MediaInstanceReachedEnd,
+    libvlc_MediaInstanceEndReached,
+    libvlc_MediaInstanceStopped,
     libvlc_MediaInstanceEncounteredError,
     libvlc_MediaInstanceTimeChanged,
     libvlc_MediaInstancePositionChanged;
index ae976551ab26c3af11b3ce9d9bad86db36aa5063..d9467c770576bf607a7ad5505fee6118b0cb3358 100644 (file)
@@ -98,11 +98,11 @@ public class LibVlcImpl
 
         libVlc.libvlc_event_attach(
             mediaInstanceEventManager,
-            LibVlcEventType.libvlc_MediaInstanceReachedEnd.ordinal(),
+            LibVlcEventType.libvlc_MediaInstanceEndReached.ordinal(),
             endReached,
             null,
             exception);
-        
+
         JFrame frame = new JFrame("title");
         frame.setVisible(true);
         frame.setLocation(100, 100);
index fe7f2e057cdfc6546edeb3c0b85b286ad5b2c8b9..cba64a3b52240e3f5206c18406aca350ee345873 100644 (file)
@@ -49,7 +49,8 @@ typedef enum libvlc_event_type_t {
 
     libvlc_MediaInstancePlayed,
     libvlc_MediaInstancePaused,
-    libvlc_MediaInstanceReachedEnd,
+    libvlc_MediaInstanceEndReached,
+    libvlc_MediaInstanceStopped,
     libvlc_MediaInstanceEncounteredError,
     libvlc_MediaInstanceTimeChanged,
     libvlc_MediaInstancePositionChanged,
index ba8d7971417b9a98a622090d1d7e3f1372059885..fd5111cb29c9fe2a2d376072723ec2609df65f47 100644 (file)
@@ -92,7 +92,7 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void *
         newState = VLCMediaPlayerStatePlaying;
     else if( event->type == libvlc_MediaInstancePaused )
         newState = VLCMediaPlayerStatePaused;
-    else if( event->type == libvlc_MediaInstanceReachedEnd )
+    else if( event->type == libvlc_MediaInstanceEndReached )
         newState = VLCMediaPlayerStateStopped;
     else if( event->type == libvlc_MediaInstanceEncounteredError )
         newState = VLCMediaPlayerStateError;
@@ -642,7 +642,7 @@ static const VLCMediaPlayerState libvlc_to_local_state[] =
     libvlc_event_manager_t * p_em = libvlc_media_player_event_manager( instance, &ex );
     libvlc_event_attach( p_em, libvlc_MediaInstancePlayed,          HandleMediaInstanceStateChanged, self, &ex );
     libvlc_event_attach( p_em, libvlc_MediaInstancePaused,          HandleMediaInstanceStateChanged, self, &ex );
-    libvlc_event_attach( p_em, libvlc_MediaInstanceReachedEnd,      HandleMediaInstanceStateChanged, self, &ex );
+    libvlc_event_attach( p_em, libvlc_MediaInstanceEndReached,      HandleMediaInstanceStateChanged, self, &ex );
     /* FIXME: We may want to turn that off when none is interested by that */
     libvlc_event_attach( p_em, libvlc_MediaInstancePositionChanged, HandleMediaPositionChanged,      self, &ex );
     libvlc_event_attach( p_em, libvlc_MediaInstanceTimeChanged,     HandleMediaTimeChanged,          self, &ex );
@@ -654,7 +654,7 @@ static const VLCMediaPlayerState libvlc_to_local_state[] =
     libvlc_event_manager_t * p_em = libvlc_media_player_event_manager( instance, NULL );
     libvlc_event_detach( p_em, libvlc_MediaInstancePlayed,          HandleMediaInstanceStateChanged, self, NULL );
     libvlc_event_detach( p_em, libvlc_MediaInstancePaused,          HandleMediaInstanceStateChanged, self, NULL );
-    libvlc_event_detach( p_em, libvlc_MediaInstanceReachedEnd,      HandleMediaInstanceStateChanged, self, NULL );
+    libvlc_event_detach( p_em, libvlc_MediaInstanceEndReached,      HandleMediaInstanceStateChanged, self, NULL );
     libvlc_event_detach( p_em, libvlc_MediaInstancePositionChanged, HandleMediaPositionChanged,      self, NULL );
     libvlc_event_detach( p_em, libvlc_MediaInstanceTimeChanged,     HandleMediaTimeChanged,          self, NULL );
 }
index cf5999c0a9172bec073a4008c9161c545cf43828..b98f14ca01cae1b2f36e7e44a0b358e5945d7288 100644 (file)
@@ -263,7 +263,8 @@ static const char * event_type_to_name[] =
 
     EVENT(libvlc_MediaInstancePlayed),
     EVENT(libvlc_MediaInstancePaused),
-    EVENT(libvlc_MediaInstanceReachedEnd),
+    EVENT(libvlc_MediaInstanceEndReached),
+    EVENT(libvlc_MediaInstanceStopped),
     EVENT(libvlc_MediaInstanceTimeChanged),
     EVENT(libvlc_MediaInstancePositionChanged),
 
index 4db4c86ccafb79b0c0140443991f5e09243d7e0b..89f1155357bd4a66d7c8f42b8edb2b455241f8ce 100644 (file)
@@ -170,7 +170,7 @@ static void
 install_media_player_observer( libvlc_media_list_player_t * p_mlp )
 {
     libvlc_event_attach( libvlc_media_player_event_manager( p_mlp->p_mi, NULL ),
-                         libvlc_MediaInstanceReachedEnd,
+                         libvlc_MediaInstanceEndReached,
                           media_player_reached_end, p_mlp, NULL );
 }
 
@@ -185,9 +185,9 @@ uninstall_media_player_observer( libvlc_media_list_player_t * p_mlp )
     {
         return;
     }
-        
+
     libvlc_event_detach( libvlc_media_player_event_manager( p_mlp->p_mi, NULL ),
-                         libvlc_MediaInstanceReachedEnd,
+                         libvlc_MediaInstanceEndReached,
                          media_player_reached_end, p_mlp, NULL );
 }
 
index f8968a51fb5b43fce5220bbbad7566332d099b8c..bc026a94a0c2ad659cb29f3e5c11f1566345116c 100644 (file)
@@ -149,7 +149,7 @@ input_state_changed( vlc_object_t * p_this, char const * psz_cmd,
     {
         case END_S:
             libvlc_media_set_state( p_mi->p_md, libvlc_NothingSpecial, NULL);
-            event.type = libvlc_MediaInstanceReachedEnd;
+            event.type = libvlc_MediaInstanceEndReached;
             break;
         case PAUSE_S:
             libvlc_media_set_state( p_mi->p_md, libvlc_Playing, NULL);
@@ -314,9 +314,11 @@ libvlc_media_player_new( libvlc_instance_t * p_libvlc_instance,
         free( p_mi );
         return NULL;
     }
+
+    libvlc_event_manager_register_event_type( p_mi->p_event_manager,
+            libvlc_MediaInstanceEndReached, p_e );
     libvlc_event_manager_register_event_type( p_mi->p_event_manager,
-            libvlc_MediaInstanceReachedEnd, p_e );
+            libvlc_MediaInstanceStopped, p_e );
     libvlc_event_manager_register_event_type( p_mi->p_event_manager,
             libvlc_MediaInstanceEncounteredError, p_e );
     libvlc_event_manager_register_event_type( p_mi->p_event_manager,
@@ -641,6 +643,12 @@ void libvlc_media_player_stop( libvlc_media_player_t *p_mi,
         input_StopThread( p_input_thread );
         vlc_object_release( p_input_thread );
     }
+
+    /* Send a stop notification event */
+    libvlc_event_t event;
+    libvlc_media_set_state( p_mi->p_md, libvlc_Stopped, NULL);
+    event.type = libvlc_MediaInstanceStopped;
+    libvlc_event_send( p_mi->p_event_manager, &event );
 }
 
 /**************************************************************************
index bb61fd49f1c9f0fc4d3a48dd1f615bd94fa98f83..c779fff397d9c76a381c33e496109d923acc790a 100644 (file)
@@ -247,7 +247,8 @@ static void test_events (const char ** argv, int argc)
     libvlc_event_type_t mi_events[] = {
         libvlc_MediaInstancePlayed,
         libvlc_MediaInstancePaused,
-        libvlc_MediaInstanceReachedEnd,
+        libvlc_MediaInstanceEndReached,
+        libvlc_MediaInstanceStopped,
         libvlc_MediaInstanceEncounteredError,
         libvlc_MediaInstanceTimeChanged,
         libvlc_MediaInstancePositionChanged,