]> code.delx.au - pulseaudio/blob - src/pulsecore/card.h
remap: Change remapping function argument type from void to int16_t / float as approp...
[pulseaudio] / src / pulsecore / card.h
1 #ifndef foopulsecardhfoo
2 #define foopulsecardhfoo
3
4 /***
5 This file is part of PulseAudio.
6
7 Copyright 2009 Lennart Poettering
8
9 PulseAudio is free software; you can redistribute it and/or modify
10 it under the terms of the GNU Lesser General Public License as published
11 by the Free Software Foundation; either version 2.1 of the License,
12 or (at your option) any later version.
13
14 PulseAudio is distributed in the hope that it will be useful, but
15 WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 General Public License for more details.
18
19 You should have received a copy of the GNU Lesser General Public License
20 along with PulseAudio; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
22 USA.
23 ***/
24
25 typedef struct pa_card pa_card;
26
27 #include <pulse/proplist.h>
28 #include <pulsecore/core.h>
29 #include <pulsecore/module.h>
30 #include <pulsecore/idxset.h>
31
32 /* This enum replaces pa_port_available_t (defined in pulse/def.h) for
33 * internal use, so make sure both enum types stay in sync. */
34 typedef enum pa_available {
35 PA_AVAILABLE_UNKNOWN = 0,
36 PA_AVAILABLE_NO = 1,
37 PA_AVAILABLE_YES = 2,
38 } pa_available_t;
39
40 typedef struct pa_card_profile {
41 pa_card *card;
42 char *name;
43 char *description;
44
45 unsigned priority;
46 pa_available_t available; /* PA_AVAILABLE_UNKNOWN, PA_AVAILABLE_NO or PA_AVAILABLE_YES */
47
48 /* We probably want to have different properties later on here */
49 unsigned n_sinks;
50 unsigned n_sources;
51
52 unsigned max_sink_channels;
53 unsigned max_source_channels;
54
55 /* .. followed by some implementation specific data */
56 } pa_card_profile;
57
58 #define PA_CARD_PROFILE_DATA(d) ((void*) ((uint8_t*) d + PA_ALIGN(sizeof(pa_card_profile))))
59
60 struct pa_card {
61 uint32_t index;
62 pa_core *core;
63
64 char *name;
65
66 pa_proplist *proplist;
67 pa_module *module;
68 char *driver;
69
70 pa_idxset *sinks;
71 pa_idxset *sources;
72
73 pa_hashmap *profiles;
74 pa_card_profile *active_profile;
75
76 pa_hashmap *ports;
77
78 bool save_profile:1;
79
80 void *userdata;
81
82 int (*set_profile)(pa_card *c, pa_card_profile *profile);
83 };
84
85 typedef struct pa_card_new_data {
86 char *name;
87 pa_proplist *proplist;
88
89 const char *driver;
90 pa_module *module;
91
92 pa_hashmap *profiles;
93 char *active_profile;
94
95 pa_hashmap *ports;
96
97 bool namereg_fail:1;
98
99 bool save_profile:1;
100 } pa_card_new_data;
101
102 pa_card_profile *pa_card_profile_new(const char *name, const char *description, size_t extra);
103 void pa_card_profile_free(pa_card_profile *c);
104
105 /* The profile's available status has changed */
106 void pa_card_profile_set_available(pa_card_profile *c, pa_available_t available);
107
108 pa_card_new_data *pa_card_new_data_init(pa_card_new_data *data);
109 void pa_card_new_data_set_name(pa_card_new_data *data, const char *name);
110 void pa_card_new_data_set_profile(pa_card_new_data *data, const char *profile);
111 void pa_card_new_data_done(pa_card_new_data *data);
112
113 pa_card *pa_card_new(pa_core *c, pa_card_new_data *data);
114 void pa_card_free(pa_card *c);
115
116 void pa_card_add_profile(pa_card *c, pa_card_profile *profile);
117
118 int pa_card_set_profile(pa_card *c, pa_card_profile *profile, bool save);
119
120 int pa_card_suspend(pa_card *c, bool suspend, pa_suspend_cause_t cause);
121
122 #endif