PipeWire  0.3.66
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 {
33 };
34 
42 struct spa_meta {
43  uint32_t type;
44  uint32_t size;
45  void *data;
46 };
47 
48 static inline void *spa_meta_first(const struct spa_meta *m) {
49  return m->data;
50 }
51 #define spa_meta_first spa_meta_first
52 static inline void *spa_meta_end(const struct spa_meta *m) {
53  return SPA_PTROFF(m->data,m->size,void);
54 }
55 #define spa_meta_end spa_meta_end
56 #define spa_meta_check(p,m) (SPA_PTROFF(p,sizeof(*(p)),void) <= spa_meta_end(m))
57 
62 struct spa_meta_header {
63 #define SPA_META_HEADER_FLAG_DISCONT (1 << 0)
64 #define SPA_META_HEADER_FLAG_CORRUPTED (1 << 1)
65 #define SPA_META_HEADER_FLAG_MARKER (1 << 2)
66 #define SPA_META_HEADER_FLAG_HEADER (1 << 3)
67 #define SPA_META_HEADER_FLAG_GAP (1 << 4)
68 #define SPA_META_HEADER_FLAG_DELTA_UNIT (1 << 5)
69  uint32_t flags;
70  uint32_t offset;
71  int64_t pts;
72  int64_t dts_offset;
73  uint64_t seq;
75 };
76 
78 struct spa_meta_region {
80 };
81 
82 static inline bool spa_meta_region_is_valid(const struct spa_meta_region *m) {
83  return m->region.size.width != 0 && m->region.size.height != 0;
84 }
85 #define spa_meta_region_is_valid spa_meta_region_is_valid
86 
88 #define spa_meta_for_each(pos,meta) \
89  for ((pos) = (__typeof(pos))spa_meta_first(meta); \
90  spa_meta_check(pos, meta); \
91  (pos)++)
92 
93 #define spa_meta_bitmap_is_valid(m) ((m)->format != 0)
94 
102 struct spa_meta_bitmap {
103  uint32_t format;
106  struct spa_rectangle size;
107  int32_t stride;
108  uint32_t offset;
112 };
113 
114 #define spa_meta_cursor_is_valid(m) ((m)->id != 0)
115 
121 struct spa_meta_cursor {
122  uint32_t id;
124  uint32_t flags;
126  struct spa_point hotspot;
128  uint32_t bitmap_offset;
132 };
133 
136  struct spa_pod_sequence sequence;
137 };
138 
140 struct spa_meta_busy {
141  uint32_t flags;
142  uint32_t count;
143 };
144 
156 };
157 
160  uint32_t transform;
162 };
163 
168 #ifdef __cplusplus
169 } /* extern "C" */
170 #endif
171 
172 #endif /* SPA_META_H */
spa/utils/defs.h
#define spa_meta_region_is_valid
Definition: meta.h:96
#define spa_meta_end
Definition: meta.h:60
#define spa_meta_first
Definition: meta.h:56
spa_meta_videotransform_value
Definition: meta.h:156
spa_meta_type
Definition: meta.h:25
@ SPA_META_TRANSFORMATION_Flipped270
flip then rotate around 270 degree counter-clockwise
Definition: meta.h:166
@ SPA_META_TRANSFORMATION_Flipped
180 degree flipped around the vertical axis.
Definition: meta.h:161
@ SPA_META_TRANSFORMATION_270
270 degree counter-clockwise
Definition: meta.h:160
@ SPA_META_TRANSFORMATION_Flipped180
flip then rotate around 180 degree counter-clockwise
Definition: meta.h:165
@ SPA_META_TRANSFORMATION_Flipped90
flip then rotate around 90 degree counter-clockwise
Definition: meta.h:164
@ SPA_META_TRANSFORMATION_None
no transform
Definition: meta.h:157
@ SPA_META_TRANSFORMATION_90
90 degree counter-clockwise
Definition: meta.h:158
@ SPA_META_TRANSFORMATION_180
180 degree counter-clockwise
Definition: meta.h:159
@ 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
struct spa_meta_bitmap
Definition: meta.h:30
@ SPA_META_VideoTransform
struct spa_meta_transform
Definition: meta.h:35
@ SPA_META_Cursor
struct spa_meta_cursor
Definition: meta.h:31
@ SPA_META_Busy
don't write to buffer when count > 0
Definition: meta.h:34
@ SPA_META_VideoCrop
struct spa_meta_region with cropping data
Definition: meta.h:28
@ SPA_META_Header
struct spa_meta_header
Definition: meta.h:27
@ SPA_META_Control
metadata contains a spa_meta_control associated with the data
Definition: meta.h:32
@ SPA_META_Invalid
Definition: meta.h:26
@ _SPA_META_LAST
not part of ABI/API
Definition: meta.h:37
#define SPA_PTROFF(ptr_, offset_, type_)
Return the address (buffer + offset) as pointer of type.
Definition: defs.h:194
spa/pod/pod.h
Bitmap information.
Definition: meta.h:113
struct spa_rectangle size
width and height of bitmap
Definition: meta.h:117
uint32_t format
bitmap video format, one of enum spa_video_format.
Definition: meta.h:114
uint32_t offset
offset of bitmap data in this structure.
Definition: meta.h:119
int32_t stride
stride of bitmap data
Definition: meta.h:118
a busy counter for the buffer
Definition: meta.h:151
uint32_t count
number of users busy with the buffer
Definition: meta.h:153
uint32_t flags
Definition: meta.h:152
a timed set of events associated with the buffer
Definition: meta.h:146
struct spa_pod_sequence sequence
Definition: meta.h:147
Cursor information.
Definition: meta.h:132
uint32_t flags
extra flags
Definition: meta.h:135
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:137
uint32_t id
cursor id.
Definition: meta.h:133
struct spa_point position
position on screen
Definition: meta.h:136
uint32_t bitmap_offset
offset of bitmap meta in this structure.
Definition: meta.h:139
Describes essential buffer header metadata such as flags and timestamps.
Definition: meta.h:67
uint32_t offset
offset in current cycle
Definition: meta.h:81
uint32_t flags
flags
Definition: meta.h:80
uint64_t seq
sequence number, increments with a media specific frequency
Definition: meta.h:84
int64_t pts
presentation timestamp in nanoseconds
Definition: meta.h:82
int64_t dts_offset
decoding timestamp as a difference with pts
Definition: meta.h:83
metadata structure for Region or an array of these for RegionArray
Definition: meta.h:89
struct spa_region region
Definition: meta.h:90
a transformation of the buffer
Definition: meta.h:170
uint32_t transform
orientation transformation that was applied to the buffer, one of enum spa_meta_videotransform_value
Definition: meta.h:171
A metadata element.
Definition: meta.h:47
uint32_t size
size of metadata
Definition: meta.h:49
uint32_t type
metadata type, one of enum spa_meta_type
Definition: meta.h:48
void * data
pointer to metadata
Definition: meta.h:50
a sequence of timed controls
Definition: pod/pod.h:248
Definition: defs.h:109
Definition: defs.h:102
uint32_t width
Definition: defs.h:103
uint32_t height
Definition: defs.h:104
Definition: defs.h:116
struct spa_rectangle size
Definition: defs.h:118