You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-15 14:13:16 +02:00
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>
This commit is contained in:
@@ -5466,6 +5466,13 @@ previous output PTS
|
|||||||
|
|
||||||
@item PREV_OUTT
|
@item PREV_OUTT
|
||||||
previous output time in seconds
|
previous output time in seconds
|
||||||
|
|
||||||
|
@item RTCTIME
|
||||||
|
wallclock (RTC) time in microseconds
|
||||||
|
|
||||||
|
@item RTCSTART
|
||||||
|
wallclock (RTC) time at the start of the movie in microseconds
|
||||||
|
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
@subsection Examples
|
@subsection Examples
|
||||||
@@ -5506,6 +5513,12 @@ Apply an offset of 10 seconds to the input PTS:
|
|||||||
@example
|
@example
|
||||||
setpts=PTS+10/TB
|
setpts=PTS+10/TB
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
|
@item
|
||||||
|
generate timestamps from a "live source" and rebase onto the current timebase
|
||||||
|
@example
|
||||||
|
setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
|
||||||
|
@end example
|
||||||
@end itemize
|
@end itemize
|
||||||
|
|
||||||
@section ebur128
|
@section ebur128
|
||||||
|
@@ -27,6 +27,7 @@
|
|||||||
#include "libavutil/eval.h"
|
#include "libavutil/eval.h"
|
||||||
#include "libavutil/internal.h"
|
#include "libavutil/internal.h"
|
||||||
#include "libavutil/mathematics.h"
|
#include "libavutil/mathematics.h"
|
||||||
|
#include "libavutil/time.h"
|
||||||
#include "avfilter.h"
|
#include "avfilter.h"
|
||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
#include "audio.h"
|
#include "audio.h"
|
||||||
@@ -49,6 +50,8 @@ static const char *const var_names[] = {
|
|||||||
"STARTT", ///< time at start of movie
|
"STARTT", ///< time at start of movie
|
||||||
"T", ///< original time in the file of the frame
|
"T", ///< original time in the file of the frame
|
||||||
"TB", ///< timebase
|
"TB", ///< timebase
|
||||||
|
"RTCTIME", ///< wallclock (RTC) time in micro seconds
|
||||||
|
"RTCSTART", ///< wallclock (RTC) time at the start of the movie in micro seconds
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -69,6 +72,8 @@ enum var_name {
|
|||||||
VAR_STARTT,
|
VAR_STARTT,
|
||||||
VAR_T,
|
VAR_T,
|
||||||
VAR_TB,
|
VAR_TB,
|
||||||
|
VAR_RTCTIME,
|
||||||
|
VAR_RTCSTART,
|
||||||
VAR_VARS_NB
|
VAR_VARS_NB
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -103,6 +108,7 @@ static int config_input(AVFilterLink *inlink)
|
|||||||
|
|
||||||
setpts->type = inlink->type;
|
setpts->type = inlink->type;
|
||||||
setpts->var_values[VAR_TB] = av_q2d(inlink->time_base);
|
setpts->var_values[VAR_TB] = av_q2d(inlink->time_base);
|
||||||
|
setpts->var_values[VAR_RTCSTART] = av_gettime();
|
||||||
|
|
||||||
setpts->var_values[VAR_SAMPLE_RATE] =
|
setpts->var_values[VAR_SAMPLE_RATE] =
|
||||||
setpts->type == AVMEDIA_TYPE_AUDIO ? inlink->sample_rate : NAN;
|
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_PTS ] = TS2D(frame->pts);
|
||||||
setpts->var_values[VAR_T ] = TS2T(frame->pts, inlink->time_base);
|
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_POS ] = frame->pos == -1 ? NAN : frame->pos;
|
||||||
|
setpts->var_values[VAR_RTCTIME ] = av_gettime();
|
||||||
|
|
||||||
switch (inlink->type) {
|
switch (inlink->type) {
|
||||||
case AVMEDIA_TYPE_VIDEO:
|
case AVMEDIA_TYPE_VIDEO:
|
||||||
|
Reference in New Issue
Block a user