/*****************************************************************************
* event.c: New libvlc event control API
*****************************************************************************
- * Copyright (C) 2007-2010 the VideoLAN team
+ * Copyright (C) 2007-2010 VLC authors and VideoLAN
* $Id $
*
* Authors: Filippo Carone <filippo@carone.org>
* 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
/* Fill event with the sending object now */
p_event->p_obj = p_em->p_obj;
- /* Here a read/write lock would be nice */
-
+ vlc_mutex_lock( &p_em->event_sending_lock );
vlc_mutex_lock( &p_em->object_lock );
for( i = 0; i < vlc_array_count(&p_em->listeners_groups); i++)
{
if( !array_listeners_cached )
{
vlc_mutex_unlock( &p_em->object_lock );
+ vlc_mutex_unlock( &p_em->event_sending_lock );
fprintf(stderr, "Can't alloc memory in libvlc_event_send" );
return;
}
{
free( array_listeners_cached );
vlc_mutex_unlock( &p_em->object_lock );
+ vlc_mutex_unlock( &p_em->event_sending_lock );
return;
}
+ /* Track item removed from *this* thread, with a simple flag. Indeed
+ * event_sending_lock is a recursive lock. This has the advantage of
+ * allowing to remove an event listener from within a callback */
+ listeners_group->b_sublistener_removed = false;
+
vlc_mutex_unlock( &p_em->object_lock );
- vlc_mutex_lock( &p_em->event_sending_lock );
listener_cached = array_listeners_cached;
- listeners_group->b_sublistener_removed = false;
for( i = 0; i < i_cached_listeners; i++ )
{
if(listener_cached->is_asynchronous)
DEF(MediaParsedChanged)
DEF(MediaFreed)
DEF(MediaStateChanged)
+ DEF(MediaSubItemTreeAdded)
DEF(MediaPlayerMediaChanged)
DEF(MediaPlayerNothingSpecial)
DEF(MediaPlayerTitleChanged)
DEF(MediaPlayerSnapshotTaken)
DEF(MediaPlayerLengthChanged)
+ DEF(MediaPlayerVout)
+ DEF(MediaPlayerScrambledChanged)
+ DEF(MediaPlayerESAdded)
+ DEF(MediaPlayerESDeleted)
+ DEF(MediaPlayerESSelected)
DEF(MediaListItemAdded)
DEF(MediaListWillAddItem)
DEF(VlmMediaInstanceStopped)
DEF(VlmMediaInstanceStatusInit)
DEF(VlmMediaInstanceStatusOpening)
+ DEF(VlmMediaInstanceStatusPlaying)
+ DEF(VlmMediaInstanceStatusPause)
+ DEF(VlmMediaInstanceStatusEnd)
+ DEF(VlmMediaInstanceStatusError)
};
#undef DEF
free(listener);
fprintf( stderr, "This object event manager doesn't know about '%s' events",
libvlc_event_type_name(event_type) );
- assert(0);
+ vlc_assert_unreachable();
return -1;
}
/* Mark this group as edited so that libvlc_event_send
* will recheck what listener to call */
- listeners_group->b_sublistener_removed = false;
+ listeners_group->b_sublistener_removed = true;
free( listener );
vlc_array_remove( &listeners_group->listeners, j );