spa: add keys for properties

Define and document property keys
This commit is contained in:
Wim Taymans 2019-06-03 16:48:01 +02:00
parent 1f250046a3
commit 49ef8f9b5f
35 changed files with 333 additions and 134 deletions

View file

@ -236,6 +236,42 @@ struct spa_device_methods {
#define spa_device_enum_params(d,...) spa_device_method(d, enum_params, 0, __VA_ARGS__)
#define spa_device_set_param(d,...) spa_device_method(d, set_param, 0, __VA_ARGS__)
#define SPA_KEY_DEVICE_API "device.api" /**< the api used by the device
* Ex. "alsa", "v4l2". */
#define SPA_KEY_DEVICE_NAME "device.name" /**< the name of the device */
#define SPA_KEY_DEVICE_ALIAS "device.alias" /**< altenative name of the device */
#define SPA_KEY_DEVICE_NICK "device.nick" /**< the device short name */
#define SPA_KEY_DEVICE_ID "device.id" /**< the device id */
#define SPA_KEY_DEVICE_DESCRIPTION "device.description" /**< a device description */
#define SPA_KEY_DEVICE_ICON "device.icon" /**< icon for the device. A base64 blob
* containing PNG image data */
#define SPA_KEY_DEVICE_ICON_NAME "device.icon-name" /**< an XDG icon name for the device.
* Ex. "sound-card-speakers-usb" */
#define SPA_KEY_DEVICE_PLUGGED_USEC "device.plugged.usec" /**< when the device was plugged */
#define SPA_KEY_DEVICE_BUS_PATH "device.bus-path" /**< bus path to the device in the OS'
* format.
* Ex. "pci-0000:00:14.0-usb-0:3.2:1.0" */
#define SPA_KEY_DEVICE_BUS "device.bus" /**< bus of the device if applicable. One of
* "isa", "pci", "usb", "firewire",
* "bluetooth" */
#define SPA_KEY_DEVICE_SUBSYSTEM "device.subsystem" /**< device subsystem */
#define SPA_KEY_DEVICE_SYSFS_PATH "device.sysfs.path" /**< device sysfs path */
#define SPA_KEY_DEVICE_VENDOR_ID "device.vendor.id" /**< vendor ID if applicable */
#define SPA_KEY_DEVICE_VENDOR_NAME "device.vendor.name" /**< vendor name if applicable */
#define SPA_KEY_DEVICE_PRODUCT_ID "device.product.id" /**< product ID if applicable */
#define SPA_KEY_DEVICE_PRODUCT_NAME "device.product.name" /**< product name if applicable */
#define SPA_KEY_DEVICE_SERIAL "device.serial" /**< Serial number if applicable */
#define SPA_KEY_DEVICE_CLASS "device.class" /**< device class */
#define SPA_KEY_DEVICE_CAPABILITIES "device.capabilities" /**< api specific device capabilities */
#define SPA_KEY_DEVICE_FORM_FACTOR "device.form-factor" /**< form factor if applicable. One of
* "internal", "speaker", "handset", "tv",
* "webcam", "microphone", "headset",
* "headphone", "hands-free", "car", "hifi",
* "computer", "portable" */
#ifdef __cplusplus
} /* extern "C" */
#endif

View file

@ -123,6 +123,9 @@ static inline int spa_monitor_set_callbacks(struct spa_monitor *m,
}
#define SPA_KEY_MONITOR_API "monitor.api" /**< the api used by the monitor.
* Ex. "udev", "dbus", ... */
#ifdef __cplusplus
} /* extern "C" */
#endif

View file

@ -659,6 +659,15 @@ struct spa_node_methods {
#define spa_node_port_reuse_buffer(n,...) spa_node_method(n, port_reuse_buffer, 0, __VA_ARGS__)
#define spa_node_process(n) spa_node_method(n, process, 0)
/** node keys */
#define SPA_KEY_NODE_DRIVER "node.driver" /**< the node can be a driver */
#define SPA_KEY_NODE_PAUSE_ON_IDLE "node.pause-on-idle" /**< if the node should be paused
* immediately when idle. */
/** port keys */
#define SPA_KEY_PORT_MONITOR "port.monitor" /**< this port is a monitor port */
#ifdef __cplusplus
} /* extern "C" */
#endif

View file

@ -206,6 +206,9 @@ struct spa_audio_info_raw {
#define SPA_AUDIO_INFO_RAW_INIT(...) (struct spa_audio_info_raw) { __VA_ARGS__ }
#define SPA_KEY_AUDIO_CHANNEL "audio.channel" /**< an audio channel as string,
* Ex. "FL" */
#ifdef __cplusplus
} /* extern "C" */
#endif

View file

@ -128,6 +128,9 @@ enum spa_format {
SPA_FORMAT_START_Stream = 0x40000,
};
#define SPA_KEY_FORMAT_DSP "format.dsp" /**< a predefined DSP format,
* Ex. "32 bit float mono audio" */
#ifdef __cplusplus
} /* extern "C" */
#endif

View file

@ -161,6 +161,11 @@ static inline void spa_log_trace_fp (struct spa_log *l, const char *format, ...)
#endif
#endif
/** keys can be given when initializing the logger handle */
#define SPA_KEY_LOG_COLORS "log.colors" /**< enable colors in the logger */
#define SPA_KEY_LOG_FILE "log.file" /**< log to the specified file instead of
* stderr. */
#ifdef __cplusplus
} /* extern "C" */
#endif

