87 const char *value1,
const char *value2);
91 #define OFFSET(x) offsetof(MetadataContext, x)
92 #define DEFINE_OPTIONS(filt_name, FLAGS) \
93 static const AVOption filt_name##_options[] = { \
94 { "mode", "set a mode of operation", OFFSET(mode), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, METADATA_NB-1, FLAGS, "mode" }, \
95 { "select", "select frame", 0, AV_OPT_TYPE_CONST, {.i64 = METADATA_SELECT }, 0, 0, FLAGS, "mode" }, \
96 { "add", "add new metadata", 0, AV_OPT_TYPE_CONST, {.i64 = METADATA_ADD }, 0, 0, FLAGS, "mode" }, \
97 { "modify", "modify metadata", 0, AV_OPT_TYPE_CONST, {.i64 = METADATA_MODIFY }, 0, 0, FLAGS, "mode" }, \
98 { "delete", "delete metadata", 0, AV_OPT_TYPE_CONST, {.i64 = METADATA_DELETE }, 0, 0, FLAGS, "mode" }, \
99 { "print", "print metadata", 0, AV_OPT_TYPE_CONST, {.i64 = METADATA_PRINT }, 0, 0, FLAGS, "mode" }, \
100 { "key", "set metadata key", OFFSET(key), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, FLAGS }, \
101 { "value", "set metadata value", OFFSET(value), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, FLAGS }, \
102 { "function", "function for comparing values", OFFSET(function), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, METADATAF_NB-1, FLAGS, "function" }, \
103 { "same_str", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = METADATAF_SAME_STR }, 0, 3, FLAGS, "function" }, \
104 { "starts_with", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = METADATAF_STARTS_WITH }, 0, 0, FLAGS, "function" }, \
105 { "less", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = METADATAF_LESS }, 0, 3, FLAGS, "function" }, \
106 { "equal", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = METADATAF_EQUAL }, 0, 3, FLAGS, "function" }, \
107 { "greater", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = METADATAF_GREATER }, 0, 3, FLAGS, "function" }, \
108 { "expr", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = METADATAF_EXPR }, 0, 3, FLAGS, "function" }, \
109 { "expr", "set expression for expr function", OFFSET(expr_str), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, FLAGS }, \
110 { "file", "set file where to print metadata information", OFFSET(file_str), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, FLAGS }, \
116 return !strcmp(value1, value2);
121 return !strncmp(value1, value2, strlen(value2));
128 if (sscanf(value1,
"%f", &f1) + sscanf(value2,
"%f", &f2) != 2)
131 return fabsf(f1 - f2) < FLT_EPSILON;
138 if (sscanf(value1,
"%f", &f1) + sscanf(value2,
"%f", &f2) != 2)
141 return (f1 - f2) < FLT_EPSILON;
148 if (sscanf(value1,
"%f", &f1) + sscanf(value2,
"%f", &f2) != 2)
151 return (f2 - f1) < FLT_EPSILON;
158 if (sscanf(value1,
"%lf", &f1) + sscanf(value2,
"%lf", &f2) != 2)
169 va_list argument_list;
171 va_start(argument_list, msg);
174 va_end(argument_list);
180 va_list argument_list;
182 va_start(argument_list, msg);
184 vfprintf(s->
file, msg, argument_list);
185 va_end(argument_list);
309 s->
print(ctx,
"frame:%-4"PRId64
" pts:%-7s pts_time:%-7s\n",
316 s->
print(ctx,
"frame:%-4"PRId64
" pts:%-7s pts_time:%-7s\n",
325 }
else if (e && e->
value) {
339 #if CONFIG_AMETADATA_FILTER
365 .priv_class = &ametadata_class,
375 #if CONFIG_METADATA_FILTER
401 .priv_class = &metadata_class,
This structure describes decoded (raw) audio or video data.
#define AV_LOG_WARNING
Something somehow does not look correct.
Main libavfilter public API header.
#define AV_OPT_FLAG_AUDIO_PARAM
int(* compare)(struct MetadataContext *s, const char *value1, const char *value2)
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.
#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 char * name
Pad name.
#define av_assert0(cond)
assert() equivalent, that is always enabled.
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
timestamp utils, mostly useful for debugging/logging purposes
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
AVDictionaryEntry * av_dict_get(const AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
Get a dictionary entry with matching key.
A filter pad used for either input or output.
A link between two filters.
double var_values[VAR_VARS_NB]
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define AV_OPT_FLAG_FILTERING_PARAM
a generic parameter which can be set by the user for filtering
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
#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 * priv
private data for use by the filter
AVRational time_base
Define the time base used by the PTS of the frames/samples which will pass through this link...
simple assert() macros that are a bit more flexible than ISO C assert().
#define av_printf_format(fmtpos, attrpos)
common internal API header
typedef void(APIENTRY *FF_PFNGLACTIVETEXTUREPROC)(GLenum texture)
static const AVFilterPad outputs[]
#define AV_LOG_INFO
Standard information.
static const AVFilterPad inputs[]
#define AV_OPT_FLAG_VIDEO_PARAM
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
AVDictionary * av_frame_get_metadata(const AVFrame *frame)
Describe the class of an AVClass context structure.
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...
const char * name
Filter name.
AVFilterLink ** outputs
array of pointers to output links
int av_strerror(int errnum, char *errbuf, size_t errbuf_size)
Put a description of the AVERROR code errnum in errbuf.
static int query_formats(AVFilterContext *ctx)
#define av_ts2str(ts)
Convenience macro, the return value should be used only directly in function arguments but never stan...
double av_expr_eval(AVExpr *e, const double *const_values, void *opaque)
Evaluate a previously parsed expression.
AVFilterContext * dst
dest filter
#define AVFILTER_DEFINE_CLASS(fname)
#define AV_DICT_IGNORE_SUFFIX
Return first entry in a dictionary whose first part corresponds to the search key, ignoring the suffix of the found key string.
int64_t frame_count
Number of past frames sent through the link.
void(* print)(AVFilterContext *ctx, const char *msg,...) av_printf_format(2
simple arithmetic expression evaluator