Commit e9ca55ae authored by Nicolas George's avatar Nicolas George

lavfi/af_volume: use standard options parsing.

parent e9f45a83
...@@ -59,14 +59,6 @@ AVFILTER_DEFINE_CLASS(volume); ...@@ -59,14 +59,6 @@ AVFILTER_DEFINE_CLASS(volume);
static av_cold int init(AVFilterContext *ctx, const char *args) static av_cold int init(AVFilterContext *ctx, const char *args)
{ {
VolumeContext *vol = ctx->priv; VolumeContext *vol = ctx->priv;
static const char *shorthand[] = { "volume", "precision", NULL };
int ret;
vol->class = &volume_class;
av_opt_set_defaults(vol);
if ((ret = av_opt_set_from_string(vol, args, shorthand, "=", ":")) < 0)
return ret;
if (vol->precision == PRECISION_FIXED) { if (vol->precision == PRECISION_FIXED) {
vol->volume_i = (int)(vol->volume * 256 + 0.5); vol->volume_i = (int)(vol->volume * 256 + 0.5);
...@@ -79,8 +71,7 @@ static av_cold int init(AVFilterContext *ctx, const char *args) ...@@ -79,8 +71,7 @@ static av_cold int init(AVFilterContext *ctx, const char *args)
precision_str[vol->precision]); precision_str[vol->precision]);
} }
av_opt_free(vol); return 0;
return ret;
} }
static int query_formats(AVFilterContext *ctx) static int query_formats(AVFilterContext *ctx)
...@@ -299,6 +290,8 @@ static const AVFilterPad avfilter_af_volume_outputs[] = { ...@@ -299,6 +290,8 @@ static const AVFilterPad avfilter_af_volume_outputs[] = {
{ NULL } { NULL }
}; };
static const char *const shorthand[] = { "volume", "precision", NULL };
AVFilter avfilter_af_volume = { AVFilter avfilter_af_volume = {
.name = "volume", .name = "volume",
.description = NULL_IF_CONFIG_SMALL("Change input volume."), .description = NULL_IF_CONFIG_SMALL("Change input volume."),
...@@ -308,4 +301,5 @@ AVFilter avfilter_af_volume = { ...@@ -308,4 +301,5 @@ AVFilter avfilter_af_volume = {
.inputs = avfilter_af_volume_inputs, .inputs = avfilter_af_volume_inputs,
.outputs = avfilter_af_volume_outputs, .outputs = avfilter_af_volume_outputs,
.priv_class = &volume_class, .priv_class = &volume_class,
.shorthand = shorthand,
}; };
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment