Go to the documentation of this file.
22 #ifndef AVFILTER_AVFILTER_H
23 #define AVFILTER_AVFILTER_H
105 #define AVFILTER_FLAG_DYNAMIC_INPUTS (1 << 0)
111 #define AVFILTER_FLAG_DYNAMIC_OUTPUTS (1 << 1)
116 #define AVFILTER_FLAG_SLICE_THREADS (1 << 2)
125 #define AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC (1 << 16)
133 #define AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL (1 << 17)
138 #define AVFILTER_FLAG_SUPPORT_TIMELINE (AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL)
333 #define AVFILTER_THREAD_SLICE (1 << 0)
603 #ifndef FF_INTERNAL_FIELDS
624 int frame_blocked_in;
636 int64_t status_in_pts;
666 #if FF_API_FILTER_GET_SET
691 #define AVFILTER_CMD_FLAG_ONE 1
692 #define AVFILTER_CMD_FLAG_FAST 2
714 void avfilter_register_all(
void);
800 unsigned filt_srcpad_idx,
unsigned filt_dstpad_idx);
838 void *
arg,
int *
ret,
int nb_jobs);
961 const char *
name,
const char *args,
void *opaque,
int(* func)(AVBPrint *dst, const char *in, const char *arg)
avfilter_execute_func * execute
This callback may be set by the caller immediately after allocating the graph and before adding any f...
A list of supported channel layouts.
int nb_threads
Max number of threads allowed in this filter instance.
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default minimum maximum flags name is the option name
struct AVFilterChannelLayouts * in_channel_layouts
int nb_threads
Maximum number of threads used by filters in this graph.
const char * avfilter_pad_get_name(const AVFilterPad *pads, int pad_idx)
Get the name of an AVFilterPad.
int frame_wanted_out
True if a frame is currently wanted on the output of this filter.
const AVClass * priv_class
A class for the private data, used to declare filter private AVOptions.
int() avfilter_action_func(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
A function pointer passed to the AVFilterGraph::execute callback to be executed multiple times,...
AVFilterPad * dstpad
input pad on the dest filter
static const struct PPFilter filters[]
double * var_values
variable values for the enable expression
AVFilterFormats * in_formats
Lists of formats and channel layouts supported by the input and output filters respectively.
int is_disabled
the enabled state from the last expression evaluation
int(* process_command)(AVFilterContext *, const char *cmd, const char *arg, char *res, int res_len, int flags)
Make the filter instance process a command.
This structure describes decoded (raw) audio or video data.
struct AVFilterInOut * next
next input/input in the list, NULL if this is the last
unsigned nb_outputs
number of output pads
const AVClass * av_class
needed for av_log() and filters common options
unsigned disable_auto_convert
int max_samples
Maximum number of samples to filter at once.
AVBufferRef * hw_device_ctx
For filters which will create hardware frames, sets the device the filter should create them in.
filter_frame For filters that do not use the this method is called when a frame is pushed to the filter s input It can be called at any time except in a reentrant way If the input frame is enough to produce then the filter should push the output frames on the output link immediately As an exception to the previous rule if the input frame is enough to produce several output frames then the filter needs output only at least one per link The additional frames can be left buffered in the filter
AVFilterPad * output_pads
array of output pads
const char * name
Filter name.
A link between two filters.
AVFilterFormats * in_samplerates
Lists of channel layouts and sample rates used for automatic negotiation.
int channels
Number of channels.
enum AVFilterLink::@200 init_state
stage of the initialization of the link properties (dimensions, etc)
struct AVFilterChannelLayouts * out_channel_layouts
void avfilter_graph_free(AVFilterGraph **graph)
Free a graph, destroy its links, and set *graph to NULL.
int avfilter_graph_create_filter(AVFilterContext **filt_ctx, const AVFilter *filt, const char *name, const char *args, void *opaque, AVFilterGraph *graph_ctx)
Create and add a filter instance into an existing graph.
AVFilterContext * avfilter_graph_alloc_filter(AVFilterGraph *graph, const AVFilter *filter, const char *name)
Create a new filter instance in a filter graph.
void * priv
private data for use by the filter
int64_t current_pts_us
Current timestamp of the link, as defined by the most recent frame(s), in AV_TIME_BASE units.
struct AVFilterGraph * graph
filtergraph this filter belongs to
AVFrame * partial_buf
Buffer partially filled with samples to achieve a fixed/minimum size.
char * enable_str
enable expression string
AVFilterGraph * avfilter_graph_alloc(void)
Allocate a filter graph.
int avfilter_insert_filter(AVFilterLink *link, AVFilterContext *filt, unsigned filt_srcpad_idx, unsigned filt_dstpad_idx)
Insert a filter in the middle of an existing link.
const AVFilter * av_filter_iterate(void **opaque)
Iterate over all registered filters.
int extra_hw_frames
Sets the number of extra hardware frames which the filter will allocate on its output links for use i...
int avfilter_config_links(AVFilterContext *filter)
Negotiate the media format, dimensions, etc of all inputs to a filter.
void * opaque
Opaque user data.
int flags_internal
Additional flags for avfilter internal use only.
A filter pad used for either input or output.
const char * avfilter_license(void)
Return the libavfilter license.
unsigned flags
Link processing flags.
AVFilterPad * input_pads
array of input pads
void avfilter_inout_free(AVFilterInOut **inout)
Free the supplied list of AVFilterInOut and set *inout to NULL.
enum AVMediaType type
filter media type
int avfilter_process_command(AVFilterContext *filter, const char *cmd, const char *arg, char *res, int res_len, int flags)
Make the filter instance process a command.
int avfilter_pad_count(const AVFilterPad *pads)
Get the number of elements in a NULL-terminated array of AVFilterPads (e.g.
AVRational sample_aspect_ratio
agreed upon sample aspect ratio
static const AVFilterPad outputs[]
AVRational frame_rate
Frame rate of the stream on the link, or 1/0 if unknown or variable; if left to 0/0,...
int flags
A combination of AVFILTER_FLAG_*.
char * aresample_swr_opts
swr options to use for the auto-inserted aresample filters, Access ONLY through AVOptions
int64_t current_pts
Current timestamp of the link, as defined by the most recent frame(s), in link time_base units.
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 link
struct AVFilter * next
Used by the filter registration system.
int(* activate)(AVFilterContext *ctx)
Filter activation function.
const AVFilter * avfilter_get_by_name(const char *name)
Get a filter definition matching the given name.
Describe the class of an AVClass context structure.
int thread_type
Type of multithreading being allowed/used.
int avfilter_graph_config(AVFilterGraph *graphctx, void *log_ctx)
Check validity and configure all the links and formats in the graph.
const AVFilterPad * outputs
List of outputs, terminated by a zeroed element.
void avfilter_graph_set_auto_convert(AVFilterGraph *graph, unsigned flags)
Enable or disable automatic format conversion inside the graph.
Rational number (pair of numerator and denominator).
AVFilterContext ** filters
AVFilterLink ** inputs
array of pointers to input links
uint64_t channel_layout
channel layout of current buffer (see libavutil/channel_layout.h)
char * name
name of this filter instance
AVFilterInOut * avfilter_inout_alloc(void)
Allocate a single AVFilterInOut entry.
AVFilterContext * avfilter_graph_get_filter(AVFilterGraph *graph, const char *name)
Get a filter instance identified by instance name from graph.
int avfilter_graph_request_oldest(AVFilterGraph *graph)
Request a frame on the oldest sink link.
@ AVLINK_STARTINIT
started, but incomplete
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 inputs
int avfilter_graph_parse2(AVFilterGraph *graph, const char *filters, AVFilterInOut **inputs, AVFilterInOut **outputs)
Add a graph described by a string to a graph.
void * frame_pool
A pointer to a FFFramePool struct.
int min_samples
Minimum number of samples to filter at once.
char reserved[0xF000]
Internal structure members.
int pad_idx
index of the filt_ctx pad to use for linking
Queue of AVFrame pointers.
char * scale_sws_opts
sws options to use for the auto-inserted scale filters
const OptionDef options[]
unsigned nb_inputs
number of input pads
struct AVFilterCommand * command_queue
@ AVFILTER_AUTO_CONVERT_ALL
all automatic conversions enabled
AVFilterContext * filter_ctx
filter context associated to this input/output
attribute_deprecated void avfilter_link_set_closed(AVFilterLink *link, int closed)
Set the closed field of a link.
int() avfilter_execute_func(AVFilterContext *ctx, avfilter_action_func *func, void *arg, int *ret, int nb_jobs)
A function executing multiple jobs, possibly in parallel.
int(* preinit)(AVFilterContext *ctx)
Filter pre-initialization function.
int partial_buf_size
Size of the partial buffer to allocate.
int avfilter_link(AVFilterContext *src, unsigned srcpad, AVFilterContext *dst, unsigned dstpad)
Link two filters together.
int format
agreed upon media format
int avfilter_graph_queue_command(AVFilterGraph *graph, const char *target, const char *cmd, const char *arg, int flags, double ts)
Queue a command for one or more filter instances.
AVFilterPad * srcpad
output pad on the source filter
AVFilterContext * dst
dest filter
int request_samples
Audio only, the destination filter sets this to a non-zero value to request that buffers with the giv...
static const int8_t filt[NUMTAPS]
AVFilterFormats * out_samplerates
AVFilterContext * src
source filter
const char * description
A description of the filter.
void avfilter_link_free(AVFilterLink **link)
Free the link in *link, and set its pointer to NULL.
#define attribute_deprecated
AVFilterFormats * out_formats
int(* init)(AVFilterContext *ctx)
Filter initialization function.
int avfilter_init_str(AVFilterContext *ctx, const char *args)
Initialize a filter with the supplied parameters.
struct AVFilterGraph * graph
Graph the filter belongs to.
int sample_rate
samples per second
int age_index
Index in the age array.
int avfilter_graph_parse_ptr(AVFilterGraph *graph, const char *filters, AVFilterInOut **inputs, AVFilterInOut **outputs, void *log_ctx)
Add a graph described by a string to a graph.
int w
agreed upon image width
AVBufferRef * hw_frames_ctx
For hwaccel pixel formats, this should be a reference to the AVHWFramesContext describing the frames.
int thread_type
Type of multithreading allowed for filters in this graph.
int priv_size
size of private data to allocate for the filter
AVFilterLink ** sink_links
Private fields.
const char * avfilter_configuration(void)
Return the libavfilter build-time configuration.
char * avfilter_graph_dump(AVFilterGraph *graph, const char *options)
Dump a graph into a human-readable string representation.
enum AVMediaType avfilter_pad_get_type(const AVFilterPad *pads, int pad_idx)
Get the type of an AVFilterPad.
@ AVLINK_UNINIT
not started
int h
agreed upon image height
int avfilter_init_dict(AVFilterContext *ctx, AVDictionary **options)
Initialize a filter with the supplied dictionary of options.
void * enable
parsed expression (AVExpr*)
AVRational time_base
Define the time base used by the PTS of the frames/samples which will pass through this link.
int avfilter_graph_parse(AVFilterGraph *graph, const char *filters, AVFilterInOut *inputs, AVFilterInOut *outputs, void *log_ctx)
Add a graph described by a string to a graph.
@ AVFILTER_AUTO_CONVERT_NONE
all automatic conversions disabled
A reference to a data buffer.
int(* init_opaque)(AVFilterContext *ctx, void *opaque)
Filter initialization function, alternative to the init() callback.
int64_t frame_count_in
Number of past frames sent through the link.
const AVFilterPad * inputs
List of inputs, terminated by a zeroed element.
int(* query_formats)(AVFilterContext *)
Query formats supported by the filter on its inputs and outputs.
void(* uninit)(AVFilterContext *ctx)
Filter uninitialization function.
void avfilter_free(AVFilterContext *filter)
Free a filter context.
the definition of that something depends on the semantic of the filter The callback must examine the status of the filter s links and proceed accordingly The status of output links is stored in the status_in and status_out fields and tested by the then the processing requires a frame on this link and the filter is expected to make efforts in that direction The status of input links is stored by the status_in
int avfilter_link_get_channels(AVFilterLink *link)
char * name
unique name for this input/output in the list
#define flags(name, subs,...)
int avfilter_graph_send_command(AVFilterGraph *graph, const char *target, const char *cmd, const char *arg, char *res, int res_len, int flags)
Send a command to one or more filter instances.
const AVFilter * filter
the AVFilter of which this is an instance
int(* init_dict)(AVFilterContext *ctx, AVDictionary **options)
Should be set instead of init by the filters that want to pass a dictionary of AVOptions to nested co...
unsigned avfilter_version(void)
Return the LIBAVFILTER_VERSION_INT constant.
const AVClass * avfilter_get_class(void)
A linked-list of the inputs/outputs of the filter chain.
unsigned ready
Ready status of the filter.
AVFilterLink ** outputs
array of pointers to output links