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:
Wim Taymans 2019-06-21 13:31:34 +02:00
parent 4494f9c7c9
commit 6720ded529
40 changed files with 188 additions and 55 deletions

View file

@ -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,

View file

@ -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,

View file

@ -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,