1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
|
#ifndef foopulseproplisthfoo
#define foopulseproplisthfoo
/***
This file is part of PulseAudio.
Copyright 2007 Lennart Poettering
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA.
***/
#include <sys/types.h>
#include <pulse/cdecl.h>
#include <pulse/gccmacro.h>
#include <pulse/version.h>
PA_C_DECL_BEGIN
/** For streams: localized media name, formatted as UTF-8. e.g. "Guns'N'Roses: Civil War".*/
#define PA_PROP_MEDIA_NAME "media.name"
/** For streams: localized media title if applicable, formatted as UTF-8. e.g. "Civil War" */
#define PA_PROP_MEDIA_TITLE "media.title"
/** For streams: localized media artist if applicable, formatted as UTF-8. e.g. "Guns'N'Roses" */
#define PA_PROP_MEDIA_ARTIST "media.artist"
/** For streams: localized media copyright string if applicable, formatted as UTF-8. e.g. "Evil Record Corp." */
#define PA_PROP_MEDIA_COPYRIGHT "media.copyright"
/** For streams: localized media generator software string if applicable, formatted as UTF-8. e.g. "Foocrop AudioFrobnicator" */
#define PA_PROP_MEDIA_SOFTWARE "media.software"
/** For streams: media language if applicable, in standard POSIX format. e.g. "de_DE" */
#define PA_PROP_MEDIA_LANGUAGE "media.language"
/** For streams: source filename if applicable, in URI format or local path. e.g. "/home/lennart/music/foobar.ogg" */
#define PA_PROP_MEDIA_FILENAME "media.filename"
/** \cond fulldocs */
/** For streams: icon for the media. A binary blob containing PNG image data */
#define PA_PROP_MEDIA_ICON "media.icon"
/** \endcond */
/** For streams: an XDG icon name for the media. e.g. "audio-x-mp3" */
#define PA_PROP_MEDIA_ICON_NAME "media.icon_name"
/** For streams: logic role of this media. One of the strings "video", "music", "game", "event", "phone", "animation", "production", "a11y" */
#define PA_PROP_MEDIA_ROLE "media.role"
/** For event sound streams: XDG event sound name. e.g. "message-new-email" (Event sound streams are those with media.role set to "event") */
#define PA_PROP_EVENT_ID "event.id"
/** For event sound streams: localized human readable one-line description of the event, formatted as UTF-8. e.g. "Email from lennart@example.com received." */
#define PA_PROP_EVENT_DESCRIPTION "event.description"
/** For event sound streams: absolute horizontal mouse position on the screen if the event sound was triggered by a mouse click, integer formatted as text string. e.g. "865" */
#define PA_PROP_EVENT_MOUSE_X "event.mouse.x"
/** For event sound streams: absolute vertical mouse position on the screen if the event sound was triggered by a mouse click, integer formatted as text string. e.g. "432" */
#define PA_PROP_EVENT_MOUSE_Y "event.mouse.y"
/** For event sound streams: relative horizontal mouse position on the screen if the event sound was triggered by a mouse click, float formatted as text string, ranging from 0.0 (left side of the screen) to 1.0 (right side of the screen). e.g. "0.65" */
#define PA_PROP_EVENT_MOUSE_HPOS "event.mouse.hpos"
/** For event sound streams: relative vertical mouse position on the screen if the event sound was triggered by a mouse click, float formatted as text string, ranging from 0.0 (top of the screen) to 1.0 (bottom of the screen). e.g. "0.43" */
#define PA_PROP_EVENT_MOUSE_VPOS "event.mouse.vpos"
/** For event sound streams: mouse button that triggered the event if applicable, integer formatted as string with 0=left, 1=middle, 2=right. e.g. "0" */
#define PA_PROP_EVENT_MOUSE_BUTTON "event.mouse.button"
/** For streams that belong to a window on the screen: localized window title. e.g. "Totem Music Player" */
#define PA_PROP_WINDOW_NAME "window.name"
/** For streams that belong to a window on the screen: a textual id for identifying a window logically. e.g. "org.gnome.Totem.MainWindow" */
#define PA_PROP_WINDOW_ID "window.id"
/** \cond fulldocs */
/** For streams that belong to a window on the screen: window icon. A binary blob containing PNG image data */
#define PA_PROP_WINDOW_ICON "window.icon"
/** \endcond */
/** For streams that belong to a window on the screen: an XDG icon name for the window. e.g. "totem" */
#define PA_PROP_WINDOW_ICON_NAME "window.icon_name"
/** For streams that belong to an X11 window on the screen: the X11 display string. e.g. ":0.0" */
#define PA_PROP_WINDOW_X11_DISPLAY "window.x11.display"
/** For streams that belong to an X11 window on the screen: the X11 screen the window is on, an integer formatted as string. e.g. "0" */
#define PA_PROP_WINDOW_X11_SCREEN "window.x11.screen"
/** For streams that belong to an X11 window on the screen: the X11 monitor the window is on, an integer formatted as string. e.g. "0" */
#define PA_PROP_WINDOW_X11_MONITOR "window.x11.monitor"
/** For streams that belong to an X11 window on the screen: the window XID, an integer formatted as string. e.g. "25632" */
#define PA_PROP_WINDOW_X11_XID "window.x11.xid"
/** For clients/streams: localized human readable application name. e.g. "Totem Music Player" */
#define PA_PROP_APPLICATION_NAME "application.name"
/** For clients/streams: a textual id for identifying an application logically. e.g. "org.gnome.Totem" */
#define PA_PROP_APPLICATION_ID "application.id"
/** For clients/streams: a version string e.g. "0.6.88" */
#define PA_PROP_APPLICATION_VERSION "application.version"
/** \cond fulldocs */
/** For clients/streams: application icon. A binary blob containing PNG image data */
#define PA_PROP_APPLICATION_ICON "application.icon"
/** \endcond */
/** For clients/streams: an XDG icon name for the application. e.g. "totem" */
#define PA_PROP_APPLICATION_ICON_NAME "application.icon_name"
/** For clients/streams: application language if applicable, in standard POSIX format. e.g. "de_DE" */
#define PA_PROP_APPLICATION_LANGUAGE "application.language"
/** For clients/streams on UNIX: application process PID, an integer formatted as string. e.g. "4711" */
#define PA_PROP_APPLICATION_PROCESS_ID "application.process.id"
/** For clients/streams: application process name. e.g. "totem" */
#define PA_PROP_APPLICATION_PROCESS_BINARY "application.process.binary"
/** For clients/streams: application user name. e.g. "lennart" */
#define PA_PROP_APPLICATION_PROCESS_USER "application.process.user"
/** For clients/streams: host name the application runs on. e.g. "omega" */
#define PA_PROP_APPLICATION_PROCESS_HOST "application.process.host"
/** For clients/streams: the D-Bus host id the application runs on. e.g. "543679e7b01393ed3e3e650047d78f6e" */
#define PA_PROP_APPLICATION_PROCESS_MACHINE_ID "application.process.machine_id"
/** For clients/streams: an id for the login session the application runs in. On Unix the value of $XDG_SESSION_COOKIE. e.g. "543679e7b01393ed3e3e650047d78f6e-1235159798.76193-190367717" */
#define PA_PROP_APPLICATION_PROCESS_SESSION_ID "application.process.session_id"
/** For devices: device string in the underlying audio layer's format. e.g. "surround51:0" */
#define PA_PROP_DEVICE_STRING "device.string"
/** For devices: API this device is access with. e.g. "alsa" */
#define PA_PROP_DEVICE_API "device.api"
/** For devices: localized human readable device one-line description, e.g. "Foobar Industries USB Headset 2000+ Ultra" */
#define PA_PROP_DEVICE_DESCRIPTION "device.description"
/** For devices: bus path to the device in the OS' format. e.g. "/sys/bus/pci/devices/0000:00:1f.2" */
#define PA_PROP_DEVICE_BUS_PATH "device.bus_path"
/** For devices: serial number if applicable. e.g. "4711-0815-1234" */
#define PA_PROP_DEVICE_SERIAL "device.serial"
/** For devices: vendor ID if applicable. e.g. 1274 */
#define PA_PROP_DEVICE_VENDOR_ID "device.vendor.id"
/** For devices: vendor name if applicable. e.g. "Foocorp Heavy Industries" */
#define PA_PROP_DEVICE_VENDOR_NAME "device.vendor.name"
/** For devices: product ID if applicable. e.g. 4565 */
#define PA_PROP_DEVICE_PRODUCT_ID "device.product.id"
/** For devices: product name if applicable. e.g. "SuperSpeakers 2000 Pro" */
#define PA_PROP_DEVICE_PRODUCT_NAME "device.product.name"
/** For devices: device class. One of "sound", "modem", "monitor", "filter" */
#define PA_PROP_DEVICE_CLASS "device.class"
/** For devices: form factor if applicable. One of "internal", "speaker", "handset", "tv", "webcam", "microphone", "headset", "headphone", "hands-free", "car", "hifi", "computer", "portable" */
#define PA_PROP_DEVICE_FORM_FACTOR "device.form_factor"
/** For devices: bus of the device if applicable. One of "isa", "pci", "usb", "firewire", "bluetooth" */
#define PA_PROP_DEVICE_BUS "device.bus"
/** \cond fulldocs */
/** For devices: icon for the device. A binary blob containing PNG image data */
#define PA_PROP_DEVICE_ICON "device.icon"
/** \endcond */
/** For devices: an XDG icon name for the device. e.g. "sound-card-speakers-usb" */
#define PA_PROP_DEVICE_ICON_NAME "device.icon_name"
/** For devices: access mode of the device if applicable. One of "mmap", "mmap_rewrite", "serial" */
#define PA_PROP_DEVICE_ACCESS_MODE "device.access_mode"
/** For filter devices: master device id if applicable. */
#define PA_PROP_DEVICE_MASTER_DEVICE "device.master_device"
/** For devices: buffer size in bytes, integer formatted as string.. */
#define PA_PROP_DEVICE_BUFFERING_BUFFER_SIZE "device.buffering.buffer_size"
/** For devices: fragment size in bytes, integer formatted as string. */
#define PA_PROP_DEVICE_BUFFERING_FRAGMENT_SIZE "device.buffering.fragment_size"
/** For devices: profile identifier for the profile this devices is in. e.g. "analog-stereo", "analog-surround-40", "iec958-stereo", ...*/
#define PA_PROP_DEVICE_PROFILE_NAME "device.profile.name"
/** For devices: intended use. A comma seperated list of roles (see PA_PROP_MEDIA_ROLE) this device is particularly well suited for, due to latency, quality or form factor. \since 0.9.16 */
#define PA_PROP_DEVICE_INTENDED_ROLES "device.intended_roles"
/** For devices: human readable one-line description of the profile this device is in. e.g. "Analog Stereo", ... */
#define PA_PROP_DEVICE_PROFILE_DESCRIPTION "device.profile.description"
/** For modules: the author's name, formatted as UTF-8 string. e.g. "Lennart Poettering" */
#define PA_PROP_MODULE_AUTHOR "module.author"
/** For modules: a human readable one-line description of the module's purpose formatted as UTF-8. e.g. "Frobnicate sounds with a flux compensator" */
#define PA_PROP_MODULE_DESCRIPTION "module.description"
/** For modules: a human readable usage description of the module's arguments formatted as UTF-8. */
#define PA_PROP_MODULE_USAGE "module.usage"
/** For modules: a version string for the module. e.g. "0.9.15" */
#define PA_PROP_MODULE_VERSION "module.version"
/** A property list object. Basically a dictionary with ASCII strings
* as keys and arbitrary data as values. \since 0.9.11 */
typedef struct pa_proplist pa_proplist;
/** Allocate a property list. \since 0.9.11 */
pa_proplist* pa_proplist_new(void);
/** Free the property list. \since 0.9.11 */
void pa_proplist_free(pa_proplist* p);
/** Append a new string entry to the property list, possibly
* overwriting an already existing entry with the same key. An
* internal copy of the data passed is made. Will accept only valid
* UTF-8. \since 0.9.11 */
int pa_proplist_sets(pa_proplist *p, const char *key, const char *value);
/** Append a new string entry to the property list, possibly
* overwriting an already existing entry with the same key. An
* internal copy of the data passed is made. Will accept only valid
* UTF-8. The string passed in must contain a '='. Left hand side of
* the '=' is used as key name, the right hand side as string
* data. \since 0.9.16 */
int pa_proplist_setp(pa_proplist *p, const char *pair);
/** Append a new string entry to the property list, possibly
* overwriting an already existing entry with the same key. An
* internal copy of the data passed is made. Will accept only valid
* UTF-8. The data can be passed as printf()-style format string with
* arguments. \since 0.9.11 */
int pa_proplist_setf(pa_proplist *p, const char *key, const char *format, ...) PA_GCC_PRINTF_ATTR(3,4);
/** Append a new arbitrary data entry to the property list, possibly
* overwriting an already existing entry with the same key. An
* internal copy of the data passed is made. \since 0.9.11 */
int pa_proplist_set(pa_proplist *p, const char *key, const void *data, size_t nbytes);
/** Return a string entry for the specified key. Will return NULL if
* the data is not valid UTF-8. Will return a NUL-terminated string in
* an internally allocated buffer. The caller should make a copy of
* the data before accessing the property list again. \since 0.9.11 */
const char *pa_proplist_gets(pa_proplist *p, const char *key);
/** Return the the value for the specified key. Will return a
* NUL-terminated string for string entries. The pointer returned will
* point to an internally allocated buffer. The caller should make a
* copy of the data before the property list is accessed again. \since
* 0.9.11 */
int pa_proplist_get(pa_proplist *p, const char *key, const void **data, size_t *nbytes);
/** Update mode enum for pa_proplist_update(). \since 0.9.11 */
typedef enum pa_update_mode {
PA_UPDATE_SET
/**< Replace the entire property list with the new one. Don't keep
* any of the old data around */,
PA_UPDATE_MERGE
/**< Merge new property list into the existing one, not replacing
* any old entries if they share a common key with the new
* property list. */,
PA_UPDATE_REPLACE
/**< Merge new property list into the existing one, replacing all
* old entries that share a common key with the new property
* list. */
} pa_update_mode_t;
/** \cond fulldocs */
#define PA_UPDATE_SET PA_UPDATE_SET
#define PA_UPDATE_MERGE PA_UPDATE_MERGE
#define PA_UPDATE_REPLACE PA_UPDATE_REPLACE
/** \endcond */
/** Merge property list "other" into "p", adhering the merge mode as
* specified in "mode". \since 0.9.11 */
void pa_proplist_update(pa_proplist *p, pa_update_mode_t mode, pa_proplist *other);
/** Removes a single entry from the property list, identified be the
* specified key name. \since 0.9.11 */
int pa_proplist_unset(pa_proplist *p, const char *key);
/** Similar to pa_proplist_remove() but takes an array of keys to
* remove. The array should be terminated by a NULL pointer. Return -1
* on failure, otherwise the number of entries actually removed (which
* might even be 0, if there where no matching entries to
* remove). \since 0.9.11 */
int pa_proplist_unset_many(pa_proplist *p, const char * const keys[]);
/** Iterate through the property list. The user should allocate a
* state variable of type void* and initialize it with NULL. A pointer
* to this variable should then be passed to pa_proplist_iterate()
* which should be called in a loop until it returns NULL which
* signifies EOL. The property list should not be modified during
* iteration through the list -- except for deleting the current
* looked at entry. On each invication this function will return the
* key string for the next entry. The keys in the property list do not
* have any particular order. \since 0.9.11 */
const char *pa_proplist_iterate(pa_proplist *p, void **state);
/** Format the property list nicely as a human readable string. This
* works very much like pa_proplist_to_string_sep() and uses a newline
* as seperator and appends one final one. Call pa_xfree() on the
* result. \since 0.9.11 */
char *pa_proplist_to_string(pa_proplist *p);
/** Format the property list nicely as a human readable string and
* choose the seperator. Call pa_xfree() on the result. \since
* 0.9.15 */
char *pa_proplist_to_string_sep(pa_proplist *p, const char *sep);
/** Allocate a new property list and assign key/value from a human
* readable string. \since 0.9.15 */
pa_proplist *pa_proplist_from_string(const char *str);
/** Returns 1 if an entry for the specified key is existant in the
* property list. \since 0.9.11 */
int pa_proplist_contains(pa_proplist *p, const char *key);
/** Remove all entries from the property list object. \since 0.9.11 */
void pa_proplist_clear(pa_proplist *p);
/** Allocate a new property list and copy over every single entry from
* the specific list. \since 0.9.11 */
pa_proplist* pa_proplist_copy(pa_proplist *t);
/** Return the number of entries on the property list. \since 0.9.15 */
unsigned pa_proplist_size(pa_proplist *t);
/** Returns 0 when the proplist is empty, positive otherwise \since 0.9.15 */
int pa_proplist_isempty(pa_proplist *t);
PA_C_DECL_END
#endif
|