X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fcontrol%2Fplaylist.c;h=79f274cda5757fe50a677005e1ac9d836776f2d6;hb=55abf4ec4b9b010438d83a4b925f7f8fec4270cc;hp=f08ad122ef4da45895bf436df53b3fef6bc66a6d;hpb=f0531d5b038ed279e206a3deeae9e70f243a6704;p=vlc diff --git a/src/control/playlist.c b/src/control/playlist.c index f08ad122ef..79f274cda5 100644 --- a/src/control/playlist.c +++ b/src/control/playlist.c @@ -21,135 +21,31 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/ -#include +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include "libvlc_internal.h" +#include "libvlc.h" + +#include #include +#include +#include +#include -#include +#include #include -#define PL p_instance->p_libvlc_int->p_playlist - void libvlc_playlist_play( libvlc_instance_t *p_instance, int i_id, - int i_options, char **ppsz_options, - libvlc_exception_t *p_e ) -{ - assert( PL ); - ///\todo Handle additionnal options - - if( PL->i_size == 0 ) RAISEVOID( "Empty playlist" ); - if( i_id > 0 ) - { - playlist_item_t *p_item = playlist_ItemGetById( PL, - i_id ); - if( !p_item ) RAISEVOID( "Unable to find item" ); - - playlist_LockControl( PL, PLAYLIST_VIEWPLAY, - PL->status.p_node, p_item ); - } - else - { - playlist_Play( PL ); - } -} - -void libvlc_playlist_pause( libvlc_instance_t *p_instance, - libvlc_exception_t *p_e ) -{ - assert( PL ); - if( playlist_Pause( PL ) != VLC_SUCCESS ) - RAISEVOID( "Empty playlist" ); -} - - -void libvlc_playlist_stop( libvlc_instance_t *p_instance, - libvlc_exception_t *p_e ) -{ - assert( PL ); - if( playlist_Stop( PL ) != VLC_SUCCESS ) - RAISEVOID( "Empty playlist" ); -} - -void libvlc_playlist_clear( libvlc_instance_t *p_instance, - libvlc_exception_t *p_e ) -{ - assert( PL ); - playlist_Clear( PL ); -} - -void libvlc_playlist_next( libvlc_instance_t *p_instance, - libvlc_exception_t *p_e ) -{ - assert( PL ); - if( playlist_Next( PL ) != VLC_SUCCESS ) - RAISEVOID( "Empty playlist" ); -} - -void libvlc_playlist_prev( libvlc_instance_t *p_instance, - libvlc_exception_t *p_e ) + int i_options, char **ppsz_options ) { - if( playlist_Prev( PL ) != VLC_SUCCESS ) - RAISEVOID( "Empty playlist" ); -} - -int libvlc_playlist_add( libvlc_instance_t *p_instance, const char *psz_uri, - const char *psz_name, libvlc_exception_t *p_e ) -{ - return libvlc_playlist_add_extended( p_instance, psz_uri, psz_name, - 0, NULL, p_e ); -} - -int libvlc_playlist_add_extended( libvlc_instance_t *p_instance, - const char *psz_uri, const char *psz_name, - int i_options, const char **ppsz_options, - libvlc_exception_t *p_e ) -{ - assert( PL ); - return playlist_PlaylistAddExt( PL, psz_uri, psz_name, - PLAYLIST_INSERT, PLAYLIST_END, -1, ppsz_options, - i_options ); -} - -int libvlc_playlist_delete_item( libvlc_instance_t *p_instance, int i_id, - libvlc_exception_t *p_e ) -{ - assert( PL ); - return playlist_DeleteFromItemId( PL, i_id ); -} - - -int libvlc_playlist_isplaying( libvlc_instance_t *p_instance, - libvlc_exception_t *p_e ) -{ - assert( PL ); - return playlist_IsPlaying( PL ); -} - -int libvlc_playlist_items_count( libvlc_instance_t *p_instance, - libvlc_exception_t *p_e ) -{ - assert( PL ); - return PL->i_size; -} - -libvlc_input_t * libvlc_playlist_get_input( libvlc_instance_t *p_instance, - libvlc_exception_t *p_e ) -{ - libvlc_input_t *p_input; - assert( PL ); - - vlc_mutex_lock( &PL->object_lock ); - if( PL->p_input == NULL ) - { - libvlc_exception_raise( p_e, "No active input" ); - vlc_mutex_unlock( &PL->object_lock ); - return NULL; - } - p_input = (libvlc_input_t *)malloc( sizeof( libvlc_input_t ) ); - - p_input->i_input_id = PL->p_input->i_object_id; - p_input->p_instance = p_instance; - vlc_mutex_unlock( &PL->object_lock ); + playlist_t *pl = libvlc_priv (p_instance->p_libvlc_int)->p_playlist; + VLC_UNUSED(i_id); VLC_UNUSED(i_options); VLC_UNUSED(ppsz_options); - return p_input; + assert( pl ); + if( pl->items.i_size == 0 ) + return; + playlist_Control( pl, PLAYLIST_PLAY, false ); }