diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-04-10 17:13:29 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-04-10 17:36:29 +0200 |
commit | 1c3cdf533ba0f47e70b166b335fe3282264950d7 (patch) | |
tree | 7ad99a625ca16927836d686159ac6ec7aedbf12e /libavfilter/vf_cropdetect.c | |
parent | 200e04c70f9a77fd117d4ebb9d0fad9656514979 (diff) | |
parent | 460e7b4f6d473d9f03ed45501221f9cb209b28fd (diff) | |
download | ffmpeg-1c3cdf533ba0f47e70b166b335fe3282264950d7.tar.gz |
Merge commit '460e7b4f6d473d9f03ed45501221f9cb209b28fd'
* commit '460e7b4f6d473d9f03ed45501221f9cb209b28fd':
vf_cropdetect: switch to an AVOptions-based system.
Conflicts:
doc/filters.texi
libavfilter/vf_cropdetect.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavfilter/vf_cropdetect.c')
-rw-r--r-- | libavfilter/vf_cropdetect.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/libavfilter/vf_cropdetect.c b/libavfilter/vf_cropdetect.c index 7c0af7323e..b721f70df5 100644 --- a/libavfilter/vf_cropdetect.c +++ b/libavfilter/vf_cropdetect.c @@ -26,6 +26,7 @@ #include "libavutil/imgutils.h" #include "libavutil/internal.h" #include "libavutil/opt.h" + #include "avfilter.h" #include "formats.h" #include "internal.h" @@ -41,18 +42,6 @@ typedef struct { int max_pixsteps[4]; } CropDetectContext; -#define OFFSET(x) offsetof(CropDetectContext, x) -#define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM - -static const AVOption cropdetect_options[] = { - { "limit", "set black threshold", OFFSET(limit), AV_OPT_TYPE_INT, {.i64=24}, 0, 255, FLAGS }, - { "round", "set width/height round value", OFFSET(round), AV_OPT_TYPE_INT, {.i64=16}, 0, INT_MAX, FLAGS }, - { "reset_count", "set after how many frames to reset detected info", OFFSET(reset_count), AV_OPT_TYPE_INT, {.i64=0}, 0, INT_MAX, FLAGS }, - { NULL } -}; - -AVFILTER_DEFINE_CLASS(cropdetect); - static int query_formats(AVFilterContext *ctx) { static const enum AVPixelFormat pix_fmts[] = { @@ -100,6 +89,7 @@ static av_cold int init(AVFilterContext *ctx, const char *args) CropDetectContext *cd = ctx->priv; cd->frame_nb = -2; + av_log(ctx, AV_LOG_VERBOSE, "limit:%d round:%d reset_count:%d\n", cd->limit, cd->round, cd->reset_count); @@ -201,6 +191,19 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) return ff_filter_frame(inlink->dst->outputs[0], frame); } +#define OFFSET(x) offsetof(CropDetectContext, x) +#define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM + +static const AVOption cropdetect_options[] = { + { "limit", "Threshold below which the pixel is considered black", OFFSET(limit), AV_OPT_TYPE_INT, { .i64 = 24 }, 0, 255, FLAGS }, + { "round", "Value by which the width/height should be divisible", OFFSET(round), AV_OPT_TYPE_INT, { .i64 = 16 }, 0, INT_MAX, FLAGS }, + { "reset", "Recalculate the crop area after this many frames", OFFSET(reset_count), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, FLAGS }, + { "reset_count", "Recalculate the crop area after this many frames",OFFSET(reset_count),AV_OPT_TYPE_INT,{ .i64 = 0 }, 0, INT_MAX, FLAGS }, + { NULL }, +}; + +AVFILTER_DEFINE_CLASS(cropdetect); + static const AVFilterPad avfilter_vf_cropdetect_inputs[] = { { .name = "default", @@ -220,17 +223,14 @@ static const AVFilterPad avfilter_vf_cropdetect_outputs[] = { { NULL } }; -static const char *const shorthand[] = { "limit", "round", "reset_count", NULL }; - AVFilter avfilter_vf_cropdetect = { .name = "cropdetect", .description = NULL_IF_CONFIG_SMALL("Auto-detect crop size."), .priv_size = sizeof(CropDetectContext), + .priv_class = &cropdetect_class, .init = init, .query_formats = query_formats, .inputs = avfilter_vf_cropdetect_inputs, .outputs = avfilter_vf_cropdetect_outputs, - .priv_class = &cropdetect_class, - .shorthand = shorthand, }; |