37 #define FF_INTERNAL_FIELDS 1
53 "ref[%p buf:%p data:%p linesize[%d, %d, %d, %d] pts:%"PRId64
" pos:%"PRId64,
55 ref->linesize[0],
ref->linesize[1],
ref->linesize[2],
ref->linesize[3],
59 ff_tlog(
ctx,
" a:%d/%d s:%dx%d i:%c iskey:%d type:%c",
60 ref->sample_aspect_ratio.num,
ref->sample_aspect_ratio.den,
62 !
ref->interlaced_frame ?
'P' :
63 ref->top_field_first ?
'T' :
'B',
67 if (
ref->nb_samples) {
90 #define LICENSE_PREFIX "libavfilter license: "
111 idx =
FFMIN(idx, *count);
119 if (!newpads || !newlinks)
122 memmove(*pads + idx + 1, *pads + idx,
sizeof(
AVFilterPad) * (*count - idx));
123 memmove(*links + idx + 1, *links + idx,
sizeof(
AVFilterLink*) * (*count - idx));
125 (*links)[idx] =
NULL;
128 for (
i = idx + 1;
i < *count;
i++)
130 (*(
unsigned *)((
uint8_t *) (*links)[
i] + padidx_off))++;
144 if (
src->nb_outputs <= srcpad || dst->
nb_inputs <= dstpad ||
145 src->outputs[srcpad] || dst->
inputs[dstpad])
150 "Media type mismatch between the '%s' filter output pad %d (%s) and the '%s' filter input pad %d (%s)\n",
160 src->outputs[srcpad] = dst->
inputs[dstpad] = link;
164 link->
srcpad = &
src->output_pads[srcpad];
166 link->
type =
src->output_pads[srcpad].type;
186 #if FF_API_FILTER_GET_SET
207 filter->outputs[
i]->frame_blocked_in = 0;
213 if (link->status_in == status)
216 link->status_in = status;
217 link->status_in_pts =
pts;
219 link->frame_blocked_in = 0;
228 link->status_out = status;
235 #if FF_API_FILTER_LINK_SET_CLOSED
242 unsigned filt_srcpad_idx,
unsigned filt_dstpad_idx)
248 "between the filter '%s' and the filter '%s'\n",
260 link->
dstpad = &
filt->input_pads[filt_srcpad_idx];
261 filt->inputs[filt_srcpad_idx] = link;
267 &
filt->outputs[filt_dstpad_idx]->outcfg.formats);
270 &
filt->outputs[filt_dstpad_idx]->outcfg.samplerates);
273 &
filt->outputs[filt_dstpad_idx]->outcfg.channel_layouts);
284 for (
i = 0;
i <
filter->nb_inputs;
i ++) {
289 if (!link->
src || !link->
dst) {
291 "Not all input and output are properly linked (%d).\n",
i);
302 case AVLINK_STARTINIT:
314 "with more than one input "
315 "must set config_props() "
316 "callbacks on all outputs\n");
319 }
else if ((ret = config_link(link)) < 0) {
321 "Failed to configure output pad on %s\n",
326 switch (link->
type) {
342 }
else if (!link->
w || !link->
h) {
344 "Video source filters must set their output link's "
345 "width and height\n");
363 "should not be set by non-hwframe-aware filter");
370 if ((ret = config_link(link)) < 0) {
372 "Failed to configure input pad on %s\n",
388 "link[%p s:%dx%d fmt:%s %s->%s]%s",
389 link, link->
w, link->
h,
399 "link[%p r:%d cl:%s fmt:%s %s->%s]%s",
413 if (link->status_out)
414 return link->status_out;
415 if (link->status_in) {
425 return link->status_out;
436 int64_t
r = INT64_MAX;
438 for (
i = 0;
i <
ctx->nb_inputs;
i++)
439 if (
ctx->inputs[
i]->status_out == status)
444 for (
i = 0;
i <
ctx->nb_inputs;
i++)
457 link->frame_blocked_in = 1;
463 if (ret !=
AVERROR(EAGAIN) && ret != link->status_in)
497 "with filter '%s'\n",
ctx->filter->name);
505 if (!
ctx->var_values) {
507 if (!
ctx->var_values) {
517 "Error when evaluating the expression '%s' for enable\n",
525 ctx->enable_str = expr_dup;
542 if(!strcmp(cmd,
"ping")){
543 char local_res[256] = {0};
547 res_len =
sizeof(local_res);
550 if (res == local_res)
553 }
else if(!strcmp(cmd,
"enable")) {
555 }
else if(
filter->filter->process_command) {
568 for (count = 0; pads->
name; count++)
576 return ctx->name ?
ctx->name :
ctx->filter->name;
582 if (!prev &&
ctx->filter &&
ctx->filter->priv_class &&
ctx->priv)
587 #if FF_API_CHILD_CLASS_NEXT
588 static const AVClass *filter_child_class_next(
const AVClass *prev)
595 if (
f->priv_class == prev)
605 return f->priv_class;
617 return f->priv_class;
622 #define OFFSET(x) offsetof(AVFilterContext, x)
623 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM
624 #define TFLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
631 { .i64 = 0 }, 0, INT_MAX,
FLAGS },
632 {
"extra_hw_frames",
"Number of extra hardware frames to allocate for the user",
643 #if FF_API_CHILD_CLASS_NEXT
644 .child_class_next = filter_child_class_next,
651 int *ret,
int nb_jobs)
655 for (
i = 0;
i < nb_jobs;
i++) {
684 if (
filter->preinit(ret) < 0)
770 if (
filter->filter->uninit)
773 for (
i = 0;
i <
filter->nb_inputs;
i++) {
776 for (
i = 0;
i <
filter->nb_outputs;
i++) {
780 if (
filter->filter->priv_class)
791 while(
filter->command_queue){
804 if (
ctx->nb_threads > 0)
805 return FFMIN(
ctx->nb_threads,
ctx->graph->nb_threads);
806 return ctx->graph->nb_threads;
822 const char *shorthand =
NULL;
834 &parsed_key, &
value);
883 const char *
arg,
char *res,
int res_len,
int flags)
887 if (!
ctx->filter->priv_class)
911 ctx->thread_type = 0;
914 if (
ctx->filter->priv_class) {
922 if (
ctx->filter->init_opaque)
924 else if (
ctx->filter->init)
925 ret =
ctx->filter->init(
ctx);
926 else if (
ctx->filter->init_dict)
931 if (
ctx->enable_str) {
947 if (!
filter->filter->priv_class) {
949 "options, but options were provided: %s.\n", args);
953 #if FF_API_OLD_FILTER_OPTS_ERROR
954 if ( !strcmp(
filter->filter->name,
"format") ||
955 !strcmp(
filter->filter->name,
"noformat") ||
956 !strcmp(
filter->filter->name,
"frei0r") ||
957 !strcmp(
filter->filter->name,
"frei0r_src") ||
958 !strcmp(
filter->filter->name,
"ocv") ||
959 !strcmp(
filter->filter->name,
"pan") ||
960 !strcmp(
filter->filter->name,
"pp") ||
961 !strcmp(
filter->filter->name,
"aevalsrc")) {
974 if (!strcmp(
filter->filter->name,
"frei0r") ||
975 !strcmp(
filter->filter->name,
"ocv"))
977 else if (!strcmp(
filter->filter->name,
"frei0r_src"))
980 while (nb_leading--) {
989 deprecated = strchr(p,
':') !=
NULL;
991 if (!strcmp(
filter->filter->name,
"aevalsrc")) {
993 while ((p = strchr(p,
':')) && p[1] !=
':') {
994 const char *epos = strchr(p + 1,
'=');
995 const char *spos = strchr(p + 1,
':');
996 const int next_token_is_opt = epos && (!spos || epos < spos);
997 if (next_token_is_opt) {
1005 if (p && *p ==
':') {
1007 memmove(p, p + 1, strlen(p));
1010 while ((p = strchr(p,
':')))
1015 "'|' to separate the list items ('%s' instead of '%s')\n",
1052 return pads[pad_idx].
name;
1057 return pads[pad_idx].
type;
1158 unsigned nb_samples, nb_frames,
i, p;
1173 if (nb_samples <
min)
1195 for (
i = 0;
i < nb_frames;
i++) {
1202 if (p < nb_samples) {
1203 unsigned n = nb_samples - p;
1236 if (ret < 0 && ret != link->status_out) {
1248 unsigned out = 0, progress = 0;
1252 if (!
filter->nb_outputs) {
1256 while (!
in->status_out) {
1282 for (
i = 0;
i <
filter->nb_inputs;
i++) {
1287 for (
i = 0;
i <
filter->nb_inputs;
i++) {
1288 if (
filter->inputs[
i]->status_in && !
filter->inputs[
i]->status_out) {
1293 for (
i = 0;
i <
filter->nb_outputs;
i++) {
1294 if (
filter->outputs[
i]->frame_wanted_out &&
1295 !
filter->outputs[
i]->frame_blocked_in) {
1440 filter->filter->activate));
1453 return *rstatus = 0;
1454 if (link->status_out)
1455 return *rstatus = link->status_out;
1456 if (!link->status_in)
1457 return *rstatus = 0;
1458 *rstatus = link->status_out = link->status_in;
1483 return samples >=
min || (link->status_in && samples);
1502 if (link->fifo.samples_skipped) {
1523 if (link->status_in)
1548 switch (link->
type) {
1567 switch (link->
type) {
1593 "Processing command time:%f command:%s arg:%s\n",
1630 if (link->status_out)
1633 link->frame_blocked_in = 0;
1639 if (!link->status_in)
1640 link->status_in = status;
1645 return link->status_in;
1654 int default_pool_size)
1663 if (
frames->initial_pool_size == 0) {
1668 frames->initial_pool_size = default_pool_size;
static int request_frame(AVFilterLink *outlink)
static const int8_t filt[NUMTAPS *2]
AVFrame * ff_get_audio_buffer(AVFilterLink *link, int nb_samples)
Request an audio samples buffer with a specific set of permissions.
uint8_t pi<< 24) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8, uint8_t,(*(const uint8_t *) pi - 0x80) *(1.0f/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8, uint8_t,(*(const uint8_t *) pi - 0x80) *(1.0/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16, int16_t,(*(const int16_t *) pi >> 8)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, int16_t, *(const int16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, int16_t, *(const int16_t *) pi *(1.0/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32, int32_t,(*(const int32_t *) pi >> 24)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, int32_t, *(const int32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, int32_t, *(const int32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, float, av_clip_uint8(lrintf(*(const float *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, float, av_clip_int16(lrintf(*(const float *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(const float *) pi *(1U<< 31)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, double, av_clip_uint8(lrint(*(const double *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, double, av_clip_int16(lrint(*(const double *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(const double *) pi *(1U<< 31)))) #define SET_CONV_FUNC_GROUP(ofmt, ifmt) static void set_generic_function(AudioConvert *ac) { } void ff_audio_convert_free(AudioConvert **ac) { if(! *ac) return;ff_dither_free(&(*ac) ->dc);av_freep(ac);} AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, enum AVSampleFormat out_fmt, enum AVSampleFormat in_fmt, int channels, int sample_rate, int apply_map) { AudioConvert *ac;int in_planar, out_planar;ac=av_mallocz(sizeof(*ac));if(!ac) return NULL;ac->avr=avr;ac->out_fmt=out_fmt;ac->in_fmt=in_fmt;ac->channels=channels;ac->apply_map=apply_map;if(avr->dither_method !=AV_RESAMPLE_DITHER_NONE &&av_get_packed_sample_fmt(out_fmt)==AV_SAMPLE_FMT_S16 &&av_get_bytes_per_sample(in_fmt) > 2) { ac->dc=ff_dither_alloc(avr, out_fmt, in_fmt, channels, sample_rate, apply_map);if(!ac->dc) { av_free(ac);return NULL;} return ac;} in_planar=ff_sample_fmt_is_planar(in_fmt, channels);out_planar=ff_sample_fmt_is_planar(out_fmt, channels);if(in_planar==out_planar) { ac->func_type=CONV_FUNC_TYPE_FLAT;ac->planes=in_planar ? ac->channels :1;} else if(in_planar) ac->func_type=CONV_FUNC_TYPE_INTERLEAVE;else ac->func_type=CONV_FUNC_TYPE_DEINTERLEAVE;set_generic_function(ac);if(ARCH_AARCH64) ff_audio_convert_init_aarch64(ac);if(ARCH_ARM) ff_audio_convert_init_arm(ac);if(ARCH_X86) ff_audio_convert_init_x86(ac);return ac;} int ff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in) { int use_generic=1;int len=in->nb_samples;int p;if(ac->dc) { av_log(ac->avr, AV_LOG_TRACE, "%d samples - audio_convert: %s to %s (dithered)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));return ff_convert_dither(ac-> in
simple assert() macros that are a bit more flexible than ISO C assert().
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
#define av_assert0(cond)
assert() equivalent, that is always enabled.
static int process_options(AVFilterContext *ctx, AVDictionary **options, const char *args)
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.
void ff_command_queue_pop(AVFilterContext *filter)
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.
static const AVClass * filter_child_class_iterate(void **iter)
void ff_tlog_link(void *ctx, AVFilterLink *link, int end)
AVFrame * ff_inlink_peek_frame(AVFilterLink *link, size_t idx)
Access a frame in the link fifo without consuming it.
void ff_tlog_ref(void *ctx, AVFrame *ref, int end)
AVFilterContext * ff_filter_alloc(const AVFilter *filter, const char *inst_name)
Allocate a new filter context and return it.
static int default_filter_frame(AVFilterLink *link, AVFrame *frame)
void ff_update_link_current_pts(AVFilterLink *link, int64_t pts)
static int forward_status_change(AVFilterContext *filter, AVFilterLink *in)
static void free_link(AVFilterLink *link)
void ff_inlink_set_status(AVFilterLink *link, int status)
Set the status on an input link.
int ff_outlink_get_status(AVFilterLink *link)
Get the status on an output link.
int ff_inlink_acknowledge_status(AVFilterLink *link, int *rstatus, int64_t *rpts)
Test and acknowledge the change of status on the link.
static void consume_update(AVFilterLink *link, const AVFrame *frame)
static int ff_request_frame_to_filter(AVFilterLink *link)
int ff_inlink_check_available_frame(AVFilterLink *link)
Test if a frame is available on the link.
int ff_inlink_check_available_samples(AVFilterLink *link, unsigned min)
Test if enough samples are available on the link.
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
int ff_filter_init_hw_frames(AVFilterContext *avctx, AVFilterLink *link, int default_pool_size)
Perform any additional setup required for hardware 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.
static const AVClass avfilter_class
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.
static int ff_filter_frame_framed(AVFilterLink *link, AVFrame *frame)
const char av_filter_ffversion[]
static const AVOption avfilter_options[]
size_t ff_inlink_queued_frames(AVFilterLink *link)
Get the number of frames available on the link.
int ff_request_frame(AVFilterLink *link)
Request an input frame from the filter at the other end of the link.
static const char * default_filter_name(void *filter_ctx)
int avfilter_link_get_channels(AVFilterLink *link)
int ff_inlink_process_commands(AVFilterLink *link, const AVFrame *frame)
Process the commands queued in the link up to the time of the frame.
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.
int ff_filter_get_nb_threads(AVFilterContext *ctx)
Get number of threads for current filter instance.
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_filter_set_ready(AVFilterContext *filter, unsigned priority)
Mark a filter ready and schedule it for activation.
static void filter_unblock(AVFilterContext *filter)
Clear frame_blocked_in on all outputs.
static const char *const var_names[]
int ff_inlink_make_frame_writable(AVFilterLink *link, AVFrame **rframe)
Make sure a frame is writable.
static int ff_filter_frame_to_filter(AVFilterLink *link)
static void * filter_child_next(void *obj, void *prev)
void avfilter_link_set_closed(AVFilterLink *link, int closed)
static int ff_filter_activate_default(AVFilterContext *filter)
int ff_inlink_consume_frame(AVFilterLink *link, AVFrame **rframe)
Take a frame from the link's FIFO and update the link's stats.
static int set_enable_expr(AVFilterContext *ctx, const char *expr)
int ff_inlink_queued_samples(AVFilterLink *link)
void ff_inlink_request_frame(AVFilterLink *link)
Mark that a frame is wanted on the link.
int ff_filter_activate(AVFilterContext *filter)
static int samples_ready(AVFilterLink *link, unsigned min)
int ff_insert_pad(unsigned idx, unsigned *count, size_t padidx_off, AVFilterPad **pads, AVFilterLink ***links, AVFilterPad *newpad)
Insert a new pad.
static int take_samples(AVFilterLink *link, unsigned min, unsigned max, AVFrame **rframe)
Main libavfilter public API header.
void ff_filter_graph_remove_filter(AVFilterGraph *graph, AVFilterContext *filter)
Remove a filter from a graph;.
void ff_avfilter_graph_update_heap(AVFilterGraph *graph, AVFilterLink *link)
Update the position of a link in the age heap.
size_t av_strlcatf(char *dst, size_t size, const char *fmt,...)
refcounted data buffer API
#define flags(name, subs,...)
static av_always_inline void filter(int16_t *output, ptrdiff_t out_stride, const int16_t *low, ptrdiff_t low_stride, const int16_t *high, ptrdiff_t high_stride, int len, int clip)
audio channel layout utility functions
common internal and external API header
#define FFMPEG_CONFIGURATION
static __device__ float fabs(float a)
static int filter_frame(DBEDecodeContext *s, AVFrame *frame)
void av_expr_free(AVExpr *e)
Free a parsed expression previously created with av_expr_parse().
double av_expr_eval(AVExpr *e, const double *const_values, void *opaque)
Evaluate a previously parsed expression.
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.
simple arithmetic expression evaluator
const OptionDef options[]
#define FFERROR_NOT_READY
Filters implementation helper functions.
void ff_frame_pool_uninit(FFFramePool **pool)
Deallocate the frame pool.
AVFrame * ff_framequeue_take(FFFrameQueue *fq)
Take the first frame in the queue.
void ff_framequeue_init(FFFrameQueue *fq, FFFrameQueueGlobal *fqg)
Init a frame queue and attach it to a global structure.
int ff_framequeue_add(FFFrameQueue *fq, AVFrame *frame)
Add a frame.
AVFrame * ff_framequeue_peek(FFFrameQueue *fq, size_t idx)
Access a frame in the queue, without removing it.
void ff_framequeue_free(FFFrameQueue *fq)
Free the queue and all queued frames.
void ff_framequeue_skip_samples(FFFrameQueue *fq, size_t samples, AVRational time_base)
Skip samples from the first frame in the queue.
static size_t ff_framequeue_queued_frames(const FFFrameQueue *fq)
Get the number of queued frames.
static uint64_t ff_framequeue_queued_samples(const FFFrameQueue *fq)
Get the number of queued samples.
int av_opt_set_dict2(void *obj, AVDictionary **options, int search_flags)
Set all the options from a given dictionary on an object.
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.
#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.
#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...
const AVOption * av_opt_next(const void *obj, const AVOption *last)
Iterate over all AVOptions belonging to obj.
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.
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.
int av_opt_set_dict(void *obj, AVDictionary **options)
Set all the options from a given dictionary on an object.
@ AV_OPT_FLAG_IMPLICIT_KEY
Accept to parse a value without a key; the key will then be returned as NULL.
void av_get_channel_layout_string(char *buf, int buf_size, int nb_channels, uint64_t channel_layout)
Return a description of a channel layout.
#define AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC
Some filters support a generic "enable" expression option that can be used to enable or disable a fil...
const AVFilter * av_filter_iterate(void **opaque)
Iterate over all registered filters.
int avfilter_init_str(AVFilterContext *filter, const char *args)
Initialize a filter with the supplied parameters.
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_free(AVFilterContext *filter)
Free a filter context.
enum AVMediaType avfilter_pad_get_type(const AVFilterPad *pads, int pad_idx)
Get the type of an AVFilterPad.
const char * avfilter_pad_get_name(const AVFilterPad *pads, int pad_idx)
Get the name of an AVFilterPad.
const AVClass * avfilter_get_class(void)
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.
#define AVFILTER_THREAD_SLICE
Process multiple parts of the frame concurrently.
int avfilter_init_dict(AVFilterContext *ctx, AVDictionary **options)
Initialize a filter with the supplied dictionary of options.
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 AVFILTER_FLAG_SUPPORT_TIMELINE
Handy mask to test whether the filter supports or no the timeline feature (internally or generically)...
int avfilter_config_links(AVFilterContext *filter)
Negotiate the media format, dimensions, etc of all inputs to a filter.
unsigned avfilter_version(void)
Return the LIBAVFILTER_VERSION_INT constant.
int avfilter_link(AVFilterContext *src, unsigned srcpad, AVFilterContext *dst, unsigned dstpad)
Link two filters together.
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
void avfilter_link_free(AVFilterLink **link)
Free the link in *link, and set its pointer to NULL.
const char * avfilter_license(void)
Return the libavfilter license.
int avfilter_pad_count(const AVFilterPad *pads)
Get the number of elements in a NULL-terminated array of AVFilterPads (e.g.
const char * avfilter_configuration(void)
Return the libavfilter build-time configuration.
void av_buffer_unref(AVBufferRef **buf)
Free a given reference and automatically free the buffer if there are no more references to it.
AVBufferRef * av_buffer_ref(AVBufferRef *buf)
Create a new reference to an AVBuffer.
void av_dict_free(AVDictionary **pm)
Free all the memory allocated for an AVDictionary struct and all keys and values.
#define AV_DICT_IGNORE_SUFFIX
Return first entry in a dictionary whose first part corresponds to the search key,...
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
AVDictionaryEntry * av_dict_get(const AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
Get a dictionary entry with matching key.
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
#define AVERROR_EOF
End of file.
#define av_err2str(errnum)
Convenience macro, the return value should be used only directly in function arguments but never stan...
#define AVERROR_OPTION_NOT_FOUND
Option not found.
int av_frame_is_writable(AVFrame *frame)
Check if the frame data is writable.
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
#define AV_LOG_WARNING
Something somehow does not look correct.
#define AV_LOG_VERBOSE
Detailed information.
#define AV_LOG_INFO
Standard information.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static double av_q2d(AVRational a)
Convert an AVRational to a double.
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
char * av_strdup(const char *s)
Duplicate a string.
void * av_realloc_array(void *ptr, size_t nmemb, size_t size)
Allocate, reallocate, or free an array.
void * av_calloc(size_t nmemb, size_t size)
Non-inlined equivalent of av_mallocz_array().
void * av_mallocz_array(size_t nmemb, size_t size)
Allocate a memory block for an array with av_mallocz().
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_media_type_string(enum AVMediaType media_type)
Return a string describing the media_type enum, NULL if media_type is unknown.
void av_image_copy(uint8_t *dst_data[4], int dst_linesizes[4], const uint8_t *src_data[4], const int src_linesizes[4], enum AVPixelFormat pix_fmt, int width, int height)
Copy image in src_data to dst_data.
char av_get_picture_type_char(enum AVPictureType pict_type)
Return a single letter to describe the given picture type pict_type.
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.
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.
#define AV_NOPTS_VALUE
Undefined timestamp value.
#define AV_TIME_BASE_Q
Internal time base represented as fractional value.
#define LIBAVUTIL_VERSION_INT
int av_opt_set(void *obj, const char *name, const char *val, int search_flags)
int(* func)(AVBPrint *dst, const char *in, const char *arg)
#define FF_FILTER_FLAG_HWFRAME_AWARE
The filter is aware of hardware frames, and any hardware frame context should not be automatically pr...
#define FF_TPRINTF_START(ctx, func)
#define LIBAVFILTER_VERSION_INT
#define LIBAVFILTER_VERSION_MICRO
common internal API header
@ AV_CLASS_CATEGORY_FILTER
#define AV_OPT_FLAG_FILTERING_PARAM
a generic parameter which can be set by the user for filtering
#define AV_OPT_FLAG_RUNTIME_PARAM
a generic parameter which can be set by the user at runtime
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.
Utilties for rational number calculation.
uint8_t * data
The data buffer.
Describe the class of an AVClass context structure.
const struct AVOption * option
a pointer to the first option specified in the class if any or NULL
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
double time
time expressed in seconds
char * arg
optional argument for the command
const AVClass * av_class
needed for av_log() and filters common options
int extra_hw_frames
Sets the number of extra hardware frames which the filter will allocate on its output links for use i...
char * name
name of this filter instance
void * enable
parsed expression (AVExpr*)
unsigned nb_inputs
number of input pads
AVFilterLink ** inputs
array of pointers to input links
char * enable_str
enable expression string
const AVFilter * filter
the AVFilter of which this is an instance
AVFilterInternal * internal
An opaque struct for libavfilter internal use.
struct AVFilterGraph * graph
filtergraph this filter belongs to
AVFilterPad * input_pads
array of input pads
void * priv
private data for use by the filter
unsigned nb_outputs
number of output pads
unsigned ready
Ready status of the filter.
struct AVFilterCommand * command_queue
AVFilterPad * output_pads
array of output pads
double * var_values
variable values for the enable expression
int is_disabled
the enabled state from the last expression evaluation
AVFilterLink ** outputs
array of pointers to output links
avfilter_execute_func * execute
A link between two filters.
AVFilterFormatsConfig incfg
Lists of supported formats / etc.
struct AVFilterGraph * graph
Graph the filter belongs to.
int w
agreed upon image width
int64_t current_pts
Current timestamp of the link, as defined by the most recent frame(s), in link time_base units.
int max_samples
Maximum number of samples to filter at once.
int h
agreed upon image height
int channels
Number of channels.
AVFilterFormatsConfig outcfg
Lists of supported formats / etc.
enum AVMediaType type
filter media type
AVFilterContext * src
source filter
int64_t frame_count_in
Number of past frames sent through the link.
AVRational time_base
Define the time base used by the PTS of the frames/samples which will pass through this link.
int sample_rate
samples per second
int frame_wanted_out
True if a frame is currently wanted on the output of this filter.
AVBufferRef * hw_frames_ctx
For hwaccel pixel formats, this should be a reference to the AVHWFramesContext describing the frames.
AVRational sample_aspect_ratio
agreed upon sample aspect ratio
AVRational frame_rate
Frame rate of the stream on the link, or 1/0 if unknown or variable; if left to 0/0,...
AVFilterPad * srcpad
output pad on the source filter
int age_index
Index in the age array.
int64_t current_pts_us
Current timestamp of the link, as defined by the most recent frame(s), in AV_TIME_BASE units.
enum AVFilterLink::@200 init_state
stage of the initialization of the link properties (dimensions, etc)
uint64_t channel_layout
channel layout of current buffer (see libavutil/channel_layout.h)
AVFilterPad * dstpad
input pad on the dest filter
AVFilterContext * dst
dest filter
int format
agreed upon media format
int min_samples
Minimum number of samples to filter at once.
A filter pad used for either input or output.
int(* request_frame)(AVFilterLink *link)
Frame request callback.
int needs_writable
The filter expects writable frames from its input link, duplicating data buffers if needed.
int(* config_props)(AVFilterLink *link)
Link configuration callback.
enum AVMediaType type
AVFilterPad type.
int(* filter_frame)(AVFilterLink *link, AVFrame *frame)
Filtering callback.
const char * name
Pad name.
const char * name
Filter name.
int flags
A combination of AVFILTER_FLAG_*.
int flags_internal
Additional flags for avfilter internal use only.
int(* activate)(AVFilterContext *ctx)
Filter activation function.
int flags
Flags modifying the (de)muxer behaviour.
AVFormatInternal * internal
An opaque field for libavformat internal usage.
This structure describes decoded (raw) audio or video data.
int nb_samples
number of audio samples (per channel) described by this frame
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
int64_t pkt_pos
reordered pos from the last AVPacket that has been input into the decoder
int channels
number of audio channels, only used for audio.
uint64_t channel_layout
Channel layout of the audio data.
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
int sample_rate
Sample rate of the audio data.
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames,...
uint8_t ** extended_data
pointers to the data planes/channels.
This struct describes a set or pool of "hardware" frames (i.e.
int offset
The offset relative to the context structure where the option value is stored.
Rational number (pair of numerator and denominator).
#define av_malloc_array(a, b)
static void error(const char *err)
static int ref[MAX_W *MAX_W]
static FilteringContext * filter_ctx
static const uint8_t offset[127][2]
static void copy(const float *p1, float *p2, const int length)
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.