]> git.sesse.net Git - vlc/commitdiff
Fixes + use new API for directory demuxer
authorClément Stenac <zorglub@videolan.org>
Sat, 6 Nov 2004 11:21:14 +0000 (11:21 +0000)
committerClément Stenac <zorglub@videolan.org>
Sat, 6 Nov 2004 11:21:14 +0000 (11:21 +0000)
modules/access/directory.c
modules/codec/cmml/intf.c
modules/codec/vorbis.c

index 1cdfa2cee8657b2dfdf952abbea09ce29e9321e5..2dcd85ed0bffc7d5fdd1364bdd5c4d3e3bb4a3fb 100644 (file)
@@ -108,7 +108,8 @@ static int Demux( demux_t *p_demux );
 static int DemuxControl( demux_t *p_demux, int i_query, va_list args );
 
 
-static int ReadDir( playlist_t *, char *psz_name, int i_mode, int *pi_pos );
+static int ReadDir( playlist_t *, char *psz_name, int i_mode, int *pi_pos,
+                    playlist_item_t * );
 
 /*****************************************************************************
  * Open: open the directory
@@ -206,17 +207,24 @@ static int Read( access_t *p_access, uint8_t *p_buffer, int i_len)
     free( psz );
 
     /* Make sure we are deleted when we are done */
-    p_playlist->pp_items[p_playlist->i_index]->b_autodeletion = VLC_TRUE;
+//    p_playlist->pp_items[p_playlist->i_index]->b_autodeletion = VLC_TRUE;
     /* The playlist position we will use for the add */
     i_pos = p_playlist->i_index + 1;
 
     msg_Dbg( p_access, "opening directory `%s'", psz_name );
-    if( ReadDir( p_playlist, psz_name , i_mode, &i_pos ) != VLC_SUCCESS )
+
+    p_playlist->status.p_item->input.i_type = ITEM_TYPE_DIRECTORY;
+    if( ReadDir( p_playlist, psz_name , i_mode, &i_pos,
+                            p_playlist->status.p_item
+               ) != VLC_SUCCESS )
     {
         goto end;
     }
 
 end:
+    /* Begin to read the directory */
+    playlist_Control( p_playlist, PLAYLIST_VIEWPLAY,p_playlist->status.i_view,
+                      p_playlist->status.p_item, NULL );
     if( psz_name ) free( psz_name );
     vlc_object_release( p_playlist );
 
@@ -307,11 +315,19 @@ static int DemuxControl( demux_t *p_demux, int i_query, va_list args )
  * ReadDir: read a directory and add its content to the list
  *****************************************************************************/
 static int ReadDir( playlist_t *p_playlist,
-                    char *psz_name , int i_mode, int *pi_position )
+                    char *psz_name , int i_mode, int *pi_position,
+                    playlist_item_t *p_parent )
 {
     DIR *                       p_current_dir;
     struct dirent *             p_dir_content;
-
+    playlist_item_t *p_node;
+    int i;
+
+   /* Change the item to a node */
+   if( p_parent->i_children == -1)
+   {
+        playlist_ItemToNode( p_playlist,p_parent );
+   }
     /* Open the dir */
     p_current_dir = opendir( psz_name );
 
@@ -361,8 +377,21 @@ static int ReadDir( playlist_t *p_playlist,
                 else if(i_mode == MODE_EXPAND )
                 {
                     msg_Dbg(p_playlist, "Reading subdirectory %s", psz_uri );
-                    if( ReadDir( p_playlist, psz_uri , MODE_EXPAND, pi_position )
-                                 != VLC_SUCCESS )
+                    p_node = playlist_NodeCreate( p_playlist,
+                                       p_parent->pp_parents[0]->i_view,
+                                       psz_uri, p_parent );
+
+                    p_node->input.i_type = ITEM_TYPE_DIRECTORY;
+                    /* We need to declare the parents of the node as the
+                     * same of the parent's ones */
+                    for( i= 1 ; i< p_parent->i_parents; i ++ )
+                    {
+                        playlist_ItemAddParent( p_node,
+                                                p_parent->pp_parents[i]->i_view,
+                                                p_parent );
+                    }
+                    if( ReadDir( p_playlist, psz_uri , MODE_EXPAND,
+                                 pi_position, p_node ) != VLC_SUCCESS )
                     {
                         return VLC_EGENERIC;
                     }
@@ -370,9 +399,22 @@ static int ReadDir( playlist_t *p_playlist,
             }
             else
             {
-                playlist_Add( p_playlist, psz_uri, p_dir_content->d_name,
-                          PLAYLIST_INSERT, *pi_position );
-                (*pi_position)++;
+                playlist_item_t *p_item = playlist_ItemNew( p_playlist,
+                                psz_uri, p_dir_content->d_name );
+                fprintf(stderr,"STARTTTTt\n");
+                playlist_NodeAddItem( p_playlist,p_item,
+                                      p_parent->pp_parents[0]->i_view,
+                                      p_parent,
+                                      PLAYLIST_APPEND, PLAYLIST_END );
+                fprintf(stderr,"DONE\n");
+                /* We need to declare the parents of the node as the
+                 * same of the parent's ones */
+                for( i= 1 ; i< p_parent->i_parents; i ++ )
+                {
+                    playlist_ItemAddParent( p_item,
+                                            p_parent->pp_parents[i]->i_view,
+                                            p_parent );
+                }
             }
         }
         free( psz_uri );
index 1222afb8a611f5460ffa559a72822fb5498a0fbe..f30108b826c2e846b9c30e00acabfd31ab56bde4 100644 (file)
@@ -526,7 +526,7 @@ static void FollowAnchor ( intf_thread_t *p_intf )
             msg_Dbg( p_intf, "calling browser_Open with \"%s\"", psz_url );
 #endif
             (void) browser_Open( psz_url );
-            playlist_Command( p_playlist, PLAYLIST_PAUSE, 0 );
+            playlist_Control( p_playlist, PLAYLIST_PAUSE, 0 );
         }
 
         free( psz_uri_to_load );
index bdfbae315eecd46c14603500a7786f81ad5b4c24..d7889f66e0e1ec2f4ece2f9608d81dc5151d8c3e 100644 (file)
@@ -576,7 +576,19 @@ static void ParseVorbisComments( decoder_t *p_dec )
             psz_value++;
             input_Control( p_input, INPUT_ADD_INFO, _("Vorbis comment"),
                            psz_name, psz_value );
+            /* HACK, we should use meta */
+            if( strstr( psz_name, "artist" ) )
+            {
+                input_Control( p_input, INPUT_ADD_INFO, _("Meta-information"),
+                               _("Artist"), psz_value );
+            }
+            else if( strstr( psz_name, "title" ) )
+            {
+                p_input->input.p_item->psz_name = strdup( psz_value );
+            }
         }
+        /* FIXME */
+        var_SetInteger( p_input, "item-change", p_input->input.p_item->i_id );
         free( psz_comment );
         i++;
     }