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_ladspa.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_ladspa.c')
-rw-r--r-- | audio/filter/af_ladspa.c | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/audio/filter/af_ladspa.c b/audio/filter/af_ladspa.c index 73b7430201..6acdc150d7 100644 --- a/audio/filter/af_ladspa.c +++ b/audio/filter/af_ladspa.c @@ -497,10 +497,6 @@ static int control(struct af_instance *af, int cmd, void *arg) { mp_audio_copy_config(af->data, (struct mp_audio*)arg); mp_audio_set_format(af->data, AF_FORMAT_FLOAT_NE); - /* arg->len is not set here yet, so init of buffers and connecting the - * filter, has to be done in play() :-/ - */ - return af_test_output(af, (struct mp_audio*)arg); case AF_CONTROL_COMMAND_LINE: { char *buf; @@ -710,8 +706,8 @@ static void uninit(struct af_instance *af) { static struct mp_audio* play(struct af_instance *af, struct mp_audio *data) { af_ladspa_t *setup = af->setup; const LADSPA_Descriptor *pdes = setup->plugin_descriptor; - float *audio = (float*)data->audio; - int nsamples = data->len/4; /* /4 because it's 32-bit float */ + float *audio = (float*)data->planes[0]; + int nsamples = data->samples*data->nch; int nch = data->nch; int rate = data->rate; int i, p; @@ -723,10 +719,6 @@ static struct mp_audio* play(struct af_instance *af, struct mp_audio *data) { * plugin, connect ports and activate plugin */ - /* 2004-12-07: Also check if the buffersize has to be changed! - * data->len is not constant per se! re-init buffers. - */ - if ( (setup->bufsize != nsamples/nch) || (setup->nch != nch) ) { /* if setup->nch==0, it's the first call, if not, something has |