PipeWire 1.6.5

Loading...
Searching...
No Matches
factory.h
Go to the documentation of this file.
1/* PipeWire */
2/* SPDX-FileCopyrightText: Copyright © 2018 Wim Taymans */
3/* SPDX-License-Identifier: MIT */
4
5#ifndef PIPEWIRE_FACTORY_H
6#define PIPEWIRE_FACTORY_H
7
8#include <stdarg.h>
9#include <errno.h>
10
11#include <spa/utils/defs.h>
12#include <spa/utils/hook.h>
13
14#include <pipewire/proxy.h>
15
16#ifdef __cplusplus
17 extern "C" {
18#endif
19
23
28#define PW_TYPE_INTERFACE_Factory PW_TYPE_INFO_INTERFACE_BASE "Factory"
29
30#define PW_FACTORY_PERM_MASK PW_PERM_R|PW_PERM_M
31
32#define PW_VERSION_FACTORY 3
33 struct pw_factory;
34
35#ifndef PW_API_FACTORY_IMPL
36#define PW_API_FACTORY_IMPL static inline
37#endif
38
40 struct pw_factory_info {
41 uint32_t id;
42 const char *name;
43 const char *type;
44 uint32_t version;
45#define PW_FACTORY_CHANGE_MASK_PROPS (1 << 0)
46#define PW_FACTORY_CHANGE_MASK_ALL ((1 << 1)-1)
47 uint64_t change_mask;
48 struct spa_dict *props;
49};
50
51 struct pw_factory_info *
52 pw_factory_info_update(struct pw_factory_info *info,
53 const struct pw_factory_info *update);
54 struct pw_factory_info *
55 pw_factory_info_merge(struct pw_factory_info *info,
56 const struct pw_factory_info *update, bool reset);
57 void
58 pw_factory_info_free(struct pw_factory_info *info);
59
60
61#define PW_FACTORY_EVENT_INFO 0
62#define PW_FACTORY_EVENT_NUM 1
63
65 struct pw_factory_events {
66#define PW_VERSION_FACTORY_EVENTS 0
67 uint32_t version;
73 void (*info) (void *data, const struct pw_factory_info *info);
74};
75
76#define PW_FACTORY_METHOD_ADD_LISTENER 0
77#define PW_FACTORY_METHOD_NUM 1
78
80 struct pw_factory_methods {
81#define PW_VERSION_FACTORY_METHODS 0
82 uint32_t version;
83
84 int (*add_listener) (void *object,
85 struct spa_hook *listener,
86 const struct pw_factory_events *events,
87 void *data);
88};
89
92 PW_API_FACTORY_IMPL int pw_factory_add_listener(struct pw_factory *object,
93 struct spa_hook *listener,
94 const struct pw_factory_events *events,
95 void *data)
96{
97 return spa_api_method_r(int, -ENOTSUP,
98 pw_factory, (struct spa_interface*)object, add_listener, 0,
99 listener, events, data);
100}
101
105
106#ifdef __cplusplus
107} /* extern "C" */
108#endif
109
110#endif /* PIPEWIRE_FACTORY_H */
defs.h
spa/utils/defs.h
id
uint32_t id
Definition core.h:432
pw_factory_info_merge
struct pw_factory_info * pw_factory_info_merge(struct pw_factory_info *info, const struct pw_factory_info *update, bool reset)
Definition introspect.c:316
pw_factory_info_update
struct pw_factory_info * pw_factory_info_update(struct pw_factory_info *info, const struct pw_factory_info *update)
Definition introspect.c:345
pw_factory_add_listener
PW_API_FACTORY_IMPL int pw_factory_add_listener(struct pw_factory *object, struct spa_hook *listener, const struct pw_factory_events *events, void *data)
Definition factory.h:109
pw_factory_info_free
void pw_factory_info_free(struct pw_factory_info *info)
Definition introspect.c:352
PW_API_FACTORY_IMPL
#define PW_API_FACTORY_IMPL
Definition factory.h:45
spa_api_method_r
#define spa_api_method_r(rtype, def, type, o, method, version,...)
Definition hook.h:291
hook.h
spa/utils/hook.h
proxy.h
pipewire/proxy.h
pw_factory_events
Factory events.
Definition factory.h:78
pw_factory_events::version
uint32_t version
Definition factory.h:81
pw_factory_info
The factory information.
Definition factory.h:49
pw_factory_info::version
uint32_t version
version of the objects
Definition factory.h:53
pw_factory_info::type
const char * type
type of the objects created by this factory
Definition factory.h:52
pw_factory_info::change_mask
uint64_t change_mask
bitfield of changed fields since last call
Definition factory.h:58
pw_factory_methods
Factory methods.
Definition factory.h:96
pw_factory_methods::add_listener
int(* add_listener)(void *object, struct spa_hook *listener, const struct pw_factory_events *events, void *data)
Definition factory.h:101
pw_factory
spa_dict
Definition dict.h:51
spa_hook
A hook, contains the structure with functions and the data passed to the functions.
Definition hook.h:427
spa_interface
Definition hook.h:148