FFmpeg
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Files | Data Structures | Macros | Functions
Libavfilter

Files

file  avfilter.h
 external API header
 

Data Structures

struct  AVFilterBuffer
 A reference-counted buffer data type used by the filter system. More...
 
struct  AVFilterBufferRefAudioProps
 Audio specific properties in a reference to an AVFilterBuffer. More...
 
struct  AVFilterBufferRefVideoProps
 Video specific properties in a reference to an AVFilterBuffer. More...
 
struct  AVFilterBufferRef
 A reference to an AVFilterBuffer. More...
 
struct  AVFilter
 Filter definition. More...
 
struct  AVFilterContext
 An instance of a filter. More...
 
struct  AVFilterLink
 A link between two filters. More...
 

Macros

#define AV_PERM_READ   0x01
 can read from the buffer
 
#define AV_PERM_WRITE   0x02
 can write to the buffer
 
#define AV_PERM_PRESERVE   0x04
 nobody else can overwrite the buffer
 
#define AV_PERM_REUSE   0x08
 can output the buffer multiple times, with the same contents each time
 
#define AV_PERM_REUSE2   0x10
 can output the buffer multiple times, modified each time
 
#define AV_PERM_NEG_LINESIZES   0x20
 the buffer requested can have negative linesizes
 
#define AV_PERM_ALIGN   0x40
 the buffer must be aligned
 
#define AVFILTER_ALIGN   16
 
#define AVFILTER_CMD_FLAG_ONE   1
 Stop once a filter understood the command (for target=all for example), fast filters are favored automatically.
 
#define AVFILTER_CMD_FLAG_FAST   2
 Only execute command when its fast (like a video out that supports contrast adjustment in hw)
 

Functions

unsigned avfilter_version (void)
 Return the LIBAVFILTER_VERSION_INT constant.
 
const char * avfilter_configuration (void)
 Return the libavfilter build-time configuration.
 
const char * avfilter_license (void)
 Return the libavfilter license.
 
const AVClassavfilter_get_class (void)
 Get the class for the AVFilterContext struct.
 
void avfilter_copy_buffer_ref_props (AVFilterBufferRef *dst, AVFilterBufferRef *src)
 Copy properties of src to dst, without copying the actual data.
 
AVFilterBufferRefavfilter_ref_buffer (AVFilterBufferRef *ref, int pmask)
 Add a new reference to a buffer.
 
void avfilter_unref_buffer (AVFilterBufferRef *ref)
 Remove a reference to a buffer.
 
void avfilter_unref_bufferp (AVFilterBufferRef **ref)
 Remove a reference to a buffer and set the pointer to NULL.
 
int avfilter_ref_get_channels (AVFilterBufferRef *ref)
 Get the number of channels of a buffer reference.
 
const char * avfilter_pad_get_name (AVFilterPad *pads, int pad_idx)
 Get the name of an AVFilterPad.
 
enum AVMediaType avfilter_pad_get_type (AVFilterPad *pads, int pad_idx)
 Get the type of an AVFilterPad.
 
int avfilter_link (AVFilterContext *src, unsigned srcpad, AVFilterContext *dst, unsigned dstpad)
 Link two filters together.
 
void avfilter_link_free (AVFilterLink **link)
 Free the link in *link, and set its pointer to NULL.
 
int avfilter_link_get_channels (AVFilterLink *link)
 Get the number of channels of a link.
 
void avfilter_link_set_closed (AVFilterLink *link, int closed)
 Set the closed field of a link.
 
int avfilter_config_links (AVFilterContext *filter)
 Negotiate the media format, dimensions, etc of all inputs to a filter.
 
AVFilterBufferRefavfilter_get_video_buffer_ref_from_arrays (uint8_t *const data[4], const int linesize[4], int perms, int w, int h, enum AVPixelFormat format)
 Create a buffer reference wrapped around an already allocated image buffer.
 
AVFilterBufferRefavfilter_get_audio_buffer_ref_from_arrays (uint8_t **data, int linesize, int perms, int nb_samples, enum AVSampleFormat sample_fmt, uint64_t channel_layout)
 Create an audio buffer reference wrapped around an already allocated samples buffer.
 
AVFilterBufferRefavfilter_get_audio_buffer_ref_from_arrays_channels (uint8_t **data, int linesize, int perms, int nb_samples, enum AVSampleFormat sample_fmt, int channels, uint64_t channel_layout)
 Create an audio buffer reference wrapped around an already allocated samples buffer.
 
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.
 
