mirror of
https://gitee.com/openharmony/third_party_ffmpeg
synced 2024-11-24 03:39:45 +00: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:
commit
fc2922836b
@ -5466,6 +5466,13 @@ previous output PTS
|
||||
|
||||
@item PREV_OUTT
|
||||
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
|
||||
|
||||
@subsection Examples
|
||||
@ -5506,6 +5513,12 @@ Apply an offset of 10 seconds to the input PTS:
|
||||
@example
|
||||
setpts=PTS+10/TB
|
||||
@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
|
||||
|
||||
@section ebur128
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user