aboutsummaryrefslogtreecommitdiffstats
path: root/libavfilter/vf_drawbox.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-04-10 18:11:15 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-04-10 18:11:15 +0200
commit0726d516dcd1e12d493b402bbe256d8c4b50acc6 (patch)
tree7d4e275fa24f50688aadf3a91771cc2c0f5b837e /libavfilter/vf_drawbox.c
parent215ca864759a54f45265a51ac57dbfd75cb23da2 (diff)
parent335c31293baec6e6cf5907bd29840af3de8ff735 (diff)
downloadffmpeg-0726d516dcd1e12d493b402bbe256d8c4b50acc6.tar.gz
Merge commit '335c31293baec6e6cf5907bd29840af3de8ff735'
* commit '335c31293baec6e6cf5907bd29840af3de8ff735': vf_drawbox: switch to an AVOptions-based system. Conflicts: doc/filters.texi libavfilter/vf_drawbox.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavfilter/vf_drawbox.c')
-rw-r--r--libavfilter/vf_drawbox.c43
1 files changed, 20 insertions, 23 deletions
diff --git a/libavfilter/vf_drawbox.c b/libavfilter/vf_drawbox.c
index b831182c8b..c575b2fa56 100644
--- a/libavfilter/vf_drawbox.c
+++ b/libavfilter/vf_drawbox.c
@@ -45,25 +45,6 @@ typedef struct {
int vsub, hsub; ///< chroma subsampling
} DrawBoxContext;
-#define OFFSET(x) offsetof(DrawBoxContext, x)
-#define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
-
-static const AVOption drawbox_options[] = {
- { "x", "set the box top-left corner x position", OFFSET(x), AV_OPT_TYPE_INT, {.i64=0}, INT_MIN, INT_MAX, FLAGS },
- { "y", "set the box top-left corner y position", OFFSET(y), AV_OPT_TYPE_INT, {.i64=0}, INT_MIN, INT_MAX, FLAGS },
- { "width", "set the box width", OFFSET(w), AV_OPT_TYPE_INT, {.i64=0}, 0, INT_MAX, FLAGS },
- { "w", "set the box width", OFFSET(w), AV_OPT_TYPE_INT, {.i64=0}, 0, INT_MAX, FLAGS },
- { "height", "set the box height", OFFSET(h), AV_OPT_TYPE_INT, {.i64=0}, 0, INT_MAX, FLAGS },
- { "h", "set the box height", OFFSET(h), AV_OPT_TYPE_INT, {.i64=0}, 0, INT_MAX, FLAGS },
- { "color", "set the box edge color", OFFSET(color_str), AV_OPT_TYPE_STRING, {.str="black"}, CHAR_MIN, CHAR_MAX, FLAGS },
- { "c", "set the box edge color", OFFSET(color_str), AV_OPT_TYPE_STRING, {.str="black"}, CHAR_MIN, CHAR_MAX, FLAGS },
- { "thickness", "set the box maximum thickness", OFFSET(thickness), AV_OPT_TYPE_INT, {.i64=4}, 0, INT_MAX, FLAGS },
- { "t", "set the box maximum thickness", OFFSET(thickness), AV_OPT_TYPE_INT, {.i64=4}, 0, INT_MAX, FLAGS },
- {NULL},
-};
-
-AVFILTER_DEFINE_CLASS(drawbox);
-
static av_cold int init(AVFilterContext *ctx, const char *args)
{
DrawBoxContext *drawbox = ctx->priv;
@@ -151,6 +132,25 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
return ff_filter_frame(inlink->dst->outputs[0], frame);
}
+#define OFFSET(x) offsetof(DrawBoxContext, x)
+#define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
+
+static const AVOption drawbox_options[] = {
+ { "x", "Horizontal position of the left box edge", OFFSET(x), AV_OPT_TYPE_INT, { .i64 = 0 }, INT_MIN, INT_MAX, FLAGS },
+ { "y", "Vertical position of the top box edge", OFFSET(y), AV_OPT_TYPE_INT, { .i64 = 0 }, INT_MIN, INT_MAX, FLAGS },
+ { "width", "Width of the box", OFFSET(w), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, FLAGS },
+ { "w", "Width of the box", OFFSET(w), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, FLAGS },
+ { "height", "Height of the box", OFFSET(h), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, FLAGS },
+ { "h", "Height of the box", OFFSET(h), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, FLAGS },
+ { "color", "Color of the box", OFFSET(color_str), AV_OPT_TYPE_STRING, { .str = "black" }, CHAR_MIN, CHAR_MAX, .flags = FLAGS },
+ { "c", "Color of the box", OFFSET(color_str), AV_OPT_TYPE_STRING, { .str = "black" }, CHAR_MIN, CHAR_MAX, .flags = FLAGS },
+ { "thickness", "set the box maximum thickness", OFFSET(thickness), AV_OPT_TYPE_INT, {.i64=4}, 0, INT_MAX, FLAGS },
+ { "t", "set the box maximum thickness", OFFSET(thickness), AV_OPT_TYPE_INT, {.i64=4}, 0, INT_MAX, FLAGS },
+ { NULL },
+};
+
+AVFILTER_DEFINE_CLASS(drawbox);
+
static const AVFilterPad avfilter_vf_drawbox_inputs[] = {
{
.name = "default",
@@ -171,17 +171,14 @@ static const AVFilterPad avfilter_vf_drawbox_outputs[] = {
{ NULL }
};
-static const char *const shorthand[] = { "x", "y", "w", "h", "color", "thickness", NULL };
-
AVFilter avfilter_vf_drawbox = {
.name = "drawbox",
.description = NULL_IF_CONFIG_SMALL("Draw a colored box on the input video."),
.priv_size = sizeof(DrawBoxContext),
+ .priv_class = &drawbox_class,
.init = init,
.query_formats = query_formats,
.inputs = avfilter_vf_drawbox_inputs,
.outputs = avfilter_vf_drawbox_outputs,
- .priv_class = &drawbox_class,
- .shorthand = shorthand,
};