Update copyright notices.
[mpd-mk.git] / src / filter / null_filter_plugin.c
blob650f95bc46970722ec0f27b8e1c139a3fa8775db
1 /*
2 * Copyright (C) 2003-2010 The Music Player Daemon Project
3 * http://www.musicpd.org
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.
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.
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.
20 /** \file
22 * This filter plugin does nothing. That is not quite useful, except
23 * for testing the filter core, or as a template for new filter
24 * plugins.
27 #include "config.h"
28 #include "filter_plugin.h"
29 #include "filter_internal.h"
30 #include "filter_registry.h"
32 #include <assert.h>
34 struct null_filter {
35 struct filter filter;
38 static struct filter *
39 null_filter_init(G_GNUC_UNUSED const struct config_param *param,
40 G_GNUC_UNUSED GError **error_r)
42 struct null_filter *filter = g_new(struct null_filter, 1);
44 filter_init(&filter->filter, &null_filter_plugin);
45 return &filter->filter;
48 static void
49 null_filter_finish(struct filter *_filter)
51 struct null_filter *filter = (struct null_filter *)_filter;
53 g_free(filter);
56 static const struct audio_format *
57 null_filter_open(struct filter *_filter, struct audio_format *audio_format,
58 G_GNUC_UNUSED GError **error_r)
60 struct null_filter *filter = (struct null_filter *)_filter;
61 (void)filter;
63 return audio_format;
66 static void
67 null_filter_close(struct filter *_filter)
69 struct null_filter *filter = (struct null_filter *)_filter;
70 (void)filter;
73 static const void *
74 null_filter_filter(struct filter *_filter,
75 const void *src, size_t src_size,
76 size_t *dest_size_r, G_GNUC_UNUSED GError **error_r)
78 struct null_filter *filter = (struct null_filter *)_filter;
79 (void)filter;
81 /* return the unmodified source buffer */
82 *dest_size_r = src_size;
83 return src;
86 const struct filter_plugin null_filter_plugin = {
87 .name = "null",
88 .init = null_filter_init,
89 .finish = null_filter_finish,
90 .open = null_filter_open,
91 .close = null_filter_close,
92 .filter = null_filter_filter,