update docs

This commit is contained in:
Wim Taymans 2017-09-05 13:35:25 +02:00
parent 7ef1a1d107
commit 36ac8a6545
24 changed files with 308 additions and 167 deletions

View file

@ -780,7 +780,7 @@ WARN_LOGFILE =
# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
# Note: If this tag is empty the current directory is searched.
INPUT = "@top_srcdir@/src/pipewire"
INPUT = @inputs@
# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses

View file

@ -10,6 +10,16 @@ else
doxyfile_conf.set('HAVE_DOT', 'NO')
endif
inputs = ''
foreach h : pipewire_headers
inputs += ' ' + join_paths(meson.source_root(), 'src', 'pipewire', h)
endforeach
foreach h : pipewire_sources
inputs += ' ' + join_paths(meson.source_root(), 'src', 'pipewire', h)
endforeach
doxyfile_conf.set('inputs', inputs)
doxyfile = configure_file(input: 'Doxyfile.in',
output: 'Doxyfile',
configuration: doxyfile_conf,

View file

@ -1,9 +1,9 @@
pipewire_sources = [
pipewire_daemon_sources = [
'main.c',
'daemon-config.c',
]
pipewire_headers = [
pipewire_daemon_headers = [
'daemon-config.h',
]
@ -23,7 +23,7 @@ configure_file(input : 'pipewire.conf.in',
executable('pipewire',
pipewire_sources,
pipewire_daemon_sources,
install: true,
c_args : pipewire_c_args,
include_directories : [configinc, spa_inc],

View file

@ -31,10 +31,9 @@ extern "C" {
*
* \brief the core PipeWire object
*
* The server core object manages all resources available on the
* server.
* The core object manages all available resources.
*
* See \ref page_server_api
* See \ref page_core_api
*/
struct pw_core;
@ -47,14 +46,12 @@ struct pw_core;
#include <pipewire/properties.h>
#include <pipewire/type.h>
/** \page page_server_api Server API
/** \page page_core_api Core API
*
* \section page_server_overview Overview
* \section page_core_overview Overview
*
* \subpage page_core
*
* \subpage page_registry
*
* \subpage page_global
*
* \subpage page_client
@ -73,32 +70,7 @@ struct pw_core;
* \section page_core_overview Overview
*
* The core object is a singleton object that manages the state and
* resources of the PipeWire server.
*/
/** \page page_registry Registry
*
* \section page_registry_overview Overview
*
* The registry object is a singleton object that keeps track of
* global objects on the PipeWire server. See also \ref page_global.
*
* Global objects typically represent an actual object in the
* server (for example, a module or node) or they are singleton
* objects such as the core.
*
* When a client creates a registry object, the registry object
* will emit a global event for each global currently in the
* registry. Globals come and go as a result of device hotplugs or
* reconfiguration or other events, and the registry will send out
* global and global_remove events to keep the client up to date
* with the changes. To mark the end of the initial burst of
* events, the client can use the pw_core.sync methosd immediately
* after calling pw_core.get_registry.
*
* A client can bind to a global object by using the bind
* request. This creates a client-side proxy that lets the object
* emit events to the client and lets the client invoke methods on
* the object.
* resources of a PipeWire instance.
*/
#define PW_PERM_R 0400 /**< object can be seen and events can be received */
@ -106,6 +78,9 @@ struct pw_core;
#define PW_PERM_X 0100 /**< methods can be called on the object. The W flag must be
* present in order to call methods that modify the object. */
#define PW_PERM_RWX (PW_PERM_R|PW_PERM_W|PW_PERM_X)
/** the permission function. It returns the allowed access permissions for \a global
* for \a client */
typedef uint32_t (*pw_permission_func_t) (struct pw_global *global,
struct pw_client *client, void *data);
@ -113,56 +88,71 @@ typedef uint32_t (*pw_permission_func_t) (struct pw_global *global,
#define PW_PERM_IS_W(p) (((p)&PW_PERM_W) == PW_PERM_W)
#define PW_PERM_IS_X(p) (((p)&PW_PERM_X) == PW_PERM_X)
/** core events emited by the core object added with \ref pw_core_add_listener */
struct pw_core_events {
#define PW_VERSION_CORE_EVENTS 0
uint32_t version;
/** The core is being destroyed */
void (*destroy) (void *data);
/** The core is being freed */
void (*free) (void *data);
/** The core info changed, use \ref pw_core_get_info() to get the updated info */
void (*info_changed) (void *data, struct pw_core_info *info);
/** a new global object was added */
void (*global_added) (void *data, struct pw_global *global);
/** a global object was removed */
void (*global_removed) (void *data, struct pw_global *global);
};
struct pw_core *
pw_core_new(struct pw_loop *main_loop, struct pw_properties *props);
/** Make a new core object for a given main_loop. Ownership of the properties is taken */
struct pw_core * pw_core_new(struct pw_loop *main_loop, struct pw_properties *props);
/** destroy a core object, all resources except the main_loop will be destroyed */
void pw_core_destroy(struct pw_core *core);
/** Add a new event listener to a core */
void pw_core_add_listener(struct pw_core *core,
struct spa_hook *listener,
const struct pw_core_events *events,
void *data);
/** Set a callback that will be called to check the permissions of a global
* object for a client */
void pw_core_set_permission_callback(struct pw_core *core,
pw_permission_func_t callback,
void *data);
/** Get the type object of a core */
struct pw_type *pw_core_get_type(struct pw_core *core);
/** Get the core info object */
const struct pw_core_info *pw_core_get_info(struct pw_core *core);
/** Get the core global object */
struct pw_global *pw_core_get_global(struct pw_core *core);
/** Get the core properties */
const struct pw_properties *pw_core_get_properties(struct pw_core *core);
/** Update the core properties */
void pw_core_update_properties(struct pw_core *core, const struct spa_dict *dict);
/** Get the core support objects */
const struct spa_support *pw_core_get_support(struct pw_core *core, uint32_t *n_support);
/** get the core main loop */
struct pw_loop *pw_core_get_main_loop(struct pw_core *core);
void pw_core_update_properties(struct pw_core *core, const struct spa_dict *dict);
/** iterate the globals */
bool pw_core_for_each_global(struct pw_core *core,
bool (*callback) (void *data, struct pw_global *global),
void *data);
/** Find a core global by id */
struct pw_global *pw_core_find_global(struct pw_core *core, uint32_t id);
/** Find a good format between 2 ports */
struct spa_format *
pw_core_find_format(struct pw_core *core,
struct pw_port *output,
@ -172,6 +162,7 @@ pw_core_find_format(struct pw_core *core,
struct spa_format **format_filters,
char **error);
/** Find a ports compatible with \a other_port and the format filters */
struct pw_port *
pw_core_find_port(struct pw_core *core,
struct pw_port *other_port,
@ -181,6 +172,7 @@ pw_core_find_port(struct pw_core *core,
struct spa_format **format_filters,
char **error);
/** Find a node factory by name */
struct pw_node_factory *
pw_core_find_node_factory(struct pw_core *core, const char *name);

View file

@ -28,42 +28,47 @@ extern "C" {
/** \class pw_data_loop
*
* PipeWire rt-loop object.
* PipeWire rt-loop object. This loop starts a new real-time thread that
* is designed to run the processing graph.
*/
struct pw_data_loop;
#include <pipewire/loop.h>
#include <pipewire/properties.h>
/** Loop events, use \ref pw_data_loop_add_listener to add a listener */
struct pw_data_loop_events {
#define PW_VERSION_DATA_LOOP_EVENTS 0
uint32_t version;
/** The loop is destroyed */
void (*destroy) (void *data);
};
/** Make a new loop */
struct pw_data_loop *
pw_data_loop_new(struct pw_properties *properties);
/** Add an event listener to loop */
void pw_data_loop_add_listener(struct pw_data_loop *loop,
struct spa_hook *listener,
const struct pw_data_loop_events *events,
void *data);
/** Get the loop implementation of this data loop */
struct pw_loop *
pw_data_loop_get_loop(struct pw_data_loop *loop);
void
pw_data_loop_destroy(struct pw_data_loop *loop);
/** Destroy the loop */
void pw_data_loop_destroy(struct pw_data_loop *loop);
int
pw_data_loop_start(struct pw_data_loop *loop);
/** Start the processing thread */
int pw_data_loop_start(struct pw_data_loop *loop);
int
pw_data_loop_stop(struct pw_data_loop *loop);
/** Stop the processing thread */
int pw_data_loop_stop(struct pw_data_loop *loop);
bool
pw_data_loop_in_thread(struct pw_data_loop *loop);
/** Check if the current thread is the processing thread */
bool pw_data_loop_in_thread(struct pw_data_loop *loop);
#ifdef __cplusplus
}

View file

@ -26,37 +26,42 @@ extern "C" {
/** \page page_global Global
*
* Global objects represent resources that are available on the server and
* accessible to clients.
* Global objects represent resources that are available on the PipeWire
* core and are accessible to remote clients.
* Globals come and go when devices or other resources become available for
* clients.
*
* The client receives a list of globals when it binds to the registry
* Remote clients receives a list of globals when it binds to the registry
* object. See \ref page_registry.
*
* A client can bind to a global to send methods or receive events from
* the global.
*
* Global objects are arranged in a hierarchy where each global has a parent
* global. The core global is the top parent in the hierarchy.
*/
/** \class pw_global
*
* \brief A global object visible to all clients
* \brief A global object visible to remote clients
*
* A global object is visible to all clients and represents a resource
* A global object is visible to remote clients and represents a resource
* that can be used or inspected.
*
* See \ref page_server_api
* See \ref page_remote_api
*/
struct pw_global;
#include <pipewire/core.h>
#include <pipewire/client.h>
/** The function to let a client bind to a global */
typedef int (*pw_bind_func_t) (struct pw_global *global, /**< the global to bind */
struct pw_client *client, /**< client that binds */
uint32_t permissions, /**< permissions for the bind */
uint32_t version, /**< client interface version */
uint32_t id /**< client proxy id */);
/** Add a new global object to the core registry */
struct pw_global *
pw_core_add_global(struct pw_core *core,
struct pw_client *owner,
@ -66,29 +71,39 @@ pw_core_add_global(struct pw_core *core,
pw_bind_func_t bind,
void *object);
/** Get the permissions of the global for a given client */
uint32_t pw_global_get_permissions(struct pw_global *global, struct pw_client *client);
/** Get the core object of this global */
struct pw_core *pw_global_get_core(struct pw_global *global);
/** Get the owner of the global. This can be NULL when the core is owner */
struct pw_client *pw_global_get_owner(struct pw_global *global);
/** Get the parent of a global */
struct pw_global *pw_global_get_parent(struct pw_global *global);
/** Get the global type */
uint32_t pw_global_get_type(struct pw_global *global);
/** Get the global version */
uint32_t pw_global_get_version(struct pw_global *global);
/** Get the object associated with the global. This depends on the type of the
* global */
void *pw_global_get_object(struct pw_global *global);
/** Get the unique id of the global */
uint32_t pw_global_get_id(struct pw_global *global);
int
pw_global_bind(struct pw_global *global,
struct pw_client *client,
uint32_t permissions,
uint32_t version,
uint32_t id);
/** Let a client bind to a global */
int pw_global_bind(struct pw_global *global,
struct pw_client *client,
uint32_t permissions,
uint32_t version,
uint32_t id);
/** Destroy a global */
void pw_global_destroy(struct pw_global *global);
#ifdef __cplusplus

View file

@ -52,7 +52,7 @@ struct pw_link_proxy;
* \section page_iface_pw_core_desc Description
*
* The core global object. This is a special singleton object. It
* is used for internal Wayland protocol features.
* is used for internal PipeWire protocol features.
* \section page_iface_pw_core API
*/
@ -80,8 +80,8 @@ struct pw_link_proxy;
* \brief Core methods
*
* The core global object. This is a singleton object used for
* creating new objects in the PipeWire server. It is also used
* for internal features.
* creating new objects in the remote PipeWire intance. It is
* also used for internal features.
*/
struct pw_core_proxy_methods {
#define PW_VERSION_CORE_PROXY_METHODS 0
@ -308,6 +308,32 @@ pw_core_proxy_add_listener(struct pw_core_proxy *core,
#define PW_VERSION_REGISTRY 0
/** \page page_registry Registry
*
* \section page_registry_overview Overview
*
* The registry object is a singleton object that keeps track of
* global objects on the PipeWire instance. See also \ref page_global.
*
* Global objects typically represent an actual object in PipeWire
* (for example, a module or node) or they are singleton
* objects such as the core.
*
* When a client creates a registry object, the registry object
* will emit a global event for each global currently in the
* registry. Globals come and go as a result of device hotplugs or
* reconfiguration or other events, and the registry will send out
* global and global_remove events to keep the client up to date
* with the changes. To mark the end of the initial burst of
* events, the client can use the pw_core.sync methosd immediately
* after calling pw_core.get_registry.
*
* A client can bind to a global object by using the bind
* request. This creates a client-side proxy that lets the object
* emit events to the client and lets the client invoke methods on
* the object. See \ref page_proxy
*/
#define PW_REGISTRY_PROXY_METHOD_BIND 0
#define PW_REGISTRY_PROXY_METHOD_NUM 1

View file

@ -26,7 +26,7 @@ extern "C" {
/** \class pw_link
*
* PipeWire link interface.
* PipeWire link object.
*/
struct pw_link;
@ -48,19 +48,26 @@ struct pw_link;
* the nodes.
*/
/** link events added with \ref pw_link_add_listener */
struct pw_link_events {
#define PW_VERSION_LINK_EVENTS 0
uint32_t version;
/** A link is destroyed */
void (*destroy) (void *data);
/** A link is freed */
void (*free) (void *data);
/** The info changed on a link */
void (*info_changed) (void *data, const struct pw_link_info *info);
/** The link state changed, \a error is only valid when the state is
* in error. */
void (*state_changed) (void *data, enum pw_link_state old,
enum pw_link_state state, const char *error);
/** A port is unlinked */
void (*port_unlinked) (void *data, struct pw_port *port);
};
@ -79,16 +86,20 @@ pw_link_new(struct pw_core *core, /**< the core object */
/** Destroy a link \memberof pw_link */
void pw_link_destroy(struct pw_link *link);
/** Add an event listener to \a link */
void pw_link_add_listener(struct pw_link *link,
struct spa_hook *listener,
const struct pw_link_events *events,
void *data);
/** Get the core of a link */
struct pw_core *pw_link_get_core(struct pw_link *link);
/** Get the user_data of a link, the size of the memory is given when
* constructing the link */
void *pw_link_get_user_data(struct pw_link *link);
/** Get the link info */
const struct pw_link_info *pw_link_get_info(struct pw_link *link);
/** Get the global of the link */
@ -107,8 +118,8 @@ struct pw_link *pw_link_find(struct pw_port *output, struct pw_port *input);
void pw_link_inc_idle(struct pw_link *link);
/** Activate a link \memberof pw_link
* Starts the negotiation of formats and buffers on \a link and then
* starts data streaming */
* Starts the negotiation of formats and buffers on \a link and then
* starts data streaming */
bool pw_link_activate(struct pw_link *link);
/** Deactivate a link \memberof pw_link */

View file

@ -30,7 +30,7 @@ extern "C" {
*
* Logging functions of PipeWire
*
* Loggin is performed to stdout and stderr. Trace logging is performed
* Logging is performed to stdout and stderr. Trace logging is performed
* in a lockfree ringbuffer and written out from the main thread as to not
* block the realtime threads.
*/

View file

@ -30,7 +30,7 @@ extern "C" {
/** \class pw_loop
*
* PipeWire loop interface provides an implementation of
* PipeWire loop object provides an implementation of
* the spa loop interfaces. It can be used to implement various
* event loops.
*/

View file

@ -36,6 +36,7 @@ struct pw_main_loop;
#include <pipewire/loop.h>
#include <pipewire/properties.h>
/** Events of the main loop */
struct pw_main_loop_events {
#define PW_VERSION_MAIN_LOOP_EVENTS 0
uint32_t version;
@ -44,25 +45,27 @@ struct pw_main_loop_events {
void (*destroy) (void *data);
};
/** Create a new main loop */
struct pw_main_loop *
pw_main_loop_new(struct pw_properties *properties);
/** Add an event listener */
void pw_main_loop_add_listener(struct pw_main_loop *loop,
struct spa_hook *listener,
const struct pw_main_loop_events *events,
void *data);
struct pw_loop *
pw_main_loop_get_loop(struct pw_main_loop *loop);
/** Get the loop implementation */
struct pw_loop * pw_main_loop_get_loop(struct pw_main_loop *loop);
void
pw_main_loop_destroy(struct pw_main_loop *loop);
/** Destroy a loop */
void pw_main_loop_destroy(struct pw_main_loop *loop);
void
pw_main_loop_run(struct pw_main_loop *loop);
/** Run a main loop. This blocks until \ref pw_main_loop_quit is called */
void pw_main_loop_run(struct pw_main_loop *loop);
void
pw_main_loop_quit(struct pw_main_loop *loop);
/** Quit a main loop */
void pw_main_loop_quit(struct pw_main_loop *loop);
#ifdef __cplusplus
}

View file

@ -53,30 +53,38 @@ struct pw_module;
*/
typedef bool (*pw_module_init_func_t) (struct pw_module *module, char *args);
/** Module events added with \ref pw_module_add_listener */
struct pw_module_events {
#define PW_VERSION_MODULE_EVENTS 0
uint32_t version;
/** The module id destroyed */
void (*destroy) (void *data);
};
/** Load a module by name and arguments */
struct pw_module *
pw_module_load(struct pw_core *core, const char *name, const char *args);
/** Get the core of a module */
struct pw_core * pw_module_get_core(struct pw_module *module);
/** Get the global of a module */
struct pw_global * pw_module_get_global(struct pw_module *module);
/** Get the module info */
const struct pw_module_info *pw_module_get_info(struct pw_module *module);
/** Add an event listener to a module */
void pw_module_add_listener(struct pw_module *module,
struct spa_hook *listener,
const struct pw_module_events *events,
void *data);
void
pw_module_destroy(struct pw_module *module);
/** Destroy a module */
void pw_module_destroy(struct pw_module *module);
/** Find a module by filename */
struct pw_module *
pw_core_find_module(struct pw_core *core, const char *filename);

View file

@ -461,11 +461,6 @@ void pw_node_add_listener(struct pw_node *node,
spa_hook_list_append(&node->listener_list, listener, events, data);
}
struct spa_hook_list *pw_node_get_listeners(struct pw_node *node)
{
return &node->listener_list;
}
static int
do_node_remove(struct spa_loop *loop,
bool async, uint32_t seq, size_t size, const void *data, void *user_data)

View file

@ -47,6 +47,7 @@ struct pw_node;
#include <pipewire/port.h>
#include <pipewire/resource.h>
/** Node events, listen to them with \ref pw_node_add_listener */
struct pw_node_events {
#define PW_VERSION_NODE_EVENTS 0
uint32_t version;
@ -100,34 +101,43 @@ void pw_node_register(struct pw_node *node);
/** Destroy a node */
void pw_node_destroy(struct pw_node *node);
/** Configure the maximum input and output ports */
void pw_node_set_max_ports(struct pw_node *node,
uint32_t max_input_ports,
uint32_t max_output_ports);
/** Get the node info */
const struct pw_node_info *pw_node_get_info(struct pw_node *node);
/** Get node user_data. The size of the memory was given in \ref pw_node_new */
void * pw_node_get_user_data(struct pw_node *node);
/** Get the core of this node */
struct pw_core *pw_node_get_core(struct pw_node *node);
/** Get the node owner or NULL when not owned by a remote client */
struct pw_resource *pw_node_get_owner(struct pw_node *node);
/** Get the global of this node */
struct pw_global *pw_node_get_global(struct pw_node *node);
/** Get the node properties */
const struct pw_properties *pw_node_get_properties(struct pw_node *node);
/** Update the node properties */
void pw_node_update_properties(struct pw_node *node, const struct spa_dict *dict);
/** Set the node implementation */
void pw_node_set_implementation(struct pw_node *node, struct spa_node *spa_node);
/** Get the node implementation */
struct spa_node *pw_node_get_implementation(struct pw_node *node);
/** Add an event listener */
void pw_node_add_listener(struct pw_node *node,
struct spa_hook *listener,
const struct pw_node_events *events,
void *data);
struct spa_hook_list *pw_node_get_listeners(struct pw_node *node);
/** iterate the ports in the given direction */
bool pw_node_for_each_port(struct pw_node *node,
enum pw_direction direction,

View file

@ -51,12 +51,12 @@ extern "C" {
*
* \section sec_intro Introduction
*
* This document describes the API for the PipeWire multimedia server.
* This document describes the API for the PipeWire multimedia framework.
* The API consists of two parts:
*
* \li The client side API (See \subpage page_client_api)
* \li The server side API and tools to build new modules (See
* \subpage page_server_api)
* \li The core API and tools to build new modules (See
* \subpage page_core_api)
* \li The remote API (See \subpage page_remote_api)
*
* \section sec_errors Error reporting
*

View file

@ -49,28 +49,35 @@ struct pw_link;
#include <pipewire/node.h>
enum pw_port_state {
PW_PORT_STATE_ERROR = -1,
PW_PORT_STATE_INIT = 0,
PW_PORT_STATE_CONFIGURE = 1,
PW_PORT_STATE_READY = 2,
PW_PORT_STATE_PAUSED = 3,
PW_PORT_STATE_STREAMING = 4,
PW_PORT_STATE_ERROR = -1, /**< the port is in error */
PW_PORT_STATE_INIT = 0, /**< the port is being created */
PW_PORT_STATE_CONFIGURE = 1, /**< the port is ready for format negotiation */
PW_PORT_STATE_READY = 2, /**< the port is ready for buffer allocation */
PW_PORT_STATE_PAUSED = 3, /**< the port is paused */
PW_PORT_STATE_STREAMING = 4, /**< the port is streaming */
};
/** Port events, use \ref pw_port_add_listener */
struct pw_port_events {
#define PW_VERSION_PORT_EVENTS 0
uint32_t version;
/** The port is destroyed */
void (*destroy) (void *data);
/** The port is freed */
void (*free) (void *data);
/** a new link is added on this port */
void (*link_added) (void *data, struct pw_link *link);
/** a link is removed from this port */
void (*link_removed) (void *data, struct pw_link *link);
/** the state of the port changed */
void (*state_changed) (void *data, enum pw_port_state state);
/** the properties of the port changed */
void (*properties_changed) (void *data, const struct pw_properties *properties);
};
@ -85,8 +92,10 @@ pw_port_new(enum pw_direction direction,
/** Get the port direction */
enum pw_direction pw_port_get_direction(struct pw_port *port);
/** Get the port properties */
const struct pw_properties *pw_port_get_properties(struct pw_port *port);
/** Update the port properties */
void pw_port_update_properties(struct pw_port *port, const struct spa_dict *dict);
/** Get the port id */
@ -98,6 +107,7 @@ struct pw_node *pw_port_get_node(struct pw_port *port);
/** Add a port to a node \memberof pw_port */
bool pw_port_add(struct pw_port *port, struct pw_node *node);
/** Add an event listener on the port */
void pw_port_add_listener(struct pw_port *port,
struct spa_hook *listener,
const struct pw_port_events *events,
@ -106,6 +116,7 @@ void pw_port_add_listener(struct pw_port *port,
/** Destroy a port \memberof pw_port */
void pw_port_destroy(struct pw_port *port);
/** Get the user data of a port, the size of the memory was given \ref in pw_port_new */
void * pw_port_get_user_data(struct pw_port *port);
#ifdef __cplusplus

View file

@ -32,6 +32,7 @@ extern "C" {
#include "pipewire/pipewire.h"
#include "pipewire/introspect.h"
/** \cond */
struct pw_command {
struct spa_list link; /**< link in list of commands */
const char *name; /**< command name */
@ -381,6 +382,8 @@ int pw_port_alloc_buffers(struct pw_port *port,
struct spa_param **params, uint32_t n_params,
struct spa_buffer **buffers, uint32_t *n_buffers);
/** \endcond */
#ifdef __cplusplus
}
#endif

View file

@ -20,6 +20,7 @@
#include <pipewire/protocol.h>
#include <pipewire/private.h>
/** \cond */
struct impl {
struct pw_protocol this;
};
@ -29,6 +30,7 @@ struct marshal {
const struct pw_protocol_marshal *marshal;
uint32_t type;
};
/** \endcond */
struct pw_protocol *pw_protocol_new(struct pw_core *core,
const char *name,

View file

@ -31,9 +31,9 @@ struct proxy {
/** Create a proxy object with a given id and type
*
* \param proxy another proxy object that serves as a factory
* \param id Id of the new object, SPA_ID_INVALID will choose a new id
* \param factory another proxy object that serves as a factory
* \param type Type of the proxy object
* \param user_data_size size of user_data
* \return A newly allocated proxy object or NULL on failure
*
* This function creates a new proxy object with the supplied id and type. The

View file

@ -31,9 +31,19 @@ extern "C" {
* \section sec_page_proxy_overview Overview
*
* The proxy object is a client side representation of a resource
* that lives on the server.
* that lives on a remote PipeWire instance.
*
* It is used to communicate with the server side object.
* It is used to communicate with the remote object.
*
* \section sec_page_proxy_core Core proxy
*
* A proxy for a remote core object can be obtained by making
* a remote connection. See \ref pw_page_remote_api
*
* A pw_core_proxy can then be retrieved with \ref pw_remote_get_core_proxy
*
* Some methods on proxy object allow creation of more proxy objects or
* create a binding between a local proxy and global resource.
*
* \section sec_page_proxy_create Create
*
@ -77,8 +87,8 @@ extern "C" {
*
* \brief Represents an object on the client side.
*
* A pw_proxy acts as a client side proxy to an object existing in the
* pipewire server. The proxy is responsible for converting interface functions
* A pw_proxy acts as a client side proxy to an object existing in a remote
* pipewire instance. The proxy is responsible for converting interface functions
* invoked by the client to PipeWire messages. Events will call the handlers
* set in listener.
*
@ -88,41 +98,51 @@ struct pw_proxy;
#include <pipewire/protocol.h>
/** Proxy events, use \ref pw_proxy_add_listener */
struct pw_proxy_events {
#define PW_VERSION_PROXY_EVENTS 0
uint32_t version;
/** The proxy is destroyed */
void (*destroy) (void *data);
};
/** Make a new proxy object. The id can be used to bind to a remote object. */
/** Make a new proxy object. The id can be used to bind to a remote object and
* can be retrieved with \ref pw_proxy_get_id . */
struct pw_proxy *
pw_proxy_new(struct pw_proxy *factory, /**< factory */
uint32_t type, /**< interface type */
size_t user_data_size /**< size of user data */);
void
pw_proxy_add_listener(struct pw_proxy *proxy,
struct spa_hook *listener,
const struct pw_proxy_events *events,
void *data);
/** Add an event listener to proxy */
void pw_proxy_add_listener(struct pw_proxy *proxy,
struct spa_hook *listener,
const struct pw_proxy_events *events,
void *data);
void
pw_proxy_add_proxy_listener(struct pw_proxy *proxy, /**< the proxy */
struct spa_hook *listener, /**< listener */
const void *events, /**< proxied events */
void *data /**< data passed to events */);
/** Add a listener for the events received from the remote resource. The
* events depend on the type of the remote resource. */
void pw_proxy_add_proxy_listener(struct pw_proxy *proxy, /**< the proxy */
struct spa_hook *listener, /**< listener */
const void *events, /**< proxied events */
void *data /**< data passed to events */);
/** destroy a proxy */
void pw_proxy_destroy(struct pw_proxy *proxy);
/** Get the user_data. The size was given in \ref pw_proxy_new */
void *pw_proxy_get_user_data(struct pw_proxy *proxy);
/** Get the local id of the proxy */
uint32_t pw_proxy_get_id(struct pw_proxy *proxy);
/** Get the protocol used for the proxy */
struct pw_protocol *pw_proxy_get_protocol(struct pw_proxy *proxy);
/** Get the listener of proxy */
struct spa_hook_list *pw_proxy_get_proxy_listeners(struct pw_proxy *proxy);
/** Get the marshal functions for the proxy */
const struct pw_protocol_marshal *pw_proxy_get_marshal(struct pw_proxy *proxy);
#define pw_proxy_notify(p,type,event,...) spa_hook_list_call(pw_proxy_get_proxy_listeners(p),type,event,## __VA_ARGS__)

View file

@ -30,20 +30,20 @@ extern "C" {
*
* \section sec_remote_api_overview Overview
*
* The remote API allows you to connect to a remote PipeWire and
* perform actions on the PipeWire graph. This includes
* The remote API allows you to connect to a remote PipeWire instance
* and perform actions on the PipeWire graph. This includes
*
* \li introspecting the objects on the server
* \li introspecting the objects on the instance
* \li Creating nodes
* \li Linking nodes on their ports
* \li providing media to the server for playback or consumption
* \li retrieving media from the server
* \li retrieving media from the remote instance
*
* \section sec_remote_api_loop Event Loop Abstraction
*
* Most API is asynchronous and based around an event loop. Methods will
* start an operation which will cause a state change of the \ref pw_context
* object. Connect to the state_changed signal to be notified of these
* start an operation which will cause a state change of the \ref pw_remote
* object. Connect to the state_changed event to be notified of these
* state changes.
*
* The most convenient way to deal with the asynchronous calls is probably
@ -64,7 +64,8 @@ extern "C" {
* \subsection ssec_remote_create Create
*
* To create a new remote use pw_remote_new(). You will
* need to pass a \ref pw_core implementation for event and data loop.
* need to pass a local \ref pw_core implementation for event and
* data loop.
*
* A typical loop would be created with pw_thread_loop_new() but
* other implementation are possible.
@ -73,16 +74,20 @@ extern "C" {
* pw_fill_remote_properties() to get a default set of properties.
*
* After creating the remote, you can track the state of the remote
* by listening for the state_changed signal.
* by listening for the state_changed event.
*
* \subsection ssec_remote_api_remote_connect Connecting
*
* A remote must be connected to a server before any operation can be
* issued. Calling pw_remote_connect() will initiate the connection
* procedure.
* A remote must be connected before any operation can be issued.
* Calling pw_remote_connect() will initiate the connection procedure.
*
* When connecting, the remote will automatically create a core
* proxy to get access to the registry and types.
* proxy to get access to the registry proxy and types.
*
* \subsection ssec_remote_api_remote_registry Registry
*
* \subpage page_registry
*
*
* \subsection ssec_remote_api_remote_disconnect Disconnect
*
@ -90,13 +95,14 @@ extern "C" {
*/
/** \class pw_remote
*
* \brief Represents a connection with the PipeWire server
* \brief Represents a connection with a remote PipeWire instance
*
* a \ref pw_remote is created and used to connect to the server.
* a \ref pw_remote is created and used to connect to a remote PipeWire
* instance.
* A \ref pw_proxy for the core object will automatically be created
* when connecting.
*
* See also \ref page_client_api
* See also \ref page_core_api
*/
struct pw_remote;
@ -116,10 +122,12 @@ enum pw_remote_state {
/** Convert a \ref pw_remote_state to a readable string \memberof pw_remote */
const char *pw_remote_state_as_string(enum pw_remote_state state);
/** Events for the remote. use \ref pw_remote_add_listener */
struct pw_remote_events {
#define PW_VERSION_REMOTE_EVENTS 0
uint32_t version;
/** The remote is destroyed */
void (*destroy) (void *data);
/** emited when the remote core info changed */
void (*info_changed) (void *data, const struct pw_core_info *info);
@ -167,6 +175,7 @@ struct pw_core_proxy * pw_remote_get_core_proxy(struct pw_remote *remote);
/** Get the remote core info, can only be called when connected */
const struct pw_core_info *pw_remote_get_core_info(struct pw_remote *remote);
/** Get the proxy with the given id */
struct pw_proxy *pw_remote_get_proxy(struct pw_remote *remote, uint32_t id);
/** Disconnect from the remote PipeWire. \memberof pw_remote */

View file

@ -58,10 +58,12 @@ struct pw_resource;
#include <pipewire/client.h>
/** Resource events */
struct pw_resource_events {
#define PW_VERSION_RESOURCE_EVENTS 0
uint32_t version;
/** The resource is destroyed */
void (*destroy) (void *data);
};
@ -74,38 +76,51 @@ pw_resource_new(struct pw_client *client, /**< the client owning the resource */
uint32_t version, /**< requested interface version */
size_t user_data_size /**< extra user data size */);
/** Destroy a resource */
void pw_resource_destroy(struct pw_resource *resource);
/** Get the client owning this resource */
struct pw_client *pw_resource_get_client(struct pw_resource *resource);
/** Get the unique id of this resource */
uint32_t pw_resource_get_id(struct pw_resource *resource);
/** Get the permissions of this resource */
uint32_t pw_resource_get_permissions(struct pw_resource *resource);
/** Get the type of this resource */
uint32_t pw_resource_get_type(struct pw_resource *resource);
/** Get the protocol used for this resource */
struct pw_protocol *pw_resource_get_protocol(struct pw_resource *resource);
/** Get the user data for the resource, the size was given in \ref pw_resource_new */
void *pw_resource_get_user_data(struct pw_resource *resource);
/** Add an event listener */
void pw_resource_add_listener(struct pw_resource *resource,
struct spa_hook *listener,
const struct pw_resource_events *events,
void *data);
/** Set the resource implementation. */
void pw_resource_set_implementation(struct pw_resource *resource,
const void *implementation,
void *data);
/** Override the implementation of a resource. */
void pw_resource_add_override(struct pw_resource *resource,
struct spa_hook *listener,
const void *implementation,
void *data);
/** Generate an error for a resource */
void pw_resource_error(struct pw_resource *resource, int result, const char *error);
/** Get the implementation list of a resource */
struct spa_hook_list *pw_resource_get_implementation(struct pw_resource *resource);
/** Get the marshal functions for the resource */
const struct pw_protocol_marshal *pw_resource_get_marshal(struct pw_resource *resource);
#define pw_resource_do(r,type,method,...) \

View file

@ -41,8 +41,8 @@ extern "C" {
* choose a port for you.
*
* For more complicated nodes such as filters or ports with multiple
* inputs and/or outputs you will need to manage the \ref pw_client_node proxy
* yourself.
* inputs and/or outputs you will need to create a pw_node yourself and
* export it with \ref pw_remote_export.
*
* \section sec_create Create
*
@ -51,7 +51,7 @@ extern "C" {
* pw_fill_stream_properties() to get a basic set of properties for the
* stream.
*
* Once the stream is created, the state_changed signal should be used to
* Once the stream is created, the state_changed event should be used to
* track the state of the stream.
*
* \section sec_connect Connect
@ -88,7 +88,7 @@ extern "C" {
* PW_STREAM_STATE_CONFIGURE state. In this state the format will be
* negotiated by the PipeWire server.
*
* Once the format has been selected, the format_changed signal is
* Once the format has been selected, the format_changed event is
* emited with the configured format as a parameter.
*
* The client should now prepare itself to deal with the format and
@ -106,7 +106,7 @@ extern "C" {
* notify the stream of the buffers that will be used to exchange data
* between client and server.
*
* With the add_buffer signal, a stream will be notified of a new buffer
* With the add_buffer event, a stream will be notified of a new buffer
* that can be used for data transport.
*
* Afer the buffers are negotiated, the stream will transition to the
@ -124,7 +124,7 @@ extern "C" {
*
* \subsection ssec_consume Consume data
*
* The new_buffer signal is emited for each new buffer can can be
* The new_buffer event is emited for each new buffer can can be
* consumed.
*
* \ref pw_stream_peek_buffer() should be used to get the data and metadata
@ -135,7 +135,7 @@ extern "C" {
*
* \subsection ssec_produce Produce data
*
* The need_buffer signal is emited when PipeWire needs a new buffer for this
* The need_buffer event is emited when PipeWire needs a new buffer for this
* stream.
*
* \ref pw_stream_get_empty_buffer() gives the id of an empty buffer.
@ -144,7 +144,7 @@ extern "C" {
*
* To send the filled buffer, use \ref pw_stream_send_buffer().
*
* The new_buffer signal is emited when PipeWire no longer uses the buffer
* The new_buffer event is emited when PipeWire no longer uses the buffer
* and it can be safely reused.
*
* \section sec_stream_disconnect Disconnect
@ -158,7 +158,7 @@ extern "C" {
* The stream object provides a convenient way to send and
* receive data streams from/to PipeWire.
*
* See also \ref page_streams and \ref page_client_api
* See also \ref page_streams and \ref page_core_api
*/
struct pw_stream;
@ -179,6 +179,7 @@ enum pw_stream_state {
PW_STREAM_STATE_STREAMING = 5 /**< streaming */
};
/** Events for a stream */
struct pw_stream_events {
#define PW_VERSION_STREAM_EVENTS 0
uint32_t version;
@ -253,7 +254,7 @@ const struct pw_properties *pw_stream_get_properties(struct pw_stream *stream);
* \return true on success.
*
* When \a mode is \ref PW_STREAM_MODE_BUFFER, you should connect to the new-buffer
* signal and use pw_stream_peek_buffer() to get the latest metadata and
* event and use pw_stream_peek_buffer() to get the latest metadata and
* data. */
bool
pw_stream_connect(struct pw_stream *stream, /**< a \ref pw_stream */

View file

@ -70,9 +70,9 @@ extern "C" {
* on to the lock more than necessary though, as the threaded loop stops
* while the lock is held.
*
* \section sec_thread_loop_signals Signals and Callbacks
* \section sec_thread_loop_events Events and Callbacks
*
* All signals and callbacks are called with the thread lock held.
* All events and callbacks are called with the thread lock held.
*
*/
/** \class pw_thread_loop
@ -89,49 +89,54 @@ extern "C" {
*/
struct pw_thread_loop;
/** Thread loop events */
struct pw_thread_loop_events {
#define PW_VERSION_THREAD_LOOP_EVENTS 0
uint32_t version;
/** the loop is destroyed */
void (*destroy) (void *data);
};
/** Make a new thread loop with the given name */
struct pw_thread_loop *
pw_thread_loop_new(struct pw_loop *loop, const char *name);
void
pw_thread_loop_destroy(struct pw_thread_loop *loop);
/** Destroy a thread loop */
void pw_thread_loop_destroy(struct pw_thread_loop *loop);
/** Add an event listener */
void pw_thread_loop_add_listener(struct pw_thread_loop *loop,
struct spa_hook *listener,
const struct pw_thread_loop_events *events,
void *data);
struct pw_loop *
pw_thread_loop_get_loop(struct pw_thread_loop *loop);
int
pw_thread_loop_start(struct pw_thread_loop *loop);
/** Get the loop implementation of the thread loop */
struct pw_loop * pw_thread_loop_get_loop(struct pw_thread_loop *loop);
void
pw_thread_loop_stop(struct pw_thread_loop *loop);
/** Start the thread loop */
int pw_thread_loop_start(struct pw_thread_loop *loop);
void
pw_thread_loop_lock(struct pw_thread_loop *loop);
/** Stop the thread loop */
void pw_thread_loop_stop(struct pw_thread_loop *loop);
void
pw_thread_loop_unlock(struct pw_thread_loop *loop);
/** Lock the loop. This ensures exclusive ownership of the loop */
void pw_thread_loop_lock(struct pw_thread_loop *loop);
void
pw_thread_loop_wait(struct pw_thread_loop *loop);
/** Unlock the loop */
void pw_thread_loop_unlock(struct pw_thread_loop *loop);
void
pw_thread_loop_signal(struct pw_thread_loop *loop, bool wait_for_accept);
/** Release the lock and wait until some thread calls \ref pw_thread_loop_signal */
void pw_thread_loop_wait(struct pw_thread_loop *loop);
void
pw_thread_loop_accept(struct pw_thread_loop *loop);
/** Signal all threads waiting with \ref pw_thread_loop_wait */
void pw_thread_loop_signal(struct pw_thread_loop *loop, bool wait_for_accept);
bool
pw_thread_loop_in_thread(struct pw_thread_loop *loop);
/** Signal all threads executing \ref pw_thread_loop_signal with wait_for_accept */
void pw_thread_loop_accept(struct pw_thread_loop *loop);
/** Check if inside the thread */
bool pw_thread_loop_in_thread(struct pw_thread_loop *loop);
#ifdef __cplusplus
}