[vlc-commits] Reshuffle after playthrough

Alex Warhawk git at videolan.org
Tue Oct 8 23:55:25 CEST 2013


vlc/vlc-2.1 | branch: master | Alex Warhawk <ax.warhawk at gmail.com> | Mon Oct  7 12:59:21 2013 +0200| [60d6356217879597ee9f4789c27b4a4409f568af] | committer: Jean-Baptiste Kempf

Reshuffle after playthrough

Close #3932

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
(cherry picked from commit 2f2c4b076805ac4a568f8ea3334159e759fdcc6b)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.1.git/?a=commit;h=60d6356217879597ee9f4789c27b4a4409f568af
---

 src/playlist/thread.c |   18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/src/playlist/thread.c b/src/playlist/thread.c
index 9bfbc3c..08d9feb 100644
--- a/src/playlist/thread.c
+++ b/src/playlist/thread.c
@@ -332,6 +332,12 @@ static playlist_item_t *NextItem( playlist_t *p_playlist )
                 if( p_playlist->i_current_index >= p_playlist->current.i_size )
                 {
                     PL_DEBUG( "looping - restarting at beginning of node" );
+                    /* reshuffle playlist when end is reached */
+                    if( var_GetBool( p_playlist, "random" ) ) {
+                        PL_DEBUG( "reshuffle playlist" );
+                        ResetCurrentlyPlaying( p_playlist,
+                                get_current_status_item( p_playlist ) );
+                    }
                     p_playlist->i_current_index = 0;
                 }
             }
@@ -346,6 +352,12 @@ static playlist_item_t *NextItem( playlist_t *p_playlist )
                 if( p_playlist->i_current_index <= -1 )
                 {
                     PL_DEBUG( "looping - restarting at end of node" );
+                    /* reshuffle playlist when beginning is reached */
+                    if( var_GetBool( p_playlist, "random" ) ) {
+                        PL_DEBUG( "reshuffle playlist" );
+                        ResetCurrentlyPlaying( p_playlist,
+                                get_current_status_item( p_playlist ) );
+                    }
                     p_playlist->i_current_index = p_playlist->current.i_size-1;
                 }
             }
@@ -406,6 +418,12 @@ static playlist_item_t *NextItem( playlist_t *p_playlist )
         {
             if( !b_loop || p_playlist->current.i_size == 0 )
                 return NULL;
+            /* reshuffle after last item has been played */
+            if( var_GetBool( p_playlist, "random" ) ) {
+                PL_DEBUG( "reshuffle playlist" );
+                ResetCurrentlyPlaying( p_playlist,
+                                       get_current_status_item( p_playlist ) );
+            }
             p_playlist->i_current_index = 0;
         }
         PL_DEBUG( "using item %i", p_playlist->i_current_index );



More information about the vlc-commits mailing list