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
681 "hue",681 "hue",
682 "mp",682 "mp",
683 "pan",683 "pan",
684 "removelogo",
685 "scale",684 "scale",
686 "setdar",685 "setdar",
687 "setsar",686 "setsar",
libavfilter/vf_removelogo.c+17−3
@@ -70,6 +70,7 @@ · 69 unmodified lines
70 */70 */
71 71
72#include "libavutil/imgutils.h"72#include "libavutil/imgutils.h"
73#include "libavutil/opt.h"
73#include "avfilter.h"74#include "avfilter.h"
74#include "formats.h"75#include "formats.h"
75#include "internal.h"76#include "internal.h"
@@ -79,6 +80,8 @@ · 3 unmodified lines
79#include "lswsutils.h"80#include "lswsutils.h"
80 81
81typedef struct {82typedef struct {
83 const AVClass *class;
84 char *filename;
82 /* Stores our collection of masks. The first is for an array of85 /* Stores our collection of masks. The first is for an array of
83 the second for the y axis, and the third for the x axis. */86 the second for the y axis, and the third for the x axis. */
84 int ***mask;87 int ***mask;
@@ -91,6 +94,16 @@ typedef struct { · 6 unmodified lines
91 FFBoundingBox half_mask_bbox;94 FFBoundingBox half_mask_bbox;
92} RemovelogoContext;95} RemovelogoContext;
93 96
97#define OFFSET(x) offsetof(RemovelogoContext, x)
98#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
99static 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
105AVFILTER_DEFINE_CLASS(removelogo);
106
94/**107/**
95 * Choose a slightly larger mask size to improve performance.108 * Choose a slightly larger mask size to improve performance.
96 *109 *
@@ -272,13 +285,13 @@ static av_cold int init(AVFilterContext *ctx, const char *args) · 175 unmodified lines
272 int a, b, c, w, h;285 int a, b, c, w, h;
273 int full_max_mask_size, half_max_mask_size;286 int full_max_mask_size, half_max_mask_size;
274 287
275 if (!args) {288 if (!removelogo->filename) {
276 av_log(ctx, AV_LOG_ERROR, "An image file must be specified as argument\n");289 av_log(ctx, AV_LOG_ERROR, "The bitmap file name is mandatory\n");
277 return AVERROR(EINVAL);290 return AVERROR(EINVAL);
278 }291 }
279 292
280 /* Load our mask image. */293 /* 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)
282 return ret;295 return ret;
283 removelogo->mask_w = w;296 removelogo->mask_w = w;
284 removelogo->mask_h = h;297 removelogo->mask_h = h;
@@ -564,4 +577,5 @@ AVFilter avfilter_vf_removelogo = { · 279 unmodified lines
564 .query_formats = query_formats,577 .query_formats = query_formats,
565 .inputs = removelogo_inputs,578 .inputs = removelogo_inputs,
566 .outputs = removelogo_outputs,579 .outputs = removelogo_outputs,
580 .priv_class = &removelogo_class,
567};581};

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