PipeWire  0.3.33
pipewire.h
Go to the documentation of this file.
1 /* PipeWire
2  *
3  * Copyright © 2018 Wim Taymans
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a
6  * copy of this software and associated documentation files (the "Software"),
7  * to deal in the Software without restriction, including without limitation
8  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9  * and/or sell copies of the Software, and to permit persons to whom the
10  * Software is furnished to do so, subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice (including the next
13  * paragraph) shall be included in all copies or substantial portions of the
14  * Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  * DEALINGS IN THE SOFTWARE.
23  */
24 
25 #ifndef PIPEWIRE_H
26 #define PIPEWIRE_H
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 #include <spa/support/plugin.h>
33 
34 #include <pipewire/array.h>
35 #include <pipewire/client.h>
36 #include <pipewire/context.h>
37 #include <pipewire/device.h>
38 #include <pipewire/buffers.h>
39 #include <pipewire/core.h>
40 #include <pipewire/factory.h>
41 #include <pipewire/keys.h>
42 #include <pipewire/log.h>
43 #include <pipewire/loop.h>
44 #include <pipewire/link.h>
45 #include <pipewire/main-loop.h>
46 #include <pipewire/map.h>
47 #include <pipewire/mem.h>
48 #include <pipewire/module.h>
49 #include <pipewire/node.h>
50 #include <pipewire/properties.h>
51 #include <pipewire/proxy.h>
52 #include <pipewire/permission.h>
53 #include <pipewire/protocol.h>
54 #include <pipewire/port.h>
55 #include <pipewire/stream.h>
56 #include <pipewire/filter.h>
57 #include <pipewire/thread-loop.h>
58 #include <pipewire/data-loop.h>
59 #include <pipewire/type.h>
60 #include <pipewire/utils.h>
61 #include <pipewire/version.h>
62 
71 void
72 pw_init(int *argc, char **argv[]);
73 
74 void pw_deinit(void);
75 
76 bool
78 
79 const char *
81 
82 const char *
83 pw_get_prgname(void);
84 
85 const char *
86 pw_get_user_name(void);
87 
88 const char *
89 pw_get_host_name(void);
90 
91 const char *
92 pw_get_client_name(void);
93 
94 bool pw_in_valgrind(void);
95 
96 bool pw_check_option(const char *option, const char *value);
97 
98 enum pw_direction
99 pw_direction_reverse(enum pw_direction direction);
100 
101 int pw_set_domain(const char *domain);
102 const char *pw_get_domain(void);
103 
104 uint32_t pw_get_support(struct spa_support *support, uint32_t max_support);
105 
106 struct spa_handle *pw_load_spa_handle(const char *lib,
107  const char *factory_name,
108  const struct spa_dict *info,
109  uint32_t n_support,
110  const struct spa_support support[]);
111 
113 
118 #ifdef __cplusplus
119 }
120 #endif
121 
122 #endif /* PIPEWIRE_H */
pw_log_level
enum spa_log_level pw_log_level
The global log level.
Definition: log.c:39
pw_ngettext
const char * pw_ngettext(const char *msgid, const char *msgid_plural, unsigned long int n)
Definition: pipewire.c:425
PW_DIRECTION_INPUT
#define PW_DIRECTION_INPUT
Definition: port.h:57
SUPPORTLIB
#define SUPPORTLIB
Definition: pipewire.c:53
spa_interface
Definition: hook.h:146
handle::factory_name
char * factory_name
Definition: pipewire.c:71
SPA_KEY_LOG_FILE
#define SPA_KEY_LOG_FILE
log to the specified file instead of stderr.
Definition: build-12683127/doc/spa/support/log.h:182
data-loop.h
port.h
SPA_TYPE_INTERFACE_I18N
#define SPA_TYPE_INTERFACE_I18N
Definition: build-12683127/doc/spa/support/i18n.h:40
spa_i18n_ntext
const char * spa_i18n_ntext(struct spa_i18n *i18n, const char *msgid, const char *msgid_plural, unsigned long int n)
Definition: build-12683127/doc/spa/support/i18n.h:83
pw_gettext
const char * pw_gettext(const char *msgid)
Definition: pipewire.c:420
pw_get_prgname
const char * pw_get_prgname(void)
Get the program name.
Definition: pipewire.c:653
SPA_VERSION_I18N
#define SPA_VERSION_I18N
Definition: build-12683127/doc/spa/support/i18n.h:42
spa_zero
#define spa_zero(x)
Definition: defs.h:303
factory.h
spa_i18n_methods
Definition: build-12683127/doc/spa/support/i18n.h:45
MAX_SUPPORT
#define MAX_SUPPORT
Definition: pipewire.c:51
SPA_SUPPORT_INIT
#define SPA_SUPPORT_INIT(type, data)
Definition: plugin.h:107
pw_init
void pw_init(int *argc, char **argv[])
Initialize PipeWire.
Definition: pipewire.c:483
SPA_DICT_ITEM_INIT
#define SPA_DICT_ITEM_INIT(key, value)
Definition: utils/dict.h:46
plugin::handles
struct spa_list handles
Definition: pipewire.c:64
plugin::ref
int ref
Definition: pipewire.c:65
name
const char * name
Definition: media-session.c:2379
string.h
loop.h
spa_type_info
Definition: build-12683127/doc/spa/utils/type.h:137
mem.h
handle::ref
int ref
Definition: pipewire.c:72
device.h
spa_streq
bool spa_streq(const char *s1, const char *s2)
Definition: string.h:50
spa_list_for_each
#define spa_list_for_each(pos, head, member)
Definition: list.h:111
SPA_NAME_SUPPORT_LOG
#define SPA_NAME_SUPPORT_LOG
A Log interface.
Definition: names.h:43
pw_get_support
uint32_t pw_get_support(struct spa_support *support, uint32_t max_support)
Definition: pipewire.c:233
spa_aprintf
#define spa_aprintf(_fmt,...)
Definition: defs.h:323
SPA_EXPORT
#define SPA_EXPORT
Definition: defs.h:208
pw_get_application_name
const char * pw_get_application_name(void)
Get the application name.
Definition: pipewire.c:610
plugin::enum_func
spa_handle_factory_enum_func_t enum_func
Definition: pipewire.c:63
SPA_KEY_LOG_TIMESTAMP
#define SPA_KEY_LOG_TIMESTAMP
log timestamps
Definition: build-12683127/doc/spa/support/log.h:184
module.h
plugin.h
pw_get_user_name
const char * pw_get_user_name(void)
Get the user name.
Definition: pipewire.c:663
spa_i18n
Definition: build-12683127/doc/spa/support/i18n.h:43
spa_list
Definition: list.h:37
pw_free_strv
void pw_free_strv(char **str)
Free a NULL terminated array of strings.
Definition: utils.c:98
SPA_DICT_INIT
#define SPA_DICT_INIT(items, n_items)
Definition: utils/dict.h:55
support::no_config
unsigned int no_config
Definition: pipewire.c:91
handle
Definition: pipewire.c:68
pw_get_client_name
const char * pw_get_client_name(void)
Get the client name.
Definition: pipewire.c:711
pw_deinit
void pw_deinit(void)
Definition: pipewire.c:563
SPA_VERSION_I18N_METHODS
#define SPA_VERSION_I18N_METHODS
Definition: build-12683127/doc/spa/support/i18n.h:46
array.h
spa_support::type
const char * type
Definition: plugin.h:90
SPA_INTERFACE_INIT
#define SPA_INTERFACE_INIT(_type, _version, _funcs, _data)
Initialize a spa_interface.
Definition: hook.h:165
spa_dict_item
Definition: utils/dict.h:41
spa_list_consume
#define spa_list_consume(pos, head, member)
Definition: list.h:96
pw_direction_reverse
enum pw_direction pw_direction_reverse(enum pw_direction direction)
Reverse the direction.
Definition: pipewire.c:729
protocol.h
pw_type_info
const struct spa_type_info * pw_type_info(void)
Definition: pipewire.c:751
permission.h
spa_handle_factory::info
const struct spa_dict * info
Extra information about the handles of this factory.
Definition: plugin.h:130
PW_DIRECTION_OUTPUT
#define PW_DIRECTION_OUTPUT
Definition: port.h:58
spa_types
const struct spa_type_info spa_types[]
Definition: utils/type-info.h:78
spa_list_remove
void spa_list_remove(struct spa_list *elem)
Definition: list.h:69
pw_split_strv
char ** pw_split_strv(const char *str, const char *delimiter, int max_tokens, int *n_tokens)
Split a string based on delimiters.
Definition: utils.c:66
spa_log
Definition: build-12683127/doc/spa/support/log.h:61
plugin
Definition: pipewire.c:59
pw_get_host_name
const char * pw_get_host_name(void)
Get the host name.
Definition: pipewire.c:675
SPA_KEY_LOG_COLORS
#define SPA_KEY_LOG_COLORS
enable colors in the logger
Definition: build-12683127/doc/spa/support/log.h:181
support::support_lib
const char * support_lib
Definition: pipewire.c:83
utils.h
stream.h
spa_log::level
enum spa_log_level level
Logging level, everything above this level is not logged.
Definition: build-12683127/doc/spa/support/log.h:69
spa_support::data
void * data
Definition: plugin.h:91
type.h
support::i18n_domain
char * i18n_domain
Definition: pipewire.c:85
spa_handle
Definition: plugin.h:44
buffers.h
SPA_HANDLE_FACTORY_ENUM_FUNC_NAME
#define SPA_HANDLE_FACTORY_ENUM_FUNC_NAME
Definition: plugin.h:196
spa_list_init
void spa_list_init(struct spa_list *list)
Definition: list.h:44
support::support
struct spa_support support[MAX_SUPPORT]
Definition: pipewire.c:87
spa_dict
Definition: utils/dict.h:48
cpu.h
handle::SPA_ALIGNED
struct spa_handle handle SPA_ALIGNED(8)
map.h
support::no_color
unsigned int no_color
Definition: pipewire.c:90
keys.h
proxy.h
thread-loop.h
support::n_support
uint32_t n_support
Definition: pipewire.c:88
pw_debug_is_category_enabled
bool pw_debug_is_category_enabled(const char *name)
Check if a debug category is enabled.
Definition: pipewire.c:594
support::registry
struct registry * registry
Definition: pipewire.c:84
spa_strerror
#define spa_strerror(err)
Definition: result.h:51
support::i18n_iface
struct spa_interface i18n_iface
Definition: pipewire.c:86
registry::plugins
struct spa_list plugins
Definition: pipewire.c:77
support::in_valgrind
unsigned int in_valgrind
Definition: pipewire.c:89
pw_log_debug
#define pw_log_debug(...)
Definition: src/pipewire/log.h:89
pw_in_valgrind
bool pw_in_valgrind(void)
Definition: pipewire.c:687
plugin::hnd
void * hnd
Definition: pipewire.c:62
spa_handle_get_interface
#define spa_handle_get_interface(h,...)
Definition: plugin.h:73
SPA_MIN
#define SPA_MIN(a, b)
Definition: defs.h:123
spa_handle_factory_enum_func_t
int(* spa_handle_factory_enum_func_t)(const struct spa_handle_factory **factory, uint32_t *index)
The function signature of the entry point in a plugin.
Definition: plugin.h:193
spa_i18n_text
const char * spa_i18n_text(struct spa_i18n *i18n, const char *msgid)
Definition: build-12683127/doc/spa/support/i18n.h:72
SPA_ID_INVALID
#define SPA_ID_INVALID
Definition: defs.h:182
pw_log_set_level
void pw_log_set_level(enum spa_log_level level)
Configure the logging level.
Definition: log.c:71
pw_unload_spa_handle
int pw_unload_spa_handle(struct spa_handle *handle)
Definition: pipewire.c:321
main-loop.h
spa_handle_clear
#define spa_handle_clear(h)
Definition: plugin.h:74
SPA_KEY_CPU_FORCE
#define SPA_KEY_CPU_FORCE
keys can be given when initializing the cpu handle
Definition: cpu.h:151
SPA_TYPE_INTERFACE_Log
#define SPA_TYPE_INTERFACE_Log
The Log interface.
Definition: build-12683127/doc/spa/support/log.h:58
pw_log_get
struct spa_log * pw_log_get(void)
Get the log interface.
Definition: log.c:62
spa_memzero
#define spa_memzero(x, l)
Definition: defs.h:302
pw_log_is_default
bool pw_log_is_default(void)
Definition: log.c:53
handle::link
struct spa_list link
Definition: pipewire.c:69
pw_log_warn
#define pw_log_warn(...)
Definition: src/pipewire/log.h:87
registry
Definition: pipewire.c:76
core.h
context.h
plugin::link
struct spa_list link
Definition: pipewire.c:60
support::plugin_dir
const char * plugin_dir
Definition: pipewire.c:82
pw_load_spa_handle
struct spa_handle * pw_load_spa_handle(const char *lib, const char *factory_name, const struct spa_dict *info, uint32_t n_support, const struct spa_support support[])
Definition: pipewire.c:242
pw_log_info
#define pw_log_info(...)
Definition: src/pipewire/log.h:88
i18n.h
spa_handle_factory_init
#define spa_handle_factory_init(h,...)
Definition: plugin.h:181
node.h
SPA_KEY_LOG_LEVEL
#define SPA_KEY_LOG_LEVEL
keys can be given when initializing the logger handle
Definition: build-12683127/doc/spa/support/log.h:180
pw_check_option
bool pw_check_option(const char *option, const char *value)
Definition: pipewire.c:693
pipewire.h
properties.h
names.h
spa_handle_factory::name
const char * name
The name of the factory contains a logical name that describes the function of the handle.
Definition: plugin.h:126
spa_support
Extra supporting infrastructure passed to the init() function of a factory.
Definition: plugin.h:89
pw_log_set
void pw_log_set(struct spa_log *log)
Configure a logging module.
Definition: log.c:47
SPA_NAME_SUPPORT_CPU
#define SPA_NAME_SUPPORT_CPU
for factory names
Definition: names.h:41
handle::plugin
struct plugin * plugin
Definition: pipewire.c:70
pw_set_domain
int pw_set_domain(const char *domain)
Definition: pipewire.c:357
filter.h
spa_handle_factory_get_size
#define spa_handle_factory_get_size(h,...)
Definition: plugin.h:180
SPA_TYPE_INTERFACE_CPU
#define SPA_TYPE_INTERFACE_CPU
The CPU features interface.
Definition: cpu.h:49
spa_handle_factory::version
uint32_t version
Definition: plugin.h:112
spa_atob
bool spa_atob(const char *str)
Convert str to a boolean.
Definition: string.h:213
client.h
pw_get_library_version
const char * pw_get_library_version(void)
Get the currently running version.
Definition: pipewire.c:740
pw_direction
#define pw_direction
The direction of a port.
Definition: port.h:56
plugin::filename
char * filename
Definition: pipewire.c:61
log.h
support
Definition: pipewire.c:80
support::categories
char ** categories
Definition: pipewire.c:81
spa_handle_factory
Definition: plugin.h:109
SPA_KEY_LOG_LINE
#define SPA_KEY_LOG_LINE
log file and line numbers
Definition: build-12683127/doc/spa/support/log.h:185
pw_get_domain
const char * pw_get_domain(void)
Definition: pipewire.c:368
SPA_KEY_CPU_VM_TYPE
#define SPA_KEY_CPU_VM_TYPE
force a VM type
Definition: cpu.h:152
pw_log_error
#define pw_log_error(...)
Definition: src/pipewire/log.h:86
spa_list_append
#define spa_list_append(list, item)
Definition: list.h:81