MPD 0.17~git
src/filter_plugin.h
Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2003-2011 The Music Player Daemon Project
00003  * http://www.musicpd.org
00004  *
00005  * This program is free software; you can redistribute it and/or modify
00006  * it under the terms of the GNU General Public License as published by
00007  * the Free Software Foundation; either version 2 of the License, or
00008  * (at your option) any later version.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License along
00016  * with this program; if not, write to the Free Software Foundation, Inc.,
00017  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
00018  */
00019 
00026 #ifndef MPD_FILTER_PLUGIN_H
00027 #define MPD_FILTER_PLUGIN_H
00028 
00029 #include <glib.h>
00030 
00031 #include <stdbool.h>
00032 #include <stddef.h>
00033 
00034 struct config_param;
00035 struct filter;
00036 
00037 struct filter_plugin {
00038         const char *name;
00039 
00043         struct filter *(*init)(const struct config_param *param,
00044                                GError **error_r);
00045 
00049         void (*finish)(struct filter *filter);
00050 
00058         const struct audio_format *
00059         (*open)(struct filter *filter,
00060                 struct audio_format *audio_format,
00061                 GError **error_r);
00062 
00066         void (*close)(struct filter *filter);
00067 
00071         const void *(*filter)(struct filter *filter,
00072                               const void *src, size_t src_size,
00073                               size_t *dest_buffer_r,
00074                               GError **error_r);
00075 };
00076 
00086 struct filter *
00087 filter_new(const struct filter_plugin *plugin,
00088            const struct config_param *param, GError **error_r);
00089 
00099 struct filter *
00100 filter_configured_new(const struct config_param *param, GError **error_r);
00101 
00108 void
00109 filter_free(struct filter *filter);
00110 
00121 const struct audio_format *
00122 filter_open(struct filter *filter, struct audio_format *audio_format,
00123             GError **error_r);
00124 
00130 void
00131 filter_close(struct filter *filter);
00132 
00145 const void *
00146 filter_filter(struct filter *filter, const void *src, size_t src_size,
00147               size_t *dest_size_r,
00148               GError **error_r);
00149 
00150 #endif