avfilter.h File Reference
#include "libavutil/avutil.h"
#include "libavutil/log.h"
#include "libavutil/samplefmt.h"
#include "libavutil/pixfmt.h"
#include "libavutil/rational.h"
#include "libavcodec/avcodec.h"
#include <stddef.h>
#include "libavfilter/version.h"

Go to the source code of this file.

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  AVFilterFormats
 A list of supported formats for one end of a filter link. More...
struct  AVFilterPad
 A filter pad used for either input or output. 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

Typedefs

typedef struct AVFilterContext AVFilterContext
typedef struct AVFilterLink AVFilterLink
typedef struct AVFilterPad AVFilterPad
typedef struct AVFilterBuffer AVFilterBuffer
 A reference-counted buffer data type used by the filter system.
typedef struct
AVFilterBufferRefAudioProps 
AVFilterBufferRefAudioProps
 Audio specific properties in a reference to an AVFilterBuffer.
typedef struct
AVFilterBufferRefVideoProps 
AVFilterBufferRefVideoProps
 Video specific properties in a reference to an AVFilterBuffer.
typedef struct AVFilterBufferRef AVFilterBufferRef
 A reference to an AVFilterBuffer.
typedef struct AVFilterFormats AVFilterFormats
 A list of supported formats for one end of a filter link.
typedef struct AVFilter AVFilter
 Filter definition.

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.
static 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.
AVFilterFormatsavfilter_make_format_list (const int *fmts)
 Create a list of supported formats.
int avfilter_add_format (AVFilterFormats **avff, int fmt)
 Add fmt to the list of media formats contained in *avff.
AVFilterFormatsavfilter_all_formats (enum AVMediaType type)
 Return a list of all formats supported by Libav for the given media type.
AVFilterFormatsavfilter_merge_formats (AVFilterFormats *a, AVFilterFormats *b)
 Return a format list which contains the intersection of the formats of a and b.
void avfilter_formats_ref (AVFilterFormats *formats, AVFilterFormats **ref)
 Add *ref as a new reference to formats.
void avfilter_formats_unref (AVFilterFormats **ref)
 If *ref is non-NULL, remove *ref as a reference to the format list it currently points to, deallocates that list if this was the last reference, and sets *ref to NULL.
void avfilter_formats_changeref (AVFilterFormats **oldref, AVFilterFormats **newref)
 
   Before                                 After

|formats |<------—.
void avfilter_default_start_frame (AVFilterLink *link, AVFilterBufferRef *picref)
 default handler for start_frame() for video inputs
void avfilter_default_draw_slice (AVFilterLink *link, int y, int h, int slice_dir)
 default handler for draw_slice() for video inputs
void avfilter_default_end_frame (AVFilterLink *link)
 default handler for end_frame() for video inputs
void avfilter_default_filter_samples (AVFilterLink *link, AVFilterBufferRef *samplesref)
 default handler for filter_samples() for audio inputs
int avfilter_default_config_output_link (AVFilterLink *link)
 default handler for config_props() for audio/video outputs
int avfilter_default_config_input_link (AVFilterLink *link)
 default handler for config_props() for audio/video inputs
AVFilterBufferRefavfilter_default_get_video_buffer (AVFilterLink *link, int perms, int w, int h)
 default handler for get_video_buffer() for video inputs
AVFilterBufferRefavfilter_default_get_audio_buffer (AVFilterLink *link, int perms, enum AVSampleFormat sample_fmt, int size, uint64_t channel_layout, int planar)
 default handler for get_audio_buffer() for audio inputs
void avfilter_set_common_formats (AVFilterContext *ctx, AVFilterFormats *formats)
 A helper for query_formats() which sets all links to the same list of formats.
int avfilter_default_query_formats (AVFilterContext *ctx)
 Default handler for query_formats()
void avfilter_null_start_frame (AVFilterLink *link, AVFilterBufferRef *picref)
 start_frame() handler for filters which simply pass video along
void avfilter_null_draw_slice (AVFilterLink *link, int y, int h, int slice_dir)
 draw_slice() handler for filters which simply pass video along
void avfilter_null_end_frame (AVFilterLink *link)
 end_frame() handler for filters which simply pass video along
