History

Merge commit '7bc1a883c9158bb6e383d86fc76bdf2541e9a9fe'

* commit '7bc1a883c9158bb6e383d86fc76bdf2541e9a9fe': vsrc_color: switch to an AVOptions-based system. Conflicts: doc/filters.texi libavfilter/vsrc_color.c

Michael Niedermayer committed 13 years ago

Commit 8bafd832 parents 7f2198a 7bc1a882 files · +25 −16Browse files

Unified · Split

2 files
  1. libavfilter/avfilter.c +1 −0
  2. libavfilter/vsrc_testsrc.c +24 −16
libavfilter/avfilter.c+1−0
@@ -675,6 +675,7 @@ int avfilter_init_filter(AVFilterContext *filter, const char *args, void *opaque · 674 unmodified lines
675675 !strcmp(filter->filter->name, "cellauto") ||
676676 !strcmp(filter->filter->name, "channelmap") ||
677677 !strcmp(filter->filter->name, "channelsplit") ||
678+ !strcmp(filter->filter->name, "color" ) ||
678679 !strcmp(filter->filter->name, "colormatrix") ||
679680 !strcmp(filter->filter->name, "crop" ) ||
680681 !strcmp(filter->filter->name, "cropdetect") ||
libavfilter/vsrc_testsrc.c+24−16
@@ -75,22 +75,31 @@ typedef struct { · 74 unmodified lines
7575 #define OFFSET(x) offsetof(TestSourceContext, x)
7676 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
7777
78−static const AVOption options[] = {
79− { "size", "set video size", OFFSET(w), AV_OPT_TYPE_IMAGE_SIZE, {.str = "320x240"}, 0, 0, FLAGS },
80− { "s", "set video size", OFFSET(w), AV_OPT_TYPE_IMAGE_SIZE, {.str = "320x240"}, 0, 0, FLAGS },
81− { "rate", "set video rate", OFFSET(frame_rate), AV_OPT_TYPE_VIDEO_RATE, {.str = "25"}, 0, 0, FLAGS },
82− { "r", "set video rate", OFFSET(frame_rate), AV_OPT_TYPE_VIDEO_RATE, {.str = "25"}, 0, 0, FLAGS },
83− { "duration", "set video duration", OFFSET(duration_str), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, FLAGS },
84− { "d", "set video duration", OFFSET(duration_str), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, FLAGS },
78+#define COMMON_OPTIONS \
79+ { "size", "set video size", OFFSET(w), AV_OPT_TYPE_IMAGE_SIZE, {.str = "320x240"}, 0, 0, FLAGS },\
80+ { "s", "set video size", OFFSET(w), AV_OPT_TYPE_IMAGE_SIZE, {.str = "320x240"}, 0, 0, FLAGS },\
81+ { "rate", "set video rate", OFFSET(frame_rate), AV_OPT_TYPE_VIDEO_RATE, {.str = "25"}, 0, 0, FLAGS },\
82+ { "r", "set video rate", OFFSET(frame_rate), AV_OPT_TYPE_VIDEO_RATE, {.str = "25"}, 0, 0, FLAGS },\
83+ { "duration", "set video duration", OFFSET(duration_str), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, FLAGS },\
84+ { "d", "set video duration", OFFSET(duration_str), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, FLAGS },\
8585 { "sar", "set video sample aspect ratio", OFFSET(sar), AV_OPT_TYPE_RATIONAL, {.dbl= 1}, 0, INT_MAX, FLAGS },
8686
87+
88+static const AVOption color_options[] = {
8789 /* only used by color */
88− { "color", "set color", OFFSET(color_str), AV_OPT_TYPE_STRING, {.str = NULL}, CHAR_MIN, CHAR_MAX, FLAGS },
89− { "c", "set color", OFFSET(color_str), AV_OPT_TYPE_STRING, {.str = NULL}, CHAR_MIN, CHAR_MAX, FLAGS },
90+ { "color", "set color", OFFSET(color_str), AV_OPT_TYPE_STRING, {.str = "black"}, CHAR_MIN, CHAR_MAX, FLAGS },
91+ { "c", "set color", OFFSET(color_str), AV_OPT_TYPE_STRING, {.str = "black"}, CHAR_MIN, CHAR_MAX, FLAGS },
9092
93+ COMMON_OPTIONS
94+ { NULL },
95+};
96+
97+static const AVOption options[] = {
9198 /* only used by testsrc */
9299 { "decimals", "set number of decimals to show", OFFSET(nb_decimals), AV_OPT_TYPE_INT, {.i64=0}, 0, 17, FLAGS },
93100 { "n", "set number of decimals to show", OFFSET(nb_decimals), AV_OPT_TYPE_INT, {.i64=0}, 0, 17, FLAGS },
101+
102+ COMMON_OPTIONS
94103 { NULL },
95104 };
96105
@@ -99,8 +108,6 @@ static av_cold int init(AVFilterContext *ctx, const char *args) · 2 unmodified lines
99108 TestSourceContext *test = ctx->priv;
100109 int ret = 0;
101110
102− av_opt_set_defaults(test);
103−
104111 if ((ret = (av_set_options_string(test, args, "=", ":"))) < 0)
105112 return ret;
106113
@@ -200,7 +207,6 @@ static int request_frame(AVFilterLink *outlink) · 93 unmodified lines
200207
201208 #if CONFIG_COLOR_FILTER
202209
203−#define color_options options
204210 AVFILTER_DEFINE_CLASS(color);
205211
206212 static void color_fill_picture(AVFilterContext *ctx, AVFrame *picref)
@@ -214,11 +220,9 @@ static void color_fill_picture(AVFilterContext *ctx, AVFrame *picref) · 7 unmodified lines
214220 static av_cold int color_init(AVFilterContext *ctx, const char *args)
215221 {
216222 TestSourceContext *test = ctx->priv;
217− test->class = &color_class;
218223 test->fill_picture_fn = color_fill_picture;
219224 test->draw_once = 1;
220− av_opt_set(test, "color", "black", 0);
221− return init(ctx, args);
225+ return init(ctx, NULL);
222226 }
223227
224228 static int color_query_formats(AVFilterContext *ctx)
@@ -263,6 +267,7 @@ AVFilter avfilter_vsrc_color = { · 38 unmodified lines
263267 .name = "color",
264268 .description = NULL_IF_CONFIG_SMALL("Provide an uniformly colored input."),
265269
270+ .priv_class = &color_class,
266271 .priv_size = sizeof(TestSourceContext),
267272 .init = color_init,
268273 .uninit = uninit,
@@ -270,7 +275,6 @@ AVFilter avfilter_vsrc_color = { · 1 unmodified line
270275 .query_formats = color_query_formats,
271276 .inputs = NULL,
272277 .outputs = color_outputs,
273− .priv_class = &color_class,
274278 };
275279
276280 #endif /* CONFIG_COLOR_FILTER */
@@ -288,6 +292,7 @@ static av_cold int nullsrc_init(AVFilterContext *ctx, const char *args) · 11 unmodified lines
288292
289293 test->class = &nullsrc_class;
290294 test->fill_picture_fn = nullsrc_fill_picture;
295+ av_opt_set_defaults(test);
291296 return init(ctx, args);
292297 }
293298
@@ -507,6 +512,7 @@ static av_cold int test_init(AVFilterContext *ctx, const char *args) · 213 unmodified lines
507512
508513 test->class = &testsrc_class;
509514 test->fill_picture_fn = test_fill_picture;
515+ av_opt_set_defaults(test);
510516 return init(ctx, args);
511517 }
512518
@@ -613,6 +619,7 @@ static av_cold int rgbtest_init(AVFilterContext *ctx, const char *args) · 100 unmodified lines
613619 test->draw_once = 1;
614620 test->class = &rgbtestsrc_class;
615621 test->fill_picture_fn = rgbtest_fill_picture;
622+ av_opt_set_defaults(test);
616623 return init(ctx, args);
617624 }
618625
@@ -764,6 +771,7 @@ static av_cold int smptebars_init(AVFilterContext *ctx, const char *args) · 145 unmodified lines
764771 test->class = &smptebars_class;
765772 test->fill_picture_fn = smptebars_fill_picture;
766773 test->draw_once = 1;
774+ av_opt_set_defaults(test);
767775 return init(ctx, args);
768776 }
769777

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t