summaryrefslogtreecommitdiffstats
path: root/audio/filter/af_lavfi.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-11-10 23:39:29 +0100
committerwm4 <wm4@nowhere>2013-11-12 23:34:35 +0100
commit824e6550f8ef1f361701eae469ada35d3889ab83 (patch)
tree7170184cfcdce814fde9308941fd2b4ff74d126c /audio/filter/af_lavfi.c
parent7510caa0c5ef3db320d1065f869d14c0eddecf79 (diff)
downloadmpv-824e6550f8ef1f361701eae469ada35d3889ab83.tar.bz2
mpv-824e6550f8ef1f361701eae469ada35d3889ab83.tar.xz
audio/filter: fix mul/delay scale and values
Before this commit, the af_instance->mul/delay values were in bytes. Using bytes is confusing for non-interleaved audio, so switch mul to samples, and delay to seconds. For delay, seconds are more intuitive than bytes or samples, because it's used for the latency calculation. We also might want to replace the delay mechanism with real PTS tracking inside the filter chain some time in the future, and PTS will also require time-adjustments to be done in seconds. For most filters, we just remove the redundant mul=1 initialization. (Setting this used to be required, but not anymore.)
Diffstat (limited to 'audio/filter/af_lavfi.c')
-rw-r--r--audio/filter/af_lavfi.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/audio/filter/af_lavfi.c b/audio/filter/af_lavfi.c
index e77110c067..24ff8c5985 100644
--- a/audio/filter/af_lavfi.c
+++ b/audio/filter/af_lavfi.c
@@ -197,7 +197,8 @@ static int control(struct af_instance *af, int cmd, void *arg)
p->timebase_out = l_out->time_base;
- af->mul = (double) (out->rate * out->nch) / (in->rate * in->nch);
+ // Blatantly incorrect; we don't know what the filters do.
+ af->mul = out->rate / (double)in->rate;
return mp_audio_config_equals(in, &orig_in) ? AF_OK : AF_FALSE;
}
@@ -270,7 +271,7 @@ static struct mp_audio *play(struct af_instance *af, struct mp_audio *data)
// Need pts past the last output sample.
out_time += r->samples / (double)r->rate;
- af->delay = (in_time - out_time) * r->rate * r->sstride;
+ af->delay = in_time - out_time;
}
*data = *r;
@@ -286,7 +287,6 @@ static int af_open(struct af_instance *af)
af->control = control;
af->uninit = uninit;
af->play = play;
- af->mul = 1;
struct priv *priv = af->priv;
af->data = talloc_zero(priv, struct mp_audio),
// Removing this requires fixing AVFrame.data vs. AVFrame.extended_data