mirror of https://github.com/mpv-player/mpv
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.
This commit is contained in:
parent
abd5e8a2e7
commit
ff6342a311
|
@ -50,6 +50,11 @@ lavrresample[=option1:option2:...]
|
||||||
linear
|
linear
|
||||||
if set then filters will be linearly interpolated between polyphase
|
if set then filters will be linearly interpolated between polyphase
|
||||||
entries (default: no)
|
entries (default: no)
|
||||||
|
no-detach
|
||||||
|
don't detach if input and output audio format/rate/channels are the
|
||||||
|
same. You should add this option if you specify additional parameters,
|
||||||
|
as automatically inserted lavrresample instances will use the
|
||||||
|
default settings.
|
||||||
|
|
||||||
lavcac3enc[=tospdif[:bitrate[:minchn]]]
|
lavcac3enc[=tospdif[:bitrate[:minchn]]]
|
||||||
Encode multi-channel audio to AC-3 at runtime using libavcodec. Supports
|
Encode multi-channel audio to AC-3 at runtime using libavcodec. Supports
|
||||||
|
|
|
@ -67,6 +67,7 @@ struct af_resample_opts {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct af_resample {
|
struct af_resample {
|
||||||
|
int allow_detach;
|
||||||
struct AVAudioResampleContext *avrctx;
|
struct AVAudioResampleContext *avrctx;
|
||||||
struct af_resample_opts ctx; // opts in the context
|
struct af_resample_opts ctx; // opts in the context
|
||||||
struct af_resample_opts opts; // opts requested by the user
|
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)) &&
|
if (((out->rate == in->rate) || (out->rate == 0)) &&
|
||||||
(out->format == in->format) &&
|
(out->format == in->format) &&
|
||||||
(out->bps == in->bps) &&
|
(out->bps == in->bps) &&
|
||||||
((out->nch == in->nch) || out->nch == 0))
|
((out->nch == in->nch) || out->nch == 0) &&
|
||||||
|
s->allow_detach)
|
||||||
return AF_DETACH;
|
return AF_DETACH;
|
||||||
|
|
||||||
if (out->rate == 0)
|
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},
|
{"phase_shift", OPT_ARG_INT, &s->opts.phase_shift, NULL},
|
||||||
{"linear", OPT_ARG_BOOL, &s->opts.linear, NULL},
|
{"linear", OPT_ARG_BOOL, &s->opts.linear, NULL},
|
||||||
{"cutoff", OPT_ARG_FLOAT, &s->opts.cutoff, NULL},
|
{"cutoff", OPT_ARG_FLOAT, &s->opts.cutoff, NULL},
|
||||||
|
{"detach", OPT_ARG_BOOL, &s->allow_detach, NULL},
|
||||||
{0}
|
{0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -307,6 +310,8 @@ static int af_open(struct af_instance *af)
|
||||||
.phase_shift = 10,
|
.phase_shift = 10,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
s->allow_detach = 1;
|
||||||
|
|
||||||
s->avrctx = avresample_alloc_context();
|
s->avrctx = avresample_alloc_context();
|
||||||
af->setup = s;
|
af->setup = s;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue