Changeset 6c0ceeb39cf4038daffa2e078e49e39949342bc3

Show
Ignore:
Timestamp:
16/01/05 15:10:47 (4 years ago)
Author:
Clément Stenac <zorglub@videolan.org>
git-committer:
Clément Stenac <zorglub@videolan.org> 1105884647 +0000
git-parent:

[f2797b3effbd173cb2aa7c1a267fa19fe3eb100a]

git-author:
Clément Stenac <zorglub@videolan.org> 1105884647 +0000
Message:

Remove playlist info accessors (as they now belong to input_item) and use vlc_input_item_AddInfo and vlc_input_item_GetInfo instead

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • Makefile.am

    r3e29864 r6c0ceeb  
    331331    src/playlist/item.c \ 
    332332    src/playlist/item-ext.c \ 
    333     src/playlist/info.c \ 
    334333    src/playlist/services_discovery.c \ 
    335334    src/input/access.c \ 
  • include/vlc_input.h

    r301ea6e r6c0ceeb  
    159159} 
    160160 
     161VLC_EXPORT( char *, vlc_input_item_GetInfo, ( input_item_t *p_i, const char *psz_cat,const char *psz_name ) ); 
     162VLC_EXPORT(int, vlc_input_item_AddInfo, ( input_item_t *p_i, const char *psz_cat, const char *psz_name, const char *psz_format, ... ) ); 
     163 
    161164/***************************************************************************** 
    162165 * Seek point: (generalisation of chapters) 
  • include/vlc_playlist.h

    rd8712f2 r6c0ceeb  
    332332VLC_EXPORT( int, playlist_GetPositionById, (playlist_t *,int ) ); 
    333333 
    334 /* Info functions */ 
    335 VLC_EXPORT( char * , playlist_GetInfo, ( playlist_t * , int, const char *, const char *) ); 
    336 VLC_EXPORT( char * , playlist_ItemGetInfo, ( playlist_item_t * , const char *, const char *) ); 
    337  
    338 VLC_EXPORT( info_category_t*, playlist_ItemGetCategory, ( playlist_item_t *, const char *) ); 
    339  
    340 VLC_EXPORT( info_category_t*, playlist_ItemCreateCategory, ( playlist_item_t *, const char *) ); 
    341  
    342 VLC_EXPORT( int, playlist_AddInfo, (playlist_t *, int, const char * , const char *, const char *, ...) ); 
    343 VLC_EXPORT( int, playlist_ItemAddInfo, (playlist_item_t *, const char * , const char *, const char *, ...) ); 
    344334VLC_EXPORT( int, playlist_ItemAddOption, (playlist_item_t *, const char *) ); 
    345335 
  • modules/access/cdda/info.c

    rcaf4b94 r6c0ceeb  
    802802    if (FIELD && strlen(FIELD))                                          \ 
    803803    {                                                                    \ 
    804         playlist_ItemAddInfo( p_item, _("Track"), _(TITLE),              \ 
     804        vlc_input_item_AddInfo( &p_item->input, _("Track"), _(TITLE),    \ 
    805805                              "%s", FIELD);                              \ 
    806806    } 
     
    845845 
    846846int CDDAAddMetaToItem( access_t *p_access, cdda_data_t *p_cdda, 
    847                        playlist_item_t *p_item, int i_track,  
    848               vlc_bool_t b_single ) 
     847                       playlist_item_t *p_item, int i_track, 
     848                       vlc_bool_t b_single ) 
    849849{ 
    850850    vlc_mutex_lock( &p_item->input.lock ); 
    851851 
    852852    add_playlist_track_info_str("Source",  p_cdda->psz_source); 
    853     playlist_ItemAddInfo( p_item, _("Track"), _("Track Number"), 
    854                           "%d", i_track ); 
     853    vlc_input_item_AddInfo( &p_item->input, _("Track"), _("Track Number"), 
     854                          "%d", i_track ); 
    855855 
    856856    if (p_cdda->p_cdtext[i_track]) 
  • modules/gui/macosx/playlistinfo.m

    rfc548ac r6c0ceeb  
    151151        p_item->input.psz_uri = strdup( [[o_uri_txt stringValue] UTF8String] ); 
    152152        p_item->input.psz_name = strdup( [[o_title_txt stringValue] UTF8String] ); 
    153         playlist_ItemAddInfo( p_item, _("General"), _("Author"), [[o_author_txt stringValue] UTF8String]); 
     153        vlc_input_item_AddInfo( &p_item->input, _("General"), _("Author"), [[o_author_txt stringValue] UTF8String]); 
    154154        vlc_mutex_unlock( &p_item->input.lock ); 
    155155         
  • modules/gui/wince/iteminfo.cpp

    r801b203 r6c0ceeb  
    132132            70, 10 + 15 + 10 - 3, rcClient.right - 70 - 10, 15 + 6, 
    133133            hwnd, NULL, hInst, NULL); 
    134  
    135         /* Author Textbox */ 
    136         author_label = CreateWindow( _T("STATIC"), _T("Author:"), 
    137                          WS_CHILD | WS_VISIBLE | SS_RIGHT , 
    138                          0, 10 + 2*( 15 + 10 ), 60, 15, 
    139                          hwnd, NULL, hInst, NULL); 
    140  
    141         author_text = CreateWindow( _T("EDIT"), 
    142             _FROMMB(playlist_ItemGetInfo( p_item, _("General"), _("Author") )), 
    143             WS_CHILD | WS_VISIBLE | WS_BORDER | SS_LEFT | ES_AUTOHSCROLL, 
    144             70, 10 + 2*( 15 + 10 ) - 3, rcClient.right - 70 - 10, 15 + 6, 
    145             hwnd, NULL, hInst, NULL ); 
    146134 
    147135        /* CheckBox */ 
     
    291279    p_item->input.psz_uri = strdup( _TOMB(psz_uri) ); 
    292280 
    293     TCHAR psz_author[MAX_PATH]; 
    294     Edit_GetText( author_text, psz_author, MAX_PATH ); 
    295     playlist_ItemAddInfo( p_item, "General", "Author", _TOMB(psz_author) ); 
    296  
    297281    vlc_bool_t b_old_enabled = p_item->b_enabled; 
    298282 
  • modules/gui/wince/wince.h

    r801b203 r6c0ceeb  
    253253    HWND name_label; 
    254254    HWND name_text; 
    255  
    256     HWND author_label; 
    257     HWND author_text; 
    258255 
    259256    HWND checkbox_label; 
  • modules/gui/wxwindows/iteminfo.cpp

    rf5009d6 r6c0ceeb  
    5252    Uri_Event, 
    5353    Name_Event, 
    54     Author_Event, 
    5554    Enabled_Event, 
    5655}; 
     
    156155    sizer->Add( name_text, 1 , wxALIGN_RIGHT | wxALL , 5 ); 
    157156 
    158     /* Author Textbox */ 
    159     wxStaticText *author_label = 
    160            new wxStaticText( info_panel, -1, wxU(_("Author")) ); 
    161  
    162     author_text = new wxTextCtrl( info_panel, Uri_Event, 
    163                                    wxU( playlist_ItemGetInfo( p_item, 
    164                                           _("General"), _("Author") ) ), 
    165                                    wxDefaultPosition, wxSize( 300, -1 ), 
    166                                    wxTE_PROCESS_ENTER); 
    167  
    168     sizer->Add( author_label, 0 , wxALIGN_LEFT | wxALL , 5 ); 
    169     sizer->Add( author_text, 1 , wxALIGN_RIGHT | wxALL , 5); 
    170  
    171157    /* Treeview */ 
    172158    info_tree = new wxTreeCtrl( info_panel, -1, wxDefaultPosition, 
     
    222208    p_item->input.psz_name = strdup( name_text->GetLineText(0).mb_str() ); 
    223209    p_item->input.psz_uri = strdup( uri_text->GetLineText(0).mb_str() ); 
    224     playlist_ItemAddInfo( p_item,"General","Author", 
    225                             author_text->GetLineText(0).mb_str() ); 
    226210    vlc_mutex_unlock( &p_item->input.lock ); 
    227211    EndModal( wxID_OK ); 
  • modules/gui/wxwindows/playlist.cpp

    r153deb4 r6c0ceeb  
    518518    wxString msg; 
    519519    wxString duration = wxU( "" ); 
    520     char *psz_author = playlist_ItemGetInfo( p_item, _("Meta-information"), 
     520    char *psz_author = vlc_input_item_GetInfo( &p_item->input, 
     521                                                     _("Meta-information"), 
    521522                                                     _("Artist")); 
    522523    char psz_duration[MSTRTIME_MAX_SIZE]; 
     
    527528        secstotimestr( psz_duration, dur/1000000 ); 
    528529        duration.Append( wxU( " ( " ) +  wxString( wxU( psz_duration ) ) + 
    529                          wxU( ")" ) ); 
     530                         wxU( " )" ) ); 
    530531    } 
    531532 
  • modules/gui/wxwindows/wxwindows.h

    rf079727 r6c0ceeb  
    941941    wxTextCtrl *uri_text; 
    942942    wxTextCtrl *name_text; 
    943     wxTextCtrl *author_text; 
    944943 
    945944    wxTreeCtrl *info_tree; 
  • src/input/control.c

    r315f9cd r6c0ceeb  
    130130        case INPUT_ADD_INFO: 
    131131        { 
     132            /* FIXME : Impossible to use vlc_input_item_AddInfo because of 
     133             * the ... problem ? */ 
    132134            char *psz_cat = (char *)va_arg( args, char * ); 
    133135            char *psz_name = (char *)va_arg( args, char * ); 
     
    205207            *ppsz_value = NULL; 
    206208 
    207             vlc_mutex_lock( &p_input->input.p_item->lock ); 
    208             for( i = 0; i < p_input->input.p_item->i_categories; i++ ) 
    209             { 
    210                 if( !strcmp( p_input->input.p_item->pp_categories[i]->psz_name, 
    211                              psz_cat ) ) break; 
    212             } 
    213  
    214             if( i != p_input->input.p_item->i_categories ) 
    215             { 
    216                 info_category_t *p_cat; 
    217                 p_cat = p_input->input.p_item->pp_categories[i]; 
    218  
    219                 for( i = 0; i < p_cat->i_infos; i++ ) 
    220                 { 
    221                     if( !strcmp( p_cat->pp_infos[i]->psz_name, psz_name ) ) 
    222                     { 
    223                         if( p_cat->pp_infos[i]->psz_value ) 
    224                         { 
    225                             *ppsz_value =strdup(p_cat->pp_infos[i]->psz_value); 
    226                             i_ret = VLC_SUCCESS; 
    227                         } 
    228                         break; 
    229                     } 
    230                 } 
    231             } 
    232             vlc_mutex_unlock( &p_input->input.p_item->lock ); 
     209            *ppsz_value = vlc_input_item_GetInfo( p_input->input.p_item, 
     210                                                  psz_cat, psz_name ); 
    233211            return i_ret; 
    234212        } 
     
    443421 
    444422            vlc_mutex_lock( &p_input->input.p_item->lock ); 
    445             /* Check if option already exists */             
     423            /* Check if option already exists */ 
    446424            for( i = 0; i < p_input->input.p_item->i_options; i++ ) 
    447425            { 
  • src/input/input.c

    rb19e66ac r6c0ceeb  
    24432443             *pi_title_end, *pi_chapter_end ); 
    24442444} 
     2445 
     2446 
     2447/*********************************************************************** 
     2448 * Info management functions 
     2449 ***********************************************************************/ 
     2450char *vlc_input_item_GetInfo( input_item_t *p_i, 
     2451                              const char *psz_cat, 
     2452                              const char *psz_name ) 
     2453{ 
     2454    int i,j; 
     2455 
     2456    vlc_mutex_lock( &p_i->lock ); 
     2457 
     2458    for( i = 0 ; i< p_i->i_categories  ; i++ ) 
     2459    { 
     2460        info_category_t *p_cat = p_i->pp_categories[i]; 
     2461 
     2462        if( !psz_cat || strcmp( p_cat->psz_name, psz_cat ) ) 
     2463            continue; 
     2464 
     2465        for( j = 0; j < p_cat->i_infos ; j++ ) 
     2466        { 
     2467            if( !strcmp( p_cat->pp_infos[j]->psz_name, psz_name ) ) 
     2468            { 
     2469                vlc_mutex_unlock( &p_i->lock ); 
     2470                return strdup( p_cat->pp_infos[j]->psz_value ); 
     2471            } 
     2472        } 
     2473    } 
     2474    vlc_mutex_unlock( &p_i->lock ); 
     2475    return strdup( "" ); 
     2476} 
     2477 
     2478int vlc_input_item_AddInfo( input_item_t *p_i, 
     2479                            const char *psz_cat, 
     2480                            const char *psz_name, 
     2481                            const char *psz_format, ... ) 
     2482{ 
     2483    va_list args; 
     2484    int i; 
     2485    info_t *p_info = NULL; 
     2486    info_category_t *p_cat = NULL ; 
     2487 
     2488    vlc_mutex_lock( &p_i->lock ); 
     2489 
     2490    for( i = 0 ; i < p_i->i_categories ; i ++ ) 
     2491    { 
     2492        if( !strcmp( p_i->pp_categories[i]->psz_name, psz_cat ) ) 
     2493        { 
     2494            p_cat = p_i->pp_categories[i]; 
     2495            break; 
     2496        } 
     2497    } 
     2498    if( !p_cat ) 
     2499    { 
     2500        if( ( p_cat = (info_category_t *)malloc( 
     2501                                     sizeof( info_category_t ) ) )  == NULL ) 
     2502        { 
     2503            vlc_mutex_unlock( &p_i->lock ); 
     2504            return VLC_EGENERIC; 
     2505        } 
     2506        p_cat->psz_name = strdup( psz_cat ); 
     2507        p_cat->i_infos = 0; 
     2508        p_cat->pp_infos = 0; 
     2509        INSERT_ELEM( p_i->pp_categories, p_i->i_categories, p_i->i_categories, 
     2510                     p_cat ); 
     2511    } 
     2512 
     2513    for( i = 0; i< p_cat->i_infos; i++ ) 
     2514    { 
     2515        if( !strcmp( p_cat->pp_infos[i]->psz_name, psz_name ) ) 
     2516        { 
     2517            p_info = p_cat->pp_infos[i]; 
     2518            break; 
     2519        } 
     2520    } 
     2521 
     2522    if( !p_info ) 
     2523    { 
     2524        if( ( p_info = (info_t *)malloc( sizeof( info_t ) ) ) == NULL ) 
     2525        { 
     2526            vlc_mutex_unlock( &p_i->lock ); 
     2527            return VLC_EGENERIC; 
     2528        } 
     2529        INSERT_ELEM( p_cat->pp_infos, p_cat->i_infos, p_cat->i_infos, p_info ); 
     2530        p_info->psz_name = strdup( psz_name ); 
     2531    } 
     2532    else 
     2533    { 
     2534        if( p_info->psz_value ) free( p_info->psz_value ); 
     2535    } 
     2536 
     2537    va_start( args, psz_format ); 
     2538    vasprintf( &p_info->psz_value, psz_format, args); 
     2539    va_end( args ); 
     2540 
     2541    vlc_mutex_unlock( &p_i->lock ); 
     2542 
     2543    return VLC_SUCCESS; 
     2544} 
     2545 
  • src/playlist/item.c

    r301ea6e r6c0ceeb  
    2828#include <vlc/input.h> 
    2929 
     30#include "vlc_input.h" 
    3031#include "vlc_playlist.h" 
    3132 
     
    8788    if( p_item->input.i_type == ITEM_TYPE_UNKNOWN ) 
    8889        GuessType( &p_item->input ); 
    89  
    90     playlist_ItemCreateCategory( p_item, _("General") ); 
    9190 
    9291    return p_item; 
     
    277276            memcpy( psz_buffer, "--:--:--", sizeof("--:--:--") ); 
    278277        } 
    279         playlist_ItemAddInfo( p_item, _("General") , _("Duration"), 
    280                               "%s", psz_buffer ); 
     278        vlc_input_item_AddInfo( &p_item->input, _("General") , _("Duration"), 
     279                                "%s", psz_buffer ); 
    281280 
    282281        return VLC_SUCCESS; 
  • src/playlist/sort.c

    r92cf251 r6c0ceeb  
    238238        else if ( i_mode == SORT_AUTHOR ) 
    239239        { 
    240             psz_search = playlist_ItemGetInfo( pp_items[i]
     240            psz_search = vlc_input_item_GetInfo( &pp_items[i]->input
    241241                            _("Meta-information"), _( "Artist" ) ); 
    242242        }