Go to the documentation of this file.
32 #define OFFSET(x) offsetof(AVBitStreamFilterGraph, x)
33 #define FLAGS (AV_OPT_FLAG_BSF_PARAM|AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_VIDEO_PARAM)
35 {
"max_buffered_packets" ,
"maximum number of buffered packets allowed",
OFFSET(max_buffered_packets),
73 for (j = 0; j<
filter->nb_outputs; j++)
186 for (j = 0; j <
filt->nb_inputs; j++) {
187 if (!
filt->inputs[j] || !
filt->inputs[j]->src) {
188 pad = &
filt->input_pads[j];
190 "Input pad \"%s\" of the filter instance \"%s\" of %s not connected to any source\n",
196 for (j = 0; j <
filt->nb_outputs; j++) {
197 if (!
filt->outputs[j] || !
filt->outputs[j]->dst) {
198 pad = &
filt->output_pads[j];
200 "Output pad \"%s\" of the filter instance \"%s\" of %s not connected to any destination\n",
223 if (!
filt->nb_outputs) {
235 int sink_links_count = 0, source_links_count = 0, n = 0;
241 for (j = 0; j <
f->nb_inputs; j++) {
244 for (j = 0; j <
f->nb_outputs; j++) {
247 if (!
f->nb_outputs) {
248 if (
f->nb_inputs > INT_MAX - sink_links_count)
250 sink_links_count +=
f->nb_inputs;
252 if (!
f->nb_inputs && !strcmp(
f->filter->name,
"source")) {
253 if (
f->nb_outputs > INT_MAX - source_links_count)
255 source_links_count +=
f->nb_outputs;
258 sinks =
av_calloc(sink_links_count,
sizeof(*sinks));
263 if (!
f->nb_outputs) {
264 for (j = 0; j <
f->nb_inputs; j++) {
280 if (!
f->nb_inputs && !strcmp(
f->filter->name,
"source")) {
281 for (j = 0; j <
f->nb_outputs; j++) {
318 int parent = (
index - 1) >> 1;
337 int child = 2 *
index + 1;
341 links[child + 1]->l.current_pts_us <
links[child]->l.current_pts_us)
386 int nb_requests, nb_requests_max = -1;
397 if (nb_requests > nb_requests_max) {
398 nb_requests_max = nb_requests;
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default minimum maximum flags name is the option name
void av_opt_set_defaults(void *s)
Set the values of all AVOption fields to their default values.
static const av_always_inline FFBitStreamFilter * ff_bsf(const AVBitStreamFilter *bsf)
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame 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 all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
static const FFBitStreamFilterGraph * cffbsffiltergraph(const AVBitStreamFilterGraph *graph)
static int graph_config_links(AVBitStreamFilterGraph *graph, void *log_ctx)
Configure all the links of graphctx.
A filter pad used for either input or output.
unsigned ready
Ready status of the filter.
struct BitStreamFilterLinkInternal ** source_links
struct BitStreamFilterLinkInternal ** sink_links
Note except for filters that can have queued frames and sources
static void heap_bubble_up(FFBitStreamFilterGraph *graph, BitStreamFilterLinkInternal *li, int index)
void(* filter)(uint8_t *src, int stride, int qscale)
static void heap_bubble_down(FFBitStreamFilterGraph *graph, BitStreamFilterLinkInternal *li, int index)
void av_opt_free(void *obj)
Free all allocated objects in obj.
void ff_bsf_free(AVBitStreamFilterContext *ctx)
Free a filter context.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
int av_bsf_graph_create_filter(AVBitStreamFilterContext **filt_ctx, const AVBitStreamFilter *filt, const char *name, AVDictionary **options, AVBitStreamFilterGraph *graph_ctx)
A convenience wrapper that allocates and initializes a filter in a single step.
int ff_bsf_config_links(AVBitStreamFilterContext *filter)
void * av_realloc_array(void *ptr, size_t nmemb, size_t size)
#define filters(fmt, type, inverse, clp, inverset, clip, one, clip_fn, packed)
#define av_assert0(cond)
assert() equivalent, that is always enabled.
int64_t current_pts_us
Current timestamp of the link, as defined by the most recent packet(s), in AV_TIME_BASE units.
unsigned max_buffered_packets
Sets the maximum number of buffered packets in the filtergraph combined.
AVBitStreamFilterContext p
The public AVBitStreamFilterContext.
#define LIBAVUTIL_VERSION_INT
int av_bsf_graph_source_needs_input(const AVBitStreamFilterGraph *graph)
Get the index of the source filter in the filtergraph that reported needing input more urgently.
Describe the class of an AVClass context structure.
int ff_bsf_alloc(const AVBitStreamFilter *filter, const char *inst_name, AVBitStreamFilterContext **pctx)
Allocate a new filter context and return it.
AVBitStreamFilterContext ** filters
filter_frame For filters that do not use the activate() callback
const char * av_default_item_name(void *ptr)
Return the context name.
@ AV_OPT_TYPE_UINT
Underlying C type is unsigned int.
int age_index
Index in the age array.
AVBitStreamFilterGraph * av_bsf_graph_alloc(void)
Allocate a filter graph.
static int graph_config_pointers(AVBitStreamFilterGraph *graph, void *log_ctx)
char * name
name of this filter instance
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a source
int ff_bsf_activate(AVBitStreamFilterContext *ctx)
static BitStreamFilterLinkInternal * ff_link_internal(AVBitStreamFilterLink *link)
#define i(width, name, range_min, range_max)
int av_bsf_graph_alloc_filter(AVBitStreamFilterContext **filt_ctx, const AVBitStreamFilter *filter, const char *name, AVBitStreamFilterGraph *graph)
Create a new filter instance in a filter graph.
int av_bsf_source_get_status(AVBitStreamFilterContext *ctx)
Returns 0 or a negative AVERROR code.
unsigned ff_bsf_source_get_nb_failed_requests(const AVBitStreamFilterContext *src)
Get the number of failed requests.
void ff_bsf_graph_update_heap(AVBitStreamFilterGraph *graph, BitStreamFilterLinkInternal *li)
static int graph_check_validity(AVBitStreamFilterGraph *graph, void *log_ctx)
Check for the validity of graph.
AVBitStreamFilterGraph p
The public AVBitStreamFilterGraph.
int av_bsf_graph_config(AVBitStreamFilterGraph *graphctx, void *log_ctx)
Check validity and configure all the links and formats in the graph.
static const AVOption filtergraph_options[]
void av_bsf_graph_free(AVBitStreamFilterGraph **graphp)
Free a graph, destroy its links, and set *graph to NULL.
static const int8_t filt[NUMTAPS *2]
void * av_calloc(size_t nmemb, size_t size)
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output links
#define FFSWAP(type, a, b)
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
int ff_bsf_graph_run_once(AVBitStreamFilterGraph *graph)
Run one round of processing on a filter graph.
const char * name
Pad name.
Link properties exposed to filter code, but not external callers.
int av_bsf_init_dict(AVBitStreamFilterContext *ctx, AVDictionary **options)
Initialize a filter with the supplied dictionary of options.
@ AV_CLASS_CATEGORY_BITSTREAM_FILTER
void ff_bsf_graph_remove_filter(AVBitStreamFilterGraph *graph, AVBitStreamFilterContext *filter)
Remove a filter from a graph;.
static FFBitStreamFilterGraph * ffbsffiltergraph(AVBitStreamFilterGraph *graph)
static const AVClass filtergraph_class
AVBitStreamFilterContext * av_bsf_graph_get_filter(AVBitStreamFilterGraph *graph, const char *name)
Get a filter instance identified by instance name from graph.
static FFBitStreamFilterContext * ffbsfctx(AVBitStreamFilterContext *ctx)