Changeset 5c9c07f8e066b6a9d4115ca1b19a5a4203719da7

Show
Ignore:
Timestamp:
23/03/07 20:59:11 (2 years ago)
Author:
Laurent Aimar <fenrir@videolan.org>
git-committer:
Laurent Aimar <fenrir@videolan.org> 1174679951 +0000
git-parent:

[d5c128a3b7a8812506929bc381de72fe206a5398]

git-author:
Laurent Aimar <fenrir@videolan.org> 1174679951 +0000
Message:

Extended INPUT_DEL_INFO (Allow deleting a whole category with NULL name)
Fixed VLC_META_NOW_PLAYING update.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/input/control.c

    rd3fe7f2 r5c9c07f  
    206206 
    207207            info_category_t *p_cat = NULL; 
     208            int i_cat; 
    208209            int i; 
    209210 
    210211            vlc_mutex_lock( &p_input->p->input.p_item->lock ); 
    211             for( i = 0; i < p_input->p->input.p_item->i_categories; i++ ) 
    212             { 
    213                 if( !strcmp( p_input->p->input.p_item->pp_categories[i]->psz_name, 
     212            for( i_cat = 0; i_cat < p_input->p->input.p_item->i_categories; i_cat++ ) 
     213            { 
     214                if( !strcmp( p_input->p->input.p_item->pp_categories[i_cat]->psz_name, 
    214215                             psz_cat ) ) 
    215216                { 
    216                     p_cat = p_input->p->input.p_item->pp_categories[i]; 
     217                    p_cat = p_input->p->input.p_item->pp_categories[i_cat]; 
    217218                    break; 
    218219                } 
     
    224225            } 
    225226 
    226             for( i = 0; i < p_cat->i_infos; i++ ) 
    227             { 
    228                 if( !strcmp( p_cat->pp_infos[i]->psz_name, psz_name ) ) 
     227            if( psz_name ) 
     228            { 
     229                /* Remove a specific info */ 
     230                for( i = 0; i < p_cat->i_infos; i++ ) 
     231                { 
     232                    if( !strcmp( p_cat->pp_infos[i]->psz_name, psz_name ) ) 
     233                    { 
     234                        free( p_cat->pp_infos[i]->psz_name ); 
     235                        if( p_cat->pp_infos[i]->psz_value ) 
     236                            free( p_cat->pp_infos[i]->psz_value ); 
     237                        free( p_cat->pp_infos[i] ); 
     238                        REMOVE_ELEM( p_cat->pp_infos, p_cat->i_infos, i ); 
     239                        break; 
     240                    } 
     241                } 
     242                if( i >= p_cat->i_infos ) 
     243                { 
     244                    vlc_mutex_unlock( &p_input->p->input.p_item->lock ); 
     245                    return VLC_EGENERIC; 
     246                } 
     247            } 
     248            else 
     249            { 
     250                /* Remove the complete categorie */ 
     251                for( i = 0; i < p_cat->i_infos; i++ ) 
    229252                { 
    230253                    free( p_cat->pp_infos[i]->psz_name ); 
     
    232255                        free( p_cat->pp_infos[i]->psz_value ); 
    233256                    free( p_cat->pp_infos[i] ); 
    234                     REMOVE_ELEM( p_cat->pp_infos, p_cat->i_infos, i ); 
    235                     break; 
    236                 } 
    237             } 
    238             vlc_mutex_unlock( &p_input->p->input.p_item->lock ); 
    239  
    240             if( i >= p_cat->i_infos ) 
    241                 return VLC_EGENERIC; 
     257                } 
     258                if( p_cat->pp_infos ) 
     259                    free( p_cat->pp_infos ); 
     260                REMOVE_ELEM( p_input->p->input.p_item->pp_categories, p_input->p->input.p_item->i_categories, i_cat ); 
     261            } 
     262            vlc_mutex_unlock( &p_input->p->input.p_item->lock ); 
    242263 
    243264            if( !p_input->b_preparsing ) 
    244265                NotifyPlaylist( p_input ); 
     266 
     267            return VLC_SUCCESS; 
    245268        } 
    246         return VLC_SUCCESS; 
    247269 
    248270 
  • src/input/input.c

    r6b8c8ec r5c9c07f  
    254254 
    255255    /* Remove 'Now playing' info as it is probably outdated */ 
    256     input_Control( p_input, INPUT_DEL_INFO, _(VLC_META_INFO_CAT), 
    257                    VLC_META_NOW_PLAYING );     /* ? Don't translate as it might has been copied ? */ 
     256    input_Control( p_input, INPUT_DEL_INFO, _(VLC_META_INFO_CAT), VLC_META_NOW_PLAYING ); 
     257    vlc_meta_SetNowPlaying( p_item->p_meta, NULL ); 
    258258 
    259259    /* */