core.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_CORE_H__
#define __PIPEWIRE_CORE_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <spa/utils/defs.h>
#include <spa/utils/hook.h>
struct pw_core;
#include <pipewire/type.h>
#include <pipewire/client.h>
#include <pipewire/global.h>
#include <pipewire/introspect.h>
#include <pipewire/loop.h>
#include <pipewire/factory.h>
#include <pipewire/port.h>
#include <pipewire/properties.h>
#define PW_PERM_R 0400
#define PW_PERM_W 0200
#define PW_PERM_X 0100
#define PW_PERM_RWX (PW_PERM_R|PW_PERM_W|PW_PERM_X)
#define PW_PERM_IS_R(p) (((p)&PW_PERM_R) == PW_PERM_R)
#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)
struct pw_core_events {
#define PW_VERSION_CORE_EVENTS 0
uint32_t version;
void (*destroy) (void *data);
void (*free) (void *data);
void (*info_changed) (void *data, struct pw_core_info *info);
void (*global_added) (void *data, struct pw_global *global);
void (*global_removed) (void *data, struct pw_global *global);
};
#define PW_CORE_PROP_USER_NAME "pipewire.core.user-name"
#define PW_CORE_PROP_HOST_NAME "pipewire.core.host-name"
#define PW_CORE_PROP_NAME "pipewire.core.name"
#define PW_CORE_PROP_VERSION "pipewire.core.version"
#define PW_CORE_PROP_DAEMON "pipewire.daemon"
struct pw_core * pw_core_new(struct pw_loop *main_loop, struct pw_properties *props);
void pw_core_destroy(struct pw_core *core);
void pw_core_add_listener(struct pw_core *core,
struct spa_hook *listener,
const struct pw_core_events *events,
void *data);
struct pw_type *pw_core_get_type(struct pw_core *core);
const struct pw_core_info *pw_core_get_info(struct pw_core *core);
struct pw_global *pw_core_get_global(struct pw_core *core);
const struct pw_properties *pw_core_get_properties(struct pw_core *core);
int pw_core_update_properties(struct pw_core *core, const struct spa_dict *dict);
const struct spa_support *pw_core_get_support(struct pw_core *core, uint32_t *n_support);
struct pw_loop *pw_core_get_main_loop(struct pw_core *core);
int pw_core_for_each_global(struct pw_core *core,
int (*callback) (void *data, struct pw_global *global),
void *data);
struct pw_global *pw_core_find_global(struct pw_core *core,
uint32_t id );
struct pw_factory *
pw_core_find_factory(struct pw_core *core ,
const char *name );
#ifdef __cplusplus
}
#endif
#endif /* __PIPEWIRE_CORE_H__ */
pw_core_get_properties
const struct pw_properties * pw_core_get_properties(struct pw_core *core)
Get the core properties.
Definition: core.c:571
pw_core_update_properties
int pw_core_update_properties(struct pw_core *core, const struct spa_dict *dict)
Update the core properties.
pw_properties
A collection of key/value pairs.
Definition: properties.h:38
pw_core_events
core events emited by the core object added with pw_core_add_listener
Definition: core.h:88
introspect.h
pw_loop
PipeWire loop object provides an implementation of the spa loop interfaces.
Definition: loop.h:37
pw_core_get_info
const struct pw_core_info * pw_core_get_info(struct pw_core *core)
Get the core info object.
Definition: core.c:531
pw_properties::dict
struct spa_dict dict
Definition: properties.h:39
pw_core_events::destroy
void(* destroy)(void *data)
The core is being destroyed.
Definition: core.h:93
pw_core_get_support
const struct spa_support * pw_core_get_support(struct pw_core *core, uint32_t *n_support)
Get the core support objects.
Definition: core.c:558
pw_core_events::version
uint32_t version
Definition: core.h:90
pw_core
the core PipeWire object
pw_core_find_global
struct pw_global * pw_core_find_global(struct pw_core *core, uint32_t id)
Find a core global by id.
Definition: core.c:631
pw_core_info
The core information.
Definition: introspect.h:76
global.h
pw_type::core
uint32_t core
Definition: type.h:54
pw_core_events::global_removed
void(* global_removed)(void *data, struct pw_global *global)
a global object was removed
Definition: core.h:101
loop.h
pw_core_events::free
void(* free)(void *data)
The core is being freed.
Definition: core.h:95
pw_factory
PipeWire factory interface.
pw_core_get_global
struct pw_global * pw_core_get_global(struct pw_core *core)
Get the core global object.
Definition: core.c:537
pw_core_new
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.
pw_type
PipeWire type support struct.
Definition: type.h:51
pw_core_events::info_changed
void(* info_changed)(void *data, struct pw_core_info *info)
The core info changed, use pw_core_get_info() to get the updated info.
Definition: core.h:97
pw_core_destroy
void pw_core_destroy(struct pw_core *core)
destroy a core object, all resources except the main_loop will be destroyed
factory.h
pw_core_for_each_global
int pw_core_for_each_global(struct pw_core *core, int(*callback)(void *data, struct pw_global *global), void *data)
Iterate the globals of the core.
Definition: core.c:613
properties.h
pw_core_get_type
struct pw_type * pw_core_get_type(struct pw_core *core)
Get the type object of a core.
Definition: core.c:552
port.h
pw_global
A global object visible to remote clients.
pw_core_get_main_loop
struct pw_loop * pw_core_get_main_loop(struct pw_core *core)
get the core main loop
Definition: core.c:565
pw_core_find_factory
struct pw_factory * pw_core_find_factory(struct pw_core *core, const char *name)
Find a factory by name.
client.h
pw_core_add_listener
void pw_core_add_listener(struct pw_core *core, struct spa_hook *listener, const struct pw_core_events *events, void *data)
Add a new event listener to a core.
Definition: core.c:543
pw_core_events::global_added
void(* global_added)(void *data, struct pw_global *global)
a new global object was added
Definition: core.h:99
type.h