From: Clément Stenac Date: Sat, 6 Nov 2004 11:21:14 +0000 (+0000) Subject: Fixes + use new API for directory demuxer X-Git-Tag: 0.8.2~1786 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=38184c2e4bf4a0368e3b95a2822733c1d9e54b4a;p=vlc Fixes + use new API for directory demuxer --- diff --git a/modules/access/directory.c b/modules/access/directory.c index 1cdfa2cee8..2dcd85ed0b 100644 --- a/modules/access/directory.c +++ b/modules/access/directory.c @@ -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 ); diff --git a/modules/codec/cmml/intf.c b/modules/codec/cmml/intf.c index 1222afb8a6..f30108b826 100644 --- a/modules/codec/cmml/intf.c +++ b/modules/codec/cmml/intf.c @@ -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 ); diff --git a/modules/codec/vorbis.c b/modules/codec/vorbis.c index bdfbae315e..d7889f66e0 100644 --- a/modules/codec/vorbis.c +++ b/modules/codec/vorbis.c @@ -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++; }