+ +
2da5fe7 OpenAVX v0.2.0 - High-performance open-standard IP audio and video transport suite
saifmukhtar · 2026-11-24
main
| 1 | /* PipeWire */ |
| 2 | /* SPDX-FileCopyrightText: Copyright © 2021 Wim Taymans */ |
| 3 | /* SPDX-License-Identifier: MIT */ |
| 4 | |
| 5 | #ifndef PIPEWIRE_IMPL_METADATA_H |
| 6 | #define PIPEWIRE_IMPL_METADATA_H |
| 7 | |
| 8 | #ifdef __cplusplus |
| 9 | extern "C" { |
| 10 | #endif |
| 11 | |
| 12 | /** \defgroup pw_impl_metadata Metadata Impl |
| 13 | * |
| 14 | * The metadata is used to store key/type/value pairs per object id. |
| 15 | */ |
| 16 | |
| 17 | /** |
| 18 | * \addtogroup pw_impl_metadata |
| 19 | * \{ |
| 20 | */ |
| 21 | struct pw_impl_metadata; |
| 22 | |
| 23 | #include <pipewire/context.h> |
| 24 | #include <pipewire/impl-client.h> |
| 25 | #include <pipewire/global.h> |
| 26 | #include <pipewire/properties.h> |
| 27 | #include <pipewire/resource.h> |
| 28 | |
| 29 | #include "pipewire/extensions/metadata.h" |
| 30 | |
| 31 | /** Metadata events, listen to them with \ref pw_impl_metadata_add_listener */ |
| 32 | struct pw_impl_metadata_events { |
| 33 | #define PW_VERSION_IMPL_METADATA_EVENTS 0 |
| 34 | uint32_t version; |
| 35 | |
| 36 | /** the metadata is destroyed */ |
| 37 | void (*destroy) (void *data); |
| 38 | /** the metadata is freed */ |
| 39 | void (*free) (void *data); |
| 40 | |
| 41 | /** a property changed */ |
| 42 | int (*property) (void *data, |
| 43 | uint32_t subject, |
| 44 | const char *key, |
| 45 | const char *type, |
| 46 | const char *value); |
| 47 | }; |
| 48 | |
| 49 | struct pw_impl_metadata *pw_context_create_metadata(struct pw_context *context, |
| 50 | const char *name, struct pw_properties *properties, |
| 51 | size_t user_data_size); |
| 52 | |
| 53 | /** Get the metadata properties */ |
| 54 | const struct pw_properties *pw_impl_metadata_get_properties(struct pw_impl_metadata *metadata); |
| 55 | |
| 56 | int pw_impl_metadata_register(struct pw_impl_metadata *metadata, |
| 57 | struct pw_properties *properties); |
| 58 | |
| 59 | void pw_impl_metadata_destroy(struct pw_impl_metadata *metadata); |
| 60 | |
| 61 | void *pw_impl_metadata_get_user_data(struct pw_impl_metadata *metadata); |
| 62 | |
| 63 | int pw_impl_metadata_set_implementation(struct pw_impl_metadata *metadata, |
| 64 | struct pw_metadata *impl); |
| 65 | |
| 66 | struct pw_metadata *pw_impl_metadata_get_implementation(struct pw_impl_metadata *metadata); |
| 67 | |
| 68 | /** Get the global of this metadata */ |
| 69 | struct pw_global *pw_impl_metadata_get_global(struct pw_impl_metadata *metadata); |
| 70 | |
| 71 | /** Add an event listener */ |
| 72 | void pw_impl_metadata_add_listener(struct pw_impl_metadata *metadata, |
| 73 | struct spa_hook *listener, |
| 74 | const struct pw_impl_metadata_events *events, |
| 75 | void *data); |
| 76 | |
| 77 | /** Set a property */ |
| 78 | int pw_impl_metadata_set_property(struct pw_impl_metadata *metadata, |
| 79 | uint32_t subject, const char *key, const char *type, |
| 80 | const char *value); |
| 81 | |
| 82 | int pw_impl_metadata_set_propertyf(struct pw_impl_metadata *metadata, |
| 83 | uint32_t subject, const char *key, const char *type, |
| 84 | const char *fmt, ...) SPA_PRINTF_FUNC(5,6); |
| 85 | |
| 86 | /** |
| 87 | * \} |
| 88 | */ |
| 89 | |
| 90 | #ifdef __cplusplus |
| 91 | } |
| 92 | #endif |
| 93 | |
| 94 | #endif /* PIPEWIRE_IMPL_METADATA_H */ |