add card profile prober
[profile/ivi/pulseaudio-panda.git] / src / modules / alsa / module-alsa-card.c
1 /***
2   This file is part of PulseAudio.
3
4   Copyright 2009 Lennart Poettering
5
6   PulseAudio is free software; you can redistribute it and/or modify
7   it under the terms of the GNU Lesser General Public License as published
8   by the Free Software Foundation; either version 2 of the License,
9   or (at your option) any later version.
10
11   PulseAudio is distributed in the hope that it will be useful, but
12   WITHOUT ANY WARRANTY; without even the implied warranty of
13   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14   General Public License for more details.
15
16   You should have received a copy of the GNU Lesser General Public License
17   along with PulseAudio; if not, write to the Free Software
18   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19   USA.
20 ***/
21
22 #ifdef HAVE_CONFIG_H
23 #include <config.h>
24 #endif
25
26 #include "alsa-util.h"
27 #include "module-alsa-card-symdef.h"
28
29 PA_MODULE_AUTHOR("Lennart Poettering");
30 PA_MODULE_DESCRIPTION("ALSA Card");
31 PA_MODULE_VERSION(PACKAGE_VERSION);
32 PA_MODULE_LOAD_ONCE(FALSE);
33
34 static void enumerate_cb(
35         const pa_alsa_profile_info *sink,
36         const pa_alsa_profile_info *source,
37         void *userdata) {
38
39     if (sink && source)
40         pa_log("Found Output %s + Input %s", sink->description, source->description);
41     else if (sink)
42         pa_log("Found Output %s", sink->description);
43     else if (source)
44         pa_log("Found Input %s", source->description);
45
46 }
47
48 int pa__init(pa_module*m) {
49     pa_alsa_redirect_errors_inc();
50     pa_alsa_probe_profiles("1", &m->core->default_sample_spec, enumerate_cb, m);
51     return 0;
52 }
53
54 void pa__done(pa_module*m) {
55     pa_alsa_redirect_errors_dec();
56 }