PipeWire 1.2.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#ifdef __cplusplus
9 extern "C" {
10#endif
11
12#include <spa/utils/defs.h>
13#include <spa/pod/pod.h>
14
20 enum spa_meta_type {
21 SPA_META_Invalid,
22 SPA_META_Header,
23 SPA_META_VideoCrop,
24 SPA_META_VideoDamage,
25 SPA_META_Bitmap,
26 SPA_META_Cursor,
27 SPA_META_Control,
29 SPA_META_Busy,
30 SPA_META_VideoTransform,
31 SPA_META_SyncTimeline,
33 _SPA_META_LAST,
34};
35
43 struct spa_meta {
44 uint32_t type;
45 uint32_t size;
46 void *data;
47};
48
49 static inline void *spa_meta_first(const struct spa_meta *m) {
50 return m->data;
51}
52#define spa_meta_first spa_meta_first
53 static inline void *spa_meta_end(const struct spa_meta *m) {
54 return SPA_PTROFF(m->data,m->size,void);
55}
56#define spa_meta_end spa_meta_end
57#define spa_meta_check(p,m) (SPA_PTROFF(p,sizeof(*(p)),void) <= spa_meta_end(m))
58
63 struct spa_meta_header {
64#define SPA_META_HEADER_FLAG_DISCONT (1 << 0)
65#define SPA_META_HEADER_FLAG_CORRUPTED (1 << 1)
66#define SPA_META_HEADER_FLAG_MARKER (1 << 2)
67#define SPA_META_HEADER_FLAG_HEADER (1 << 3)
68#define SPA_META_HEADER_FLAG_GAP (1 << 4)
69#define SPA_META_HEADER_FLAG_DELTA_UNIT (1 << 5)
70 uint32_t flags;
71 uint32_t offset;
72 int64_t pts;
73 int64_t dts_offset;
74 uint64_t seq;
76};
77
79 struct spa_meta_region {
80 struct spa_region region;
81};
82
83 static inline bool spa_meta_region_is_valid(const struct spa_meta_region *m) {
84 return m->region.size.width != 0 && m->region.size.height != 0;
85}
86#define spa_meta_region_is_valid spa_meta_region_is_valid
87
89#define spa_meta_for_each(pos,meta) \
90 for ((pos) = (__typeof(pos))spa_meta_first(meta); \
91 spa_meta_check(pos, meta); \
92 (pos)++)
93
94#define spa_meta_bitmap_is_valid(m) ((m)->format != 0)
95
103 struct spa_meta_bitmap {
104 uint32_t format;
107 struct spa_rectangle size;
108 int32_t stride;
109 uint32_t offset;
113};
114
115#define spa_meta_cursor_is_valid(m) ((m)->id != 0)
116
122 struct spa_meta_cursor {
123 uint32_t id;
125 uint32_t flags;
126 struct spa_point position;
127 struct spa_point hotspot;
129 uint32_t bitmap_offset;
133};
134
136 struct spa_meta_control {
137 struct spa_pod_sequence sequence;
138};
139
141 struct spa_meta_busy {
142 uint32_t flags;
143 uint32_t count;
144};
145
146 enum spa_meta_videotransform_value {
147 SPA_META_TRANSFORMATION_None = 0,
148 SPA_META_TRANSFORMATION_90,
149 SPA_META_TRANSFORMATION_180,
150 SPA_META_TRANSFORMATION_270,
151 SPA_META_TRANSFORMATION_Flipped,
154 SPA_META_TRANSFORMATION_Flipped90,
155 SPA_META_TRANSFORMATION_Flipped180,
156 SPA_META_TRANSFORMATION_Flipped270,
157};
158
160 struct spa_meta_videotransform {
161 uint32_t transform;
163};
164
175 struct spa_meta_sync_timeline {
176 uint32_t flags;
177 uint32_t padding;
178 uint64_t acquire_point;
180 uint64_t release_point;
182};
183
188#ifdef __cplusplus
189} /* extern "C" */
190#endif
191
192#endif /* SPA_META_H */
defs.h
spa/utils/defs.h
spa_meta_region_is_valid
#define spa_meta_region_is_valid
Definition meta.h:97
spa_meta_end
#define spa_meta_end
Definition meta.h:61
spa_meta_first
#define spa_meta_first
Definition meta.h:57
spa_meta_videotransform_value
spa_meta_videotransform_value
Definition meta.h:157
spa_meta_type
spa_meta_type
Definition meta.h:25
SPA_META_TRANSFORMATION_Flipped270
@ SPA_META_TRANSFORMATION_Flipped270
flip then rotate around 270 degree counter-clockwise
Definition meta.h:167
SPA_META_TRANSFORMATION_Flipped
@ SPA_META_TRANSFORMATION_Flipped
180 degree flipped around the vertical axis.
Definition meta.h:162
SPA_META_TRANSFORMATION_270
@ SPA_META_TRANSFORMATION_270
270 degree counter-clockwise
Definition meta.h:161
SPA_META_TRANSFORMATION_Flipped180
@ SPA_META_TRANSFORMATION_Flipped180
flip then rotate around 180 degree counter-clockwise
Definition meta.h:166
SPA_META_TRANSFORMATION_Flipped90
@ SPA_META_TRANSFORMATION_Flipped90
flip then rotate around 90 degree counter-clockwise
Definition meta.h:165
SPA_META_TRANSFORMATION_None
@ SPA_META_TRANSFORMATION_None
no transform
Definition meta.h:158
SPA_META_TRANSFORMATION_90
@ SPA_META_TRANSFORMATION_90
90 degree counter-clockwise
Definition meta.h:159
SPA_META_TRANSFORMATION_180
@ SPA_META_TRANSFORMATION_180
180 degree counter-clockwise
Definition meta.h:160
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:29
SPA_META_Bitmap
@ SPA_META_Bitmap
struct spa_meta_bitmap
Definition meta.h:30
SPA_META_VideoTransform
@ SPA_META_VideoTransform
struct spa_meta_transform
Definition meta.h:35
SPA_META_Cursor
@ SPA_META_Cursor
struct spa_meta_cursor
Definition meta.h:31
SPA_META_Busy
@ SPA_META_Busy
don't write to buffer when count > 0
Definition meta.h:34
SPA_META_VideoCrop
@ SPA_META_VideoCrop
struct spa_meta_region with cropping data
Definition meta.h:28
SPA_META_SyncTimeline
@ SPA_META_SyncTimeline
struct spa_meta_sync_timeline
Definition meta.h:36
SPA_META_Header
@ SPA_META_Header
struct spa_meta_header
Definition meta.h:27
SPA_META_Control
@ SPA_META_Control
metadata contains a spa_meta_control associated with the data
Definition meta.h:32
SPA_META_Invalid
@ SPA_META_Invalid
Definition meta.h:26
_SPA_META_LAST
@ _SPA_META_LAST
not part of ABI/API
Definition meta.h:38
SPA_PTROFF
#define SPA_PTROFF(ptr_, offset_, type_)
Return the address (buffer + offset) as pointer of type.
Definition defs.h:222
pod.h
spa/pod/pod.h
spa_meta_bitmap
Bitmap information.
Definition meta.h:114
spa_meta_bitmap::size
struct spa_rectangle size
width and height of bitmap
Definition meta.h:118
spa_meta_bitmap::format
uint32_t format
bitmap video format, one of enum spa_video_format.
Definition meta.h:115
spa_meta_bitmap::offset
uint32_t offset
offset of bitmap data in this structure.
Definition meta.h:120
spa_meta_bitmap::stride
int32_t stride
stride of bitmap data
Definition meta.h:119
spa_meta_busy
a busy counter for the buffer
Definition meta.h:152
spa_meta_busy::count
uint32_t count
number of users busy with the buffer
Definition meta.h:154
spa_meta_busy::flags
uint32_t flags
Definition meta.h:153
spa_meta_control
a timed set of events associated with the buffer
Definition meta.h:147
spa_meta_control::sequence
struct spa_pod_sequence sequence
Definition meta.h:148
spa_meta_cursor
Cursor information.
Definition meta.h:133
spa_meta_cursor::flags
uint32_t flags
extra flags
Definition meta.h:136
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:138
spa_meta_cursor::id
uint32_t id
cursor id.
Definition meta.h:134
spa_meta_cursor::position
struct spa_point position
position on screen
Definition meta.h:137
spa_meta_cursor::bitmap_offset
uint32_t bitmap_offset
offset of bitmap meta in this structure.
Definition meta.h:140
spa_meta_header
Describes essential buffer header metadata such as flags and timestamps.
Definition meta.h:68
spa_meta_header::offset
uint32_t offset
offset in current cycle
Definition meta.h:82
spa_meta_header::flags
uint32_t flags
flags
Definition meta.h:81
spa_meta_header::seq
uint64_t seq
sequence number, increments with a media specific frequency
Definition meta.h:85
spa_meta_header::pts
int64_t pts
presentation timestamp in nanoseconds
Definition meta.h:83
spa_meta_header::dts_offset
int64_t dts_offset
decoding timestamp as a difference with pts
Definition meta.h:84
spa_meta_region
metadata structure for Region or an array of these for RegionArray
Definition meta.h:90
spa_meta_region::region
struct spa_region region
Definition meta.h:91
spa_meta_sync_timeline
A timeline point for explicit sync.
Definition meta.h:186
spa_meta_sync_timeline::padding
uint32_t padding
Definition meta.h:188
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:189
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:191
spa_meta_sync_timeline::flags
uint32_t flags
Definition meta.h:187
spa_meta_videotransform
a transformation of the buffer
Definition meta.h:171
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:172
spa_meta
A metadata element.
Definition meta.h:48
spa_meta::size
uint32_t size
size of metadata
Definition meta.h:50
spa_meta::type
uint32_t type
metadata type, one of enum spa_meta_type
Definition meta.h:49
spa_meta::data
void * data
pointer to metadata
Definition meta.h:51
spa_pod_sequence
a sequence of timed controls
Definition pod.h:248
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