diff options
author | wm4 <wm4@nowhere> | 2013-11-12 23:42:04 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-11-12 23:42:04 +0100 |
commit | e4bbb1d348dafbb32722f413648006a7bd9d0897 (patch) | |
tree | 7165ed9f86a77b751187600d0a9de8b35416f380 /audio/filter/af_extrastereo.c | |
parent | e4f2fcc0ecd31322df65141edf0ddbff9c075f5d (diff) | |
parent | 22b3f522cacfbdba76d311c86efd6091512eb089 (diff) | |
download | mpv-e4bbb1d348dafbb32722f413648006a7bd9d0897.tar.bz2 mpv-e4bbb1d348dafbb32722f413648006a7bd9d0897.tar.xz |
Merge branch 'planar_audio'
Conflicts:
audio/out/ao_lavc.c
Diffstat (limited to 'audio/filter/af_extrastereo.c')
-rw-r--r-- | audio/filter/af_extrastereo.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/audio/filter/af_extrastereo.c b/audio/filter/af_extrastereo.c index 4cf27f2724..4561b60690 100644 --- a/audio/filter/af_extrastereo.c +++ b/audio/filter/af_extrastereo.c @@ -49,6 +49,7 @@ static int control(struct af_instance* af, int cmd, void* arg) if(!arg) return AF_ERROR; mp_audio_copy_config(af->data, (struct mp_audio*)arg); + mp_audio_force_interleaved_format(af->data); mp_audio_set_num_channels(af->data, 2); if (af->data->format == AF_FORMAT_FLOAT_NE) { @@ -74,7 +75,6 @@ static int control(struct af_instance* af, int cmd, void* arg) // Deallocate memory static void uninit(struct af_instance* af) { - free(af->data); free(af->setup); } @@ -83,8 +83,8 @@ static struct mp_audio* play_s16(struct af_instance* af, struct mp_audio* data) { af_extrastereo_t *s = af->setup; register int i = 0; - int16_t *a = (int16_t*)data->audio; // Audio data - int len = data->len/2; // Number of samples + int16_t *a = (int16_t*)data->planes[0]; // Audio data + int len = data->samples*data->nch; // Number of samples int avg, l, r; for (i = 0; i < len; i+=2) @@ -105,8 +105,8 @@ static struct mp_audio* play_float(struct af_instance* af, struct mp_audio* data { af_extrastereo_t *s = af->setup; register int i = 0; - float *a = (float*)data->audio; // Audio data - int len = data->len/4; // Number of samples + float *a = (float*)data->planes[0]; // Audio data + int len = data->samples * data->nch; // Number of samples float avg, l, r; for (i = 0; i < len; i+=2) @@ -128,10 +128,8 @@ static int af_open(struct af_instance* af){ af->control=control; af->uninit=uninit; af->play=play_s16; - af->mul=1; - af->data=calloc(1,sizeof(struct mp_audio)); af->setup=calloc(1,sizeof(af_extrastereo_t)); - if(af->data == NULL || af->setup == NULL) + if(af->setup == NULL) return AF_ERROR; ((af_extrastereo_t*)af->setup)->mul = 2.5; |