avfiltergraph.c File Reference
#include <string.h>
#include "libavutil/avassert.h"
#include "libavutil/avstring.h"
#include "libavutil/bprint.h"
#include "libavutil/channel_layout.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "libavcodec/avcodec.h"
#include "avfilter.h"
#include "formats.h"
#include "internal.h"
Include dependency graph for avfiltergraph.c:

Go to the source code of this file.

Macros

#define OFFSET(x)   offsetof(AVFilterGraph,x)
 
#define MERGE_DISPATCH(field, statement)
 
#define REDUCE_FORMATS(fmt_type, list_type, list, var, nb, add_format)
 
#define CH_CENTER_PAIR   (AV_CH_FRONT_LEFT_OF_CENTER | AV_CH_FRONT_RIGHT_OF_CENTER)
 
#define CH_FRONT_PAIR   (AV_CH_FRONT_LEFT | AV_CH_FRONT_RIGHT)
 
#define CH_STEREO_PAIR   (AV_CH_STEREO_LEFT | AV_CH_STEREO_RIGHT)
 
#define CH_WIDE_PAIR   (AV_CH_WIDE_LEFT | AV_CH_WIDE_RIGHT)
 
#define CH_SIDE_PAIR   (AV_CH_SIDE_LEFT | AV_CH_SIDE_RIGHT)
 
#define CH_DIRECT_PAIR   (AV_CH_SURROUND_DIRECT_LEFT | AV_CH_SURROUND_DIRECT_RIGHT)
 
#define CH_BACK_PAIR   (AV_CH_BACK_LEFT | AV_CH_BACK_RIGHT)
 

Functions

AVFilterGraphavfilter_graph_alloc (void)
 Allocate a filter graph. More...
 
void ff_filter_graph_remove_filter (AVFilterGraph *graph, AVFilterContext *filter)
 Remove a filter from a graph;. More...
 
void avfilter_graph_free (AVFilterGraph **graph)
 Free a graph, destroy its links, and set *graph to NULL. More...
 
int avfilter_graph_create_filter (AVFilterContext **filt_ctx, AVFilter *filt, const char *name, const char *args, void *opaque, AVFilterGraph *graph_ctx)
 Create and add a filter instance into an existing graph. More...
 
void avfilter_graph_set_auto_convert (AVFilterGraph *graph, unsigned flags)
 Enable or disable automatic format conversion inside the graph. More...
 
AVFilterContextavfilter_graph_alloc_filter (AVFilterGraph *graph, const AVFilter *filter, const char *name)
 Create a new filter instance in a filter graph. More...
 
static int graph_check_validity (AVFilterGraph *graph, AVClass *log_ctx)
 Check for the validity of graph. More...
 
static int graph_config_links (AVFilterGraph *graph, AVClass *log_ctx)
 Configure all the links of graphctx. More...
 
AVFilterContextavfilter_graph_get_filter (AVFilterGraph *graph, char *name)
 Get a filter instance with name name from graph. More...
 
static void sanitize_channel_layouts (void *log, AVFilterChannelLayouts *l)
 
static int filter_query_formats (AVFilterContext *ctx)
 
static int formats_declared (AVFilterContext *f)
 
static int query_formats (AVFilterGraph *graph, AVClass *log_ctx)
 
static int pick_format (AVFilterLink *link, AVFilterLink *ref)
 
static int reduce_formats_on_filter (AVFilterContext *filter)
 
static void reduce_formats (AVFilterGraph *graph)
 
static void swap_samplerates_on_filter (AVFilterContext *filter)
 
static void swap_samplerates (AVFilterGraph *graph)
 
static void swap_channel_layouts_on_filter (AVFilterContext *filter)
 
static void swap_channel_layouts (AVFilterGraph *graph)
 
static void swap_sample_fmts_on_filter (AVFilterContext *filter)
 
static void swap_sample_fmts (AVFilterGraph *graph)
 
static int pick_formats (AVFilterGraph *graph)
 
static int graph_config_formats (AVFilterGraph *graph, AVClass *log_ctx)
 Configure the formats of all the links in the graph. More...
 
static int ff_avfilter_graph_config_pointers (AVFilterGraph *graph, AVClass *log_ctx)
 
static int graph_insert_fifos (AVFilterGraph *graph, AVClass *log_ctx)
 
int avfilter_graph_config (AVFilterGraph *graphctx, void *log_ctx)
 Check validity and configure all the links and formats in the graph. More...
 
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. More...
 
