diff options
Diffstat (limited to 'meta/recipes-multimedia/pulseaudio/pulseaudio/0001-card-add-pa_card_profile.ports.patch')
-rw-r--r-- | meta/recipes-multimedia/pulseaudio/pulseaudio/0001-card-add-pa_card_profile.ports.patch | 218 |
1 files changed, 0 insertions, 218 deletions
diff --git a/meta/recipes-multimedia/pulseaudio/pulseaudio/0001-card-add-pa_card_profile.ports.patch b/meta/recipes-multimedia/pulseaudio/pulseaudio/0001-card-add-pa_card_profile.ports.patch deleted file mode 100644 index 84c951940b..0000000000 --- a/meta/recipes-multimedia/pulseaudio/pulseaudio/0001-card-add-pa_card_profile.ports.patch +++ /dev/null | |||
@@ -1,218 +0,0 @@ | |||
1 | From d1c02971867bea10afcafc82c965414012c4d6bd Mon Sep 17 00:00:00 2001 | ||
2 | From: Tanu Kaskinen <tanuk@iki.fi> | ||
3 | Date: Fri, 23 Oct 2015 12:23:13 +0300 | ||
4 | Subject: [PATCH 1/4] card: add pa_card_profile.ports | ||
5 | |||
6 | Having ports accessible from pa_card_profile allows checking whether all ports | ||
7 | of a profile are unavailable, and therefore helps with managing the profile | ||
8 | availability (implemented in a later patch). | ||
9 | |||
10 | http://bugzilla.yoctoproject.org/show_bug.cgi?id=8448 | ||
11 | |||
12 | Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com> | ||
13 | |||
14 | Rebased on 8.0. | ||
15 | |||
16 | Upstream-Status: Denied [The patch set needs some work to be accepted. | ||
17 | The review thread: | ||
18 | http://thread.gmane.org/gmane.comp.audio.pulseaudio.general/24301] | ||
19 | |||
20 | Signed-off-by: Tanu Kaskinen <tanuk@iki.fi> | ||
21 | --- | ||
22 | src/modules/alsa/alsa-mixer.c | 4 +++- | ||
23 | src/modules/alsa/alsa-ucm.c | 1 + | ||
24 | src/modules/bluetooth/module-bluez4-device.c | 6 ++++++ | ||
25 | src/modules/bluetooth/module-bluez5-device.c | 6 ++++++ | ||
26 | src/pulsecore/card.c | 15 +++++++++++++++ | ||
27 | src/pulsecore/card.h | 4 ++++ | ||
28 | src/pulsecore/device-port.c | 7 ++++++- | ||
29 | 7 files changed, 41 insertions(+), 2 deletions(-) | ||
30 | |||
31 | diff --git a/src/modules/alsa/alsa-mixer.c b/src/modules/alsa/alsa-mixer.c | ||
32 | index 1fe2a02..5b76b06 100644 | ||
33 | --- a/src/modules/alsa/alsa-mixer.c | ||
34 | +++ b/src/modules/alsa/alsa-mixer.c | ||
35 | @@ -4783,8 +4783,10 @@ static pa_device_port* device_port_alsa_init(pa_hashmap *ports, /* card ports */ | ||
36 | path->port = p; | ||
37 | } | ||
38 | |||
39 | - if (cp) | ||
40 | + if (cp) { | ||
41 | pa_hashmap_put(p->profiles, cp->name, cp); | ||
42 | + pa_card_profile_add_port(cp, p); | ||
43 | + } | ||
44 | |||
45 | if (extra) { | ||
46 | pa_hashmap_put(extra, p->name, p); | ||
47 | diff --git a/src/modules/alsa/alsa-ucm.c b/src/modules/alsa/alsa-ucm.c | ||
48 | index 42f3242..68fcc26 100644 | ||
49 | --- a/src/modules/alsa/alsa-ucm.c | ||
50 | +++ b/src/modules/alsa/alsa-ucm.c | ||
51 | @@ -791,6 +791,7 @@ static void ucm_add_port_combination( | ||
52 | if (cp) { | ||
53 | pa_log_debug("Adding profile %s to port %s.", cp->name, port->name); | ||
54 | pa_hashmap_put(port->profiles, cp->name, cp); | ||
55 | + pa_card_profile_add_port(cp, port); | ||
56 | } | ||
57 | |||
58 | if (hash) { | ||
59 | diff --git a/src/modules/bluetooth/module-bluez4-device.c b/src/modules/bluetooth/module-bluez4-device.c | ||
60 | index 9a921a5..adecb32 100644 | ||
61 | --- a/src/modules/bluetooth/module-bluez4-device.c | ||
62 | +++ b/src/modules/bluetooth/module-bluez4-device.c | ||
63 | @@ -2180,6 +2180,7 @@ static pa_card_profile *create_card_profile(struct userdata *u, const char *uuid | ||
64 | p->max_sink_channels = 2; | ||
65 | p->max_source_channels = 0; | ||
66 | pa_hashmap_put(output_port->profiles, p->name, p); | ||
67 | + pa_card_profile_add_port(p, output_port); | ||
68 | |||
69 | d = PA_CARD_PROFILE_DATA(p); | ||
70 | *d = PA_BLUEZ4_PROFILE_A2DP; | ||
71 | @@ -2191,6 +2192,7 @@ static pa_card_profile *create_card_profile(struct userdata *u, const char *uuid | ||
72 | p->max_sink_channels = 0; | ||
73 | p->max_source_channels = 2; | ||
74 | pa_hashmap_put(input_port->profiles, p->name, p); | ||
75 | + pa_card_profile_add_port(p, input_port); | ||
76 | |||
77 | d = PA_CARD_PROFILE_DATA(p); | ||
78 | *d = PA_BLUEZ4_PROFILE_A2DP_SOURCE; | ||
79 | @@ -2203,6 +2205,8 @@ static pa_card_profile *create_card_profile(struct userdata *u, const char *uuid | ||
80 | p->max_source_channels = 1; | ||
81 | pa_hashmap_put(input_port->profiles, p->name, p); | ||
82 | pa_hashmap_put(output_port->profiles, p->name, p); | ||
83 | + pa_card_profile_add_port(p, input_port); | ||
84 | + pa_card_profile_add_port(p, output_port); | ||
85 | |||
86 | d = PA_CARD_PROFILE_DATA(p); | ||
87 | *d = PA_BLUEZ4_PROFILE_HSP; | ||
88 | @@ -2215,6 +2219,8 @@ static pa_card_profile *create_card_profile(struct userdata *u, const char *uuid | ||
89 | p->max_source_channels = 1; | ||
90 | pa_hashmap_put(input_port->profiles, p->name, p); | ||
91 | pa_hashmap_put(output_port->profiles, p->name, p); | ||
92 | + pa_card_profile_add_port(p, input_port); | ||
93 | + pa_card_profile_add_port(p, output_port); | ||
94 | |||
95 | d = PA_CARD_PROFILE_DATA(p); | ||
96 | *d = PA_BLUEZ4_PROFILE_HFGW; | ||
97 | diff --git a/src/modules/bluetooth/module-bluez5-device.c b/src/modules/bluetooth/module-bluez5-device.c | ||
98 | index 84e6d55..b015c67 100644 | ||
99 | --- a/src/modules/bluetooth/module-bluez5-device.c | ||
100 | +++ b/src/modules/bluetooth/module-bluez5-device.c | ||
101 | @@ -1790,6 +1790,7 @@ static pa_card_profile *create_card_profile(struct userdata *u, const char *uuid | ||
102 | cp->max_sink_channels = 2; | ||
103 | cp->max_source_channels = 0; | ||
104 | pa_hashmap_put(output_port->profiles, cp->name, cp); | ||
105 | + pa_card_profile_add_port(cp, output_port); | ||
106 | |||
107 | p = PA_CARD_PROFILE_DATA(cp); | ||
108 | *p = PA_BLUETOOTH_PROFILE_A2DP_SINK; | ||
109 | @@ -1801,6 +1802,7 @@ static pa_card_profile *create_card_profile(struct userdata *u, const char *uuid | ||
110 | cp->max_sink_channels = 0; | ||
111 | cp->max_source_channels = 2; | ||
112 | pa_hashmap_put(input_port->profiles, cp->name, cp); | ||
113 | + pa_card_profile_add_port(cp, input_port); | ||
114 | |||
115 | p = PA_CARD_PROFILE_DATA(cp); | ||
116 | *p = PA_BLUETOOTH_PROFILE_A2DP_SOURCE; | ||
117 | @@ -1813,6 +1815,8 @@ static pa_card_profile *create_card_profile(struct userdata *u, const char *uuid | ||
118 | cp->max_source_channels = 1; | ||
119 | pa_hashmap_put(input_port->profiles, cp->name, cp); | ||
120 | pa_hashmap_put(output_port->profiles, cp->name, cp); | ||
121 | + pa_card_profile_add_port(cp, input_port); | ||
122 | + pa_card_profile_add_port(cp, output_port); | ||
123 | |||
124 | p = PA_CARD_PROFILE_DATA(cp); | ||
125 | *p = PA_BLUETOOTH_PROFILE_HEADSET_HEAD_UNIT; | ||
126 | @@ -1825,6 +1829,8 @@ static pa_card_profile *create_card_profile(struct userdata *u, const char *uuid | ||
127 | cp->max_source_channels = 1; | ||
128 | pa_hashmap_put(input_port->profiles, cp->name, cp); | ||
129 | pa_hashmap_put(output_port->profiles, cp->name, cp); | ||
130 | + pa_card_profile_add_port(cp, input_port); | ||
131 | + pa_card_profile_add_port(cp, output_port); | ||
132 | |||
133 | p = PA_CARD_PROFILE_DATA(cp); | ||
134 | *p = PA_BLUETOOTH_PROFILE_HEADSET_AUDIO_GATEWAY; | ||
135 | diff --git a/src/pulsecore/card.c b/src/pulsecore/card.c | ||
136 | index b6cbbf7..f92ac87 100644 | ||
137 | --- a/src/pulsecore/card.c | ||
138 | +++ b/src/pulsecore/card.c | ||
139 | @@ -45,6 +45,7 @@ pa_card_profile *pa_card_profile_new(const char *name, const char *description, | ||
140 | c->name = pa_xstrdup(name); | ||
141 | c->description = pa_xstrdup(description); | ||
142 | c->available = PA_AVAILABLE_UNKNOWN; | ||
143 | + c->ports = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func); | ||
144 | |||
145 | return c; | ||
146 | } | ||
147 | @@ -52,6 +53,14 @@ pa_card_profile *pa_card_profile_new(const char *name, const char *description, | ||
148 | void pa_card_profile_free(pa_card_profile *c) { | ||
149 | pa_assert(c); | ||
150 | |||
151 | + if (c->ports) { | ||
152 | + pa_device_port *port; | ||
153 | + void *state; | ||
154 | + PA_HASHMAP_FOREACH(port, c->ports, state) | ||
155 | + pa_hashmap_remove (port->profiles, c->name); | ||
156 | + pa_hashmap_free(c->ports); | ||
157 | + } | ||
158 | + | ||
159 | pa_xfree(c->input_name); | ||
160 | pa_xfree(c->output_name); | ||
161 | pa_xfree(c->name); | ||
162 | @@ -59,6 +68,12 @@ void pa_card_profile_free(pa_card_profile *c) { | ||
163 | pa_xfree(c); | ||
164 | } | ||
165 | |||
166 | +void pa_card_profile_add_port(pa_card_profile *profile, pa_device_port *port) { | ||
167 | + pa_assert(profile); | ||
168 | + | ||
169 | + pa_hashmap_put(profile->ports, port->name, port); | ||
170 | +} | ||
171 | + | ||
172 | void pa_card_profile_set_available(pa_card_profile *c, pa_available_t available) { | ||
173 | pa_core *core; | ||
174 | |||
175 | diff --git a/src/pulsecore/card.h b/src/pulsecore/card.h | ||
176 | index 30bfc0e..fff9057 100644 | ||
177 | --- a/src/pulsecore/card.h | ||
178 | +++ b/src/pulsecore/card.h | ||
179 | @@ -50,6 +50,8 @@ struct pa_card_profile { | ||
180 | unsigned priority; | ||
181 | pa_available_t available; /* PA_AVAILABLE_UNKNOWN, PA_AVAILABLE_NO or PA_AVAILABLE_YES */ | ||
182 | |||
183 | + pa_hashmap *ports; /* port name -> pa_device_port */ | ||
184 | + | ||
185 | /* We probably want to have different properties later on here */ | ||
186 | unsigned n_sinks; | ||
187 | unsigned n_sources; | ||
188 | @@ -107,6 +109,8 @@ typedef struct pa_card_new_data { | ||
189 | pa_card_profile *pa_card_profile_new(const char *name, const char *description, size_t extra); | ||
190 | void pa_card_profile_free(pa_card_profile *c); | ||
191 | |||
192 | +void pa_card_profile_add_port(pa_card_profile *profile, pa_device_port *port); | ||
193 | + | ||
194 | /* The profile's available status has changed */ | ||
195 | void pa_card_profile_set_available(pa_card_profile *c, pa_available_t available); | ||
196 | |||
197 | diff --git a/src/pulsecore/device-port.c b/src/pulsecore/device-port.c | ||
198 | index 5807d3e..d12dfbc 100644 | ||
199 | --- a/src/pulsecore/device-port.c | ||
200 | +++ b/src/pulsecore/device-port.c | ||
201 | @@ -107,8 +107,13 @@ static void device_port_free(pa_object *o) { | ||
202 | if (p->proplist) | ||
203 | pa_proplist_free(p->proplist); | ||
204 | |||
205 | - if (p->profiles) | ||
206 | + if (p->profiles) { | ||
207 | + pa_card_profile *profile; | ||
208 | + void *state; | ||
209 | + PA_HASHMAP_FOREACH(profile, p->profiles, state) | ||
210 | + pa_hashmap_remove (profile->ports, p->name); | ||
211 | pa_hashmap_free(p->profiles); | ||
212 | + } | ||
213 | |||
214 | pa_xfree(p->preferred_profile); | ||
215 | pa_xfree(p->name); | ||
216 | -- | ||
217 | 2.7.0 | ||
218 | |||