/*****************************************************************************
* Local structure lock
*****************************************************************************/
/*****************************************************************************
* Local structure lock
*****************************************************************************/
+static void libvlc_lock (libvlc_int_t *p_libvlc)
+{
+ vlc_mutex_lock (&(libvlc_priv (p_libvlc)->structure_lock));
+}
+
+static void libvlc_unlock (libvlc_int_t *p_libvlc)
+{
+ vlc_mutex_unlock (&(libvlc_priv (p_libvlc)->structure_lock));
+}
+
void *__vlc_custom_create( vlc_object_t *p_this, size_t i_size,
int i_type, const char *psz_type )
{
void *__vlc_custom_create( vlc_object_t *p_this, size_t i_size,
int i_type, const char *psz_type )
{
- p_new->p_libvlc = NULL;
- vlc_mutex_init( &structure_lock );
+ libvlc_int_t *self = (libvlc_int_t*)p_new;
+ p_new->p_libvlc = self;
+ vlc_mutex_init (&(libvlc_priv (self)->structure_lock));
p_priv->prev = vlc_internals (p_this)->prev;
vlc_internals (p_this)->prev = p_new;
vlc_internals (p_priv->prev)->next = p_new;
p_priv->prev = vlc_internals (p_this)->prev;
vlc_internals (p_this)->prev = p_new;
vlc_internals (p_priv->prev)->next = p_new;
close( p_priv->pipes[1] );
if( p_priv->pipes[0] != -1 )
close( p_priv->pipes[0] );
close( p_priv->pipes[1] );
if( p_priv->pipes[0] != -1 )
close( p_priv->pipes[0] );
/* Otherwise, recursively look for the object */
if( (i_mode & 0x000f) == FIND_ANYWHERE )
/* Otherwise, recursively look for the object */
if( (i_mode & 0x000f) == FIND_ANYWHERE )
/* Take the spin again. Note that another thread may have held the
* object in the (very short) mean time. */
vlc_spin_lock( &internals->ref_spin );
/* Take the spin again. Note that another thread may have held the
* object in the (very short) mean time. */
vlc_spin_lock( &internals->ref_spin );
vlc_object_internals_t *priv = vlc_internals( p_parent );
INSERT_ELEM( priv->pp_children, priv->i_children, priv->i_children,
p_this );
vlc_object_internals_t *priv = vlc_internals( p_parent );
INSERT_ELEM( priv->pp_children, priv->i_children, priv->i_children,
p_this );
i_count = CountChildren( p_this, i_type );
p_list = NewList( i_count );
/* Check allocation was successful */
if( p_list->i_count != i_count )
{
i_count = CountChildren( p_this, i_type );
p_list = NewList( i_count );
/* Check allocation was successful */
if( p_list->i_count != i_count )
{
l = NewList( priv->i_children );
for (int i = 0; i < l->i_count; i++)
{
vlc_object_hold( priv->pp_children[i] );
l->p_values[i].p_object = priv->pp_children[i];
}
l = NewList( priv->i_children );
for (int i = 0; i < l->i_count; i++)
{
vlc_object_hold( priv->pp_children[i] );
l->p_values[i].p_object = priv->pp_children[i];
}
/* try using the object's name to find it */
p_object = vlc_object_find_name( p_this, newval.psz_string,
FIND_ANYWHERE );
/* try using the object's name to find it */
p_object = vlc_object_find_name( p_this, newval.psz_string,
FIND_ANYWHERE );