[FFmpeg-devel] [PATCH] ffplay: add option to allow custom jump interval
Gyan Doshi
gyandoshi at gmail.com
Sun Sep 2 07:51:34 EEST 2018
On 01-09-2018 10:25 PM, Marton Balint wrote:
>
> In the descriptive text write "seeking" instead of jumping.
>
>> @item -nodisp
>> Disable graphical display.
>> @item -noborder
>> diff --git a/fftools/ffplay.c b/fftools/ffplay.c
>> index 368e262123..83eef17797 100644
>> --- a/fftools/ffplay.c
>> +++ b/fftools/ffplay.c
>> @@ -319,6 +319,7 @@ static int video_disable;
>> static int subtitle_disable;
>> static const char* wanted_stream_spec[AVMEDIA_TYPE_NB] = {0};
>> static int seek_by_bytes = -1;
>> +static float jump_interval = 0;
>
> why not make this = 10.0 by default? And change the code below accordingly.
Changed 'jump' to 'seek' throughout.
Haven't changed code much, kept basic protection against invalid input
(val < 0)
Gyan
-------------- next part --------------
From abd6b2616ec2caf115dcdf05fba6be0a3c80a17a Mon Sep 17 00:00:00 2001
From: Gyan Doshi <ffmpeg at gyani.pro>
Date: Sat, 1 Sep 2018 11:33:17 +0530
Subject: [PATCH v2] ffplay: add option to allow custom seek interval
At present, left and right keys are hardcoded to seek by 10 seconds.
Added option allows users to set a custom interval, in seconds.
---
doc/ffplay.texi | 2 ++
fftools/ffplay.c | 8 +++++---
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/doc/ffplay.texi b/doc/ffplay.texi
index c95956ea17..8dd7803e97 100644
--- a/doc/ffplay.texi
+++ b/doc/ffplay.texi
@@ -60,6 +60,8 @@ Play @var{duration} seconds of audio/video.
see @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
@item -bytes
Seek by bytes.
+ at item -seek
+Set custom interval, in seconds, for seeking using left/right keys. Default is 10 seconds.
@item -nodisp
Disable graphical display.
@item -noborder
diff --git a/fftools/ffplay.c b/fftools/ffplay.c
index 368e262123..8409952f3b 100644
--- a/fftools/ffplay.c
+++ b/fftools/ffplay.c
@@ -319,6 +319,7 @@ static int video_disable;
static int subtitle_disable;
static const char* wanted_stream_spec[AVMEDIA_TYPE_NB] = {0};
static int seek_by_bytes = -1;
+static float seek_interval = 10;
static int display_disable;
static int borderless;
static int startup_volume = 100;
@@ -3341,10 +3342,10 @@ static void event_loop(VideoState *cur_stream)
seek_chapter(cur_stream, -1);
break;
case SDLK_LEFT:
- incr = -10.0;
+ incr = seek_interval ? -FFABS(seek_interval) : -10.0;
goto do_seek;
case SDLK_RIGHT:
- incr = 10.0;
+ incr = seek_interval ? FFABS(seek_interval) : 10.0;
goto do_seek;
case SDLK_UP:
incr = 60.0;
@@ -3580,6 +3581,7 @@ static const OptionDef options[] = {
{ "ss", HAS_ARG, { .func_arg = opt_seek }, "seek to a given position in seconds", "pos" },
{ "t", HAS_ARG, { .func_arg = opt_duration }, "play \"duration\" seconds of audio/video", "duration" },
{ "bytes", OPT_INT | HAS_ARG, { &seek_by_bytes }, "seek by bytes 0=off 1=on -1=auto", "val" },
+ { "seek", OPT_FLOAT | HAS_ARG, { &seek_interval }, "set seek interval for left/right keys, in seconds", "seconds" },
{ "nodisp", OPT_BOOL, { &display_disable }, "disable graphical display" },
{ "noborder", OPT_BOOL, { &borderless }, "borderless window" },
{ "volume", OPT_INT | HAS_ARG, { &startup_volume}, "set startup volume 0=min 100=max", "volume" },
@@ -3650,7 +3652,7 @@ void show_help_default(const char *opt, const char *arg)
"c cycle program\n"
"w cycle video filters or show modes\n"
"s activate frame-step mode\n"
- "left/right seek backward/forward 10 seconds\n"
+ "left/right seek backward/forward 10 seconds or to custom interval if -seek is set\n"
"down/up seek backward/forward 1 minute\n"
"page down/page up seek backward/forward 10 minutes\n"
"right mouse click seek to percentage in file corresponding to fraction of width\n"
--
2.18.0
More information about the ffmpeg-devel
mailing list