void avfilter_null_filter_samples (AVFilterLink *link, AVFilterBufferRef *samplesref)
 filter_samples() handler for filters which simply pass audio along
AVFilterBufferRefavfilter_null_get_video_buffer (AVFilterLink *link, int perms, int w, int h)
 get_video_buffer() handler for filters which simply pass video along
AVFilterBufferRefavfilter_null_get_audio_buffer (AVFilterLink *link, int perms, enum AVSampleFormat sample_fmt, int size, uint64_t channel_layout, int planar)
 get_audio_buffer() handler for filters which simply pass audio along
int avfilter_link (AVFilterContext *src, unsigned srcpad, AVFilterContext *dst, unsigned dstpad)
 Link two filters together.
int avfilter_config_links (AVFilterContext *filter)
 Negotiate the media format, dimensions, etc of all inputs to a filter.
AVFilterBufferRefavfilter_get_video_buffer (AVFilterLink *link, int perms, int w, int h)
 Request a picture buffer with a specific set of permissions.
AVFilterBufferRefavfilter_get_video_buffer_ref_from_arrays (uint8_t *data[4], int linesize[4], int perms, int w, int h, enum PixelFormat format)
 Create a buffer reference wrapped around an already allocated image buffer.
AVFilterBufferRefavfilter_get_audio_buffer (AVFilterLink *link, int perms, enum AVSampleFormat sample_fmt, int size, uint64_t channel_layout, int planar)
 Request an audio samples buffer with a specific set of permissions.
int avfilter_request_frame (AVFilterLink *link)
 Request an input frame from the filter at the other end of the link.
int avfilter_poll_frame (AVFilterLink *link)
 Poll a frame from the filter chain.
void avfilter_start_frame (AVFilterLink *link, AVFilterBufferRef *picref)
 Notify the next filter of the start of a frame.
void avfilter_end_frame (AVFilterLink *link)
 Notifie the next filter that the current frame has finished.
void avfilter_draw_slice (AVFilterLink *link, int y, int h, int slice_dir)
 Send a slice to the next filter.
void avfilter_filter_samples (AVFilterLink *link, AVFilterBufferRef *samplesref)
 Send a buffer of audio samples to the next filter.
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.
void avfilter_insert_pad (unsigned idx, unsigned *count, size_t padidx_off, AVFilterPad **pads, AVFilterLink ***links, AVFilterPad *newpad)
 Insert a new pad.
static void avfilter_insert_inpad (AVFilterContext *f, unsigned index, AVFilterPad *p)
 Insert a new input pad for the filter.
static void avfilter_insert_outpad (AVFilterContext *f, unsigned index, AVFilterPad *p)
 Insert a new output pad for the filter.
int avfilter_copy_frame_props (AVFilterBufferRef *dst, const AVFrame *src)
 Copy the frame properties of src to dst, without copying the actual image data.

Macro Definition Documentation

#define AV_PERM_NEG_LINESIZES   0x20

the buffer requested can have negative linesizes

Definition at line 86 of file avfilter.h.

Referenced by avfilter_start_frame(), get_video_buffer(), and start_frame().

#define AV_PERM_PRESERVE   0x04

nobody else can overwrite the buffer

Definition at line 83 of file avfilter.h.

Referenced by movie_get_frame(), return_frame(), start_frame(), and transcode_video().

#define AV_PERM_READ   0x01

can read from the buffer

Definition at line 81 of file avfilter.h.

Referenced by avfilter_default_get_audio_buffer(), avfilter_get_video_buffer_ref_from_arrays(), start_frame(), and transcode_video().

#define AV_PERM_REUSE   0x08

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

Definition at line 84 of file avfilter.h.

Referenced by return_frame(), and start_frame().

#define AV_PERM_REUSE2   0x10

can output the buffer multiple times, modified each time

Definition at line 85 of file avfilter.h.

Referenced by movie_get_frame().

Typedef Documentation

typedef struct AVFilter AVFilter

Filter definition.

This defines the pads a filter contains, and all the callback functions used to interact with the filter.

A reference-counted buffer data type used by the filter system.

