22 #ifndef AVFILTER_AVFILTER_H
23 #define AVFILTER_AVFILTER_H
69 #if FF_API_AVFILTERBUFFER
75 typedef struct AVFilterBuffer {
103 void (*free)(
struct AVFilterBuffer *
buf);
110 #define AV_PERM_READ 0x01
111 #define AV_PERM_WRITE 0x02
112 #define AV_PERM_PRESERVE 0x04
113 #define AV_PERM_REUSE 0x08
114 #define AV_PERM_REUSE2 0x10
115 #define AV_PERM_NEG_LINESIZES 0x20
116 #define AV_PERM_ALIGN 0x40
118 #define AVFILTER_ALIGN 16 //not part of ABI
125 typedef struct AVFilterBufferRefAudioProps {
126 uint64_t channel_layout;
130 } AVFilterBufferRefAudioProps;
137 typedef struct AVFilterBufferRefVideoProps {
145 int qp_table_linesize;
148 } AVFilterBufferRefVideoProps;
158 typedef struct AVFilterBufferRef {
178 AVFilterBufferRefVideoProps *video;
179 AVFilterBufferRefAudioProps *audio;
202 void avfilter_copy_buffer_ref_props(AVFilterBufferRef *dst,
const AVFilterBufferRef *
src);
214 AVFilterBufferRef *avfilter_ref_buffer(AVFilterBufferRef *ref,
int pmask);
226 void avfilter_unref_buffer(AVFilterBufferRef *ref);
236 void avfilter_unref_bufferp(AVFilterBufferRef **ref);
242 int avfilter_ref_get_channels(AVFilterBufferRef *ref);
245 #if FF_API_AVFILTERPAD_PUBLIC
299 int (*start_frame)(
AVFilterLink *link, AVFilterBufferRef *picref);
431 #define AVFILTER_FLAG_DYNAMIC_INPUTS (1 << 0)
437 #define AVFILTER_FLAG_DYNAMIC_OUTPUTS (1 << 1)
442 #define AVFILTER_FLAG_SLICE_THREADS (1 << 2)
451 #define AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC (1 << 16)
459 #define AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL (1 << 17)
464 #define AVFILTER_FLAG_SUPPORT_TIMELINE (AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL)
628 #define AVFILTER_THREAD_SLICE (1 << 0)
766 #if FF_API_AVFILTERBUFFER
767 struct AVFilterPool *pool;
824 #if FF_API_AVFILTERBUFFER
832 AVFilterBufferRef *cur_buf_copy;
904 #if FF_API_AVFILTERBUFFER
936 AVFilterBufferRef *avfilter_get_audio_buffer_ref_from_arrays(
uint8_t **
data,
941 uint64_t channel_layout);
956 AVFilterBufferRef *avfilter_get_audio_buffer_ref_from_arrays_channels(
uint8_t **
data,
962 uint64_t channel_layout);
967 #define AVFILTER_CMD_FLAG_ONE 1
968 #define AVFILTER_CMD_FLAG_FAST 2
979 #if FF_API_OLD_FILTER_REGISTER
982 void avfilter_uninit(
void);
1004 #if !FF_API_NOCONST_GET_NAME
1016 #if FF_API_OLD_FILTER_REGISTER
1028 #if FF_API_AVFILTER_OPEN
1044 #if FF_API_AVFILTER_INIT_FILTER
1111 unsigned filt_srcpad_idx,
unsigned filt_dstpad_idx);
1113 #if FF_API_AVFILTERBUFFER
1121 int avfilter_copy_frame_props(AVFilterBufferRef *dst,
const AVFrame *
src);
1130 int avfilter_copy_buf_props(
AVFrame *dst,
const AVFilterBufferRef *
src);
1169 void *
arg,
int *ret,
int nb_jobs);
1173 #if FF_API_FOO_COUNT
1175 unsigned filter_count_unused;
1178 #if !FF_API_FOO_COUNT
1184 #if FF_API_FOO_COUNT
1285 #if FF_API_AVFILTER_OPEN
1313 const char *
name,
const char *
args,
void *opaque,
1382 #if AV_HAVE_INCOMPATIBLE_LIBAV_ABI || !FF_API_OLD_GRAPH_PARSE
AVFilterContext ** filters
void avfilter_graph_set_auto_convert(AVFilterGraph *graph, unsigned flags)
Enable or disable automatic format conversion inside the graph.
int(* poll_frame)(AVFilterLink *link)
Frame poll callback.
double * var_values
variable values for the enable expression
void avfilter_link_set_closed(AVFilterLink *link, int closed)
Set the closed field of a link.
This structure describes decoded (raw) audio or video data.
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.
int thread_type
Type of multithreading allowed for filters in this graph.
ptrdiff_t const GLvoid * data
void avfilter_free(AVFilterContext *filter)
Free a filter context.
AVFilterGraph * avfilter_graph_alloc(void)
Allocate a filter graph.
static const AVFilterPad outputs[]
int max_samples
Maximum number of samples to filter at once.
int(* init)(AVFilterContext *ctx)
Filter initialization function.
int avfilter_graph_config(AVFilterGraph *graphctx, void *log_ctx)
Check validity and configure all the links and formats in the graph.
void avfilter_inout_free(AVFilterInOut **inout)
Free the supplied list of AVFilterInOut and set *inout to NULL.
struct AVFilterInOut * next
next input/input in the list, NULL if this is the last
int h
agreed upon image height
enum AVMediaType avfilter_pad_get_type(const AVFilterPad *pads, int pad_idx)
Get the type of an AVFilterPad.
Libavfilter version macros.
int request_samples
Audio only, the destination filter sets this to a non-zero value to request that buffers with the giv...
void avfilter_graph_free(AVFilterGraph **graph)
Free a graph, destroy its links, and set *graph to NULL.
enum AVMediaType type
AVFilterPad type.
int(* query_formats)(AVFilterContext *)
Query formats supported by the filter on its inputs and outputs.
AVFilterPad * dstpad
input pad on the dest filter
struct AVFilterChannelLayouts * in_channel_layouts
int thread_type
Type of multithreading being allowed/used.
int is_disabled
the enabled state from the last expression evaluation
Macro definitions for various function/variable attributes.
char * scale_sws_opts
sws options to use for the auto-inserted scale filters
static void draw_slice(HYuvContext *s, AVFrame *frame, int y)
struct AVFilterGraph * graph
filtergraph this filter belongs to
const char * name
Pad name.
int priv_size
size of private data to allocate for the filter
AVFilterLink ** inputs
array of pointers to input links
char * name
name of this filter instance
avfilter_execute_func * execute
This callback may be set by the caller immediately after allocating the graph and before adding any f...
int avfilter_link(AVFilterContext *src, unsigned srcpad, AVFilterContext *dst, unsigned dstpad)
Link two filters together.
AVFilterPad * output_pads
array of output pads
const char * avfilter_license(void)
Return the libavfilter license.
int(* request_frame)(AVFilterLink *link)
Frame request callback.
unsigned frame_requested
True if a frame is being requested on the link.
int flags
A combination of AVFILTER_FLAG_*.
void avfilter_register_all(void)
Initialize the filter system.
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.
char * resample_lavr_opts
libavresample options to use for the auto-inserted resample filters
int nb_threads
Maximum number of threads used by filters in this graph.
int avfilter_config_links(AVFilterContext *filter)
Negotiate the media format, dimensions, etc of all inputs to a filter.
const AVFilter * avfilter_next(const AVFilter *prev)
Iterate over all registered filters.
AVFilterContext * avfilter_graph_get_filter(AVFilterGraph *graph, const char *name)
Get a filter instance identified by instance name from graph.
void(* uninit)(AVFilterContext *ctx)
Filter uninitialization function.
int(* process_command)(AVFilterContext *, const char *cmd, const char *arg, char *res, int res_len, int flags)
Make the filter instance process a command.
int avfilter_graph_parse2(AVFilterGraph *graph, const char *filters, AVFilterInOut **inputs, AVFilterInOut **outputs)
Add a graph described by a string to a graph.
const OptionDef options[]
A filter pad used for either input or output.
A link between two filters.
AVFilterPad * input_pads
array of input pads
int closed
True if the link is closed.
unsigned flags
Link processing flags.
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...
int min_samples
Minimum number of samples to filter at once.
AVRational frame_rate
Frame rate of the stream on the link, or 1/0 if unknown; if left to 0/0, will be automatically be cop...
int sample_rate
samples per second
int avfilter_link_get_channels(AVFilterLink *link)
Get the number of channels of a link.
unsigned nb_outputs
number of output pads
unsigned avfilter_version(void)
Return the LIBAVFILTER_VERSION_INT constant.
void * priv
private data for use by the filter
int(* filter_frame)(AVFilterLink *link, AVFrame *frame)
Filtering callback.
char * enable_str
enable expression string
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...
AVRational time_base
Define the time base used by the PTS of the frames/samples which will pass through this link...
struct AVFilterChannelLayouts * out_channel_layouts
AVFilterFormats * in_formats
Lists of formats and channel layouts supported by the input and output filters respectively.
static FilteringContext * filter_ctx
AVFilterLink ** sink_links
Private fields.
reference-counted frame API
int w
agreed upon image width
const AVFilter * avfilter_get_by_name(const char *name)
Get a filter definition matching the given name.
unsigned nb_inputs
number of input pads
all automatic conversions disabled
typedef void(APIENTRY *FF_PFNGLACTIVETEXTUREPROC)(GLenum texture)
int needs_writable
The filter expects writable frames from its input link, duplicating data buffers if needed...
AVFilterContext * src
source filter
int partial_buf_size
Size of the partial buffer to allocate.
int(* init_opaque)(AVFilterContext *ctx, void *opaque)
Filter initialization function, alternative to the init() callback.
int age_index
Index in the age array.
AVFilterFormats * out_samplerates
AVFrame * partial_buf
Buffer partially filled with samples to achieve a fixed/minimum size.
AVFilterContext * filter_ctx
filter context associated to this input/output
int format
agreed upon media format
A list of supported channel layouts.
int avfilter_init_str(AVFilterContext *ctx, const char *args)
Initialize a filter with the supplied parameters.
const AVFilterPad * inputs
List of inputs, terminated by a zeroed element.
const AVClass * avfilter_get_class(void)
A linked-list of the inputs/outputs of the filter chain.
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.
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.
const AVClass * priv_class
A class for the private data, used to declare filter private AVOptions.
AVFilterFormats * in_samplerates
Lists of channel layouts and sample rates used for automatic negotiation.
AVSampleFormat
Audio sample formats.
int avfilter_graph_request_oldest(AVFilterGraph *graph)
Request a frame on the oldest sink link.
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_graph_parse(AVFilterGraph *graph, const char *filters, AVFilterInOut *inputs, AVFilterInOut *outputs, void *log_ctx)
Add a graph described by a string to a graph.
BYTE int const BYTE int int int height
Describe the class of an AVClass context structure.
static const AVFilterPad inputs[]
int pad_idx
index of the filt_ctx pad to use for linking
rational number numerator/denominator
AVFilterBufferRef * avfilter_get_video_buffer_ref_from_arrays(uint8_t *const data[4], const int linesize[4], int perms, int w, int h, enum AVPixelFormat format)
struct AVFilter * next
Used by the filter registration system.
int(* func)(AVBPrint *dst, const char *in, const char *arg)
const char * name
Filter name.
const char * avfilter_configuration(void)
Return the libavfilter build-time configuration.
AVRational sample_aspect_ratio
agreed upon sample aspect ratio
const char * avfilter_pad_get_name(const AVFilterPad *pads, int pad_idx)
Get the name of an AVFilterPad.
AVFilterLink ** outputs
array of pointers to output links
char * name
unique name for this input/output in the list
static int64_t pts
Global timestamp for the audio frames.
static const int8_t filt[NUMTAPS]
enum AVMediaType type
filter media type
#define attribute_deprecated
int avfilter_init_dict(AVFilterContext *ctx, AVDictionary **options)
Initialize a filter with the supplied dictionary of options.
struct AVFilterGraph * graph
Graph the filter belongs to.
void * opaque
Opaque user data.
static void filter(MpegAudioContext *s, int ch, const short *samples, int incr)
AVFilterInOut * avfilter_inout_alloc(void)
Allocate a single AVFilterInOut entry.
enum AVFilterLink::@128 init_state
stage of the initialization of the link properties (dimensions, etc)
struct AVFilterCommand * command_queue
char * avfilter_graph_dump(AVFilterGraph *graph, const char *options)
Dump a graph into a human-readable string representation.
uint64_t channel_layout
channel layout of current buffer (see libavutil/channel_layout.h)
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 channels
Number of channels.
char * aresample_swr_opts
swr options to use for the auto-inserted aresample filters, Access ONLY through AVOptions ...
const char * description
A description of the filter.
int avfilter_register(AVFilter *filter)
Register a filter.
AVFilterContext * avfilter_graph_alloc_filter(AVFilterGraph *graph, const AVFilter *filter, const char *name)
Create a new filter instance in a filter graph.
AVFilterContext * dst
dest filter
void * enable
parsed expression (AVExpr*)
const AVClass * av_class
needed for av_log() and filters common options
static const struct PPFilter filters[]
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 avfilter_pad_count(const AVFilterPad *pads)
Get the number of elements in a NULL-terminated array of AVFilterPads (e.g.
AVFilterPad * srcpad
output pad on the source filter
const AVFilterPad * outputs
List of outputs, terminated by a zeroed element.
int(* config_props)(AVFilterLink *link)
Link configuration callback.
int needs_fifo
The filter expects a fifo to be inserted on its input link, typically because it has a delay...
AVPixelFormat
Pixel format.
void avfilter_link_free(AVFilterLink **link)
Free the link in *link, and set its pointer to NULL.
const AVFilter * filter
the AVFilter of which this is an instance
int64_t current_pts
Current timestamp of the link, as defined by the most recent frame(s), in AV_TIME_BASE units...
int64_t frame_count
Number of past frames sent through the link.
AVFilterFormats * out_formats
unsigned disable_auto_convert
all automatic conversions enabled