Commit 934b28d9 authored by Pierre d'Herbemont's avatar Pierre d'Herbemont

libvlc: Remove exception from media_list_player.

parent db14d090
...@@ -59,7 +59,6 @@ typedef enum libvlc_playback_mode_t ...@@ -59,7 +59,6 @@ typedef enum libvlc_playback_mode_t
* Create new media_list_player. * Create new media_list_player.
* *
* \param p_instance libvlc instance * \param p_instance libvlc instance
* \param p_e initialized exception instance
* \return media list player instance or NULL on error * \return media list player instance or NULL on error
*/ */
VLC_PUBLIC_API libvlc_media_list_player_t * VLC_PUBLIC_API libvlc_media_list_player_t *
...@@ -86,7 +85,6 @@ VLC_PUBLIC_API libvlc_event_manager_t * ...@@ -86,7 +85,6 @@ VLC_PUBLIC_API libvlc_event_manager_t *
* *
* \param p_mlp media list player instance * \param p_mlp media list player instance
* \param p_mi media player instance * \param p_mi media player instance
* \param p_e initialized exception instance
*/ */
VLC_PUBLIC_API void VLC_PUBLIC_API void
libvlc_media_list_player_set_media_player( libvlc_media_list_player_set_media_player(
...@@ -102,27 +100,22 @@ VLC_PUBLIC_API void ...@@ -102,27 +100,22 @@ VLC_PUBLIC_API void
* Play media list * Play media list
* *
* \param p_mlp media list player instance * \param p_mlp media list player instance
* \param p_e initialized exception instance
*/ */
VLC_PUBLIC_API void VLC_PUBLIC_API
libvlc_media_list_player_play( libvlc_media_list_player_t * p_mlp, void libvlc_media_list_player_play(libvlc_media_list_player_t * p_mlp);
libvlc_exception_t * p_e );
/** /**
* Pause media list * Pause media list
* *
* \param p_mlp media list player instance * \param p_mlp media list player instance
* \param p_e initialized exception instance
*/ */
VLC_PUBLIC_API void VLC_PUBLIC_API
libvlc_media_list_player_pause( libvlc_media_list_player_t * p_mlp, void libvlc_media_list_player_pause(libvlc_media_list_player_t * p_mlp);
libvlc_exception_t * p_e );
/** /**
* Is media list playing? * Is media list playing?
* *
* \param p_mlp media list player instance * \param p_mlp media list player instance
* \param p_e initialized exception instance
* \return true for playing and false for not playing * \return true for playing and false for not playing
*/ */
VLC_PUBLIC_API int VLC_PUBLIC_API int
...@@ -142,19 +135,15 @@ VLC_PUBLIC_API libvlc_state_t ...@@ -142,19 +135,15 @@ VLC_PUBLIC_API libvlc_state_t
* *
* \param p_mlp media list player instance * \param p_mlp media list player instance
* \param i_index index in media list to play * \param i_index index in media list to play
* \param p_e initialized exception instance * \return 0 upon success -1 if the item wasn't found
*/ */
VLC_PUBLIC_API void VLC_PUBLIC_API
libvlc_media_list_player_play_item_at_index( int libvlc_media_list_player_play_item_at_index(libvlc_media_list_player_t * p_mlp,
libvlc_media_list_player_t * p_mlp, int i_index);
int i_index,
libvlc_exception_t * p_e );
VLC_PUBLIC_API void VLC_PUBLIC_API
libvlc_media_list_player_play_item( int libvlc_media_list_player_play_item(libvlc_media_list_player_t * p_mlp,
libvlc_media_list_player_t * p_mlp, libvlc_media_t * p_md);
libvlc_media_t * p_md,
libvlc_exception_t * p_e );
/** /**
* Stop playing media list * Stop playing media list
...@@ -162,27 +151,25 @@ VLC_PUBLIC_API void ...@@ -162,27 +151,25 @@ VLC_PUBLIC_API void
* \param p_mlp media list player instance * \param p_mlp media list player instance
*/ */
VLC_PUBLIC_API void VLC_PUBLIC_API void
libvlc_media_list_player_stop( libvlc_media_list_player_t * p_mlp ); libvlc_media_list_player_stop( libvlc_media_list_player_t * p_mlp);
/** /**
* Play next item from media list * Play next item from media list
* *
* \param p_mlp media list player instance * \param p_mlp media list player instance
* \param p_e initialized exception instance * \return 0 upon success -1 if there is no next item
*/ */
VLC_PUBLIC_API void VLC_PUBLIC_API
libvlc_media_list_player_next( libvlc_media_list_player_t * p_mlp, int libvlc_media_list_player_next(libvlc_media_list_player_t * p_mlp);
libvlc_exception_t * p_e );
/** /**
* Play previous item from media list * Play previous item from media list
* *
* \param p_mlp media list player instance * \param p_mlp media list player instance
* \param p_e initialized exception instance * \return 0 upon success -1 if there is no previous item
*/ */
VLC_PUBLIC_API void VLC_PUBLIC_API
libvlc_media_list_player_previous( libvlc_media_list_player_t * p_mlp, int libvlc_media_list_player_previous(libvlc_media_list_player_t * p_mlp);
libvlc_exception_t * p_e );
...@@ -192,10 +179,9 @@ VLC_PUBLIC_API void ...@@ -192,10 +179,9 @@ VLC_PUBLIC_API void
* \param p_mlp media list player instance * \param p_mlp media list player instance
* \param e_mode playback mode specification * \param e_mode playback mode specification
*/ */
VLC_PUBLIC_API void VLC_PUBLIC_API
libvlc_media_list_player_set_playback_mode( void libvlc_media_list_player_set_playback_mode(libvlc_media_list_player_t * p_mlp,
libvlc_media_list_player_t * p_mlp, libvlc_playback_mode_t e_mode );
libvlc_playback_mode_t e_mode );
/** @} media_list_player */ /** @} media_list_player */
......
...@@ -104,7 +104,7 @@ ...@@ -104,7 +104,7 @@
{ {
libvlc_exception_t ex; libvlc_exception_t ex;
libvlc_exception_init(&ex); libvlc_exception_init(&ex);
libvlc_media_list_player_play_item(instance, [media libVLCMediaDescriptor], &ex); libvlc_media_list_player_play_item(instance, [media libVLCMediaDescriptor]);
catch_exception(&ex); catch_exception(&ex);
} }
...@@ -112,7 +112,7 @@ ...@@ -112,7 +112,7 @@
{ {
libvlc_exception_t ex; libvlc_exception_t ex;
libvlc_exception_init(&ex); libvlc_exception_init(&ex);
libvlc_media_list_player_play(instance, &ex); libvlc_media_list_player_play(instance);
catch_exception(&ex); catch_exception(&ex);
} }
......
...@@ -80,10 +80,9 @@ static inline void vlc_assert_locked(vlc_mutex_t *mutex) ...@@ -80,10 +80,9 @@ static inline void vlc_assert_locked(vlc_mutex_t *mutex)
* Forward declaration * Forward declaration
*/ */
static void set_relative_playlist_position_and_play( static
libvlc_media_list_player_t * p_mlp, int set_relative_playlist_position_and_play(libvlc_media_list_player_t *p_mlp,
int i_relative_position, int i_relative_position);
libvlc_exception_t * p_e);
static void stop(libvlc_media_list_player_t * p_mlp); static void stop(libvlc_media_list_player_t * p_mlp);
/* /*
...@@ -328,16 +327,11 @@ media_player_reached_end(const libvlc_event_t * p_event, void * p_user_data) ...@@ -328,16 +327,11 @@ media_player_reached_end(const libvlc_event_t * p_event, void * p_user_data)
{ {
VLC_UNUSED(p_event); VLC_UNUSED(p_event);
libvlc_media_list_player_t * p_mlp = p_user_data; libvlc_media_list_player_t * p_mlp = p_user_data;
libvlc_exception_t e;
libvlc_exception_init(&e);
vlc_mutex_lock(&p_mlp->mp_callback_lock); vlc_mutex_lock(&p_mlp->mp_callback_lock);
if (!p_mlp->are_mp_callback_cancelled) if (!p_mlp->are_mp_callback_cancelled)
set_relative_playlist_position_and_play(p_mlp, 1, &e); set_relative_playlist_position_and_play(p_mlp, 1);
vlc_mutex_unlock(&p_mlp->mp_callback_lock); vlc_mutex_unlock(&p_mlp->mp_callback_lock);
// There is no point in reporting an error from this callback
libvlc_exception_clear(&e);
} }
/************************************************************************** /**************************************************************************
...@@ -578,12 +572,12 @@ void libvlc_media_list_player_set_media_list(libvlc_media_list_player_t * p_mlp, ...@@ -578,12 +572,12 @@ void libvlc_media_list_player_set_media_list(libvlc_media_list_player_t * p_mlp,
/************************************************************************** /**************************************************************************
* Play (Public) * Play (Public)
**************************************************************************/ **************************************************************************/
void libvlc_media_list_player_play(libvlc_media_list_player_t * p_mlp, libvlc_exception_t * p_e) void libvlc_media_list_player_play(libvlc_media_list_player_t * p_mlp)
{ {
lock(p_mlp); lock(p_mlp);
if (!p_mlp->current_playing_item_path) if (!p_mlp->current_playing_item_path)
{ {
set_relative_playlist_position_and_play(p_mlp, 1, p_e); set_relative_playlist_position_and_play(p_mlp, 1);
unlock(p_mlp); unlock(p_mlp);
return; /* Will set to play */ return; /* Will set to play */
} }
...@@ -595,7 +589,7 @@ void libvlc_media_list_player_play(libvlc_media_list_player_t * p_mlp, libvlc_ex ...@@ -595,7 +589,7 @@ void libvlc_media_list_player_play(libvlc_media_list_player_t * p_mlp, libvlc_ex
/************************************************************************** /**************************************************************************
* Pause (Public) * Pause (Public)
**************************************************************************/ **************************************************************************/
void libvlc_media_list_player_pause(libvlc_media_list_player_t * p_mlp, libvlc_exception_t * p_e) void libvlc_media_list_player_pause(libvlc_media_list_player_t * p_mlp)
{ {
lock(p_mlp); lock(p_mlp);
if (!p_mlp->p_mi) if (!p_mlp->p_mi)
...@@ -632,7 +626,7 @@ libvlc_media_list_player_get_state(libvlc_media_list_player_t * p_mlp) ...@@ -632,7 +626,7 @@ libvlc_media_list_player_get_state(libvlc_media_list_player_t * p_mlp)
/************************************************************************** /**************************************************************************
* Play item at index (Public) * Play item at index (Public)
**************************************************************************/ **************************************************************************/
void libvlc_media_list_player_play_item_at_index(libvlc_media_list_player_t * p_mlp, int i_index, libvlc_exception_t *p_e) int libvlc_media_list_player_play_item_at_index(libvlc_media_list_player_t * p_mlp, int i_index)
{ {
lock(p_mlp); lock(p_mlp);
set_current_playing_item(p_mlp, libvlc_media_list_path_with_root_index(i_index)); set_current_playing_item(p_mlp, libvlc_media_list_path_with_root_index(i_index));
...@@ -643,26 +637,27 @@ void libvlc_media_list_player_play_item_at_index(libvlc_media_list_player_t * p_ ...@@ -643,26 +637,27 @@ void libvlc_media_list_player_play_item_at_index(libvlc_media_list_player_t * p_
libvlc_event_t event; libvlc_event_t event;
event.type = libvlc_MediaListPlayerNextItemSet; event.type = libvlc_MediaListPlayerNextItemSet;
libvlc_event_send(p_mlp->p_event_manager, &event); libvlc_event_send(p_mlp->p_event_manager, &event);
return 0;
} }
/************************************************************************** /**************************************************************************
* Play item (Public) * Play item (Public)
**************************************************************************/ **************************************************************************/
void libvlc_media_list_player_play_item(libvlc_media_list_player_t * p_mlp, libvlc_media_t * p_md, libvlc_exception_t * p_e) int libvlc_media_list_player_play_item(libvlc_media_list_player_t * p_mlp, libvlc_media_t * p_md)
{ {
lock(p_mlp); lock(p_mlp);
libvlc_media_list_path_t path = libvlc_media_list_path_of_item(p_mlp->p_mlist, p_md); libvlc_media_list_path_t path = libvlc_media_list_path_of_item(p_mlp->p_mlist, p_md);
if (!path) if (!path)
{ {
libvlc_exception_raise(p_e);
libvlc_printerr("Item not found in media list"); libvlc_printerr("Item not found in media list");
unlock(p_mlp); unlock(p_mlp);
return; return -1;
} }
set_current_playing_item(p_mlp, path); set_current_playing_item(p_mlp, path);
libvlc_media_player_play(p_mlp->p_mi); libvlc_media_player_play(p_mlp->p_mi);
unlock(p_mlp); unlock(p_mlp);
return 0;
} }
/************************************************************************** /**************************************************************************
...@@ -703,18 +698,16 @@ void libvlc_media_list_player_stop(libvlc_media_list_player_t * p_mlp) ...@@ -703,18 +698,16 @@ void libvlc_media_list_player_stop(libvlc_media_list_player_t * p_mlp)
* (based on the currently playing item) and then begins the new item playback. * (based on the currently playing item) and then begins the new item playback.
* Lock must be held. * Lock must be held.
**************************************************************************/ **************************************************************************/
static void set_relative_playlist_position_and_play( static int set_relative_playlist_position_and_play(
libvlc_media_list_player_t * p_mlp, libvlc_media_list_player_t * p_mlp,
int i_relative_position, int i_relative_position)
libvlc_exception_t * p_e)
{ {
assert_locked(p_mlp); assert_locked(p_mlp);
if (!p_mlp->p_mlist) if (!p_mlp->p_mlist)
{ {
libvlc_exception_raise(p_e);
libvlc_printerr("No media list"); libvlc_printerr("No media list");
return; return -1;
} }
libvlc_media_list_lock(p_mlp->p_mlist); libvlc_media_list_lock(p_mlp->p_mlist);
...@@ -759,7 +752,7 @@ static void set_relative_playlist_position_and_play( ...@@ -759,7 +752,7 @@ static void set_relative_playlist_position_and_play(
if (!path) if (!path)
{ {
libvlc_media_list_unlock(p_mlp->p_mlist); libvlc_media_list_unlock(p_mlp->p_mlist);
return; return -1;
} }
libvlc_media_player_play(p_mlp->p_mi); libvlc_media_player_play(p_mlp->p_mi);
...@@ -778,23 +771,23 @@ static void set_relative_playlist_position_and_play( ...@@ -778,23 +771,23 @@ static void set_relative_playlist_position_and_play(
/************************************************************************** /**************************************************************************
* Next (Public) * Next (Public)
**************************************************************************/ **************************************************************************/
void libvlc_media_list_player_next(libvlc_media_list_player_t * p_mlp, int libvlc_media_list_player_next(libvlc_media_list_player_t * p_mlp)
libvlc_exception_t * p_e)
{ {
lock(p_mlp); lock(p_mlp);
set_relative_playlist_position_and_play(p_mlp, 1, p_e); int failure = set_relative_playlist_position_and_play(p_mlp, 1);
unlock(p_mlp); unlock(p_mlp);
return failure;
} }
/************************************************************************** /**************************************************************************
* Previous (Public) * Previous (Public)
**************************************************************************/ **************************************************************************/
void libvlc_media_list_player_previous(libvlc_media_list_player_t * p_mlp, int libvlc_media_list_player_previous(libvlc_media_list_player_t * p_mlp)
libvlc_exception_t * p_e)
{ {
lock(p_mlp); lock(p_mlp);
set_relative_playlist_position_and_play(p_mlp, -1, p_e); int failure = set_relative_playlist_position_and_play(p_mlp, -1);
unlock(p_mlp); unlock(p_mlp);
return failure;
} }
/************************************************************************** /**************************************************************************
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment