PipeWire  0.3.45
profiler.h
Go to the documentation of this file.
1 /* PipeWire
2  *
3  * Copyright © 2020 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_EXT_PROFILER_H
26 #define PIPEWIRE_EXT_PROFILER_H
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 #include <spa/utils/defs.h>
33 
42 #define PW_TYPE_INTERFACE_Profiler PW_TYPE_INFO_INTERFACE_BASE "Profiler"
43 
44 #define PW_VERSION_PROFILER 3
45 struct pw_profiler;
46 
47 #define PW_EXTENSION_MODULE_PROFILER PIPEWIRE_MODULE_PREFIX "module-profiler"
48 
49 #define PW_PROFILER_EVENT_PROFILE 0
50 #define PW_PROFILER_EVENT_NUM 1
51 
53 struct pw_profiler_events {
54 #define PW_VERSION_PROFILER_EVENTS 0
55  uint32_t version;
56 
57  void (*profile) (void *object, const struct spa_pod *pod);
58 };
59 
60 #define PW_PROFILER_METHOD_ADD_LISTENER 0
61 #define PW_PROFILER_METHOD_NUM 1
62 
64 struct pw_profiler_methods {
65 #define PW_VERSION_PROFILER_METHODS 0
66  uint32_t version;
67 
68  int (*add_listener) (void *object,
69  struct spa_hook *listener,
70  const struct pw_profiler_events *events,
71  void *data);
72 };
73 
74 #define pw_profiler_method(o,method,version,...) \
75 ({ \
76  int _res = -ENOTSUP; \
77  spa_interface_call_res((struct spa_interface*)o, \
78  struct pw_profiler_methods, _res, \
79  method, version, ##__VA_ARGS__); \
80  _res; \
81 })
82 
83 #define pw_profiler_add_listener(c,...) pw_profiler_method(c,add_listener,0,__VA_ARGS__)
84 
85 #define PW_KEY_PROFILER_NAME "profiler.name"
86 
91 #ifdef __cplusplus
92 } /* extern "C" */
93 #endif
94 
95 #endif /* PIPEWIRE_EXT_PROFILER_H */
spa/utils/defs.h
Profiler events
Definition: profiler.h:63
uint32_t version
Definition: profiler.h:66
void(* profile)(void *object, const struct spa_pod *pod)
Definition: profiler.h:68
Profiler methods
Definition: profiler.h:77
int(* add_listener)(void *object, struct spa_hook *listener, const struct pw_profiler_events *events, void *data)
Definition: profiler.h:82
A hook, contains the structure with functions and the data passed to the functions.
Definition: hook.h:342
Definition: pod.h:63