From b54bde6f2b9f826cd7189182d733aada66c95dd8 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 25 Dec 2009 14:27:32 +0100 Subject: filter_plugin: allow open() to force an input format Make the audio_format argument non-const. Allow the open() method to modify it, to indicate that it wants a different input audio format than the one specified. Check that condition in chain_filter_open(), and fail. --- src/filter_plugin.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src/filter_plugin.c') diff --git a/src/filter_plugin.c b/src/filter_plugin.c index ecc4b5432..21cb2f277 100644 --- a/src/filter_plugin.c +++ b/src/filter_plugin.c @@ -74,18 +74,23 @@ filter_free(struct filter *filter) } const struct audio_format * -filter_open(struct filter *filter, const struct audio_format *audio_format, +filter_open(struct filter *filter, struct audio_format *audio_format, GError **error_r) { + const struct audio_format *out_audio_format; + assert(filter != NULL); assert(audio_format != NULL); assert(audio_format_valid(audio_format)); assert(error_r == NULL || *error_r == NULL); - audio_format = filter->plugin->open(filter, audio_format, error_r); - assert(audio_format == NULL || audio_format_valid(audio_format)); + out_audio_format = filter->plugin->open(filter, audio_format, error_r); + + assert(out_audio_format == NULL || audio_format_valid(audio_format)); + assert(out_audio_format == NULL || + audio_format_valid(out_audio_format)); - return audio_format; + return out_audio_format; } void -- cgit v1.2.3