avfilter.c File Reference
#include "libavutil/channel_layout.h"
#include "libavutil/common.h"
#include "libavutil/imgutils.h"
#include "libavutil/pixdesc.h"
#include "libavutil/rational.h"
#include "libavutil/samplefmt.h"
#include "audio.h"
#include "avfilter.h"
#include "formats.h"
#include "internal.h"
#include "video.h"

Go to the source code of this file.

Macros

#define LICENSE_PREFIX   "libavfilter license: "
 
#define MAX_REGISTERED_AVFILTERS_NB   64
 

Functions

unsigned avfilter_version (void)
 Return the LIBAVFILTER_VERSION_INT constant. More...
 
const char * avfilter_configuration (void)
 Return the libavfilter build-time configuration. More...
 
const char * avfilter_license (void)
 Return the libavfilter license. More...
 
void ff_insert_pad (unsigned idx, unsigned *count, size_t padidx_off, AVFilterPad **pads, AVFilterLink ***links, AVFilterPad *newpad)
 Insert a new pad. More...
 
int avfilter_link (AVFilterContext *src, unsigned srcpad, AVFilterContext *dst, unsigned dstpad)
 Link two filters together. More...
 
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. More...
 
int avfilter_config_links (AVFilterContext *filter)
 Negotiate the media format, dimensions, etc of all inputs to a filter. More...
 
void ff_dlog_link (void *ctx, AVFilterLink *link, int end)
 
int ff_request_frame (AVFilterLink *link)
 Request an input frame from the filter at the other end of the link. More...
 
int ff_poll_frame (AVFilterLink *link)
 Poll a frame from the filter chain. More...
 
AVFilteravfilter_get_by_name (const char *name)
 Get a filter definition matching the given name. More...
 
int avfilter_register (AVFilter *filter)
 Register a filter. More...
 
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. More...
 
void avfilter_uninit (void)
 Uninitialize the filter system. More...
 
static int pad_count (const AVFilterPad *pads)
 
static const char * filter_name (void *p)
 
int avfilter_open (AVFilterContext **filter_ctx, AVFilter *filter, const char *inst_name)
 Create a filter instance. More...
 
void avfilter_free (AVFilterContext *filter)
 Free a filter context. More...
 
int avfilter_init_filter (AVFilterContext *filter, const char *args, void *opaque)
 Initialize a filter. More...
 
const char * avfilter_pad_get_name (AVFilterPad *pads, int pad_idx)
 Get the name of an AVFilterPad. More...
 
enum AVMediaType avfilter_pad_get_type (AVFilterPad *pads, int pad_idx)
 Get the type of an AVFilterPad. More...
 
static int default_filter_frame (AVFilterLink *link, AVFilterBufferRef *frame)
 
int ff_filter_frame (AVFilterLink *link, AVFilterBufferRef *frame)
 Send a frame of data to the next filter. More...
 

Variables

static AVFilterregistered_avfilters [MAX_REGISTERED_AVFILTERS_NB+1]
 
static int next_registered_avfilter_idx = 0
 
static const AVClass avfilter_class
 

Macro Definition Documentation

#define LICENSE_PREFIX   "libavfilter license: "

Referenced by avfilter_license().

#define MAX_REGISTERED_AVFILTERS_NB   64

Definition at line 268 of file avfilter.c.

Referenced by avfilter_register().

Function Documentation

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 294 of file avfilter.c.

Referenced by show_filters().

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 140 of file avfilter.c.

Referenced by avfilter_config_links(), and graph_config_links().

const char* avfilter_configuration ( void  )

Return the libavfilter build-time configuration.

Definition at line 41 of file avfilter.c.

void avfilter_free ( AVFilterContext filter)

Free a filter context.

Parameters
filterthe filter to free

Definition at line 391 of file avfilter.c.

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

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 274 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(), main(), and query_formats().

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 435 of file avfilter.c.

Referenced by avfilter_graph_create_filter(), 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 103 of file avfilter.c.

Referenced by graph_insert_fifos(), and query_formats().

