PipeWire  0.3.33
factory.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_FACTORY_H
26 #define PIPEWIRE_FACTORY_H
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 #include <stdarg.h>
33 #include <errno.h>
34 
35 #include <spa/utils/defs.h>
36 #include <spa/utils/hook.h>
37 
38 #include <pipewire/proxy.h>
39 
40 #define PW_TYPE_INTERFACE_Factory PW_TYPE_INFO_INTERFACE_BASE "Factory"
41 
42 #define PW_VERSION_FACTORY 3
43 struct pw_factory;
44 
47  uint32_t id;
48  const char *name;
49  const char *type;
50  uint32_t version;
51 #define PW_FACTORY_CHANGE_MASK_PROPS (1 << 0)
52 #define PW_FACTORY_CHANGE_MASK_ALL ((1 << 1)-1)
53  uint64_t change_mask;
54  struct spa_dict *props;
55 };
56 
57 struct pw_factory_info *
59  const struct pw_factory_info *update);
60 
61 void
63 
64 
65 #define PW_FACTORY_EVENT_INFO 0
66 #define PW_FACTORY_EVENT_NUM 1
67 
70 #define PW_VERSION_FACTORY_EVENTS 0
71  uint32_t version;
77  void (*info) (void *object, const struct pw_factory_info *info);
78 };
79 
80 #define PW_FACTORY_METHOD_ADD_LISTENER 0
81 #define PW_FACTORY_METHOD_NUM 1
82 
85 #define PW_VERSION_FACTORY_METHODS 0
86  uint32_t version;
87 
88  int (*add_listener) (void *object,
89  struct spa_hook *listener,
90  const struct pw_factory_events *events,
91  void *data);
92 };
93 
94 #define pw_factory_method(o,method,version,...) \
95 ({ \
96  int _res = -ENOTSUP; \
97  spa_interface_call_res((struct spa_interface*)o, \
98  struct pw_factory_methods, _res, \
99  method, version, ##__VA_ARGS__); \
100  _res; \
101 })
102 
103 #define pw_factory_add_listener(c,...) pw_factory_method(c,add_listener,0,__VA_ARGS__)
104 
105 #ifdef __cplusplus
106 } /* extern "C" */
107 #endif
108 
109 #endif /* PIPEWIRE_FACTORY_H */
pw_factory_methods
Factory methods.
Definition: factory.h:84
pw_factory_info::change_mask
uint64_t change_mask
bitfield of changed fields since last call
Definition: factory.h:53
pw_factory_info::type
const char * type
type of the objects created by this factory
Definition: factory.h:49
data
user data to add to an object
Definition: filter.c:75
pw_factory_events::version
uint32_t version
Definition: factory.h:71
pw_factory_info::id
uint32_t id
id of the global
Definition: factory.h:47
pw_factory_methods::version
uint32_t version
Definition: factory.h:86
pw_factory_events
Factory events.
Definition: factory.h:69
pw_factory_events::info
void(* info)(void *object, const struct pw_factory_info *info)
Notify factory info.
Definition: factory.h:77
pw_factory_info_free
void pw_factory_info_free(struct pw_factory_info *info)
Definition: introspect.c:320
spa_hook
A hook, contains the structure with functions and the data passed to the functions.
Definition: hook.h:295
spa_dict
Definition: utils/dict.h:48
proxy.h
pw_factory_info::version
uint32_t version
version of the objects
Definition: factory.h:50
pw_factory_info
The factory information.
Definition: factory.h:46
pw_factory_info::props
struct spa_dict * props
the properties of the factory
Definition: factory.h:54
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:293
defs.h
pw_factory_info::name
const char * name
name the factory
Definition: factory.h:48
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:88
hook.h