X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fplaylist%2Fitem.c;h=64ae5e92a8fa16b54514a83006f86d1bd3db73fd;hb=fe087a38282e93addb25fa9598393e40ea233b09;hp=18e18b7d66c7bcd11045e72ec56762bad87325eb;hpb=d1c0b83659a46e172178cb59efc5aad3ae201e89;p=vlc diff --git a/src/playlist/item.c b/src/playlist/item.c index 18e18b7d66..64ae5e92a8 100644 --- a/src/playlist/item.c +++ b/src/playlist/item.c @@ -1,8 +1,8 @@ /***************************************************************************** * item.c : Playlist item functions ***************************************************************************** - * Copyright (C) 1999-2001 VideoLAN - * $Id: item.c,v 1.6 2003/12/04 16:02:54 sam Exp $ + * Copyright (C) 1999-2004 the VideoLAN team + * $Id$ * * Authors: Samuel Hocevar * @@ -25,502 +25,390 @@ #include /* strerror() */ #include -#include -#include #include +#include "vlc_input.h" #include "vlc_playlist.h" +static void GuessType( input_item_t *p_item); + /** - * Add an MRL to the playlist. This is a simplified version of - * playlist_AddExt inculded for convenince. It equals calling playlist_AddExt - * with psz_name == psz_target and i_duration == -1 + * Create a new item, without adding it to the playlist + * + * \param p_obj a vlc object (anyone will do) + * \param psz_uri the mrl of the item + * \param psz_name a text giving a name or description of the item + * \return the new item or NULL on failure */ -int playlist_Add( playlist_t *p_playlist, const char *psz_target, - const char **ppsz_options, int i_options, - int i_mode, int i_pos ) +playlist_item_t * __playlist_ItemNew( vlc_object_t *p_obj, + const char *psz_uri, + const char *psz_name ) { - return playlist_AddExt( p_playlist, psz_target, psz_target, -1, - ppsz_options, i_options, i_mode, i_pos ); + return playlist_ItemNewWithType( p_obj, psz_uri, + psz_name, ITEM_TYPE_UNKNOWN ); } -/** - * Add a MRL into the playlist. - * - * \param p_playlist the playlist to add into - * \param psz_uri the mrl to add to the playlist - * \param psz_name a text giving a name or description of this item - * \param i_duration a hint about the duration of this item, in miliseconds, or - * -1 if unknown. - * \param ppsz_options array of options - * \param i_options number of items in ppsz_options - * \param i_mode the mode used when adding - * \param i_pos the position in the playlist where to add. If this is - * PLAYLIST_END the item will be added at the end of the playlist - * regardless of it's size - * \return always returns 0 -*/ -int playlist_AddExt( playlist_t *p_playlist, const char * psz_uri, - const char * psz_name, mtime_t i_duration, - const char **ppsz_options, int i_options, int i_mode, - int i_pos ) +playlist_item_t * playlist_ItemNewWithType( vlc_object_t *p_obj, + const char *psz_uri, + const char *psz_name, + int i_type ) { playlist_item_t * p_item; + if( psz_uri == NULL) return NULL; + p_item = malloc( sizeof( playlist_item_t ) ); - if( p_item == NULL ) - { - msg_Err( p_playlist, "out of memory" ); - } + if( p_item == NULL ) return NULL; + + memset( p_item, 0, sizeof( playlist_item_t ) ); + + p_item->input.psz_uri = strdup( psz_uri ); + + if( psz_name != NULL ) p_item->input.psz_name = strdup( psz_name ); + else p_item->input.psz_name = strdup ( psz_uri ); + + p_item->input.i_type = i_type; - p_item->psz_name = strdup( psz_name ); - p_item->psz_uri = strdup( psz_uri ); - p_item->psz_author = strdup( "" ); - p_item->i_duration = i_duration; - p_item->i_type = 0; - p_item->i_status = 0; - p_item->b_autodeletion = VLC_FALSE; p_item->b_enabled = VLC_TRUE; - p_item->i_group = PLAYLIST_TYPE_MANUAL; + p_item->i_nb_played = 0; - p_item->ppsz_options = NULL; - p_item->i_options = i_options; + p_item->i_children = -1; + p_item->pp_children = NULL; - if( i_options > 0 ) - { - int i; + p_item->i_flags = 0; + p_item->i_flags |= PLAYLIST_SKIP_FLAG; + p_item->i_flags |= PLAYLIST_SAVE_FLAG; - p_item->ppsz_options = malloc( i_options * sizeof(char *) ); - for( i = 0; i < i_options; i++ ) - { - p_item->ppsz_options[i] = strdup( ppsz_options[i] ); - } + p_item->input.i_duration = -1; + p_item->input.ppsz_options = NULL; + p_item->input.i_options = 0; - } + vlc_mutex_init( p_obj, &p_item->input.lock ); - return playlist_AddItem( p_playlist, p_item, i_mode, i_pos ); + if( p_item->input.i_type == ITEM_TYPE_UNKNOWN ) + GuessType( &p_item->input ); + + return p_item; } /** - * Add a playlist item into a playlist + * Copy a playlist item * - * \param p_playlist the playlist to insert into - * \param p_item the playlist item to insert - * \param i_mode the mode used when adding - * \param i_pos the possition in the playlist where to add. If this is - * PLAYLIST_END the item will be added at the end of the playlist - * regardless of it's size - * \return always returns 0 -*/ -int playlist_AddItem( playlist_t *p_playlist, playlist_item_t * p_item, - int i_mode, int i_pos) + * Creates a new item with name, mrl and meta infor like the + * source. Does not copy children for node type items. + * \param p_obj any vlc object, needed for mutex init + * \param p_item the item to copy + * \return pointer to the new item, or NULL on error + * \note function takes the lock on p_item + */ +playlist_item_t *__playlist_ItemCopy( vlc_object_t *p_obj, + playlist_item_t *p_item ) { - vlc_value_t val; - - vlc_mutex_lock( &p_playlist->object_lock ); + playlist_item_t *p_res; + int i; + vlc_mutex_lock( &p_item->input.lock ); - /* - * CHECK_INSERT : checks if the item is already enqued before - * enqueing it - */ - if ( i_mode & PLAYLIST_CHECK_INSERT ) + p_res = malloc( sizeof( playlist_item_t ) ); + if( p_res == NULL ) { - int j; - - if ( p_playlist->pp_items ) - { - for ( j = 0; j < p_playlist->i_size; j++ ) - { - if ( !strcmp( p_playlist->pp_items[j]->psz_uri, p_item->psz_uri ) ) - { - if( p_item->psz_name ) - { - free( p_item->psz_name ); - } - if( p_item->psz_uri ) - { - free( p_item->psz_uri ); - } - if( p_item->i_options ) - { - int i_opt; - for( i_opt = 0; i_opt < p_item->i_options; i_opt++ ) - { - free( p_item->ppsz_options[i_opt] ); - } - free( p_item->ppsz_options ); - } - if( p_item->psz_author ) - { - free( p_item->psz_author ); - } - free( p_item ); - vlc_mutex_unlock( &p_playlist->object_lock ); - return 0; - } - } - } - i_mode &= ~PLAYLIST_CHECK_INSERT; - i_mode |= PLAYLIST_APPEND; + vlc_mutex_unlock( &p_item->input.lock ); + return NULL; } + *p_res = *p_item; + vlc_mutex_init( p_obj, &p_res->input.lock ); - msg_Dbg( p_playlist, "adding playlist item « %s » ( %s )", p_item->psz_name, p_item->psz_uri); - - /* Create the new playlist item */ - - - /* Do a few boundary checks and allocate space for the item */ - if( i_pos == PLAYLIST_END ) + if( p_item->input.i_options ) + p_res->input.ppsz_options = + malloc( p_item->input.i_options * sizeof(char*) ); + for( i = 0; i < p_item->input.i_options; i++ ) { - if( i_mode & PLAYLIST_INSERT ) - { - i_mode &= ~PLAYLIST_INSERT; - i_mode |= PLAYLIST_APPEND; - } - - i_pos = p_playlist->i_size - 1; + p_res->input.ppsz_options[i] = strdup( p_item->input.ppsz_options[i] ); } - if( !(i_mode & PLAYLIST_REPLACE) - || i_pos < 0 || i_pos >= p_playlist->i_size ) + if( p_item->i_children != -1 ) { - /* Additional boundary checks */ - if( i_mode & PLAYLIST_APPEND ) - { - i_pos++; - } - - if( i_pos < 0 ) - { - i_pos = 0; - } - else if( i_pos > p_playlist->i_size ) - { - i_pos = p_playlist->i_size; - } - - INSERT_ELEM( p_playlist->pp_items, - p_playlist->i_size, - i_pos, - p_item ); - p_playlist->i_enabled ++; - - if( p_playlist->i_index >= i_pos ) - { - p_playlist->i_index++; - } + msg_Warn( p_obj, "not copying playlist items children" ); + p_res->i_children = -1; + p_res->pp_children = NULL; } - else + p_res->i_parents = 0; + p_res->pp_parents = NULL; + + if( p_item->input.psz_name ) + p_res->input.psz_name = strdup( p_item->input.psz_name ); + if( p_item->input.psz_uri ) + p_res->input.psz_uri = strdup( p_item->input.psz_uri ); + + if( p_item->input.i_es ) { - /* i_mode == PLAYLIST_REPLACE and 0 <= i_pos < p_playlist->i_size */ - if( p_playlist->pp_items[i_pos]->psz_name ) + p_res->input.es = + (es_format_t**)malloc( p_item->input.i_es * sizeof(es_format_t*)); + for( i = 0; i < p_item->input.i_es; i++ ) { - free( p_playlist->pp_items[i_pos]->psz_name ); + p_res->input.es[ i ] = (es_format_t*)malloc(sizeof(es_format_t*)); + es_format_Copy( p_res->input.es[ i ], + p_item->input.es[ i ] ); } - if( p_playlist->pp_items[i_pos]->psz_uri ) - { - free( p_playlist->pp_items[i_pos]->psz_uri ); - } - if( p_playlist->pp_items[i_pos]->psz_author ) - { - free( p_playlist->pp_items[i_pos]->psz_author ); - } - /* XXX: what if the item is still in use? */ - free( p_playlist->pp_items[i_pos] ); - p_playlist->pp_items[i_pos] = p_item; } - - if( i_mode & PLAYLIST_GO ) + if( p_item->input.i_categories ) { - p_playlist->i_index = i_pos; - if( p_playlist->p_input ) + p_res->input.pp_categories = NULL; + p_res->input.i_categories = 0; + for( i = 0; i < p_item->input.i_categories; i++ ) { - input_StopThread( p_playlist->p_input ); + info_category_t *p_incat; + p_incat = p_item->input.pp_categories[i]; + if( p_incat->i_infos ) + { + int j; + for( j = 0; j < p_incat->i_infos; j++ ) + { + vlc_input_item_AddInfo( &p_res->input, p_incat->psz_name, + p_incat->pp_infos[j]->psz_name, + "%s", /* to be safe */ + p_incat->pp_infos[j]->psz_value ); + } + } } - p_playlist->i_status = PLAYLIST_RUNNING; } - vlc_mutex_unlock( &p_playlist->object_lock ); - - val.b_bool = VLC_TRUE; - var_Set( p_playlist, "intf-change", val ); - - return 0; + vlc_mutex_unlock( &p_item->input.lock ); + return p_res; } /** - * delete an item from a playlist. + * Deletes a playlist item * - * \param p_playlist the playlist to remove from. - * \param i_pos the position of the item to remove - * \return returns 0 + * \param p_item the item to delete + * \return nothing */ -int playlist_Delete( playlist_t * p_playlist, int i_pos ) +int playlist_ItemDelete( playlist_item_t *p_item ) { - vlc_value_t val; + vlc_mutex_lock( &p_item->input.lock ); - /* if i_pos is the current played item, playlist should stop playing it */ - if( ( p_playlist->i_status == PLAYLIST_RUNNING) && (p_playlist->i_index == i_pos) ) - { - playlist_Command( p_playlist, PLAYLIST_STOP, 0 ); - } + if( p_item->input.psz_name ) free( p_item->input.psz_name ); + if( p_item->input.psz_uri ) free( p_item->input.psz_uri ); - vlc_mutex_lock( &p_playlist->object_lock ); - if( i_pos >= 0 && i_pos < p_playlist->i_size ) + /* Free the info categories */ + if( p_item->input.i_categories > 0 ) { - playlist_item_t *p_item = p_playlist->pp_items[i_pos]; - - msg_Dbg( p_playlist, "deleting playlist item « %s »", - p_item->psz_name ); + int i, j; - if( p_item->psz_name ) - { - free( p_item->psz_name ); - } - if( p_item->psz_uri ) - { - free( p_item->psz_uri ); - } - if( p_item->psz_author ) - { - free( p_item->psz_author ); - } - if( p_item->i_options > 0 ) + for( i = 0; i < p_item->input.i_categories; i++ ) { - int i; + info_category_t *p_category = p_item->input.pp_categories[i]; - for( i = 0; i < p_item->i_options; i++ ) + for( j = 0; j < p_category->i_infos; j++) { - free( p_item->ppsz_options[i] ); + if( p_category->pp_infos[j]->psz_name ) + { + free( p_category->pp_infos[j]->psz_name); + } + if( p_category->pp_infos[j]->psz_value ) + { + free( p_category->pp_infos[j]->psz_value ); + } + free( p_category->pp_infos[j] ); } - free( p_item->ppsz_options ); + if( p_category->i_infos ) free( p_category->pp_infos ); + if( p_category->psz_name ) free( p_category->psz_name ); + free( p_category ); } - /* XXX: what if the item is still in use? */ - free( p_item ); + free( p_item->input.pp_categories ); + } - if( i_pos <= p_playlist->i_index ) - { - p_playlist->i_index--; - } + for( ; p_item->input.i_options > 0; p_item->input.i_options-- ) + { + free( p_item->input.ppsz_options[p_item->input.i_options - 1] ); + if( p_item->input.i_options == 1 ) free( p_item->input.ppsz_options ); + } - /* Renumber the playlist */ - REMOVE_ELEM( p_playlist->pp_items, - p_playlist->i_size, - i_pos ); - if( p_playlist->i_enabled > 0 ) - p_playlist->i_enabled--; + for( ; p_item->i_parents > 0 ; ) + { + struct item_parent_t *p_parent = p_item->pp_parents[0]; + REMOVE_ELEM( p_item->pp_parents, p_item->i_parents, 0 ); + free( p_parent ); } - vlc_mutex_unlock( &p_playlist->object_lock ); + vlc_mutex_unlock( &p_item->input.lock ); + vlc_mutex_destroy( &p_item->input.lock ); - val.b_bool = VLC_TRUE; - var_Set( p_playlist, "intf-change", val ); + free( p_item ); - return 0; + return VLC_SUCCESS; } /** - * Disables a playlist item + * Add a option to one item ( no need for p_playlist ) * - * \param p_playlist the playlist to disable from. - * \param i_pos the position of the item to disable - * \return returns 0 + * \param p_item the item on which we want the info + * \param psz_option the option + * \return 0 on success */ -int playlist_Disable( playlist_t * p_playlist, int i_pos ) +int playlist_ItemAddOption( playlist_item_t *p_item, const char *psz_option ) { - vlc_value_t val; - vlc_mutex_lock( &p_playlist->object_lock ); - - - if( i_pos >= 0 && i_pos < p_playlist->i_size ) - { - msg_Dbg( p_playlist, "disabling playlist item « %s »", - p_playlist->pp_items[i_pos]->psz_name ); - - if( p_playlist->pp_items[i_pos]->b_enabled == VLC_TRUE ) - p_playlist->i_enabled--; - p_playlist->pp_items[i_pos]->b_enabled = VLC_FALSE; - } - - vlc_mutex_unlock( &p_playlist->object_lock ); + if( !psz_option ) return VLC_EGENERIC; - val.b_bool = VLC_TRUE; - var_Set( p_playlist, "intf-change", val ); + vlc_mutex_lock( &p_item->input.lock ); + INSERT_ELEM( p_item->input.ppsz_options, p_item->input.i_options, + p_item->input.i_options, strdup( psz_option ) ); + vlc_mutex_unlock( &p_item->input.lock ); - return 0; + return VLC_SUCCESS; } /** - * Enables a playlist item + * Add a parent to an item * - * \param p_playlist the playlist to enable from. - * \param i_pos the position of the item to enable - * \return returns 0 + * \param p_item the item + * \param i_view the view in which the parent is + * \param p_parent the parent to add + * \return nothing */ -int playlist_Enable( playlist_t * p_playlist, int i_pos ) +int playlist_ItemAddParent( playlist_item_t *p_item, int i_view, + playlist_item_t *p_parent ) { - vlc_value_t val; - vlc_mutex_lock( &p_playlist->object_lock ); - - if( i_pos >= 0 && i_pos < p_playlist->i_size ) - { - msg_Dbg( p_playlist, "enabling playlist item « %s »", - p_playlist->pp_items[i_pos]->psz_name ); - - if( p_playlist->pp_items[i_pos]->b_enabled == VLC_FALSE ) - p_playlist->i_enabled++; - - p_playlist->pp_items[i_pos]->b_enabled = VLC_TRUE; - } - - vlc_mutex_unlock( &p_playlist->object_lock ); - - val.b_bool = VLC_TRUE; - var_Set( p_playlist, "intf-change", val ); - - return 0; + vlc_bool_t b_found = VLC_FALSE; + int i; + + for( i= 0; i< p_item->i_parents ; i++ ) + { + if( p_item->pp_parents[i]->i_view == i_view ) + + { + b_found = VLC_TRUE; + break; + } + } + if( b_found == VLC_FALSE ) + { + + struct item_parent_t *p_ip = (struct item_parent_t *) + malloc(sizeof(struct item_parent_t) ); + p_ip->i_view = i_view; + p_ip->p_parent = p_parent; + + INSERT_ELEM( p_item->pp_parents, + p_item->i_parents, p_item->i_parents, + p_ip ); + } + return VLC_SUCCESS; } /** - * Disables a playlist group - * - * \param p_playlist the playlist to disable from. - * \param i_pos the id of the group to disable - * \return returns 0 + * Copy all parents from parent to child */ -int playlist_DisableGroup( playlist_t * p_playlist, int i_group) +int playlist_CopyParents( playlist_item_t *p_parent, + playlist_item_t *p_child ) { - vlc_value_t val; - int i; - vlc_mutex_lock( &p_playlist->object_lock ); - - msg_Dbg(p_playlist,"Disabling group %i",i_group); - for( i = 0 ; i< p_playlist->i_size; i++ ) + int i=0; + for( i= 0 ; i< p_parent->i_parents; i ++ ) { - if( p_playlist->pp_items[i]->i_group == i_group ) - { - msg_Dbg( p_playlist, "disabling playlist item « %s »", - p_playlist->pp_items[i]->psz_name ); - - if( p_playlist->pp_items[i]->b_enabled == VLC_TRUE ) - p_playlist->i_enabled--; - - p_playlist->pp_items[i]->b_enabled = VLC_FALSE; - } + playlist_ItemAddParent( p_child, + p_parent->pp_parents[i]->i_view, + p_parent ); } - vlc_mutex_unlock( &p_playlist->object_lock ); + return VLC_SUCCESS; +} - val.b_bool = VLC_TRUE; - var_Set( p_playlist, "intf-change", val ); - return 0; -} +/********************************************************************** + * playlist_item_t structure accessors + * These functions give access to the fields of the playlist_item_t + * structure + **********************************************************************/ + /** - * Enables a playlist group + * Set the name of a playlist item * - * \param p_playlist the playlist to enable from. - * \param i_pos the id of the group to enable - * \return returns 0 + * \param p_item the item + * \param psz_name the new name + * \return VLC_SUCCESS on success, VLC_EGENERIC on failure */ -int playlist_EnableGroup( playlist_t * p_playlist, int i_group) +int playlist_ItemSetName( playlist_item_t *p_item, char *psz_name ) { - vlc_value_t val; - int i; - vlc_mutex_lock( &p_playlist->object_lock ); - - for( i = 0 ; i< p_playlist->i_size; i++ ) + if( psz_name && p_item ) { - if( p_playlist->pp_items[i]->i_group == i_group ) - { - msg_Dbg( p_playlist, "enabling playlist item « %s »", - p_playlist->pp_items[i]->psz_name ); - - if( p_playlist->pp_items[i]->b_enabled == VLC_FALSE ) - p_playlist->i_enabled++; - - p_playlist->pp_items[i]->b_enabled = VLC_TRUE; - } + if( p_item->input.psz_name ) free( p_item->input.psz_name ); + p_item->input.psz_name = strdup( psz_name ); + return VLC_SUCCESS; } - vlc_mutex_unlock( &p_playlist->object_lock ); - - val.b_bool = VLC_TRUE; - var_Set( p_playlist, "intf-change", val ); - - return 0; + return VLC_EGENERIC; } /** - * Move an item in a playlist + * Set the duration of a playlist item + * This function must be entered with the item lock * - * Move the item in the playlist with position i_pos before the current item - * at position i_newpos. - * \param p_playlist the playlist to move items in - * \param i_pos the position of the item to move - * \param i_newpos the position of the item that will be behind the moved item - * after the move - * \return returns 0 + * \param p_item the item + * \param i_duration the new duration + * \return VLC_SUCCESS on success, VLC_EGENERIC on failure */ -int playlist_Move( playlist_t * p_playlist, int i_pos, int i_newpos) +int playlist_ItemSetDuration( playlist_item_t *p_item, mtime_t i_duration ) { - vlc_value_t val; - vlc_mutex_lock( &p_playlist->object_lock ); - - /* take into account that our own row disappears. */ - if ( i_pos < i_newpos ) i_newpos--; - - if( i_pos >= 0 && i_newpos >=0 && i_pos <= p_playlist->i_size - && i_newpos <= p_playlist->i_size ) + char psz_buffer[MSTRTIME_MAX_SIZE]; + if( p_item ) { - playlist_item_t * temp; - - msg_Dbg( p_playlist, "moving playlist item « %s » (%i -> %i)", - p_playlist->pp_items[i_pos]->psz_name, i_pos, - i_newpos ); - - if( i_pos == p_playlist->i_index ) - { - p_playlist->i_index = i_newpos; - } - else if( i_pos > p_playlist->i_index && i_newpos <= p_playlist->i_index ) + p_item->input.i_duration = i_duration; + if( i_duration != -1 ) { - p_playlist->i_index++; + secstotimestr( psz_buffer, (int)(i_duration/1000000) ); } - else if( i_pos < p_playlist->i_index && i_newpos >= p_playlist->i_index ) + else { - p_playlist->i_index--; + memcpy( psz_buffer, "--:--:--", sizeof("--:--:--") ); } + vlc_input_item_AddInfo( &p_item->input, _("General") , _("Duration"), + "%s", psz_buffer ); - if ( i_pos < i_newpos ) - { - temp = p_playlist->pp_items[i_pos]; - while ( i_pos < i_newpos ) - { - p_playlist->pp_items[i_pos] = p_playlist->pp_items[i_pos+1]; - i_pos++; - } - p_playlist->pp_items[i_newpos] = temp; - } - else if ( i_pos > i_newpos ) - { - temp = p_playlist->pp_items[i_pos]; - while ( i_pos > i_newpos ) - { - p_playlist->pp_items[i_pos] = p_playlist->pp_items[i_pos-1]; - i_pos--; - } - p_playlist->pp_items[i_newpos] = temp; - } + return VLC_SUCCESS; } + return VLC_EGENERIC; +} - vlc_mutex_unlock( &p_playlist->object_lock ); - - val.b_bool = VLC_TRUE; - var_Set( p_playlist, "intf-change", val ); +/* + * Guess the type of the item using the beginning of the mrl */ +static void GuessType( input_item_t *p_item) +{ + int i; + static struct { char *psz_search; int i_type; } types_array[] = + { + { "http", ITEM_TYPE_NET }, + { "dvd", ITEM_TYPE_DISC }, + { "cdda", ITEM_TYPE_CDDA }, + { "mms", ITEM_TYPE_NET }, + { "rtsp", ITEM_TYPE_NET }, + { "udp", ITEM_TYPE_NET }, + { "rtp", ITEM_TYPE_NET }, + { "vcd", ITEM_TYPE_DISC }, + { "v4l", ITEM_TYPE_CARD }, + { "dshow", ITEM_TYPE_CARD }, + { "pvr", ITEM_TYPE_CARD }, + { "dvb", ITEM_TYPE_CARD }, + { "qpsk", ITEM_TYPE_CARD }, + { "sdp", ITEM_TYPE_NET }, + { NULL, 0 } + }; + + static struct { char *psz_search; int i_type; } exts_array[] = + { + { "mp3", ITEM_TYPE_AFILE }, + { NULL, 0 } + }; - return 0; + for( i = 0; types_array[i].psz_search != NULL; i++ ) + { + if( !strncmp( p_item->psz_uri, types_array[i].psz_search, + strlen( types_array[i].psz_search ) ) ) + { + p_item->i_type = types_array[i].i_type; + return; + } + } + p_item->i_type = ITEM_TYPE_VFILE; }