PipeWire: pipewire/extensions/metadata.h Source File

PipeWire 1.2.0

Loading...
Searching...
No Matches
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
9extern "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_METADATA_PERM_MASK PW_PERM_RWX
25
26#define PW_VERSION_METADATA 3
27 struct pw_metadata;
28
29#define PW_EXTENSION_MODULE_METADATA PIPEWIRE_MODULE_PREFIX "module-metadata"
30
31#define PW_METADATA_EVENT_PROPERTY 0
32#define PW_METADATA_EVENT_NUM 1
33
34
36struct pw_metadata_events {
37#define PW_VERSION_METADATA_EVENTS 0
38 uint32_t version;
39
40 int (*property) (void *data,
41 uint32_t subject,
42 const char *key,
43 const char *type,
44 const char *value);
45};
46
47#define PW_METADATA_METHOD_ADD_LISTENER 0
48#define PW_METADATA_METHOD_SET_PROPERTY 1
49#define PW_METADATA_METHOD_CLEAR 2
50#define PW_METADATA_METHOD_NUM 3
51
53struct pw_metadata_methods {
54#define PW_VERSION_METADATA_METHODS 0
55 uint32_t version;
56
57 int (*add_listener) (void *object,
58 struct spa_hook *listener,
59 const struct pw_metadata_events *events,
60 void *data);
61
78 int (*set_property) (void *object,
79 uint32_t subject,
80 const char *key,
81 const char *type,
82 const char *value);
83
89 int (*clear) (void *object);
90};
91
92
93#define pw_metadata_method(o,method,version,...) \
94({ \
95 int _res = -ENOTSUP; \
96 spa_interface_call_res((struct spa_interface*)o, \
97 struct pw_metadata_methods, _res, \
98 method, version, ##__VA_ARGS__); \
99 _res; \
100})
101
102#define pw_metadata_add_listener(c,...) pw_metadata_method(c,add_listener,0,__VA_ARGS__)
103#define pw_metadata_set_property(c,...) pw_metadata_method(c,set_property,0,__VA_ARGS__)
104#define pw_metadata_clear(c) pw_metadata_method(c,clear,0)
105
106#define PW_KEY_METADATA_NAME "metadata.name"
107#define PW_KEY_METADATA_VALUES "metadata.values"
108
113#ifdef __cplusplus
114} /* extern "C" */
115#endif
116
117#endif /* PIPEWIRE_EXT_METADATA_H */
defs.h
spa/utils/defs.h
pw_metadata_events
Metadata events
Definition metadata.h:47
pw_metadata_events::version
uint32_t version
Definition metadata.h:50
pw_metadata_events::property
int(* property)(void *data, uint32_t subject, const char *key, const char *type, const char *value)
Definition metadata.h:52
pw_metadata_methods
Metadata methods
Definition metadata.h:69
pw_metadata_methods::clear
int(* clear)(void *object)
Clear all metadata.
Definition metadata.h:106
pw_metadata_methods::add_listener
int(* add_listener)(void *object, struct spa_hook *listener, const struct pw_metadata_events *events, void *data)
Definition metadata.h:74
pw_metadata_methods::set_property
int(* set_property)(void *object, uint32_t subject, const char *key, const char *type, const char *value)
Set a metadata property.
Definition metadata.h:95
pw_metadata_methods::version
uint32_t version
Definition metadata.h:72
pw_metadata
spa_hook
A hook, contains the structure with functions and the data passed to the functions.
Definition hook.h:350