int avfilter_graph_queue_command (AVFilterGraph *graph, const char *target, const char *command, const char *arg, int flags, double ts)
 Queue a command for one or more filter instances. More...
 
static void heap_bubble_up (AVFilterGraph *graph, AVFilterLink *link, int index)
 
static void heap_bubble_down (AVFilterGraph *graph, AVFilterLink *link, int index)
 
void ff_avfilter_graph_update_heap (AVFilterGraph *graph, AVFilterLink *link)
 Update the position of a link in the age heap. More...
 
int avfilter_graph_request_oldest (AVFilterGraph *graph)
 Request a frame on the oldest sink link. More...
 

Variables

static const AVOption options []
 
static const AVClass filtergraph_class
 
static const uint64_t ch_subst [][2]
 

Macro Definition Documentation

#define CH_BACK_PAIR   (AV_CH_BACK_LEFT | AV_CH_BACK_RIGHT)

Definition at line 688 of file avfiltergraph.c.

Definition at line 682 of file avfiltergraph.c.

Definition at line 687 of file avfiltergraph.c.

#define CH_FRONT_PAIR   (AV_CH_FRONT_LEFT | AV_CH_FRONT_RIGHT)

Definition at line 683 of file avfiltergraph.c.

#define CH_SIDE_PAIR   (AV_CH_SIDE_LEFT | AV_CH_SIDE_RIGHT)

Definition at line 686 of file avfiltergraph.c.

#define CH_STEREO_PAIR   (AV_CH_STEREO_LEFT | AV_CH_STEREO_RIGHT)

Definition at line 684 of file avfiltergraph.c.

#define CH_WIDE_PAIR   (AV_CH_WIDE_LEFT | AV_CH_WIDE_RIGHT)

Definition at line 685 of file avfiltergraph.c.

#define MERGE_DISPATCH (   field,
  statement 
)
Value:
if (!(link->in_ ## field && link->out_ ## field)) { \
count_delayed++; \
} else if (link->in_ ## field == link->out_ ## field) { \
count_already_merged++; \
} else { \
count_merged++; \
statement \
}
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFilterBuffer 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

Referenced by query_formats().

#define OFFSET (   x)    offsetof(AVFilterGraph,x)

Definition at line 36 of file avfiltergraph.c.

#define REDUCE_FORMATS (   fmt_type,
  list_type,
  list,
  var,
  nb,
  add_format 
)

Definition at line 540 of file avfiltergraph.c.

Referenced by reduce_formats_on_filter().

Function Documentation

static int ff_avfilter_graph_config_pointers ( AVFilterGraph graph,
AVClass log_ctx 
)
static

Definition at line 964 of file avfiltergraph.c.

Referenced by avfilter_graph_config().

void ff_avfilter_graph_update_heap ( AVFilterGraph graph,
AVFilterLink link 
)

Update the position of a link in the age heap.

Definition at line 1159 of file avfiltergraph.c.

Referenced by ff_update_link_current_pts().

void ff_filter_graph_remove_filter ( AVFilterGraph graph,
AVFilterContext filter 
)

Remove a filter from a graph;.

Definition at line 62 of file avfiltergraph.c.

Referenced by avfilter_free().

static int filter_query_formats ( AVFilterContext ctx)
static

Definition at line 257 of file avfiltergraph.c.

Referenced by query_formats().

static int formats_declared ( AVFilterContext f)
static

Definition at line 296 of file avfiltergraph.c.

Referenced by query_formats().

static int graph_check_validity ( AVFilterGraph graph,
AVClass log_ctx 
)
static

Check for the validity of graph.

A graph is considered valid if all its input and output pads are connected.

Returns
0 in case of success, a negative value otherwise

Definition at line 176 of file avfiltergraph.c.

Referenced by avfilter_graph_config().

static int graph_config_formats ( AVFilterGraph graph,
AVClass log_ctx 
)
static

Configure the formats of all the links in the graph.

Definition at line 937 of file avfiltergraph.c.

Referenced by avfilter_graph_config().

static int graph_config_links ( AVFilterGraph graph,
AVClass log_ctx 
)
static

Configure all the links of graphctx.

Returns
0 in case of success, a negative value otherwise

Definition at line 214 of file avfiltergraph.c.

Referenced by avfilter_graph_config().

static int graph_insert_fifos ( AVFilterGraph graph,
AVClass log_ctx 
)
static

Definition at line 1006 of file avfiltergraph.c.

Referenced by avfilter_graph_config().

static void heap_bubble_down ( AVFilterGraph graph,
AVFilterLink link,
int  index 
)
static
static void heap_bubble_up ( AVFilterGraph graph,
AVFilterLink link,
int  index 
)
static

