Changeset 37dbdbd8e1a9df9be0217aa396c3bbbc07298413

Show
Ignore:
Timestamp:
23/01/04 11:48:08 (5 years ago)
Author:
Clément Stenac <zorglub@videolan.org>
git-committer:
Clément Stenac <zorglub@videolan.org> 1074854888 +0000
git-parent:

[6729ec178e0d9b3ea08779729575db987e291f24]

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

* Doxygen doc fixes
* Add missing locks
* Duration sort

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • include/vlc_playlist.h

    r5dc722b r37dbdbd  
    33 ***************************************************************************** 
    44 * Copyright (C) 1999-2004 VideoLAN 
    5  * $Id: vlc_playlist.h,v 1.24 2004/01/11 00:45:06 zorglub Exp $ 
     5 * $Id: vlc_playlist.h,v 1.25 2004/01/23 10:48:08 zorglub Exp $ 
    66 * 
    77 * Authors: Samuel Hocevar <sam@zoy.org> 
     
    140140#define SORT_GROUP 3 
    141141#define SORT_RANDOM 4 
     142#define SORT_DURATION 5 
    142143 
    143144#define ORDER_NORMAL 0 
  • src/playlist/group.c

    r5dc722b r37dbdbd  
    33 ***************************************************************************** 
    44 * Copyright (C) 1999-2004 VideoLAN 
    5  * $Id: group.c,v 1.7 2004/01/11 00:45:06 zorglub Exp $ 
     5 * $Id: group.c,v 1.8 2004/01/23 10:48:08 zorglub Exp $ 
    66 * 
    77 * Authors: Cl�nt Stenac <zorglub@videolan.org> 
     
    4949        if( !strcasecmp( p_playlist->pp_groups[i]->psz_name , psz_name ) ) 
    5050        { 
    51             msg_Info( p_playlist, "This group already exists !"); 
     51            msg_Info( p_playlist, "this group already exists"); 
    5252            return p_playlist->pp_groups[i]; 
    5353        } 
     
    8282 * \param p_playlist the playlist to remove the group from 
    8383 * \param i_id the identifier of the group to remove 
    84  * \return 0 on success 
     84 * \return VLC_SUCCESS 
    8585 */ 
    8686int playlist_DeleteGroup( playlist_t *p_playlist, int i_id ) 
     
    132132 
    133133/** 
    134  * Find the Id of a group given its name 
     134 * Find the id of a group given its name 
    135135 * 
    136136 * \param p_playlist the playlist where to find the group 
    137  * \param char * the name to search for 
     137 * \param psz_name the name to search for 
    138138 * \return the id of the group 
    139139 */ 
     
    141141{ 
    142142    int i; 
    143     for( i=0 ; i< p_playlist->i_groups; i++ ) 
     143    for( i = 0 ; i< p_playlist->i_groups; i++ ) 
    144144    { 
    145145        if( p_playlist->pp_groups[i]->psz_name) 
     
    151151        } 
    152152    } 
    153     return 0
     153    return VLC_SUCCESS
    154154} 
  • src/playlist/info.c

    r0678f19 r37dbdbd  
    33 ***************************************************************************** 
    44 * Copyright (C) 1999-2004 VideoLAN 
    5  * $Id: info.c,v 1.5 2004/01/17 16:24:14 gbazin Exp $ 
     5 * $Id: info.c,v 1.6 2004/01/23 10:48:08 zorglub Exp $ 
    66 * 
    77 * Authors: Cl�nt Stenac <zorglub@videolan.org> 
     
    3535 * 
    3636 * \param p_playlist the playlist to get the info from 
    37  * \param i_item the item on which we want the info ( -1 for current ) 
     37 * \param i_item position of the item on 
     38 *               which we want the info ( -1 for current ) 
    3839 * \param psz_cat the category in which the info is stored 
    3940 * \param psz_name the name of the info 
    40  * \return the info value if any, NULL else 
     41 * \return the info value if any, an empty string else 
    4142*/ 
    4243char * playlist_GetInfo( playlist_t *p_playlist, int i_item, 
    43                       const char * psz_cat, const char *psz_name ) 
     44                         const char * psz_cat, const char *psz_name ) 
    4445{ 
    4546    /* Check the existence of the playlist */ 
     
    7071 * \param psz_cat the category in which the info is stored 
    7172 * \param psz_name the name of the info 
    72  * \return the info value if any, NULL else 
     73 * \return the info value if any, an empty string else 
    7374*/ 
    7475char * playlist_GetItemInfo( playlist_item_t *p_item, 
     
    9596 
    9697/** 
    97  * Get one info category. Creates it if it does not exist 
    98  * 
    99  * \param p_playlist the playlist to get the info from 
    100  * \param i_item the item on which we want the info ( -1 for current ) 
     98 * Get one info category. Create it if it does not exist 
     99 * 
     100 * \param p_playlist the playlist to get the category from 
     101 * \param i_item the position of the item on which we want 
     102 *               the info ( -1 for current ) 
    101103 * \param psz_cat the category we want 
    102104 * \return the info category. 
     
    129131 
    130132/** 
    131  * Get one info category (no p_playlist). Creates it if it does not exist 
    132  * 
    133  * \param p_item the playlist to search categories in 
     133 * Get one info category (no p_playlist). Create it if it does not exist 
     134 * 
     135 * \param p_item the playlist item to get the category from 
    134136 * \param psz_cat the category we want 
    135137 * \return the info category. 
     
    157159 * Create one info category. 
    158160 * 
    159  * \param p_playlist the playlist to get the info from 
    160  * \param i_item the item on which we want the info ( -1 for current ) 
     161 * \param p_playlist the playlist 
     162 * \param i_item the position of the item for which we create 
     163 *               the category ( -1 for current ) 
    161164 * \param psz_cat the category we want to create 
    162165 * \return the info category. 
     
    164167item_info_category_t * 
    165168playlist_CreateCategory( playlist_t *p_playlist, int i_item, 
    166                       const char * psz_cat ) 
     169                         const char * psz_cat ) 
    167170{ 
    168171    playlist_item_t *p_item = NULL; 
     
    194197 * Create one info category for an item ( no p_playlist required ) 
    195198 * 
    196  * \param p_playlist the playlist to get the info from 
    197  * \param i_item the item on which we want the info ( -1 for current ) 
     199 * \param p_playlist the playlist 
     200 * \param p_item the item to create category for 
    198201 * \param psz_cat the category we want to create 
    199202 * \return the info category. 
     
    231234 * Add an info item 
    232235 * 
    233  * \param p_playlist the playlist to get the info from 
    234  * \param i_item the item on which we want the info ( -1 for current ) 
     236 * \param p_playlist the playlist 
     237 * \param i_item the position of the item on which we want 
     238 *               the info ( -1 for current ) 
    235239 * \param psz_cat the category we want to put the info into 
    236  *     (gets created if needed) 
    237  * \return the info category. 
     240 *                (gets created if needed) 
     241 * \param psz_name the name of the info 
     242 * \param psz_format printf-style info 
     243 * \return VLC_SUCCESS 
    238244 */ 
    239245int playlist_AddInfo( playlist_t *p_playlist, int i_item, 
     
    249255    if( p_playlist == NULL) 
    250256    { 
    251         return -1
     257        return VLC_EGENERIC
    252258    } 
    253259 
     
    263269    else 
    264270    { 
    265         return -1
     271        return VLC_EGENERIC
    266272    } 
    267273 
     
    280286 *  Add info to one item ( no need for p_playlist ) 
    281287 * 
    282  * \param p_item the item on which we want the info 
    283  * \param psz_cat the category in which the info is stored (must exist !) 
     288 * \param p_item the item for which we add the info 
     289 * \param psz_cat the category in which the info is stored 
    284290 * \param psz_name the name of the info 
    285  * \return the info value if any, NULL else 
     291 * \param psz_format printf-style info 
     292 * \return VLC_SUCCESS on success 
    286293*/ 
    287294int playlist_AddItemInfo( playlist_item_t *p_item, 
     
    299306    if( p_cat == NULL) 
    300307    { 
    301         return -1
     308        return VLC_EGENERIC
    302309    } 
    303310 
     
    318325        if( ( p_info = malloc( sizeof( item_info_t) ) ) == NULL ) 
    319326        { 
    320             return -1
     327            return VLC_EGENERIC
    321328        } 
    322329        p_info->psz_name = strdup( psz_name); 
     
    340347    } 
    341348 
    342     return 0
     349    return VLC_SUCCESS
    343350} 
    344351 
     
    346353 * Add a special info : option 
    347354 * 
    348  * \param p_playlist the playlist to get the info from 
    349  * \param i_item the item on which we want the info ( -1 for current ) 
     355 * \param p_playlist the playlist 
     356 * \param i_item the position of the item on which we 
     357 *               add the option ( -1 for current ) 
    350358 * \param psz_value the option to add 
    351359 * \return the info category. 
     
    361369    if( p_playlist == NULL) 
    362370    { 
    363         return -1
     371        return VLC_EGENERIC
    364372    } 
    365373 
     
    374382    else 
    375383    { 
    376         return -1
     384        return VLC_EGENERIC
    377385    } 
    378386 
     
    381389    if( p_cat == NULL) 
    382390    { 
    383         return -1
     391        return VLC_EGENERIC
    384392    } 
    385393 
     
    387395    { 
    388396        msg_Err( p_playlist, "out of memory" ); 
    389         return -1
     397        return VLC_EGENERIC
    390398    } 
    391399 
     
    398406    INSERT_ELEM( p_cat->pp_infos, p_cat->i_infos, p_cat->i_infos, p_info ); 
    399407 
    400     return 0
     408    return VLC_SUCCESS
    401409} 
    402410 
     
    418426    if( p_cat == NULL) 
    419427    { 
    420         return -1
     428        return VLC_EGENERIC
    421429    } 
    422430 
    423431    if( ( p_info = malloc( sizeof( item_info_t) ) ) == NULL ) 
    424432    { 
    425         return -1
     433        return VLC_EGENERIC
    426434    } 
    427435 
     
    434442    INSERT_ELEM( p_cat->pp_infos, p_cat->i_infos, p_cat->i_infos, p_info ); 
    435443 
    436     return 0
    437 } 
     444    return VLC_SUCCESS
     445} 
  • src/playlist/item-ext.c

    ra536602 r37dbdbd  
    33 ***************************************************************************** 
    44 * Copyright (C) 1999-2004 VideoLAN 
    5  * $Id: item-ext.c,v 1.10 2004/01/17 14:08:37 sigmunau Exp $ 
     5 * $Id: item-ext.c,v 1.11 2004/01/23 10:48:08 zorglub Exp $ 
    66 * 
    77 * Authors: Samuel Hocevar <sam@zoy.org> 
     
    3333 
    3434/** 
    35  * Add a MRL into the playlist
     35 * Add a MRL into the playlist, duration given
    3636 * 
    3737 * \param p_playlist the playlist to add into 
     
    103103 * \param p_playlist the playlist 
    104104 * \param i_id the id to find 
    105  * \return the position, or -1 on failure 
     105 * \return the position, or VLC_EGENERIC on failure 
    106106 */ 
    107107int playlist_GetPositionById( playlist_t * p_playlist , int i_id ) 
     
    115115        } 
    116116    } 
    117     return -1
     117    return VLC_EGENERIC
    118118} 
    119119 
     
    150150 * \param i_pos the postition of the item of which we change the group 
    151151 * \param i_group the new group 
    152  * \return 0 on success, -1 on failure 
     152 * \return VLC_SUCCESS on success, VLC_EGENERIC on failure 
    153153 */ 
    154154int playlist_SetGroup( playlist_t *p_playlist, int i_pos, int i_group ) 
    155155{ 
    156156    char *psz_group; 
     157    vlc_value_t val; 
    157158    /* Check the existence of the playlist */ 
    158159    if( p_playlist == NULL) 
    159160    { 
    160         return -1; 
    161     } 
     161        return VLC_EGENERIC; 
     162    } 
     163 
     164    vlc_mutex_lock( &p_playlist->object_lock ); 
     165 
    162166    /* Get a correct item */ 
    163167    if( i_pos >= 0 && i_pos < p_playlist->i_size ) 
     
    170174    else 
    171175    { 
    172         return -1
     176        return VLC_EGENERIC
    173177    } 
    174178 
     
    178182        p_playlist->pp_items[i_pos]->i_group = i_group ; 
    179183    } 
    180     return 0; 
     184    vlc_mutex_unlock( &p_playlist->object_lock ); 
     185    val.b_bool = i_pos; 
     186    var_Set( p_playlist, "item-change", val ); 
     187 
     188    return VLC_SUCCESS; 
    181189} 
    182190 
     
    196204    if( p_playlist == NULL) 
    197205    { 
    198         return -1; 
    199     } 
     206        return VLC_EGENERIC; 
     207    } 
     208 
     209    vlc_mutex_lock( &p_playlist->object_lock ); 
     210 
    200211    /* Get a correct item */ 
    201212    if( i_pos >= 0 && i_pos < p_playlist->i_size ) 
     
    208219    else 
    209220    { 
    210         return -1
     221        return VLC_EGENERIC
    211222    } 
    212223 
     
    216227    if( psz_name ) 
    217228        p_playlist->pp_items[i_pos]->psz_name = strdup( psz_name ); 
     229 
     230    vlc_mutex_unlock( &p_playlist->object_lock ); 
    218231 
    219232    val.b_bool = i_pos; 
     
    238251    if( p_playlist == NULL) 
    239252    { 
    240         return -1; 
    241     } 
     253        return VLC_EGENERIC; 
     254    } 
     255 
     256    vlc_mutex_lock( &p_playlist->object_lock ); 
     257 
    242258    /* Get a correct item */ 
    243259    if( i_pos >= 0 && i_pos < p_playlist->i_size ) 
     
    264280    playlist_AddInfo( p_playlist, i_pos, _("General") , _("Duration"), 
    265281                      "%s", psz_buffer ); 
     282 
     283    vlc_mutex_unlock( &p_playlist->object_lock ); 
    266284 
    267285    val.b_bool = i_pos; 
     
    534552 * \param i_newpos the position of the item that will be behind the moved item 
    535553 *        after the move 
    536  * \return returns 0 
     554 * \return returns VLC_SUCCESS 
    537555 */ 
    538556int playlist_Move( playlist_t * p_playlist, int i_pos, int i_newpos) 
     
    593611    var_Set( p_playlist, "intf-change", val ); 
    594612 
    595     return 0
    596 } 
     613    return VLC_SUCCESS
     614} 
  • src/playlist/loadsave.c

    rcc43bca r37dbdbd  
    33 ***************************************************************************** 
    44 * Copyright (C) 1999-2004 VideoLAN 
    5  * $Id: loadsave.c,v 1.6 2004/01/22 19:35:14 gbazin Exp $ 
     5 * $Id: loadsave.c,v 1.7 2004/01/23 10:48:08 zorglub Exp $ 
    66 * 
    77 * Authors: Samuel Hocevar <sam@zoy.org> 
     
    4242 
    4343/** 
    44  * Import a playlist file 
     44 * Import a certain playlist file into the playlist 
    4545 * 
    46  * Import a certain playlist file into the playlist 
    4746 * \param p_playlist the playlist to which the new items will be added 
    4847 * \param psz_filename the name of the playlistfile to import 
    49  * \return 0 on succe
     48 * \return VLC_SUCCESS on succes
    5049 */ 
    5150int playlist_Import( playlist_t * p_playlist, const char *psz_filename ) 
     
    5655 
    5756    msg_Dbg( p_playlist, "clearing playlist"); 
    58  
    59     /* Create our "fake" playlist item */ 
    6057    playlist_Clear( p_playlist ); 
    6158 
     
    6461    sprintf( psz_uri, "file/playlist://%s", psz_filename); 
    6562 
     63    vlc_mutex_lock( &p_playlist->object_lock ); 
    6664    i_id = playlist_Add( p_playlist, psz_uri, psz_uri, 
    6765                  PLAYLIST_INSERT | PLAYLIST_GO , PLAYLIST_END); 
     
    7068    p_item->b_autodeletion = VLC_TRUE; 
    7169 
    72     //p_playlist->i_index = 0; 
    73  
    74 /* 
    75  *     if( p_item ) 
    76     { 
    77         p_playlist->p_input = input_CreateThread( p_playlist, p_item ); 
    78     } 
    79     */ 
     70    vlc_mutex_unlock( &p_playlist->object_lock ); 
    8071 
    8172    return VLC_SUCCESS; 
     
    8374 
    8475/** 
    85  * Export a playlist to a file 
     76 * Export a playlist to a certain type of playlistfile 
    8677 * 
    87  * Export a playlist to a certain type of playlistfile 
    8878 * \param p_playlist the playlist to export 
    8979 * \param psz_filename the location where the exported file will be saved 
    9080 * \param psz_type the type of playlist file to create. 
    91  * \return 0 on succe
     81 * \return VLC_SUCCESS on succes
    9282 */ 
    9383int playlist_Export( playlist_t * p_playlist, const char *psz_filename , 
     
    9787    playlist_export_t *p_export; 
    9888 
    99     msg_Info( p_playlist, "Saving playlist to file %s", psz_filename ); 
     89    msg_Info( p_playlist, "saving playlist to file %s", psz_filename ); 
    10090 
    10191    /* Prepare the playlist_export_t structure */ 
     
    10393    if( !p_export) 
    10494    { 
    105         msg_Err( p_playlist, "Out of memory"); 
     95        msg_Err( p_playlist, "out of memory"); 
    10696        return VLC_ENOMEM; 
    10797    } 
  • src/playlist/playlist.c

    ra826dc3 r37dbdbd  
    33 ***************************************************************************** 
    44 * Copyright (C) 1999-2004 VideoLAN 
    5  * $Id: playlist.c,v 1.74 2004/01/11 00:11:56 zorglub Exp $ 
     5 * $Id: playlist.c,v 1.75 2004/01/23 10:48:08 zorglub Exp $ 
    66 * 
    77 * Authors: Samuel Hocevar <sam@zoy.org> 
     
    3636 
    3737#define PLAYLIST_FILE_HEADER_0_5  "# vlc playlist file version 0.5" 
    38 #define PLAYLIST_FILE_HEADER_0_6  "# vlc playlist file version 0.6" 
    3938 
    4039/***************************************************************************** 
  • src/playlist/sort.c

    r0d975a4 r37dbdbd  
    33 ***************************************************************************** 
    44 * Copyright (C) 1999-2004 VideoLAN 
    5  * $Id: sort.c,v 1.8 2004/01/10 23:44:19 hartman Exp $ 
     5 * $Id: sort.c,v 1.9 2004/01/23 10:48:08 zorglub Exp $ 
    66 * 
    77 * Authors: Cl�nt Stenac <zorglub@videolan.org> 
     
    3636 * \param i_mode: SORT_ID, SORT_TITLE, SORT_GROUP, SORT_AUTHOR, SORT_RANDOM 
    3737 * \param i_type: ORDER_NORMAL or ORDER_REVERSE (reversed order) 
    38  * \return 0 on success 
     38 * \return VLC_SUCCESS on success 
    3939 */ 
    4040int playlist_Sort( playlist_t * p_playlist , int i_mode, int i_type ) 
     
    7171        var_Set( p_playlist, "intf-change", val ); 
    7272 
    73         return 0
     73        return VLC_SUCCESS
    7474    } 
    7575 
     
    9595                i_test = p_playlist->pp_items[i]->i_group - 
    9696                                 p_playlist->pp_items[i_small]->i_group; 
     97            } 
     98            else if( i_mode == SORT_DURATION ) 
     99            { 
     100                i_test = p_playlist->pp_items[i]->i_duration - 
     101                                 p_playlist->pp_items[i_small]->i_duration; 
    97102            } 
    98103            else if( i_mode == SORT_AUTHOR ) 
     
    126131    var_Set( p_playlist, "intf-change", val ); 
    127132 
    128     return 0
     133    return VLC_SUCCESS
    129134}