void avfilter_register_all (void)
 Initialize the filter system.
 
void avfilter_uninit (void)
 Uninitialize the filter system.
 
int avfilter_register (AVFilter *filter)
 Register a filter.
 
AVFilteravfilter_get_by_name (const char *name)
 Get a filter definition matching the given name.
 
AVFilter ** av_filter_next (AVFilter **filter)
 If filter is NULL, returns a pointer to the first registered filter pointer, if filter is non-NULL, returns the next pointer after filter.
 
int avfilter_open (AVFilterContext **filter_ctx, AVFilter *filter, const char *inst_name)
 Create a filter instance.
 
int avfilter_init_filter (AVFilterContext *filter, const char *args, void *opaque)
 Initialize a filter.
 
void avfilter_free (AVFilterContext *filter)
 Free a filter context.
 
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.
 

Detailed Description

Macro Definition Documentation

#define AV_PERM_READ   0x01
#define AV_PERM_WRITE   0x02
#define AV_PERM_PRESERVE   0x04
#define AV_PERM_REUSE   0x08

can output the buffer multiple times, with the same contents each time

Definition at line 115 of file avfilter.h.

Referenced by ff_default_get_audio_buffer(), ff_default_get_video_buffer(), ff_get_ref_perms_string(), and request_frame().

#define AV_PERM_REUSE2   0x10

can output the buffer multiple times, modified each time

Definition at line 116 of file avfilter.h.

Referenced by config_output(), config_video_output(), ff_default_get_audio_buffer(), ff_default_get_video_buffer(), ff_get_ref_perms_string(), ff_vf_next_put_image(), and frame_to_buf().

#define AV_PERM_NEG_LINESIZES   0x20

the buffer requested can have negative linesizes

Definition at line 117 of file avfilter.h.

Referenced by ff_default_get_audio_buffer(), ff_default_get_video_buffer(), ff_filter_frame_framed(), ff_get_ref_perms_string(), filter_frame(), and get_video_buffer().

#define AV_PERM_ALIGN   0x40

the buffer must be aligned

Definition at line 118 of file avfilter.h.

Referenced by ff_default_get_audio_buffer(), ff_default_get_video_buffer(), filter_frame(), and get_video_buffer().

#define AVFILTER_ALIGN   16

Definition at line 120 of file avfilter.h.

Referenced by get_video_buffer().

#define AVFILTER_CMD_FLAG_ONE   1

Stop once a filter understood the command (for target=all for example), fast filters are favored automatically.

Definition at line 762 of file avfilter.h.

Referenced by avfilter_graph_queue_command(), avfilter_graph_send_command(), check_keyboard_interaction(), and filter_frame().

#define AVFILTER_CMD_FLAG_FAST   2

Only execute command when its fast (like a video out that supports contrast adjustment in hw)

Definition at line 763 of file avfilter.h.

Referenced by avfilter_graph_send_command().

Function Documentation

unsigned avfilter_version ( void  )

Return the LIBAVFILTER_VERSION_INT constant.

Definition at line 79 of file avfilter.c.

const char* avfilter_configuration ( void  )

Return the libavfilter build-time configuration.

Definition at line 84 of file avfilter.c.

const char* avfilter_license ( void  )

Return the libavfilter license.

Definition at line 89 of file avfilter.c.

const AVClass* avfilter_get_class ( void  )

Get the class for the AVFilterContext struct.

Definition at line 498 of file avfilter.c.

Referenced by show_help_default().

void avfilter_copy_buffer_ref_props ( AVFilterBufferRef dst,
AVFilterBufferRef src 
)

Copy properties of src to dst, without copying the actual data.

Definition at line 189 of file buffer.c.

Referenced by ff_copy_buffer_ref(), ff_filter_frame_framed(), ff_filter_frame_needs_framing(), filter_frame(), geq_filter_frame(), pp_filter_frame(), and return_frame().

AVFilterBufferRef* avfilter_ref_buffer ( AVFilterBufferRef ref,
int  pmask 
)

Add a new reference to a buffer.

Parameters
refan existing reference to the buffer
pmaska bitmask containing the allowable permissions in the new reference
Returns
a new reference to the buffer with the same properties as the old, excluding any permissions denied by pmask

Definition at line 51 of file buffer.c.

Referenced by filter_frame(), push_frame(), request_frame(), return_audio_frame(), and sub2video_push_ref().

