| @@ -125,8 +125,8 @@ enum var_name { · 124 unmodified lines |
| 125 | | 125 | |
| 126 | typedef struct { | 126 | typedef struct { |
| 127 | const AVClass *class; | 127 | const AVClass *class; |
| 128 | AVExpr *expr; | | |
| 129 | char *expr_str; | 128 | char *expr_str; |
| | 129 | AVExpr *expr; |
| 130 | double var_values[VAR_VARS_NB]; | 130 | double var_values[VAR_VARS_NB]; |
| 131 | int do_scene_detect; ///< 1 if the expression requires scene detection variables, 0 otherwise | 131 | int do_scene_detect; ///< 1 if the expression requires scene detection variables, 0 otherwise |
| 132 | #if CONFIG_AVCODEC | 132 | #if CONFIG_AVCODEC |
| @@ -138,13 +138,6 @@ typedef struct { · 5 unmodified lines |
| 138 | double select; | 138 | double select; |
| 139 | } SelectContext; | 139 | } SelectContext; |
| 140 | | 140 | |
| 141 | #define OFFSET(x) offsetof(SelectContext, x) | | |
| 142 | #define FLAGS AV_OPT_FLAG_FILTERING_PARAM | | |
| 143 | static const AVOption options[] = { | | |
| 144 | { "expr", "set selection expression", OFFSET(expr_str), AV_OPT_TYPE_STRING, {.str = "1"}, 0, 0, FLAGS }, | | |
| 145 | { "e", "set selection expression", OFFSET(expr_str), AV_OPT_TYPE_STRING, {.str = "1"}, 0, 0, FLAGS }, | | |
| 146 | {NULL}, | | |
| 147 | }; | | |
| 148 | | 141 | |
| 149 | static av_cold int init(AVFilterContext *ctx, const char *args, const AVClass *class) | 142 | static av_cold int init(AVFilterContext *ctx, const char *args, const AVClass *class) |
| 150 | { | 143 | { |
| @@ -153,7 +146,8 @@ static av_cold int init(AVFilterContext *ctx, const char *args, const AVClass *c · 2 unmodified lines |
| 153 | | 146 | |
| 154 | if ((ret = av_expr_parse(&select->expr, select->expr_str, | 147 | if ((ret = av_expr_parse(&select->expr, select->expr_str, |
| 155 | var_names, NULL, NULL, NULL, NULL, 0, ctx)) < 0) { | 148 | var_names, NULL, NULL, NULL, NULL, 0, ctx)) < 0) { |
| 156 | av_log(ctx, AV_LOG_ERROR, "Error while parsing expression '%s'\n", select->expr_str); | 149 | av_log(ctx, AV_LOG_ERROR, "Error while parsing expression '%s'\n", |
| | 150 | select->expr_str); |
| 157 | return ret; | 151 | return ret; |
| 158 | } | 152 | } |
| 159 | select->do_scene_detect = !!strstr(select->expr_str, "scene"); | 153 | select->do_scene_detect = !!strstr(select->expr_str, "scene"); |
| @@ -398,7 +392,13 @@ static const char *const shorthand[] = { "expr", NULL }; · 238 unmodified lines |
| 398 | | 392 | |
| 399 | #if CONFIG_ASELECT_FILTER | 393 | #if CONFIG_ASELECT_FILTER |
| 400 | | 394 | |
| 401 | #define aselect_options options | 395 | #define OFFSET(x) offsetof(SelectContext, x) |
| | 396 | #define AFLAGS AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_AUDIO_PARAM |
| | 397 | static const AVOption aselect_options[] = { |
| | 398 | { "expr", "An expression to use for selecting frames", OFFSET(expr_str), AV_OPT_TYPE_STRING, { .str = "1" }, .flags = AFLAGS }, |
| | 399 | { "e", "An expression to use for selecting frames", OFFSET(expr_str), AV_OPT_TYPE_STRING, { .str = "1" }, .flags = AFLAGS }, |
| | 400 | { NULL }, |
| | 401 | }; |
| 402 | AVFILTER_DEFINE_CLASS(aselect); | 402 | AVFILTER_DEFINE_CLASS(aselect); |
| 403 | | 403 | |
| 404 | static av_cold int aselect_init(AVFilterContext *ctx, const char *args) | 404 | static av_cold int aselect_init(AVFilterContext *ctx, const char *args) |
| @@ -451,7 +451,14 @@ AVFilter avfilter_af_aselect = { · 46 unmodified lines |
| 451 | | 451 | |
| 452 | #if CONFIG_SELECT_FILTER | 452 | #if CONFIG_SELECT_FILTER |
| 453 | | 453 | |
| 454 | #define select_options options | 454 | #define OFFSET(x) offsetof(SelectContext, x) |
| | 455 | #define FLAGS AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_VIDEO_PARAM |
| | 456 | static const AVOption select_options[] = { |
| | 457 | { "expr", "An expression to use for selecting frames", OFFSET(expr_str), AV_OPT_TYPE_STRING, { .str = "1" }, .flags = FLAGS }, |
| | 458 | { "e", "An expression to use for selecting frames", OFFSET(expr_str), AV_OPT_TYPE_STRING, { .str = "1" }, .flags = FLAGS }, |
| | 459 | { NULL }, |
| | 460 | }; |
| | 461 | |
| 455 | AVFILTER_DEFINE_CLASS(select); | 462 | AVFILTER_DEFINE_CLASS(select); |
| 456 | | 463 | |
| 457 | static av_cold int select_init(AVFilterContext *ctx, const char *args) | 464 | static av_cold int select_init(AVFilterContext *ctx, const char *args) |
| @@ -498,10 +505,9 @@ AVFilter avfilter_vf_select = { · 40 unmodified lines |
| 498 | .query_formats = query_formats, | 505 | .query_formats = query_formats, |
| 499 | | 506 | |
| 500 | .priv_size = sizeof(SelectContext), | 507 | .priv_size = sizeof(SelectContext), |
| | 508 | .priv_class = &select_class, |
| 501 | | 509 | |
| 502 | .inputs = avfilter_vf_select_inputs, | 510 | .inputs = avfilter_vf_select_inputs, |
| 503 | .outputs = avfilter_vf_select_outputs, | 511 | .outputs = avfilter_vf_select_outputs, |
| 504 | .priv_class = &select_class, | | |
| 505 | .shorthand = shorthand, | | |
| 506 | }; | 512 | }; |
| 507 | #endif /* CONFIG_SELECT_FILTER */ | 513 | #endif /* CONFIG_SELECT_FILTER */ |