PipeWire 0.3.60
meta.h
Go to the documentation of this file.
1/* Simple Plugin API
2 *
3 * Copyright © 2018 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 SPA_META_H
26#define SPA_META_H
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
32#include <spa/utils/defs.h>
33#include <spa/pod/pod.h>
34
40enum spa_meta_type {
52};
61struct spa_meta {
62 uint32_t type;
63 uint32_t size;
64 void *data;
65};
67static inline void *spa_meta_first(const struct spa_meta *m) {
68 return m->data;
70#define spa_meta_first spa_meta_first
71static inline void *spa_meta_end(const struct spa_meta *m) {
72 return SPA_PTROFF(m->data,m->size,void);
73}
74#define spa_meta_end spa_meta_end
75#define spa_meta_check(p,m) (SPA_PTROFF(p,sizeof(*(p)),void) <= spa_meta_end(m))
81struct spa_meta_header {
82#define SPA_META_HEADER_FLAG_DISCONT (1 << 0)
83#define SPA_META_HEADER_FLAG_CORRUPTED (1 << 1)
84#define SPA_META_HEADER_FLAG_MARKER (1 << 2)
85#define SPA_META_HEADER_FLAG_HEADER (1 << 3)
86#define SPA_META_HEADER_FLAG_GAP (1 << 4)
87#define SPA_META_HEADER_FLAG_DELTA_UNIT (1 << 5)
88 uint32_t flags;
89 uint32_t offset;
90 int64_t pts;
91 int64_t dts_offset;
92 uint64_t seq;
94};
95
97struct spa_meta_region {
99};
101static inline bool spa_meta_region_is_valid(const struct spa_meta_region *m) {
102 return m->region.size.width != 0 && m->region.size.height != 0;
104#define spa_meta_region_is_valid spa_meta_region_is_valid
105
107#define spa_meta_for_each(pos,meta) \
108 for ((pos) = (__typeof(pos))spa_meta_first(meta); \
109 spa_meta_check(pos, meta); \
110 (pos)++)
111
112#define spa_meta_bitmap_is_valid(m) ((m)->format != 0)
113
121struct spa_meta_bitmap {
122 uint32_t format;
125 struct spa_rectangle size;
126 int32_t stride;
127 uint32_t offset;
131};
133#define spa_meta_cursor_is_valid(m) ((m)->id != 0)
134
140struct spa_meta_cursor {
141 uint32_t id;
143 uint32_t flags;
145 struct spa_point hotspot;
147 uint32_t bitmap_offset;
157
159struct spa_meta_busy {
160 uint32_t flags;
161 uint32_t count;
162};
163
168#ifdef __cplusplus
169} /* extern "C" */
170#endif
172#endif /* SPA_META_H */
spa/utils/defs.h
#define spa_meta_region_is_valid
Definition: meta.h:115
#define spa_meta_end
Definition: meta.h:79
#define spa_meta_first
Definition: meta.h:75
spa_meta_type
Definition: meta.h:45
@ SPA_META_VideoDamage
array of struct spa_meta_region with damage, where an invalid entry or end-of-array marks the end.
Definition: meta.h:49
@ SPA_META_Bitmap
struct spa_meta_bitmap
Definition: meta.h:50
@ SPA_META_Cursor
struct spa_meta_cursor
Definition: meta.h:51
@ SPA_META_Busy
don't write to buffer when count > 0
Definition: meta.h:54
@ SPA_META_VideoCrop
struct spa_meta_region with cropping data
Definition: meta.h:48
@ SPA_META_Header
struct spa_meta_header
Definition: meta.h:47
@ SPA_META_Control
metadata contains a spa_meta_control associated with the data
Definition: meta.h:52
@ SPA_META_Invalid
Definition: meta.h:46
@ _SPA_META_LAST
not part of ABI/API
Definition: meta.h:56
#define SPA_PTROFF(ptr_, offset_, type_)
Return the address (buffer + offset) as pointer of type.
Definition: defs.h:210
spa/pod/pod.h
Bitmap information.
Definition: meta.h:132
struct spa_rectangle size
width and height of bitmap
Definition: meta.h:136
uint32_t format
bitmap video format, one of enum spa_video_format.
Definition: meta.h:133
uint32_t offset
offset of bitmap data in this structure.
Definition: meta.h:138
int32_t stride
stride of bitmap data
Definition: meta.h:137
a busy counter for the buffer
Definition: meta.h:170
uint32_t count
number of users busy with the buffer
Definition: meta.h:172
uint32_t flags
Definition: meta.h:171
a timed set of events associated with the buffer
Definition: meta.h:165
struct spa_pod_sequence sequence
Definition: meta.h:166
Cursor information.
Definition: meta.h:151
uint32_t flags
extra flags
Definition: meta.h:154
struct spa_point hotspot
offsets for hotspot in bitmap, this field has no meaning when there is no valid bitmap (see below)
Definition: meta.h:156
uint32_t id
cursor id.
Definition: meta.h:152
struct spa_point position
position on screen
Definition: meta.h:155
uint32_t bitmap_offset
offset of bitmap meta in this structure.
Definition: meta.h:158
Describes essential buffer header metadata such as flags and timestamps.
Definition: meta.h:86
uint32_t offset
offset in current cycle
Definition: meta.h:100
uint32_t flags
flags
Definition: meta.h:99
uint64_t seq
sequence number, increments with a media specific frequency
Definition: meta.h:103
int64_t pts
presentation timestamp in nanoseconds
Definition: meta.h:101
int64_t dts_offset
decoding timestamp as a difference with pts
Definition: meta.h:102
metadata structure for Region or an array of these for RegionArray
Definition: meta.h:108
struct spa_region region
Definition: meta.h:109
A metadata element.
Definition: meta.h:66
uint32_t size
size of metadata
Definition: meta.h:68
uint32_t type
metadata type, one of enum spa_meta_type
Definition: meta.h:67
void * data
pointer to metadata
Definition: meta.h:69
a sequence of timed controls
Definition: pod.h:268
Definition: defs.h:125
Definition: defs.h:118
uint32_t width
Definition: defs.h:119
uint32_t height
Definition: defs.h:120
Definition: defs.h:132
struct spa_rectangle size
Definition: defs.h:134