diff mbox

[FFmpeg-devel] avfilter/setpts: add FR shorthand for FRAME_RATE

Message ID b5450621-e232-5890-e82b-6e68e73be645@gmail.com
State Accepted
Commit c71e1e60305669c225c696dd99f6db5dc550a56a
Headers show

Commit Message

Gyan July 5, 2018, 9:58 a.m. UTC
From 5012a823d34cecaac2bc19ef60062e6eedcdda6e Mon Sep 17 00:00:00 2001
From: Gyan Doshi <ffmpeg@gyani.pro>
Date: Thu, 5 Jul 2018 15:24:55 +0530
Subject: [PATCH] avfilter/setpts: add FR shorthand for FRAME_RATE

---
 doc/filters.texi     | 2 +-
 libavfilter/setpts.c | 5 ++++-
 2 files changed, 5 insertions(+), 2 deletions(-)

Comments

Gyan July 7, 2018, 5:33 a.m. UTC | #1
Plan to push tonight if no objections.
Gyan July 7, 2018, 3:44 p.m. UTC | #2
On 07-07-2018 11:03 AM, Gyan Doshi wrote:
> 
> Plan to push tonight if no objections.

Pushed as c71e1e60305669c225c696dd99f6db5dc550a56a
diff mbox

Patch

diff --git a/doc/filters.texi b/doc/filters.texi
index fb5f3eef4b..b697a829c4 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -19387,7 +19387,7 @@  The expression is evaluated through the eval API and can contain the following
 constants:
 
 @table @option
-@item FRAME_RATE
+@item FRAME_RATE, FR
 frame rate, only defined for constant frame-rate video
 
 @item PTS
diff --git a/libavfilter/setpts.c b/libavfilter/setpts.c
index 4505498bf3..800ba6a83f 100644
--- a/libavfilter/setpts.c
+++ b/libavfilter/setpts.c
@@ -57,6 +57,7 @@  static const char *const var_names[] = {
     "RTCSTART",    ///< wallclock (RTC) time at the start of the movie in micro seconds
     "S",           //   Number of samples in the current frame
     "SR",          //   Audio sample rate
+    "FR",          ///< defined only for constant frame-rate video
     NULL
 };
 
@@ -81,6 +82,7 @@  enum var_name {
     VAR_RTCSTART,
     VAR_S,
     VAR_SR,
+    VAR_FR,
     VAR_VARS_NB
 };
 
@@ -127,7 +129,8 @@  static int config_input(AVFilterLink *inlink)
     setpts->var_values[VAR_SAMPLE_RATE] =
         setpts->type == AVMEDIA_TYPE_AUDIO ? inlink->sample_rate : NAN;
 
-    setpts->var_values[VAR_FRAME_RATE] = inlink->frame_rate.num &&
+    setpts->var_values[VAR_FRAME_RATE] =
+    setpts->var_values[VAR_FR] =         inlink->frame_rate.num &&
                                          inlink->frame_rate.den ?
                                             av_q2d(inlink->frame_rate) : NAN;