From ed024aadb6e7be6c3d910045a64db53a6c95e98f Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 5 Dec 2013 00:01:46 +0100 Subject: audio/filter: change filter callback signature The new signature is actually closer to how it actually works, and someone who is not familiar to the API and how it works might make fewer fatal mistakes with the new signature than the old one. Pretty weird. Do this to sneak in a flags parameter, which will later be used to flush remaining data of at least vf_lavfi. --- audio/filter/af_extrastereo.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'audio/filter/af_extrastereo.c') diff --git a/audio/filter/af_extrastereo.c b/audio/filter/af_extrastereo.c index ed05941ece..92cc4dd216 100644 --- a/audio/filter/af_extrastereo.c +++ b/audio/filter/af_extrastereo.c @@ -35,8 +35,8 @@ typedef struct af_extrastereo_s float mul; }af_extrastereo_t; -static struct mp_audio* play_s16(struct af_instance* af, struct mp_audio* data); -static struct mp_audio* play_float(struct af_instance* af, struct mp_audio* data); +static int play_s16(struct af_instance* af, struct mp_audio* data, int f); +static int play_float(struct af_instance* af, struct mp_audio* data, int f); // Initialization and runtime control static int control(struct af_instance* af, int cmd, void* arg) @@ -51,11 +51,11 @@ static int control(struct af_instance* af, int cmd, void* arg) mp_audio_set_num_channels(af->data, 2); if (af->data->format == AF_FORMAT_FLOAT) { - af->play = play_float; + af->filter = play_float; }// else { mp_audio_set_format(af->data, AF_FORMAT_S16); - af->play = play_s16; + af->filter = play_s16; } return af_test_output(af,(struct mp_audio*)arg); @@ -65,7 +65,7 @@ static int control(struct af_instance* af, int cmd, void* arg) } // Filter data through filter -static struct mp_audio* play_s16(struct af_instance* af, struct mp_audio* data) +static int play_s16(struct af_instance* af, struct mp_audio* data, int f) { af_extrastereo_t *s = af->priv; register int i = 0; @@ -84,10 +84,10 @@ static struct mp_audio* play_s16(struct af_instance* af, struct mp_audio* data) a[i + 1] = MPCLAMP(r, SHRT_MIN, SHRT_MAX); } - return data; + return 0; } -static struct mp_audio* play_float(struct af_instance* af, struct mp_audio* data) +static int play_float(struct af_instance* af, struct mp_audio* data, int f) { af_extrastereo_t *s = af->priv; register int i = 0; @@ -106,13 +106,13 @@ static struct mp_audio* play_float(struct af_instance* af, struct mp_audio* data a[i + 1] = af_softclip(r); } - return data; + return 0; } // Allocate memory and set function pointers static int af_open(struct af_instance* af){ af->control=control; - af->play=play_s16; + af->filter=play_s16; return AF_OK; } -- cgit v1.2.3