const char* avfilter_license ( void  )

Return the libavfilter license.

Definition at line 46 of file avfilter.c.

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 73 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(), and link_filter().

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 329 of file avfilter.c.

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

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 444 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 449 of file avfilter.c.

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

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 succesfull, a negative value otherwise

Definition at line 285 of file avfilter.c.

void avfilter_uninit ( void  )

Uninitialize the filter system.

Unregister all filters.

Definition at line 299 of file avfilter.c.

Referenced by do_exit(), and exit_program().

unsigned avfilter_version ( void  )

Return the LIBAVFILTER_VERSION_INT constant.

Definition at line 37 of file avfilter.c.

static int default_filter_frame ( AVFilterLink link,
AVFilterBufferRef frame 
)
static

Definition at line 454 of file avfilter.c.

Referenced by ff_filter_frame().

void ff_dlog_link ( void ctx,
AVFilterLink link,
int  end 
)

Definition at line 215 of file avfilter.c.

Referenced by ff_filter_frame(), ff_get_video_buffer(), and ff_request_frame().

int ff_filter_frame ( AVFilterLink link,
AVFilterBufferRef frame 
)

Send a frame of data to the next filter.

Parameters
linkthe output link over which the data is being sent
framea reference to the buffer of data being sent. The receiving filter will free this reference when it no longer needs it or pass it on to the next filter.
Returns
>= 0 on success, a negative AVERROR on error. The receiving filter is responsible for unreferencing frame in case of error.

Definition at line 459 of file avfilter.c.

Referenced by channelmap_filter_frame(), color_request_frame(), default_filter_frame(), filter_frame(), join_request_frame(), output_frame(), request_frame(), return_audio_frame(), and return_frame().

void ff_insert_pad ( unsigned  idx,
unsigned *  count,
size_t  padidx_off,
AVFilterPad **  pads,
AVFilterLink ***  links,
AVFilterPad newpad 
)

Insert a new pad.

Parameters
idxInsertion point. Pad is inserted at the end if this point is beyond the end of the list of pads.
countPointer to the number of pads in the list
padidx_offOffset within an AVFilterLink structure to the element to increment when inserting a new pad causes link numbering to change
padsPointer to the pointer to the beginning of the list of pads
linksPointer to the pointer to the beginning of the list of links
newpadThe new pad to add. A copy is made when adding.

Definition at line 52 of file avfilter.c.

Referenced by ff_insert_inpad(), and ff_insert_outpad().

int ff_poll_frame ( AVFilterLink link)

Poll a frame from the filter chain.

Parameters
linkthe input link
Returns
the number of immediately available frames, a negative number in case of error

Definition at line 250 of file avfilter.c.

Referenced by av_buffersink_read(), ff_poll_frame(), and poll_frame().

int ff_request_frame ( AVFilterLink link)

Request an input frame from the filter at the other end of the link.

Parameters
linkthe input link
Returns
zero on success

Definition at line 239 of file avfilter.c.

Referenced by av_buffersink_read(), ff_request_frame(), join_request_frame(), poll_frame(), request_frame(), request_samples(), and return_audio_frame().

static const char* filter_name ( void p)
static

Definition at line 316 of file avfilter.c.

Referenced by main().

static int pad_count ( const AVFilterPad pads)
static

Definition at line 305 of file avfilter.c.

Referenced by avfilter_open().

Variable Documentation

const AVClass avfilter_class
static
Initial value:
= {
"AVFilter",
}
static const char * filter_name(void *p)
Definition: avfilter.c:316
LIBAVUTIL_VERSION_INT
Definition: eval.c:52
NULL
Definition: eval.c:52

Definition at line 322 of file avfilter.c.

Referenced by avfilter_open().

int next_registered_avfilter_idx = 0
static

Definition at line 272 of file avfilter.c.

Referenced by avfilter_register(), and avfilter_uninit().

AVFilter* registered_avfilters[MAX_REGISTERED_AVFILTERS_NB+1]
static

Definition at line 270 of file avfilter.c.