summaryrefslogtreecommitdiffstats
path: root/audio/filter/af_drc.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-11-10 23:11:40 +0100
committerwm4 <wm4@nowhere>2013-11-12 23:16:31 +0100
commitd2e7467eb203d3a34bc1111564c7058b5e9c6b12 (patch)
tree9285523821c8710a0609f47e3ee923a20d038826 /audio/filter/af_drc.c
parentb2d4b5ee43206f8c4491b3af1c24fedd35dbdc31 (diff)
downloadmpv-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_drc.c')
-rw-r--r--audio/filter/af_drc.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/audio/filter/af_drc.c b/audio/filter/af_drc.c
index 9bbbde4831..589844d89b 100644
--- a/audio/filter/af_drc.c
+++ b/audio/filter/af_drc.c
@@ -88,6 +88,7 @@ static int control(struct af_instance* af, int cmd, void* arg)
// Sanity check
if(!arg) return AF_ERROR;
+ mp_audio_force_interleaved_format((struct mp_audio*)arg);
mp_audio_copy_config(af->data, (struct mp_audio*)arg);
if(((struct mp_audio*)arg)->format != (AF_FORMAT_S16_NE)){
@@ -119,8 +120,8 @@ static void uninit(struct af_instance* af)
static void method1_int16(af_drc_t *s, struct mp_audio *c)
{
register int i = 0;
- int16_t *data = (int16_t*)c->audio; // Audio data
- int len = c->len/2; // Number of samples
+ int16_t *data = (int16_t*)c->planes[0]; // Audio data
+ int len = c->samples*c->nch; // Number of samples
float curavg = 0.0, newavg, neededmul;
int tmp;
@@ -161,8 +162,8 @@ static void method1_int16(af_drc_t *s, struct mp_audio *c)
static void method1_float(af_drc_t *s, struct mp_audio *c)
{
register int i = 0;
- float *data = (float*)c->audio; // Audio data
- int len = c->len/4; // Number of samples
+ float *data = (float*)c->planes[0]; // Audio data
+ int len = c->samples*c->nch; // Number of samples
float curavg = 0.0, newavg, neededmul, tmp;
for (i = 0; i < len; i++)
@@ -198,8 +199,8 @@ static void method1_float(af_drc_t *s, struct mp_audio *c)
static void method2_int16(af_drc_t *s, struct mp_audio *c)
{
register int i = 0;
- int16_t *data = (int16_t*)c->audio; // Audio data
- int len = c->len/2; // Number of samples
+ int16_t *data = (int16_t*)c->planes[0]; // Audio data
+ int len = c->samples*c->nch; // Number of samples
float curavg = 0.0, newavg, avg = 0.0;
int tmp, totallen = 0;
@@ -248,8 +249,8 @@ static void method2_int16(af_drc_t *s, struct mp_audio *c)
static void method2_float(af_drc_t *s, struct mp_audio *c)
{
register int i = 0;
- float *data = (float*)c->audio; // Audio data
- int len = c->len/4; // Number of samples
+ float *data = (float*)c->planes[0]; // Audio data
+ int len = c->samples*c->nch; // Number of samples
float curavg = 0.0, newavg, avg = 0.0, tmp;
int totallen = 0;