[FFmpeg-cvslog] lavfi/setpts: add FRAME_RATE constant
Stefano Sabatini
git at videolan.org
Mon Sep 10 18:55:24 CEST 2012
ffmpeg | branch: master | Stefano Sabatini <stefasab at gmail.com> | Mon Sep 10 11:58:53 2012 +0200| [722762f7e1212b4d02142778fabfdd73375722e0] | committer: Stefano Sabatini
lavfi/setpts: add FRAME_RATE constant
Useful for dealing with constant frame-rate video.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=722762f7e1212b4d02142778fabfdd73375722e0
---
doc/filters.texi | 3 +++
libavfilter/f_setpts.c | 11 +++++++++--
libavfilter/version.h | 2 +-
3 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/doc/filters.texi b/doc/filters.texi
index 685a3e2..53c9932 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -4194,6 +4194,9 @@ Accept in input an expression evaluated through the eval API, which
can contain the following constants:
@table @option
+ at item FRAME_RATE
+frame rate, only defined for constant frame-rate video
+
@item PTS
the presentation timestamp in input
diff --git a/libavfilter/f_setpts.c b/libavfilter/f_setpts.c
index 177d29b..6227fe0 100644
--- a/libavfilter/f_setpts.c
+++ b/libavfilter/f_setpts.c
@@ -35,6 +35,7 @@
#include "video.h"
static const char *const var_names[] = {
+ "FRAME_RATE", ///< defined only for constant frame-rate video
"INTERLACED", ///< tell if the current frame is interlaced
"N", ///< frame number (starting at zero)
"NB_CONSUMED_SAMPLES", ///< number of samples consumed by the filter (only audio)
@@ -54,6 +55,7 @@ static const char *const var_names[] = {
};
enum var_name {
+ VAR_FRAME_RATE,
VAR_INTERLACED,
VAR_N,
VAR_NB_CONSUMED_SAMPLES,
@@ -107,8 +109,13 @@ static int config_input(AVFilterLink *inlink)
if (setpts->type == AVMEDIA_TYPE_AUDIO)
setpts->var_values[VAR_SAMPLE_RATE] = inlink->sample_rate;
- av_log(inlink->src, AV_LOG_VERBOSE, "TB:%f SAMPLE_RATE:%f\n",
- setpts->var_values[VAR_TB], setpts->var_values[VAR_SAMPLE_RATE]);
+ setpts->var_values[VAR_FRAME_RATE] = inlink->frame_rate.num && inlink->frame_rate.den ?
+ av_q2d(inlink->frame_rate) : NAN;
+
+ av_log(inlink->src, AV_LOG_VERBOSE, "TB:%f FRAME_RATE:%f SAMPLE_RATE:%f\n",
+ setpts->var_values[VAR_TB],
+ setpts->var_values[VAR_FRAME_RATE],
+ setpts->var_values[VAR_SAMPLE_RATE]);
return 0;
}
diff --git a/libavfilter/version.h b/libavfilter/version.h
index 607948d..9d96d77 100644
--- a/libavfilter/version.h
+++ b/libavfilter/version.h
@@ -30,7 +30,7 @@
#define LIBAVFILTER_VERSION_MAJOR 3
#define LIBAVFILTER_VERSION_MINOR 16
-#define LIBAVFILTER_VERSION_MICRO 101
+#define LIBAVFILTER_VERSION_MICRO 102
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
LIBAVFILTER_VERSION_MINOR, \
More information about the ffmpeg-cvslog
mailing list