Go to the documentation of this file.
22 #ifndef AVFILTER_AVFILTER_H
23 #define AVFILTER_AVFILTER_H
51 #ifndef HAVE_AV_CONFIG_H
141 #define AVFILTER_FLAG_DYNAMIC_INPUTS (1 << 0)
147 #define AVFILTER_FLAG_DYNAMIC_OUTPUTS (1 << 1)
152 #define AVFILTER_FLAG_SLICE_THREADS (1 << 2)
168 #define AVFILTER_FLAG_METADATA_ONLY (1 << 3)
173 #define AVFILTER_FLAG_HWDEVICE (1 << 4)
182 #define AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC (1 << 16)
190 #define AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL (1 << 17)
195 #define AVFILTER_FLAG_SUPPORT_TIMELINE (AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL)
454 #define AVFILTER_THREAD_SLICE (1 << 0)
501 #if FF_API_CONTEXT_PUBLIC
510 #if FF_API_CONTEXT_PUBLIC
541 #if FF_API_CONTEXT_PUBLIC
647 #if FF_API_LINK_PUBLIC
661 #define AVFILTER_CMD_FLAG_ONE 1
662 #define AVFILTER_CMD_FLAG_FAST 2
743 unsigned filt_srcpad_idx,
unsigned filt_dstpad_idx);
779 void *
arg,
int *
ret,
int nb_jobs);
888 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.
AVPixelFormat
Pixel format.
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
unsigned avfilter_filter_pad_count(const AVFilter *filter, int is_output)
Get the number of elements in an AVFilter's inputs or outputs array.
@ AVFILTER_AUTO_CONVERT_ALL
all automatic conversions enabled
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.
char * instance_name
Name to be used for this filter instance.
int avfilter_graph_segment_create_filters(AVFilterGraphSegment *seg, int flags)
Create filters specified in a graph segment.
enum AVPixelFormat * pixels_list
A pointer to an array of admissible pixel formats delimited by AV_PIX_FMT_NONE.
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
enum AVPixelFormat pix_fmt
Equivalent to { pix_fmt, AV_PIX_FMT_NONE } as pixels_list.
int is_disabled
MUST NOT be accessed from outside avfilter.
int(* process_command)(AVFilterContext *, const char *cmd, const char *arg, char *res, int res_len, int flags)
Make the filter instance process a command.
union AVFilter::@307 formats
The state of the following union is determined by formats_state.
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
void(* filter)(uint8_t *src, int stride, int qscale)
AVBufferRef * hw_device_ctx
For filters which will create hardware frames, sets the device the filter should create them in.
AVFilterPad * output_pads
array of output pads
const char * name
Filter name.
AVFilterPadParams ** inputs
A link between two filters.
AVFilterFormatsConfig outcfg
Lists of supported formats / etc.
void avfilter_graph_free(AVFilterGraph **graph)
Free a graph, destroy its links, and set *graph to NULL.
AVFilterPadParams ** outputs
int avfilter_graph_create_filter(AVFilterContext **filt_ctx, const AVFilter *filt, const char *name, const char *args, void *opaque, AVFilterGraph *graph_ctx)
A convenience wrapper that allocates and initializes a filter in a single step.
AVFilterContext * avfilter_graph_alloc_filter(AVFilterGraph *graph, const AVFilter *filter, const char *name)
Create a new filter instance in a filter graph.
int avfilter_graph_segment_link(AVFilterGraphSegment *seg, int flags, AVFilterInOut **inputs, AVFilterInOut **outputs)
Link filters in a graph segment.
void * priv
private data for use by the filter
struct AVFilterGraph * graph
filtergraph this filter belongs to
char * enable_str
enable expression string
AVFilterGraph * avfilter_graph_alloc(void)
Allocate a filter graph.
uint8_t formats_state
This field determines the state of the formats union.
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...
void avfilter_graph_segment_free(AVFilterGraphSegment **seg)
Free the provided AVFilterGraphSegment and everything associated with it.
void * opaque
Opaque user data.
int avfilter_graph_segment_parse(AVFilterGraph *graph, const char *graph_str, int flags, AVFilterGraphSegment **seg)
Parse a textual filtergraph description into an intermediate form.
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.
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
AVFilterParams ** filters
@ AVFILTER_AUTO_CONVERT_NONE
all automatic conversions disabled
enum AVSampleFormat * samples_list
Analogous to pixels, but delimited by AV_SAMPLE_FMT_NONE and restricted to filters that only have AVM...
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.
AVRational sample_aspect_ratio
agreed upon sample aspect ratio
#define filters(fmt, type, inverse, clp, inverset, clip, one, clip_fn, packed)
int avfilter_graph_segment_init(AVFilterGraphSegment *seg, int flags)
Initialize all filter instances in a graph segment.
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
char * label
An av_malloc()'ed string containing the pad label.
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
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.
int avfilter_graph_segment_apply(AVFilterGraphSegment *seg, int flags, AVFilterInOut **inputs, AVFilterInOut **outputs)
Apply all filter/link descriptions from a graph segment to the associated filtergraph.
Parameters describing a filter to be created in a filtergraph.
const AVFilterPad * outputs
List of static outputs.
void avfilter_graph_set_auto_convert(AVFilterGraph *graph, unsigned flags)
Enable or disable automatic format conversion inside the graph.
AVFilterContext * filter
The filter context.
Rational number (pair of numerator and denominator).
char * filter_name
Name of the AVFilter to be used.
AVFilterContext ** filters
AVFilterLink ** inputs
array of pointers to input links
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.
AVFilterChain ** chains
A list of filter chain contained in this segment.
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.
A parsed representation of a filtergraph segment.
int pad_idx
index of the filt_ctx pad to use for linking
char * scale_sws_opts
sws options to use for the auto-inserted scale filters
const OptionDef options[]
unsigned nb_inputs
number of input pads
An AVChannelLayout holds information about the channel layout of audio data.
AVFilterContext * filter_ctx
filter context associated to this input/output
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
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 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
char * scale_sws_opts
A string containing a colon-separated list of key=value options applied to all scale filters in this ...
AVFilterContext * src
source filter
const char * description
A description of the filter.
#define attribute_deprecated
AVFilterFormatsConfig incfg
Lists of supported formats / etc.
uint8_t nb_inputs
The number of entries in the list of inputs.
int(* init)(AVFilterContext *ctx)
Filter initialization function.
int avfilter_init_str(AVFilterContext *ctx, const char *args)
Initialize a filter with the supplied parameters.
int(* query_func)(AVFilterContext *)
Query formats supported by the filter on its inputs and outputs.
int sample_rate
samples per second
AVFilterGraph * graph
The filtergraph this segment is associated with.
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
AVColorSpace
YUV colorspace type.
AVSampleFormat
Audio sample formats.
int thread_type
Type of multithreading allowed for filters in this graph.
static const int8_t filt[NUMTAPS *2]
static const AVFilterPad outputs[]
int priv_size
size of private data to allocate for the filter
const char * avfilter_configuration(void)
Return the libavfilter build-time configuration.
AVDictionary * opts
Options to be apllied to the filter.
char * avfilter_graph_dump(AVFilterGraph *graph, const char *options)
Dump a graph into a human-readable string representation.
uint8_t nb_outputs
The number of entries in the list of outputs.
enum AVMediaType avfilter_pad_get_type(const AVFilterPad *pads, int pad_idx)
Get the type of an AVFilterPad.
int h
agreed upon image height
int avfilter_init_dict(AVFilterContext *ctx, AVDictionary **options)
Initialize a filter with the supplied dictionary of options.
A filterchain is a list of filter specifications.
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.
A reference to a data buffer.
const AVFilterPad * inputs
List of static inputs.
void(* uninit)(AVFilterContext *ctx)
Filter uninitialization function.
void avfilter_free(AVFilterContext *filter)
Free a filter context.
AVChannelLayout ch_layout
channel layout of current buffer (see libavutil/channel_layout.h)
enum AVSampleFormat sample_fmt
Equivalent to { sample_fmt, AV_SAMPLE_FMT_NONE } as samples_list.
enum AVColorSpace colorspace
For non-YUV links, these are respectively set to fallback values (as appropriate for that colorspace)...
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 ready
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.
int avfilter_graph_segment_apply_opts(AVFilterGraphSegment *seg, int flags)
Apply parsed options to filter instances in a graph segment.
const AVFilter * filter
the AVFilter of which this is an instance
int(* query_func2)(const AVFilterContext *, struct AVFilterFormatsConfig **cfg_in, struct AVFilterFormatsConfig **cfg_out)
Same as query_func(), except this function writes the results into provided arrays.
AVColorRange
Visual content value range.
unsigned avfilter_version(void)
Return the LIBAVFILTER_VERSION_INT constant.
enum AVColorRange color_range
agreed upon YUV color range
const AVClass * avfilter_get_class(void)
A linked-list of the inputs/outputs of the filter chain.
Parameters of a filter's input or output pad.
AVFilterLink ** outputs
array of pointers to output links