void avfilter_unref_buffer ( AVFilterBufferRef ref)
void avfilter_unref_bufferp ( AVFilterBufferRef **  ref)

Remove a reference to a buffer and set the pointer to NULL.

If this is the last reference to the buffer, the buffer itself is also automatically freed.

Parameters
refpointer to the buffer reference
Examples:
doc/examples/filtering_audio.c, and doc/examples/filtering_video.c.

Definition at line 183 of file buffer.c.

Referenced by alloc_picture(), avfilter_get_audio_buffer_ref_from_frame(), avfilter_get_video_buffer_ref_from_frame(), avfilter_link_free(), config_output(), config_video_output(), exit_program(), filter_frame(), geq_filter_frame(), join_free_buffer(), join_uninit(), main(), null_filter_frame(), queue_picture(), request_frame(), stream_close(), uninit(), write_to_fifo(), and yae_clear().

int avfilter_ref_get_channels ( AVFilterBufferRef ref)

Get the number of channels of a buffer reference.

Definition at line 30 of file audio.c.

const char* avfilter_pad_get_name ( AVFilterPad pads,
int  pad_idx 
)

Get the name of an AVFilterPad.

Parameters
padsan array of AVFilterPads
pad_idxindex of the pad in the array it; is the caller's responsibility to ensure the index is valid
Returns
name of the pad_idx'th pad in pads

Definition at line 626 of file avfilter.c.

enum AVMediaType avfilter_pad_get_type ( AVFilterPad pads,
int  pad_idx 
)

Get the type of an AVFilterPad.

Parameters
padsan array of AVFilterPads
pad_idxindex of the pad in the array; it is the caller's responsibility to ensure the index is valid
Returns
type of the pad_idx'th pad in pads

Definition at line 631 of file avfilter.c.

Referenced by configure_input_filter(), configure_output_filter(), init_input_filter(), init_output_filter(), and open_output_file().

int avfilter_link ( AVFilterContext src,
unsigned  srcpad,
AVFilterContext dst,
unsigned  dstpad 
)

Link two filters together.

Parameters
srcthe source filter
srcpadindex of the output pad on the source filter
dstthe destination filter
dstpadindex of the input pad on the destination filter
Returns
zero on success

Definition at line 125 of file avfilter.c.

Referenced by avfilter_graph_parse(), avfilter_insert_filter(), configure_input_audio_filter(), configure_input_video_filter(), configure_output_audio_filter(), configure_output_video_filter(), lavfi_read_header(), and link_filter().

void avfilter_link_free ( AVFilterLink **  link)

Free the link in *link, and set its pointer to NULL.

Definition at line 156 of file avfilter.c.

Referenced by avfilter_free().

int avfilter_link_get_channels ( AVFilterLink link)

Get the number of channels of a link.

Definition at line 169 of file avfilter.c.

Referenced by transcode_init().

void avfilter_link_set_closed ( AVFilterLink link,
int  closed 
)

Set the closed field of a link.

Definition at line 174 of file avfilter.c.

int avfilter_config_links ( AVFilterContext filter)

Negotiate the media format, dimensions, etc of all inputs to a filter.

Parameters
filterthe filter to negotiate the properties for its inputs
Returns
zero on successful negotiation

Definition at line 217 of file avfilter.c.

Referenced by avfilter_config_links(), and graph_config_links().

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 
)

Create a buffer reference wrapped around an already allocated image buffer.

Parameters
datapointers to the planes of the image to reference
linesizelinesizes for the planes of the image to reference
permsthe required access permissions
wthe width of the image specified by the data and linesize arrays
hthe height of the image specified by the data and linesize arrays
formatthe pixel format of the image specified by the data and linesize arrays

Definition at line 96 of file video.c.

Referenced by avfilter_get_video_buffer_ref_from_frame(), decode_video(), ff_default_get_video_buffer(), sub2video_prepare(), and video_thread().

AVFilterBufferRef* avfilter_get_audio_buffer_ref_from_arrays ( uint8_t **  data,
int  linesize,
int  perms,
int  nb_samples,
enum AVSampleFormat  sample_fmt,
uint64_t  channel_layout 
)

Create an audio buffer reference wrapped around an already allocated samples buffer.

See avfilter_get_audio_buffer_ref_from_arrays_channels() for a version that can handle unknown channel layouts.

Parameters
datapointers to the samples plane buffers
linesizelinesize for the samples plane buffers
permsthe required access permissions
nb_samplesnumber of samples per channel
sample_fmtthe format of each sample in the buffer to allocate
channel_layoutthe channel layout of the buffer

