27#include "config_components.h"
45 "NB_CONSUMED_SAMPLES",
101 setpts->var_values[VAR_##name_]
118 V(PREV_OUTPTS) =
NAN;
136 V(SR) =
V(SAMPLE_RATE) =
139 V(FRAME_RATE) =
V(FR) =
144 V(
TB),
V(FRAME_RATE),
V(SAMPLE_RATE));
186 V(NB_SAMPLES) =
frame->nb_samples;
192#define d2istr(v) double2int64str((char[BUF_SIZE]){0}, v)
206 "N:%"PRId64
" PTS:%s T:%f",
208 switch (inlink->
type) {
227 V(PREV_INPTS ) =
TS2D(in_pts);
232 V(NB_CONSUMED_SAMPLES) +=
frame->nb_samples;
277 char *res,
int res_len,
int flags)
288 if (!strcmp(cmd,
"expr")) {
296 setpts->
expr = new_expr;
307#define OFFSET(x) offsetof(SetPTSContext, x)
308#define V AV_OPT_FLAG_VIDEO_PARAM
309#define A AV_OPT_FLAG_AUDIO_PARAM
310#define R AV_OPT_FLAG_RUNTIME_PARAM
311#define F AV_OPT_FLAG_FILTERING_PARAM
313#if CONFIG_SETPTS_FILTER
314static const AVOption setpts_options[] = {
321static const AVFilterPad avfilter_vf_setpts_inputs[] = {
342 .p.priv_class = &setpts_class,
356#if CONFIG_ASETPTS_FILTER
358static const AVOption asetpts_options[] = {
375 .p.priv_class = &asetpts_class,
static int config_input(AVFilterLink *inlink)
static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, char *res, int res_len, int flags)
@ VAR_NB_CONSUMED_SAMPLES
const FFFilter ff_vf_setpts
const FFFilter ff_af_asetpts
static AVFormatContext * ctx
const AVFilterPad ff_audio_default_filterpad[1]
An AVFilterPad array whose only entry has name "default" and is of type AVMEDIA_TYPE_AUDIO.
int ff_inlink_acknowledge_status(AVFilterLink *link, int *rstatus, int64_t *rpts)
Test and acknowledge the change of status on the link.
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
int ff_filter_process_command(AVFilterContext *ctx, const char *cmd, const char *arg, char *res, int res_len, int flags)
Generic processing of user supplied commands that are set in the same way as the filter options.
int ff_inlink_consume_frame(AVFilterLink *link, AVFrame **rframe)
Take a frame from the link's FIFO and update the link's stats.
Main libavfilter public API header.
#define flags(name, subs,...)
int(* init)(AVBSFContext *ctx)
void av_expr_free(AVExpr *e)
Free a parsed expression previously created with av_expr_parse().
double av_expr_eval(AVExpr *e, const double *const_values, void *opaque)
Evaluate a previously parsed expression.
int av_expr_parse(AVExpr **expr, const char *s, const char *const *const_names, const char *const *func1_names, double(*const *funcs1)(void *, double), const char *const *func2_names, double(*const *funcs2)(void *, double, double), int log_offset, void *log_ctx)
Parse an expression.
simple arithmetic expression evaluator
@ AV_OPT_TYPE_BOOL
Underlying C type is int.
@ AV_OPT_TYPE_STRING
Underlying C type is a uint8_t* that is either NULL or points to a C string allocated with the av_mal...
#define AVFILTER_FLAG_METADATA_ONLY
The filter is a "metadata" filter - it does not modify the frame data in any way.
#define AV_FRAME_FLAG_INTERLACED
A flag to mark frames whose content is interlaced.
#define AV_LOG_TRACE
Extremely verbose debugging, useful for libav* development.
#define AV_LOG_VERBOSE
Detailed information.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static double av_q2d(AVRational a)
Convert an AVRational to a double.
static av_cold void uninit(AVBitStreamFilterContext *ctx)
static int activate(AVBitStreamFilterContext *ctx)
#define FILTER_INPUTS(array)
#define FILTER_OUTPUTS(array)
#define FF_FILTER_FORWARD_WANTED(outlink, inlink)
Forward the frame_wanted_out flag from an output link to an input link.
static void ff_outlink_set_status(AVFilterLink *link, int status, int64_t pts)
Set the status field of a link from the source filter.
#define FFERROR_NOT_READY
Filters implementation helper functions and internal structures.
#define FF_FILTER_FORWARD_STATUS_BACK(outlink, inlink)
Forward the status on an output link to an input link.
static FilterLink * ff_filter_link(AVFilterLink *link)
#define AVFILTER_DEFINE_CLASS(fname)
common internal API header
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
static const char *const var_names[]
static int process_command(AVFilterContext *ctx, const char *cmd, const char *arg, char *res, int res_len, int flags)
static int config_input(AVFilterLink *inlink)
static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
static char * double2int64str(char *buf, double v)
static int config_output_video(AVFilterLink *outlink)
static double eval_pts(SetPTSContext *setpts, AVFilterLink *inlink, AVFrame *frame, int64_t pts)
static int activate(AVFilterContext *ctx)
static av_cold void uninit(AVFilterContext *ctx)
Describe the class of an AVClass context structure.
void * priv
private data for use by the filter
AVFilterLink ** outputs
array of pointers to output links
A link between two filters.
enum AVMediaType type
filter media type
AVFilterContext * src
source filter
AVRational time_base
Define the time base used by the PTS of the frames/samples which will pass through this link.
int sample_rate
samples per second
AVFilterContext * dst
dest filter
A filter pad used for either input or output.
This structure describes decoded (raw) audio or video data.
Rational number (pair of numerator and denominator).
Link properties exposed to filter code, but not external callers.
AVRational frame_rate
Frame rate of the stream on the link, or 1/0 if unknown or variable.
double var_values[VAR_VARS_NB]
int64_t av_gettime(void)
Get the current time in microseconds.