summaryrefslogtreecommitdiffstats
path: root/audio
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-03-29 22:29:13 +0100
committerwm4 <wm4@nowhere>2013-04-13 04:21:29 +0200
commitff6342a3112e194c228660516cc19dd1ce4de6d9 (patch)
tree18ad0ee9f5ff0104d7f4fbede14249c5c02c21d7 /audio
parentabd5e8a2e774f20d78a901faac64fe74fdc7b040 (diff)
downloadmpv-ff6342a3112e194c228660516cc19dd1ce4de6d9.tar.bz2
mpv-ff6342a3112e194c228660516cc19dd1ce4de6d9.tar.xz
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.
Diffstat (limited to 'audio')
-rw-r--r--audio/filter/af_lavrresample.c7
1 files changed, 6 insertions, 1 deletions
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;