summaryrefslogtreecommitdiff
path: root/libavfilter/f_setpts.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-01-25 15:04:41 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-01-25 15:04:41 +0100
commitfc2922836bc289e443c0c7a20450bf8f03c0785d (patch)
tree20843987f14580004c6f67314783eb39d00e2e93 /libavfilter/f_setpts.c
parent25be63005f0ba0b4cb8bf2569202ad0e89b4dae3 (diff)
parent0b55b16abc15c3fad0ae8b7cedc8f63f1162e89c (diff)
Merge remote-tracking branch 'qatar/master'
* qatar/master: avfilter: allow setpts filter to use wallclock time for calculations Conflicts: doc/filters.texi Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavfilter/f_setpts.c')
-rw-r--r--libavfilter/f_setpts.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/libavfilter/f_setpts.c b/libavfilter/f_setpts.c
index db1d91cf4e..1c2edb826b 100644
--- a/libavfilter/f_setpts.c
+++ b/libavfilter/f_setpts.c
@@ -27,6 +27,7 @@
#include "libavutil/eval.h"
#include "libavutil/internal.h"
#include "libavutil/mathematics.h"
+#include "libavutil/time.h"
#include "avfilter.h"
#include "internal.h"
#include "audio.h"
@@ -49,6 +50,8 @@ static const char *const var_names[] = {
"STARTT", ///< time at start of movie
"T", ///< original time in the file of the frame
"TB", ///< timebase
+ "RTCTIME", ///< wallclock (RTC) time in micro seconds
+ "RTCSTART", ///< wallclock (RTC) time at the start of the movie in micro seconds
NULL
};
@@ -69,6 +72,8 @@ enum var_name {
VAR_STARTT,
VAR_T,
VAR_TB,
+ VAR_RTCTIME,
+ VAR_RTCSTART,
VAR_VARS_NB
};
@@ -103,6 +108,7 @@ static int config_input(AVFilterLink *inlink)
setpts->type = inlink->type;
setpts->var_values[VAR_TB] = av_q2d(inlink->time_base);
+ setpts->var_values[VAR_RTCSTART] = av_gettime();
setpts->var_values[VAR_SAMPLE_RATE] =
setpts->type == AVMEDIA_TYPE_AUDIO ? inlink->sample_rate : NAN;
@@ -145,6 +151,7 @@ static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *frame)
setpts->var_values[VAR_PTS ] = TS2D(frame->pts);
setpts->var_values[VAR_T ] = TS2T(frame->pts, inlink->time_base);
setpts->var_values[VAR_POS ] = frame->pos == -1 ? NAN : frame->pos;
+ setpts->var_values[VAR_RTCTIME ] = av_gettime();
switch (inlink->type) {
case AVMEDIA_TYPE_VIDEO: