/*****************************************************************************
* media_list_player.c: libvlc new API media_list player functions
*****************************************************************************
- * Copyright (C) 2007 the VideoLAN team
+ * Copyright (C) 2007 VLC authors and VideoLAN
* $Id$
*
* Authors: Pierre d'Herbemont <pdherbemont # videolan.org>
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifdef HAVE_CONFIG_H
p_mlp->i_refcount = 1;
vlc_mutex_init(&p_mlp->object_lock);
vlc_mutex_init(&p_mlp->mp_callback_lock);
- libvlc_event_manager_register_event_type(p_mlp->p_event_manager, libvlc_MediaListPlayerNextItemSet);
+ libvlc_event_manager_register_event_type( p_mlp->p_event_manager,
+ libvlc_MediaListPlayerNextItemSet );
+ libvlc_event_manager_register_event_type( p_mlp->p_event_manager,
+ libvlc_MediaListPlayerStopped );
+ libvlc_event_manager_register_event_type( p_mlp->p_event_manager,
+ libvlc_MediaListPlayerPlayed );
p_mlp->e_playback_mode = libvlc_playback_mode_default;
return p_mlp;
int libvlc_media_list_player_play_item_at_index(libvlc_media_list_player_t * p_mlp, int i_index)
{
lock(p_mlp);
- set_current_playing_item(p_mlp, libvlc_media_list_path_with_root_index(i_index));
+ libvlc_media_list_path_t path = libvlc_media_list_path_with_root_index(i_index);
+ set_current_playing_item(p_mlp, path);
libvlc_media_player_play(p_mlp->p_mi);
unlock(p_mlp);
/* Send the next item event */
libvlc_event_t event;
event.type = libvlc_MediaListPlayerNextItemSet;
+ libvlc_media_t * p_md = libvlc_media_list_item_at_path(p_mlp->p_mlist, path);
+ event.u.media_list_player_next_item_set.item = p_md;
libvlc_event_send(p_mlp->p_event_manager, &event);
+ libvlc_media_release(p_md);
return 0;
}
free(p_mlp->current_playing_item_path);
p_mlp->current_playing_item_path = NULL;
+
+ /* Send the event */
+ libvlc_event_t event;
+ event.type = libvlc_MediaListPlayerStopped;
+ libvlc_event_send(p_mlp->p_event_manager, &event);
}
/**************************************************************************
if (!path)
{
libvlc_media_list_unlock(p_mlp->p_mlist);
+ /* Send list played event */
+ libvlc_event_t event;
+ event.type = libvlc_MediaListPlayerPlayed;
+ libvlc_event_send(p_mlp->p_event_manager, &event);
return -1;
}