mirror of https://git.ffmpeg.org/ffmpeg.git
lavfi/cropdetect: use standard options parsing.
This commit is contained in:
parent
a36d903601
commit
1341dd2dd0
|
@ -98,28 +98,14 @@ static int checkline(void *ctx, const unsigned char *src, int stride, int len, i
|
||||||
static av_cold int init(AVFilterContext *ctx, const char *args)
|
static av_cold int init(AVFilterContext *ctx, const char *args)
|
||||||
{
|
{
|
||||||
CropDetectContext *cd = ctx->priv;
|
CropDetectContext *cd = ctx->priv;
|
||||||
static const char *shorthand[] = { "limit", "round", "reset_count", NULL };
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
cd->frame_nb = -2;
|
cd->frame_nb = -2;
|
||||||
cd->class = &cropdetect_class;
|
|
||||||
av_opt_set_defaults(cd);
|
|
||||||
|
|
||||||
if ((ret = av_opt_set_from_string(cd, args, shorthand, "=", ":")) < 0)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
av_log(ctx, AV_LOG_VERBOSE, "limit:%d round:%d reset_count:%d\n",
|
av_log(ctx, AV_LOG_VERBOSE, "limit:%d round:%d reset_count:%d\n",
|
||||||
cd->limit, cd->round, cd->reset_count);
|
cd->limit, cd->round, cd->reset_count);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static av_cold void uninit(AVFilterContext *ctx)
|
|
||||||
{
|
|
||||||
CropDetectContext *cd = ctx->priv;
|
|
||||||
av_opt_free(cd);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int config_input(AVFilterLink *inlink)
|
static int config_input(AVFilterLink *inlink)
|
||||||
{
|
{
|
||||||
AVFilterContext *ctx = inlink->dst;
|
AVFilterContext *ctx = inlink->dst;
|
||||||
|
@ -234,15 +220,17 @@ static const AVFilterPad avfilter_vf_cropdetect_outputs[] = {
|
||||||
{ NULL }
|
{ NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const char *const shorthand[] = { "limit", "round", "reset_count", NULL };
|
||||||
|
|
||||||
AVFilter avfilter_vf_cropdetect = {
|
AVFilter avfilter_vf_cropdetect = {
|
||||||
.name = "cropdetect",
|
.name = "cropdetect",
|
||||||
.description = NULL_IF_CONFIG_SMALL("Auto-detect crop size."),
|
.description = NULL_IF_CONFIG_SMALL("Auto-detect crop size."),
|
||||||
|
|
||||||
.priv_size = sizeof(CropDetectContext),
|
.priv_size = sizeof(CropDetectContext),
|
||||||
.init = init,
|
.init = init,
|
||||||
.uninit = uninit,
|
|
||||||
.query_formats = query_formats,
|
.query_formats = query_formats,
|
||||||
.inputs = avfilter_vf_cropdetect_inputs,
|
.inputs = avfilter_vf_cropdetect_inputs,
|
||||||
.outputs = avfilter_vf_cropdetect_outputs,
|
.outputs = avfilter_vf_cropdetect_outputs,
|
||||||
.priv_class = &cropdetect_class,
|
.priv_class = &cropdetect_class,
|
||||||
|
.shorthand = shorthand,
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue