summaryrefslogtreecommitdiff
path: root/libavfilter/vf_removelogo.c
diff options
context:
space:
mode:
authorClément Bœsch <ubitux@gmail.com>2013-04-11 18:49:46 +0200
committerClément Bœsch <ubitux@gmail.com>2013-04-11 18:49:46 +0200
commitc1907bd732c026ad5b9464d3fd41ae7ebad0ee59 (patch)
tree534cea3c9cbaeb7f73616b6ebe6f27a80da958fd /libavfilter/vf_removelogo.c
parent7f09b888e88dcf063810378d411fa92ebbd7c36a (diff)
downloadffmpeg-c1907bd732c026ad5b9464d3fd41ae7ebad0ee59.tar.gz
lavfi/removelogo: switch to an AVOptions-based system.
Diffstat (limited to 'libavfilter/vf_removelogo.c')
-rw-r--r--libavfilter/vf_removelogo.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/libavfilter/vf_removelogo.c b/libavfilter/vf_removelogo.c
index e3da1970ba..7ca7f30a34 100644
--- a/libavfilter/vf_removelogo.c
+++ b/libavfilter/vf_removelogo.c
@@ -70,6 +70,7 @@
*/
#include "libavutil/imgutils.h"
+#include "libavutil/opt.h"
#include "avfilter.h"
#include "formats.h"
#include "internal.h"
@@ -79,6 +80,8 @@
#include "lswsutils.h"
typedef struct {
+ const AVClass *class;
+ char *filename;
/* Stores our collection of masks. The first is for an array of
the second for the y axis, and the third for the x axis. */
int ***mask;
@@ -91,6 +94,16 @@ typedef struct {
FFBoundingBox half_mask_bbox;
} RemovelogoContext;
+#define OFFSET(x) offsetof(RemovelogoContext, x)
+#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
+static const AVOption removelogo_options[] = {
+ { "filename", "set bitmap filename", OFFSET(filename), AV_OPT_TYPE_STRING, {.str=NULL}, .flags = FLAGS },
+ { "f", "set bitmap filename", OFFSET(filename), AV_OPT_TYPE_STRING, {.str=NULL}, .flags = FLAGS },
+ { NULL }
+};
+
+AVFILTER_DEFINE_CLASS(removelogo);
+
/**
* Choose a slightly larger mask size to improve performance.
*
@@ -272,13 +285,13 @@ static av_cold int init(AVFilterContext *ctx, const char *args)
int a, b, c, w, h;
int full_max_mask_size, half_max_mask_size;
- if (!args) {
- av_log(ctx, AV_LOG_ERROR, "An image file must be specified as argument\n");
+ if (!removelogo->filename) {
+ av_log(ctx, AV_LOG_ERROR, "The bitmap file name is mandatory\n");
return AVERROR(EINVAL);
}
/* Load our mask image. */
- if ((ret = load_mask(&removelogo->full_mask_data, &w, &h, args, ctx)) < 0)
+ if ((ret = load_mask(&removelogo->full_mask_data, &w, &h, removelogo->filename, ctx)) < 0)
return ret;
removelogo->mask_w = w;
removelogo->mask_h = h;
@@ -564,4 +577,5 @@ AVFilter avfilter_vf_removelogo = {
.query_formats = query_formats,
.inputs = removelogo_inputs,
.outputs = removelogo_outputs,
+ .priv_class = &removelogo_class,
};