mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-03 09:01:54 -05:00
interfaces: move proxy API into their own header files
This commit is contained in:
parent
b75f2aaabd
commit
aa378417c2
26 changed files with 1039 additions and 858 deletions
|
|
@ -33,10 +33,7 @@
|
|||
#include <pulse/introspect.h>
|
||||
#include <pulse/version.h>
|
||||
|
||||
#include <pipewire/array.h>
|
||||
#include <pipewire/utils.h>
|
||||
#include <pipewire/interfaces.h>
|
||||
#include <pipewire/log.h>
|
||||
#include <pipewire/pipewire.h>
|
||||
#include <extensions/session-manager.h>
|
||||
|
||||
/* Some PulseAudio API added const qualifiers in 13.0 */
|
||||
|
|
|
|||
|
|
@ -33,7 +33,6 @@
|
|||
#include <spa/utils/keys.h>
|
||||
|
||||
#include "pipewire/pipewire.h"
|
||||
#include "pipewire/interfaces.h"
|
||||
#include "pipewire/private.h"
|
||||
|
||||
#include "pipewire/context.h"
|
||||
|
|
|
|||
|
|
@ -21,10 +21,7 @@
|
|||
|
||||
#include <spa/pod/parser.h>
|
||||
|
||||
#include "pipewire/pipewire.h"
|
||||
#include "pipewire/interfaces.h"
|
||||
#include "pipewire/protocol.h"
|
||||
#include "pipewire/impl-client.h"
|
||||
#include "pipewire/impl.h"
|
||||
#include "pipewire/private.h"
|
||||
|
||||
#include "extensions/protocol-native.h"
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@ extern "C" {
|
|||
#include <spa/param/param.h>
|
||||
#include <spa/node/node.h>
|
||||
|
||||
#include <pipewire/introspect.h>
|
||||
#include <pipewire/proxy.h>
|
||||
#include <pipewire/pipewire.h>
|
||||
|
||||
/** Core */
|
||||
|
||||
|
|
|
|||
166
src/pipewire/client.h
Normal file
166
src/pipewire/client.h
Normal file
|
|
@ -0,0 +1,166 @@
|
|||
/* PipeWire
|
||||
*
|
||||
* Copyright © 2018 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 PIPEWIRE_CLIENT_H
|
||||
#define PIPEWIRE_CLIENT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <spa/utils/defs.h>
|
||||
#include <spa/param/param.h>
|
||||
|
||||
#include <pipewire/proxy.h>
|
||||
#include <pipewire/permission.h>
|
||||
|
||||
/** The client information. Extra information can be added in later versions \memberof pw_introspect */
|
||||
struct pw_client_info {
|
||||
uint32_t id; /**< id of the global */
|
||||
#define PW_CLIENT_CHANGE_MASK_PROPS (1 << 0)
|
||||
#define PW_CLIENT_CHANGE_MASK_ALL ((1 << 1)-1)
|
||||
uint64_t change_mask; /**< bitfield of changed fields since last call */
|
||||
struct spa_dict *props; /**< extra properties */
|
||||
};
|
||||
|
||||
/** Update and existing \ref pw_client_info with \a update \memberof pw_introspect */
|
||||
struct pw_client_info *
|
||||
pw_client_info_update(struct pw_client_info *info,
|
||||
const struct pw_client_info *update);
|
||||
|
||||
/** Free a \ref pw_client_info \memberof pw_introspect */
|
||||
void pw_client_info_free(struct pw_client_info *info);
|
||||
|
||||
|
||||
#define PW_VERSION_CLIENT_PROXY 3
|
||||
struct pw_client_proxy;
|
||||
|
||||
#define PW_CLIENT_PROXY_EVENT_INFO 0
|
||||
#define PW_CLIENT_PROXY_EVENT_PERMISSIONS 1
|
||||
#define PW_CLIENT_PROXY_EVENT_NUM 2
|
||||
|
||||
/** Client events */
|
||||
struct pw_client_proxy_events {
|
||||
#define PW_VERSION_CLIENT_PROXY_EVENTS 0
|
||||
uint32_t version;
|
||||
/**
|
||||
* Notify client info
|
||||
*
|
||||
* \param info info about the client
|
||||
*/
|
||||
void (*info) (void *object, const struct pw_client_info *info);
|
||||
/**
|
||||
* Notify a client permission
|
||||
*
|
||||
* Event emited as a result of the get_permissions method.
|
||||
*
|
||||
* \param default_permissions the default permissions
|
||||
* \param index the index of the first permission entry
|
||||
* \param n_permissions the number of permissions
|
||||
* \param permissions the permissions
|
||||
*/
|
||||
void (*permissions) (void *object,
|
||||
uint32_t index,
|
||||
uint32_t n_permissions,
|
||||
const struct pw_permission *permissions);
|
||||
};
|
||||
|
||||
|
||||
#define PW_CLIENT_PROXY_METHOD_ADD_LISTENER 0
|
||||
#define PW_CLIENT_PROXY_METHOD_ERROR 1
|
||||
#define PW_CLIENT_PROXY_METHOD_UPDATE_PROPERTIES 2
|
||||
#define PW_CLIENT_PROXY_METHOD_GET_PERMISSIONS 3
|
||||
#define PW_CLIENT_PROXY_METHOD_UPDATE_PERMISSIONS 4
|
||||
#define PW_CLIENT_PROXY_METHOD_NUM 5
|
||||
|
||||
/** Client methods */
|
||||
struct pw_client_proxy_methods {
|
||||
#define PW_VERSION_CLIENT_PROXY_METHODS 0
|
||||
uint32_t version;
|
||||
|
||||
int (*add_listener) (void *object,
|
||||
struct spa_hook *listener,
|
||||
const struct pw_client_proxy_events *events,
|
||||
void *data);
|
||||
/**
|
||||
* Send an error to a client
|
||||
*
|
||||
* \param id the global id to report the error on
|
||||
* \param res an errno style error code
|
||||
* \param message an error string
|
||||
*/
|
||||
int (*error) (void *object, uint32_t id, int res, const char *message);
|
||||
/**
|
||||
* Update client properties
|
||||
*
|
||||
* \param props new properties
|
||||
*/
|
||||
int (*update_properties) (void *object, const struct spa_dict *props);
|
||||
|
||||
/**
|
||||
* Get client permissions
|
||||
*
|
||||
* A permissions event will be emited with the permissions.
|
||||
*
|
||||
* \param index the first index to query, 0 for first
|
||||
* \param num the maximum number of items to get
|
||||
*/
|
||||
int (*get_permissions) (void *object, uint32_t index, uint32_t num);
|
||||
/**
|
||||
* Manage the permissions of the global objects for this
|
||||
* client
|
||||
*
|
||||
* Update the permissions of the global objects using the
|
||||
* provided array with permissions
|
||||
*
|
||||
* Globals can use the default permissions or can have specific
|
||||
* permissions assigned to them.
|
||||
*
|
||||
* \param n_permissions number of permissions
|
||||
* \param permissions array of permissions
|
||||
*/
|
||||
int (*update_permissions) (void *object, uint32_t n_permissions,
|
||||
const struct pw_permission *permissions);
|
||||
};
|
||||
|
||||
#define pw_client_proxy_method(o,method,version,...) \
|
||||
({ \
|
||||
int _res = -ENOTSUP; \
|
||||
spa_interface_call_res((struct spa_interface*)o, \
|
||||
struct pw_client_proxy_methods, _res, \
|
||||
method, version, ##__VA_ARGS__); \
|
||||
_res; \
|
||||
})
|
||||
|
||||
#define pw_client_proxy_add_listener(c,...) pw_client_proxy_method(c,add_listener,0,__VA_ARGS__)
|
||||
#define pw_client_proxy_error(c,...) pw_client_proxy_method(c,error,0,__VA_ARGS__)
|
||||
#define pw_client_proxy_update_properties(c,...) pw_client_proxy_method(c,update_properties,0,__VA_ARGS__)
|
||||
#define pw_client_proxy_get_permissions(c,...) pw_client_proxy_method(c,get_permissions,0,__VA_ARGS__)
|
||||
#define pw_client_proxy_update_permissions(c,...) pw_client_proxy_method(c,update_permissions,0,__VA_ARGS__)
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* PIPEWIRE_CLIENT_H */
|
||||
|
|
@ -46,8 +46,6 @@ struct pw_global;
|
|||
struct pw_impl_client;
|
||||
struct pw_impl_factory;
|
||||
|
||||
#include <pipewire/introspect.h>
|
||||
#include <pipewire/interfaces.h>
|
||||
#include <pipewire/core.h>
|
||||
#include <pipewire/loop.h>
|
||||
#include <pipewire/properties.h>
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <spa/utils/hook.h>
|
||||
|
||||
|
|
|
|||
147
src/pipewire/device.h
Normal file
147
src/pipewire/device.h
Normal file
|
|
@ -0,0 +1,147 @@
|
|||
/* PipeWire
|
||||
*
|
||||
* Copyright © 2018 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 PIPEWIRE_DEVICE_H
|
||||
#define PIPEWIRE_DEVICE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <spa/utils/defs.h>
|
||||
#include <spa/utils/hook.h>
|
||||
|
||||
#include <pipewire/proxy.h>
|
||||
|
||||
#define PW_VERSION_DEVICE_PROXY 3
|
||||
struct pw_device_proxy;
|
||||
|
||||
/** The device information. Extra information can be added in later versions \memberof pw_introspect */
|
||||
struct pw_device_info {
|
||||
uint32_t id; /**< id of the global */
|
||||
#define PW_DEVICE_CHANGE_MASK_PROPS (1 << 0)
|
||||
#define PW_DEVICE_CHANGE_MASK_PARAMS (1 << 1)
|
||||
#define PW_DEVICE_CHANGE_MASK_ALL ((1 << 2)-1)
|
||||
uint64_t change_mask; /**< bitfield of changed fields since last call */
|
||||
struct spa_dict *props; /**< extra properties */
|
||||
struct spa_param_info *params; /**< parameters */
|
||||
uint32_t n_params; /**< number of items in \a params */
|
||||
};
|
||||
|
||||
/** Update and existing \ref pw_device_info with \a update \memberof pw_introspect */
|
||||
struct pw_device_info *
|
||||
pw_device_info_update(struct pw_device_info *info,
|
||||
const struct pw_device_info *update);
|
||||
|
||||
/** Free a \ref pw_device_info \memberof pw_introspect */
|
||||
void pw_device_info_free(struct pw_device_info *info);
|
||||
|
||||
#define PW_DEVICE_PROXY_EVENT_INFO 0
|
||||
#define PW_DEVICE_PROXY_EVENT_PARAM 1
|
||||
#define PW_DEVICE_PROXY_EVENT_NUM 2
|
||||
|
||||
/** Device events */
|
||||
struct pw_device_proxy_events {
|
||||
#define PW_VERSION_DEVICE_PROXY_EVENTS 0
|
||||
uint32_t version;
|
||||
/**
|
||||
* Notify device info
|
||||
*
|
||||
* \param info info about the device
|
||||
*/
|
||||
void (*info) (void *object, const struct pw_device_info *info);
|
||||
/**
|
||||
* Notify a device param
|
||||
*
|
||||
* Event emited as a result of the enum_params method.
|
||||
*
|
||||
* \param seq the sequence number of the request
|
||||
* \param id the param id
|
||||
* \param index the param index
|
||||
* \param next the param index of the next param
|
||||
* \param param the parameter
|
||||
*/
|
||||
void (*param) (void *object, int seq,
|
||||
uint32_t id, uint32_t index, uint32_t next,
|
||||
const struct spa_pod *param);
|
||||
};
|
||||
|
||||
|
||||
#define PW_DEVICE_PROXY_METHOD_ADD_LISTENER 0
|
||||
#define PW_DEVICE_PROXY_METHOD_ENUM_PARAMS 1
|
||||
#define PW_DEVICE_PROXY_METHOD_SET_PARAM 2
|
||||
#define PW_DEVICE_PROXY_METHOD_NUM 3
|
||||
|
||||
/** Device methods */
|
||||
struct pw_device_proxy_methods {
|
||||
#define PW_VERSION_DEVICE_PROXY_METHODS 0
|
||||
uint32_t version;
|
||||
|
||||
int (*add_listener) (void *object,
|
||||
struct spa_hook *listener,
|
||||
const struct pw_device_proxy_events *events,
|
||||
void *data);
|
||||
/**
|
||||
* Enumerate device parameters
|
||||
*
|
||||
* Start enumeration of device parameters. For each param, a
|
||||
* param event will be emited.
|
||||
*
|
||||
* \param seq a sequence number to place in the reply
|
||||
* \param id the parameter id to enum or SPA_ID_INVALID for all
|
||||
* \param start the start index or 0 for the first param
|
||||
* \param num the maximum number of params to retrieve
|
||||
* \param filter a param filter or NULL
|
||||
*/
|
||||
int (*enum_params) (void *object, int seq, uint32_t id, uint32_t start, uint32_t num,
|
||||
const struct spa_pod *filter);
|
||||
/**
|
||||
* Set a parameter on the device
|
||||
*
|
||||
* \param id the parameter id to set
|
||||
* \param flags extra parameter flags
|
||||
* \param param the parameter to set
|
||||
*/
|
||||
int (*set_param) (void *object, uint32_t id, uint32_t flags,
|
||||
const struct spa_pod *param);
|
||||
};
|
||||
|
||||
#define pw_device_proxy_method(o,method,version,...) \
|
||||
({ \
|
||||
int _res = -ENOTSUP; \
|
||||
spa_interface_call_res((struct spa_interface*)o, \
|
||||
struct pw_device_proxy_methods, _res, \
|
||||
method, version, ##__VA_ARGS__); \
|
||||
_res; \
|
||||
})
|
||||
|
||||
#define pw_device_proxy_add_listener(c,...) pw_device_proxy_method(c,add_listener,0,__VA_ARGS__)
|
||||
#define pw_device_proxy_enum_params(c,...) pw_device_proxy_method(c,enum_params,0,__VA_ARGS__)
|
||||
#define pw_device_proxy_set_param(c,...) pw_device_proxy_method(c,set_param,0,__VA_ARGS__)
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* PIPEWIRE_DEVICE_H */
|
||||
107
src/pipewire/factory.h
Normal file
107
src/pipewire/factory.h
Normal file
|
|
@ -0,0 +1,107 @@
|
|||
/* PipeWire
|
||||
*
|
||||
* Copyright © 2018 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 PIPEWIRE_FACTORY_H
|
||||
#define PIPEWIRE_FACTORY_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <spa/utils/defs.h>
|
||||
#include <spa/utils/hook.h>
|
||||
|
||||
#include <pipewire/proxy.h>
|
||||
|
||||
#define PW_VERSION_FACTORY_PROXY 3
|
||||
struct pw_factory_proxy;
|
||||
|
||||
/** The factory information. Extra information can be added in later versions \memberof pw_introspect */
|
||||
struct pw_factory_info {
|
||||
uint32_t id; /**< id of the global */
|
||||
const char *name; /**< name the factory */
|
||||
uint32_t type; /**< type of the objects created by this factory */
|
||||
uint32_t version; /**< version of the objects */
|
||||
#define PW_FACTORY_CHANGE_MASK_PROPS (1 << 0)
|
||||
#define PW_FACTORY_CHANGE_MASK_ALL ((1 << 1)-1)
|
||||
uint64_t change_mask; /**< bitfield of changed fields since last call */
|
||||
struct spa_dict *props; /**< the properties of the factory */
|
||||
};
|
||||
|
||||
struct pw_factory_info *
|
||||
pw_factory_info_update(struct pw_factory_info *info,
|
||||
const struct pw_factory_info *update);
|
||||
|
||||
void
|
||||
pw_factory_info_free(struct pw_factory_info *info);
|
||||
|
||||
|
||||
#define PW_FACTORY_PROXY_EVENT_INFO 0
|
||||
#define PW_FACTORY_PROXY_EVENT_NUM 1
|
||||
|
||||
/** Factory events */
|
||||
struct pw_factory_proxy_events {
|
||||
#define PW_VERSION_FACTORY_PROXY_EVENTS 0
|
||||
uint32_t version;
|
||||
/**
|
||||
* Notify factory info
|
||||
*
|
||||
* \param info info about the factory
|
||||
*/
|
||||
void (*info) (void *object, const struct pw_factory_info *info);
|
||||
};
|
||||
|
||||
#define PW_FACTORY_PROXY_METHOD_ADD_LISTENER 0
|
||||
#define PW_FACTORY_PROXY_METHOD_NUM 1
|
||||
|
||||
/** Factory methods */
|
||||
struct pw_factory_proxy_methods {
|
||||
#define PW_VERSION_FACTORY_PROXY_METHODS 0
|
||||
uint32_t version;
|
||||
|
||||
int (*add_listener) (void *object,
|
||||
struct spa_hook *listener,
|
||||
const struct pw_factory_proxy_events *events,
|
||||
void *data);
|
||||
};
|
||||
|
||||
#define pw_factory_proxy_method(o,method,version,...) \
|
||||
({ \
|
||||
int _res = -ENOTSUP; \
|
||||
spa_interface_call_res((struct spa_interface*)o, \
|
||||
struct pw_factory_proxy_methods, _res, \
|
||||
method, version, ##__VA_ARGS__); \
|
||||
_res; \
|
||||
})
|
||||
|
||||
#define pw_factory_proxy_add_listener(c,...) pw_factory_proxy_method(c,add_listener,0,__VA_ARGS__)
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* PIPEWIRE_FACTORY_H */
|
||||
|
|
@ -27,10 +27,8 @@
|
|||
#include <time.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <pipewire/impl.h>
|
||||
#include <pipewire/private.h>
|
||||
#include <pipewire/global.h>
|
||||
#include <pipewire/interfaces.h>
|
||||
#include <pipewire/type.h>
|
||||
|
||||
#include <spa/debug/types.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -25,12 +25,8 @@
|
|||
#include <errno.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "pipewire/interfaces.h"
|
||||
#include "pipewire/impl-client.h"
|
||||
#include "pipewire/impl.h"
|
||||
#include "pipewire/private.h"
|
||||
#include "pipewire/resource.h"
|
||||
#include "pipewire/type.h"
|
||||
#include "pipewire/keys.h"
|
||||
|
||||
#define NAME "client"
|
||||
|
||||
|
|
|
|||
|
|
@ -45,7 +45,6 @@ struct pw_impl_client;
|
|||
|
||||
#include <pipewire/context.h>
|
||||
#include <pipewire/global.h>
|
||||
#include <pipewire/introspect.h>
|
||||
#include <pipewire/properties.h>
|
||||
#include <pipewire/resource.h>
|
||||
#include <pipewire/permission.h>
|
||||
|
|
|
|||
|
|
@ -1,583 +0,0 @@
|
|||
/* PipeWire
|
||||
*
|
||||
* Copyright © 2018 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 PIPEWIRE_INTERFACES_H
|
||||
#define PIPEWIRE_INTERFACES_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <spa/utils/defs.h>
|
||||
#include <spa/utils/hook.h>
|
||||
#include <spa/node/command.h>
|
||||
#include <spa/param/param.h>
|
||||
|
||||
#include <pipewire/introspect.h>
|
||||
#include <pipewire/proxy.h>
|
||||
#include <pipewire/permission.h>
|
||||
|
||||
#define PW_VERSION_MODULE_PROXY 3
|
||||
struct pw_module_proxy;
|
||||
#define PW_VERSION_DEVICE_PROXY 3
|
||||
struct pw_device_proxy;
|
||||
#define PW_VERSION_NODE_PROXY 3
|
||||
struct pw_node_proxy;
|
||||
#define PW_VERSION_PORT_PROXY 3
|
||||
struct pw_port_proxy;
|
||||
#define PW_VERSION_FACTORY_PROXY 3
|
||||
struct pw_factory_proxy;
|
||||
#define PW_VERSION_CLIENT_PROXY 3
|
||||
struct pw_client_proxy;
|
||||
#define PW_VERSION_LINK_PROXY 3
|
||||
struct pw_link_proxy;
|
||||
|
||||
/**
|
||||
* \page page_pipewire_protocol The PipeWire protocol
|
||||
* \section page_ifaces_pipewire Interfaces
|
||||
* - \subpage page_iface_pw_core - core global object
|
||||
* - \subpage page_iface_pw_registry - global registry object
|
||||
*/
|
||||
|
||||
/**
|
||||
* \page page_iface_pw_core pw_core
|
||||
* \section page_iface_pw_core_desc Description
|
||||
*
|
||||
* The core global object. This is a special singleton object. It
|
||||
* is used for internal PipeWire protocol features.
|
||||
* \section page_iface_pw_core API
|
||||
*/
|
||||
|
||||
|
||||
#define PW_MODULE_PROXY_EVENT_INFO 0
|
||||
#define PW_MODULE_PROXY_EVENT_NUM 1
|
||||
|
||||
/** Module events */
|
||||
struct pw_module_proxy_events {
|
||||
#define PW_VERSION_MODULE_PROXY_EVENTS 0
|
||||
uint32_t version;
|
||||
/**
|
||||
* Notify module info
|
||||
*
|
||||
* \param info info about the module
|
||||
*/
|
||||
void (*info) (void *object, const struct pw_module_info *info);
|
||||
};
|
||||
|
||||
#define PW_MODULE_PROXY_METHOD_ADD_LISTENER 0
|
||||
#define PW_MODULE_PROXY_METHOD_NUM 1
|
||||
|
||||
/** Module methods */
|
||||
struct pw_module_proxy_methods {
|
||||
#define PW_VERSION_MODULE_PROXY_METHODS 0
|
||||
uint32_t version;
|
||||
|
||||
int (*add_listener) (void *object,
|
||||
struct spa_hook *listener,
|
||||
const struct pw_module_proxy_events *events,
|
||||
void *data);
|
||||
};
|
||||
|
||||
#define pw_module_proxy_method(o,method,version,...) \
|
||||
({ \
|
||||
int _res = -ENOTSUP; \
|
||||
spa_interface_call_res((struct spa_interface*)o, \
|
||||
struct pw_module_proxy_methods, _res, \
|
||||
method, version, ##__VA_ARGS__); \
|
||||
_res; \
|
||||
})
|
||||
|
||||
#define pw_module_proxy_add_listener(c,...) pw_module_proxy_method(c,add_listener,0,__VA_ARGS__)
|
||||
|
||||
#define PW_DEVICE_PROXY_EVENT_INFO 0
|
||||
#define PW_DEVICE_PROXY_EVENT_PARAM 1
|
||||
#define PW_DEVICE_PROXY_EVENT_NUM 2
|
||||
|
||||
/** Device events */
|
||||
struct pw_device_proxy_events {
|
||||
#define PW_VERSION_DEVICE_PROXY_EVENTS 0
|
||||
uint32_t version;
|
||||
/**
|
||||
* Notify device info
|
||||
*
|
||||
* \param info info about the device
|
||||
*/
|
||||
void (*info) (void *object, const struct pw_device_info *info);
|
||||
/**
|
||||
* Notify a device param
|
||||
*
|
||||
* Event emited as a result of the enum_params method.
|
||||
*
|
||||
* \param seq the sequence number of the request
|
||||
* \param id the param id
|
||||
* \param index the param index
|
||||
* \param next the param index of the next param
|
||||
* \param param the parameter
|
||||
*/
|
||||
void (*param) (void *object, int seq,
|
||||
uint32_t id, uint32_t index, uint32_t next,
|
||||
const struct spa_pod *param);
|
||||
};
|
||||
|
||||
|
||||
#define PW_DEVICE_PROXY_METHOD_ADD_LISTENER 0
|
||||
#define PW_DEVICE_PROXY_METHOD_ENUM_PARAMS 1
|
||||
#define PW_DEVICE_PROXY_METHOD_SET_PARAM 2
|
||||
#define PW_DEVICE_PROXY_METHOD_NUM 3
|
||||
|
||||
/** Device methods */
|
||||
struct pw_device_proxy_methods {
|
||||
#define PW_VERSION_DEVICE_PROXY_METHODS 0
|
||||
uint32_t version;
|
||||
|
||||
int (*add_listener) (void *object,
|
||||
struct spa_hook *listener,
|
||||
const struct pw_device_proxy_events *events,
|
||||
void *data);
|
||||
/**
|
||||
* Enumerate device parameters
|
||||
*
|
||||
* Start enumeration of device parameters. For each param, a
|
||||
* param event will be emited.
|
||||
*
|
||||
* \param seq a sequence number to place in the reply
|
||||
* \param id the parameter id to enum or SPA_ID_INVALID for all
|
||||
* \param start the start index or 0 for the first param
|
||||
* \param num the maximum number of params to retrieve
|
||||
* \param filter a param filter or NULL
|
||||
*/
|
||||
int (*enum_params) (void *object, int seq, uint32_t id, uint32_t start, uint32_t num,
|
||||
const struct spa_pod *filter);
|
||||
/**
|
||||
* Set a parameter on the device
|
||||
*
|
||||
* \param id the parameter id to set
|
||||
* \param flags extra parameter flags
|
||||
* \param param the parameter to set
|
||||
*/
|
||||
int (*set_param) (void *object, uint32_t id, uint32_t flags,
|
||||
const struct spa_pod *param);
|
||||
};
|
||||
|
||||
#define pw_device_proxy_method(o,method,version,...) \
|
||||
({ \
|
||||
int _res = -ENOTSUP; \
|
||||
spa_interface_call_res((struct spa_interface*)o, \
|
||||
struct pw_device_proxy_methods, _res, \
|
||||
method, version, ##__VA_ARGS__); \
|
||||
_res; \
|
||||
})
|
||||
|
||||
#define pw_device_proxy_add_listener(c,...) pw_device_proxy_method(c,add_listener,0,__VA_ARGS__)
|
||||
#define pw_device_proxy_enum_params(c,...) pw_device_proxy_method(c,enum_params,0,__VA_ARGS__)
|
||||
#define pw_device_proxy_set_param(c,...) pw_device_proxy_method(c,set_param,0,__VA_ARGS__)
|
||||
|
||||
|
||||
#define PW_NODE_PROXY_EVENT_INFO 0
|
||||
#define PW_NODE_PROXY_EVENT_PARAM 1
|
||||
#define PW_NODE_PROXY_EVENT_NUM 2
|
||||
|
||||
/** Node events */
|
||||
struct pw_node_proxy_events {
|
||||
#define PW_VERSION_NODE_PROXY_EVENTS 0
|
||||
uint32_t version;
|
||||
/**
|
||||
* Notify node info
|
||||
*
|
||||
* \param info info about the node
|
||||
*/
|
||||
void (*info) (void *object, const struct pw_node_info *info);
|
||||
/**
|
||||
* Notify a node param
|
||||
*
|
||||
* Event emited as a result of the enum_params method.
|
||||
*
|
||||
* \param seq the sequence number of the request
|
||||
* \param id the param id
|
||||
* \param index the param index
|
||||
* \param next the param index of the next param
|
||||
* \param param the parameter
|
||||
*/
|
||||
void (*param) (void *object, int seq,
|
||||
uint32_t id, uint32_t index, uint32_t next,
|
||||
const struct spa_pod *param);
|
||||
};
|
||||
|
||||
#define PW_NODE_PROXY_METHOD_ADD_LISTENER 0
|
||||
#define PW_NODE_PROXY_METHOD_SUBSCRIBE_PARAMS 1
|
||||
#define PW_NODE_PROXY_METHOD_ENUM_PARAMS 2
|
||||
#define PW_NODE_PROXY_METHOD_SET_PARAM 3
|
||||
#define PW_NODE_PROXY_METHOD_SEND_COMMAND 4
|
||||
#define PW_NODE_PROXY_METHOD_NUM 5
|
||||
|
||||
/** Node methods */
|
||||
struct pw_node_proxy_methods {
|
||||
#define PW_VERSION_NODE_PROXY_METHODS 0
|
||||
uint32_t version;
|
||||
|
||||
int (*add_listener) (void *object,
|
||||
struct spa_hook *listener,
|
||||
const struct pw_node_proxy_events *events,
|
||||
void *data);
|
||||
/**
|
||||
* Subscribe to parameter changes
|
||||
*
|
||||
* Automatically emit param events for the given ids when
|
||||
* they are changed.
|
||||
*
|
||||
* \param ids an array of param ids
|
||||
* \param n_ids the number of ids in \a ids
|
||||
*/
|
||||
int (*subscribe_params) (void *object, uint32_t *ids, uint32_t n_ids);
|
||||
|
||||
/**
|
||||
* Enumerate node parameters
|
||||
*
|
||||
* Start enumeration of node parameters. For each param, a
|
||||
* param event will be emited.
|
||||
*
|
||||
* \param seq a sequence number to place in the reply
|
||||
* \param id the parameter id to enum or SPA_ID_INVALID for all
|
||||
* \param start the start index or 0 for the first param
|
||||
* \param num the maximum number of params to retrieve
|
||||
* \param filter a param filter or NULL
|
||||
*/
|
||||
int (*enum_params) (void *object, int seq, uint32_t id,
|
||||
uint32_t start, uint32_t num,
|
||||
const struct spa_pod *filter);
|
||||
|
||||
/**
|
||||
* Set a parameter on the node
|
||||
*
|
||||
* \param id the parameter id to set
|
||||
* \param flags extra parameter flags
|
||||
* \param param the parameter to set
|
||||
*/
|
||||
int (*set_param) (void *object, uint32_t id, uint32_t flags,
|
||||
const struct spa_pod *param);
|
||||
|
||||
/**
|
||||
* Send a command to the node
|
||||
*
|
||||
* \param command the command to send
|
||||
*/
|
||||
int (*send_command) (void *object, const struct spa_command *command);
|
||||
};
|
||||
|
||||
#define pw_node_proxy_method(o,method,version,...) \
|
||||
({ \
|
||||
int _res = -ENOTSUP; \
|
||||
spa_interface_call_res((struct spa_interface*)o, \
|
||||
struct pw_node_proxy_methods, _res, \
|
||||
method, version, ##__VA_ARGS__); \
|
||||
_res; \
|
||||
})
|
||||
|
||||
/** Node */
|
||||
#define pw_node_proxy_add_listener(c,...) pw_node_proxy_method(c,add_listener,0,__VA_ARGS__)
|
||||
#define pw_node_proxy_subscribe_params(c,...) pw_node_proxy_method(c,subscribe_params,0,__VA_ARGS__)
|
||||
#define pw_node_proxy_enum_params(c,...) pw_node_proxy_method(c,enum_params,0,__VA_ARGS__)
|
||||
#define pw_node_proxy_set_param(c,...) pw_node_proxy_method(c,set_param,0,__VA_ARGS__)
|
||||
#define pw_node_proxy_send_command(c,...) pw_node_proxy_method(c,send_command,0,__VA_ARGS__)
|
||||
|
||||
|
||||
#define PW_PORT_PROXY_EVENT_INFO 0
|
||||
#define PW_PORT_PROXY_EVENT_PARAM 1
|
||||
#define PW_PORT_PROXY_EVENT_NUM 2
|
||||
|
||||
/** Port events */
|
||||
struct pw_port_proxy_events {
|
||||
#define PW_VERSION_PORT_PROXY_EVENTS 0
|
||||
uint32_t version;
|
||||
/**
|
||||
* Notify port info
|
||||
*
|
||||
* \param info info about the port
|
||||
*/
|
||||
void (*info) (void *object, const struct pw_port_info *info);
|
||||
/**
|
||||
* Notify a port param
|
||||
*
|
||||
* Event emited as a result of the enum_params method.
|
||||
*
|
||||
* \param seq the sequence number of the request
|
||||
* \param id the param id
|
||||
* \param index the param index
|
||||
* \param next the param index of the next param
|
||||
* \param param the parameter
|
||||
*/
|
||||
void (*param) (void *object, int seq,
|
||||
uint32_t id, uint32_t index, uint32_t next,
|
||||
const struct spa_pod *param);
|
||||
};
|
||||
|
||||
#define PW_PORT_PROXY_METHOD_ADD_LISTENER 0
|
||||
#define PW_PORT_PROXY_METHOD_SUBSCRIBE_PARAMS 1
|
||||
#define PW_PORT_PROXY_METHOD_ENUM_PARAMS 2
|
||||
#define PW_PORT_PROXY_METHOD_NUM 3
|
||||
|
||||
/** Port methods */
|
||||
struct pw_port_proxy_methods {
|
||||
#define PW_VERSION_PORT_PROXY_METHODS 0
|
||||
uint32_t version;
|
||||
|
||||
int (*add_listener) (void *object,
|
||||
struct spa_hook *listener,
|
||||
const struct pw_port_proxy_events *events,
|
||||
void *data);
|
||||
/**
|
||||
* Subscribe to parameter changes
|
||||
*
|
||||
* Automatically emit param events for the given ids when
|
||||
* they are changed.
|
||||
*
|
||||
* \param ids an array of param ids
|
||||
* \param n_ids the number of ids in \a ids
|
||||
*/
|
||||
int (*subscribe_params) (void *object, uint32_t *ids, uint32_t n_ids);
|
||||
|
||||
/**
|
||||
* Enumerate port parameters
|
||||
*
|
||||
* Start enumeration of port parameters. For each param, a
|
||||
* param event will be emited.
|
||||
*
|
||||
* \param seq a sequence number returned in the reply
|
||||
* \param id the parameter id to enumerate
|
||||
* \param start the start index or 0 for the first param
|
||||
* \param num the maximum number of params to retrieve
|
||||
* \param filter a param filter or NULL
|
||||
*/
|
||||
int (*enum_params) (void *object, int seq,
|
||||
uint32_t id, uint32_t start, uint32_t num,
|
||||
const struct spa_pod *filter);
|
||||
};
|
||||
|
||||
#define pw_port_proxy_method(o,method,version,...) \
|
||||
({ \
|
||||
int _res = -ENOTSUP; \
|
||||
spa_interface_call_res((struct spa_interface*)o, \
|
||||
struct pw_port_proxy_methods, _res, \
|
||||
method, version, ##__VA_ARGS__); \
|
||||
_res; \
|
||||
})
|
||||
|
||||
#define pw_port_proxy_add_listener(c,...) pw_port_proxy_method(c,add_listener,0,__VA_ARGS__)
|
||||
#define pw_port_proxy_subscribe_params(c,...) pw_port_proxy_method(c,subscribe_params,0,__VA_ARGS__)
|
||||
#define pw_port_proxy_enum_params(c,...) pw_port_proxy_method(c,enum_params,0,__VA_ARGS__)
|
||||
|
||||
|
||||
#define PW_FACTORY_PROXY_EVENT_INFO 0
|
||||
#define PW_FACTORY_PROXY_EVENT_NUM 1
|
||||
|
||||
/** Factory events */
|
||||
struct pw_factory_proxy_events {
|
||||
#define PW_VERSION_FACTORY_PROXY_EVENTS 0
|
||||
uint32_t version;
|
||||
/**
|
||||
* Notify factory info
|
||||
*
|
||||
* \param info info about the factory
|
||||
*/
|
||||
void (*info) (void *object, const struct pw_factory_info *info);
|
||||
};
|
||||
|
||||
#define PW_FACTORY_PROXY_METHOD_ADD_LISTENER 0
|
||||
#define PW_FACTORY_PROXY_METHOD_NUM 1
|
||||
|
||||
/** Factory methods */
|
||||
struct pw_factory_proxy_methods {
|
||||
#define PW_VERSION_FACTORY_PROXY_METHODS 0
|
||||
uint32_t version;
|
||||
|
||||
int (*add_listener) (void *object,
|
||||
struct spa_hook *listener,
|
||||
const struct pw_factory_proxy_events *events,
|
||||
void *data);
|
||||
};
|
||||
|
||||
#define pw_factory_proxy_method(o,method,version,...) \
|
||||
({ \
|
||||
int _res = -ENOTSUP; \
|
||||
spa_interface_call_res((struct spa_interface*)o, \
|
||||
struct pw_factory_proxy_methods, _res, \
|
||||
method, version, ##__VA_ARGS__); \
|
||||
_res; \
|
||||
})
|
||||
|
||||
#define pw_factory_proxy_add_listener(c,...) pw_factory_proxy_method(c,add_listener,0,__VA_ARGS__)
|
||||
|
||||
|
||||
#define PW_CLIENT_PROXY_EVENT_INFO 0
|
||||
#define PW_CLIENT_PROXY_EVENT_PERMISSIONS 1
|
||||
#define PW_CLIENT_PROXY_EVENT_NUM 2
|
||||
|
||||
/** Client events */
|
||||
struct pw_client_proxy_events {
|
||||
#define PW_VERSION_CLIENT_PROXY_EVENTS 0
|
||||
uint32_t version;
|
||||
/**
|
||||
* Notify client info
|
||||
*
|
||||
* \param info info about the client
|
||||
*/
|
||||
void (*info) (void *object, const struct pw_client_info *info);
|
||||
/**
|
||||
* Notify a client permission
|
||||
*
|
||||
* Event emited as a result of the get_permissions method.
|
||||
*
|
||||
* \param default_permissions the default permissions
|
||||
* \param index the index of the first permission entry
|
||||
* \param n_permissions the number of permissions
|
||||
* \param permissions the permissions
|
||||
*/
|
||||
void (*permissions) (void *object,
|
||||
uint32_t index,
|
||||
uint32_t n_permissions,
|
||||
const struct pw_permission *permissions);
|
||||
};
|
||||
|
||||
|
||||
#define PW_CLIENT_PROXY_METHOD_ADD_LISTENER 0
|
||||
#define PW_CLIENT_PROXY_METHOD_ERROR 1
|
||||
#define PW_CLIENT_PROXY_METHOD_UPDATE_PROPERTIES 2
|
||||
#define PW_CLIENT_PROXY_METHOD_GET_PERMISSIONS 3
|
||||
#define PW_CLIENT_PROXY_METHOD_UPDATE_PERMISSIONS 4
|
||||
#define PW_CLIENT_PROXY_METHOD_NUM 5
|
||||
|
||||
/** Client methods */
|
||||
struct pw_client_proxy_methods {
|
||||
#define PW_VERSION_CLIENT_PROXY_METHODS 0
|
||||
uint32_t version;
|
||||
|
||||
int (*add_listener) (void *object,
|
||||
struct spa_hook *listener,
|
||||
const struct pw_client_proxy_events *events,
|
||||
void *data);
|
||||
/**
|
||||
* Send an error to a client
|
||||
*
|
||||
* \param id the global id to report the error on
|
||||
* \param res an errno style error code
|
||||
* \param message an error string
|
||||
*/
|
||||
int (*error) (void *object, uint32_t id, int res, const char *message);
|
||||
/**
|
||||
* Update client properties
|
||||
*
|
||||
* \param props new properties
|
||||
*/
|
||||
int (*update_properties) (void *object, const struct spa_dict *props);
|
||||
|
||||
/**
|
||||
* Get client permissions
|
||||
*
|
||||
* A permissions event will be emited with the permissions.
|
||||
*
|
||||
* \param index the first index to query, 0 for first
|
||||
* \param num the maximum number of items to get
|
||||
*/
|
||||
int (*get_permissions) (void *object, uint32_t index, uint32_t num);
|
||||
/**
|
||||
* Manage the permissions of the global objects for this
|
||||
* client
|
||||
*
|
||||
* Update the permissions of the global objects using the
|
||||
* provided array with permissions
|
||||
*
|
||||
* Globals can use the default permissions or can have specific
|
||||
* permissions assigned to them.
|
||||
*
|
||||
* \param n_permissions number of permissions
|
||||
* \param permissions array of permissions
|
||||
*/
|
||||
int (*update_permissions) (void *object, uint32_t n_permissions,
|
||||
const struct pw_permission *permissions);
|
||||
};
|
||||
|
||||
#define pw_client_proxy_method(o,method,version,...) \
|
||||
({ \
|
||||
int _res = -ENOTSUP; \
|
||||
spa_interface_call_res((struct spa_interface*)o, \
|
||||
struct pw_client_proxy_methods, _res, \
|
||||
method, version, ##__VA_ARGS__); \
|
||||
_res; \
|
||||
})
|
||||
|
||||
#define pw_client_proxy_add_listener(c,...) pw_client_proxy_method(c,add_listener,0,__VA_ARGS__)
|
||||
#define pw_client_proxy_error(c,...) pw_client_proxy_method(c,error,0,__VA_ARGS__)
|
||||
#define pw_client_proxy_update_properties(c,...) pw_client_proxy_method(c,update_properties,0,__VA_ARGS__)
|
||||
#define pw_client_proxy_get_permissions(c,...) pw_client_proxy_method(c,get_permissions,0,__VA_ARGS__)
|
||||
#define pw_client_proxy_update_permissions(c,...) pw_client_proxy_method(c,update_permissions,0,__VA_ARGS__)
|
||||
|
||||
|
||||
#define PW_LINK_PROXY_EVENT_INFO 0
|
||||
#define PW_LINK_PROXY_EVENT_NUM 1
|
||||
|
||||
/** Link events */
|
||||
struct pw_link_proxy_events {
|
||||
#define PW_VERSION_LINK_PROXY_EVENTS 0
|
||||
uint32_t version;
|
||||
/**
|
||||
* Notify link info
|
||||
*
|
||||
* \param info info about the link
|
||||
*/
|
||||
void (*info) (void *object, const struct pw_link_info *info);
|
||||
};
|
||||
|
||||
#define PW_LINK_PROXY_METHOD_ADD_LISTENER 0
|
||||
#define PW_LINK_PROXY_METHOD_NUM 1
|
||||
|
||||
/** Link methods */
|
||||
struct pw_link_proxy_methods {
|
||||
#define PW_VERSION_LINK_PROXY_METHODS 0
|
||||
uint32_t version;
|
||||
|
||||
int (*add_listener) (void *object,
|
||||
struct spa_hook *listener,
|
||||
const struct pw_link_proxy_events *events,
|
||||
void *data);
|
||||
};
|
||||
|
||||
#define pw_link_proxy_method(o,method,version,...) \
|
||||
({ \
|
||||
int _res = -ENOTSUP; \
|
||||
spa_interface_call_res((struct spa_interface*)o, \
|
||||
struct pw_link_proxy_methods, _res, \
|
||||
method, version, ##__VA_ARGS__); \
|
||||
_res; \
|
||||
})
|
||||
|
||||
#define pw_link_proxy_add_listener(c,...) pw_link_proxy_method(c,add_listener,0,__VA_ARGS__)
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* PIPEWIRE_INTERFACES_H */
|
||||
|
|
@ -1,233 +0,0 @@
|
|||
/* PipeWire
|
||||
*
|
||||
* Copyright © 2018 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 PIPEWIRE_INTROSPECT_H
|
||||
#define PIPEWIRE_INTROSPECT_H
|
||||
|
||||
#include <spa/utils/defs.h>
|
||||
#include <spa/param/param.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <pipewire/properties.h>
|
||||
|
||||
/** \enum pw_node_state The different node states \memberof pw_node */
|
||||
enum pw_node_state {
|
||||
PW_NODE_STATE_ERROR = -1, /**< error state */
|
||||
PW_NODE_STATE_CREATING = 0, /**< the node is being created */
|
||||
PW_NODE_STATE_SUSPENDED = 1, /**< the node is suspended, the device might
|
||||
* be closed */
|
||||
PW_NODE_STATE_IDLE = 2, /**< the node is running but there is no active
|
||||
* port */
|
||||
PW_NODE_STATE_RUNNING = 3, /**< the node is running */
|
||||
};
|
||||
|
||||
/** Convert a \ref pw_node_state to a readable string \memberof pw_node */
|
||||
const char * pw_node_state_as_string(enum pw_node_state state);
|
||||
|
||||
/** \enum pw_direction The direction of a port \memberof pw_introspect */
|
||||
enum pw_direction {
|
||||
PW_DIRECTION_INPUT = SPA_DIRECTION_INPUT, /**< an input port direction */
|
||||
PW_DIRECTION_OUTPUT = SPA_DIRECTION_OUTPUT /**< an output port direction */
|
||||
};
|
||||
|
||||
/** Convert a \ref pw_direction to a readable string \memberof pw_introspect */
|
||||
const char * pw_direction_as_string(enum pw_direction direction);
|
||||
|
||||
/** \enum pw_link_state The different link states \memberof pw_link */
|
||||
enum pw_link_state {
|
||||
PW_LINK_STATE_ERROR = -2, /**< the link is in error */
|
||||
PW_LINK_STATE_UNLINKED = -1, /**< the link is unlinked */
|
||||
PW_LINK_STATE_INIT = 0, /**< the link is initialized */
|
||||
PW_LINK_STATE_NEGOTIATING = 1, /**< the link is negotiating formats */
|
||||
PW_LINK_STATE_ALLOCATING = 2, /**< the link is allocating buffers */
|
||||
PW_LINK_STATE_PAUSED = 3, /**< the link is paused */
|
||||
};
|
||||
|
||||
/** Convert a \ref pw_link_state to a readable string \memberof pw_link */
|
||||
const char * pw_link_state_as_string(enum pw_link_state state);
|
||||
|
||||
/** \class pw_introspect
|
||||
*
|
||||
* The introspection methods and structures are used to get information
|
||||
* about the object in the PipeWire server
|
||||
*/
|
||||
|
||||
/** The module information. Extra information can be added in later versions \memberof pw_introspect */
|
||||
struct pw_module_info {
|
||||
uint32_t id; /**< id of the global */
|
||||
const char *name; /**< name of the module */
|
||||
const char *filename; /**< filename of the module */
|
||||
const char *args; /**< arguments passed to the module */
|
||||
#define PW_MODULE_CHANGE_MASK_PROPS (1 << 0)
|
||||
#define PW_MODULE_CHANGE_MASK_ALL ((1 << 1)-1)
|
||||
uint64_t change_mask; /**< bitfield of changed fields since last call */
|
||||
struct spa_dict *props; /**< extra properties */
|
||||
};
|
||||
|
||||
/** Update and existing \ref pw_module_info with \a update \memberof pw_introspect */
|
||||
struct pw_module_info *
|
||||
pw_module_info_update(struct pw_module_info *info,
|
||||
const struct pw_module_info *update);
|
||||
|
||||
/** Free a \ref pw_module_info \memberof pw_introspect */
|
||||
void pw_module_info_free(struct pw_module_info *info);
|
||||
|
||||
|
||||
/** The device information. Extra information can be added in later versions \memberof pw_introspect */
|
||||
struct pw_device_info {
|
||||
uint32_t id; /**< id of the global */
|
||||
#define PW_DEVICE_CHANGE_MASK_PROPS (1 << 0)
|
||||
#define PW_DEVICE_CHANGE_MASK_PARAMS (1 << 1)
|
||||
#define PW_DEVICE_CHANGE_MASK_ALL ((1 << 2)-1)
|
||||
uint64_t change_mask; /**< bitfield of changed fields since last call */
|
||||
struct spa_dict *props; /**< extra properties */
|
||||
struct spa_param_info *params; /**< parameters */
|
||||
uint32_t n_params; /**< number of items in \a params */
|
||||
};
|
||||
|
||||
/** Update and existing \ref pw_device_info with \a update \memberof pw_introspect */
|
||||
struct pw_device_info *
|
||||
pw_device_info_update(struct pw_device_info *info,
|
||||
const struct pw_device_info *update);
|
||||
|
||||
/** Free a \ref pw_device_info \memberof pw_introspect */
|
||||
void pw_device_info_free(struct pw_device_info *info);
|
||||
|
||||
/** The client information. Extra information can be added in later versions \memberof pw_introspect */
|
||||
struct pw_client_info {
|
||||
uint32_t id; /**< id of the global */
|
||||
#define PW_CLIENT_CHANGE_MASK_PROPS (1 << 0)
|
||||
#define PW_CLIENT_CHANGE_MASK_ALL ((1 << 1)-1)
|
||||
uint64_t change_mask; /**< bitfield of changed fields since last call */
|
||||
struct spa_dict *props; /**< extra properties */
|
||||
};
|
||||
|
||||
/** Update and existing \ref pw_client_info with \a update \memberof pw_introspect */
|
||||
struct pw_client_info *
|
||||
pw_client_info_update(struct pw_client_info *info,
|
||||
const struct pw_client_info *update);
|
||||
|
||||
/** Free a \ref pw_client_info \memberof pw_introspect */
|
||||
void pw_client_info_free(struct pw_client_info *info);
|
||||
|
||||
|
||||
/** The node information. Extra information can be added in later versions \memberof pw_introspect */
|
||||
struct pw_node_info {
|
||||
uint32_t id; /**< id of the global */
|
||||
uint32_t max_input_ports; /**< maximum number of inputs */
|
||||
uint32_t max_output_ports; /**< maximum number of outputs */
|
||||
#define PW_NODE_CHANGE_MASK_INPUT_PORTS (1 << 0)
|
||||
#define PW_NODE_CHANGE_MASK_OUTPUT_PORTS (1 << 1)
|
||||
#define PW_NODE_CHANGE_MASK_STATE (1 << 2)
|
||||
#define PW_NODE_CHANGE_MASK_PROPS (1 << 3)
|
||||
#define PW_NODE_CHANGE_MASK_PARAMS (1 << 4)
|
||||
#define PW_NODE_CHANGE_MASK_ALL ((1 << 5)-1)
|
||||
uint64_t change_mask; /**< bitfield of changed fields since last call */
|
||||
uint32_t n_input_ports; /**< number of inputs */
|
||||
uint32_t n_output_ports; /**< number of outputs */
|
||||
enum pw_node_state state; /**< the current state of the node */
|
||||
const char *error; /**< an error reason if \a state is error */
|
||||
struct spa_dict *props; /**< the properties of the node */
|
||||
struct spa_param_info *params; /**< parameters */
|
||||
uint32_t n_params; /**< number of items in \a params */
|
||||
};
|
||||
|
||||
struct pw_node_info *
|
||||
pw_node_info_update(struct pw_node_info *info,
|
||||
const struct pw_node_info *update);
|
||||
|
||||
void
|
||||
pw_node_info_free(struct pw_node_info *info);
|
||||
|
||||
struct pw_port_info {
|
||||
uint32_t id; /**< id of the global */
|
||||
enum pw_direction direction; /**< port direction */
|
||||
#define PW_PORT_CHANGE_MASK_PROPS (1 << 0)
|
||||
#define PW_PORT_CHANGE_MASK_PARAMS (1 << 1)
|
||||
#define PW_PORT_CHANGE_MASK_ALL ((1 << 2)-1)
|
||||
uint64_t change_mask; /**< bitfield of changed fields since last call */
|
||||
struct spa_dict *props; /**< the properties of the port */
|
||||
struct spa_param_info *params; /**< parameters */
|
||||
uint32_t n_params; /**< number of items in \a params */
|
||||
};
|
||||
|
||||
struct pw_port_info *
|
||||
pw_port_info_update(struct pw_port_info *info,
|
||||
const struct pw_port_info *update);
|
||||
|
||||
void
|
||||
pw_port_info_free(struct pw_port_info *info);
|
||||
|
||||
/** The factory information. Extra information can be added in later versions \memberof pw_introspect */
|
||||
struct pw_factory_info {
|
||||
uint32_t id; /**< id of the global */
|
||||
const char *name; /**< name the factory */
|
||||
uint32_t type; /**< type of the objects created by this factory */
|
||||
uint32_t version; /**< version of the objects */
|
||||
#define PW_FACTORY_CHANGE_MASK_PROPS (1 << 0)
|
||||
#define PW_FACTORY_CHANGE_MASK_ALL ((1 << 1)-1)
|
||||
uint64_t change_mask; /**< bitfield of changed fields since last call */
|
||||
struct spa_dict *props; /**< the properties of the factory */
|
||||
};
|
||||
|
||||
struct pw_factory_info *
|
||||
pw_factory_info_update(struct pw_factory_info *info,
|
||||
const struct pw_factory_info *update);
|
||||
|
||||
void
|
||||
pw_factory_info_free(struct pw_factory_info *info);
|
||||
|
||||
/** The link information. Extra information can be added in later versions \memberof pw_introspect */
|
||||
struct pw_link_info {
|
||||
uint32_t id; /**< id of the global */
|
||||
uint32_t output_node_id; /**< server side output node id */
|
||||
uint32_t output_port_id; /**< output port id */
|
||||
uint32_t input_node_id; /**< server side input node id */
|
||||
uint32_t input_port_id; /**< input port id */
|
||||
#define PW_LINK_CHANGE_MASK_STATE (1 << 0)
|
||||
#define PW_LINK_CHANGE_MASK_FORMAT (1 << 1)
|
||||
#define PW_LINK_CHANGE_MASK_PROPS (1 << 2)
|
||||
#define PW_LINK_CHANGE_MASK_ALL ((1 << 3)-1)
|
||||
uint64_t change_mask; /**< bitfield of changed fields since last call */
|
||||
enum pw_link_state state; /**< the current state of the link */
|
||||
const char *error; /**< an error reason if \a state is error */
|
||||
struct spa_pod *format; /**< format over link */
|
||||
struct spa_dict *props; /**< the properties of the link */
|
||||
};
|
||||
|
||||
struct pw_link_info *
|
||||
pw_link_info_update(struct pw_link_info *info,
|
||||
const struct pw_link_info *update);
|
||||
|
||||
void
|
||||
pw_link_info_free(struct pw_link_info *info);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* PIPEWIRE_INTROSPECT_H */
|
||||
122
src/pipewire/link.h
Normal file
122
src/pipewire/link.h
Normal file
|
|
@ -0,0 +1,122 @@
|
|||
/* PipeWire
|
||||
*
|
||||
* Copyright © 2018 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 PIPEWIRE_LINK_H
|
||||
#define PIPEWIRE_LINK_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <spa/utils/defs.h>
|
||||
#include <spa/utils/hook.h>
|
||||
|
||||
#include <pipewire/proxy.h>
|
||||
|
||||
#define PW_VERSION_LINK_PROXY 3
|
||||
struct pw_link_proxy;
|
||||
|
||||
/** \enum pw_link_state The different link states \memberof pw_link */
|
||||
enum pw_link_state {
|
||||
PW_LINK_STATE_ERROR = -2, /**< the link is in error */
|
||||
PW_LINK_STATE_UNLINKED = -1, /**< the link is unlinked */
|
||||
PW_LINK_STATE_INIT = 0, /**< the link is initialized */
|
||||
PW_LINK_STATE_NEGOTIATING = 1, /**< the link is negotiating formats */
|
||||
PW_LINK_STATE_ALLOCATING = 2, /**< the link is allocating buffers */
|
||||
PW_LINK_STATE_PAUSED = 3, /**< the link is paused */
|
||||
};
|
||||
|
||||
/** Convert a \ref pw_link_state to a readable string \memberof pw_link */
|
||||
const char * pw_link_state_as_string(enum pw_link_state state);
|
||||
/** The link information. Extra information can be added in later versions \memberof pw_introspect */
|
||||
struct pw_link_info {
|
||||
uint32_t id; /**< id of the global */
|
||||
uint32_t output_node_id; /**< server side output node id */
|
||||
uint32_t output_port_id; /**< output port id */
|
||||
uint32_t input_node_id; /**< server side input node id */
|
||||
uint32_t input_port_id; /**< input port id */
|
||||
#define PW_LINK_CHANGE_MASK_STATE (1 << 0)
|
||||
#define PW_LINK_CHANGE_MASK_FORMAT (1 << 1)
|
||||
#define PW_LINK_CHANGE_MASK_PROPS (1 << 2)
|
||||
#define PW_LINK_CHANGE_MASK_ALL ((1 << 3)-1)
|
||||
uint64_t change_mask; /**< bitfield of changed fields since last call */
|
||||
enum pw_link_state state; /**< the current state of the link */
|
||||
const char *error; /**< an error reason if \a state is error */
|
||||
struct spa_pod *format; /**< format over link */
|
||||
struct spa_dict *props; /**< the properties of the link */
|
||||
};
|
||||
|
||||
struct pw_link_info *
|
||||
pw_link_info_update(struct pw_link_info *info,
|
||||
const struct pw_link_info *update);
|
||||
|
||||
void
|
||||
pw_link_info_free(struct pw_link_info *info);
|
||||
|
||||
|
||||
#define PW_LINK_PROXY_EVENT_INFO 0
|
||||
#define PW_LINK_PROXY_EVENT_NUM 1
|
||||
|
||||
/** Link events */
|
||||
struct pw_link_proxy_events {
|
||||
#define PW_VERSION_LINK_PROXY_EVENTS 0
|
||||
uint32_t version;
|
||||
/**
|
||||
* Notify link info
|
||||
*
|
||||
* \param info info about the link
|
||||
*/
|
||||
void (*info) (void *object, const struct pw_link_info *info);
|
||||
};
|
||||
|
||||
#define PW_LINK_PROXY_METHOD_ADD_LISTENER 0
|
||||
#define PW_LINK_PROXY_METHOD_NUM 1
|
||||
|
||||
/** Link methods */
|
||||
struct pw_link_proxy_methods {
|
||||
#define PW_VERSION_LINK_PROXY_METHODS 0
|
||||
uint32_t version;
|
||||
|
||||
int (*add_listener) (void *object,
|
||||
struct spa_hook *listener,
|
||||
const struct pw_link_proxy_events *events,
|
||||
void *data);
|
||||
};
|
||||
|
||||
#define pw_link_proxy_method(o,method,version,...) \
|
||||
({ \
|
||||
int _res = -ENOTSUP; \
|
||||
spa_interface_call_res((struct spa_interface*)o, \
|
||||
struct pw_link_proxy_methods, _res, \
|
||||
method, version, ##__VA_ARGS__); \
|
||||
_res; \
|
||||
})
|
||||
|
||||
#define pw_link_proxy_add_listener(c,...) pw_link_proxy_method(c,add_listener,0,__VA_ARGS__)
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* PIPEWIRE_LINK_H */
|
||||
|
|
@ -2,31 +2,36 @@ pipewire_headers = [
|
|||
'array.h',
|
||||
'buffers.h',
|
||||
'impl-client.h',
|
||||
'control.h',
|
||||
'client.h',
|
||||
'context.h',
|
||||
'data-loop.h',
|
||||
'control.h',
|
||||
'core.h',
|
||||
'device.h',
|
||||
'impl-device.h',
|
||||
'data-loop.h',
|
||||
'factory.h',
|
||||
'impl-factory.h',
|
||||
'filter.h',
|
||||
'global.h',
|
||||
'interfaces.h',
|
||||
'introspect.h',
|
||||
'keys.h',
|
||||
'impl-link.h',
|
||||
'link.h',
|
||||
'log.h',
|
||||
'loop.h',
|
||||
'main-loop.h',
|
||||
'map.h',
|
||||
'mem.h',
|
||||
'impl-module.h',
|
||||
'module.h',
|
||||
'impl-node.h',
|
||||
'impl-factory.h',
|
||||
'node.h',
|
||||
'permission.h',
|
||||
'pipewire.h',
|
||||
'impl-port.h',
|
||||
'port.h',
|
||||
'properties.h',
|
||||
'protocol.h',
|
||||
'proxy.h',
|
||||
'core.h',
|
||||
'resource.h',
|
||||
'stream.h',
|
||||
'thread-loop.h',
|
||||
|
|
@ -38,8 +43,9 @@ pipewire_headers = [
|
|||
pipewire_sources = [
|
||||
'buffers.c',
|
||||
'impl-client.c',
|
||||
'control.c',
|
||||
'context.c',
|
||||
'control.c',
|
||||
'core.c',
|
||||
'data-loop.c',
|
||||
'impl-device.c',
|
||||
'filter.c',
|
||||
|
|
@ -58,7 +64,6 @@ pipewire_sources = [
|
|||
'properties.c',
|
||||
'protocol.c',
|
||||
'proxy.c',
|
||||
'core.c',
|
||||
'resource.c',
|
||||
'stream.c',
|
||||
'thread-loop.c',
|
||||
|
|
|
|||
104
src/pipewire/module.h
Normal file
104
src/pipewire/module.h
Normal file
|
|
@ -0,0 +1,104 @@
|
|||
/* PipeWire
|
||||
*
|
||||
* Copyright © 2018 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 PIPEWIRE_MODULE_H
|
||||
#define PIPEWIRE_MODULE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <spa/utils/defs.h>
|
||||
#include <spa/utils/hook.h>
|
||||
|
||||
#include <pipewire/proxy.h>
|
||||
|
||||
#define PW_VERSION_MODULE_PROXY 3
|
||||
struct pw_module_proxy;
|
||||
|
||||
/** The module information. Extra information can be added in later versions \memberof pw_introspect */
|
||||
struct pw_module_info {
|
||||
uint32_t id; /**< id of the global */
|
||||
const char *name; /**< name of the module */
|
||||
const char *filename; /**< filename of the module */
|
||||
const char *args; /**< arguments passed to the module */
|
||||
#define PW_MODULE_CHANGE_MASK_PROPS (1 << 0)
|
||||
#define PW_MODULE_CHANGE_MASK_ALL ((1 << 1)-1)
|
||||
uint64_t change_mask; /**< bitfield of changed fields since last call */
|
||||
struct spa_dict *props; /**< extra properties */
|
||||
};
|
||||
|
||||
/** Update and existing \ref pw_module_info with \a update \memberof pw_introspect */
|
||||
struct pw_module_info *
|
||||
pw_module_info_update(struct pw_module_info *info,
|
||||
const struct pw_module_info *update);
|
||||
|
||||
/** Free a \ref pw_module_info \memberof pw_introspect */
|
||||
void pw_module_info_free(struct pw_module_info *info);
|
||||
|
||||
#define PW_MODULE_PROXY_EVENT_INFO 0
|
||||
#define PW_MODULE_PROXY_EVENT_NUM 1
|
||||
|
||||
/** Module events */
|
||||
struct pw_module_proxy_events {
|
||||
#define PW_VERSION_MODULE_PROXY_EVENTS 0
|
||||
uint32_t version;
|
||||
/**
|
||||
* Notify module info
|
||||
*
|
||||
* \param info info about the module
|
||||
*/
|
||||
void (*info) (void *object, const struct pw_module_info *info);
|
||||
};
|
||||
|
||||
#define PW_MODULE_PROXY_METHOD_ADD_LISTENER 0
|
||||
#define PW_MODULE_PROXY_METHOD_NUM 1
|
||||
|
||||
/** Module methods */
|
||||
struct pw_module_proxy_methods {
|
||||
#define PW_VERSION_MODULE_PROXY_METHODS 0
|
||||
uint32_t version;
|
||||
|
||||
int (*add_listener) (void *object,
|
||||
struct spa_hook *listener,
|
||||
const struct pw_module_proxy_events *events,
|
||||
void *data);
|
||||
};
|
||||
|
||||
#define pw_module_proxy_method(o,method,version,...) \
|
||||
({ \
|
||||
int _res = -ENOTSUP; \
|
||||
spa_interface_call_res((struct spa_interface*)o, \
|
||||
struct pw_module_proxy_methods, _res, \
|
||||
method, version, ##__VA_ARGS__); \
|
||||
_res; \
|
||||
})
|
||||
|
||||
#define pw_module_proxy_add_listener(c,...) pw_module_proxy_method(c,add_listener,0,__VA_ARGS__)
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* PIPEWIRE_MODULE_H */
|
||||
198
src/pipewire/node.h
Normal file
198
src/pipewire/node.h
Normal file
|
|
@ -0,0 +1,198 @@
|
|||
/* PipeWire
|
||||
*
|
||||
* Copyright © 2018 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 PIPEWIRE_NODE_H
|
||||
#define PIPEWIRE_NODE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <spa/utils/defs.h>
|
||||
#include <spa/utils/hook.h>
|
||||
#include <spa/node/command.h>
|
||||
#include <spa/param/param.h>
|
||||
|
||||
#include <pipewire/proxy.h>
|
||||
|
||||
#define PW_VERSION_NODE_PROXY 3
|
||||
struct pw_node_proxy;
|
||||
|
||||
/** \enum pw_node_state The different node states \memberof pw_node */
|
||||
enum pw_node_state {
|
||||
PW_NODE_STATE_ERROR = -1, /**< error state */
|
||||
PW_NODE_STATE_CREATING = 0, /**< the node is being created */
|
||||
PW_NODE_STATE_SUSPENDED = 1, /**< the node is suspended, the device might
|
||||
* be closed */
|
||||
PW_NODE_STATE_IDLE = 2, /**< the node is running but there is no active
|
||||
* port */
|
||||
PW_NODE_STATE_RUNNING = 3, /**< the node is running */
|
||||
};
|
||||
|
||||
/** Convert a \ref pw_node_state to a readable string \memberof pw_node */
|
||||
const char * pw_node_state_as_string(enum pw_node_state state);
|
||||
|
||||
/** The node information. Extra information can be added in later versions \memberof pw_introspect */
|
||||
struct pw_node_info {
|
||||
uint32_t id; /**< id of the global */
|
||||
uint32_t max_input_ports; /**< maximum number of inputs */
|
||||
uint32_t max_output_ports; /**< maximum number of outputs */
|
||||
#define PW_NODE_CHANGE_MASK_INPUT_PORTS (1 << 0)
|
||||
#define PW_NODE_CHANGE_MASK_OUTPUT_PORTS (1 << 1)
|
||||
#define PW_NODE_CHANGE_MASK_STATE (1 << 2)
|
||||
#define PW_NODE_CHANGE_MASK_PROPS (1 << 3)
|
||||
#define PW_NODE_CHANGE_MASK_PARAMS (1 << 4)
|
||||
#define PW_NODE_CHANGE_MASK_ALL ((1 << 5)-1)
|
||||
uint64_t change_mask; /**< bitfield of changed fields since last call */
|
||||
uint32_t n_input_ports; /**< number of inputs */
|
||||
uint32_t n_output_ports; /**< number of outputs */
|
||||
enum pw_node_state state; /**< the current state of the node */
|
||||
const char *error; /**< an error reason if \a state is error */
|
||||
struct spa_dict *props; /**< the properties of the node */
|
||||
struct spa_param_info *params; /**< parameters */
|
||||
uint32_t n_params; /**< number of items in \a params */
|
||||
};
|
||||
|
||||
struct pw_node_info *
|
||||
pw_node_info_update(struct pw_node_info *info,
|
||||
const struct pw_node_info *update);
|
||||
|
||||
void
|
||||
pw_node_info_free(struct pw_node_info *info);
|
||||
|
||||
#define PW_NODE_PROXY_EVENT_INFO 0
|
||||
#define PW_NODE_PROXY_EVENT_PARAM 1
|
||||
#define PW_NODE_PROXY_EVENT_NUM 2
|
||||
|
||||
/** Node events */
|
||||
struct pw_node_proxy_events {
|
||||
#define PW_VERSION_NODE_PROXY_EVENTS 0
|
||||
uint32_t version;
|
||||
/**
|
||||
* Notify node info
|
||||
*
|
||||
* \param info info about the node
|
||||
*/
|
||||
void (*info) (void *object, const struct pw_node_info *info);
|
||||
/**
|
||||
* Notify a node param
|
||||
*
|
||||
* Event emited as a result of the enum_params method.
|
||||
*
|
||||
* \param seq the sequence number of the request
|
||||
* \param id the param id
|
||||
* \param index the param index
|
||||
* \param next the param index of the next param
|
||||
* \param param the parameter
|
||||
*/
|
||||
void (*param) (void *object, int seq,
|
||||
uint32_t id, uint32_t index, uint32_t next,
|
||||
const struct spa_pod *param);
|
||||
};
|
||||
|
||||
#define PW_NODE_PROXY_METHOD_ADD_LISTENER 0
|
||||
#define PW_NODE_PROXY_METHOD_SUBSCRIBE_PARAMS 1
|
||||
#define PW_NODE_PROXY_METHOD_ENUM_PARAMS 2
|
||||
#define PW_NODE_PROXY_METHOD_SET_PARAM 3
|
||||
#define PW_NODE_PROXY_METHOD_SEND_COMMAND 4
|
||||
#define PW_NODE_PROXY_METHOD_NUM 5
|
||||
|
||||
/** Node methods */
|
||||
struct pw_node_proxy_methods {
|
||||
#define PW_VERSION_NODE_PROXY_METHODS 0
|
||||
uint32_t version;
|
||||
|
||||
int (*add_listener) (void *object,
|
||||
struct spa_hook *listener,
|
||||
const struct pw_node_proxy_events *events,
|
||||
void *data);
|
||||
/**
|
||||
* Subscribe to parameter changes
|
||||
*
|
||||
* Automatically emit param events for the given ids when
|
||||
* they are changed.
|
||||
*
|
||||
* \param ids an array of param ids
|
||||
* \param n_ids the number of ids in \a ids
|
||||
*/
|
||||
int (*subscribe_params) (void *object, uint32_t *ids, uint32_t n_ids);
|
||||
|
||||
/**
|
||||
* Enumerate node parameters
|
||||
*
|
||||
* Start enumeration of node parameters. For each param, a
|
||||
* param event will be emited.
|
||||
*
|
||||
* \param seq a sequence number to place in the reply
|
||||
* \param id the parameter id to enum or SPA_ID_INVALID for all
|
||||
* \param start the start index or 0 for the first param
|
||||
* \param num the maximum number of params to retrieve
|
||||
* \param filter a param filter or NULL
|
||||
*/
|
||||
int (*enum_params) (void *object, int seq, uint32_t id,
|
||||
uint32_t start, uint32_t num,
|
||||
const struct spa_pod *filter);
|
||||
|
||||
/**
|
||||
* Set a parameter on the node
|
||||
*
|
||||
* \param id the parameter id to set
|
||||
* \param flags extra parameter flags
|
||||
* \param param the parameter to set
|
||||
*/
|
||||
int (*set_param) (void *object, uint32_t id, uint32_t flags,
|
||||
const struct spa_pod *param);
|
||||
|
||||
/**
|
||||
* Send a command to the node
|
||||
*
|
||||
* \param command the command to send
|
||||
*/
|
||||
int (*send_command) (void *object, const struct spa_command *command);
|
||||
};
|
||||
|
||||
#define pw_node_proxy_method(o,method,version,...) \
|
||||
({ \
|
||||
int _res = -ENOTSUP; \
|
||||
spa_interface_call_res((struct spa_interface*)o, \
|
||||
struct pw_node_proxy_methods, _res, \
|
||||
method, version, ##__VA_ARGS__); \
|
||||
_res; \
|
||||
})
|
||||
|
||||
/** Node */
|
||||
#define pw_node_proxy_add_listener(c,...) pw_node_proxy_method(c,add_listener,0,__VA_ARGS__)
|
||||
#define pw_node_proxy_subscribe_params(c,...) pw_node_proxy_method(c,subscribe_params,0,__VA_ARGS__)
|
||||
#define pw_node_proxy_enum_params(c,...) pw_node_proxy_method(c,enum_params,0,__VA_ARGS__)
|
||||
#define pw_node_proxy_set_param(c,...) pw_node_proxy_method(c,set_param,0,__VA_ARGS__)
|
||||
#define pw_node_proxy_send_command(c,...) pw_node_proxy_method(c,send_command,0,__VA_ARGS__)
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* PIPEWIRE_NODE_H */
|
||||
|
|
@ -32,21 +32,26 @@ extern "C" {
|
|||
#include <spa/support/plugin.h>
|
||||
|
||||
#include <pipewire/array.h>
|
||||
#include <pipewire/client.h>
|
||||
#include <pipewire/context.h>
|
||||
#include <pipewire/device.h>
|
||||
#include <pipewire/buffers.h>
|
||||
#include <pipewire/core.h>
|
||||
#include <pipewire/interfaces.h>
|
||||
#include <pipewire/introspect.h>
|
||||
#include <pipewire/factory.h>
|
||||
#include <pipewire/keys.h>
|
||||
#include <pipewire/log.h>
|
||||
#include <pipewire/loop.h>
|
||||
#include <pipewire/link.h>
|
||||
#include <pipewire/main-loop.h>
|
||||
#include <pipewire/map.h>
|
||||
#include <pipewire/mem.h>
|
||||
#include <pipewire/module.h>
|
||||
#include <pipewire/node.h>
|
||||
#include <pipewire/properties.h>
|
||||
#include <pipewire/proxy.h>
|
||||
#include <pipewire/permission.h>
|
||||
#include <pipewire/protocol.h>
|
||||
#include <pipewire/port.h>
|
||||
#include <pipewire/stream.h>
|
||||
#include <pipewire/filter.h>
|
||||
#include <pipewire/thread-loop.h>
|
||||
|
|
|
|||
168
src/pipewire/port.h
Normal file
168
src/pipewire/port.h
Normal file
|
|
@ -0,0 +1,168 @@
|
|||
/* PipeWire
|
||||
*
|
||||
* Copyright © 2018 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 PIPEWIRE_PORT_H
|
||||
#define PIPEWIRE_PORT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <spa/utils/defs.h>
|
||||
#include <spa/utils/hook.h>
|
||||
#include <spa/param/param.h>
|
||||
|
||||
#include <pipewire/proxy.h>
|
||||
|
||||
#define PW_VERSION_PORT_PROXY 3
|
||||
struct pw_port_proxy;
|
||||
|
||||
/** \enum pw_direction The direction of a port \memberof pw_introspect */
|
||||
enum pw_direction {
|
||||
PW_DIRECTION_INPUT = SPA_DIRECTION_INPUT, /**< an input port direction */
|
||||
PW_DIRECTION_OUTPUT = SPA_DIRECTION_OUTPUT /**< an output port direction */
|
||||
};
|
||||
|
||||
/** Convert a \ref pw_direction to a readable string \memberof pw_introspect */
|
||||
const char * pw_direction_as_string(enum pw_direction direction);
|
||||
|
||||
|
||||
/** \class pw_introspect
|
||||
*
|
||||
* The introspection methods and structures are used to get information
|
||||
* about the object in the PipeWire server
|
||||
*/
|
||||
|
||||
struct pw_port_info {
|
||||
uint32_t id; /**< id of the global */
|
||||
enum pw_direction direction; /**< port direction */
|
||||
#define PW_PORT_CHANGE_MASK_PROPS (1 << 0)
|
||||
#define PW_PORT_CHANGE_MASK_PARAMS (1 << 1)
|
||||
#define PW_PORT_CHANGE_MASK_ALL ((1 << 2)-1)
|
||||
uint64_t change_mask; /**< bitfield of changed fields since last call */
|
||||
struct spa_dict *props; /**< the properties of the port */
|
||||
struct spa_param_info *params; /**< parameters */
|
||||
uint32_t n_params; /**< number of items in \a params */
|
||||
};
|
||||
|
||||
struct pw_port_info *
|
||||
pw_port_info_update(struct pw_port_info *info,
|
||||
const struct pw_port_info *update);
|
||||
|
||||
void
|
||||
pw_port_info_free(struct pw_port_info *info);
|
||||
|
||||
#define PW_PORT_PROXY_EVENT_INFO 0
|
||||
#define PW_PORT_PROXY_EVENT_PARAM 1
|
||||
#define PW_PORT_PROXY_EVENT_NUM 2
|
||||
|
||||
/** Port events */
|
||||
struct pw_port_proxy_events {
|
||||
#define PW_VERSION_PORT_PROXY_EVENTS 0
|
||||
uint32_t version;
|
||||
/**
|
||||
* Notify port info
|
||||
*
|
||||
* \param info info about the port
|
||||
*/
|
||||
void (*info) (void *object, const struct pw_port_info *info);
|
||||
/**
|
||||
* Notify a port param
|
||||
*
|
||||
* Event emited as a result of the enum_params method.
|
||||
*
|
||||
* \param seq the sequence number of the request
|
||||
* \param id the param id
|
||||
* \param index the param index
|
||||
* \param next the param index of the next param
|
||||
* \param param the parameter
|
||||
*/
|
||||
void (*param) (void *object, int seq,
|
||||
uint32_t id, uint32_t index, uint32_t next,
|
||||
const struct spa_pod *param);
|
||||
};
|
||||
|
||||
#define PW_PORT_PROXY_METHOD_ADD_LISTENER 0
|
||||
#define PW_PORT_PROXY_METHOD_SUBSCRIBE_PARAMS 1
|
||||
#define PW_PORT_PROXY_METHOD_ENUM_PARAMS 2
|
||||
#define PW_PORT_PROXY_METHOD_NUM 3
|
||||
|
||||
/** Port methods */
|
||||
struct pw_port_proxy_methods {
|
||||
#define PW_VERSION_PORT_PROXY_METHODS 0
|
||||
uint32_t version;
|
||||
|
||||
int (*add_listener) (void *object,
|
||||
struct spa_hook *listener,
|
||||
const struct pw_port_proxy_events *events,
|
||||
void *data);
|
||||
/**
|
||||
* Subscribe to parameter changes
|
||||
*
|
||||
* Automatically emit param events for the given ids when
|
||||
* they are changed.
|
||||
*
|
||||
* \param ids an array of param ids
|
||||
* \param n_ids the number of ids in \a ids
|
||||
*/
|
||||
int (*subscribe_params) (void *object, uint32_t *ids, uint32_t n_ids);
|
||||
|
||||
/**
|
||||
* Enumerate port parameters
|
||||
*
|
||||
* Start enumeration of port parameters. For each param, a
|
||||
* param event will be emited.
|
||||
*
|
||||
* \param seq a sequence number returned in the reply
|
||||
* \param id the parameter id to enumerate
|
||||
* \param start the start index or 0 for the first param
|
||||
* \param num the maximum number of params to retrieve
|
||||
* \param filter a param filter or NULL
|
||||
*/
|
||||
int (*enum_params) (void *object, int seq,
|
||||
uint32_t id, uint32_t start, uint32_t num,
|
||||
const struct spa_pod *filter);
|
||||
};
|
||||
|
||||
#define pw_port_proxy_method(o,method,version,...) \
|
||||
({ \
|
||||
int _res = -ENOTSUP; \
|
||||
spa_interface_call_res((struct spa_interface*)o, \
|
||||
struct pw_port_proxy_methods, _res, \
|
||||
method, version, ##__VA_ARGS__); \
|
||||
_res; \
|
||||
})
|
||||
|
||||
#define pw_port_proxy_add_listener(c,...) pw_port_proxy_method(c,add_listener,0,__VA_ARGS__)
|
||||
#define pw_port_proxy_subscribe_params(c,...) pw_port_proxy_method(c,subscribe_params,0,__VA_ARGS__)
|
||||
#define pw_port_proxy_enum_params(c,...) pw_port_proxy_method(c,enum_params,0,__VA_ARGS__)
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* PIPEWIRE_PORT_H */
|
||||
|
|
@ -27,7 +27,6 @@
|
|||
#include <pipewire/core.h>
|
||||
#include <pipewire/private.h>
|
||||
#include <pipewire/type.h>
|
||||
#include <pipewire/interfaces.h>
|
||||
|
||||
#include <spa/debug/types.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@
|
|||
|
||||
#include <string.h>
|
||||
|
||||
#include "pipewire/interfaces.h"
|
||||
#include "pipewire/private.h"
|
||||
#include "pipewire/protocol.h"
|
||||
#include "pipewire/resource.h"
|
||||
|
|
|
|||
|
|
@ -196,7 +196,7 @@ struct pw_time {
|
|||
* currently queued */
|
||||
};
|
||||
|
||||
#include <pipewire/core.h>
|
||||
#include <pipewire/pipewire.h>
|
||||
|
||||
/** Events for a stream. These events are always called from the mainloop
|
||||
* unless explicitly documented otherwise. */
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@
|
|||
*/
|
||||
|
||||
#include <pipewire/pipewire.h>
|
||||
#include <pipewire/interfaces.h>
|
||||
|
||||
#define TEST_FUNC(a,b,func) \
|
||||
do { \
|
||||
|
|
|
|||
|
|
@ -31,9 +31,6 @@
|
|||
#include <spa/debug/format.h>
|
||||
#include <spa/debug/types.h>
|
||||
|
||||
#include <pipewire/interfaces.h>
|
||||
#include <pipewire/type.h>
|
||||
#include <pipewire/main-loop.h>
|
||||
#include <pipewire/pipewire.h>
|
||||
|
||||
#define GLOBAL_ID_NONE UINT32_MAX
|
||||
|
|
|
|||
|
|
@ -30,9 +30,6 @@
|
|||
#include <spa/debug/format.h>
|
||||
#include <spa/debug/types.h>
|
||||
|
||||
#include <pipewire/interfaces.h>
|
||||
#include <pipewire/type.h>
|
||||
#include <pipewire/main-loop.h>
|
||||
#include <pipewire/pipewire.h>
|
||||
|
||||
struct proxy_data;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue