summaryrefslogtreecommitdiff
path: root/libavfilter/f_select.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-04-10 23:18:18 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-04-10 23:24:48 +0200
commitb3fb2d8cec91dadf935832f3bef97bf5a3a11352 (patch)
tree5cd66817a72919b0dd0ceaa55713959ad7a7a259 /libavfilter/f_select.c
parent7e99ccf5d8c25d7fe670d9402349b055c0c1449a (diff)
parent95f1f56a21bc2f824af6fb97ca7ab35cdd0c401e (diff)
Merge commit '95f1f56a21bc2f824af6fb97ca7ab35cdd0c401e'
* commit '95f1f56a21bc2f824af6fb97ca7ab35cdd0c401e': vf_select: switch to an AVOptions-based system. Conflicts: doc/filters.texi libavfilter/f_select.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavfilter/f_select.c')
-rw-r--r--libavfilter/f_select.c32
1 files changed, 19 insertions, 13 deletions
diff --git a/libavfilter/f_select.c b/libavfilter/f_select.c
index 351b7f8d80..e2c4ef719a 100644
--- a/libavfilter/f_select.c
+++ b/libavfilter/f_select.c
@@ -125,8 +125,8 @@ enum var_name {
typedef struct {
const AVClass *class;
- AVExpr *expr;
char *expr_str;
+ AVExpr *expr;
double var_values[VAR_VARS_NB];
int do_scene_detect; ///< 1 if the expression requires scene detection variables, 0 otherwise
#if CONFIG_AVCODEC
@@ -138,13 +138,6 @@ typedef struct {
double select;
} SelectContext;
-#define OFFSET(x) offsetof(SelectContext, x)
-#define FLAGS AV_OPT_FLAG_FILTERING_PARAM
-static const AVOption options[] = {
- { "expr", "set selection expression", OFFSET(expr_str), AV_OPT_TYPE_STRING, {.str = "1"}, 0, 0, FLAGS },
- { "e", "set selection expression", OFFSET(expr_str), AV_OPT_TYPE_STRING, {.str = "1"}, 0, 0, FLAGS },
- {NULL},
-};
static av_cold int init(AVFilterContext *ctx, const char *args, const AVClass *class)
{
@@ -153,7 +146,8 @@ static av_cold int init(AVFilterContext *ctx, const char *args, const AVClass *c
if ((ret = av_expr_parse(&select->expr, select->expr_str,
var_names, NULL, NULL, NULL, NULL, 0, ctx)) < 0) {
- av_log(ctx, AV_LOG_ERROR, "Error while parsing expression '%s'\n", select->expr_str);
+ av_log(ctx, AV_LOG_ERROR, "Error while parsing expression '%s'\n",
+ select->expr_str);
return ret;
}
select->do_scene_detect = !!strstr(select->expr_str, "scene");
@@ -398,7 +392,13 @@ static const char *const shorthand[] = { "expr", NULL };
#if CONFIG_ASELECT_FILTER
-#define aselect_options options
+#define OFFSET(x) offsetof(SelectContext, x)
+#define AFLAGS AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_AUDIO_PARAM
+static const AVOption aselect_options[] = {
+ { "expr", "An expression to use for selecting frames", OFFSET(expr_str), AV_OPT_TYPE_STRING, { .str = "1" }, .flags = AFLAGS },
+ { "e", "An expression to use for selecting frames", OFFSET(expr_str), AV_OPT_TYPE_STRING, { .str = "1" }, .flags = AFLAGS },
+ { NULL },
+};
AVFILTER_DEFINE_CLASS(aselect);
static av_cold int aselect_init(AVFilterContext *ctx, const char *args)
@@ -451,7 +451,14 @@ AVFilter avfilter_af_aselect = {
#if CONFIG_SELECT_FILTER
-#define select_options options
+#define OFFSET(x) offsetof(SelectContext, x)
+#define FLAGS AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_VIDEO_PARAM
+static const AVOption select_options[] = {
+ { "expr", "An expression to use for selecting frames", OFFSET(expr_str), AV_OPT_TYPE_STRING, { .str = "1" }, .flags = FLAGS },
+ { "e", "An expression to use for selecting frames", OFFSET(expr_str), AV_OPT_TYPE_STRING, { .str = "1" }, .flags = FLAGS },
+ { NULL },
+};
+
AVFILTER_DEFINE_CLASS(select);
static av_cold int select_init(AVFilterContext *ctx, const char *args)
@@ -498,10 +505,9 @@ AVFilter avfilter_vf_select = {
.query_formats = query_formats,
.priv_size = sizeof(SelectContext),
+ .priv_class = &select_class,
.inputs = avfilter_vf_select_inputs,
.outputs = avfilter_vf_select_outputs,
- .priv_class = &select_class,
- .shorthand = shorthand,
};
#endif /* CONFIG_SELECT_FILTER */