Add some playlist api functions

Fix a bug in exceptions handling
This commit is contained in:
Clément Stenac 2006-02-12 17:31:39 +00:00
parent 6d4e213788
commit 711b5da24a
2 changed files with 39 additions and 0 deletions

View File

@ -39,6 +39,7 @@ void libvlc_exception_clear( libvlc_exception_t *p_exception )
{
if( p_exception->psz_message )
free( p_exception->psz_message );
p_exception->psz_message = NULL;
p_exception->b_raised = 0;
}

View File

@ -90,6 +90,24 @@ void libvlc_playlist_clear( libvlc_instance_t *p_instance,
playlist_Clear( p_instance->p_playlist );
}
void libvlc_playlist_next( libvlc_instance_t *p_instance,
libvlc_exception_t *p_exception )
{
if( playlist_Next( p_instance->p_playlist ) != VLC_SUCCESS )
{
libvlc_exception_raise( p_exception, "Empty playlist" );
}
}
void libvlc_playlist_prev( libvlc_instance_t *p_instance,
libvlc_exception_t *p_exception )
{
if( playlist_Prev( p_instance->p_playlist ) != VLC_SUCCESS )
{
libvlc_exception_raise( p_exception, "Empty playlist" );
}
}
int libvlc_playlist_add( libvlc_instance_t *p_instance, const char *psz_uri,
const char *psz_name, libvlc_exception_t *p_exception )
{
@ -107,7 +125,27 @@ int libvlc_playlist_add_extended( libvlc_instance_t *p_instance,
i_options );
}
int libvlc_playlist_isplaying( libvlc_instance_t *p_instance,
libvlc_exception_t *p_exception )
{
if( !p_instance->p_playlist )
{
libvlc_exception_raise( p_exception, "No playlist" );
return 0;
}
return playlist_IsPlaying( p_instance->p_playlist );
}
int libvlc_playlist_items_count( libvlc_instance_t *p_instance,
libvlc_exception_t *p_exception )
{
if( !p_instance->p_playlist )
{
libvlc_exception_raise( p_exception, "No playlist" );
return 0;
}
return p_instance->p_playlist->i_size;
}
libvlc_input_t * libvlc_playlist_get_input( libvlc_instance_t *p_instance,
libvlc_exception_t *p_exception )