@ -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 :