From patchwork Sun Sep 2 04:51:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gyan X-Patchwork-Id: 10201 Delivered-To: ffmpegpatchwork@gmail.com Received: by 2002:a02:12c4:0:0:0:0:0 with SMTP id 65-v6csp1267606jap; Sat, 1 Sep 2018 21:51:51 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYFaveXA1onjfshRtQ0CUx5nKsN8P5cygO4yjEuosIXwckL5JjCG1z6hlug5xK9RFvF/aXc X-Received: by 2002:a1c:1f48:: with SMTP id f69-v6mr1860376wmf.152.1535863910966; Sat, 01 Sep 2018 21:51:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535863910; cv=none; d=google.com; s=arc-20160816; b=khdJYDcXAINr94dooSpWOef56x8+Mzu0P20w6Wr7qOsYd9sImdtm3fMNks5SPDhwm2 MSZg3PhaXB37nBOQRoWcjEFOcPttE4g9rdwZv6ghFD1Ag0neEJm4OFjt4LC7KrhSzKv+ 0XUEKXHvqcllvqGEs47i7kKq9vVXElnH5+ehtE/90Gqr8gFeaIWFtcTVMm9LQti8PEBx s2xDnRG2/PBnVQKxXyyeyw4DgzAx/GFwFB7Io44I/BKOx3+2R/jRcRE+bT+WW0uK4L1e pMKQk9DwTCU63iWJbIdlAwV/hQhwEKX0nSn4WQalEAGT5J4BromowURDnBkkVKq5h1/G pyMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:subject :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:to:dkim-signature:delivered-to :arc-authentication-results; bh=AwTANnmXzwfuuvlMGGLDF3eBunJ6zPeHZmPx+W41WLU=; b=mK6byZsZuZ3ElPHPSJWwyu0YyKffihhPvQjyKkdGW91GElE/BlyswQ2pRjMYzHu3Bx n9T2FphYshLmNhHIE9z70EhXyu8cDj5DeVMcxhGxzmFNZPm2wZws2H5/NtR8nb2862j5 AvrTy586muhV6wK4LZQgQezBkwg1mMvPM69vcn8n20OE3fQyffE5PgsJUWpau3vFtpm4 NCPp0xEQvBshYqLoHA8Z6LyQKY1cwOX57k5bJ6D0dzjmDDQS60PXUkgm9Ib6GvA/vXzK 2opED0XjLTen4lTzCTnxjxQ89k7BfMrAiEJ62RihD4XNA30IZbrcfZHMCRq/e1GKss3Q q2eA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=rw0U7hYB; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id n188-v6si6057457wmn.170.2018.09.01.21.51.50; Sat, 01 Sep 2018 21:51:50 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=rw0U7hYB; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A4ADC689CBB; Sun, 2 Sep 2018 07:51:42 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pl1-f196.google.com (mail-pl1-f196.google.com [209.85.214.196]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id EF39C689ACD for ; Sun, 2 Sep 2018 07:51:35 +0300 (EEST) Received: by mail-pl1-f196.google.com with SMTP id f6-v6so7194812plo.1 for ; Sat, 01 Sep 2018 21:51:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language; bh=KLuUNG/c08thuqMfEQ6w1KFr+ZuWrEXq0MOmgtkDfpY=; b=rw0U7hYBVPH4aVilRqjbHBhwKvkNA5U3tiD/5Vbn7siMMS6B7zN+Eum9x04JAPE+xc D4NZHZbms78xeiqjK3MgJgMxjt86sePKHTPJIXlPJ+HSeJeH+KYcfbyJPtc5KnITjLcc MHXEhGCP0SqVZqS9UNvQgMyppyrPPSL3aR8GAxQYLASapFlUugTkYV9KLIdPmQm3FdDe Jxn3c+gz/nhg7WnOcVbyl/nTEjHnsazvSd94lCAENL4zCnTg7PKj65WVFQ2rWvcceJUr KjFCg6iOahn6SKcADzhHPbEwc7t4lkWs/y+IYyVd7WQW9VT+fmXPf50tSrz1ZL2oHKHo 6Khw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language; bh=KLuUNG/c08thuqMfEQ6w1KFr+ZuWrEXq0MOmgtkDfpY=; b=Gpxvy2M4n8FeUQBltLTRxr94Ks9+O86EgqvTuWULJ7YuN3QIdt2cNlkw0PUDqWYuvL 0rfeXOXrRUiwgOXR+vAoGVSmM2L/JE6G6E4fwXPQf8rmVqf0zycppAuWMN+K6IggrK2c qgOUiwlPtNvbMKpCIc7WLP9tuF2+Lqtg1zlQ5yW6zjVxqhe+o+qutJ9FUymHF4irRQbR LyqkRWsNMuraEAyFeyF4TZOLvBpsM5wGUKr/IOFM6vfptNdYYPNQwGlCPJND7AbkUu3I mAaQOr4Lqsd6bbQuP26QHCIVVwE+HKIc2ACMl0lZTgeZ1U9mmtZiGD442zXtb/rlgxo5 gohQ== X-Gm-Message-State: APzg51BRGoyFYGnVMO1kj2PAP91w/bG6RGI/4731YageB8cwxcBPVrIB oVK8EEnO1oIT0D4pdz/scHfW8nZi X-Received: by 2002:a17:902:9a47:: with SMTP id x7-v6mr22618508plv.37.1535863899906; Sat, 01 Sep 2018 21:51:39 -0700 (PDT) Received: from [192.168.1.225] ([103.206.134.208]) by smtp.gmail.com with ESMTPSA id s27-v6sm32964041pfk.133.2018.09.01.21.51.37 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 01 Sep 2018 21:51:38 -0700 (PDT) To: ffmpeg-devel@ffmpeg.org References: From: Gyan Doshi Message-ID: Date: Sun, 2 Sep 2018 10:21:34 +0530 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Subject: Re: [FFmpeg-devel] [PATCH] ffplay: add option to allow custom jump interval X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" 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 From abd6b2616ec2caf115dcdf05fba6be0a3c80a17a Mon Sep 17 00:00:00 2001 From: Gyan Doshi 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. +@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"