Go to the documentation of this file.
26 #include "config_components.h"
95 const char *value1,
const char *value2);
101 #define OFFSET(x) offsetof(MetadataContext, x)
102 #define DEFINE_OPTIONS(filt_name, FLAGS) \
103 static const AVOption filt_name##_options[] = { \
104 { "mode", "set a mode of operation", OFFSET(mode), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, METADATA_NB-1, FLAGS, "mode" }, \
105 { "select", "select frame", 0, AV_OPT_TYPE_CONST, {.i64 = METADATA_SELECT }, 0, 0, FLAGS, "mode" }, \
106 { "add", "add new metadata", 0, AV_OPT_TYPE_CONST, {.i64 = METADATA_ADD }, 0, 0, FLAGS, "mode" }, \
107 { "modify", "modify metadata", 0, AV_OPT_TYPE_CONST, {.i64 = METADATA_MODIFY }, 0, 0, FLAGS, "mode" }, \
108 { "delete", "delete metadata", 0, AV_OPT_TYPE_CONST, {.i64 = METADATA_DELETE }, 0, 0, FLAGS, "mode" }, \
109 { "print", "print metadata", 0, AV_OPT_TYPE_CONST, {.i64 = METADATA_PRINT }, 0, 0, FLAGS, "mode" }, \
110 { "key", "set metadata key", OFFSET(key), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, FLAGS }, \
111 { "value", "set metadata value", OFFSET(value), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, FLAGS }, \
112 { "function", "function for comparing values", OFFSET(function), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, METADATAF_NB-1, FLAGS, "function" }, \
113 { "same_str", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = METADATAF_SAME_STR }, 0, 3, FLAGS, "function" }, \
114 { "starts_with", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = METADATAF_STARTS_WITH }, 0, 0, FLAGS, "function" }, \
115 { "less", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = METADATAF_LESS }, 0, 3, FLAGS, "function" }, \
116 { "equal", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = METADATAF_EQUAL }, 0, 3, FLAGS, "function" }, \
117 { "greater", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = METADATAF_GREATER }, 0, 3, FLAGS, "function" }, \
118 { "expr", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = METADATAF_EXPR }, 0, 3, FLAGS, "function" }, \
119 { "ends_with", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = METADATAF_ENDS_WITH }, 0, 0, FLAGS, "function" }, \
120 { "expr", "set expression for expr function", OFFSET(expr_str), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, FLAGS }, \
121 { "file", "set file where to print metadata information", OFFSET(file_str), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, FLAGS }, \
122 { "direct", "reduce buffering when printing to user-set file or pipe", OFFSET(direct), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, FLAGS }, \
128 return !strcmp(value1, value2);
133 return !strncmp(value1, value2, strlen(value2));
138 const int len1 = strlen(value1);
139 const int len2 = strlen(value2);
141 return !strncmp(value1 +
FFMAX(len1 - len2, 0), value2, len2);
148 if (sscanf(value1,
"%f", &f1) + sscanf(value2,
"%f", &f2) != 2)
151 return fabsf(f1 - f2) < FLT_EPSILON;
158 if (sscanf(value1,
"%f", &f1) + sscanf(value2,
"%f", &f2) != 2)
161 return (f1 - f2) < FLT_EPSILON;
168 if (sscanf(value1,
"%f", &f1) + sscanf(value2,
"%f", &f2) != 2)
171 return (f2 - f1) < FLT_EPSILON;
178 if (sscanf(value1,
"%lf", &f1) + sscanf(value2,
"%lf", &f2) != 2)
189 va_list argument_list;
191 va_start(argument_list, msg);
194 va_end(argument_list);
200 va_list argument_list;
202 va_start(argument_list, msg);
205 vsnprintf(buf,
sizeof(buf), msg, argument_list);
208 va_end(argument_list);
227 switch (
s->function) {
271 s->avio_context =
NULL;
273 if (!strcmp(
"-",
s->file_str)) {
300 if (
s->avio_context) {
318 if (!
s->value && e && e->
value) {
320 }
else if (
s->value && e && e->
value &&
321 s->compare(
s, e->
value,
s->value)) {
339 s->print(
ctx,
"frame:%-4"PRId64
" pts:%-7s pts_time:%s\n",
345 }
else if (e && e->
value && (!
s->value || (e->
value &&
s->compare(
s, e->
value,
s->value)))) {
346 s->print(
ctx,
"frame:%-4"PRId64
" pts:%-7s pts_time:%s\n",
354 }
else if (e && e->
value && (!
s->value ||
s->compare(
s, e->
value,
s->value))) {
367 #if CONFIG_AMETADATA_FILTER
391 .priv_class = &ametadata_class,
401 #if CONFIG_METADATA_FILTER
425 .priv_class = &metadata_class,
void av_vlog(void *avcl, int level, const char *fmt, va_list vl)
Send the specified message to the log if the level is less than or equal to the current av_log_level.
#define AV_LOG_WARNING
Something somehow does not look correct.
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
#define AV_OPT_FLAG_VIDEO_PARAM
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
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.
This structure describes decoded (raw) audio or video data.
#define AV_DICT_IGNORE_SUFFIX
Return first entry in a dictionary whose first part corresponds to the search key,...
const char * name
Filter name.
A link between two filters.
#define AV_OPT_FLAG_FILTERING_PARAM
a generic parameter which can be set by the user for filtering
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.
int av_strerror(int errnum, char *errbuf, size_t errbuf_size)
Put a description of the AVERROR code errnum in errbuf.
static __device__ float fabsf(float a)
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.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
AVDictionaryEntry * av_dict_get(const AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
Get a dictionary entry with matching key.
#define av_assert0(cond)
assert() equivalent, that is always enabled.
static const AVFilterPad outputs[]
#define AVIO_FLAG_WRITE
write-only
const AVFilter ff_af_ametadata
double av_expr_eval(AVExpr *e, const double *const_values, void *opaque)
Evaluate a previously parsed expression.
#define FILTER_INPUTS(array)
#define AV_OPT_FLAG_AUDIO_PARAM
Describe the class of an AVClass context structure.
size_t static size_t av_strnlen(const char *s, size_t len)
Get the count of continuous non zero chars starting from the beginning.
#define av_printf_format(fmtpos, attrpos)
void(* print)(AVFilterContext *ctx, const char *msg,...) av_printf_format(2
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 inputs
#define av_ts2timestr(ts, tb)
Convenience macro, the return value should be used only directly in function arguments but never stan...
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
void avio_write(AVIOContext *s, const unsigned char *buf, int size)
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.
#define AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC
Some filters support a generic "enable" expression option that can be used to enable or disable a fil...
#define AVFILTER_DEFINE_CLASS(fname)
int avio_closep(AVIOContext **s)
Close the resource accessed by the AVIOContext *s, free it and set the pointer pointing to it to NULL...
const AVFilter ff_vf_metadata
int(* compare)(struct MetadataContext *s, const char *value1, const char *value2)
const char * name
Pad name.
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
#define AVFILTER_FLAG_METADATA_ONLY
The filter is a "metadata" filter - it does not modify the frame data in any way.
int avio_open(AVIOContext **s, const char *url, int flags)
Create and initialize a AVIOContext for accessing the resource indicated by url.
#define AVIO_FLAG_DIRECT
Use direct mode.
#define FILTER_OUTPUTS(array)
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
double var_values[VAR_VARS_NB]
#define av_ts2str(ts)
Convenience macro, the return value should be used only directly in function arguments but never stan...
AVIOContext * avio_context
const AVDictionaryEntry * av_dict_iterate(const AVDictionary *m, const AVDictionaryEntry *prev)
Iterate over a dictionary.