Definition at line 171 of file audio.c.

Referenced by av_asrc_buffer_add_samples(), and join_request_frame().

AVFilterBufferRef* avfilter_get_audio_buffer_ref_from_arrays_channels ( uint8_t **  data,
int  linesize,
int  perms,
int  nb_samples,
enum AVSampleFormat  sample_fmt,
int  channels,
uint64_t  channel_layout 
)

Create an audio buffer reference wrapped around an already allocated samples buffer.

Parameters
datapointers to the samples plane buffers
linesizelinesize for the samples plane buffers
permsthe required access permissions
nb_samplesnumber of samples per channel
sample_fmtthe format of each sample in the buffer to allocate
channelsthe number of channels of the buffer
channel_layoutthe channel layout of the buffer, must be either 0 or consistent with channels

Definition at line 95 of file audio.c.

Referenced by avfilter_get_audio_buffer_ref_from_arrays(), avfilter_get_audio_buffer_ref_from_frame(), and ff_default_get_audio_buffer().

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.

It is recommended to use avfilter_graph_send_command().

Definition at line 383 of file avfilter.c.

Referenced by avfilter_graph_send_command(), and ff_filter_frame_framed().

void avfilter_register_all ( void  )

Initialize the filter system.

Register all builtin filters.

Definition at line 39 of file allfilters.c.

Referenced by lavfi_read_header(), and main().

void avfilter_uninit ( void  )

Uninitialize the filter system.

Unregister all filters.

Definition at line 438 of file avfilter.c.

Referenced by do_exit(), and exit_program().

int avfilter_register ( AVFilter filter)

Register a filter.

This is only needed if you plan to use avfilter_get_by_name later to lookup the AVFilter structure by name. A filter can still by instantiated with avfilter_open even if it is not registered.

Parameters
filterthe filter to register
Returns
0 if the registration was successful, a negative value otherwise

Definition at line 411 of file avfilter.c.

AVFilter* avfilter_get_by_name ( const char *  name)

Get a filter definition matching the given name.

Parameters
namethe filter name to find
Returns
the filter definition, if any matching one is registered. NULL if none found.

Definition at line 400 of file avfilter.c.

Referenced by configure_input_audio_filter(), configure_input_video_filter(), configure_output_audio_filter(), configure_output_video_filter(), create_filter(), graph_insert_fifos(), init_filters(), lavfi_read_header(), main(), and query_formats().

AVFilter** av_filter_next ( AVFilter **  filter)

If filter is NULL, returns a pointer to the first registered filter pointer, if filter is non-NULL, returns the next pointer after filter.

If the returned pointer points to NULL, the last registered filter was already reached.

Definition at line 433 of file avfilter.c.

Referenced by filter_child_class_next(), and show_filters().

int avfilter_open ( AVFilterContext **  filter_ctx,
AVFilter filter,
const char *  inst_name 
)

Create a filter instance.

Parameters
filter_ctxput here a pointer to the created filter context on success, NULL on failure
filterthe filter to create an instance of
inst_nameName to give to the new instance. Can be NULL for none.
Returns
>= 0 in case of success, a negative error code otherwise

Definition at line 503 of file avfilter.c.

Referenced by avfilter_graph_create_filter(), create_filter(), and main().

int avfilter_init_filter ( AVFilterContext filter,
const char *  args,
void opaque 
)

Initialize a filter.

Parameters
filterthe filter to initialize
argsA string of parameters to use when initializing the filter. The format and meaning of this string varies by filter.
opaqueAny extra non-string data needed by the filter. The meaning of this parameter varies by filter.
Returns
zero on success

Definition at line 615 of file avfilter.c.

Referenced by avfilter_graph_create_filter(), create_filter(), and main().

void avfilter_free ( AVFilterContext filter)

Free a filter context.

Parameters
filterthe filter to free

Definition at line 565 of file avfilter.c.

Referenced by avfilter_graph_create_filter(), avfilter_graph_free(), avfilter_graph_parse(), avfilter_graph_parse2(), create_filter(), and main().

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.

Parameters
linkthe link into which the filter should be inserted
filtthe filter to be inserted
filt_srcpad_idxthe input pad on the filter to connect
filt_dstpad_idxthe output pad on the filter to connect
Returns
zero on success

Definition at line 179 of file avfilter.c.

Referenced by graph_insert_fifos(), and query_formats().