play: Fix prev command.
authorAndre Noll <maan@systemlinux.org>
Sun, 22 Sep 2013 14:45:10 +0000 (16:45 +0200)
committerAndre Noll <maan@systemlinux.org>
Sun, 22 Sep 2013 14:57:12 +0000 (16:57 +0200)
The command handler for com_prev() stores the number of the
previous (valid) file in ->next_file of struct play_task and sets
->rq to CRT_FILE_CHANGE. The real work is supposed to be done in
load_next_file() which is called from the main post_select() function.

However, load_next_file() ignores ->next_file and computes the number
of the next file itself. Hence the "prev" command acts exactly as
"next", i.e. it selects the next rather than the previous file.

Fix this by ignoring ->next_file only if ->rq is CRT_NONE, which
indicates a normal end of file condition.

play.c

diff --git a/play.c b/play.c
index 6eed58a..01125ab 100644 (file)
--- a/play.c
+++ b/play.c
@@ -431,7 +431,7 @@ static int load_next_file(struct play_task *pt)
        int ret;
 
 again:
-       if (pt->rq == CRT_NONE || pt->rq == CRT_FILE_CHANGE) {
+       if (pt->rq == CRT_NONE) {
                pt->start_chunk = 0;
                ret = next_valid_file(pt);
                if (ret < 0)