PipeWire: factory.h Source File

PipeWire 0.3.67

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#ifdef __cplusplus
9extern "C" {
10#endif
11
12#include <stdarg.h>
13#include <errno.h>
14
15#include <spa/utils/defs.h>
16#include <spa/utils/hook.h>
17
18#include <pipewire/proxy.h>
19
28#define PW_TYPE_INTERFACE_Factory PW_TYPE_INFO_INTERFACE_BASE "Factory"
29
30#define PW_VERSION_FACTORY 3
31struct pw_factory;
32
34struct pw_factory_info {
35 uint32_t id;
36 const char *name;
37 const char *type;
38 uint32_t version;
39#define PW_FACTORY_CHANGE_MASK_PROPS (1 << 0)
40#define PW_FACTORY_CHANGE_MASK_ALL ((1 << 1)-1)
41 uint64_t change_mask;
42 struct spa_dict *props;
43};
44
45 struct pw_factory_info *
46 pw_factory_info_update(struct pw_factory_info *info,
47 const struct pw_factory_info *update);
48struct pw_factory_info *
49 pw_factory_info_merge(struct pw_factory_info *info,
50 const struct pw_factory_info *update, bool reset);
51void
52 pw_factory_info_free(struct pw_factory_info *info);
53
54
55#define PW_FACTORY_EVENT_INFO 0
56#define PW_FACTORY_EVENT_NUM 1
57
59struct pw_factory_events {
60#define PW_VERSION_FACTORY_EVENTS 0
61 uint32_t version;
67 void (*info) (void *data, const struct pw_factory_info *info);
68};
69
70#define PW_FACTORY_METHOD_ADD_LISTENER 0
71#define PW_FACTORY_METHOD_NUM 1
72
74struct pw_factory_methods {
75#define PW_VERSION_FACTORY_METHODS 0
76 uint32_t version;
77
78 int (*add_listener) (void *object,
79 struct spa_hook *listener,
80 const struct pw_factory_events *events,
81 void *data);
82};
83
84#define pw_factory_method(o,method,version,...) \
85({ \
86 int _res = -ENOTSUP; \
87 spa_interface_call_res((struct spa_interface*)o, \
88 struct pw_factory_methods, _res, \
89 method, version, ##__VA_ARGS__); \
90 _res; \
91})
92
93#define pw_factory_add_listener(c,...) pw_factory_method(c,add_listener,0,__VA_ARGS__)
94
99#ifdef __cplusplus
100} /* extern "C" */
101#endif
102
103#endif /* PIPEWIRE_FACTORY_H */
defs.h
spa/utils/defs.h
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:313
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:342
pw_factory_info_free
void pw_factory_info_free(struct pw_factory_info *info)
Definition: introspect.c:349
hook.h
spa/utils/hook.h
proxy.h
pipewire/proxy.h
pw_factory_events
Factory events.
Definition: factory.h:70
pw_factory_events::version
uint32_t version
Definition: factory.h:73
pw_factory_events::info
void(* info)(void *data, const struct pw_factory_info *info)
Notify factory info.
Definition: factory.h:79
pw_factory_info
The factory information.
Definition: factory.h:41
pw_factory_info::version
uint32_t version
version of the objects
Definition: factory.h:45
pw_factory_info::type
const char * type
type of the objects created by this factory
Definition: factory.h:44
pw_factory_info::id
uint32_t id
id of the global
Definition: factory.h:42
pw_factory_info::change_mask
uint64_t change_mask
bitfield of changed fields since last call
Definition: factory.h:50
pw_factory_methods
Factory methods.
Definition: factory.h:88
pw_factory_methods::version
uint32_t version
Definition: factory.h:91
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:93
pw_factory
spa_dict
Definition: utils/dict.h:39
spa_hook
A hook, contains the structure with functions and the data passed to the functions.
Definition: hook.h:331