2 * \file pcm/pcm_empty.c
4 * \brief PCM Null Plugin Interface
5 * \author Jaroslav Kysela <perex@perex.cz>
10 * Copyright (c) 2006 by Jaroslav Kysela <perex@perex.cz>
13 * This library is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU Lesser General Public License as
15 * published by the Free Software Foundation; either version 2.1 of
16 * the License, or (at your option) any later version.
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License for more details.
23 * You should have received a copy of the GNU Lesser General Public
24 * License along with this library; if not, write to the Free Software
25 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
29 #include "pcm_local.h"
30 #include "pcm_plugin.h"
33 /* entry for static linking */
34 const char *_snd_module_pcm_empty = "";
39 \section pcm_plugins_null Plugin: Null
41 This plugin discards contents of a PCM stream or creates a stream with zero
44 Note: This implementation uses devices /dev/null (playback, must be writable)
45 and /dev/full (capture, must be readable).
53 \subsection pcm_plugins_null_funcref Function reference
56 <LI>_snd_pcm_empty_open()
62 * \brief Creates a new Empty PCM
63 * \param pcmp Returns created PCM handle
64 * \param name Name of PCM
65 * \param root Root configuration node
66 * \param conf Configuration node with empty PCM description
67 * \param stream Stream type
68 * \param mode Stream mode
69 * \retval zero on success otherwise a negative error code
70 * \warning Using of this function might be dangerous in the sense
71 * of compatibility reasons. The prototype might be freely
74 int _snd_pcm_empty_open(snd_pcm_t **pcmp, const char *name ATTRIBUTE_UNUSED,
75 snd_config_t *root, snd_config_t *conf,
76 snd_pcm_stream_t stream, int mode)
78 snd_config_t *slave = NULL, *sconf;
79 snd_config_iterator_t i, next;
82 snd_config_for_each(i, next, conf) {
83 snd_config_t *n = snd_config_iterator_entry(i);
85 if (snd_config_get_id(n, &id) < 0)
87 if (snd_pcm_conf_generic_id(id))
89 if (strcmp(id, "slave") == 0) {
93 SNDERR("Unknown field %s", id);
97 SNDERR("slave is not defined");
100 err = snd_pcm_slave_conf(root, slave, &sconf, 0);
103 err = snd_pcm_open_slave(pcmp, root, sconf, stream, mode, conf);
104 snd_config_delete(sconf);
108 SND_DLSYM_BUILD_VERSION(_snd_pcm_empty_open, SND_PCM_DLSYM_VERSION);