Showing the changes to libavfilter (2 of 3 files). Show all
Unified · Split
| @@ -681,7 +681,6 @@ static const char *const filters_left_to_update[] = { · 680 unmodified lines | ||
| 681 | 681 | "hue", |
| 682 | 682 | "mp", |
| 683 | 683 | "pan", |
| 684 | − "removelogo", | |
| 685 | 684 | "scale", |
| 686 | 685 | "setdar", |
| 687 | 686 | "setsar", |
| @@ -70,6 +70,7 @@ · 69 unmodified lines | ||
| 70 | 70 | */ |
| 71 | 71 | |
| 72 | 72 | #include "libavutil/imgutils.h" |
| 73 | +#include "libavutil/opt.h" | |
| 73 | 74 | #include "avfilter.h" |
| 74 | 75 | #include "formats.h" |
| 75 | 76 | #include "internal.h" |
| @@ -79,6 +80,8 @@ · 3 unmodified lines | ||
| 79 | 80 | #include "lswsutils.h" |
| 80 | 81 | |
| 81 | 82 | typedef struct { |
| 83 | + const AVClass *class; | |
| 84 | + char *filename; | |
| 82 | 85 | /* Stores our collection of masks. The first is for an array of |
| 83 | 86 | the second for the y axis, and the third for the x axis. */ |
| 84 | 87 | int ***mask; |
| @@ -91,6 +94,16 @@ typedef struct { · 6 unmodified lines | ||
| 91 | 94 | FFBoundingBox half_mask_bbox; |
| 92 | 95 | } RemovelogoContext; |
| 93 | 96 | |
| 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 | + | |
| 94 | 107 | /** |
| 95 | 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 | 285 | int a, b, c, w, h; |
| 273 | 286 | int full_max_mask_size, half_max_mask_size; |
| 274 | 287 | |
| 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"); | |
| 277 | 290 | return AVERROR(EINVAL); |
| 278 | 291 | } |
| 279 | 292 | |
| 280 | 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 | 295 | return ret; |
| 283 | 296 | removelogo->mask_w = w; |
| 284 | 297 | removelogo->mask_h = h; |
| @@ -564,4 +577,5 @@ AVFilter avfilter_vf_removelogo = { · 279 unmodified lines | ||
| 564 | 577 | .query_formats = query_formats, |
| 565 | 578 | .inputs = removelogo_inputs, |
| 566 | 579 | .outputs = removelogo_outputs, |
| 580 | + .priv_class = &removelogo_class, | |
| 567 | 581 | }; |