Filters should not store pointers to this structure directly, but instead use the AVFilterBufferRef structure below.

A reference to an AVFilterBuffer.

Since filters can manipulate the origin of a buffer to, for example, crop image without any memcpy, the buffer origin and dimensions are per-reference properties. Linesize is also useful for image flipping, frame to field filters, etc, and so is also per-reference.

TODO: add anything necessary for frame reordering

Audio specific properties in a reference to an AVFilterBuffer.

Since AVFilterBufferRef is common to different media formats, audio specific per reference properties must be separated out.

Video specific properties in a reference to an AVFilterBuffer.

Since AVFilterBufferRef is common to different media formats, video specific per reference properties must be separated out.

Definition at line 52 of file avfilter.h.

A list of supported formats for one end of a filter link.

This is used during the format negotiation process to try to pick the best format to use to minimize the number of necessary conversions. Each filter gives a list of the formats supported by each input and output pad. The list given for each pad need not be distinct - they may be references to the same list of formats, as is often the case when a filter supports multiple formats, but will always output the same format as it is given in input.

In this way, a list of possible input formats and a list of possible output formats are associated with each link. When a set of formats is negotiated over a link, the input and output lists are merged to form a new list containing only the common elements of each list. In the case that there were no common elements, a format conversion is necessary. Otherwise, the lists are merged, and all other links which reference either of the format lists involved in the merge are also affected.

For example, consider the filter chain: filter (a) –> (b) filter (b) –> (c) filter

where the letters in parenthesis indicate a list of formats supported on the input or output of the link. Suppose the lists are as follows: (a) = {A, B} (b) = {A, B, C} (c) = {B, C}

First, the first link's lists are merged, yielding: filter (a) –> (a) filter (a) –> (c) filter

Notice that format list (b) now refers to the same list as filter list (a). Next, the lists for the second link are merged, yielding: filter (a) –> (a) filter (a) –> (a) filter

where (a) = {B}.

Unfortunately, when the format lists at the two ends of a link are merged, we must ensure that all links which reference either pre-merge format list get updated as well. Therefore, we have the format list structure store a pointer to each of the pointers to itself.

typedef struct AVFilterLink AVFilterLink

Definition at line 53 of file avfilter.h.

typedef struct AVFilterPad AVFilterPad

Definition at line 54 of file avfilter.h.

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

Referenced by show_filters().

int avfilter_add_format ( AVFilterFormats **  avff,
int  fmt 
)

Add fmt to the list of media formats contained in *avff.

If *avff is NULL the function allocates the filter formats struct and puts its pointer in *avff.

Returns
a non negative value in case of success, or a negative value corresponding to an AVERROR code in case of error

Definition at line 107 of file formats.c.

Referenced by avfilter_all_formats(), and query_formats().

AVFilterFormats* avfilter_all_formats ( enum AVMediaType  type)

Return a list of all formats supported by Libav for the given media type.

Definition at line 124 of file formats.c.

Referenced by avfilter_default_query_formats().

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

Referenced by avfilter_config_links(), and ff_avfilter_graph_config_links().

const char* avfilter_configuration ( void  )

Return the libavfilter build-time configuration.

Definition at line 36 of file avfilter.c.

static void avfilter_copy_buffer_ref_props ( AVFilterBufferRef dst,
AVFilterBufferRef src 
)
inlinestatic

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

Definition at line 148 of file avfilter.h.

Referenced by avfilter_default_start_frame(), avfilter_start_frame(), return_frame(), and start_frame().

int avfilter_copy_frame_props ( AVFilterBufferRef dst,
const AVFrame src 
)

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

Returns
0 on success, a negative number on error.

Definition at line 685 of file avfilter.c.

Referenced by av_vsrc_buffer_add_frame(), movie_get_frame(), and transcode_video().

int avfilter_default_config_input_link ( AVFilterLink link)

default handler for config_props() for audio/video inputs

int avfilter_default_config_output_link ( AVFilterLink link)

default handler for config_props() for audio/video outputs

Definition at line 206 of file defaults.c.

Referenced by avfilter_config_links().

void avfilter_default_draw_slice ( AVFilterLink link,
int  y,
int  h,
int  slice_dir 
)