View file

@ -102,7 +102,15 @@ struct spa_handle_factory {
#define SPA_VERSION_HANDLE_FACTORY 0
uint32_t version;
/**
* The name
* The name of the factory contains a logical name that describes
* the function of the handle. Other plugins might contain an alternative
* implementation with the same name.
*
* Examples include:
*
* api.alsa.pcm.sink: an object to write PCM samples to an alsa PLAYBACK
* device
* api.v4l2.source: an object to read from a v4l2 source.
*/
const char *name;
/**
@ -187,6 +195,17 @@ typedef int (*spa_handle_factory_enum_func_t) (const struct spa_handle_factory *
*/
int spa_handle_factory_enum(const struct spa_handle_factory **factory, uint32_t *index);
#define SPA_KEY_FACTORY_NAME "factory.name" /**< the name of a factory */
#define SPA_KEY_FACTORY_AUTHOR "factory.author" /**< a comma separated list of factory authors */
#define SPA_KEY_FACTORY_DESCRIPTION "factory.description" /**< description of a factory */
#define SPA_KEY_FACTORY_USAGE "factory.usage" /**< usage of a factory */
#define SPA_KEY_LIBRARY_NAME "library.name" /**< the name of a library. This is usually
* the filename of the plugin without the
* path or the plugin extension. */
#ifdef __cplusplus
} /* extern "C" */
#endif

View file

@ -0,0 +1,88 @@
/* Simple Plugin API
*
* Copyright © 2019 Wim Taymans
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
#ifndef SPA_UTILS_KEYS_H
#define SPA_UTILS_KEYS_H
#ifdef __cplusplus
extern "C" {
#endif
/** for objects */
#define SPA_KEY_MEDIA_CLASS "media.class" /**< Media class
* Ex. "Audio/Device",
* "Video/Source",... */
#define SPA_KEY_MEDIA_ROLE "media.role" /**< Role: Movie, Music, Camera,
* Screen, Communication, Game,
* Notification, DSP, Production,
* Accessibility, Test */
/** keys for alsa api */
#define SPA_KEY_API_ALSA "api.alsa" /**< key for the alsa api */
#define SPA_KEY_API_ALSA_PATH "api.alsa.path" /**< alsa device path as can be
* used in snd_pcm_open() and
* snd_ctl_open(). */
#define SPA_KEY_API_ALSA_CARD "api.alsa.card" /**< alsa card number */
/** info from alsa card_info */
#define SPA_KEY_API_ALSA_CARD_ID "api.alsa.card.id" /**< id from card_info */
#define SPA_KEY_API_ALSA_CARD_COMPONENTS \
"api.alsa.card.components" /**< components from card_info */
#define SPA_KEY_API_ALSA_CARD_DRIVER "api.alsa.card.driver" /**< driver from card_info */
#define SPA_KEY_API_ALSA_CARD_NAME "api.alsa.card.name" /**< name from card_info */
#define SPA_KEY_API_ALSA_CARD_LONGNAME "api.alsa.card.longname" /**< longname from card_info */
#define SPA_KEY_API_ALSA_CARD_MIXERNAME "api.alsa.card.mixername" /**< mixername from card_info */
/** info from alsa pcm_info */
#define SPA_KEY_API_ALSA_PCM_ID "api.alsa.pcm.id" /**< id from pcm_info */
#define SPA_KEY_API_ALSA_PCM_NAME "api.alsa.pcm.name" /**< name from pcm_info */
#define SPA_KEY_API_ALSA_PCM_SUBNAME "api.alsa.pcm.subname" /**< subdevice_name from pcm_info */
#define SPA_KEY_API_ALSA_PCM_CLASS "api.alsa.pcm.class" /**< class from pcm_info as string */
#define SPA_KEY_API_ALSA_PCM_SUBCLASS "api.alsa.pcm.subclass" /**< subclass from pcm_info as string */
/** keys for v4l2 api */
#define SPA_KEY_API_V4L2 "api.v4l2" /**< key for the v4l2 api */
#define SPA_KEY_API_V4L2_PATH "api.v4l2.path" /**< v4l2 device path as can be
* used in open() */
/** info from v4l2_capability */
#define SPA_KEY_API_V4L2_CAP_DRIVER "api.v4l2.cap.driver" /**< driver from capbility */
#define SPA_KEY_API_V4L2_CAP_CARD "api.v4l2.cap.card" /**< caps from capability */
#define SPA_KEY_API_V4L2_CAP_BUS_INFO "api.v4l2.cap.bus_info" /**< bus_info from capability */
/** keys for bluez5 api */
#define SPA_KEY_API_BLUEZ5 "api.bluez5" /**< key for the bluez5 api */
#define SPA_KEY_API_BLUEZ5_PATH "api.bluez5.path" /**< a bluez5 path */
#define SPA_KEY_API_BLUEZ5_DEVICE "api.bluez5.device" /**< an internal bluez5 device */
#define SPA_KEY_API_BLUEZ5_TRANSPORT "api.bluez5.transport" /**< an internal bluez5 transport */
#define SPA_KEY_API_BLUEZ5_ADDRESS "api.bluez5.address" /**< a bluetooth address */
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* SPA_UTILS_KEYS_H */