summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-01-13 20:14:02 +0100
committerwm4 <wm4@nowhere>2015-01-13 20:14:02 +0100
commit0bbd65b09cb80ee6a822b27a53e7ddfd5d249cf2 (patch)
treeedf7dcb12a658c2606653cb3b2dcaa3ac3acda99
parent9418f884750e2837c51dea9bd300a5e4b3a8f16c (diff)
downloadmpv-0bbd65b09cb80ee6a822b27a53e7ddfd5d249cf2.tar.bz2
mpv-0bbd65b09cb80ee6a822b27a53e7ddfd5d249cf2.tar.xz
audio/filter: remove unused af_calc_filter_multiplier()
The purpose of this function was to filter only as much audio input as needed to produce a certain amount of audio output. This could (in theory) avoid excessive buffering when e.g. changing playback speed with resampling. Use of this was already removed in commit 5fd8a1e0. No problems were experienced, so let's assume this feature is practically worthless. (Though it's possible that it was quite useful over a decade ago, or in some cornercases with evil files.)
-rw-r--r--audio/filter/af.c17
-rw-r--r--audio/filter/af.h4
-rw-r--r--audio/filter/af_lavcac3enc.c5
-rw-r--r--audio/filter/af_lavfi.c3
-rw-r--r--audio/filter/af_lavrresample.c2
-rw-r--r--audio/filter/af_scaletempo.c2
6 files changed, 2 insertions, 31 deletions
diff --git a/audio/filter/af.c b/audio/filter/af.c
index 365f5c46fb..d541687001 100644
--- a/audio/filter/af.c
+++ b/audio/filter/af.c
@@ -195,7 +195,6 @@ static struct af_instance *af_create(struct af_stream *s, char *name,
struct af_instance *af = talloc_zero(NULL, struct af_instance);
*af = (struct af_instance) {
.info = info,
- .mul = 1,
.data = talloc_zero(af, struct mp_audio),
.log = mp_log_new(af, s->log, name),
.replaygain_data = s->replaygain_data,
@@ -596,7 +595,6 @@ struct af_stream *af_new(struct mpv_global *global)
.filter = dummy_filter,
.priv = s,
.data = &s->input,
- .mul = 1.0,
};
static const struct af_info out = { .name = "out" };
s->last = talloc(s, struct af_instance);
@@ -606,7 +604,6 @@ struct af_stream *af_new(struct mpv_global *global)
.filter = dummy_filter,
.priv = s,
.data = &s->filter_output,
- .mul = 1.0,
};
s->first->next = s->last;
s->last->prev = s->first;
@@ -758,20 +755,6 @@ done:
return r;
}
-// Calculate average ratio of filter output samples to input samples.
-// e.g: num_output_samples = mul * num_input_samples
-double af_calc_filter_multiplier(struct af_stream *s)
-{
- struct af_instance *af = s->first;
- double mul = 1;
- do {
- mul *= af->mul;
- af = af->next;
- } while (af);
-
- return mul;
-}
-
/* Calculate the total delay [seconds of output] caused by the filters */
double af_calc_delay(struct af_stream *s)
{
diff --git a/audio/filter/af.h b/audio/filter/af.h
index 682cdb93e3..96758a0cc9 100644
--- a/audio/filter/af.h
+++ b/audio/filter/af.h
@@ -72,9 +72,6 @@ struct af_instance {
struct af_instance *prev;
double delay; /* Delay caused by the filter, in seconds of audio consumed
* without corresponding output */
- double mul; /* length multiplier: how much does this instance change
- * the number of samples passed though. (Ratio of input
- * and output, e.g. mul=4 => 1 sample becomes 4 samples) .*/
bool auto_inserted; // inserted by af.c, such as conversion filters
char *label;
};
@@ -142,7 +139,6 @@ int af_filter(struct af_stream *s, struct mp_audio *data,
struct af_instance *af_control_any_rev(struct af_stream *s, int cmd, void *arg);
void af_control_all(struct af_stream *s, int cmd, void *arg);
-double af_calc_filter_multiplier(struct af_stream *s);
double af_calc_delay(struct af_stream *s);
int af_test_output(struct af_instance *af, struct mp_audio *out);
diff --git a/audio/filter/af_lavcac3enc.c b/audio/filter/af_lavcac3enc.c
index a9ec4088eb..d4f559ad07 100644
--- a/audio/filter/af_lavcac3enc.c
+++ b/audio/filter/af_lavcac3enc.c
@@ -100,12 +100,11 @@ static int control(struct af_instance *af, int cmd, void *arg)
} else {
s->out_samples = AC3_MAX_CODED_FRAME_SIZE / af->data->sstride;
}
- af->mul = s->out_samples / (double)s->in_samples;
mp_audio_buffer_reinit(s->pending, in);
- MP_DBG(af, "af_lavcac3enc reinit: %d, %d, %f, %d.\n",
- in->nch, in->rate, af->mul, s->in_samples);
+ MP_DBG(af, "af_lavcac3enc reinit: %d, %d, %d.\n",
+ in->nch, in->rate, s->in_samples);
int bit_rate = s->bit_rate ? s->bit_rate : default_bit_rate[in->nch];
diff --git a/audio/filter/af_lavfi.c b/audio/filter/af_lavfi.c
index 0b7a619e56..bf49d9a311 100644
--- a/audio/filter/af_lavfi.c
+++ b/audio/filter/af_lavfi.c
@@ -201,9 +201,6 @@ static int control(struct af_instance *af, int cmd, void *arg)
p->timebase_out = l_out->time_base;
- // 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;
}
}
diff --git a/audio/filter/af_lavrresample.c b/audio/filter/af_lavrresample.c
index 8dce52cf67..dc777e9b2c 100644
--- a/audio/filter/af_lavrresample.c
+++ b/audio/filter/af_lavrresample.c
@@ -248,8 +248,6 @@ static int control(struct af_instance *af, int cmd, void *arg)
if (af_to_avformat(out->format) == AV_SAMPLE_FMT_NONE)
mp_audio_set_format(out, in->format);
- af->mul = out->rate / (double)in->rate;
-
int r = ((in->format == orig_in.format) &&
mp_chmap_equals(&in->channels, &orig_in.channels))
? AF_OK : AF_FALSE;
diff --git a/audio/filter/af_scaletempo.c b/audio/filter/af_scaletempo.c
index 9e9ce1b80b..b31735749f 100644
--- a/audio/filter/af_scaletempo.c
+++ b/audio/filter/af_scaletempo.c
@@ -285,7 +285,6 @@ static int control(struct af_instance *af, int cmd, void *arg)
if (s->speed_tempo && s->speed_pitch)
return AF_DETACH;
af->delay = 0;
- af->mul = 1;
return af_test_output(af, data);
}
@@ -300,7 +299,6 @@ static int control(struct af_instance *af, int cmd, void *arg)
s->bytes_stride = s->frames_stride * bps * nch;
s->frames_stride_scaled = s->scale * s->frames_stride;
s->frames_stride_error = 0;
- af->mul = 1.0 / s->scale;
af->delay = 0;
int frames_overlap = s->frames_stride * s->percent_overlap;