| 1 |
/* PipeWire */ |
| 2 |
/* SPDX-FileCopyrightText: Copyright © 2020 Wim Taymans */ |
| 3 |
/* SPDX-License-Identifier: MIT */ |
| 4 |
|
| 5 |
#ifndef PIPEWIRE_EXT_PROFILER_H |
| 6 |
#define PIPEWIRE_EXT_PROFILER_H |
| 7 |
|
| 8 |
#include <pw-headers/spa/utils/defs.h> |
| 9 |
|
| 10 |
#ifdef __cplusplus |
| 11 |
extern "C" { |
| 12 |
#endif |
| 13 |
|
| 14 |
/** \defgroup pw_profiler Profiler |
| 15 |
* Profiler interface |
| 16 |
*/ |
| 17 |
|
| 18 |
/** |
| 19 |
* \addtogroup pw_profiler |
| 20 |
* \{ |
| 21 |
*/ |
| 22 |
#define PW_TYPE_INTERFACE_Profiler PW_TYPE_INFO_INTERFACE_BASE "Profiler" |
| 23 |
|
| 24 |
#define PW_VERSION_PROFILER 3 |
| 25 |
struct pw_profiler; |
| 26 |
|
| 27 |
#ifndef PW_API_PROFILER |
| 28 |
#define PW_API_PROFILER static inline |
| 29 |
#endif |
| 30 |
|
| 31 |
#define PW_EXTENSION_MODULE_PROFILER PIPEWIRE_MODULE_PREFIX "module-profiler" |
| 32 |
|
| 33 |
#define PW_PROFILER_PERM_MASK PW_PERM_R |
| 34 |
|
| 35 |
#define PW_PROFILER_EVENT_PROFILE 0 |
| 36 |
#define PW_PROFILER_EVENT_NUM 1 |
| 37 |
|
| 38 |
/** \ref pw_profiler events */ |
| 39 |
struct pw_profiler_events { |
| 40 |
#define PW_VERSION_PROFILER_EVENTS 0 |
| 41 |
uint32_t version; |
| 42 |
|
| 43 |
void (*profile) (void *data, const struct spa_pod *pod); |
| 44 |
}; |
| 45 |
|
| 46 |
#define PW_PROFILER_METHOD_ADD_LISTENER 0 |
| 47 |
#define PW_PROFILER_METHOD_NUM 1 |
| 48 |
|
| 49 |
/** \ref pw_profiler methods */ |
| 50 |
struct pw_profiler_methods { |
| 51 |
#define PW_VERSION_PROFILER_METHODS 0 |
| 52 |
uint32_t version; |
| 53 |
|
| 54 |
int (*add_listener) (void *object, |
| 55 |
struct spa_hook *listener, |
| 56 |
const struct pw_profiler_events *events, |
| 57 |
void *data); |
| 58 |
}; |
| 59 |
|
| 60 |
/** \copydoc pw_profiler_methods.add_listener |
| 61 |
* \sa pw_profiler_methods.add_listener */ |
| 62 |
PW_API_PROFILER int pw_profiler_add_listener(struct pw_profiler *object, |
| 63 |
struct spa_hook *listener, |
| 64 |
const struct pw_profiler_events *events, |
| 65 |
void *data) |
| 66 |
{ |
| 67 |
return spa_api_method_r(int, -ENOTSUP, |
| 68 |
pw_profiler, (struct spa_interface*)object, add_listener, 0, |
| 69 |
listener, events, data); |
| 70 |
} |
| 71 |
|
| 72 |
#define PW_KEY_PROFILER_NAME "profiler.name" |
| 73 |
|
| 74 |
/** |
| 75 |
* \} |
| 76 |
*/ |
| 77 |
|
| 78 |
#ifdef __cplusplus |
| 79 |
} /* extern "C" */ |
| 80 |
#endif |
| 81 |
|
| 82 |
#endif /* PIPEWIRE_EXT_PROFILER_H */ |