Go to the documentation of this file.
27 #include "config_components.h"
45 "NB_CONSUMED_SAMPLES",
106 setpts->var_values[VAR_##name_]
123 V(PREV_OUTPTS) =
NAN;
141 V(SR) =
V(SAMPLE_RATE) =
144 V(FRAME_RATE) =
V(FR) =
149 V(
TB),
V(FRAME_RATE),
V(SAMPLE_RATE));
194 V(NB_SAMPLES) =
frame->nb_samples;
200 #define d2istr(v) double2int64str((char[BUF_SIZE]){0}, v)
213 "N:%"PRId64
" PTS:%s T:%f",
234 V(PREV_INPTS ) =
TS2D(in_pts);
239 V(NB_CONSUMED_SAMPLES) +=
frame->nb_samples;
284 char *res,
int res_len,
int flags)
295 if (!strcmp(cmd,
"expr")) {
303 setpts->
expr = new_expr;
314 #define OFFSET(x) offsetof(SetPTSContext, x)
315 #define V AV_OPT_FLAG_VIDEO_PARAM
316 #define A AV_OPT_FLAG_AUDIO_PARAM
317 #define R AV_OPT_FLAG_RUNTIME_PARAM
318 #define F AV_OPT_FLAG_FILTERING_PARAM
320 #if CONFIG_SETPTS_FILTER
321 static const AVOption setpts_options[] = {
327 static const AVFilterPad avfilter_vf_setpts_inputs[] = {
353 .priv_class = &setpts_class,
360 #if CONFIG_ASETPTS_FILTER
362 static const AVOption asetpts_options[] = {
384 .priv_class = &asetpts_class,
#define FF_ENABLE_DEPRECATION_WARNINGS
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
The exact code depends on how similar the blocks are and how related they are to the and needs to apply these operations to the correct inlink or outlink if there are several Macros are available to factor that when no extra processing is inlink
#define FILTER_INPUTS(array)
This structure describes decoded (raw) audio or video data.
#define AV_LOG_VERBOSE
Detailed information.
const char * name
Filter name.
A link between two filters.
static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
#define FF_FILTER_FORWARD_STATUS_BACK(outlink, inlink)
Forward the status on an output link to an input link.
Link properties exposed to filter code, but not external callers.
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.
int ff_inlink_consume_frame(AVFilterLink *link, AVFrame **rframe)
Take a frame from the link's FIFO and update the link's stats.
double var_values[VAR_VARS_NB]
void av_expr_free(AVExpr *e)
Free a parsed expression previously created with av_expr_parse().
A filter pad used for either input or output.
#define AV_LOG_TRACE
Extremely verbose debugging, useful for libav* development.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static av_cold int init(AVFilterContext *ctx)
static int activate(AVFilterContext *ctx)
static void ff_outlink_set_status(AVFilterLink *link, int status, int64_t pts)
Set the status field of a link from the source filter.
static double av_q2d(AVRational a)
Convert an AVRational to a double.
static double eval_pts(SetPTSContext *setpts, AVFilterLink *inlink, AVFrame *frame, int64_t pts)
double av_expr_eval(AVExpr *e, const double *const_values, void *opaque)
Evaluate a previously parsed expression.
#define FILTER_OUTPUTS(array)
Describe the class of an AVClass context structure.
Rational number (pair of numerator and denominator).
const AVFilterPad ff_audio_default_filterpad[1]
An AVFilterPad array whose only entry has name "default" and is of type AVMEDIA_TYPE_AUDIO.
#define AVFILTER_DEFINE_CLASS(fname)
int ff_inlink_acknowledge_status(AVFilterLink *link, int *rstatus, int64_t *rpts)
Test and acknowledge the change of status on the link.
static FilterLink * ff_filter_link(AVFilterLink *link)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
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.
FF_FILTER_FORWARD_WANTED(outlink, inlink)
@ VAR_NB_CONSUMED_SAMPLES
const AVFilter ff_vf_setpts
static int process_command(AVFilterContext *ctx, const char *cmd, const char *arg, char *res, int res_len, int flags)
static char * double2int64str(char *buf, double v)
const char * name
Pad name.
#define AV_FRAME_FLAG_INTERLACED
A flag to mark frames whose content is interlaced.
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
static int config_output_video(AVFilterLink *outlink)
#define AVFILTER_FLAG_METADATA_ONLY
The filter is a "metadata" filter - it does not modify the frame data in any way.
static const char *const var_names[]
int64_t av_gettime(void)
Get the current time in microseconds.
#define FF_DISABLE_DEPRECATION_WARNINGS
static int config_input(AVFilterLink *inlink)
#define flags(name, subs,...)
AVRational frame_rate
Frame rate of the stream on the link, or 1/0 if unknown or variable.
@ 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...
const AVFilter ff_af_asetpts
static av_cold void uninit(AVFilterContext *ctx)