[vlc-devel] [PATCH] Reshuffle after playthrough

Alex Warhawk ax.warhawk at gmail.com
Fri Oct 4 16:59:18 CEST 2013

It looks like i found the correct points to insert my code, now it seems
quite obvious to me. The patch is attached to this mail (again) and I
already did some testing. You can find the results here:


This patch shuffles the playlist ether when it automatically advances and
reaches the end, or when the end / beginning is reached by using next /
prev. The Gist shows the according log output for each of the 3 cases. You
can observe reshuffling after all songs have been played exactly once.

Might this patch work for you and resolve this issue? ;)

On Mon, Sep 30, 2013 at 11:39 PM, Alex Warhawk <ax.warhawk at gmail.com> wrote:

> there is no simple way to check whether all elements have been played, it
> would require me keep track of everything as well as managing adding /
> removing elements from the playlist.
> my patch does the following: when the NextItem function is invoked as
> result of automatically advancing. it checks if the last element has been
> played and if so: shuffles the playlist and restarts with element 0.
> when using the next button the NextItem function works different. instead
> of simply increment i_current_index it uses the p_sys->request mechanism to
> figure out which element to play next. firstly i am afraid of breaking
> stuff when i alter the code to much (i'm not very familiar with the source
> code). secondly when i add shuffle the same way i did on the other part,
> there won't be a guarantee every element is played once before shuffling
> again.
> reason: NextItem gets told which element to play next. if i reshuffle the
> playlist this next element which should be played might not be the first
> element of the new order, hence some elements are not played before the
> last one is reached.
> if i override the element request in any way i might break the whole
> request mechanism.
> On Mon, Sep 30, 2013 at 11:22 PM, Jean-Baptiste Kempf <jb at videolan.org>wrote:
>> On 30 Sep, Alex Warhawk wrote :
>> > i agree with you, but i only found a way to integrate this for
>> > automatically advancing to the next element.
>> > the code which gets executed when hitting the next button is totally
>> > different hence i was unable to find the right spot to put my code in
>> > without breaking something or achieving the task fully.
>> >
>> > example, letting vlc play for ever
>> > A -> C -> B -(reshuffle)-> B -> C -> A -(reshuffle)-> C -> B -> A etc
>> >
>> > example, hitting next over and over gain
>> > A -> C -> B -> A -> C -> B -> A -> C -> B -> etc.
>> Why no reshuffle when all of the elements have been played once?
>> --
>> Jean-Baptiste Kempf
>> http://www.jbkempf.com/ - +33 672 704 734
>> Sent from my Electronic Device
>> _______________________________________________
>> vlc-devel mailing list
>> To unsubscribe or modify your subscription options:
>> https://mailman.videolan.org/listinfo/vlc-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20131004/175c34ca/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.diff
Type: application/octet-stream
Size: 2085 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20131004/175c34ca/attachment.obj>

More information about the vlc-devel mailing list