PipeWire 0.3.65
metadata.h
Go to the documentation of this file.
1/* PipeWire
2 *
3 * Copyright © 2019 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_METADATA_H
26#define PIPEWIRE_EXT_METADATA_H
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
32#include <spa/utils/defs.h>
33
42#define PW_TYPE_INTERFACE_Metadata PW_TYPE_INFO_INTERFACE_BASE "Metadata"
43
44#define PW_VERSION_METADATA 3
45struct pw_metadata;
46
47#define PW_EXTENSION_MODULE_METADATA PIPEWIRE_MODULE_PREFIX "module-metadata"
48
49#define PW_METADATA_EVENT_PROPERTY 0
50#define PW_METADATA_EVENT_NUM 1
53struct pw_metadata_events {
54#define PW_VERSION_METADATA_EVENTS 0
55 uint32_t version;
56
57 int (*property) (void *data,
58 uint32_t subject,
59 const char *key,
60 const char *type,
61 const char *value);
62};
64#define PW_METADATA_METHOD_ADD_LISTENER 0
65#define PW_METADATA_METHOD_SET_PROPERTY 1
66#define PW_METADATA_METHOD_CLEAR 2
67#define PW_METADATA_METHOD_NUM 3
71#define PW_VERSION_METADATA_METHODS 0
72 uint32_t version;
73
74 int (*add_listener) (void *object,
75 struct spa_hook *listener,
76 const struct pw_metadata_events *events,
77 void *data);
79 int (*set_property) (void *object,
80 uint32_t subject,
81 const char *key,
82 const char *type,
83 const char *value);
84
85 int (*clear) (void *object);
86};
89#define pw_metadata_method(o,method,version,...) \
90({ \
91 int _res = -ENOTSUP; \
92 spa_interface_call_res((struct spa_interface*)o, \
93 struct pw_metadata_methods, _res, \
94 method, version, ##__VA_ARGS__); \
95 _res; \
96})
97
98#define pw_metadata_add_listener(c,...) pw_metadata_method(c,add_listener,0,__VA_ARGS__)
99#define pw_metadata_set_property(c,...) pw_metadata_method(c,set_property,0,__VA_ARGS__)
100#define pw_metadata_clear(c) pw_metadata_method(c,clear,0)
102#define PW_KEY_METADATA_NAME "metadata.name"
103
108#ifdef __cplusplus
109} /* extern "C" */
110#endif
111
112#endif /* PIPEWIRE_EXT_METADATA_H */
spa/utils/defs.h
Metadata events
Definition: metadata.h:63
uint32_t version
Definition: metadata.h:66
int(* property)(void *data, uint32_t subject, const char *key, const char *type, const char *value)
Definition: metadata.h:68
Metadata methods
Definition: metadata.h:85
int(* clear)(void *object)
Definition: metadata.h:101
int(* add_listener)(void *object, struct spa_hook *listener, const struct pw_metadata_events *events, void *data)
Definition: metadata.h:90
int(* set_property)(void *object, uint32_t subject, const char *key, const char *type, const char *value)
Definition: metadata.h:95
uint32_t version
Definition: metadata.h:88
A hook, contains the structure with functions and the data passed to the functions.
Definition: hook.h:351