]> git.sesse.net Git - vlc/commitdiff
No need to GuessType on directory content
authorClément Stenac <zorglub@videolan.org>
Mon, 20 Dec 2004 20:14:43 +0000 (20:14 +0000)
committerClément Stenac <zorglub@videolan.org>
Mon, 20 Dec 2004 20:14:43 +0000 (20:14 +0000)
include/vlc_playlist.h
modules/access/directory.c
src/playlist/item.c

index 20ca0f4fc139cb01e815ae0b763feb2aeb954831..dca75130c9d5f253799aa9d43033889a5fe41ee5 100644 (file)
@@ -264,6 +264,7 @@ VLC_EXPORT( vlc_bool_t, playlist_IsServicesDiscoveryLoaded, ( playlist_t *,const
 #define playlist_AddItem(p,pi,i1,i2) playlist_ItemAdd(p,pi,i1,i2)
 #define playlist_ItemNew( a , b, c ) __playlist_ItemNew(VLC_OBJECT(a) , b , c )
 VLC_EXPORT( playlist_item_t* , __playlist_ItemNew, ( vlc_object_t *,const char *,const char * ) );
+VLC_EXPORT( playlist_item_t* , playlist_ItemNewWithType, ( vlc_object_t *,const char *,const char *, int ) );
 VLC_EXPORT( int, playlist_ItemDelete, ( playlist_item_t * ) );
 VLC_EXPORT( int, playlist_ItemAddParent, ( playlist_item_t *, int,playlist_item_t *) );
 VLC_EXPORT( int, playlist_CopyParents, ( playlist_item_t *,playlist_item_t *) );
index 255b570158002c6884810fc5f7f10f8e11501708..4ff8ac3e213f9756551b006477696a4df898ff23 100644 (file)
@@ -477,8 +477,11 @@ static int ReadDir( playlist_t *p_playlist,
             }
             else
             {
-                playlist_item_t *p_item = playlist_ItemNew( p_playlist,
-                                psz_uri, p_dir_content->d_name );
+                playlist_item_t *p_item = playlist_ItemNewWithType(
+                                                p_playlist,
+                                                psz_uri,
+                                                p_dir_content->d_name,
+                                                ITEM_TYPE_FILE );
                 playlist_NodeAddItem( p_playlist,p_item,
                                       p_parent->pp_parents[0]->i_view,
                                       p_parent,
index 9e5a5cd522590e9c446d00974c8c04fef55508a3..332ca1a20ec25ec77b0be7f6cc35244e5d073144 100644 (file)
@@ -39,9 +39,19 @@ static void GuessType( input_item_t *p_item);
  * \param psz_name a text giving a name or description of the item
  * \return the new item or NULL on failure
  */
+
 playlist_item_t * __playlist_ItemNew( vlc_object_t *p_obj,
                                       const char *psz_uri,
                                       const char *psz_name )
+{
+    return playlist_ItemNewWithType( p_obj, psz_uri,
+                                     psz_name, ITEM_TYPE_UNKNOWN );
+}
+
+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;
 
@@ -57,6 +67,8 @@ playlist_item_t * __playlist_ItemNew( vlc_object_t *p_obj,
     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->b_enabled = VLC_TRUE;
     p_item->i_nb_played = 0;
 
@@ -72,7 +84,8 @@ playlist_item_t * __playlist_ItemNew( vlc_object_t *p_obj,
 
     vlc_mutex_init( p_obj, &p_item->input.lock );
 
-    GuessType( &p_item->input );
+    if( p_item->input.i_type == ITEM_TYPE_UNKNOWN )
+        GuessType( &p_item->input );
 
     playlist_ItemCreateCategory( p_item, _("General") );