default handler for draw_slice() for video inputs

Definition at line 150 of file defaults.c.

Referenced by avfilter_draw_slice().

void avfilter_default_end_frame ( AVFilterLink link)

default handler for end_frame() for video inputs

Definition at line 161 of file defaults.c.

Referenced by avfilter_end_frame().

void avfilter_default_filter_samples ( AVFilterLink link,
AVFilterBufferRef samplesref 
)

default handler for filter_samples() for audio inputs

Definition at line 181 of file defaults.c.

Referenced by avfilter_filter_samples().

AVFilterBufferRef* avfilter_default_get_audio_buffer ( AVFilterLink link,
int  perms,
enum AVSampleFormat  sample_fmt,
int  size,
uint64_t  channel_layout,
int  planar 
)

default handler for get_audio_buffer() for audio inputs

Definition at line 58 of file defaults.c.

Referenced by avfilter_default_filter_samples(), avfilter_filter_samples(), and avfilter_get_audio_buffer().

AVFilterBufferRef* avfilter_default_get_video_buffer ( AVFilterLink link,
int  perms,
int  w,
int  h 
)

default handler for get_video_buffer() for video inputs

Definition at line 38 of file defaults.c.

Referenced by avfilter_get_video_buffer(), and get_video_buffer().

int avfilter_default_query_formats ( AVFilterContext ctx)

Default handler for query_formats()

Definition at line 258 of file defaults.c.

Referenced by main(), and query_formats().

void avfilter_default_start_frame ( AVFilterLink link,
AVFilterBufferRef picref 
)

default handler for start_frame() for video inputs

Definition at line 136 of file defaults.c.

Referenced by avfilter_start_frame().

void avfilter_draw_slice ( AVFilterLink link,
int  y,
int  h,
int  slice_dir 
)

Send a slice to the next filter.

Slices have to be provided in sequential order, either in top-bottom or bottom-top order. If slices are provided in non-sequential order the behavior of the function is undefined.

Parameters
linkthe output link over which the frame is being sent
yoffset in pixels from the top of the image for this slice
hheight of this slice in pixels
slice_dirthe assumed direction for sending slices, from the top slice to the bottom slice if the value is 1, from the bottom slice to the top slice if the value is -1, for other values the behavior of the function is undefined.

Definition at line 447 of file avfilter.c.

Referenced by avfilter_default_draw_slice(), avfilter_null_draw_slice(), color_request_frame(), draw_send_bar_slice(), draw_slice(), end_frame(), request_frame(), and return_frame().

void avfilter_end_frame ( AVFilterLink link)

Notifie the next filter that the current frame has finished.

Parameters
linkthe output link the frame was sent over

Definition at line 430 of file avfilter.c.

Referenced by avfilter_default_end_frame(), avfilter_null_end_frame(), color_request_frame(), end_frame(), request_frame(), and return_frame().

void avfilter_filter_samples ( AVFilterLink link,
AVFilterBufferRef samplesref 
)

Send a buffer of audio samples to the next filter.

Parameters
linkthe output link over which the audio samples are being sent
samplesrefa reference to the buffer of audio samples being sent. The receiving filter will free this reference when it no longer needs it or pass it on to the next filter.

Definition at line 488 of file avfilter.c.

Referenced by avfilter_default_filter_samples(), and avfilter_null_filter_samples().

void avfilter_formats_changeref ( AVFilterFormats **  oldref,
AVFilterFormats **  newref 
)

   Before                                 After

|formats |<------—.

        |formats |<---------.

| ____ | ___|___ | ____ | ___|___ | |refs| | | | | | |refs| | | | | NULL | |* *------—>|*oldref| | |* *------—>|*newref| ^ | |* * | | |_______| | |* * | | |_______| ___|___ | |____| | | |____| | | | | |________| |________| |*oldref| |_______|

Definition at line 176 of file formats.c.

Referenced by avfilter_insert_filter().

void avfilter_formats_ref ( AVFilterFormats formats,
AVFilterFormats **  ref 
)

Add *ref as a new reference to formats.

That is the pointers will point like in the ascii art below:


