PipeWire: spa/buffer/meta.h Source File

PipeWire 1.6.6

Loading...
Searching...
No Matches
meta.h
Go to the documentation of this file.
1/* Simple Plugin API */
2/* SPDX-FileCopyrightText: Copyright © 2018 Wim Taymans */
3/* SPDX-License-Identifier: MIT */
4
5#ifndef SPA_META_H
6#define SPA_META_H
7
8#include <spa/utils/defs.h>
9#include <spa/pod/pod.h>
10
11#ifdef __cplusplus
12extern "C" {
13#endif
14
15#ifndef SPA_API_META
16 #ifdef SPA_API_IMPL
17 #define SPA_API_META SPA_API_IMPL
18 #else
19 #define SPA_API_META static inline
20 #endif
21#endif
22
27
28enum spa_meta_type {
29 SPA_META_Invalid,
30 SPA_META_Header,
31 SPA_META_VideoCrop,
32 SPA_META_VideoDamage,
33 SPA_META_Bitmap,
34 SPA_META_Cursor,
35 SPA_META_Control,
37 SPA_META_Busy,
38 SPA_META_VideoTransform,
39 SPA_META_SyncTimeline,
40 _SPA_META_LAST,
41
42 SPA_META_START_custom = 0x200,
43
44 SPA_META_START_features = 0x10000, /* features start, these have 0 size, the
45 * type in the upper 16 bits and a bitmask in
46 * the lower 16 bits with type specific features. */
47};
48
49#define SPA_META_TYPE_FEATURES(type,features) (((type)<<16)|(features))
50
55
58struct spa_meta {
59 uint32_t type;
60 uint32_t size;
61 void *data;
62};
63
64 SPA_API_META void *spa_meta_first(const struct spa_meta *m) {
65 return m->data;
66}
67
68 SPA_API_META void *spa_meta_end(const struct spa_meta *m) {
69 return SPA_PTROFF(m->data,m->size,void);
70}
71#define spa_meta_check(p,m) (SPA_PTROFF(p,sizeof(*(p)),void) <= spa_meta_end(m))
72
75
76 */
77struct spa_meta_header {
78#define SPA_META_HEADER_FLAG_DISCONT (1 << 0)
79#define SPA_META_HEADER_FLAG_CORRUPTED (1 << 1)
80#define SPA_META_HEADER_FLAG_MARKER (1 << 2)
81#define SPA_META_HEADER_FLAG_HEADER (1 << 3)
82#define SPA_META_HEADER_FLAG_GAP (1 << 4)
83#define SPA_META_HEADER_FLAG_DELTA_UNIT (1 << 5)
84 uint32_t flags;
85 uint32_t offset;
86 int64_t pts;
87 int64_t dts_offset;
88 uint64_t seq;
90};
91
93 struct spa_meta_region {
94 struct spa_region region;
95};
96
97 SPA_API_META bool spa_meta_region_is_valid(const struct spa_meta_region *m) {
98 return m->region.size.width != 0 && m->region.size.height != 0;
99}
100
102#define spa_meta_for_each(pos,meta) \
103 for ((pos) = (__typeof(pos))spa_meta_first(meta); \
104 spa_meta_check(pos, meta); \
105 (pos)++)
106
107/**
108 * Bitmap information
109 *
110 * This metadata contains a bitmap image in the given format and size.
111 * It is typically used for cursor images or other small images that are
112 * better transferred inline.
113 */
114struct spa_meta_bitmap {
115 uint32_t format;
116 * and invalid format and should be handled as if there is
117 * no new bitmap information. */
118 struct spa_rectangle size;
119 int32_t stride;
120 uint32_t offset;
124};
125
126 SPA_API_META bool spa_meta_bitmap_is_valid(const struct spa_meta_bitmap *m) {
127 return m->format != 0;
128}
129
135struct spa_meta_cursor {
136 uint32_t id;
138 uint32_t flags;
139 struct spa_point position;
140 struct spa_point hotspot;
142 uint32_t bitmap_offset;
143
146};
147
148 SPA_API_META bool spa_meta_cursor_is_valid(const struct spa_meta_cursor *m) {
149 return m->id != 0;
150}
151
153 struct spa_meta_control {
154 struct spa_pod_sequence sequence;
155};
156
158struct spa_meta_busy {
159 uint32_t flags;
160 uint32_t count;
161};
162
163enum spa_meta_videotransform_value {
164 SPA_META_TRANSFORMATION_None = 0,
165 SPA_META_TRANSFORMATION_90,
166 SPA_META_TRANSFORMATION_180,
167 SPA_META_TRANSFORMATION_270,
168 SPA_META_TRANSFORMATION_Flipped,
170
171 SPA_META_TRANSFORMATION_Flipped90,
172 SPA_META_TRANSFORMATION_Flipped180,
173 SPA_META_TRANSFORMATION_Flipped270,
174};
175
176
177 struct spa_meta_videotransform {
178 uint32_t transform;
180};
181
189
191 * layout with 2 extra fds.
192 */
193#define SPA_META_FEATURE_SYNC_TIMELINE_RELEASE (1<<0)
194
195struct spa_meta_sync_timeline {
196#define SPA_META_SYNC_TIMELINE_UNSCHEDULED_RELEASE (1<<0)
199 uint32_t flags;
200 uint32_t padding;
201 uint64_t acquire_point;
203 uint64_t release_point;
205};
206
210
211#ifdef __cplusplus
212} /* extern "C" */
213#endif
214
215#endif /* SPA_META_H */
defs.h
spa/utils/defs.h
seq
uint32_t int seq
Definition core.h:432
id
uint32_t id
Definition core.h:432
spa_meta_first
SPA_API_META void * spa_meta_first(const struct spa_meta *m)
Definition meta.h:72
spa_meta_bitmap_is_valid
SPA_API_META bool spa_meta_bitmap_is_valid(const struct spa_meta_bitmap *m)
Definition meta.h:140
spa_meta_videotransform_value
spa_meta_videotransform_value
Definition meta.h:177
spa_meta_end
SPA_API_META void * spa_meta_end(const struct spa_meta *m)
Definition meta.h:76
spa_meta_type
spa_meta_type
Definition meta.h:35
spa_meta_region_is_valid
SPA_API_META bool spa_meta_region_is_valid(const struct spa_meta_region *m)
Definition meta.h:111
spa_meta_cursor_is_valid
SPA_API_META bool spa_meta_cursor_is_valid(const struct spa_meta_cursor *m)
Definition meta.h:162
SPA_META_TRANSFORMATION_Flipped270
@ SPA_META_TRANSFORMATION_Flipped270
flip then rotate around 270 degree counter-clockwise
Definition meta.h:187
SPA_META_TRANSFORMATION_Flipped
@ SPA_META_TRANSFORMATION_Flipped
180 degree flipped around the vertical axis.
Definition meta.h:182
SPA_META_TRANSFORMATION_270
@ SPA_META_TRANSFORMATION_270
270 degree counter-clockwise
Definition meta.h:181
SPA_META_TRANSFORMATION_Flipped180
@ SPA_META_TRANSFORMATION_Flipped180
flip then rotate around 180 degree counter-clockwise
Definition meta.h:186
SPA_META_TRANSFORMATION_Flipped90
@ SPA_META_TRANSFORMATION_Flipped90
flip then rotate around 90 degree counter-clockwise
Definition meta.h:185
SPA_META_TRANSFORMATION_None
@ SPA_META_TRANSFORMATION_None
no transform
Definition meta.h:178
SPA_META_TRANSFORMATION_90
@ SPA_META_TRANSFORMATION_90
90 degree counter-clockwise
Definition meta.h:179
SPA_META_TRANSFORMATION_180
@ SPA_META_TRANSFORMATION_180
180 degree counter-clockwise
Definition meta.h:180
SPA_META_VideoDamage
@ 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:39
SPA_META_Bitmap
@ SPA_META_Bitmap
struct spa_meta_bitmap
Definition meta.h:40
SPA_META_VideoTransform
@ SPA_META_VideoTransform
struct spa_meta_transform
Definition meta.h:45
SPA_META_START_features
@ SPA_META_START_features
Definition meta.h:51
SPA_META_Cursor
@ SPA_META_Cursor
struct spa_meta_cursor
Definition meta.h:41
SPA_META_Busy
@ SPA_META_Busy
don't write to buffer when count > 0
Definition meta.h:44
SPA_META_VideoCrop
@ SPA_META_VideoCrop
struct spa_meta_region with cropping data
Definition meta.h:38
SPA_META_SyncTimeline
@ SPA_META_SyncTimeline
struct spa_meta_sync_timeline
Definition meta.h:46
SPA_META_Header
@ SPA_META_Header
struct spa_meta_header
Definition meta.h:37
SPA_META_START_custom
@ SPA_META_START_custom
Definition meta.h:49
SPA_META_Control
@ SPA_META_Control
metadata contains a spa_meta_control associated with the data
Definition meta.h:42
SPA_META_Invalid
@ SPA_META_Invalid
Definition meta.h:36
_SPA_META_LAST
@ _SPA_META_LAST
not part of ABI/API
Definition meta.h:47
SPA_PTROFF
#define SPA_PTROFF(ptr_, offset_, type_)
Return the address (buffer + offset) as pointer of type.
Definition defs.h:222
SPA_API_META
#define SPA_API_META
Definition meta.h:26
pod.h
spa/pod/pod.h
spa_meta_bitmap
Bitmap information.
Definition meta.h:128
spa_meta_bitmap::size
struct spa_rectangle size
width and height of bitmap
Definition meta.h:132
spa_meta_bitmap::format
uint32_t format
bitmap video format, one of enum spa_video_format.
Definition meta.h:129
spa_meta_bitmap::offset
uint32_t offset
offset of bitmap data in this structure.
Definition meta.h:134
spa_meta_bitmap::stride
int32_t stride
stride of bitmap data
Definition meta.h:133
spa_meta_busy
a busy counter for the buffer
Definition meta.h:172
spa_meta_busy::count
uint32_t count
number of users busy with the buffer
Definition meta.h:174
spa_meta_control
a timed set of events associated with the buffer
Definition meta.h:167
spa_meta_control::sequence
struct spa_pod_sequence sequence
Definition meta.h:168
spa_meta_cursor
Cursor information.
Definition meta.h:149
spa_meta_cursor::flags
uint32_t flags
extra flags
Definition meta.h:152
spa_meta_cursor::hotspot
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:154
spa_meta_cursor::id
uint32_t id
cursor id.
Definition meta.h:150
spa_meta_cursor::position
struct spa_point position
position on screen
Definition meta.h:153
spa_meta_cursor::bitmap_offset
uint32_t bitmap_offset
offset of bitmap meta in this structure.
Definition meta.h:156
spa_meta_header
Describes essential buffer header metadata such as flags and timestamps.
Definition meta.h:85
spa_meta_header::offset
uint32_t offset
offset in current cycle
Definition meta.h:99
spa_meta_header::flags
uint32_t flags
flags
Definition meta.h:98
spa_meta_header::pts
int64_t pts
presentation timestamp in nanoseconds
Definition meta.h:100
spa_meta_header::dts_offset
int64_t dts_offset
decoding timestamp as a difference with pts
Definition meta.h:101
spa_meta_region
metadata structure for Region or an array of these for RegionArray
Definition meta.h:107
spa_meta_region::region
struct spa_region region
Definition meta.h:108
spa_meta_sync_timeline
Definition meta.h:210
spa_meta_sync_timeline::padding
uint32_t padding
Definition meta.h:216
spa_meta_sync_timeline::acquire_point
uint64_t acquire_point
the timeline acquire point, this is when the data can be accessed.
Definition meta.h:217
spa_meta_sync_timeline::release_point
uint64_t release_point
the timeline release point, this timeline point should be signaled when the data is no longer accesse...
Definition meta.h:219
spa_meta_sync_timeline::flags
uint32_t flags
Definition meta.h:215
spa_meta_videotransform
a transformation of the buffer
Definition meta.h:191
spa_meta_videotransform::transform
uint32_t transform
orientation transformation that was applied to the buffer, one of enum spa_meta_videotransform_value
Definition meta.h:192
spa_meta
A metadata element.
Definition meta.h:66
spa_meta::size
uint32_t size
size of metadata
Definition meta.h:68
spa_meta::type
uint32_t type
metadata type, one of enum spa_meta_type
Definition meta.h:67
spa_meta::data
void * data
pointer to metadata
Definition meta.h:69
spa_pod_sequence
a sequence of timed controls
Definition pod.h:271
spa_point
Definition defs.h:123
spa_rectangle
Definition defs.h:116
spa_rectangle::width
uint32_t width
Definition defs.h:117
spa_rectangle::height
uint32_t height
Definition defs.h:118
spa_region
Definition defs.h:130
spa_region::size
struct spa_rectangle size
Definition defs.h:132