2007-12-23 20:12:37 +00:00
|
|
|
#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.
|
|
|
|
|
***/
|
|
|
|
|
|
2008-06-16 18:43:18 +00:00
|
|
|
#include <sys/types.h>
|
|
|
|
|
|
2008-05-15 23:34:41 +00:00
|
|
|
#include <pulse/cdecl.h>
|
|
|
|
|
#include <pulse/gccmacro.h>
|
2009-01-27 02:36:42 +01:00
|
|
|
#include <pulse/version.h>
|
2008-05-15 23:34:41 +00:00
|
|
|
|
|
|
|
|
PA_C_DECL_BEGIN
|
2007-12-23 20:12:37 +00:00
|
|
|
|
|
|
|
|
/* Defined properties:
|
|
|
|
|
*
|
2008-05-15 23:34:41 +00:00
|
|
|
* media.name "Guns'N'Roses: Civil War"
|
|
|
|
|
* media.title "Civil War"
|
|
|
|
|
* media.artist "Guns'N'Roses"
|
|
|
|
|
* media.language "de_DE"
|
2007-12-23 20:12:37 +00:00
|
|
|
* media.filename
|
2008-07-21 18:55:17 +02:00
|
|
|
* media.icon Binary blob containing PNG icon data
|
|
|
|
|
* media.icon_name Name from XDG icon naming spec
|
2008-05-15 23:34:41 +00:00
|
|
|
* media.role video, music, game, event, phone, production, filter, abstract, stream
|
2008-07-21 18:55:17 +02:00
|
|
|
* event.id Name from XDG sound naming spec
|
|
|
|
|
* event.description "Button blabla clicked" for a11y
|
2008-06-11 00:37:10 +00:00
|
|
|
* event.mouse.x
|
|
|
|
|
* event.mouse.y
|
2008-07-21 18:55:17 +02:00
|
|
|
* event.mouse.hpos Float formatted as string in range 0..1
|
|
|
|
|
* event.mouse.vpos Float formatted as string in range 0..1
|
|
|
|
|
* event.mouse.button Button number following X11 ordering
|
2008-05-29 15:17:18 +00:00
|
|
|
* window.name
|
2008-07-21 18:55:17 +02:00
|
|
|
* window.id "org.gnome.rhytmbox.MainWindow"
|
|
|
|
|
* window.icon Binary blob containing PNG icon data
|
|
|
|
|
* window.icon_name Name from XDG icon naming spec
|
2008-05-29 15:17:18 +00:00
|
|
|
* window.x11.display
|
2008-06-11 00:37:10 +00:00
|
|
|
* window.x11.screen
|
|
|
|
|
* window.x11.monitor
|
2008-05-29 15:17:18 +00:00
|
|
|
* window.x11.xid
|
2008-05-15 23:34:41 +00:00
|
|
|
* application.name "Rhythmbox Media Player"
|
|
|
|
|
* application.id "org.gnome.rhythmbox"
|
2007-12-23 20:12:37 +00:00
|
|
|
* application.version
|
2008-07-21 18:55:17 +02:00
|
|
|
* application.icon Binary blob containing PNG icon data
|
|
|
|
|
* application.icon_name Name from XDG icon naming spec
|
2008-05-29 15:17:18 +00:00
|
|
|
* application.language
|
2008-05-15 23:34:41 +00:00
|
|
|
* application.process.id
|
|
|
|
|
* application.process.binary
|
|
|
|
|
* application.process.user
|
|
|
|
|
* application.process.host
|
2009-02-02 00:21:41 +01:00
|
|
|
* application.process.machine_id D-Bus machine ID
|
2008-05-15 23:34:41 +00:00
|
|
|
* device.string
|
2008-07-21 18:55:17 +02:00
|
|
|
* device.api oss, alsa, sunaudio
|
2008-05-15 23:34:41 +00:00
|
|
|
* device.description
|
|
|
|
|
* device.bus_path
|
|
|
|
|
* device.serial
|
|
|
|
|
* device.vendor_product_id
|
2008-07-21 18:55:17 +02:00
|
|
|
* device.class sound, modem, monitor, filter, abstract
|
2009-02-02 00:22:02 +01:00
|
|
|
* device.form_factor laptop-speakers, external-speakers, telephone, tv-capture, webcam-capture, microphone-capture, headset, headphones, hands-free, car, hifi, computer, portable
|
2008-07-21 18:55:17 +02:00
|
|
|
* device.connector isa, pci, usb, firewire, bluetooth
|
|
|
|
|
* device.access_mode mmap, mmap_rewrite, serial
|
2008-05-15 23:34:41 +00:00
|
|
|
* device.master_device
|
2009-01-15 23:46:42 +01:00
|
|
|
* device.buffering.buffer_size
|
|
|
|
|
* device.buffering.fragment_size
|
|
|
|
|
* device.profile.name analog-stereo, analog-surround-40, iec958-stereo, ...
|
|
|
|
|
* device.profile.description "Analog Stereo", ...
|
2007-12-23 20:12:37 +00:00
|
|
|
*/
|
2008-05-15 23:34:41 +00:00
|
|
|
#define PA_PROP_MEDIA_NAME "media.name"
|
|
|
|
|
#define PA_PROP_MEDIA_TITLE "media.title"
|
|
|
|
|
#define PA_PROP_MEDIA_ARTIST "media.artist"
|
|
|
|
|
#define PA_PROP_MEDIA_LANGUAGE "media.language"
|
|
|
|
|
#define PA_PROP_MEDIA_FILENAME "media.filename"
|
|
|
|
|
#define PA_PROP_MEDIA_ICON "media.icon"
|
|
|
|
|
#define PA_PROP_MEDIA_ICON_NAME "media.icon_name"
|
|
|
|
|
#define PA_PROP_MEDIA_ROLE "media.role"
|
|
|
|
|
#define PA_PROP_EVENT_ID "event.id"
|
2008-07-21 18:55:17 +02:00
|
|
|
#define PA_PROP_EVENT_DESCRIPTION "event.description"
|
2008-05-15 23:34:41 +00:00
|
|
|
#define PA_PROP_EVENT_MOUSE_X "event.mouse.x"
|
|
|
|
|
#define PA_PROP_EVENT_MOUSE_Y "event.mouse.y"
|
2008-06-11 00:37:10 +00:00
|
|
|
#define PA_PROP_EVENT_MOUSE_HPOS "event.mouse.hpos"
|
|
|
|
|
#define PA_PROP_EVENT_MOUSE_VPOS "event.mouse.vpos"
|
2008-05-15 23:34:41 +00:00
|
|
|
#define PA_PROP_EVENT_MOUSE_BUTTON "event.mouse.button"
|
2008-05-29 15:17:18 +00:00
|
|
|
#define PA_PROP_WINDOW_NAME "window.name"
|
|
|
|
|
#define PA_PROP_WINDOW_ID "window.id"
|
|
|
|
|
#define PA_PROP_WINDOW_ICON "window.icon"
|
|
|
|
|
#define PA_PROP_WINDOW_ICON_NAME "window.icon_name"
|
|
|
|
|
#define PA_PROP_WINDOW_X11_DISPLAY "window.x11.display"
|
2008-06-11 00:37:10 +00:00
|
|
|
#define PA_PROP_WINDOW_X11_SCREEN "window.x11.screen"
|
|
|
|
|
#define PA_PROP_WINDOW_X11_MONITOR "window.x11.monitor"
|
2008-05-29 15:17:18 +00:00
|
|
|
#define PA_PROP_WINDOW_X11_XID "window.x11.xid"
|
2008-05-15 23:34:41 +00:00
|
|
|
#define PA_PROP_APPLICATION_NAME "application.name"
|
|
|
|
|
#define PA_PROP_APPLICATION_ID "application.id"
|
|
|
|
|
#define PA_PROP_APPLICATION_VERSION "application.version"
|
|
|
|
|
#define PA_PROP_APPLICATION_ICON "application.icon"
|
|
|
|
|
#define PA_PROP_APPLICATION_ICON_NAME "application.icon_name"
|
|
|
|
|
#define PA_PROP_APPLICATION_LANGUAGE "application.language"
|
|
|
|
|
#define PA_PROP_APPLICATION_PROCESS_ID "application.process.id"
|
|
|
|
|
#define PA_PROP_APPLICATION_PROCESS_BINARY "application.process.binary"
|
|
|
|
|
#define PA_PROP_APPLICATION_PROCESS_USER "application.process.user"
|
|
|
|
|
#define PA_PROP_APPLICATION_PROCESS_HOST "application.process.host"
|
2009-02-02 00:21:41 +01:00
|
|
|
#define PA_PROP_APPLICATION_PROCESS_MACHINE_ID "application.process.machine_id"
|
2008-05-15 23:34:41 +00:00
|
|
|
#define PA_PROP_DEVICE_STRING "device.string"
|
|
|
|
|
#define PA_PROP_DEVICE_API "device.api"
|
|
|
|
|
#define PA_PROP_DEVICE_DESCRIPTION "device.description"
|
|
|
|
|
#define PA_PROP_DEVICE_BUS_PATH "device.bus_path"
|
|
|
|
|
#define PA_PROP_DEVICE_SERIAL "device.serial"
|
|
|
|
|
#define PA_PROP_DEVICE_VENDOR_PRODUCT_ID "device.vendor_product_id"
|
|
|
|
|
#define PA_PROP_DEVICE_CLASS "device.class"
|
|
|
|
|
#define PA_PROP_DEVICE_FORM_FACTOR "device.form_factor"
|
|
|
|
|
#define PA_PROP_DEVICE_CONNECTOR "device.connector"
|
|
|
|
|
#define PA_PROP_DEVICE_ACCESS_MODE "device.access_mode"
|
|
|
|
|
#define PA_PROP_DEVICE_MASTER_DEVICE "device.master_device"
|
|
|
|
|
#define PA_PROP_DEVICE_BUFFERING_BUFFER_SIZE "device.buffering.buffer_size"
|
|
|
|
|
#define PA_PROP_DEVICE_BUFFERING_FRAGMENT_SIZE "device.buffering.fragment_size"
|
2009-01-15 23:46:42 +01:00
|
|
|
#define PA_PROP_DEVICE_PROFILE_NAME "device.profile.name"
|
|
|
|
|
#define PA_PROP_DEVICE_PROFILE_DESCRIPTION "device.profile.description"
|
2009-01-19 22:02:28 +01:00
|
|
|
#define PA_PROP_MODULE_AUTHOR "module.author"
|
|
|
|
|
#define PA_PROP_MODULE_DESCRIPTION "module.description"
|
|
|
|
|
#define PA_PROP_MODULE_USAGE "module.usage"
|
|
|
|
|
#define PA_PROP_MODULE_VERSION "module.version"
|
2008-05-15 23:34:41 +00:00
|
|
|
|
2009-02-04 17:14:59 +01:00
|
|
|
/** A property list object. Basically a dictionary with ASCII strings
|
2008-05-15 23:34:41 +00:00
|
|
|
* as keys and arbitrary data as values. \since 0.9.11 */
|
2007-12-23 20:12:37 +00:00
|
|
|
typedef struct pa_proplist pa_proplist;
|
|
|
|
|
|
2008-05-15 23:34:41 +00:00
|
|
|
/** Allocate a property list. \since 0.9.11 */
|
2007-12-23 20:12:37 +00:00
|
|
|
pa_proplist* pa_proplist_new(void);
|
|
|
|
|
|
2008-05-15 23:34:41 +00:00
|
|
|
/** Free the property list. \since 0.9.11 */
|
|
|
|
|
void pa_proplist_free(pa_proplist* p);
|
2007-12-23 20:12:37 +00:00
|
|
|
|
2008-05-15 23:34:41 +00:00
|
|
|
/** 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 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);
|
|
|
|
|
|
2009-01-27 02:37:13 +01:00
|
|
|
/** Return a string entry for the specified key. Will return NULL if
|
2008-05-15 23:34:41 +00:00
|
|
|
* 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 */
|
2007-12-23 20:12:37 +00:00
|
|
|
const char *pa_proplist_gets(pa_proplist *p, const char *key);
|
|
|
|
|
|
2008-05-15 23:34:41 +00:00
|
|
|
/** 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);
|
2007-12-23 20:12:37 +00:00
|
|
|
|
2008-05-15 23:34:41 +00:00
|
|
|
/** Update mode enum for pa_proplist_update(). \since 0.9.11 */
|
|
|
|
|
typedef enum pa_update_mode {
|
2008-09-03 18:51:46 +02:00
|
|
|
PA_UPDATE_SET,
|
|
|
|
|
/*< Replace the entirey 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. */
|
2008-05-15 23:34:41 +00:00
|
|
|
} pa_update_mode_t;
|
|
|
|
|
|
2009-02-06 02:01:17 +01:00
|
|
|
/** \cond fulldocs */
|
|
|
|
|
#define PA_UPDATE_SET PA_UPDATE_SET
|
|
|
|
|
#define PA_UPDATE_MERGE PA_UPDATE_MERGE
|
|
|
|
|
#define PA_UPDATE_REPLACE PA_UPDATE_REPLACE
|
|
|
|
|
/** \endcond */
|
|
|
|
|
|
2008-05-15 23:34:41 +00:00
|
|
|
/** 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
|
2008-05-29 15:17:18 +00:00
|
|
|
* 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 */
|
2007-12-23 20:12:37 +00:00
|
|
|
const char *pa_proplist_iterate(pa_proplist *p, void **state);
|
|
|
|
|
|
2009-01-17 01:59:37 +01:00
|
|
|
/** 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 */
|
2007-12-23 20:12:37 +00:00
|
|
|
char *pa_proplist_to_string(pa_proplist *p);
|
|
|
|
|
|
2009-01-17 01:59:37 +01:00
|
|
|
/** Format the property list nicely as a human readable string and
|
|
|
|
|
* choose the seperator. Call pa_xfree() on the result. \since
|
2009-01-14 00:05:54 +01:00
|
|
|
* 0.9.15 */
|
2009-01-17 01:59:37 +01:00
|
|
|
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 */
|
2008-10-27 21:14:50 +02:00
|
|
|
pa_proplist *pa_proplist_from_string(const char *str);
|
|
|
|
|
|
|
|
|
|
/** Returns 1 if an entry for the specified key is existant in the
|
2008-05-15 23:34:41 +00:00
|
|
|
* property list. \since 0.9.11 */
|
2007-12-29 18:03:53 +00:00
|
|
|
int pa_proplist_contains(pa_proplist *p, const char *key);
|
|
|
|
|
|
2008-05-15 23:34:41 +00:00
|
|
|
/** 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);
|
|
|
|
|
|
2009-01-14 00:06:26 +01:00
|
|
|
/** 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);
|
|
|
|
|
|
2008-05-15 23:34:41 +00:00
|
|
|
PA_C_DECL_END
|
|
|
|
|
|
2007-12-23 20:12:37 +00:00
|
|
|
#endif
|