|formats |<-----—. | ____ | ____|___________________ | |refs| | | __|_ | |* * | | | | | | AVFilterLink | |* *------—>|*ref| | |____| | | |____| |________| |________________________

Definition at line 139 of file formats.c.

Referenced by avfilter_set_common_formats(), and query_formats().

void avfilter_formats_unref ( AVFilterFormats **  ref)

If *ref is non-NULL, remove *ref as a reference to the format list it currently points to, deallocates that list if this was the last reference, and sets *ref to NULL.

   Before                                 After

________ ________ NULL |formats |<-----—. |formats | ^ | ____ | ____|________________ | ____ | ____|________________ | |refs| | | __|_ | |refs| | | __|_ | |* * | | | | | | AVFilterLink | |* * | | | | | | AVFilterLink | |* *------—>|*ref| | |* | | | |*ref| | |____| | | |____| | |____| | | |____| |________| |_____________________ |________| |_____________________

Definition at line 155 of file formats.c.

Referenced by avfilter_free(), pick_format(), and query_formats().

void avfilter_free ( AVFilterContext filter)

Free a filter context.

Parameters
filterthe filter to free

Definition at line 640 of file avfilter.c.

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

AVFilterBufferRef* avfilter_get_audio_buffer ( AVFilterLink link,
int  perms,
enum AVSampleFormat  sample_fmt,
int  size,
uint64_t  channel_layout,
int  planar 
)

Request an audio samples buffer with a specific set of permissions.

Parameters
linkthe output link to the filter from which the buffer will be requested
permsthe required access permissions
sample_fmtthe format of each sample in the buffer to allocate
sizethe buffer size in bytes
channel_layoutthe number and type of channels per sample in the buffer to allocate
planaraudio data layout - planar or packed
Returns
A reference to the samples. This must be unreferenced with avfilter_unref_buffer when you are finished with it.

Definition at line 351 of file avfilter.c.

Referenced by avfilter_null_get_audio_buffer().

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

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

AVFilterBufferRef* avfilter_get_video_buffer ( AVFilterLink link,
int  perms,
int  w,
int  h 
)

Request a picture buffer with a specific set of permissions.

Parameters
linkthe output link to the filter from which the buffer will be requested
permsthe required access permissions
wthe minimum width of the buffer to allocate
hthe minimum height of the buffer to allocate
Returns
A reference to the buffer. This must be unreferenced with avfilter_unref_buffer when you are finished with it.

Definition at line 289 of file avfilter.c.

Referenced by av_vsrc_buffer_add_frame(), avfilter_default_start_frame(), avfilter_null_get_video_buffer(), avfilter_start_frame(), color_request_frame(), get_video_buffer(), movie_get_frame(), request_frame(), return_frame(), source_request_frame(), and start_frame().

