[vlc-devel] [PATCH] libvlc: libvlc_MediaInstanceStopped replaces libvlc_MediaInstanceReachedEnd
Tanguy Krotoff
tkrotoff at gmail.com
Mon Mar 31 01:25:01 CEST 2008
---
include/vlc/libvlc_events.h | 2 +-
src/control/event.c | 2 +-
src/control/media_list_player.c | 4 ++--
src/control/media_player.c | 10 ++++++++--
src/control/testapi.c | 2 +-
5 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/include/vlc/libvlc_events.h b/include/vlc/libvlc_events.h
index fe7f2e0..3dccfdd 100644
--- a/include/vlc/libvlc_events.h
+++ b/include/vlc/libvlc_events.h
@@ -49,7 +49,7 @@ typedef enum libvlc_event_type_t {
libvlc_MediaInstancePlayed,
libvlc_MediaInstancePaused,
- libvlc_MediaInstanceReachedEnd,
+ libvlc_MediaInstanceStopped,
libvlc_MediaInstanceEncounteredError,
libvlc_MediaInstanceTimeChanged,
libvlc_MediaInstancePositionChanged,
diff --git a/src/control/event.c b/src/control/event.c
index cf5999c..0803c5e 100644
--- a/src/control/event.c
+++ b/src/control/event.c
@@ -263,7 +263,7 @@ static const char * event_type_to_name[] =
EVENT(libvlc_MediaInstancePlayed),
EVENT(libvlc_MediaInstancePaused),
- EVENT(libvlc_MediaInstanceReachedEnd),
+ EVENT(libvlc_MediaInstanceStopped),
EVENT(libvlc_MediaInstanceTimeChanged),
EVENT(libvlc_MediaInstancePositionChanged),
diff --git a/src/control/media_list_player.c b/src/control/media_list_player.c
index 4db4c86..c19d0d7 100644
--- a/src/control/media_list_player.c
+++ b/src/control/media_list_player.c
@@ -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_MediaInstanceStopped,
media_player_reached_end, p_mlp, NULL );
}
@@ -187,7 +187,7 @@ uninstall_media_player_observer( libvlc_media_list_player_t * p_mlp )
}
libvlc_event_detach( libvlc_media_player_event_manager( p_mlp->p_mi, NULL ),
- libvlc_MediaInstanceReachedEnd,
+ libvlc_MediaInstanceStopped,
media_player_reached_end, p_mlp, NULL );
}
diff --git a/src/control/media_player.c b/src/control/media_player.c
index f8968a5..7bd9e5c 100644
--- a/src/control/media_player.c
+++ b/src/control/media_player.c
@@ -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_MediaInstanceStopped;
break;
case PAUSE_S:
libvlc_media_set_state( p_mi->p_md, libvlc_Playing, NULL);
@@ -316,7 +316,7 @@ libvlc_media_player_new( libvlc_instance_t * p_libvlc_instance,
}
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 +641,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_NothingSpecial, NULL);
+ event.type = libvlc_MediaInstanceStopped;
+ libvlc_event_send( p_mi->p_event_manager, &event );
}
/**************************************************************************
diff --git a/src/control/testapi.c b/src/control/testapi.c
index bb61fd4..e03ee91 100644
--- a/src/control/testapi.c
+++ b/src/control/testapi.c
@@ -247,7 +247,7 @@ static void test_events (const char ** argv, int argc)
libvlc_event_type_t mi_events[] = {
libvlc_MediaInstancePlayed,
libvlc_MediaInstancePaused,
- libvlc_MediaInstanceReachedEnd,
+ libvlc_MediaInstanceStopped,
libvlc_MediaInstanceEncounteredError,
libvlc_MediaInstanceTimeChanged,
libvlc_MediaInstancePositionChanged,
--
1.5.4.3
More information about the vlc-devel
mailing list