Definition at line 1120 of file avfiltergraph.c.

Referenced by ff_avfilter_graph_update_heap().

static int pick_format ( AVFilterLink link,
AVFilterLink ref 
)
static

Definition at line 482 of file avfiltergraph.c.

Referenced by pick_formats().

static int pick_formats ( AVFilterGraph graph)
static

Definition at line 882 of file avfiltergraph.c.

Referenced by graph_config_formats().

static int query_formats ( AVFilterGraph graph,
AVClass log_ctx 
)
static

Definition at line 319 of file avfiltergraph.c.

Referenced by graph_config_formats().

static void reduce_formats ( AVFilterGraph graph)
static

Definition at line 623 of file avfiltergraph.c.

Referenced by graph_config_formats().

static int reduce_formats_on_filter ( AVFilterContext filter)
static

Definition at line 575 of file avfiltergraph.c.

Referenced by reduce_formats().

static void sanitize_channel_layouts ( void log,
AVFilterChannelLayouts l 
)
static

Definition at line 242 of file avfiltergraph.c.

Referenced by filter_query_formats().

static void swap_channel_layouts ( AVFilterGraph graph)
static

Definition at line 805 of file avfiltergraph.c.

Referenced by graph_config_formats().

static void swap_channel_layouts_on_filter ( AVFilterContext filter)
static

Definition at line 716 of file avfiltergraph.c.

Referenced by swap_channel_layouts().

static void swap_sample_fmts ( AVFilterGraph graph)
static

Definition at line 873 of file avfiltergraph.c.

Referenced by graph_config_formats().

static void swap_sample_fmts_on_filter ( AVFilterContext filter)
static

Definition at line 813 of file avfiltergraph.c.

Referenced by swap_sample_fmts().

static void swap_samplerates ( AVFilterGraph graph)
static

Definition at line 674 of file avfiltergraph.c.

Referenced by graph_config_formats().

static void swap_samplerates_on_filter ( AVFilterContext filter)
static

Definition at line 635 of file avfiltergraph.c.

Referenced by swap_samplerates().

Variable Documentation

const uint64_t ch_subst[][2]
static
Initial value:
= {
{ CH_CENTER_PAIR, CH_WIDE_PAIR },
{ CH_CENTER_PAIR, AV_CH_FRONT_CENTER },
{ CH_WIDE_PAIR, CH_FRONT_PAIR },
{ CH_WIDE_PAIR, CH_CENTER_PAIR },
{ CH_WIDE_PAIR, AV_CH_FRONT_CENTER },
{ AV_CH_FRONT_CENTER, CH_FRONT_PAIR },
{ AV_CH_FRONT_CENTER, CH_CENTER_PAIR },
{ AV_CH_FRONT_CENTER, CH_WIDE_PAIR },
{ CH_BACK_PAIR, CH_DIRECT_PAIR },
{ CH_BACK_PAIR, AV_CH_BACK_CENTER },
{ AV_CH_BACK_CENTER, CH_BACK_PAIR },
{ AV_CH_BACK_CENTER, CH_DIRECT_PAIR },
{ AV_CH_BACK_CENTER, CH_SIDE_PAIR },
}
#define CH_DIRECT_PAIR
#define CH_CENTER_PAIR
#define AV_CH_FRONT_CENTER
#define CH_BACK_PAIR
#define AV_CH_BACK_CENTER
#define CH_FRONT_PAIR
#define CH_SIDE_PAIR
#define CH_WIDE_PAIR

Definition at line 692 of file avfiltergraph.c.

Referenced by swap_channel_layouts_on_filter().

const AVClass filtergraph_class
static
Initial value:
= {
.class_name = "AVFilterGraph",
.item_name = av_default_item_name,
.option = options,
}
av_default_item_name
static const AVOption options[]
Definition: avfiltergraph.c:38
LIBAVUTIL_VERSION_INT
Definition: eval.c:55

Definition at line 45 of file avfiltergraph.c.

Referenced by avfilter_graph_alloc().

const AVOption options[]
static
Initial value:
={
{"scale_sws_opts" , "default scale filter options" , OFFSET(scale_sws_opts) , AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, 0 },
{"aresample_swr_opts" , "default aresample filter options" , OFFSET(aresample_swr_opts) , AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, 0 },
{0}
}
#define OFFSET(x)
Definition: avfiltergraph.c:36
NULL
Definition: eval.c:55

Definition at line 38 of file avfiltergraph.c.