AVFilterBufferRef* avfilter_get_video_buffer_ref_from_arrays ( uint8_t *  data[4],
int  linesize[4],
int  perms,
int  w,
int  h,
enum PixelFormat  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 312 of file avfilter.c.

Referenced by avfilter_default_get_video_buffer(), and transcode_video().

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

Referenced by query_formats().

static void avfilter_insert_inpad ( AVFilterContext f,
unsigned  index,
AVFilterPad p 
)
inlinestatic

Insert a new input pad for the filter.

Definition at line 842 of file avfilter.h.

static void avfilter_insert_outpad ( AVFilterContext f,
unsigned  index,
AVFilterPad p 
)
inlinestatic

Insert a new output pad for the filter.

Definition at line 850 of file avfilter.h.

void avfilter_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 84 of file avfilter.c.

Referenced by avfilter_insert_inpad(), and avfilter_insert_outpad().

const char* avfilter_license ( void  )

Return the libavfilter license.

Definition at line 41 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 105 of file avfilter.c.

Referenced by avfilter_insert_filter(), and link_filter().

AVFilterFormats* avfilter_make_format_list ( const int *  fmts)

Create a list of supported formats.

This is intended for use in AVFilter->query_formats().

Parameters
fmtslist of media formats, terminated by -1
Returns
the format list, with no existing references

Definition at line 90 of file formats.c.

Referenced by query_formats().

AVFilterFormats* avfilter_merge_formats ( AVFilterFormats a,
AVFilterFormats b 
)

Return a format list which contains the intersection of the formats of a and b.

Also, all the references of a, all the references of b, and a and b themselves will be deallocated.

If a and b do not share any common formats, neither is modified, and NULL is returned.

Definition at line 43 of file formats.c.

Referenced by query_formats().

void avfilter_null_draw_slice ( AVFilterLink link,
int  y,
int  h,
int  slice_dir 
)

draw_slice() handler for filters which simply pass video along

Definition at line 273 of file defaults.c.

void avfilter_null_end_frame ( AVFilterLink link)

end_frame() handler for filters which simply pass video along

Definition at line 278 of file defaults.c.

void avfilter_null_filter_samples ( AVFilterLink link,
AVFilterBufferRef samplesref 
)

filter_samples() handler for filters which simply pass audio along

Definition at line 283 of file defaults.c.

AVFilterBufferRef* avfilter_null_get_audio_buffer ( AVFilterLink link,
int  perms,
enum AVSampleFormat  sample_fmt,
int  size,
uint64_t  channel_layout,
int  planar 
)

get_audio_buffer() handler for filters which simply pass audio along

Definition at line 293 of file defaults.c.

AVFilterBufferRef* avfilter_null_get_video_buffer ( AVFilterLink link,
int  perms,
int  w,
int  h 
)

get_video_buffer() handler for filters which simply pass video along

Definition at line 288 of file defaults.c.

void avfilter_null_start_frame ( AVFilterLink link,
AVFilterBufferRef picref 
)

start_frame() handler for filters which simply pass video along

Definition at line 268 of file defaults.c.

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

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

int avfilter_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 380 of file avfilter.c.

Referenced by avfilter_poll_frame(), output_packet(), poll_frame(), and transcode_video().

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

Referenced by avfilter_default_filter_samples(), avfilter_default_start_frame(), color_request_frame(), request_frame(), source_request_frame(), and start_frame().

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

Referenced by avfilter_register_all().

void avfilter_register_all ( void  )

Initialize the filter system.

Register all builtin filters.

Definition at line 29 of file allfilters.c.

Referenced by main().

int avfilter_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 369 of file avfilter.c.

Referenced by avfilter_request_frame(), poll_frame(), request_frame(), and start_frame().

void avfilter_set_common_formats ( AVFilterContext ctx,
AVFilterFormats formats 
)

A helper for query_formats() which sets all links to the same list of formats.

If there are no links hooked to this filter, the list of formats is freed.

If there are no links hooked to this filter, the list of formats is freed.

FIXME: this will need changed for filters with a mix of pad types (video + audio, etc)

Definition at line 234 of file defaults.c.

Referenced by avfilter_default_query_formats(), and query_formats().

void avfilter_start_frame ( AVFilterLink link,
AVFilterBufferRef picref 
)

Notify the next filter of the start of a frame.

Parameters
linkthe output link the frame will be sent over
picrefA reference to the frame about to be sent. The data for this frame need only be valid once draw_slice() is called for that portion. The receiving filter will free this reference when it no longer needs it.

Definition at line 400 of file avfilter.c.

Referenced by avfilter_default_start_frame(), avfilter_null_start_frame(), color_request_frame(), request_frame(), return_frame(), source_request_frame(), and start_frame().

void avfilter_uninit ( void  )

Uninitialize the filter system.

Unregister all filters.

Definition at line 555 of file avfilter.c.

Referenced by do_exit(), and exit_program().

void avfilter_unref_buffer ( AVFilterBufferRef ref)

Remove a reference to a buffer.

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

Parameters
refreference to the buffer, may be NULL

Definition at line 73 of file avfilter.c.

Referenced by alloc_picture(), avfilter_default_end_frame(), avfilter_default_filter_samples(), avfilter_end_frame(), avfilter_filter_samples(), color_request_frame(), end_frame(), output_packet(), queue_picture(), request_frame(), start_frame(), stream_close(), transcode_video(), and uninit().

unsigned avfilter_version ( void  )

Return the LIBAVFILTER_VERSION_INT constant.

Definition at line 32 of file avfilter.c.