af_volume: switch to an AVOptions-based system.

This commit is contained in:
Anton Khirnov 2013-02-25 21:21:29 +01:00
parent dd7fc37c71
commit b13623e184
1 changed files with 2 additions and 11 deletions

View File

@ -63,15 +63,6 @@ static const AVClass volume_class = {
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;
int ret;
vol->class = &volume_class;
av_opt_set_defaults(vol);
if ((ret = av_set_options_string(vol, args, "=", ":")) < 0) {
av_log(ctx, AV_LOG_ERROR, "Error parsing options string '%s'.\n", args);
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);
@ -84,8 +75,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)
@ -311,6 +301,7 @@ AVFilter avfilter_af_volume = {
.description = NULL_IF_CONFIG_SMALL("Change input volume."), .description = NULL_IF_CONFIG_SMALL("Change input volume."),
.query_formats = query_formats, .query_formats = query_formats,
.priv_size = sizeof(VolumeContext), .priv_size = sizeof(VolumeContext),
.priv_class = &volume_class,
.init = init, .init = init,
.inputs = avfilter_af_volume_inputs, .inputs = avfilter_af_volume_inputs,
.outputs = avfilter_af_volume_outputs, .outputs = avfilter_af_volume_outputs,