[vlc-devel] commit: libvlc: clean up libvlc_Stopped and vlc_to_libvlc_state usage. ( Jean-Paul Saman )
git version control
git at videolan.org
Tue Aug 4 11:10:01 CEST 2009
vlc | branch: master | Jean-Paul Saman <jean-paul.saman at m2x.nl> | Fri Jul 24 16:35:21 2009 +0200| [3ef6a48d577beb3cc945896941a9b5deb27bdd72] | committer: Jean-Paul Saman
libvlc: clean up libvlc_Stopped and vlc_to_libvlc_state usage.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3ef6a48d577beb3cc945896941a9b5deb27bdd72
---
src/control/media_player.c | 32 +++++++++++---------------------
1 files changed, 11 insertions(+), 21 deletions(-)
diff --git a/src/control/media_player.c b/src/control/media_player.c
index b314bde..a0e1175 100644
--- a/src/control/media_player.c
+++ b/src/control/media_player.c
@@ -57,23 +57,7 @@ input_event_changed( vlc_object_t * p_this, char const * psz_cmd,
static int SnapshotTakenCallback( vlc_object_t *p_this, char const *psz_cmd,
vlc_value_t oldval, vlc_value_t newval, void *p_data );
-static const libvlc_state_t vlc_to_libvlc_state_array[] =
-{
- [INIT_S] = libvlc_NothingSpecial,
- [OPENING_S] = libvlc_Opening,
- [PLAYING_S] = libvlc_Playing,
- [PAUSE_S] = libvlc_Paused,
- [END_S] = libvlc_Ended,
- [ERROR_S] = libvlc_Error,
-};
-
-static inline libvlc_state_t vlc_to_libvlc_state( int vlc_state )
-{
- if( vlc_state < 0 || vlc_state > 6 )
- return libvlc_Ended;
-
- return vlc_to_libvlc_state_array[vlc_state];
-}
+static void libvlc_media_player_destroy( libvlc_media_player_t *p_mi );
/*
* Release the associated input thread.
@@ -226,6 +210,14 @@ input_event_changed( vlc_object_t * p_this, char const * psz_cmd,
libvlc_media_set_state( p_mi->p_md, libvlc_state, NULL );
libvlc_event_send( p_mi->p_event_manager, &event );
}
+ else if( newval.i_int == INPUT_EVENT_ABORT )
+ {
+ libvlc_state_t libvlc_state = libvlc_Stopped;
+ event.type = libvlc_MediaPlayerStopped;
+
+ libvlc_media_set_state( p_mi->p_md, libvlc_state, NULL );
+ libvlc_event_send( p_mi->p_event_manager, &event );
+ }
else if( newval.i_int == INPUT_EVENT_POSITION )
{
if( var_GetInteger( p_input, "state" ) != PLAYING_S )
@@ -650,7 +642,7 @@ void libvlc_media_player_stop( libvlc_media_player_t *p_mi,
{
/* Send a stop notification event only if we are in playing,
* buffering or paused states */
- libvlc_media_set_state( p_mi->p_md, libvlc_Ended, p_e );
+ libvlc_media_set_state( p_mi->p_md, libvlc_Stopped, p_e );
/* Construct and send the event */
libvlc_event_t event;
@@ -1125,9 +1117,7 @@ libvlc_state_t libvlc_media_player_get_state(
return state;
}
- var_Get( p_input_thread, "state", &val );
- state = vlc_to_libvlc_state(val.i_int);
-
+ state = libvlc_media_get_state( p_mi->p_md, NULL );
if( state == libvlc_Playing )
{
float caching;
More information about the vlc-devel
mailing list