Changeset f20532c0c0c1b7c48d352dc98b9421c3e72502cd

Show
Ignore:
Timestamp:
16/08/02 14:31:04 (6 years ago)
Author:
Sam Hocevar <sam@videolan.org>
git-committer:
Sam Hocevar <sam@videolan.org> 1029501064 +0000
git-parent:

[ba97736ab86529d03ca3a0d52256c01b6a9b5555]

git-author:
Sam Hocevar <sam@videolan.org> 1029501064 +0000
Message:
  • ./src/playlist/playlist.c: added -Z (--random) for endless random playing.
Files:

Legend:

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

    r8d5c85f rf20532c  
    55 ***************************************************************************** 
    66 * Copyright (C) 1998-2002 VideoLAN 
    7  * $Id: input.c,v 1.210 2002/08/12 22:12:51 massiot Exp $ 
     7 * $Id: input.c,v 1.211 2002/08/16 12:31:04 sam Exp $ 
    88 * 
    99 * Authors: Christophe Massiot <massiot@via.ecp.fr> 
     
    154154    msg_Info( p_input, "playlist item `%s'", p_input->psz_source ); 
    155155 
    156     p_info = input_InfoCategory( p_input, "General"); 
    157     input_AddInfo( p_info, "Playlist item", p_input->psz_source ); 
     156    p_info = input_InfoCategory( p_input, "General" ); 
     157    input_AddInfo( p_info, "playlist item", p_input->psz_source ); 
    158158    vlc_object_attach( p_input, p_parent ); 
    159159 
  • src/libvlc.h

    r8d5c85f rf20532c  
    33 ***************************************************************************** 
    44 * Copyright (C) 1998-2002 VideoLAN 
    5  * $Id: libvlc.h,v 1.13 2002/08/12 22:12:51 massiot Exp $ 
     5 * $Id: libvlc.h,v 1.14 2002/08/16 12:31:04 sam Exp $ 
    66 * 
    77 * Authors: Vincent Seguin <seguin@via.ecp.fr> 
     
    264264    "advantage of them.") 
    265265 
    266 #define PL_LAUNCH_TEXT N_("launch playlist on startup") 
    267 #define PL_LAUNCH_LONGTEXT N_( \ 
     266#define RANDOM_TEXT N_("play files randomly forever") 
     267#define RANDOM_LONGTEXT N_( \ 
     268    "When selected, vlc will randomly play files in the playlist until " \ 
     269    "interrupted.") 
     270 
     271#define LAUNCH_TEXT N_("launch playlist on startup") 
     272#define LAUNCH_LONGTEXT N_( \ 
    268273    "If you want vlc to start playing on startup, then enable this option.") 
    269274 
    270 #define PL_ENQUEUE_TEXT N_("enqueue items in playlist") 
    271 #define PL_ENQUEUE_LONGTEXT N_( \ 
     275#define ENQUEUE_TEXT N_("enqueue items in playlist") 
     276#define ENQUEUE_LONGTEXT N_( \ 
    272277    "If you want vlc to add items to the playlist as you open them, then " \ 
    273278    "enable this option.") 
    274279 
    275 #define PL_LOOP_TEXT N_("loop playlist on end") 
    276 #define PL_LOOP_LONGTEXT N_( \ 
     280#define LOOP_TEXT N_("loop playlist on end") 
     281#define LOOP_LONGTEXT N_( \ 
    277282    "If you want vlc to keep playing the playlist indefinitely then enable " \ 
    278283    "this option.") 
     
    422427    /* Playlist options */ 
    423428    add_category_hint( N_("Playlist"), NULL ); 
    424     add_bool( "playlist", 0, NULL, PL_LAUNCH_TEXT, PL_LAUNCH_LONGTEXT ); 
    425     add_bool( "enqueue", 0, NULL, PL_ENQUEUE_TEXT, PL_ENQUEUE_LONGTEXT ); 
    426     add_bool( "loop", 0, NULL, PL_LOOP_TEXT, PL_LOOP_LONGTEXT ); 
     429    add_bool_with_short( "random", 'Z', 0, NULL, RANDOM_TEXT, RANDOM_LONGTEXT ); 
     430    add_bool( "playlist", 0, NULL, LAUNCH_TEXT, LAUNCH_LONGTEXT ); 
     431    add_bool( "enqueue", 0, NULL, ENQUEUE_TEXT, ENQUEUE_LONGTEXT ); 
     432    add_bool( "loop", 0, NULL, LOOP_TEXT, LOOP_LONGTEXT ); 
    427433 
    428434    /* Misc options */ 
  • src/playlist/playlist.c

    r6e8f950 rf20532c  
    33 ***************************************************************************** 
    44 * Copyright (C) 1999-2001 VideoLAN 
    5  * $Id: playlist.c,v 1.10 2002/08/12 09:34:15 sam Exp $ 
     5 * $Id: playlist.c,v 1.11 2002/08/16 12:31:04 sam Exp $ 
    66 * 
    77 * Authors: Samuel Hocevar <sam@zoy.org> 
     
    106106    playlist_item_t *p_item; 
    107107 
    108     msg_Warn( p_playlist, "adding playlist item � %s �", psz_target ); 
     108    msg_Dbg( p_playlist, "adding playlist item � %s �", psz_target ); 
    109109 
    110110    /* Create the new playlist item */ 
     
    214214    if( i_pos >= 0 && i_pos < p_playlist->i_size ) 
    215215    { 
    216         msg_Warn( p_playlist, "deleting playlist item � %s �", 
    217                               p_playlist->pp_items[i_pos]->psz_name ); 
     216        msg_Dbg( p_playlist, "deleting playlist item � %s �", 
     217                             p_playlist->pp_items[i_pos]->psz_name ); 
    218218 
    219219        free( p_playlist->pp_items[i_pos]->psz_name ); 
     
    436436 
    437437    /* Increment */ 
    438     p_playlist->i_index += i_arg; 
     438    if( config_GetInt( p_playlist, "random" ) ) 
     439    { 
     440        /* Simple random stuff */ 
     441        srand( mdate() ); 
     442        p_playlist->i_index += 1 + (int) ( 1.0 * p_playlist->i_size * rand() 
     443                                            / ( RAND_MAX + 1.0 ) ); 
     444    } 
     445    else 
     446    { 
     447        p_playlist->i_index += i_arg; 
     448    } 
    439449 
    440450    /* Boundary check */ 
     
    444454             || config_GetInt( p_playlist, "loop" ) ) 
    445455        { 
    446             p_playlist->i_index = 0; 
     456            p_playlist->i_index -= p_playlist->i_size 
     457                         * ( p_playlist->i_index / p_playlist->i_size ); 
    447458        } 
    448459        else