client.h
Go to the documentation of this file.
/* PipeWire
* Copyright (C) 2015 Wim Taymans <wim.taymans@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef __PIPEWIRE_CLIENT_H__
#define __PIPEWIRE_CLIENT_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <spa/utils/hook.h>
struct pw_client;
#include <pipewire/core.h>
#include <pipewire/global.h>
#include <pipewire/introspect.h>
#include <pipewire/properties.h>
#include <pipewire/resource.h>
#define PW_TYPE__Client PW_TYPE_OBJECT_BASE "Client"
#define PW_TYPE_CLIENT_BASE PW_TYPE__Client ":"
struct pw_client_events {
#define PW_VERSION_CLIENT_EVENTS 0
uint32_t version;
void (*destroy) (void *data);
void (*free) (void *data);
void (*info_changed) (void *data, struct pw_client_info *info);
void (*resource_added) (void *data, struct pw_resource *resource);
void (*resource_impl) (void *data, struct pw_resource *resource);
void (*resource_removed) (void *data, struct pw_resource *resource);
void (*busy_changed) (void *data, bool busy);
};
#define PW_CLIENT_PROP_PROTOCOL "pipewire.protocol"
#define PW_CLIENT_PROP_UCRED_PID "pipewire.ucred.pid"
#define PW_CLIENT_PROP_UCRED_UID "pipewire.ucred.uid"
#define PW_CLIENT_PROP_UCRED_GID "pipewire.ucred.gid"
#define PW_CLIENT_PROP_SEC_LABEL "pipewire.sec.label"
struct pw_client *
pw_client_new(struct pw_core *core,
struct pw_properties *properties,
size_t user_data_size );
void pw_client_destroy(struct pw_client *client);
int pw_client_register(struct pw_client *client,
struct pw_client *owner,
struct pw_global *parent,
struct pw_properties *properties);
void *pw_client_get_user_data(struct pw_client *client);
const struct pw_client_info *pw_client_get_info(struct pw_client *client);
int pw_client_update_properties(struct pw_client *client, const struct spa_dict *dict);
int pw_client_update_permissions(struct pw_client *client, const struct spa_dict *dict);
const struct pw_properties *pw_client_get_properties(struct pw_client *client);
struct pw_core *pw_client_get_core(struct pw_client *client);
struct pw_resource *pw_client_get_core_resource(struct pw_client *client);
struct pw_resource *pw_client_find_resource(struct pw_client *client, uint32_t id);
struct pw_global *pw_client_get_global(struct pw_client *client);
void pw_client_add_listener(struct pw_client *client,
struct spa_hook *listener,
const struct pw_client_events *events,
void *data);
void pw_client_set_busy(struct pw_client *client, bool busy);
#ifdef __cplusplus
}
#endif
#endif /* __PIPEWIRE_CLIENT_H__ */
pw_client_get_info
const struct pw_client_info * pw_client_get_info(struct pw_client *client)
Get the client information.
Definition: client.c:336
pw_client_events::resource_impl
void(* resource_impl)(void *data, struct pw_resource *resource)
emited when an implementation is set on a resource.
Definition: client.h:99
pw_properties
A collection of key/value pairs.
Definition: properties.h:38
pw_client_get_core_resource
struct pw_resource * pw_client_get_core_resource(struct pw_client *client)
Get the client core resource.
Definition: client.c:247
pw_client_destroy
void pw_client_destroy(struct pw_client *client)
Destroy a previously created client.
pw_client_events::free
void(* free)(void *data)
emited right before the client is freed
Definition: client.h:89
introspect.h
pw_client_events::resource_removed
void(* resource_removed)(void *data, struct pw_resource *resource)
emited when a resource is removed
Definition: client.h:102
pw_client_set_busy
void pw_client_set_busy(struct pw_client *client, bool busy)
Mark the client busy.
Definition: client.c:514
pw_client_add_listener
void pw_client_add_listener(struct pw_client *client, struct spa_hook *listener, const struct pw_client_events *events, void *data)
listen to events from this client
Definition: client.c:327
core.h
pw_client_events::busy_changed
void(* busy_changed)(void *data, bool busy)
emited when the client becomes busy processing an asynchronous message.
Definition: client.h:107
pw_core
the core PipeWire object
pw_client_get_properties
const struct pw_properties * pw_client_get_properties(struct pw_client *client)
Get the client properties.
Definition: client.c:265
global.h
pw_client_events::info_changed
void(* info_changed)(void *data, struct pw_client_info *info)
emited when the client info changed
Definition: client.h:92
pw_client_get_global
struct pw_global * pw_client_get_global(struct pw_client *client)
Get the global associated with this client.
Definition: client.c:259
pw_client_get_user_data
void * pw_client_get_user_data(struct pw_client *client)
Get the client user data.
Definition: client.c:271
pw_client_get_core
struct pw_core * pw_client_get_core(struct pw_client *client)
Get the core used to create this client.
Definition: client.c:241
pw_client_update_properties
int pw_client_update_properties(struct pw_client *client, const struct spa_dict *dict)
Update the client properties.
pw_client_info
The client information.
Definition: introspect.h:125
resource.h
pw_client
PipeWire client object class.
pw_resource
Client owned objects.
properties.h
pw_client_new
struct pw_client * pw_client_new(struct pw_core *core, struct pw_properties *properties, size_t user_data_size)
Create a new client.
pw_client_events::destroy
void(* destroy)(void *data)
emited when the client is destroyed
Definition: client.h:86
pw_client_events::version
uint32_t version
Definition: client.h:83
pw_global
A global object visible to remote clients.
pw_client_register
int pw_client_register(struct pw_client *client, struct pw_client *owner, struct pw_global *parent, struct pw_properties *properties)
Finish configuration and register a client.
Definition: client.c:211
pw_client_events::resource_added
void(* resource_added)(void *data, struct pw_resource *resource)
emited when a new resource is added for client
Definition: client.h:95
pw_client_find_resource
struct pw_resource * pw_client_find_resource(struct pw_client *client, uint32_t id)
Get a resource with the given id.
Definition: client.c:253
pw_client_events
The events that a client can emit.
Definition: client.h:81
pw_client_update_permissions
int pw_client_update_permissions(struct pw_client *client, const struct spa_dict *dict)
Update the client permissions.
Definition: client.c:452