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_hrtf.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_hrtf.c')
-rw-r--r-- | audio/filter/af_hrtf.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/audio/filter/af_hrtf.c b/audio/filter/af_hrtf.c index 5b80bf0eec..01148dc6a6 100644 --- a/audio/filter/af_hrtf.c +++ b/audio/filter/af_hrtf.c @@ -367,7 +367,7 @@ static void uninit(struct af_instance *af) free(af->setup); } if(af->data) - free(af->data->audio); + free(af->data->planes[0]); free(af->data); } @@ -385,9 +385,9 @@ damped (without any real 3D acoustical image, however). static struct mp_audio* play(struct af_instance *af, struct mp_audio *data) { af_hrtf_t *s = af->setup; - short *in = data->audio; // Input audio data + short *in = data->planes[0]; // Input audio data short *out = NULL; // Output audio data - short *end = in + data->len / sizeof(short); // Loop end + short *end = in + data->samples * data->nch; // Loop end float common, left, right, diff, left_b, right_b; const int dblen = s->dlbuflen, hlen = s->hrflen, blen = s->basslen; @@ -425,7 +425,7 @@ static struct mp_audio* play(struct af_instance *af, struct mp_audio *data) "channel\n"); } - out = af->data->audio; + out = af->data->planes[0]; /* MPlayer's 5 channel layout (notation for the variable): * @@ -565,8 +565,7 @@ static struct mp_audio* play(struct af_instance *af, struct mp_audio *data) } /* Set output data */ - data->audio = af->data->audio; - data->len = data->len / data->nch * 2; + data->planes[0] = af->data->planes[0]; mp_audio_set_num_channels(data, 2); return data; |