MPD
filter_plugin.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2003-2010 The Music Player Daemon Project
3  * http://www.musicpd.org
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 
26 #ifndef MPD_FILTER_PLUGIN_H
27 #define MPD_FILTER_PLUGIN_H
28 
29 #include <glib.h>
30 
31 #include <stdbool.h>
32 #include <stddef.h>
33 
34 struct config_param;
35 struct filter;
36 
37 struct filter_plugin {
38  const char *name;
39 
43  struct filter *(*init)(const struct config_param *param,
44  GError **error_r);
45 
49  void (*finish)(struct filter *filter);
50 
58  const struct audio_format *
59  (*open)(struct filter *filter,
60  struct audio_format *audio_format,
61  GError **error_r);
62 
66  void (*close)(struct filter *filter);
67 
71  const void *(*filter)(struct filter *filter,
72  const void *src, size_t src_size,
73  size_t *dest_buffer_r,
74  GError **error_r);
75 };
76 
86 struct filter *
87 filter_new(const struct filter_plugin *plugin,
88  const struct config_param *param, GError **error_r);
89 
99 struct filter *
100 filter_configured_new(const struct config_param *param, GError **error_r);
101 
108 void
109 filter_free(struct filter *filter);
110 
121 const struct audio_format *
123  GError **error_r);
124 
130 void
131 filter_close(struct filter *filter);
132 
145 const void *
146 filter_filter(struct filter *filter, const void *src, size_t src_size,
147  size_t *dest_size_r,
148  GError **error_r);
149 
150 #endif