History

lavfi/removelogo: switch to an AVOptions-based system.

Clément Bœsch committed 13 years ago

Commit c1907bd1 parent 7f09b883 files · +25 −8Browse files

Showing the changes to libavfilter (2 of 3 files). Show all

Unified · Split

2 files
  1. libavfilter/avfilter.c +0 −1
  2. libavfilter/vf_removelogo.c +17 −3
libavfilter/avfilter.c+0−1
@@ -681,7 +681,6 @@ static const char *const filters_left_to_update[] = { · 680 unmodified lines
681681 "hue",
682682 "mp",
683683 "pan",
684− "removelogo",
685684 "scale",
686685 "setdar",
687686 "setsar",
libavfilter/vf_removelogo.c+17−3
@@ -70,6 +70,7 @@ · 69 unmodified lines
7070 */
7171
7272 #include "libavutil/imgutils.h"
73+#include "libavutil/opt.h"
7374 #include "avfilter.h"
7475 #include "formats.h"
7576 #include "internal.h"
@@ -79,6 +80,8 @@ · 3 unmodified lines
7980 #include "lswsutils.h"
8081
8182 typedef struct {
83+ const AVClass *class;
84+ char *filename;
8285 /* Stores our collection of masks. The first is for an array of
8386 the second for the y axis, and the third for the x axis. */
8487 int ***mask;
@@ -91,6 +94,16 @@ typedef struct { · 6 unmodified lines
9194 FFBoundingBox half_mask_bbox;
9295 } RemovelogoContext;
9396
97+#define OFFSET(x) offsetof(RemovelogoContext, x)
98+#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
99+static const AVOption removelogo_options[] = {
100+ { "filename", "set bitmap filename", OFFSET(filename), AV_OPT_TYPE_STRING, {.str=NULL}, .flags = FLAGS },
101+ { "f", "set bitmap filename", OFFSET(filename), AV_OPT_TYPE_STRING, {.str=NULL}, .flags = FLAGS },
102+ { NULL }
103+};
104+
105+AVFILTER_DEFINE_CLASS(removelogo);
106+
94107 /**
95108 * Choose a slightly larger mask size to improve performance.
96109 *
@@ -272,13 +285,13 @@ static av_cold int init(AVFilterContext *ctx, const char *args) · 175 unmodified lines
272285 int a, b, c, w, h;
273286 int full_max_mask_size, half_max_mask_size;
274287
275− if (!args) {
276− av_log(ctx, AV_LOG_ERROR, "An image file must be specified as argument\n");
288+ if (!removelogo->filename) {
289+ av_log(ctx, AV_LOG_ERROR, "The bitmap file name is mandatory\n");
277290 return AVERROR(EINVAL);
278291 }
279292
280293 /* Load our mask image. */
281− if ((ret = load_mask(&removelogo->full_mask_data, &w, &h, args, ctx)) < 0)
294+ if ((ret = load_mask(&removelogo->full_mask_data, &w, &h, removelogo->filename, ctx)) < 0)
282295 return ret;
283296 removelogo->mask_w = w;
284297 removelogo->mask_h = h;
@@ -564,4 +577,5 @@ AVFilter avfilter_vf_removelogo = { · 279 unmodified lines
564577 .query_formats = query_formats,
565578 .inputs = removelogo_inputs,
566579 .outputs = removelogo_outputs,
580+ .priv_class = &removelogo_class,
567581 };

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