Go to the documentation of this file.
36 #define FF_INTERNAL_FIELDS 1
49 "ref[%p buf:%p data:%p linesize[%d, %d, %d, %d] pts:%"PRId64
" pos:%"PRId64,
51 ref->linesize[0],
ref->linesize[1],
ref->linesize[2],
ref->linesize[3],
55 ff_tlog(
ctx,
" a:%d/%d s:%dx%d i:%c iskey:%d type:%c",
56 ref->sample_aspect_ratio.num,
ref->sample_aspect_ratio.den,
58 !
ref->interlaced_frame ?
'P' :
59 ref->top_field_first ?
'T' :
'B',
63 if (
ref->nb_samples) {
96 unsigned idx = *count;
104 if (!newpads || !newlinks) {
111 (*links)[idx] =
NULL;
120 return append_pad(&
f->nb_inputs, &
f->input_pads, &
f->inputs, p);
131 return append_pad(&
f->nb_outputs, &
f->output_pads, &
f->outputs, p);
149 if (
src->nb_outputs <= srcpad || dst->
nb_inputs <= dstpad ||
150 src->outputs[srcpad] || dst->
inputs[dstpad])
155 "Media type mismatch between the '%s' filter output pad %d (%s) and the '%s' filter input pad %d (%s)\n",
169 link->srcpad = &
src->output_pads[srcpad];
171 link->type =
src->output_pads[srcpad].type;
205 filter->outputs[
i]->frame_blocked_in = 0;
216 link->frame_wanted_out = 0;
217 link->frame_blocked_in = 0;
234 unsigned filt_srcpad_idx,
unsigned filt_dstpad_idx)
237 unsigned dstpad_idx =
link->dstpad -
link->dst->input_pads;
240 "between the filter '%s' and the filter '%s'\n",
243 link->dst->inputs[dstpad_idx] =
NULL;
246 link->dst->inputs[dstpad_idx] =
link;
252 link->dstpad = &
filt->input_pads[filt_srcpad_idx];
253 filt->inputs[filt_srcpad_idx] =
link;
257 if (
link->outcfg.formats)
259 &
filt->outputs[filt_dstpad_idx]->outcfg.formats);
260 if (
link->outcfg.samplerates)
262 &
filt->outputs[filt_dstpad_idx]->outcfg.samplerates);
263 if (
link->outcfg.channel_layouts)
265 &
filt->outputs[filt_dstpad_idx]->outcfg.channel_layouts);
276 for (
i = 0;
i <
filter->nb_inputs;
i ++) {
283 "Not all input and output are properly linked (%d).\n",
i);
291 switch (
link->init_state) {
294 case AVLINK_STARTINIT:
298 link->init_state = AVLINK_STARTINIT;
303 if (!(config_link =
link->srcpad->config_props)) {
304 if (
link->src->nb_inputs != 1) {
306 "with more than one input "
307 "must set config_props() "
308 "callbacks on all outputs\n");
311 }
else if ((
ret = config_link(
link)) < 0) {
313 "Failed to configure output pad on %s\n",
318 switch (
link->type) {
328 if (!
link->frame_rate.num && !
link->frame_rate.den)
336 "Video source filters must set their output link's "
337 "width and height\n");
355 "should not be set by non-hwframe-aware filter");
361 if ((config_link =
link->dstpad->config_props))
362 if ((
ret = config_link(
link)) < 0) {
364 "Failed to configure input pad on %s\n",
369 link->init_state = AVLINK_INIT;
380 "link[%p s:%dx%d fmt:%s %s->%s]%s",
383 link->src ?
link->src->filter->name :
"",
384 link->dst ?
link->dst->filter->name :
"",
391 "link[%p r:%d cl:%s fmt:%s %s->%s]%s",
394 link->src ?
link->src->filter->name :
"",
395 link->dst ?
link->dst->filter->name :
"",
405 if (
link->status_out)
406 return link->status_out;
407 if (
link->status_in) {
417 return link->status_out;
420 link->frame_wanted_out = 1;
428 int64_t
r = INT64_MAX;
430 for (
i = 0;
i <
ctx->nb_inputs;
i++)
436 for (
i = 0;
i <
ctx->nb_inputs;
i++)
449 link->frame_blocked_in = 1;
450 if (
link->srcpad->request_frame)
452 else if (
link->src->inputs[0])
489 "with filter '%s'\n",
ctx->filter->name);
497 if (!
ctx->var_values) {
499 if (!
ctx->var_values) {
509 "Error when evaluating the expression '%s' for enable\n",
517 ctx->enable_str = expr_dup;
528 if (
link->graph &&
link->age_index >= 0)
534 if(!strcmp(cmd,
"ping")){
535 char local_res[256] = {0};
539 res_len =
sizeof(local_res);
542 if (res == local_res)
545 }
else if(!strcmp(cmd,
"enable")) {
547 }
else if(
filter->filter->process_command) {
563 if (pads ==
filter->inputs)
565 if (pads ==
filter->outputs)
566 return filter->nb_outputs;
569 av_assert0(!
"AVFilterPad list not from a filter");
576 return is_output ?
filter->nb_outputs :
filter->nb_inputs;
582 return ctx->name ?
ctx->name :
ctx->filter->name;
588 if (!prev &&
ctx->filter &&
ctx->filter->priv_class &&
ctx->priv)
599 return f->priv_class;
604 #define OFFSET(x) offsetof(AVFilterContext, x)
605 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM
606 #define TFLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
613 { .i64 = 0 }, 0, INT_MAX,
FLAGS },
614 {
"extra_hw_frames",
"Number of extra hardware frames to allocate for the user",
630 int *
ret,
int nb_jobs)
634 for (
i = 0;
i < nb_jobs;
i++) {
680 if (
ret->nb_inputs ) {
682 if (!
ret->input_pads)
690 if (
ret->nb_outputs) {
692 if (!
ret->output_pads)
747 if (
filter->filter->uninit)
750 for (
i = 0;
i <
filter->nb_inputs;
i++) {
755 for (
i = 0;
i <
filter->nb_outputs;
i++) {
761 if (
filter->filter->priv_class)
772 while(
filter->command_queue){
785 if (
ctx->nb_threads > 0)
786 return FFMIN(
ctx->nb_threads,
ctx->graph->nb_threads);
787 return ctx->graph->nb_threads;
803 const char *shorthand =
NULL;
815 &parsed_key, &
value);
864 const char *
arg,
char *res,
int res_len,
int flags)
868 if (!
ctx->filter->priv_class)
888 ctx->graph->internal->thread_execute) {
890 ctx->internal->execute =
ctx->graph->internal->thread_execute;
892 ctx->thread_type = 0;
895 if (
ctx->filter->priv_class) {
903 if (
ctx->filter->init)
905 else if (
ctx->filter->init_dict)
910 if (
ctx->enable_str) {
926 if (!
filter->filter->priv_class) {
928 "options, but options were provided: %s.\n", args);
955 return pads[pad_idx].
name;
960 return pads[pad_idx].
type;
991 link->frame_count_out++;
1006 if (strcmp(
link->dst->filter->name,
"buffersink") &&
1007 strcmp(
link->dst->filter->name,
"format") &&
1008 strcmp(
link->dst->filter->name,
"idet") &&
1009 strcmp(
link->dst->filter->name,
"null") &&
1010 strcmp(
link->dst->filter->name,
"scale")) {
1030 link->frame_blocked_in =
link->frame_wanted_out = 0;
1031 link->frame_count_in++;
1032 link->sample_count_in +=
frame->nb_samples;
1058 unsigned nb_samples, nb_frames,
i, p;
1072 if (nb_samples +
frame->nb_samples >
max) {
1073 if (nb_samples <
min)
1077 nb_samples +=
frame->nb_samples;
1094 for (
i = 0;
i < nb_frames;
i++) {
1098 p +=
frame->nb_samples;
1101 if (p < nb_samples) {
1102 unsigned n = nb_samples - p;
1133 link->frame_count_out--;
1135 if (ret < 0 && ret != link->status_out) {
1147 unsigned out = 0, progress = 0;
1151 if (!
filter->nb_outputs) {
1155 while (!in->status_out) {
1181 for (
i = 0;
i <
filter->nb_inputs;
i++) {
1186 for (
i = 0;
i <
filter->nb_inputs;
i++) {
1187 if (
filter->inputs[
i]->status_in && !
filter->inputs[
i]->status_out) {
1192 for (
i = 0;
i <
filter->nb_outputs;
i++) {
1193 if (
filter->outputs[
i]->frame_wanted_out &&
1194 !
filter->outputs[
i]->frame_blocked_in) {
1339 filter->filter->activate));
1350 *rpts =
link->current_pts;
1352 return *rstatus = 0;
1353 if (
link->status_out)
1354 return *rstatus =
link->status_out;
1355 if (!
link->status_in)
1356 return *rstatus = 0;
1357 *rstatus =
link->status_out =
link->status_in;
1359 *rpts =
link->current_pts;
1390 link->frame_count_out++;
1391 link->sample_count_out +=
frame->nb_samples;
1402 if (
link->fifo.samples_skipped) {
1423 if (
link->status_in)
1448 switch (
link->type) {
1484 "Processing command time:%f command:%s arg:%s\n",
1488 cmd=
link->dst->command_queue;
1515 link->frame_wanted_out = 1;
1521 if (
link->status_out)
1523 link->frame_wanted_out = 0;
1524 link->frame_blocked_in = 0;
1530 if (!
link->status_in)
1536 return link->status_in;
1553 int default_pool_size)
1562 if (
frames->initial_pool_size == 0) {
1567 frames->initial_pool_size = default_pool_size;
static void error(const char *err)
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.
int(* func)(AVBPrint *dst, const char *in, const char *arg)
AVFrame * ff_get_audio_buffer(AVFilterLink *link, int nb_samples)
Request an audio samples buffer with a specific set of permissions.
#define AV_LOG_WARNING
Something somehow does not look correct.
they must not be accessed directly The fifo field contains the frames that are queued in the input for processing by the filter The status_in and status_out fields contains the queued status(EOF or error) of the link
unsigned avfilter_filter_pad_count(const AVFilter *filter, int is_output)
Get the number of elements in an AVFilter's inputs or outputs array.
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 FilteringContext * filter_ctx
static const AVClass * filter_child_class_iterate(void **iter)
const char * avfilter_pad_get_name(const AVFilterPad *pads, int pad_idx)
Get the name of an AVFilterPad.
void av_opt_set_defaults(void *s)
Set the values of all AVOption fields to their default values.
#define FF_FILTER_FLAG_HWFRAME_AWARE
The filter is aware of hardware frames, and any hardware frame context should not be automatically pr...
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
int() avfilter_action_func(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
A function pointer passed to the AVFilterGraph::execute callback to be executed multiple times,...
#define AVERROR_EOF
End of file.
uint8_t * data
The data buffer.
double * var_values
variable values for the enable expression
#define AV_TIME_BASE_Q
Internal time base represented as fractional value.
The exact code depends on how similar the blocks are and how related they are to the and needs to apply these operations to the correct inlink or outlink if there are several Macros are available to factor that when no extra processing is inlink
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
int is_disabled
the enabled state from the last expression evaluation
int ff_filter_activate(AVFilterContext *filter)
This structure describes decoded (raw) audio or video data.
static void free_link(AVFilterLink *link)
void ff_command_queue_pop(AVFilterContext *filter)
#define AV_DICT_APPEND
If the entry already exists, append to it.
static int process_options(AVFilterContext *ctx, AVDictionary **options, const char *args)
int ff_request_frame(AVFilterLink *link)
Request an input frame from the filter at the other end of the link.
#define AV_OPT_FLAG_RUNTIME_PARAM
a generic parameter which can be set by the user at runtime
#define AV_DICT_IGNORE_SUFFIX
Return first entry in a dictionary whose first part corresponds to the search key,...
#define AV_LOG_VERBOSE
Detailed information.
filter_frame For filters that do not use the this method is called when a frame is pushed to the filter s input It can be called at any time except in a reentrant way If the input frame is enough to produce then the filter should push the output frames on the output link immediately As an exception to the previous rule if the input frame is enough to produce several output frames then the filter needs output only at least one per link The additional frames can be left buffered in the filter
void ff_framequeue_init(FFFrameQueue *fq, FFFrameQueueGlobal *fqg)
Init a frame queue and attach it to a global structure.
AVBufferRef * av_buffer_ref(const AVBufferRef *buf)
Create a new reference to an AVBuffer.
static const char * default_filter_name(void *filter_ctx)
int nb_channels
Number of channels in this layout.
A link between two filters.
#define AV_OPT_FLAG_FILTERING_PARAM
a generic parameter which can be set by the user for filtering
size_t av_strlcatf(char *dst, size_t size, const char *fmt,...)
AVFilterContext * ff_filter_alloc(const AVFilter *filter, const char *inst_name)
Allocate a new filter context and return it.
int ff_inoutlink_check_flow(AVFilterLink *inlink, AVFilterLink *outlink)
Check for flow control between input and output.
static int forward_status_change(AVFilterContext *filter, AVFilterLink *in)
int av_expr_parse(AVExpr **expr, const char *s, const char *const *const_names, const char *const *func1_names, double(*const *funcs1)(void *, double), const char *const *func2_names, double(*const *funcs2)(void *, double, double), int log_offset, void *log_ctx)
Parse an expression.
void * av_memdup(const void *p, size_t size)
Duplicate a buffer with av_malloc().
int ff_inlink_consume_frame(AVFilterLink *link, AVFrame **rframe)
Take a frame from the link's FIFO and update the link's stats.
void ff_framequeue_skip_samples(FFFrameQueue *fq, size_t samples, AVRational time_base)
Skip samples from the first frame in the queue.
int ff_append_inpad(AVFilterContext *f, AVFilterPad *p)
Append a new input/output pad to the filter's list of such pads.
struct AVFilterGraph * graph
filtergraph this filter belongs to
int offset
The offset relative to the context structure where the option value is stored.
char * enable_str
enable expression string
if it could not because there are no more frames
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.
const AVFilter * av_filter_iterate(void **opaque)
Iterate over all registered filters.
int extra_hw_frames
Sets the number of extra hardware frames which the filter will allocate on its output links for use i...
int avfilter_config_links(AVFilterContext *filter)
Negotiate the media format, dimensions, etc of all inputs to a filter.
#define AVERROR_OPTION_NOT_FOUND
Option not found.
AVChannelLayout ch_layout
Channel layout of the audio data.
#define AVFILTER_THREAD_SLICE
Process multiple parts of the frame concurrently.
int av_opt_set(void *obj, const char *name, const char *val, int search_flags)
void av_expr_free(AVExpr *e)
Free a parsed expression previously created with av_expr_parse().
A filter pad used for either input or output.
AVFilterPad * input_pads
array of input pads
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
int ff_inlink_check_available_samples(AVFilterLink *link, unsigned min)
Test if enough samples are available on the link.
AVDictionaryEntry * av_dict_get(const AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
Get a dictionary entry with matching key.
int av_opt_set_dict(void *obj, AVDictionary **options)
Set all the options from a given dictionary on an object.
static int ff_request_frame_to_filter(AVFilterLink *link)
void ff_avfilter_link_set_out_status(AVFilterLink *link, int status, int64_t pts)
Set the status field of a link from the destination filter.
void ff_inlink_request_frame(AVFilterLink *link)
Mark that a frame is wanted on the link.
void * av_realloc_array(void *ptr, size_t nmemb, size_t size)
int flags
Flags modifying the (de)muxer behaviour.
int avfilter_process_command(AVFilterContext *filter, const char *cmd, const char *arg, char *res, int res_len, int flags)
Make the filter instance process a command.
static double av_q2d(AVRational a)
Convert an AVRational to a double.
#define av_assert0(cond)
assert() equivalent, that is always enabled.
int flags
A combination of AVFILTER_FLAG_*.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
double av_expr_eval(AVExpr *e, const double *const_values, void *opaque)
Evaluate a previously parsed expression.
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
const char * av_get_sample_fmt_name(enum AVSampleFormat sample_fmt)
Return the name of sample_fmt, or NULL if sample_fmt is not recognized.
static int ff_filter_frame_to_filter(AVFilterLink *link)
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 link
AVFrame * ff_framequeue_take(FFFrameQueue *fq)
Take the first frame in the queue.
int ff_inlink_make_frame_writable(AVFilterLink *link, AVFrame **rframe)
Make sure a frame is writable.
const AVOption * av_opt_find(void *obj, const char *name, const char *unit, int opt_flags, int search_flags)
Look for an option in an object.
AVFrame * ff_inlink_peek_frame(AVFilterLink *link, size_t idx)
Access a frame in the link fifo without consuming it.
#define LIBAVUTIL_VERSION_INT
static void filter_unblock(AVFilterContext *filter)
Clear frame_blocked_in on all outputs.
Describe the class of an AVClass context structure.
static __device__ float fabs(float a)
int ff_inlink_consume_samples(AVFilterLink *link, unsigned min, unsigned max, AVFrame **rframe)
Take samples from the link's FIFO and update the link's stats.
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
void av_buffer_unref(AVBufferRef **buf)
Free a given reference and automatically free the buffer if there are no more references to it.
int ff_framequeue_add(FFFrameQueue *fq, AVFrame *frame)
Add a frame.
void ff_framequeue_free(FFFrameQueue *fq)
Free the queue and all queued frames.
Rational number (pair of numerator and denominator).
int ff_append_inpad_free_name(AVFilterContext *f, AVFilterPad *p)
AVFilterLink ** inputs
array of pointers to input links
char * name
name of this filter instance
int av_channel_layout_compare(const AVChannelLayout *chl, const AVChannelLayout *chl1)
Check whether two channel layouts are semantically the same, i.e.
static int take_samples(AVFilterLink *link, unsigned min, unsigned max, AVFrame **rframe)
int(* filter_frame)(AVFilterLink *link, AVFrame *frame)
Filtering callback.
void av_opt_free(void *obj)
Free all allocated objects in obj.
static int filter_frame(DBEDecodeContext *s, AVFrame *frame)
static const AVClass avfilter_class
int ff_inlink_acknowledge_status(AVFilterLink *link, int *rstatus, int64_t *rpts)
Test and acknowledge the change of status on the link.
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
size_t ff_inlink_queued_frames(AVFilterLink *link)
Get the number of frames available on the link.
static void tlog_ref(void *ctx, AVFrame *ref, int end)
static void consume_update(AVFilterLink *link, const AVFrame *frame)
#define AV_OPT_SEARCH_FAKE_OBJ
The obj passed to av_opt_find() is fake – only a double pointer to AVClass instead of a required poin...
@ AV_CLASS_CATEGORY_FILTER
void av_channel_layout_uninit(AVChannelLayout *channel_layout)
Free any allocated data in the channel layout and reset the channel count to 0.
void ff_frame_pool_uninit(FFFramePool **pool)
Deallocate the frame pool.
const OptionDef options[]
unsigned nb_inputs
number of input pads
static int default_execute(AVFilterContext *ctx, avfilter_action_func *func, void *arg, int *ret, int nb_jobs)
static int64_t guess_status_pts(AVFilterContext *ctx, int status, AVRational link_time_base)
void ff_update_link_current_pts(AVFilterLink *link, int64_t pts)
void ff_inlink_set_status(AVFilterLink *link, int status)
Set the status on an input link.
int ff_inlink_check_available_frame(AVFilterLink *link)
Test if a frame is available on the link.
int ff_inlink_evaluate_timeline_at_frame(AVFilterLink *link, const AVFrame *frame)
Evaluate the timeline expression of the link for the time and properties of the frame.
#define FF_TPRINTF_START(ctx, func)
int av_frame_copy(AVFrame *dst, const AVFrame *src)
Copy the frame data from src to dst.
#define av_err2str(errnum)
Convenience macro, the return value should be used only directly in function arguments but never stan...
int sample_rate
Sample rate of the audio data.
int avfilter_link(AVFilterContext *src, unsigned srcpad, AVFilterContext *dst, unsigned dstpad)
Link two filters together.
#define AV_NOPTS_VALUE
Undefined timestamp value.
static int set_enable_expr(AVFilterContext *ctx, const char *expr)
AVRational time_base
Time base for the timestamps in this frame.
int av_frame_is_writable(AVFrame *frame)
Check if the frame data is writable.
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames,...
int ff_filter_process_command(AVFilterContext *ctx, const char *cmd, const char *arg, char *res, int res_len, int flags)
Generic processing of user supplied commands that are set in the same way as the filter options.
void avfilter_link_free(AVFilterLink **link)
Free the link in *link, and set its pointer to NULL.
#define AV_OPT_SEARCH_CHILDREN
Search in possible children of the given object first.
const AVOption * av_opt_find2(void *obj, const char *name, const char *unit, int opt_flags, int search_flags, void **target_obj)
Look for an option in an object.
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 offset
int av_opt_set_dict2(void *obj, AVDictionary **options, int search_flags)
Set all the options from a given dictionary on an object.
void av_dict_free(AVDictionary **pm)
Free all the memory allocated for an AVDictionary struct and all keys and values.
#define AV_LOG_INFO
Standard information.
int avfilter_init_str(AVFilterContext *filter, const char *args)
Initialize a filter with the supplied parameters.
#define AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC
Some filters support a generic "enable" expression option that can be used to enable or disable a fil...
AVFrame * ff_framequeue_peek(FFFrameQueue *fq, size_t idx)
Access a frame in the queue, without removing it.
char av_get_picture_type_char(enum AVPictureType pict_type)
Return a single letter to describe the given picture type pict_type.
int av_samples_copy(uint8_t **dst, uint8_t *const *src, int dst_offset, int src_offset, int nb_samples, int nb_channels, enum AVSampleFormat sample_fmt)
Copy samples from src to dst.
static const AVOption avfilter_options[]
static int append_pad(unsigned *count, AVFilterPad **pads, AVFilterLink ***links, AVFilterPad *newpad)
Append a new pad.
static int ff_filter_frame_framed(AVFilterLink *link, AVFrame *frame)
#define i(width, name, range_min, range_max)
static void * filter_child_next(void *obj, void *prev)
void ff_avfilter_link_set_in_status(AVFilterLink *link, int status, int64_t pts)
Set the status field of a link from the source filter.
uint8_t ** extended_data
pointers to the data planes/channels.
int ff_filter_get_nb_threads(AVFilterContext *ctx)
Get number of threads for current filter instance.
static int samples_ready(AVFilterLink *link, unsigned min)
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
static uint64_t ff_framequeue_queued_samples(const FFFrameQueue *fq)
Get the number of queued samples.
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 value
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
int flags
A combination of AVFILTERPAD_FLAG_* flags.
static const int8_t filt[NUMTAPS *2]
const char * name
Pad name.
int ff_inlink_queued_samples(AVFilterLink *link)
const AVOption * av_opt_next(const void *obj, const AVOption *last)
Iterate over all AVOptions belonging to obj.
void * av_calloc(size_t nmemb, size_t size)
This struct describes a set or pool of "hardware" frames (i.e.
enum AVMediaType type
AVFilterPad type.
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
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
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 it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
int av_opt_get_key_value(const char **ropts, const char *key_val_sep, const char *pairs_sep, unsigned flags, char **rkey, char **rval)
Extract a key-value pair from the beginning of a string.
AVRational sample_aspect_ratio
Sample aspect ratio for the video frame, 0/1 if unknown/unspecified.
static int request_frame(AVFilterLink *outlink)
static size_t ff_framequeue_queued_frames(const FFFrameQueue *fq)
Get the number of queued frames.
enum AVMediaType avfilter_pad_get_type(const AVFilterPad *pads, int pad_idx)
Get the type of an AVFilterPad.
AVBufferRef * hw_frames_ctx
For hwaccel-format frames, this should be a reference to the AVHWFramesContext describing the frame.
const char * av_get_media_type_string(enum AVMediaType media_type)
Return a string describing the media_type enum, NULL if media_type is unknown.
const struct AVOption * option
a pointer to the first option specified in the class if any or NULL
void ff_filter_graph_remove_filter(AVFilterGraph *graph, AVFilterContext *filter)
Remove a filter from a graph;.
int avfilter_init_dict(AVFilterContext *ctx, AVDictionary **options)
Initialize a filter with the supplied dictionary of options.
void ff_avfilter_graph_update_heap(AVFilterGraph *graph, AVFilterLink *link)
Update the position of a link in the age heap.
void * enable
parsed expression (AVExpr*)
static int ref[MAX_W *MAX_W]
Filter the word “frame” indicates either a video frame or a group of audio samples
void ff_tlog_link(void *ctx, AVFilterLink *link, int end)
char * arg
optional argument for the command
int av_channel_layout_describe(const AVChannelLayout *channel_layout, char *buf, size_t buf_size)
Get a human-readable string describing the channel layout properties.
int ff_outlink_get_status(AVFilterLink *link)
Get the status on an output link.
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
char * av_strdup(const char *s)
Duplicate a string.
@ AV_OPT_FLAG_IMPLICIT_KEY
Accept to parse a value without a key; the key will then be returned as NULL.
void avfilter_free(AVFilterContext *filter)
Free a filter context.
int ff_append_outpad(AVFilterContext *f, AVFilterPad *p)
static int default_filter_frame(AVFilterLink *link, AVFrame *frame)
int ff_inlink_process_commands(AVFilterLink *link, const AVFrame *frame)
Process the commands queued in the link up to the time of the frame.
#define AVFILTER_FLAG_SUPPORT_TIMELINE
Handy mask to test whether the filter supports or no the timeline feature (internally or generically)...
int ff_append_outpad_free_name(AVFilterContext *f, AVFilterPad *p)
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
static const char *const var_names[]
static int ff_filter_activate_default(AVFilterContext *filter)
#define flags(name, subs,...)
#define AVERROR_BUG
Internal bug, also see AVERROR_BUG2.
the definition of that something depends on the semantic of the filter The callback must examine the status of the filter s links and proceed accordingly The status of output links is stored in the status_in and status_out fields and tested by the ff_outlink_frame_wanted() function. If this function returns true
const AVFilter * filter
the AVFilter of which this is an instance
#define AVFILTERPAD_FLAG_FREE_NAME
The pad's name is allocated and should be freed generically.
const AVClass * avfilter_get_class(void)
static void * av_x_if_null(const void *p, const void *x)
Return x default pointer in case p is NULL.
const char * av_get_pix_fmt_name(enum AVPixelFormat pix_fmt)
Return the short name for a pixel format, NULL in case pix_fmt is unknown.
void ff_filter_set_ready(AVFilterContext *filter, unsigned priority)
Mark a filter ready and schedule it for activation.
int ff_filter_init_hw_frames(AVFilterContext *avctx, AVFilterLink *link, int default_pool_size)
Perform any additional setup required for hardware frames.
double time
time expressed in seconds
#define AVFILTERPAD_FLAG_NEEDS_WRITABLE
The filter expects writable frames from its input link, duplicating data buffers if needed.