From a9ce0218c1879a752c9d9ec6ef21fcf44eab51ab Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 1 Feb 2013 18:40:36 +0100 Subject: FilterInternal: convert struct filter to a OO interface --- src/FilterPlugin.hxx | 87 +++------------------------------------------------- 1 file changed, 4 insertions(+), 83 deletions(-) (limited to 'src/FilterPlugin.hxx') diff --git a/src/FilterPlugin.hxx b/src/FilterPlugin.hxx index 6476a621..80bb8a0b 100644 --- a/src/FilterPlugin.hxx +++ b/src/FilterPlugin.hxx @@ -31,7 +31,7 @@ #include struct config_param; -struct filter; +class Filter; struct filter_plugin { const char *name; @@ -39,38 +39,7 @@ struct filter_plugin { /** * Allocates and configures a filter. */ - struct filter *(*init)(const struct config_param *param, - GError **error_r); - - /** - * Free instance data. - */ - void (*finish)(struct filter *filter); - - /** - * Opens a filter. - * - * @param audio_format the audio format of incoming data; the - * plugin may modify the object to enforce another input - * format - */ - const struct audio_format * - (*open)(struct filter *filter, - struct audio_format *audio_format, - GError **error_r); - - /** - * Closes a filter. - */ - void (*close)(struct filter *filter); - - /** - * Filters a block of PCM data. - */ - const void *(*filter)(struct filter *filter, - const void *src, size_t src_size, - size_t *dest_buffer_r, - GError **error_r); + Filter *(*init)(const struct config_param *param, GError **error_r); }; /** @@ -82,7 +51,7 @@ struct filter_plugin { * ignore errors. * @return a new filter object, or NULL on error */ -struct filter * +Filter * filter_new(const struct filter_plugin *plugin, const struct config_param *param, GError **error_r); @@ -95,55 +64,7 @@ filter_new(const struct filter_plugin *plugin, * ignore errors. * @return a new filter object, or NULL on error */ -struct filter * +Filter * filter_configured_new(const struct config_param *param, GError **error_r); -/** - * Deletes a filter. It must be closed prior to calling this - * function, see filter_close(). - * - * @param filter the filter object - */ -void -filter_free(struct filter *filter); - -/** - * Opens the filter, preparing it for filter_filter(). - * - * @param filter the filter object - * @param audio_format the audio format of incoming data; the plugin - * may modify the object to enforce another input format - * @param error location to store the error occurring, or NULL to - * ignore errors. - * @return the format of outgoing data - */ -const struct audio_format * -filter_open(struct filter *filter, struct audio_format *audio_format, - GError **error_r); - -/** - * Closes the filter. After that, you may call filter_open() again. - * - * @param filter the filter object - */ -void -filter_close(struct filter *filter); - -/** - * Filters a block of PCM data. - * - * @param filter the filter object - * @param src the input buffer - * @param src_size the size of #src_buffer in bytes - * @param dest_size_r the size of the returned buffer - * @param error location to store the error occurring, or NULL to - * ignore errors. - * @return the destination buffer on success (will be invalidated by - * filter_close() or filter_filter()), NULL on error - */ -const void * -filter_filter(struct filter *filter, const void *src, size_t src_size, - size_t *dest_size_r, - GError **error_r); - #endif -- cgit v1.2.3