PipeWire  0.3.66
metadata.h
Go to the documentation of this file.
1 /* PipeWire */
2 /* SPDX-FileCopyrightText: Copyright © 2019 Wim Taymans */
3 /* SPDX-License-Identifier: MIT */
4 
5 #ifndef PIPEWIRE_EXT_METADATA_H
6 #define PIPEWIRE_EXT_METADATA_H
7 
8 #ifdef __cplusplus
9 extern "C" {
10 #endif
11 
12 #include <spa/utils/defs.h>
13 
22 #define PW_TYPE_INTERFACE_Metadata PW_TYPE_INFO_INTERFACE_BASE "Metadata"
23 
24 #define PW_VERSION_METADATA 3
25 struct pw_metadata;
26 
27 #define PW_EXTENSION_MODULE_METADATA PIPEWIRE_MODULE_PREFIX "module-metadata"
28 
29 #define PW_METADATA_EVENT_PROPERTY 0
30 #define PW_METADATA_EVENT_NUM 1
31 
33 struct pw_metadata_events {
34 #define PW_VERSION_METADATA_EVENTS 0
35  uint32_t version;
36 
37  int (*property) (void *data,
38  uint32_t subject,
39  const char *key,
40  const char *type,
41  const char *value);
42 };
43 
44 #define PW_METADATA_METHOD_ADD_LISTENER 0
45 #define PW_METADATA_METHOD_SET_PROPERTY 1
46 #define PW_METADATA_METHOD_CLEAR 2
47 #define PW_METADATA_METHOD_NUM 3
48 
50 struct pw_metadata_methods {
51 #define PW_VERSION_METADATA_METHODS 0
52  uint32_t version;
53 
54  int (*add_listener) (void *object,
55  struct spa_hook *listener,
56  const struct pw_metadata_events *events,
57  void *data);
58 
59  int (*set_property) (void *object,
60  uint32_t subject,
61  const char *key,
62  const char *type,
63  const char *value);
64 
65  int (*clear) (void *object);
66 };
67 
68 
69 #define pw_metadata_method(o,method,version,...) \
70 ({ \
71  int _res = -ENOTSUP; \
72  spa_interface_call_res((struct spa_interface*)o, \
73  struct pw_metadata_methods, _res, \
74  method, version, ##__VA_ARGS__); \
75  _res; \
76 })
77 
78 #define pw_metadata_add_listener(c,...) pw_metadata_method(c,add_listener,0,__VA_ARGS__)
79 #define pw_metadata_set_property(c,...) pw_metadata_method(c,set_property,0,__VA_ARGS__)
80 #define pw_metadata_clear(c) pw_metadata_method(c,clear,0)
81 
82 #define PW_KEY_METADATA_NAME "metadata.name"
83 
88 #ifdef __cplusplus
89 } /* extern "C" */
90 #endif
91 
92 #endif /* PIPEWIRE_EXT_METADATA_H */
spa/utils/defs.h
Metadata events
Definition: metadata.h:43
uint32_t version
Definition: metadata.h:46
int(* property)(void *data, uint32_t subject, const char *key, const char *type, const char *value)
Definition: metadata.h:48
Metadata methods
Definition: metadata.h:65
int(* clear)(void *object)
Definition: metadata.h:81
int(* add_listener)(void *object, struct spa_hook *listener, const struct pw_metadata_events *events, void *data)
Definition: metadata.h:70
int(* set_property)(void *object, uint32_t subject, const char *key, const char *type, const char *value)
Definition: metadata.h:75
uint32_t version
Definition: metadata.h:68
A hook, contains the structure with functions and the data passed to the functions.
Definition: hook.h:331