1 module pulse.proplist; 2 3 version(linux): 4 5 extern (C): 6 7 /*** 8 This file is part of PulseAudio. 9 10 Copyright 2007 Lennart Poettering 11 12 PulseAudio is free software; you can redistribute it and/or modify 13 it under the terms of the GNU Lesser General Public License as 14 published by the Free Software Foundation; either version 2.1 of the 15 License, or (at your option) any later version. 16 17 PulseAudio is distributed in the hope that it will be useful, but 18 WITHOUT ANY WARRANTY; without even the implied warranty of 19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 20 Lesser General Public License for more details. 21 22 You should have received a copy of the GNU Lesser General Public 23 License along with PulseAudio; if not, see <http://www.gnu.org/licenses/>. 24 ***/ 25 26 /** \file 27 * Property list constants and functions */ 28 29 /** For streams: localized media name, formatted as UTF-8. E.g. "Guns'N'Roses: Civil War".*/ 30 enum PA_PROP_MEDIA_NAME = "media.name"; 31 32 /** For streams: localized media title if applicable, formatted as UTF-8. E.g. "Civil War" */ 33 enum PA_PROP_MEDIA_TITLE = "media.title"; 34 35 /** For streams: localized media artist if applicable, formatted as UTF-8. E.g. "Guns'N'Roses" */ 36 enum PA_PROP_MEDIA_ARTIST = "media.artist"; 37 38 /** For streams: localized media copyright string if applicable, formatted as UTF-8. E.g. "Evil Record Corp." */ 39 enum PA_PROP_MEDIA_COPYRIGHT = "media.copyright"; 40 41 /** For streams: localized media generator software string if applicable, formatted as UTF-8. E.g. "Foocrop AudioFrobnicator" */ 42 enum PA_PROP_MEDIA_SOFTWARE = "media.software"; 43 44 /** For streams: media language if applicable, in standard POSIX format. E.g. "de_DE" */ 45 enum PA_PROP_MEDIA_LANGUAGE = "media.language"; 46 47 /** For streams: source filename if applicable, in URI format or local path. E.g. "/home/lennart/music/foobar.ogg" */ 48 enum PA_PROP_MEDIA_FILENAME = "media.filename"; 49 50 /** \cond fulldocs */ 51 /** For streams: icon for the media. A binary blob containing PNG image data */ 52 enum PA_PROP_MEDIA_ICON = "media.icon"; 53 /** \endcond */ 54 55 /** For streams: an XDG icon name for the media. E.g. "audio-x-mp3" */ 56 enum PA_PROP_MEDIA_ICON_NAME = "media.icon_name"; 57 58 /** For streams: logic role of this media. One of the strings "video", "music", "game", "event", "phone", "animation", "production", "a11y", "test" */ 59 enum PA_PROP_MEDIA_ROLE = "media.role"; 60 61 /** For streams: the name of a filter that is desired, e.g.\ "echo-cancel" or "equalizer-sink". PulseAudio may choose to not apply the filter if it does not make sense (for example, applying echo-cancellation on a Bluetooth headset probably does not make sense. \since 1.0 */ 62 enum PA_PROP_FILTER_WANT = "filter.want"; 63 64 /** For streams: the name of a filter that is desired, e.g.\ "echo-cancel" or "equalizer-sink". Differs from PA_PROP_FILTER_WANT in that it forces PulseAudio to apply the filter, regardless of whether PulseAudio thinks it makes sense to do so or not. If this is set, PA_PROP_FILTER_WANT is ignored. In other words, you almost certainly do not want to use this. \since 1.0 */ 65 enum PA_PROP_FILTER_APPLY = "filter.apply"; 66 67 /** For streams: the name of a filter that should specifically suppressed (i.e.\ overrides PA_PROP_FILTER_WANT). Useful for the times that PA_PROP_FILTER_WANT is automatically added (e.g. echo-cancellation for phone streams when $VOIP_APP does its own, internal AEC) \since 1.0 */ 68 enum PA_PROP_FILTER_SUPPRESS = "filter.suppress"; 69 70 /** For event sound streams: XDG event sound name. e.g.\ "message-new-email" (Event sound streams are those with media.role set to "event") */ 71 enum PA_PROP_EVENT_ID = "event.id"; 72 73 /** 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." */ 74 enum PA_PROP_EVENT_DESCRIPTION = "event.description"; 75 76 /** 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" */ 77 enum PA_PROP_EVENT_MOUSE_X = "event.mouse.x"; 78 79 /** 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" */ 80 enum PA_PROP_EVENT_MOUSE_Y = "event.mouse.y"; 81 82 /** 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" */ 83 enum PA_PROP_EVENT_MOUSE_HPOS = "event.mouse.hpos"; 84 85 /** 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" */ 86 enum PA_PROP_EVENT_MOUSE_VPOS = "event.mouse.vpos"; 87 88 /** 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" */ 89 enum PA_PROP_EVENT_MOUSE_BUTTON = "event.mouse.button"; 90 91 /** For streams that belong to a window on the screen: localized window title. E.g. "Totem Music Player" */ 92 enum PA_PROP_WINDOW_NAME = "window.name"; 93 94 /** For streams that belong to a window on the screen: a textual id for identifying a window logically. E.g. "org.gnome.Totem.MainWindow" */ 95 enum PA_PROP_WINDOW_ID = "window.id"; 96 97 /** \cond fulldocs */ 98 /** For streams that belong to a window on the screen: window icon. A binary blob containing PNG image data */ 99 enum PA_PROP_WINDOW_ICON = "window.icon"; 100 /** \endcond */ 101 102 /** For streams that belong to a window on the screen: an XDG icon name for the window. E.g. "totem" */ 103 enum PA_PROP_WINDOW_ICON_NAME = "window.icon_name"; 104 105 /** For streams that belong to a window on the screen: absolute horizontal window position on the screen, integer formatted as text string. E.g. "865". \since 0.9.17 */ 106 enum PA_PROP_WINDOW_X = "window.x"; 107 108 /** For streams that belong to a window on the screen: absolute vertical window position on the screen, integer formatted as text string. E.g. "343". \since 0.9.17 */ 109 enum PA_PROP_WINDOW_Y = "window.y"; 110 111 /** For streams that belong to a window on the screen: window width on the screen, integer formatted as text string. e.g. "365". \since 0.9.17 */ 112 enum PA_PROP_WINDOW_WIDTH = "window.width"; 113 114 /** For streams that belong to a window on the screen: window height on the screen, integer formatted as text string. E.g. "643". \since 0.9.17 */ 115 enum PA_PROP_WINDOW_HEIGHT = "window.height"; 116 117 /** For streams that belong to a window on the screen: relative position of the window center on the screen, 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". \since 0.9.17 */ 118 enum PA_PROP_WINDOW_HPOS = "window.hpos"; 119 120 /** For streams that belong to a window on the screen: relative position of the window center on the screen, float formatted as text string, ranging from 0.0 (top of the screen) to 1.0 (bottom of the screen). E.g. "0.43". \since 0.9.17 */ 121 enum PA_PROP_WINDOW_VPOS = "window.vpos"; 122 123 /** For streams that belong to a window on the screen: if the windowing system supports multiple desktops, a comma separated list of indexes of the desktops this window is visible on. If this property is an empty string, it is visible on all desktops (i.e. 'sticky'). The first desktop is 0. E.g. "0,2,3" \since 0.9.18 */ 124 enum PA_PROP_WINDOW_DESKTOP = "window.desktop"; 125 126 /** For streams that belong to an X11 window on the screen: the X11 display string. E.g. ":0.0" */ 127 enum PA_PROP_WINDOW_X11_DISPLAY = "window.x11.display"; 128 129 /** 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" */ 130 enum PA_PROP_WINDOW_X11_SCREEN = "window.x11.screen"; 131 132 /** 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" */ 133 enum PA_PROP_WINDOW_X11_MONITOR = "window.x11.monitor"; 134 135 /** For streams that belong to an X11 window on the screen: the window XID, an integer formatted as string. E.g. "25632" */ 136 enum PA_PROP_WINDOW_X11_XID = "window.x11.xid"; 137 138 /** For clients/streams: localized human readable application name. E.g. "Totem Music Player" */ 139 enum PA_PROP_APPLICATION_NAME = "application.name"; 140 141 /** For clients/streams: a textual id for identifying an application logically. E.g. "org.gnome.Totem" */ 142 enum PA_PROP_APPLICATION_ID = "application.id"; 143 144 /** For clients/streams: a version string, e.g.\ "0.6.88" */ 145 enum PA_PROP_APPLICATION_VERSION = "application.version"; 146 147 /** \cond fulldocs */ 148 /** For clients/streams: application icon. A binary blob containing PNG image data */ 149 enum PA_PROP_APPLICATION_ICON = "application.icon"; 150 /** \endcond */ 151 152 /** For clients/streams: an XDG icon name for the application. E.g. "totem" */ 153 enum PA_PROP_APPLICATION_ICON_NAME = "application.icon_name"; 154 155 /** For clients/streams: application language if applicable, in standard POSIX format. E.g. "de_DE" */ 156 enum PA_PROP_APPLICATION_LANGUAGE = "application.language"; 157 158 /** For clients/streams on UNIX: application process PID, an integer formatted as string. E.g. "4711" */ 159 enum PA_PROP_APPLICATION_PROCESS_ID = "application.process.id"; 160 161 /** For clients/streams: application process name. E.g. "totem" */ 162 enum PA_PROP_APPLICATION_PROCESS_BINARY = "application.process.binary"; 163 164 /** For clients/streams: application user name. E.g. "lennart" */ 165 enum PA_PROP_APPLICATION_PROCESS_USER = "application.process.user"; 166 167 /** For clients/streams: host name the application runs on. E.g. "omega" */ 168 enum PA_PROP_APPLICATION_PROCESS_HOST = "application.process.host"; 169 170 /** For clients/streams: the D-Bus host id the application runs on. E.g. "543679e7b01393ed3e3e650047d78f6e" */ 171 enum PA_PROP_APPLICATION_PROCESS_MACHINE_ID = "application.process.machine_id"; 172 173 /** For clients/streams: an id for the login session the application runs in. On Unix the value of $XDG_SESSION_ID. E.g. "5" */ 174 enum PA_PROP_APPLICATION_PROCESS_SESSION_ID = "application.process.session_id"; 175 176 /** For devices: device string in the underlying audio layer's format. E.g. "surround51:0" */ 177 enum PA_PROP_DEVICE_STRING = "device.string"; 178 179 /** For devices: API this device is access with. E.g. "alsa" */ 180 enum PA_PROP_DEVICE_API = "device.api"; 181 182 /** For devices: localized human readable device one-line description. E.g. "Foobar Industries USB Headset 2000+ Ultra" */ 183 enum PA_PROP_DEVICE_DESCRIPTION = "device.description"; 184 185 /** For devices: bus path to the device in the OS' format. E.g. "/sys/bus/pci/devices/0000:00:1f.2" */ 186 enum PA_PROP_DEVICE_BUS_PATH = "device.bus_path"; 187 188 /** For devices: serial number if applicable. E.g. "4711-0815-1234" */ 189 enum PA_PROP_DEVICE_SERIAL = "device.serial"; 190 191 /** For devices: vendor ID if applicable. E.g. 1274 */ 192 enum PA_PROP_DEVICE_VENDOR_ID = "device.vendor.id"; 193 194 /** For devices: vendor name if applicable. E.g. "Foocorp Heavy Industries" */ 195 enum PA_PROP_DEVICE_VENDOR_NAME = "device.vendor.name"; 196 197 /** For devices: product ID if applicable. E.g. 4565 */ 198 enum PA_PROP_DEVICE_PRODUCT_ID = "device.product.id"; 199 200 /** For devices: product name if applicable. E.g. "SuperSpeakers 2000 Pro" */ 201 enum PA_PROP_DEVICE_PRODUCT_NAME = "device.product.name"; 202 203 /** For devices: device class. One of "sound", "modem", "monitor", "filter" */ 204 enum PA_PROP_DEVICE_CLASS = "device.class"; 205 206 /** For devices: form factor if applicable. One of "internal", "speaker", "handset", "tv", "webcam", "microphone", "headset", "headphone", "hands-free", "car", "hifi", "computer", "portable" */ 207 enum PA_PROP_DEVICE_FORM_FACTOR = "device.form_factor"; 208 209 /** For devices: bus of the device if applicable. One of "isa", "pci", "usb", "firewire", "bluetooth" */ 210 enum PA_PROP_DEVICE_BUS = "device.bus"; 211 212 /** \cond fulldocs */ 213 /** For devices: icon for the device. A binary blob containing PNG image data */ 214 enum PA_PROP_DEVICE_ICON = "device.icon"; 215 /** \endcond */ 216 217 /** For devices: an XDG icon name for the device. E.g. "sound-card-speakers-usb" */ 218 enum PA_PROP_DEVICE_ICON_NAME = "device.icon_name"; 219 220 /** For devices: access mode of the device if applicable. One of "mmap", "mmap_rewrite", "serial" */ 221 enum PA_PROP_DEVICE_ACCESS_MODE = "device.access_mode"; 222 223 /** For filter devices: master device id if applicable. */ 224 enum PA_PROP_DEVICE_MASTER_DEVICE = "device.master_device"; 225 226 /** For devices: buffer size in bytes, integer formatted as string. */ 227 enum PA_PROP_DEVICE_BUFFERING_BUFFER_SIZE = "device.buffering.buffer_size"; 228 229 /** For devices: fragment size in bytes, integer formatted as string. */ 230 enum PA_PROP_DEVICE_BUFFERING_FRAGMENT_SIZE = "device.buffering.fragment_size"; 231 232 /** For devices: profile identifier for the profile this devices is in. E.g. "analog-stereo", "analog-surround-40", "iec958-stereo", ...*/ 233 enum PA_PROP_DEVICE_PROFILE_NAME = "device.profile.name"; 234 235 /** For devices: intended use. A space separated 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 */ 236 enum PA_PROP_DEVICE_INTENDED_ROLES = "device.intended_roles"; 237 238 /** For devices: human readable one-line description of the profile this device is in. E.g. "Analog Stereo", ... */ 239 enum PA_PROP_DEVICE_PROFILE_DESCRIPTION = "device.profile.description"; 240 241 /** For modules: the author's name, formatted as UTF-8 string. E.g. "Lennart Poettering" */ 242 enum PA_PROP_MODULE_AUTHOR = "module.author"; 243 244 /** 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" */ 245 enum PA_PROP_MODULE_DESCRIPTION = "module.description"; 246 247 /** For modules: a human readable usage description of the module's arguments formatted as UTF-8. */ 248 enum PA_PROP_MODULE_USAGE = "module.usage"; 249 250 /** For modules: a version string for the module. E.g. "0.9.15" */ 251 enum PA_PROP_MODULE_VERSION = "module.version"; 252 253 /** For PCM formats: the sample format used as returned by pa_sample_format_to_string() \since 1.0 */ 254 enum PA_PROP_FORMAT_SAMPLE_FORMAT = "format.sample_format"; 255 256 /** For all formats: the sample rate (unsigned integer) \since 1.0 */ 257 enum PA_PROP_FORMAT_RATE = "format.rate"; 258 259 /** For all formats: the number of channels (unsigned integer) \since 1.0 */ 260 enum PA_PROP_FORMAT_CHANNELS = "format.channels"; 261 262 /** For PCM formats: the channel map of the stream as returned by pa_channel_map_snprint() \since 1.0 */ 263 enum PA_PROP_FORMAT_CHANNEL_MAP = "format.channel_map"; 264 265 /** For context: whether to forcefully disable data transfer via POSIX or memfd shared memory. This property overrides any other client configuration which would otherwise enable SHM communication channels. \since 15.0 */ 266 enum PA_PROP_CONTEXT_FORCE_DISABLE_SHM = "context.force.disable.shm"; 267 268 /** For a bluez device: the currently selected codec name. \since 15.0 */ 269 enum PA_PROP_BLUETOOTH_CODEC = "bluetooth.codec"; 270 271 /** A property list object. Basically a dictionary with ASCII strings 272 * as keys and arbitrary data as values. \since 0.9.11 */ 273 struct pa_proplist; 274 275 /** Allocate a property list. Free with pa_proplist_free. \since 0.9.11 */ 276 pa_proplist* pa_proplist_new (); 277 278 /** Free the property list. \since 0.9.11 */ 279 void pa_proplist_free (pa_proplist* p); 280 281 /** Returns a non-zero value if the key is valid. \since 3.0 */ 282 int pa_proplist_key_valid (const(char)* key); 283 284 /** Append a new string entry to the property list, possibly 285 * overwriting an already existing entry with the same key. An 286 * internal copy of the data passed is made. Will accept only valid 287 * UTF-8. Returns zero on success. \since 0.9.11 */ 288 int pa_proplist_sets (pa_proplist* p, const(char)* key, const(char)* value); 289 290 /** Append a new string entry to the property list, possibly 291 * overwriting an already existing entry with the same key. An 292 * internal copy of the data passed is made. Will accept only valid 293 * UTF-8. The string passed in must contain a '='. Left hand side of 294 * the '=' is used as key name, the right hand side as string 295 * data. Returns zero on success. \since 0.9.16 */ 296 int pa_proplist_setp (pa_proplist* p, const(char)* pair); 297 298 /** Append a new string entry to the property list, possibly 299 * overwriting an already existing entry with the same key. An 300 * internal copy of the data passed is made. Will accept only valid 301 * UTF-8. The data can be passed as printf()-style format string with 302 * arguments. Returns zero on success. \since 0.9.11 */ 303 int pa_proplist_setf (pa_proplist* p, const(char)* key, const(char)* format, ...); 304 305 /** Append a new arbitrary data entry to the property list, possibly 306 * overwriting an already existing entry with the same key. An 307 * internal copy of the data passed is made. 308 * Returns zero on success. \since 0.9.11 */ 309 int pa_proplist_set (pa_proplist* p, const(char)* key, const(void)* data, size_t nbytes); 310 311 /** Return a string entry for the specified key. Will return NULL if 312 * the data is not valid UTF-8. Will return a NUL-terminated string in 313 * an internally allocated buffer. The caller should make a copy of 314 * the data before accessing the property list again. \since 0.9.11 */ 315 const(char)* pa_proplist_gets (const(pa_proplist)* p, const(char)* key); 316 317 /** Store the value for the specified key in \a data. Will store a 318 * NUL-terminated string for string entries. The \a data pointer returned will 319 * point to an internally allocated buffer. The caller should make a 320 * copy of the data before any subsequent modification or destruction 321 * of the property list. 322 * Returns zero on success, negative on error. \since 0.9.11 */ 323 int pa_proplist_get (const(pa_proplist)* p, const(char)* key, const(void*)* data, size_t* nbytes); 324 325 /** Update mode enum for pa_proplist_update(). \since 0.9.11 */ 326 enum pa_update_mode 327 { 328 PA_UPDATE_SET = 0, 329 /**< Replace the entire property list with the new one. Don't keep 330 * any of the old data around. */ 331 332 PA_UPDATE_MERGE = 1, 333 /**< Merge new property list into the existing one, not replacing 334 * any old entries if they share a common key with the new 335 * property list. */ 336 337 PA_UPDATE_REPLACE = 2 338 /**< Merge new property list into the existing one, replacing all 339 * old entries that share a common key with the new property 340 * list. */ 341 } 342 343 alias pa_update_mode_t = pa_update_mode; 344 345 /** \cond fulldocs */ 346 enum PA_UPDATE_SET = pa_update_mode_t.PA_UPDATE_SET; 347 enum PA_UPDATE_MERGE = pa_update_mode_t.PA_UPDATE_MERGE; 348 enum PA_UPDATE_REPLACE = pa_update_mode_t.PA_UPDATE_REPLACE; 349 /** \endcond */ 350 351 /** Merge property list "other" into "p", adhering the merge mode as 352 * specified in "mode". \since 0.9.11 */ 353 void pa_proplist_update (pa_proplist* p, pa_update_mode_t mode, const(pa_proplist)* other); 354 355 /** Removes a single entry from the property list, identified be the 356 * specified key name. Returns zero on success, negative on error. 357 * \since 0.9.11 */ 358 int pa_proplist_unset (pa_proplist* p, const(char)* key); 359 360 /** Similar to pa_proplist_unset() but takes an array of keys to 361 * remove. The array should be terminated by a NULL pointer. Returns -1 362 * on failure, otherwise the number of entries actually removed (which 363 * might even be 0, if there were no matching entries to 364 * remove). \since 0.9.11 */ 365 int pa_proplist_unset_many (pa_proplist* p, const(char*)* keys); 366 367 /** Iterate through the property list. The user should allocate a 368 * state variable of type void* and initialize it with NULL. A pointer 369 * to this variable should then be passed to pa_proplist_iterate() 370 * which should be called in a loop until it returns NULL which 371 * signifies EOL. The property list should not be modified during 372 * iteration through the list -- with the exception of deleting the 373 * current entry. On each invocation this function will return the 374 * key string for the next entry. The keys in the property list do not 375 * have any particular order. \since 0.9.11 */ 376 const(char)* pa_proplist_iterate (const(pa_proplist)* p, void** state); 377 378 /** Format the property list nicely as a human readable string. This 379 * works very much like pa_proplist_to_string_sep() and uses a newline 380 * as separator and appends one final one. Call pa_xfree() on the 381 * result. \since 0.9.11 */ 382 char* pa_proplist_to_string (const(pa_proplist)* p); 383 384 /** Format the property list nicely as a human readable string and 385 * choose the separator. Call pa_xfree() on the result. \since 386 * 0.9.15 */ 387 char* pa_proplist_to_string_sep (const(pa_proplist)* p, const(char)* sep); 388 389 /** Allocate a new property list and assign key/value from a human 390 * readable string. \since 0.9.15 */ 391 pa_proplist* pa_proplist_from_string (const(char)* str); 392 393 /** Returns 1 if an entry for the specified key exists in the 394 * property list. Returns negative on error. \since 0.9.11 */ 395 int pa_proplist_contains (const(pa_proplist)* p, const(char)* key); 396 397 /** Remove all entries from the property list object. \since 0.9.11 */ 398 void pa_proplist_clear (pa_proplist* p); 399 400 /** Allocate a new property list and copy over every single entry from 401 * the specified list. \since 0.9.11 */ 402 pa_proplist* pa_proplist_copy (const(pa_proplist)* p); 403 404 /** Return the number of entries in the property list. \since 0.9.15 */ 405 uint pa_proplist_size (const(pa_proplist)* p); 406 407 /** Returns 0 when the proplist is empty, positive otherwise \since 0.9.15 */ 408 int pa_proplist_isempty (const(pa_proplist)* p); 409 410 /** Return non-zero when a and b have the same keys and values. 411 * \since 0.9.16 */ 412 int pa_proplist_equal (const(pa_proplist)* a, const(pa_proplist)* b); 413