/** \page page_proxy Proxy * * \section sec_page_proxy_overview Overview * * The proxy object is a client side representation of a resource * that lives on a remote PipeWire instance. * * 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 with \ref pw_context_connect. * See \ref pw_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 * * A client first creates a new proxy object with pw_proxy_new(). A * type must be provided for this object. * * The protocol of the context will usually install an interface to * translate method calls and events to the wire format. * * The creator of the proxy will usually also install an event * implementation of the particular object type. * * \section sec_page_proxy_bind Bind * * To actually use the proxy object, one needs to create a server * side resource for it. This can be done by, for example, binding * to a global object or by calling a method that creates and binds * to a new remote object. In all cases, the local id is passed to * the server and is used to create a resource with the same id. * * \section sec_page_proxy_methods Methods * * To call a method on the proxy use the interface methods. Calling * any interface method will result in a request to the server to * perform the requested action on the corresponding resource. * * \section sec_page_proxy_events Events * * Events send from the server to the proxy will be demarshalled by * the protocol and will then result in a call to the installed * implementation of the proxy. * * \section sec_page_proxy_destroy Destroy * * Use pw_proxy_destroy() to destroy the client side object. This * is usually done automatically when the server removes the resource * associated to the proxy.
*/
/** \defgroup pw_proxy Proxy * * \brief Represents an object on the client side. * * 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. * * See \ref page_proxy
*/
/** The proxy is destroyed */ void (*destroy) (void *data);
/** a proxy is bound to a global id */ void (*bound) (void *data, uint32_t global_id);
/** a proxy is removed from the server. Use pw_proxy_destroy to
* free the proxy. */ void (*removed) (void *data);
/** a reply to a sync method completed */ void (*done) (void *data, int seq);
/** an error occurred on the proxy */ void (*error) (void *data, int seq, int res, constchar *message);
};
/* 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, constchar *type, /* interface type */
uint32_t version, /* interface version */
size_t user_data_size /* size of user data */);
/** Add an event listener to proxy */ void pw_proxy_add_listener(struct pw_proxy *proxy, struct spa_hook *listener, conststruct pw_proxy_events *events, void *data);
/** Add a listener for the events received from the remote object. The
* events depend on the type of the remote object type. */ void pw_proxy_add_object_listener(struct pw_proxy *proxy, /**< the proxy */ struct spa_hook *listener, /**< listener */ constvoid *funcs, /**< proxied functions */ 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 type and version of the proxy */ constchar *pw_proxy_get_type(struct pw_proxy *proxy, uint32_t *version);
/** Get the protocol used for the proxy */ struct pw_protocol *pw_proxy_get_protocol(struct pw_proxy *proxy);
/** Generate an sync method for a proxy. This will generate a done event
* with the same seq number of the reply. */ int pw_proxy_sync(struct pw_proxy *proxy, int seq);
/** Set the global id this proxy is bound to. This is usually used internally
* and will also emit the bound event */ int pw_proxy_set_bound_id(struct pw_proxy *proxy, uint32_t global_id); /** Get the global id bound to this proxy of SPA_ID_INVALID when not bound
* to a global */
uint32_t pw_proxy_get_bound_id(struct pw_proxy *proxy);
/** Generate an error for a proxy */ int pw_proxy_error(struct pw_proxy *proxy, int res, constchar *error); int pw_proxy_errorf(struct pw_proxy *proxy, int res, constchar *error, ...) SPA_PRINTF_FUNC(3, 4);
/** Get the listener of proxy */ struct spa_hook_list *pw_proxy_get_object_listeners(struct pw_proxy *proxy);
/** Get the marshal functions for the proxy */ conststruct pw_protocol_marshal *pw_proxy_get_marshal(struct pw_proxy *proxy);
/** Install a marshal function on a proxy */ int pw_proxy_install_marshal(struct pw_proxy *proxy, bool implementor);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.