From ff6342a3112e194c228660516cc19dd1ce4de6d9 Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 29 Mar 2013 22:29:13 +0100 Subject: af_lavrresample: add no-detach suboption Normally, af_lavrresample detaches itself immediately if the input and output audio parameters are the same. no-detach prevents this. --- audio/filter/af_lavrresample.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'audio') diff --git a/audio/filter/af_lavrresample.c b/audio/filter/af_lavrresample.c index 1d3b7639bd..2dd2c613c7 100644 --- a/audio/filter/af_lavrresample.c +++ b/audio/filter/af_lavrresample.c @@ -67,6 +67,7 @@ struct af_resample_opts { }; struct af_resample { + int allow_detach; struct AVAudioResampleContext *avrctx; struct af_resample_opts ctx; // opts in the context struct af_resample_opts opts; // opts requested by the user @@ -128,7 +129,8 @@ static int control(struct af_instance *af, int cmd, void *arg) if (((out->rate == in->rate) || (out->rate == 0)) && (out->format == in->format) && (out->bps == in->bps) && - ((out->nch == in->nch) || out->nch == 0)) + ((out->nch == in->nch) || out->nch == 0) && + s->allow_detach) return AF_DETACH; if (out->rate == 0) @@ -224,6 +226,7 @@ static int control(struct af_instance *af, int cmd, void *arg) {"phase_shift", OPT_ARG_INT, &s->opts.phase_shift, NULL}, {"linear", OPT_ARG_BOOL, &s->opts.linear, NULL}, {"cutoff", OPT_ARG_FLOAT, &s->opts.cutoff, NULL}, + {"detach", OPT_ARG_BOOL, &s->allow_detach, NULL}, {0} }; @@ -307,6 +310,8 @@ static int af_open(struct af_instance *af) .phase_shift = 10, }; + s->allow_detach = 1; + s->avrctx = avresample_alloc_context(); af->setup = s; -- cgit v1.2.3