[FFmpeg-devel] [PATCH] ffplay: Add ignore_keydown and ignore_mousedown options.

Ganesh Ajjanagadde gajjanag at mit.edu
Thu Jan 14 23:49:31 CET 2016


On Thu, Jan 14, 2016 at 5:39 PM, Vittorio Gambaletta (VittGam)
<ffmpeg-dev at vittgam.net> wrote:
> Hi,
>
>
> On 14/01/2016 23:15:16 CET, Ganesh Ajjanagadde wrote:
>>
>> On Thu, Jan 14, 2016 at 3:56 PM, Vittorio Gambaletta (VittGam)
>> <ffmpeg-dev at vittgam.net> wrote:
>>>
>>> ---
>>>  ffplay.c |   10 ++++++++++
>>>  1 file changed, 10 insertions(+)
>>>
>>> diff --git a/ffplay.c b/ffplay.c
>>> index d2e3dc6..0837d58 100644
>>> --- a/ffplay.c
>>> +++ b/ffplay.c
>>> @@ -336,6 +336,8 @@ static int decoder_reorder_pts = -1;
>>>  static int autoexit;
>>>  static int exit_on_keydown;
>>>  static int exit_on_mousedown;
>>> +static int ignore_keydown;
>>> +static int ignore_mousedown;
>>>  static int loop = 1;
>>>  static int framedrop = -1;
>>>  static int infinite_buffer = -1;
>>> @@ -3357,6 +3359,9 @@ static void event_loop(VideoState *cur_stream)
>>>                  do_exit(cur_stream);
>>>                  break;
>>>              }
>>> +            if (ignore_keydown) {
>>> +                break;
>>> +            }
>>>              switch (event.key.keysym.sym) {
>>>              case SDLK_ESCAPE:
>>>              case SDLK_q:
>>> @@ -3479,6 +3484,9 @@ static void event_loop(VideoState *cur_stream)
>>>                  cursor_hidden = 0;
>>>              }
>>>              cursor_last_shown = av_gettime_relative();
>>> +            if (ignore_mousedown) {
>>> +                break;
>>> +            }
>>>              if (event.type == SDL_MOUSEBUTTONDOWN) {
>>>                  x = event.button.x;
>>>              } else {
>>> @@ -3669,6 +3677,8 @@ static const OptionDef options[] = {
>>>      { "autoexit", OPT_BOOL | OPT_EXPERT, { &autoexit }, "exit at the
>>> end", "" },
>>>      { "exitonkeydown", OPT_BOOL | OPT_EXPERT, { &exit_on_keydown },
>>> "exit on key down", "" },
>>>      { "exitonmousedown", OPT_BOOL | OPT_EXPERT, { &exit_on_mousedown },
>>> "exit on mouse down", "" },
>>> +    { "ignorekeydown", OPT_BOOL | OPT_EXPERT, { &ignore_keydown },
>>> "don't act on key presses", "" },
>>> +    { "ignoremousedown", OPT_BOOL | OPT_EXPERT, { &ignore_mousedown },
>>> "don't seek on mouse down", "" },
>>>      { "loop", OPT_INT | HAS_ARG | OPT_EXPERT, { &loop }, "set number of
>>> times the playback shall be looped", "loop count" },
>>>      { "framedrop", OPT_BOOL | OPT_EXPERT, { &framedrop }, "drop frames
>>> when cpu is too slow", "" },
>>>      { "infbuf", OPT_BOOL | OPT_EXPERT, { &infinite_buffer }, "don't
>>> limit the input buffer size (useful with realtime streams)", "" },
>>
>>
>> I see no harm, but a new option should have a justification in the
>> commit message, i.e why do you want it, or what is your use case?
>
>
> I find seeking by clicking on the video window annoying, because I
> usually click on it to get focus on the window, and it seeks instead.
>
> ignorekeydown is the complement of ignoremousedown.
>
> Should I resend the patch with this comment?

Thanks for clarifying. Maybe best to wait for Marton's comments; he is
the maintainer.
Just to let you know, if this is accepted, doc/ffplay.texi will also
need an update.

>
> Cheers,
> Vittorio
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


More information about the ffmpeg-devel mailing list