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),
41 .class_name =
"AVBitStreamFilterGraph",
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++) {
275 sources =
av_calloc(source_links_count,
sizeof(*sources));
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;
321 links[
index] = links[parent];
337 int child = 2 *
index + 1;
345 links[
index] = links[child];
386 int nb_requests, nb_requests_max = -1;
397 if (nb_requests > nb_requests_max) {
398 nb_requests_max = nb_requests;
#define filters(fmt, type, inverse, clp, inverset, clip, one, clip_fn, packed)
static const int8_t filt[NUMTAPS *2]
simple assert() macros that are a bit more flexible than ISO C assert().
#define av_assert0(cond)
assert() equivalent, that is always enabled.
int ff_bsf_config_links(AVBitStreamFilterContext *filter)
void ff_bsf_free(AVBitStreamFilterContext *ctx)
Free a filter context.
int ff_bsf_alloc(const AVBitStreamFilter *filter, const char *inst_name, AVBitStreamFilterContext **pctx)
Allocate a new filter context and return it.
int ff_bsf_activate(AVBitStreamFilterContext *ctx)
static BitStreamFilterLinkInternal * ff_link_internal(AVBitStreamFilterLink *link)
static FFBitStreamFilterGraph * ffbsffiltergraph(AVBitStreamFilterGraph *graph)
static FFBitStreamFilterContext * ffbsfctx(AVBitStreamFilterContext *ctx)
static const FFBitStreamFilterGraph * cffbsffiltergraph(const AVBitStreamFilterGraph *graph)
static av_always_inline const FFBitStreamFilter * ff_bsf(const AVBitStreamFilter *bsf)
static void heap_bubble_down(FFBitStreamFilterGraph *graph, BitStreamFilterLinkInternal *li, int index)
int ff_bsf_graph_run_once(AVBitStreamFilterGraph *graph)
Run one round of processing on a filter graph.
static int graph_config_pointers(AVBitStreamFilterGraph *graph, void *log_ctx)
void ff_bsf_graph_remove_filter(AVBitStreamFilterGraph *graph, AVBitStreamFilterContext *filter)
Remove a filter from a graph;.
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.
static const AVClass filtergraph_class
static int graph_config_links(AVBitStreamFilterGraph *graph, void *log_ctx)
Configure all the links of graphctx.
static void heap_bubble_up(FFBitStreamFilterGraph *graph, BitStreamFilterLinkInternal *li, int index)
static const AVOption filtergraph_options[]
#define i(width, name, range_min, range_max)
@ AV_OPT_TYPE_UINT
Underlying C type is unsigned int.
int av_bsf_source_get_status(AVBitStreamFilterContext *ctx)
Returns 0 or a negative AVERROR code.
int av_bsf_init_dict(AVBitStreamFilterContext *ctx, AVDictionary **options)
Initialize a filter with the supplied dictionary of options.
AVBitStreamFilterGraph * av_bsf_graph_alloc(void)
Allocate a filter graph.
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.
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 av_bsf_graph_config(AVBitStreamFilterGraph *graphctx, void *log_ctx)
Check validity and configure all the links and formats in the graph.
void av_bsf_graph_free(AVBitStreamFilterGraph **graphp)
Free a graph, destroy its links, and set *graph to NULL.
AVBitStreamFilterContext * av_bsf_graph_get_filter(AVBitStreamFilterGraph *graph, const char *name)
Get a filter instance identified by instance name from graph.
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.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
const char * av_default_item_name(void *ptr)
Return the context name.
void * av_realloc_array(void *ptr, size_t nmemb, size_t size)
#define LIBAVUTIL_VERSION_INT
void av_opt_free(void *obj)
Free all allocated objects in obj.
void av_opt_set_defaults(void *s)
Set the values of all AVOption fields to their default values.
static int activate(AVBitStreamFilterContext *ctx)
unsigned ff_bsf_source_get_nb_failed_requests(const AVBitStreamFilterContext *src)
Get the number of failed requests.
@ AV_CLASS_CATEGORY_BITSTREAM_FILTER
#define FFSWAP(type, a, b)
void * av_calloc(size_t nmemb, size_t size)
Memory handling functions.
char * name
name of this filter instance
unsigned max_buffered_packets
Sets the maximum number of buffered packets in the filtergraph combined.
AVBitStreamFilterContext ** filters
Link properties exposed to filter code, but not external callers.
int64_t current_pts_us
Current timestamp of the link, as defined by the most recent packet(s), in AV_TIME_BASE units.
AVBitStreamFilterContext * src
source filter
A filter pad used for either input or output.
const char * name
Pad name.
Describe the class of an AVClass context structure.
int age_index
Index in the age array.
AVBitStreamFilterContext p
The public AVBitStreamFilterContext.
unsigned ready
Ready status of the filter.
AVBitStreamFilterGraph p
The public AVBitStreamFilterGraph.
struct BitStreamFilterLinkInternal ** source_links
struct BitStreamFilterLinkInternal ** sink_links
void(* filter)(uint8_t *src, ptrdiff_t stride, int qscale)