mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
names: add standard factory name definitions
Define a set of standard factory names and document what they contain. This makes it possible to change the implementation by mapping the factory-name to a different shared library.
This commit is contained in:
parent
4494f9c7c9
commit
6720ded529
40 changed files with 188 additions and 55 deletions
|
|
@ -42,6 +42,7 @@
|
|||
#include <spa/param/props.h>
|
||||
#include <spa/param/audio/format-utils.h>
|
||||
#include <spa/control/control.h>
|
||||
#include <spa/utils/names.h>
|
||||
|
||||
#define M_PI_M2 ( M_PI + M_PI )
|
||||
|
||||
|
|
@ -283,7 +284,8 @@ static int make_nodes(struct data *data, const char *device)
|
|||
//uint32_t idx;
|
||||
|
||||
if ((res = make_node(data, &data->sink,
|
||||
"build/spa/plugins/alsa/libspa-alsa.so", "api.alsa.pcm.sink")) < 0) {
|
||||
"build/spa/plugins/alsa/libspa-alsa.so",
|
||||
SPA_NAME_API_ALSA_PCM_SINK)) < 0) {
|
||||
printf("can't create alsa-sink: %d\n", res);
|
||||
return res;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@
|
|||
|
||||
#include <SDL2/SDL.h>
|
||||
|
||||
#include <spa/utils/names.h>
|
||||
#include <spa/support/log-impl.h>
|
||||
#include <spa/support/loop.h>
|
||||
#include <spa/node/node.h>
|
||||
|
|
@ -255,7 +256,9 @@ static int make_nodes(struct data *data, const char *device)
|
|||
uint32_t index;
|
||||
|
||||
if ((res =
|
||||
make_node(data, &data->source, PATH "v4l2/libspa-v4l2.so", "api.v4l2.source")) < 0) {
|
||||
make_node(data, &data->source,
|
||||
PATH "v4l2/libspa-v4l2.so",
|
||||
SPA_NAME_API_V4L2_SOURCE)) < 0) {
|
||||
printf("can't create v4l2-source: %d\n", res);
|
||||
return res;
|
||||
}
|
||||
|
|
@ -469,7 +472,9 @@ int main(int argc, char *argv[])
|
|||
struct spa_handle *handle = NULL;
|
||||
void *iface;
|
||||
|
||||
if ((res = load_handle(&data, &handle, PATH "support/libspa-support.so", "loop")) < 0)
|
||||
if ((res = load_handle(&data, &handle,
|
||||
PATH "support/libspa-support.so",
|
||||
SPA_NAME_SUPPORT_LOOP)) < 0)
|
||||
return res;
|
||||
|
||||
if ((res = spa_handle_get_interface(handle, SPA_TYPE_INTERFACE_Loop, &iface)) < 0) {
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ extern "C" {
|
|||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <spa/utils/type.h>
|
||||
#include <spa/support/log.h>
|
||||
|
||||
static inline void spa_log_impl_logv(void *object,
|
||||
|
|
|
|||
|
|
@ -106,6 +106,8 @@ struct spa_handle_factory {
|
|||
* the function of the handle. Other plugins might contain an alternative
|
||||
* implementation with the same name.
|
||||
*
|
||||
* See utils/names.h for the list of standard names.
|
||||
*
|
||||
* Examples include:
|
||||
*
|
||||
* api.alsa.pcm.sink: an object to write PCM samples to an alsa PLAYBACK
|
||||
|
|
|
|||
|
|
@ -37,7 +37,6 @@ extern "C" {
|
|||
* 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
|
||||
|
|
@ -80,7 +79,6 @@ extern "C" {
|
|||
#define SPA_KEY_API_BLUEZ5_ADDRESS "api.bluez5.address" /**< a bluetooth address */
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
|
|
|||
89
spa/include/spa/utils/names.h
Normal file
89
spa/include/spa/utils/names.h
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
/* 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_NAMES_H
|
||||
#define SPA_UTILS_NAMES_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** for factory names */
|
||||
#define SPA_NAME_SUPPORT_CPU "support.cpu" /**< A CPU interface */
|
||||
#define SPA_NAME_SUPPORT_DBUS "support.dbus" /**< A DBUS interface */
|
||||
#define SPA_NAME_SUPPORT_LOG "support.log" /**< A Log interface */
|
||||
#define SPA_NAME_SUPPORT_LOOP "support.loop" /**< A Loop/LoopControl/LoopUtils
|
||||
* interface */
|
||||
#define SPA_NAME_SUPPORT_SYSTEM "support.system" /**< A System interface */
|
||||
|
||||
|
||||
/* audio mixer */
|
||||
|
||||
#define SPA_NAME_AUDIO_MIXER "audio.mix" /**< mixes the raw audio on N input
|
||||
* ports together on the output
|
||||
* port */
|
||||
/** audio processing */
|
||||
#define SPA_NAME_AUDIO_PROCESS_FORMAT "audio.process.format" /**< processes raw audio from one format
|
||||
* to another */
|
||||
#define SPA_NAME_AUDIO_PROCESS_CHANNELMIX \
|
||||
"audio.process.channelmix" /**< mixes raw audio channels and applies
|
||||
* volume change. */
|
||||
#define SPA_NAME_AUDIO_PROCESS_RESAMPLE \
|
||||
"audio.process.resample" /**< resamples raw audio */
|
||||
#define SPA_NAME_AUDIO_PROCESS_DEINTERLEAVE \
|
||||
"audio.process.deinterleave" /**< deinterleave raw audio channels */
|
||||
#define SPA_NAME_AUDIO_PROCESS_INTERLEAVE \
|
||||
"audio.process.interleave" /**< interleave raw audio channels */
|
||||
|
||||
|
||||
/** audio convert combines some of the audio processing */
|
||||
#define SPA_NAME_AUDIO_CONVERT "audio.convert" /**< converts raw audio from one format
|
||||
* to another. Must include at least
|
||||
* format, channelmix and resample
|
||||
* processing */
|
||||
/** keys for alsa factory names */
|
||||
#define SPA_NAME_API_ALSA_MONITOR "api.alsa.monitor" /**< an alsa Monitor interface */
|
||||
#define SPA_NAME_API_ALSA_DEVICE "api.alsa.device" /**< an alsa Device interface */
|
||||
#define SPA_NAME_API_ALSA_PCM_SOURCE "api.alsa.pcm.source" /**< an alsa Node interface for
|
||||
* capturing PCM */
|
||||
#define SPA_NAME_API_ALSA_PCM_SINK "api.alsa.pcm.sink" /**< an alsa Node interface for
|
||||
* playback PCM */
|
||||
|
||||
/** keys for bluez5 factory names */
|
||||
#define SPA_NAME_API_BLUEZ5_MONITOR "api.bluez5.monitor" /**< a Monitor interface */
|
||||
#define SPA_NAME_API_BLUEZ5_DEVICE "api.bluez5.device" /**< a Device interface */
|
||||
#define SPA_NAME_API_BLUEZ5_A2DP_SINK "api.bluez5.a2dp.sink" /**< a playback Node interface */
|
||||
#define SPA_NAME_API_BLUEZ5_A2DP_SOURCE "api.bluez5.a2dp.source" /**< a capture Node interface */
|
||||
|
||||
/** keys for v4l2 factory names */
|
||||
#define SPA_NAME_API_V4L2_MONITOR "api.v4l2.monitor" /**< a v4l2 Monitor interface */
|
||||
#define SPA_NAME_API_V4L2_DEVICE "api.v4l2.device" /**< a v4l2 Device interface */
|
||||
#define SPA_NAME_API_V4L2_SOURCE "api.v4l2.source" /**< a v4l2 Node interface for
|
||||
* capturing */
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* SPA_UTILS_NAMES_H */
|
||||
|
|
@ -34,6 +34,7 @@
|
|||
#include <spa/support/log.h>
|
||||
#include <spa/utils/type.h>
|
||||
#include <spa/utils/keys.h>
|
||||
#include <spa/utils/names.h>
|
||||
#include <spa/support/loop.h>
|
||||
#include <spa/support/plugin.h>
|
||||
#include <spa/monitor/device.h>
|
||||
|
|
@ -109,9 +110,9 @@ static int emit_node(struct impl *this, snd_pcm_info_t *pcminfo, uint32_t id)
|
|||
info = SPA_DEVICE_OBJECT_INFO_INIT();
|
||||
info.type = SPA_TYPE_INTERFACE_Node;
|
||||
if (snd_pcm_info_get_stream(pcminfo) == SND_PCM_STREAM_PLAYBACK)
|
||||
info.factory_name = "api.alsa.pcm.sink";
|
||||
info.factory_name = SPA_NAME_API_ALSA_PCM_SINK;
|
||||
else
|
||||
info.factory_name = "api.alsa.pcm.source";
|
||||
info.factory_name = SPA_NAME_API_ALSA_PCM_SOURCE;
|
||||
|
||||
info.change_mask = SPA_DEVICE_OBJECT_CHANGE_MASK_PROPS;
|
||||
snprintf(device_name, 128, "%s,%d", this->props.device, snd_pcm_info_get_device(pcminfo));
|
||||
|
|
@ -488,7 +489,7 @@ impl_enum_interface_info(const struct spa_handle_factory *factory,
|
|||
|
||||
const struct spa_handle_factory spa_alsa_device_factory = {
|
||||
SPA_VERSION_HANDLE_FACTORY,
|
||||
"api.alsa.device",
|
||||
SPA_NAME_API_ALSA_DEVICE,
|
||||
NULL,
|
||||
impl_get_size,
|
||||
impl_init,
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@
|
|||
#include <spa/support/log.h>
|
||||
#include <spa/utils/type.h>
|
||||
#include <spa/utils/keys.h>
|
||||
#include <spa/utils/names.h>
|
||||
#include <spa/support/loop.h>
|
||||
#include <spa/support/plugin.h>
|
||||
#include <spa/monitor/monitor.h>
|
||||
|
|
@ -111,7 +112,7 @@ static int emit_object_info(struct impl *this, uint32_t id, struct udev_device *
|
|||
info = SPA_MONITOR_OBJECT_INFO_INIT();
|
||||
|
||||
info.type = SPA_TYPE_INTERFACE_Device;
|
||||
info.factory_name = "api.alsa.device";
|
||||
info.factory_name = SPA_NAME_API_ALSA_DEVICE;
|
||||
info.change_mask = SPA_MONITOR_OBJECT_CHANGE_MASK_FLAGS |
|
||||
SPA_MONITOR_OBJECT_CHANGE_MASK_PROPS;
|
||||
info.flags = 0;
|
||||
|
|
@ -482,7 +483,7 @@ impl_enum_interface_info(const struct spa_handle_factory *factory,
|
|||
|
||||
const struct spa_handle_factory spa_alsa_monitor_factory = {
|
||||
SPA_VERSION_HANDLE_FACTORY,
|
||||
"api.alsa.monitor",
|
||||
SPA_NAME_API_ALSA_MONITOR,
|
||||
NULL,
|
||||
impl_get_size,
|
||||
impl_init,
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@
|
|||
#include <spa/node/utils.h>
|
||||
#include <spa/monitor/device.h>
|
||||
#include <spa/utils/keys.h>
|
||||
#include <spa/utils/names.h>
|
||||
#include <spa/param/audio/format.h>
|
||||
#include <spa/pod/filter.h>
|
||||
#include <spa/debug/pod.h>
|
||||
|
|
@ -809,7 +810,7 @@ static const struct spa_dict info = SPA_DICT_INIT_ARRAY(info_items);
|
|||
|
||||
const struct spa_handle_factory spa_alsa_sink_factory = {
|
||||
SPA_VERSION_HANDLE_FACTORY,
|
||||
"api.alsa.pcm.sink",
|
||||
SPA_NAME_API_ALSA_PCM_SINK,
|
||||
&info,
|
||||
impl_get_size,
|
||||
impl_init,
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@
|
|||
#include <spa/node/node.h>
|
||||
#include <spa/node/utils.h>
|
||||
#include <spa/utils/keys.h>
|
||||
#include <spa/utils/names.h>
|
||||
#include <spa/utils/list.h>
|
||||
#include <spa/monitor/device.h>
|
||||
#include <spa/param/audio/format.h>
|
||||
|
|
@ -821,7 +822,7 @@ static const struct spa_dict info = SPA_DICT_INIT_ARRAY(info_items);
|
|||
|
||||
const struct spa_handle_factory spa_alsa_source_factory = {
|
||||
SPA_VERSION_HANDLE_FACTORY,
|
||||
"api.alsa.pcm.source",
|
||||
SPA_NAME_API_ALSA_PCM_SOURCE,
|
||||
&info,
|
||||
impl_get_size,
|
||||
impl_init,
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@
|
|||
|
||||
#include <spa/support/log.h>
|
||||
#include <spa/utils/list.h>
|
||||
#include <spa/utils/names.h>
|
||||
#include <spa/node/node.h>
|
||||
#include <spa/buffer/alloc.h>
|
||||
#include <spa/node/io.h>
|
||||
|
|
@ -1120,7 +1121,7 @@ impl_enum_interface_info(const struct spa_handle_factory *factory,
|
|||
|
||||
const struct spa_handle_factory spa_audioconvert_factory = {
|
||||
SPA_VERSION_HANDLE_FACTORY,
|
||||
NAME,
|
||||
SPA_NAME_AUDIO_CONVERT,
|
||||
NULL,
|
||||
impl_get_size,
|
||||
impl_init,
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@
|
|||
#include <spa/support/log.h>
|
||||
#include <spa/support/cpu.h>
|
||||
#include <spa/utils/list.h>
|
||||
#include <spa/utils/names.h>
|
||||
#include <spa/node/node.h>
|
||||
#include <spa/node/io.h>
|
||||
#include <spa/node/utils.h>
|
||||
|
|
@ -1085,7 +1086,7 @@ impl_enum_interface_info(const struct spa_handle_factory *factory,
|
|||
|
||||
const struct spa_handle_factory spa_channelmix_factory = {
|
||||
SPA_VERSION_HANDLE_FACTORY,
|
||||
NAME,
|
||||
SPA_NAME_AUDIO_PROCESS_CHANNELMIX,
|
||||
NULL,
|
||||
impl_get_size,
|
||||
impl_init,
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@
|
|||
#include <spa/support/log.h>
|
||||
#include <spa/support/cpu.h>
|
||||
#include <spa/utils/list.h>
|
||||
#include <spa/utils/names.h>
|
||||
#include <spa/node/node.h>
|
||||
#include <spa/node/io.h>
|
||||
#include <spa/node/utils.h>
|
||||
|
|
@ -1028,7 +1029,7 @@ impl_enum_interface_info(const struct spa_handle_factory *factory,
|
|||
|
||||
const struct spa_handle_factory spa_fmtconvert_factory = {
|
||||
SPA_VERSION_HANDLE_FACTORY,
|
||||
NAME,
|
||||
SPA_NAME_AUDIO_PROCESS_FORMAT,
|
||||
NULL,
|
||||
impl_get_size,
|
||||
impl_init,
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@
|
|||
#include <spa/support/cpu.h>
|
||||
#include <spa/support/log.h>
|
||||
#include <spa/utils/list.h>
|
||||
#include <spa/utils/names.h>
|
||||
#include <spa/node/node.h>
|
||||
#include <spa/node/io.h>
|
||||
#include <spa/node/utils.h>
|
||||
|
|
@ -1126,7 +1127,7 @@ impl_enum_interface_info(const struct spa_handle_factory *factory,
|
|||
|
||||
const struct spa_handle_factory spa_merger_factory = {
|
||||
SPA_VERSION_HANDLE_FACTORY,
|
||||
NAME,
|
||||
SPA_NAME_AUDIO_PROCESS_INTERLEAVE,
|
||||
NULL,
|
||||
impl_get_size,
|
||||
impl_init,
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@
|
|||
|
||||
#include <spa/support/log.h>
|
||||
#include <spa/utils/list.h>
|
||||
#include <spa/utils/names.h>
|
||||
#include <spa/node/node.h>
|
||||
#include <spa/node/io.h>
|
||||
#include <spa/node/utils.h>
|
||||
|
|
@ -1015,7 +1016,7 @@ impl_enum_interface_info(const struct spa_handle_factory *factory,
|
|||
|
||||
const struct spa_handle_factory spa_resample_factory = {
|
||||
SPA_VERSION_HANDLE_FACTORY,
|
||||
NAME,
|
||||
SPA_NAME_AUDIO_PROCESS_RESAMPLE,
|
||||
NULL,
|
||||
impl_get_size,
|
||||
impl_init,
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@
|
|||
#include <spa/support/cpu.h>
|
||||
#include <spa/support/log.h>
|
||||
#include <spa/utils/list.h>
|
||||
#include <spa/utils/names.h>
|
||||
#include <spa/node/node.h>
|
||||
#include <spa/node/utils.h>
|
||||
#include <spa/node/io.h>
|
||||
|
|
@ -1052,7 +1053,7 @@ impl_enum_interface_info(const struct spa_handle_factory *factory,
|
|||
|
||||
const struct spa_handle_factory spa_splitter_factory = {
|
||||
SPA_VERSION_HANDLE_FACTORY,
|
||||
NAME,
|
||||
SPA_NAME_AUDIO_PROCESS_DEINTERLEAVE,
|
||||
NULL,
|
||||
impl_get_size,
|
||||
impl_init,
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@
|
|||
|
||||
#include <spa/support/log.h>
|
||||
#include <spa/utils/list.h>
|
||||
#include <spa/utils/names.h>
|
||||
#include <spa/node/node.h>
|
||||
#include <spa/node/utils.h>
|
||||
#include <spa/node/io.h>
|
||||
|
|
@ -979,7 +980,7 @@ impl_enum_interface_info(const struct spa_handle_factory *factory,
|
|||
|
||||
const struct spa_handle_factory spa_audiomixer_factory = {
|
||||
SPA_VERSION_HANDLE_FACTORY,
|
||||
NAME,
|
||||
SPA_NAME_AUDIO_MIXER,
|
||||
NULL,
|
||||
impl_get_size,
|
||||
impl_init,
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@
|
|||
#include <spa/support/system.h>
|
||||
#include <spa/utils/list.h>
|
||||
#include <spa/utils/keys.h>
|
||||
#include <spa/utils/names.h>
|
||||
#include <spa/monitor/device.h>
|
||||
|
||||
#include <spa/node/node.h>
|
||||
|
|
@ -1528,7 +1529,7 @@ static const struct spa_dict info = SPA_DICT_INIT_ARRAY(info_items);
|
|||
|
||||
const struct spa_handle_factory spa_a2dp_sink_factory = {
|
||||
SPA_VERSION_HANDLE_FACTORY,
|
||||
"api.bluez5.a2dp.sink",
|
||||
SPA_NAME_API_BLUEZ5_A2DP_SINK,
|
||||
&info,
|
||||
impl_get_size,
|
||||
impl_init,
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@
|
|||
#include <spa/support/system.h>
|
||||
#include <spa/utils/list.h>
|
||||
#include <spa/utils/keys.h>
|
||||
#include <spa/utils/names.h>
|
||||
#include <spa/monitor/device.h>
|
||||
|
||||
#include <spa/node/node.h>
|
||||
|
|
@ -1226,7 +1227,7 @@ static const struct spa_dict info = SPA_DICT_INIT_ARRAY(info_items);
|
|||
|
||||
const struct spa_handle_factory spa_a2dp_source_factory = {
|
||||
SPA_VERSION_HANDLE_FACTORY,
|
||||
"api.bluez5.a2dp.source",
|
||||
SPA_NAME_API_BLUEZ5_A2DP_SOURCE,
|
||||
&info,
|
||||
impl_get_size,
|
||||
impl_init,
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@
|
|||
#include <spa/support/log.h>
|
||||
#include <spa/utils/type.h>
|
||||
#include <spa/utils/keys.h>
|
||||
#include <spa/utils/names.h>
|
||||
#include <spa/support/loop.h>
|
||||
#include <spa/support/plugin.h>
|
||||
#include <spa/monitor/device.h>
|
||||
|
|
@ -107,7 +108,7 @@ static int emit_source_node(struct impl *this)
|
|||
|
||||
info = SPA_DEVICE_OBJECT_INFO_INIT();
|
||||
info.type = SPA_TYPE_INTERFACE_Node;
|
||||
info.factory_name = "api.bluez5.a2dp.source";
|
||||
info.factory_name = SPA_NAME_API_BLUEZ5_A2DP_SOURCE;
|
||||
info.change_mask = SPA_DEVICE_OBJECT_CHANGE_MASK_PROPS;
|
||||
info.props = &SPA_DICT_INIT_ARRAY(items);
|
||||
|
||||
|
|
@ -154,7 +155,7 @@ static int emit_sink_node(struct impl *this)
|
|||
|
||||
info = SPA_DEVICE_OBJECT_INFO_INIT();
|
||||
info.type = SPA_TYPE_INTERFACE_Node;
|
||||
info.factory_name = "api.bluez5.a2dp.sink";
|
||||
info.factory_name = SPA_NAME_API_BLUEZ5_A2DP_SINK;
|
||||
info.change_mask = SPA_DEVICE_OBJECT_CHANGE_MASK_PROPS;
|
||||
info.props = &SPA_DICT_INIT_ARRAY(items);
|
||||
|
||||
|
|
@ -348,7 +349,7 @@ static const struct spa_dict handle_info = SPA_DICT_INIT_ARRAY(handle_info_items
|
|||
|
||||
const struct spa_handle_factory spa_bluez5_device_factory = {
|
||||
SPA_VERSION_HANDLE_FACTORY,
|
||||
"api.bluez5.device",
|
||||
SPA_NAME_API_BLUEZ5_DEVICE,
|
||||
&handle_info,
|
||||
impl_get_size,
|
||||
impl_init,
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@
|
|||
#include <spa/monitor/utils.h>
|
||||
#include <spa/utils/type.h>
|
||||
#include <spa/utils/keys.h>
|
||||
#include <spa/utils/names.h>
|
||||
|
||||
#include "a2dp-codecs.h"
|
||||
#include "defs.h"
|
||||
|
|
@ -499,7 +500,7 @@ static int device_add(struct spa_bt_monitor *monitor, struct spa_bt_device *devi
|
|||
|
||||
info = SPA_MONITOR_OBJECT_INFO_INIT();
|
||||
info.type = SPA_TYPE_INTERFACE_Device;
|
||||
info.factory_name = "api.bluez5.device";
|
||||
info.factory_name = SPA_NAME_API_BLUEZ5_DEVICE;
|
||||
info.change_mask = SPA_MONITOR_OBJECT_CHANGE_MASK_FLAGS |
|
||||
SPA_MONITOR_OBJECT_CHANGE_MASK_PROPS;
|
||||
info.flags = 0;
|
||||
|
|
@ -2292,7 +2293,7 @@ impl_enum_interface_info(const struct spa_handle_factory *factory,
|
|||
|
||||
const struct spa_handle_factory spa_bluez5_monitor_factory = {
|
||||
SPA_VERSION_HANDLE_FACTORY,
|
||||
"api.bluez5.monitor",
|
||||
SPA_NAME_API_BLUEZ5_MONITOR,
|
||||
NULL,
|
||||
impl_get_size,
|
||||
impl_init,
|
||||
|
|
|
|||
|
|
@ -106,10 +106,10 @@ int spa_handle_factory_enum(const struct spa_handle_factory **factory, uint32_t
|
|||
return 0;
|
||||
|
||||
if (av_codec_is_encoder(c)) {
|
||||
snprintf(name, 128, "ffenc_%s", c->name);
|
||||
snprintf(name, 128, "encoder.%s", c->name);
|
||||
f.init = ffmpeg_enc_init;
|
||||
} else {
|
||||
snprintf(name, 128, "ffdec_%s", c->name);
|
||||
snprintf(name, 128, "decoder.%s", c->name);
|
||||
f.init = ffmpeg_dec_init;
|
||||
}
|
||||
f.name = name;
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@
|
|||
#include <spa/support/plugin.h>
|
||||
#include <spa/utils/type.h>
|
||||
#include <spa/utils/hook.h>
|
||||
#include <spa/utils/names.h>
|
||||
|
||||
#define NAME "cpu"
|
||||
|
||||
|
|
@ -209,7 +210,7 @@ impl_enum_interface_info(const struct spa_handle_factory *factory,
|
|||
|
||||
const struct spa_handle_factory spa_support_cpu_factory = {
|
||||
SPA_VERSION_HANDLE_FACTORY,
|
||||
NAME,
|
||||
SPA_NAME_SUPPORT_CPU,
|
||||
NULL,
|
||||
impl_get_size,
|
||||
impl_init,
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@
|
|||
#include <dbus/dbus.h>
|
||||
|
||||
#include <spa/utils/type.h>
|
||||
#include <spa/utils/names.h>
|
||||
#include <spa/support/log.h>
|
||||
#include <spa/support/plugin.h>
|
||||
#include <spa/support/dbus.h>
|
||||
|
|
@ -439,7 +440,7 @@ impl_enum_interface_info(const struct spa_handle_factory *factory,
|
|||
|
||||
static const struct spa_handle_factory dbus_factory = {
|
||||
SPA_VERSION_HANDLE_FACTORY,
|
||||
NAME,
|
||||
SPA_NAME_SUPPORT_DBUS,
|
||||
NULL,
|
||||
impl_get_size,
|
||||
impl_init,
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@
|
|||
#include <spa/support/plugin.h>
|
||||
#include <spa/utils/ringbuffer.h>
|
||||
#include <spa/utils/type.h>
|
||||
#include <spa/utils/names.h>
|
||||
|
||||
#define NAME "logger"
|
||||
|
||||
|
|
@ -294,7 +295,7 @@ impl_enum_interface_info(const struct spa_handle_factory *factory,
|
|||
|
||||
const struct spa_handle_factory spa_support_logger_factory = {
|
||||
SPA_VERSION_HANDLE_FACTORY,
|
||||
.name = NAME,
|
||||
.name = SPA_NAME_SUPPORT_LOG,
|
||||
.info = NULL,
|
||||
.get_size = impl_get_size,
|
||||
.init = impl_init,
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@
|
|||
#include <spa/support/log.h>
|
||||
#include <spa/support/plugin.h>
|
||||
#include <spa/utils/list.h>
|
||||
#include <spa/utils/names.h>
|
||||
#include <spa/utils/result.h>
|
||||
#include <spa/utils/type.h>
|
||||
#include <spa/utils/ringbuffer.h>
|
||||
|
|
@ -815,7 +816,7 @@ impl_enum_interface_info(const struct spa_handle_factory *factory,
|
|||
|
||||
const struct spa_handle_factory spa_support_loop_factory = {
|
||||
SPA_VERSION_HANDLE_FACTORY,
|
||||
NAME,
|
||||
SPA_NAME_SUPPORT_LOOP,
|
||||
NULL,
|
||||
impl_get_size,
|
||||
impl_init,
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@
|
|||
#include <spa/support/system.h>
|
||||
#include <spa/support/plugin.h>
|
||||
#include <spa/utils/type.h>
|
||||
#include <spa/utils/names.h>
|
||||
|
||||
#define NAME "system"
|
||||
|
||||
|
|
@ -398,7 +399,7 @@ impl_enum_interface_info(const struct spa_handle_factory *factory,
|
|||
|
||||
const struct spa_handle_factory spa_support_system_factory = {
|
||||
SPA_VERSION_HANDLE_FACTORY,
|
||||
NAME,
|
||||
SPA_NAME_SUPPORT_SYSTEM,
|
||||
NULL,
|
||||
impl_get_size,
|
||||
impl_init,
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@
|
|||
#include <spa/support/log.h>
|
||||
#include <spa/support/loop.h>
|
||||
#include <spa/utils/keys.h>
|
||||
#include <spa/utils/names.h>
|
||||
#include <spa/pod/builder.h>
|
||||
#include <spa/monitor/device.h>
|
||||
#include <spa/monitor/utils.h>
|
||||
|
|
@ -102,7 +103,7 @@ static int emit_info(struct impl *this, bool full)
|
|||
|
||||
oinfo = SPA_DEVICE_OBJECT_INFO_INIT();
|
||||
oinfo.type = SPA_TYPE_INTERFACE_Node;
|
||||
oinfo.factory_name = "api.v4l2.source";
|
||||
oinfo.factory_name = SPA_NAME_API_V4L2_SOURCE;
|
||||
oinfo.change_mask = SPA_DEVICE_OBJECT_CHANGE_MASK_PROPS;
|
||||
oinfo.props = &SPA_DICT_INIT(items, n_items);
|
||||
|
||||
|
|
@ -262,7 +263,7 @@ static int impl_enum_interface_info(const struct spa_handle_factory *factory,
|
|||
|
||||
const struct spa_handle_factory spa_v4l2_device_factory = {
|
||||
SPA_VERSION_HANDLE_FACTORY,
|
||||
"api.v4l2.device",
|
||||
SPA_NAME_API_V4L2_DEVICE,
|
||||
NULL,
|
||||
impl_get_size,
|
||||
impl_init,
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@
|
|||
#include <spa/support/plugin.h>
|
||||
#include <spa/utils/type.h>
|
||||
#include <spa/utils/keys.h>
|
||||
#include <spa/utils/names.h>
|
||||
#include <spa/monitor/monitor.h>
|
||||
#include <spa/monitor/utils.h>
|
||||
|
||||
|
|
@ -99,7 +100,7 @@ static int emit_object_info(struct impl *this, uint32_t id, struct udev_device *
|
|||
info = SPA_MONITOR_OBJECT_INFO_INIT();
|
||||
|
||||
info.type = SPA_TYPE_INTERFACE_Device;
|
||||
info.factory_name = "api.v4l2.device";
|
||||
info.factory_name = SPA_NAME_API_V4L2_DEVICE;
|
||||
info.change_mask = SPA_MONITOR_OBJECT_CHANGE_MASK_FLAGS |
|
||||
SPA_MONITOR_OBJECT_CHANGE_MASK_PROPS;
|
||||
info.flags = 0;
|
||||
|
|
@ -398,7 +399,7 @@ impl_enum_interface_info(const struct spa_handle_factory *factory,
|
|||
|
||||
const struct spa_handle_factory spa_v4l2_monitor_factory = {
|
||||
SPA_VERSION_HANDLE_FACTORY,
|
||||
"api.v4l2.monitor",
|
||||
SPA_NAME_API_V4L2_MONITOR,
|
||||
NULL,
|
||||
impl_get_size,
|
||||
impl_init,
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@
|
|||
#include <spa/support/loop.h>
|
||||
#include <spa/utils/list.h>
|
||||
#include <spa/utils/keys.h>
|
||||
#include <spa/utils/names.h>
|
||||
#include <spa/monitor/device.h>
|
||||
#include <spa/node/node.h>
|
||||
#include <spa/node/io.h>
|
||||
|
|
@ -1044,7 +1045,7 @@ static int impl_enum_interface_info(const struct spa_handle_factory *factory,
|
|||
|
||||
const struct spa_handle_factory spa_v4l2_source_factory = {
|
||||
SPA_VERSION_HANDLE_FACTORY,
|
||||
"api.v4l2.source",
|
||||
SPA_NAME_API_V4L2_SOURCE,
|
||||
NULL,
|
||||
impl_get_size,
|
||||
impl_init,
|
||||
|
|
|
|||
|
|
@ -123,6 +123,7 @@ inspect_port_params(struct data *data, struct spa_node *node,
|
|||
continue;
|
||||
|
||||
printf("values:\n");
|
||||
spa_zero(listener);
|
||||
spa_node_add_listener(node, &listener, &node_events, data);
|
||||
res = spa_node_port_enum_params(node, 0,
|
||||
direction, port_id,
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
#set-prop library.name.system support/libspa-support
|
||||
#set-prop core.data-loop.library.name.system support/libspa-support
|
||||
|
||||
add-spa-lib audio.convert* audioconvert/libspa-audioconvert
|
||||
add-spa-lib api.alsa.* alsa/libspa-alsa
|
||||
add-spa-lib api.v4l2.* v4l2/libspa-v4l2
|
||||
add-spa-lib api.bluez5.* bluez5/libspa-bluez5
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@
|
|||
|
||||
#include <spa/node/node.h>
|
||||
#include <spa/utils/hook.h>
|
||||
#include <spa/utils/names.h>
|
||||
#include <spa/param/audio/format-utils.h>
|
||||
#include <spa/param/props.h>
|
||||
#include <spa/debug/dict.h>
|
||||
|
|
@ -314,7 +315,7 @@ static int start_monitor(struct impl *impl)
|
|||
int res;
|
||||
void *iface;
|
||||
|
||||
handle = pw_core_load_spa_handle(impl->core, "api.bluez5.monitor", NULL);
|
||||
handle = pw_core_load_spa_handle(impl->core, SPA_NAME_API_BLUEZ5_MONITOR, NULL);
|
||||
if (handle == NULL) {
|
||||
res = -errno;
|
||||
goto out;
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@
|
|||
#include <spa/node/io.h>
|
||||
#include <spa/node/utils.h>
|
||||
#include <spa/debug/format.h>
|
||||
#include <spa/utils/names.h>
|
||||
|
||||
#include <pipewire/pipewire.h>
|
||||
|
||||
|
|
@ -348,7 +349,7 @@ static int make_nodes(struct data *data)
|
|||
|
||||
factory = pw_core_find_factory(data->core, "spa-node-factory");
|
||||
props = pw_properties_new(SPA_KEY_LIBRARY_NAME, "v4l2/libspa-v4l2",
|
||||
SPA_KEY_FACTORY_NAME, "api.v4l2.source", NULL);
|
||||
SPA_KEY_FACTORY_NAME, SPA_NAME_API_V4L2_SOURCE, NULL);
|
||||
data->v4l2 = pw_factory_create_object(factory,
|
||||
NULL,
|
||||
PW_TYPE_INTERFACE_Node,
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@
|
|||
|
||||
#include <spa/node/node.h>
|
||||
#include <spa/utils/hook.h>
|
||||
#include <spa/utils/names.h>
|
||||
#include <spa/param/audio/format-utils.h>
|
||||
#include <spa/utils/type-info.h>
|
||||
#include <spa/param/audio/type-info.h>
|
||||
|
|
@ -262,7 +263,7 @@ struct pw_node *pw_audio_dsp_new(struct pw_core *core,
|
|||
{
|
||||
struct pw_node *node;
|
||||
struct node *n;
|
||||
const char *api, *alias, *str, *factory;
|
||||
const char *api, *alias, *str, *mode;
|
||||
char node_name[128];
|
||||
enum pw_direction direction;
|
||||
uint32_t max_buffer_size;
|
||||
|
|
@ -307,16 +308,16 @@ struct pw_node *pw_audio_dsp_new(struct pw_core *core,
|
|||
|
||||
if (direction == PW_DIRECTION_OUTPUT) {
|
||||
pw_properties_set(props, "merger.monitor", "1");
|
||||
factory = "merge";
|
||||
mode = "merge";
|
||||
} else {
|
||||
factory = "split";
|
||||
mode = "split";
|
||||
}
|
||||
pw_properties_set(props, "factory.mode", factory);
|
||||
factory = "audioconvert";
|
||||
|
||||
pw_properties_set(props, "factory.mode", mode);
|
||||
pw_properties_set(props, SPA_KEY_LIBRARY_NAME, "audioconvert/libspa-audioconvert");
|
||||
|
||||
node = pw_spa_node_load(core, NULL, NULL,
|
||||
factory,
|
||||
SPA_NAME_AUDIO_CONVERT,
|
||||
node_name,
|
||||
PW_SPA_NODE_FLAG_ACTIVATE | PW_SPA_NODE_FLAG_NO_REGISTER,
|
||||
pw_properties_copy(props),
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@
|
|||
|
||||
#include <spa/support/log.h>
|
||||
#include <spa/utils/list.h>
|
||||
#include <spa/utils/names.h>
|
||||
#include <spa/node/node.h>
|
||||
#include <spa/node/utils.h>
|
||||
#include <spa/node/io.h>
|
||||
|
|
@ -931,7 +932,7 @@ impl_enum_interface_info(const struct spa_handle_factory *factory,
|
|||
|
||||
const struct spa_handle_factory spa_floatmix_factory = {
|
||||
SPA_VERSION_HANDLE_FACTORY,
|
||||
NAME,
|
||||
SPA_NAME_AUDIO_MIXER,
|
||||
NULL,
|
||||
impl_get_size,
|
||||
impl_init,
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@
|
|||
|
||||
#include <spa/node/node.h>
|
||||
#include <spa/node/utils.h>
|
||||
#include <spa/utils/names.h>
|
||||
#include <spa/buffer/alloc.h>
|
||||
#include <spa/pod/parser.h>
|
||||
#include <spa/pod/filter.h>
|
||||
|
|
@ -1059,7 +1060,7 @@ static void client_node_initialized(void *data)
|
|||
items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_LIBRARY_NAME, "audioconvert/libspa-audioconvert");
|
||||
|
||||
if ((impl->handle = pw_core_load_spa_handle(impl->core,
|
||||
"audioconvert",
|
||||
SPA_NAME_AUDIO_CONVERT,
|
||||
&SPA_DICT_INIT(items, n_items))) == NULL)
|
||||
return;
|
||||
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@
|
|||
|
||||
#include <spa/support/dbus.h>
|
||||
#include <spa/node/utils.h>
|
||||
#include <spa/utils/names.h>
|
||||
#include <spa/debug/format.h>
|
||||
#include <spa/debug/types.h>
|
||||
|
||||
|
|
@ -516,7 +517,10 @@ struct pw_core *pw_core_new(struct pw_loop *main_loop,
|
|||
if (lib == NULL)
|
||||
lib = "support/libspa-dbus";
|
||||
|
||||
impl->dbus_handle = pw_load_spa_handle(lib, "dbus", NULL, n_support, this->support);
|
||||
impl->dbus_handle = pw_load_spa_handle(lib,
|
||||
SPA_NAME_SUPPORT_DBUS, NULL,
|
||||
n_support, this->support);
|
||||
|
||||
if (impl->dbus_handle == NULL ||
|
||||
(res = spa_handle_get_interface(impl->dbus_handle,
|
||||
SPA_TYPE_INTERFACE_DBus, &dbus_iface)) < 0) {
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
#include <stdio.h>
|
||||
|
||||
#include <spa/support/loop.h>
|
||||
#include <spa/utils/names.h>
|
||||
|
||||
#include <pipewire/pipewire.h>
|
||||
#include <pipewire/loop.h>
|
||||
|
|
@ -76,12 +77,12 @@ struct pw_loop *pw_loop_new(struct pw_properties *properties)
|
|||
lib = NULL;
|
||||
|
||||
impl->system_handle = pw_load_spa_handle(lib,
|
||||
"system",
|
||||
SPA_NAME_SUPPORT_SYSTEM,
|
||||
properties ? &properties->dict : NULL,
|
||||
n_support, support);
|
||||
if (impl->system_handle == NULL) {
|
||||
res = -errno;
|
||||
pw_log_error("can't make system handle: %m");
|
||||
pw_log_error("can't make "SPA_NAME_SUPPORT_SYSTEM" handle: %m");
|
||||
goto error_free;
|
||||
}
|
||||
|
||||
|
|
@ -101,12 +102,12 @@ struct pw_loop *pw_loop_new(struct pw_properties *properties)
|
|||
lib = NULL;
|
||||
|
||||
impl->loop_handle = pw_load_spa_handle(lib,
|
||||
"loop",
|
||||
SPA_NAME_SUPPORT_LOOP,
|
||||
properties ? &properties->dict : NULL,
|
||||
n_support, support);
|
||||
if (impl->loop_handle == NULL) {
|
||||
res = -errno;
|
||||
pw_log_error("can't make loop handle: %m");
|
||||
pw_log_error("can't make "SPA_NAME_SUPPORT_LOOP" handle: %m");
|
||||
goto error_unload_system;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@
|
|||
#include <errno.h>
|
||||
#include <dlfcn.h>
|
||||
|
||||
#include <spa/utils/names.h>
|
||||
#include <spa/support/cpu.h>
|
||||
|
||||
#include "pipewire.h"
|
||||
|
|
@ -376,7 +377,7 @@ void pw_init(int *argc, char **argv[])
|
|||
items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_LOG_LEVEL, level);
|
||||
info = SPA_DICT_INIT(items, n_items);
|
||||
|
||||
log = add_interface(support, "logger", SPA_TYPE_INTERFACE_Log, &info);
|
||||
log = add_interface(support, SPA_NAME_SUPPORT_LOG, SPA_TYPE_INTERFACE_Log, &info);
|
||||
if (log)
|
||||
pw_log_set(log);
|
||||
|
||||
|
|
@ -385,7 +386,7 @@ void pw_init(int *argc, char **argv[])
|
|||
items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_CPU_FORCE, str);
|
||||
info = SPA_DICT_INIT(items, n_items);
|
||||
|
||||
add_interface(support, "cpu", SPA_TYPE_INTERFACE_CPU, &info);
|
||||
add_interface(support, SPA_NAME_SUPPORT_CPU, SPA_TYPE_INTERFACE_CPU, &info);
|
||||
pw_log_info("version %s", pw_get_library_version());
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue