1 /*****************************************************************************
2 * playlist.c: libvlc new API playlist handling functions
3 *****************************************************************************
4 * Copyright (C) 2005 the VideoLAN team
7 * Authors: Clément Stenac <zorglub@videolan.org>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22 *****************************************************************************/
24 #include <libvlc_internal.h>
25 #include <vlc/libvlc.h>
29 void libvlc_playlist_play( libvlc_instance_t *p_instance,
30 int i_options, char **ppsz_options,
31 libvlc_exception_t *p_exception )
33 ///\todo Handle additionnal options
35 if( p_instance->p_playlist->i_size == 0 )
37 libvlc_exception_raise( p_exception, "Empty playlist" );
40 playlist_Play( p_instance->p_playlist );
43 void libvlc_playlist_stop( libvlc_instance_t *p_instance,
44 libvlc_exception_t *p_exception )
46 if( playlist_Stop( p_instance->p_playlist ) != VLC_SUCCESS )
48 libvlc_exception_raise( p_exception, "Empty playlist" );
52 void libvlc_playlist_clear( libvlc_instance_t *p_instance,
53 libvlc_exception_t *p_exception )
55 playlist_Clear( p_instance->p_playlist );
59 libvlc_input_t * libvlc_playlist_get_input( libvlc_instance_t *p_instance,
60 libvlc_exception_t *p_exception )
62 libvlc_input_t *p_input;
64 vlc_mutex_lock( &p_instance->p_playlist->object_lock );
65 if( p_instance->p_playlist->p_input == NULL )
67 libvlc_exception_raise( p_exception, "No active input" );
68 vlc_mutex_unlock( &p_instance->p_playlist->object_lock );
71 p_input = (libvlc_input_t *)malloc( sizeof( libvlc_input_t ) );
73 p_input->i_input_id = p_instance->p_playlist->p_input->i_object_id;
74 p_input->p_instance = p_instance;
75 vlc_mutex_unlock( &p_instance->p_playlist->object_lock );