]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
play: Convert com_ff() to lopsub.
authorAndre Noll <maan@tuebingen.mpg.de>
Mon, 28 Mar 2016 03:47:07 +0000 (03:47 +0000)
committerAndre Noll <maan@tuebingen.mpg.de>
Sun, 26 Mar 2017 09:02:28 +0000 (11:02 +0200)
Converting com_ff() is analogous to com_jmp() since both subcommands
take a single integer argument. See the commit message of the previous
commit which converted com_jmp() for more information.

m4/lls/play_cmd.suite.m4
play.c
play.cmd

index 744e7931e8cb4c16213c8ab2b57177814d34e9cf..466468086ad8bd00ec9737967b51a5cf25ab1ed6 100644 (file)
@@ -40,3 +40,10 @@ caption = list of commands
        [description]
                The percent argument must be an integer between 0 and 100, inclusively.
        [/description]
        [description]
                The percent argument must be an integer between 0 and 100, inclusively.
        [/description]
+
+[subcommand ff]
+       purpose = set playback position relative to the current position
+       non-opts-name = seconds
+       [description]
+               Negative values mean to jump backwards the given amount of seconds.
+       [/description]
diff --git a/play.c b/play.c
index 952707545813c5af3613b3742603b5c78317682b..4545502bcf86c9042bfbfee5535b4b6b0fecc682 100644 (file)
--- a/play.c
+++ b/play.c
@@ -986,14 +986,20 @@ static int com_jmp(struct play_task *pt, struct lls_parse_result *lpr)
 }
 EXPORT_PLAY_CMD_HANDLER(jmp);
 
 }
 EXPORT_PLAY_CMD_HANDLER(jmp);
 
-static int com_ff(struct play_task *pt, int argc, char **argv)
+static int com_ff(struct play_task *pt, struct lls_parse_result *lpr)
 {
        int32_t seconds;
 {
        int32_t seconds;
+       char *errctx;
        int ret;
 
        int ret;
 
-       if (argc != 2)
-               return -E_PLAY_SYNTAX;
-       ret = para_atoi32(argv[1], &seconds);
+       ret = lls(lls_check_arg_count(lpr, 1, 1, &errctx));
+       if (ret < 0) {
+               if (errctx)
+                       PARA_ERROR_LOG("%s\n", errctx);
+               free(errctx);
+               return ret;
+       }
+       ret = para_atoi32(lls_input(0, lpr), &seconds);
        if (ret < 0)
                return ret;
        if (pt->playing && !pt->fn.btrn)
        if (ret < 0)
                return ret;
        if (pt->playing && !pt->fn.btrn)
@@ -1010,6 +1016,7 @@ static int com_ff(struct play_task *pt, int argc, char **argv)
        kill_stream(pt);
        return 0;
 }
        kill_stream(pt);
        return 0;
 }
+EXPORT_PLAY_CMD_HANDLER(ff);
 
 static int run_command(char *line, struct play_task *pt)
 {
 
 static int run_command(char *line, struct play_task *pt)
 {
index 8e2fb6ac4823cd01460496282635df23059243f6..595d0f4aa49fee237e5889f8d8699a67e068188c 100644 (file)
--- a/play.cmd
+++ b/play.cmd
@@ -2,11 +2,6 @@ BN: play
 SF: play.c
 SN: list of commands
 ---
 SF: play.c
 SN: list of commands
 ---
-N: ff
-D: Jump forwards or backwards.
-U: ff <seconds>
-H: Negative values mean to jmp backwards the given amount of seconds.
----
 N: ls
 D: List playlist.
 U: ls
 N: ls
 D: List playlist.
 U: ls