コード例 #1
0
ファイル: iobject.c プロジェクト: AmesianX/telechips-linux
static void ListChildren(itv_object_list_t *p_list, itv_object_t *p_this, int i_type)
{
	int i;

	itv_object_t *p_tmp;

	for(i = 0; i < itv_object_internals(p_this)->i_children; i++) {
		p_tmp = itv_object_internals(p_this)->pp_children[i];

		if(itv_object_internals(p_tmp)->i_object_type == i_type) {
			ListReplace(p_list, p_tmp, p_list->i_count++);
		}
		ListChildren(p_list, p_tmp, i_type);
	}
}
コード例 #2
0
ファイル: objects.c プロジェクト: forthyen/SDesk
static void ListChildren( vlc_list_t *p_list, vlc_object_t *p_this, int i_type )
{
    vlc_object_t *p_tmp;
    int i;

    for( i = 0; i < p_this->i_children; i++ )
    {
        p_tmp = p_this->pp_children[i];

        if( p_tmp->i_object_type == i_type )
        {
            ListReplace( p_list, p_tmp, p_list->i_count++ );
        }

        if( p_tmp->i_children )
        {
            ListChildren( p_list, p_tmp, i_type );
        }
    }
}
コード例 #3
0
ファイル: objects.c プロジェクト: forthyen/SDesk
/**
 ****************************************************************************
 * find a list typed objects and increment their refcount
 *****************************************************************************
 * This function recursively looks for a given object type. i_mode can be one
 * of FIND_PARENT, FIND_CHILD or FIND_ANYWHERE.
 *****************************************************************************/
vlc_list_t * __vlc_list_find( vlc_object_t *p_this, int i_type, int i_mode )
{
    vlc_list_t *p_list;
    vlc_object_t **pp_current, **pp_end;
    int i_count = 0, i_index = 0;

    vlc_mutex_lock( &structure_lock );

    /* Look for the objects */
    switch( i_mode & 0x000f )
    {
    case FIND_ANYWHERE:
        pp_current = p_this->p_libvlc->pp_objects;
        pp_end = pp_current + p_this->p_libvlc->i_objects;

        for( ; pp_current < pp_end ; pp_current++ )
        {
            if( (*pp_current)->b_attached
                 && (*pp_current)->i_object_type == i_type )
            {
                i_count++;
            }
        }

        p_list = NewList( i_count );
        pp_current = p_this->p_libvlc->pp_objects;

        for( ; pp_current < pp_end ; pp_current++ )
        {
            if( (*pp_current)->b_attached
                 && (*pp_current)->i_object_type == i_type )
            {
                ListReplace( p_list, *pp_current, i_index );
                if( i_index < i_count ) i_index++;
            }
        }
    break;

    case FIND_CHILD:
        i_count = CountChildren( p_this, i_type );
        p_list = NewList( i_count );

        /* Check allocation was successful */
        if( p_list->i_count != i_count )
        {
            msg_Err( p_this, "list allocation failed!" );
            p_list->i_count = 0;
            break;
        }

        p_list->i_count = 0;
        ListChildren( p_list, p_this, i_type );
        break;

    default:
        msg_Err( p_this, "unimplemented!" );
        p_list = NewList( 0 );
        break;
    }

    vlc_mutex_unlock( &structure_lock );

    return p_list;
}