The command handler needs to check that there is a single argument
which is an integer between 0 and 100. This check needs to be modified
to use the lopsub primitives rather than accessing the argument
vector directly.
Unfortunately we can not perform the conversion of the string argument
into an int value with lopsub since the given percentage is an unnamed
option rather than an argument of an option.
The patch also rewords the summary and the help text of the jmp
subcommand slightly to be more clear.
key bindings map the colon key to this command, so pressing : in
command mode activates insert mode.
[/description]
key bindings map the colon key to this command, so pressing : in
command mode activates insert mode.
[/description]
+
+[subcommand jmp]
+ purpose = change playback position
+ non-opts-name = percent
+ [description]
+ The percent argument must be an integer between 0 and 100, inclusively.
+ [/description]
}
EXPORT_PLAY_CMD_HANDLER(bg);
}
EXPORT_PLAY_CMD_HANDLER(bg);
-static int com_jmp(struct play_task *pt, int argc, char **argv)
+static int com_jmp(struct play_task *pt, struct lls_parse_result *lpr)
{
int32_t percent;
int ret;
{
int32_t percent;
int ret;
- if (argc != 2)
- return -E_PLAY_SYNTAX;
- ret = para_atoi32(argv[1], &percent);
+ 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), &percent);
if (ret < 0)
return ret;
if (percent < 0 || percent > 100)
if (ret < 0)
return ret;
if (percent < 0 || percent > 100)
kill_stream(pt);
return 0;
}
kill_stream(pt);
return 0;
}
+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, int argc, char **argv)
{
SF: play.c
SN: list of commands
---
SF: play.c
SN: list of commands
---
-N: jmp
-D: Jump to position in current file.
-U: jmp <percent>
-H: The <percent> argument should be an integer between 0 and 100.
----
N: ff
D: Jump forwards or backwards.
U: ff <seconds>
N: ff
D: Jump forwards or backwards.
U: ff <seconds>