diff options
author | wm4 <wm4@nowhere> | 2013-11-10 23:11:40 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-11-12 23:16:31 +0100 |
commit | d2e7467eb203d3a34bc1111564c7058b5e9c6b12 (patch) | |
tree | 9285523821c8710a0609f47e3ee923a20d038826 /audio/filter/af_convertsignendian.c | |
parent | b2d4b5ee43206f8c4491b3af1c24fedd35dbdc31 (diff) | |
download | mpv-d2e7467eb203d3a34bc1111564c7058b5e9c6b12.tar.bz2 mpv-d2e7467eb203d3a34bc1111564c7058b5e9c6b12.tar.xz |
audio/filter: prepare filter chain for non-interleaved audio
Based on earlier work by Stefano Pigozzi.
There are 2 changes:
1. Instead of mp_audio.audio, mp_audio.planes[0] must be used.
2. mp_audio.len used to contain the size of the audio in bytes. Now
mp_audio.samples must be used. (Where 1 sample is the smallest unit
of audio that covers all channels.)
Also, some filters need changes to reject non-interleaved formats
properly.
Nothing uses the non-interleaved features yet, but this is needed so
that things don't just break when doing so.
Diffstat (limited to 'audio/filter/af_convertsignendian.c')
-rw-r--r-- | audio/filter/af_convertsignendian.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/audio/filter/af_convertsignendian.c b/audio/filter/af_convertsignendian.c index bfea004bb2..5565438aad 100644 --- a/audio/filter/af_convertsignendian.c +++ b/audio/filter/af_convertsignendian.c @@ -24,6 +24,9 @@ static bool test_conversion(int src_format, int dst_format) { + if ((src_format & AF_FORMAT_PLANAR) || + (dst_format & AF_FORMAT_PLANAR)) + return false; int src_noend = src_format & ~AF_FORMAT_END_MASK; int dst_noend = dst_format & ~AF_FORMAT_END_MASK; // We can swap endian for all formats, but sign only for integer formats. @@ -100,13 +103,13 @@ static struct mp_audio *play(struct af_instance *af, struct mp_audio *data) { int infmt = data->format; int outfmt = af->data->format; - size_t len = data->len / data->bps; + size_t len = data->samples * data->nch; if ((infmt & AF_FORMAT_END_MASK) != (outfmt & AF_FORMAT_END_MASK)) - endian(data->audio, len, data->bps); + endian(data->planes[0], len, data->bps); if ((infmt & AF_FORMAT_SIGN_MASK) != (outfmt & AF_FORMAT_SIGN_MASK)) - si2us(data->audio, len, data->bps, + si2us(data->planes[0], len, data->bps, (outfmt & AF_FORMAT_END_MASK) == AF_FORMAT_LE); mp_audio_set_format(data, outfmt); |