summaryrefslogtreecommitdiffstats
path: root/audio/filter
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2017-07-07 17:50:36 +0200
committerwm4 <wm4@nowhere>2017-07-07 17:56:22 +0200
commit03596ac551c67cf66c962b1533feec49de18626d (patch)
treecfb850e97e0d90d00a71be24a39bba57c65df08f /audio/filter
parent300097536d1de5beea286e8c8b492370333462b0 (diff)
downloadmpv-03596ac551c67cf66c962b1533feec49de18626d.tar.bz2
mpv-03596ac551c67cf66c962b1533feec49de18626d.tar.xz
audio: drop AF_FORMAT_S24
This is the last sample format that was only in mpv and not in FFmpeg (except the spdif special formats). It was a huge pain, even if the removed code in af_lavrresample is pretty small after all. Note that this drops S24 from the ao_coreaudio AOs too. I'm not sure about the impact, but I expect it doesn't matter. af_fmt_change_bytes() was unused as well, so remove that too.
Diffstat (limited to 'audio/filter')
-rw-r--r--audio/filter/af_lavrresample.c28
1 files changed, 2 insertions, 26 deletions
diff --git a/audio/filter/af_lavrresample.c b/audio/filter/af_lavrresample.c
index 47c374b227..ce991fa4fe 100644
--- a/audio/filter/af_lavrresample.c
+++ b/audio/filter/af_lavrresample.c
@@ -152,17 +152,6 @@ static int rate_from_speed(int rate, double speed)
return lrint(rate * speed);
}
-// Return the format libavresample should convert to, given the final output
-// format mp_format. In some cases (S24) we perform an extra conversion step,
-// and signal here what exactly libavresample should output. It will be the
-// input to the final conversion to mp_format.
-static int check_output_conversion(int mp_format)
-{
- if (mp_format == AF_FORMAT_S24)
- return AV_SAMPLE_FMT_S32;
- return af_to_avformat(mp_format);
-}
-
static struct mp_chmap fudge_pairs[][2] = {
{MP_CHMAP2(BL, BR), MP_CHMAP2(SL, SR)},
{MP_CHMAP2(SL, SR), MP_CHMAP2(BL, BR)},
@@ -223,7 +212,7 @@ static int configure_lavrr(struct af_instance *af, struct mp_audio *in,
goto error;
enum AVSampleFormat in_samplefmt = af_to_avformat(in->format);
- enum AVSampleFormat out_samplefmt = check_output_conversion(out->format);
+ enum AVSampleFormat out_samplefmt = af_to_avformat(out->format);
enum AVSampleFormat out_samplefmtp = av_get_planar_sample_fmt(out_samplefmt);
if (in_samplefmt == AV_SAMPLE_FMT_NONE ||
@@ -305,7 +294,6 @@ static int configure_lavrr(struct af_instance *af, struct mp_audio *in,
mp_audio_set_format(&s->avrctx_fmt, af_from_avformat(out_samplefmtp));
s->pre_out_fmt = *out;
- mp_audio_set_format(&s->pre_out_fmt, af_from_avformat(out_samplefmt));
// If there are NA channels, the final output will have more channels than
// the avrctx output. Also, avrctx will output planar (out_samplefmtp was
@@ -380,7 +368,7 @@ static int control(struct af_instance *af, int cmd, void *arg)
if (af_to_avformat(in->format) == AV_SAMPLE_FMT_NONE)
mp_audio_set_format(in, AF_FORMAT_FLOAT);
- if (check_output_conversion(out->format) == AV_SAMPLE_FMT_NONE)
+ if (af_to_avformat(out->format) == AV_SAMPLE_FMT_NONE)
mp_audio_set_format(out, in->format);
int r = ((in->format == orig_in.format) &&
@@ -426,18 +414,6 @@ static void uninit(struct af_instance *af)
static void extra_output_conversion(struct af_instance *af, struct mp_audio *mpa)
{
- if (mpa->format == AF_FORMAT_S32 && af->data->format == AF_FORMAT_S24) {
- size_t len = mp_audio_psize(mpa) / mpa->bps;
- for (int s = 0; s < len; s++) {
- uint32_t val = *((uint32_t *)mpa->planes[0] + s);
- uint8_t *ptr = (uint8_t *)mpa->planes[0] + s * 3;
- ptr[0] = val >> SHIFT24(0);
- ptr[1] = val >> SHIFT24(1);
- ptr[2] = val >> SHIFT24(2);
- }
- mp_audio_set_format(mpa, AF_FORMAT_S24);
- }
-
for (int p = 0; p < mpa->num_planes; p++) {
void *ptr = mpa->planes[p];
int total = mpa->samples * mpa->spf;