aboutsummaryrefslogtreecommitdiffhomepage
path: root/audio/filter/af_lavrresample.c
diff options
context:
space:
mode:
authorGravatar wm4 <wm4@nowhere>2016-07-10 18:39:50 +0200
committerGravatar wm4 <wm4@nowhere>2016-07-10 19:51:09 +0200
commit2eac58eaa97ec667a2512cd27c35f006a22ec074 (patch)
treefafe5b96783256f035c72aa14d6fe21a29cc0573 /audio/filter/af_lavrresample.c
parent065bb635d98f7655ce0d1f2afe7bbbcf737f3fea (diff)
audio: cleanup audio filter format negotiation
The algorithm and functionality is the same, but the code becomes much simpler and easier to follow. The assumption that there is only 1 conversion filter (lavrresample) helps with the simplification, but the main change is to use the same code for format/channels/rate. Get rid of the different AF_CONTROL_SET_* controls, and change the af->data parameters directly. (af->data is badly named, but essentially is a placeholder for the output format.) Also, instead of trying to use the af_reinit() loop to init inserted conversion filters or filters with changed output formats, do it inline, and move the common code to a filter_reinit() function. This gets rid of the awful retry variable. In general, this should not change any runtime behavior.
Diffstat (limited to 'audio/filter/af_lavrresample.c')
-rw-r--r--audio/filter/af_lavrresample.c21
1 files changed, 0 insertions, 21 deletions
diff --git a/audio/filter/af_lavrresample.c b/audio/filter/af_lavrresample.c
index 6fbb445563..fdef69a16b 100644
--- a/audio/filter/af_lavrresample.c
+++ b/audio/filter/af_lavrresample.c
@@ -173,12 +173,6 @@ static int check_output_conversion(int mp_format)
return af_to_avformat(mp_format);
}
-bool af_lavrresample_test_conversion(int src_format, int dst_format)
-{
- return af_to_avformat(src_format) != AV_SAMPLE_FMT_NONE &&
- check_output_conversion(dst_format) != AV_SAMPLE_FMT_NONE;
-}
-
static struct mp_chmap fudge_pairs[][2] = {
{MP_CHMAP2(BL, BR), MP_CHMAP2(SL, SR)},
{MP_CHMAP2(SL, SR), MP_CHMAP2(BL, BR)},
@@ -407,21 +401,6 @@ static int control(struct af_instance *af, int cmd, void *arg)
r = configure_lavrr(af, in, out, true);
return r;
}
- case AF_CONTROL_SET_FORMAT: {
- int format = *(int *)arg;
- if (format && check_output_conversion(format) == AV_SAMPLE_FMT_NONE)
- return AF_FALSE;
-
- mp_audio_set_format(af->data, format);
- return AF_OK;
- }
- case AF_CONTROL_SET_CHANNELS: {
- mp_audio_set_channels(af->data, (struct mp_chmap *)arg);
- return AF_OK;
- }
- case AF_CONTROL_SET_RESAMPLE_RATE:
- af->data->rate = *(int *)arg;
- return AF_OK;
case AF_CONTROL_SET_PLAYBACK_SPEED_RESAMPLE: {
s->playback_speed = *(double *)arg;
return AF_OK;