Commit ee1330c4 authored by Tanguy Krotoff's avatar Tanguy Krotoff Committed by Pierre d'Herbemont

libvlc: add libvlc_MediaInstanceStopped

Signed-off-by: default avatarPierre d'Herbemont <pdherbemont@videolan.org>
parent be3c7a5f
...@@ -60,7 +60,7 @@ public class MediaInstanceCallback implements LibVlcCallback ...@@ -60,7 +60,7 @@ public class MediaInstanceCallback implements LibVlcCallback
{ {
listener.paused(mediaInstance); listener.paused(mediaInstance);
} }
else if (libvlc_event.type == LibVlcEventType.libvlc_MediaInstanceReachedEnd.ordinal()) else if (libvlc_event.type == LibVlcEventType.libvlc_MediaInstanceEndReached.ordinal())
{ {
listener.endReached(mediaInstance); listener.endReached(mediaInstance);
} }
......
...@@ -36,7 +36,8 @@ public enum LibVlcEventType { ...@@ -36,7 +36,8 @@ public enum LibVlcEventType {
libvlc_MediaDescriptorStateChanged, libvlc_MediaDescriptorStateChanged,
libvlc_MediaInstancePlayed, libvlc_MediaInstancePlayed,
libvlc_MediaInstancePaused, libvlc_MediaInstancePaused,
libvlc_MediaInstanceReachedEnd, libvlc_MediaInstanceEndReached,
libvlc_MediaInstanceStopped,
libvlc_MediaInstanceEncounteredError, libvlc_MediaInstanceEncounteredError,
libvlc_MediaInstanceTimeChanged, libvlc_MediaInstanceTimeChanged,
libvlc_MediaInstancePositionChanged; libvlc_MediaInstancePositionChanged;
......
...@@ -98,11 +98,11 @@ public class LibVlcImpl ...@@ -98,11 +98,11 @@ public class LibVlcImpl
libVlc.libvlc_event_attach( libVlc.libvlc_event_attach(
mediaInstanceEventManager, mediaInstanceEventManager,
LibVlcEventType.libvlc_MediaInstanceReachedEnd.ordinal(), LibVlcEventType.libvlc_MediaInstanceEndReached.ordinal(),
endReached, endReached,
null, null,
exception); exception);
JFrame frame = new JFrame("title"); JFrame frame = new JFrame("title");
frame.setVisible(true); frame.setVisible(true);
frame.setLocation(100, 100); frame.setLocation(100, 100);
......
...@@ -49,7 +49,8 @@ typedef enum libvlc_event_type_t { ...@@ -49,7 +49,8 @@ typedef enum libvlc_event_type_t {
libvlc_MediaInstancePlayed, libvlc_MediaInstancePlayed,
libvlc_MediaInstancePaused, libvlc_MediaInstancePaused,
libvlc_MediaInstanceReachedEnd, libvlc_MediaInstanceEndReached,
libvlc_MediaInstanceStopped,
libvlc_MediaInstanceEncounteredError, libvlc_MediaInstanceEncounteredError,
libvlc_MediaInstanceTimeChanged, libvlc_MediaInstanceTimeChanged,
libvlc_MediaInstancePositionChanged, libvlc_MediaInstancePositionChanged,
......
...@@ -92,7 +92,7 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void * ...@@ -92,7 +92,7 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void *
newState = VLCMediaPlayerStatePlaying; newState = VLCMediaPlayerStatePlaying;
else if( event->type == libvlc_MediaInstancePaused ) else if( event->type == libvlc_MediaInstancePaused )
newState = VLCMediaPlayerStatePaused; newState = VLCMediaPlayerStatePaused;
else if( event->type == libvlc_MediaInstanceReachedEnd ) else if( event->type == libvlc_MediaInstanceEndReached )
newState = VLCMediaPlayerStateStopped; newState = VLCMediaPlayerStateStopped;
else if( event->type == libvlc_MediaInstanceEncounteredError ) else if( event->type == libvlc_MediaInstanceEncounteredError )
newState = VLCMediaPlayerStateError; newState = VLCMediaPlayerStateError;
...@@ -642,7 +642,7 @@ static const VLCMediaPlayerState libvlc_to_local_state[] = ...@@ -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_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_MediaInstancePlayed, HandleMediaInstanceStateChanged, self, &ex );
libvlc_event_attach( p_em, libvlc_MediaInstancePaused, 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 */ /* 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_MediaInstancePositionChanged, HandleMediaPositionChanged, self, &ex );
libvlc_event_attach( p_em, libvlc_MediaInstanceTimeChanged, HandleMediaTimeChanged, self, &ex ); libvlc_event_attach( p_em, libvlc_MediaInstanceTimeChanged, HandleMediaTimeChanged, self, &ex );
...@@ -654,7 +654,7 @@ static const VLCMediaPlayerState libvlc_to_local_state[] = ...@@ -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_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_MediaInstancePlayed, HandleMediaInstanceStateChanged, self, NULL );
libvlc_event_detach( p_em, libvlc_MediaInstancePaused, 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_MediaInstancePositionChanged, HandleMediaPositionChanged, self, NULL );
libvlc_event_detach( p_em, libvlc_MediaInstanceTimeChanged, HandleMediaTimeChanged, self, NULL ); libvlc_event_detach( p_em, libvlc_MediaInstanceTimeChanged, HandleMediaTimeChanged, self, NULL );
} }
......
...@@ -263,7 +263,8 @@ static const char * event_type_to_name[] = ...@@ -263,7 +263,8 @@ static const char * event_type_to_name[] =
EVENT(libvlc_MediaInstancePlayed), EVENT(libvlc_MediaInstancePlayed),
EVENT(libvlc_MediaInstancePaused), EVENT(libvlc_MediaInstancePaused),
EVENT(libvlc_MediaInstanceReachedEnd), EVENT(libvlc_MediaInstanceEndReached),
EVENT(libvlc_MediaInstanceStopped),
EVENT(libvlc_MediaInstanceTimeChanged), EVENT(libvlc_MediaInstanceTimeChanged),
EVENT(libvlc_MediaInstancePositionChanged), EVENT(libvlc_MediaInstancePositionChanged),
......
...@@ -170,7 +170,7 @@ static void ...@@ -170,7 +170,7 @@ static void
install_media_player_observer( libvlc_media_list_player_t * p_mlp ) 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_event_attach( libvlc_media_player_event_manager( p_mlp->p_mi, NULL ),
libvlc_MediaInstanceReachedEnd, libvlc_MediaInstanceEndReached,
media_player_reached_end, p_mlp, NULL ); media_player_reached_end, p_mlp, NULL );
} }
...@@ -185,9 +185,9 @@ uninstall_media_player_observer( libvlc_media_list_player_t * p_mlp ) ...@@ -185,9 +185,9 @@ uninstall_media_player_observer( libvlc_media_list_player_t * p_mlp )
{ {
return; return;
} }
libvlc_event_detach( libvlc_media_player_event_manager( p_mlp->p_mi, NULL ), libvlc_event_detach( libvlc_media_player_event_manager( p_mlp->p_mi, NULL ),
libvlc_MediaInstanceReachedEnd, libvlc_MediaInstanceEndReached,
media_player_reached_end, p_mlp, NULL ); media_player_reached_end, p_mlp, NULL );
} }
......
...@@ -149,7 +149,7 @@ input_state_changed( vlc_object_t * p_this, char const * psz_cmd, ...@@ -149,7 +149,7 @@ input_state_changed( vlc_object_t * p_this, char const * psz_cmd,
{ {
case END_S: case END_S:
libvlc_media_set_state( p_mi->p_md, libvlc_NothingSpecial, NULL); libvlc_media_set_state( p_mi->p_md, libvlc_NothingSpecial, NULL);
event.type = libvlc_MediaInstanceReachedEnd; event.type = libvlc_MediaInstanceEndReached;
break; break;
case PAUSE_S: case PAUSE_S:
libvlc_media_set_state( p_mi->p_md, libvlc_Playing, NULL); 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, ...@@ -314,9 +314,11 @@ libvlc_media_player_new( libvlc_instance_t * p_libvlc_instance,
free( p_mi ); free( p_mi );
return NULL; 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_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_event_manager_register_event_type( p_mi->p_event_manager,
libvlc_MediaInstanceEncounteredError, p_e ); libvlc_MediaInstanceEncounteredError, p_e );
libvlc_event_manager_register_event_type( p_mi->p_event_manager, 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, ...@@ -641,6 +643,12 @@ void libvlc_media_player_stop( libvlc_media_player_t *p_mi,
input_StopThread( p_input_thread ); input_StopThread( p_input_thread );
vlc_object_release( 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 );
} }
/************************************************************************** /**************************************************************************
......
...@@ -247,7 +247,8 @@ static void test_events (const char ** argv, int argc) ...@@ -247,7 +247,8 @@ static void test_events (const char ** argv, int argc)
libvlc_event_type_t mi_events[] = { libvlc_event_type_t mi_events[] = {
libvlc_MediaInstancePlayed, libvlc_MediaInstancePlayed,
libvlc_MediaInstancePaused, libvlc_MediaInstancePaused,
libvlc_MediaInstanceReachedEnd, libvlc_MediaInstanceEndReached,
libvlc_MediaInstanceStopped,
libvlc_MediaInstanceEncounteredError, libvlc_MediaInstanceEncounteredError,
libvlc_MediaInstanceTimeChanged, libvlc_MediaInstanceTimeChanged,
libvlc_MediaInstancePositionChanged, libvlc_MediaInstancePositionChanged,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment