PipeWire: impl-metadata.h Source File

PipeWire 0.3.34

impl-metadata.h
Go to the documentation of this file.
1 /* PipeWire
2 *
3 * Copyright © 2021 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_IMPL_METADATA_H
26 #define PIPEWIRE_IMPL_METADATA_H
27
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31
41 struct pw_impl_metadata;
42
43 #include <pipewire/context.h>
44 #include <pipewire/impl-client.h>
45 #include <pipewire/global.h>
46 #include <pipewire/properties.h>
47 #include <pipewire/resource.h>
48
49 #include "pipewire/extensions/metadata.h"
50
52 struct pw_impl_metadata_events {
53 #define PW_VERSION_IMPL_METADATA_EVENTS 0
54 uint32_t version;
55
57 void (*destroy) (void *data);
59 void (*free) (void *data);
60
62 int (*property) (void *data,
63 uint32_t subject,
64 const char *key,
65 const char *type,
66 const char *value);
67 };
68
69 struct pw_impl_metadata *pw_context_create_metadata(struct pw_context *context,
70 const char *name, struct pw_properties *properties,
71 size_t user_data_size);
72
74 const struct pw_properties *pw_impl_metadata_get_properties(struct pw_impl_metadata *metadata);
75
76 int pw_impl_metadata_register(struct pw_impl_metadata *metadata,
77 struct pw_properties *properties);
78
79 void pw_impl_metadata_destroy(struct pw_impl_metadata *metadata);
80
81 void *pw_impl_metadata_get_user_data(struct pw_impl_metadata *metadata);
82
83 int pw_impl_metadata_set_implementation(struct pw_impl_metadata *metadata,
84 struct pw_metadata *impl);
85
86 struct pw_metadata *pw_impl_metadata_get_implementation(struct pw_impl_metadata *metadata);
87
89 struct pw_global *pw_impl_metadata_get_global(struct pw_impl_metadata *metadata);
90
92 void pw_impl_metadata_add_listener(struct pw_impl_metadata *metadata,
93 struct spa_hook *listener,
94 const struct pw_impl_metadata_events *events,
95 void *data);
96
98 int pw_impl_metadata_set_property(struct pw_impl_metadata *metadata,
99 uint32_t subject, const char *key, const char *type,
100 const char *value);
101
102 int pw_impl_metadata_set_propertyf(struct pw_impl_metadata *metadata,
103 uint32_t subject, const char *key, const char *type,
104 const char *fmt, ...) SPA_PRINTF_FUNC(5,6);
105
110 #ifdef __cplusplus
111 }
112 #endif
113
114 #endif /* PIPEWIRE_IMPL_METADATA_H */
context.h
global.h
pw_impl_metadata_set_propertyf
int pw_impl_metadata_set_propertyf(struct pw_impl_metadata *metadata, uint32_t subject, const char *key, const char *type, const char *fmt,...) 1(5
pw_impl_metadata_get_user_data
void * pw_impl_metadata_get_user_data(struct pw_impl_metadata *metadata)
Definition: impl-metadata.c:547
pw_impl_metadata_register
int pw_impl_metadata_register(struct pw_impl_metadata *metadata, struct pw_properties *properties)
Definition: impl-metadata.c:508
pw_impl_metadata_set_implementation
int pw_impl_metadata_set_implementation(struct pw_impl_metadata *metadata, struct pw_metadata *impl)
Definition: impl-metadata.c:320
pw_impl_metadata_get_global
struct pw_global * pw_impl_metadata_get_global(struct pw_impl_metadata *metadata)
Get the global of this metadata.
Definition: impl-metadata.c:553
pw_impl_metadata_get_properties
const struct pw_properties * pw_impl_metadata_get_properties(struct pw_impl_metadata *metadata)
Get the metadata properties.
pw_impl_metadata_add_listener
void pw_impl_metadata_add_listener(struct pw_impl_metadata *metadata, struct spa_hook *listener, const struct pw_impl_metadata_events *events, void *data)
Add an event listener.
Definition: impl-metadata.c:559
pw_context_create_metadata
struct pw_impl_metadata * pw_context_create_metadata(struct pw_context *context, const char *name, struct pw_properties *properties, size_t user_data_size)
Definition: impl-metadata.c:276
pw_impl_metadata_set_property
int pw_impl_metadata_set_property(struct pw_impl_metadata *metadata, uint32_t subject, const char *key, const char *type, const char *value)
Set a property.
Definition: impl-metadata.c:568
pw_impl_metadata_get_implementation
struct pw_metadata * pw_impl_metadata_get_implementation(struct pw_impl_metadata *metadata)
Definition: impl-metadata.c:340
pw_impl_metadata_destroy
void pw_impl_metadata_destroy(struct pw_impl_metadata *metadata)
Definition: impl-metadata.c:346
SPA_PRINTF_FUNC
#define SPA_PRINTF_FUNC(fmt, arg1)
Definition: defs.h:205
impl-client.h
name
const char * name
Definition: media-session.c:2379
properties.h
resource.h
data
user data to add to an object
Definition: filter.c:75
impl
Definition: control.c:33
metadata
Definition: impl-metadata.c:43
pw_impl_metadata_events
Metadata events, listen to them with pw_impl_metadata_add_listener.
Definition: impl-metadata.h:52
pw_impl_metadata_events::destroy
void(* destroy)(void *data)
the metadata is destroyed
Definition: impl-metadata.h:57
pw_impl_metadata_events::property
int(* property)(void *data, uint32_t subject, const char *key, const char *type, const char *value)
a property changed
Definition: impl-metadata.h:62
pw_impl_metadata_events::free
void(* free)(void *data)
the metadata is freed
Definition: impl-metadata.h:59
pw_impl_metadata_events::version
uint32_t version
Definition: impl-metadata.h:54
pw_properties
Definition: properties.h:49
spa_hook
A hook, contains the structure with functions and the data passed to the functions.
Definition: hook.h:295