PipeWire  0.3.63
meta.h
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
29 extern "C" {
30 #endif
31 
32 #include <spa/utils/defs.h>
33 #include <spa/pod/pod.h>
34 
40 enum spa_meta_type {
53 };
54 
62 struct spa_meta {
63  uint32_t type;
64  uint32_t size;
65  void *data;
66 };
67 
68 static inline void *spa_meta_first(const struct spa_meta *m) {
69  return m->data;
70 }
71 #define spa_meta_first spa_meta_first
72 static inline void *spa_meta_end(const struct spa_meta *m) {
73  return SPA_PTROFF(m->data,m->size,void);
74 }
75 #define spa_meta_end spa_meta_end
76 #define spa_meta_check(p,m) (SPA_PTROFF(p,sizeof(*(p)),void) <= spa_meta_end(m))
77 
82 struct spa_meta_header {
83 #define SPA_META_HEADER_FLAG_DISCONT (1 << 0)
84 #define SPA_META_HEADER_FLAG_CORRUPTED (1 << 1)
85 #define SPA_META_HEADER_FLAG_MARKER (1 << 2)
86 #define SPA_META_HEADER_FLAG_HEADER (1 << 3)
87 #define SPA_META_HEADER_FLAG_GAP (1 << 4)
88 #define SPA_META_HEADER_FLAG_DELTA_UNIT (1 << 5)
89  uint32_t flags;
90  uint32_t offset;
91  int64_t pts;
92  int64_t dts_offset;
93  uint64_t seq;
95 };
96 
98 struct spa_meta_region {
99  struct spa_region region;
100 };
102 static inline bool spa_meta_region_is_valid(const struct spa_meta_region *m) {
103  return m->region.size.width != 0 && m->region.size.height != 0;
104 }
105 #define spa_meta_region_is_valid spa_meta_region_is_valid
106 
108 #define spa_meta_for_each(pos,meta) \
109  for ((pos) = (__typeof(pos))spa_meta_first(meta); \
110  spa_meta_check(pos, meta); \
111  (pos)++)
112 
113 #define spa_meta_bitmap_is_valid(m) ((m)->format != 0)
114 
122 struct spa_meta_bitmap {
123  uint32_t format;
126  struct spa_rectangle size;
127  int32_t stride;
128  uint32_t offset;
132 };
134 #define spa_meta_cursor_is_valid(m) ((m)->id != 0)
135 
141 struct spa_meta_cursor {
142  uint32_t id;
144  uint32_t flags;
145  struct spa_point position;
146  struct spa_point hotspot;
148  uint32_t bitmap_offset;
152 };
156  struct spa_pod_sequence sequence;
157 };
158 
160 struct spa_meta_busy {
161  uint32_t flags;
162  uint32_t count;
163 };
164 
176 };
180  uint32_t transform;
181 };
182 
187 #ifdef __cplusplus
188 } /* extern "C" */
189 #endif
191 #endif /* SPA_META_H */
struct spa_meta_cursor
Definition: meta.h:51
spa_meta_videotransform_value
Definition: meta.h:176
Definition: defs.h:125
uint32_t flags
flags
Definition: meta.h:100
struct spa_region region
Definition: meta.h:110
#define spa_meta_first
Definition: meta.h:76
struct spa_meta_transform
Definition: meta.h:55
uint32_t height
Definition: defs.h:120
a transformation of the buffer
Definition: meta.h:190
struct spa_meta_header
Definition: meta.h:47
metadata contains a spa_meta_control associated with the data
Definition: meta.h:52
a busy counter for the buffer
Definition: meta.h:171
a timed set of events associated with the buffer
Definition: meta.h:166
Definition: defs.h:132
no transform
Definition: meta.h:177
Definition: defs.h:118
90 degree counter-clockwise
Definition: meta.h:178
metadata structure for Region or an array of these for RegionArray
Definition: meta.h:109
flip then rotate around 180 degree counter-clockwise
Definition: meta.h:185
array of struct spa_meta_region with damage, where an invalid entry or end-of-array marks the end...
Definition: meta.h:49
struct spa_meta_region with cropping data
Definition: meta.h:48
180 degree flipped around the vertical axis.
Definition: meta.h:181
flip then rotate around 90 degree counter-clockwise
Definition: meta.h:184
uint32_t offset
offset in current cycle
Definition: meta.h:101
#define spa_meta_end
Definition: meta.h:80
struct spa_rectangle size
Definition: defs.h:134
flip then rotate around 270 degree counter-clockwise
Definition: meta.h:186
uint32_t type
metadata type, one of enum spa_meta_type
Definition: meta.h:68
not part of ABI/API
Definition: meta.h:57
uint32_t width
Definition: defs.h:119
Describes essential buffer header metadata such as flags and timestamps.
Definition: meta.h:87
struct spa_meta_bitmap
Definition: meta.h:50
don't write to buffer when count > 0
Definition: meta.h:54
Cursor information.
Definition: meta.h:152
270 degree counter-clockwise
Definition: meta.h:180
#define SPA_PTROFF(ptr_, offset_, type_)
Return the address (buffer + offset) as pointer of type.
Definition: defs.h:210
spa_meta_type
Definition: meta.h:45
#define spa_meta_region_is_valid
Definition: meta.h:116
uint32_t size
size of metadata
Definition: meta.h:69
Definition: meta.h:46
void * data
pointer to metadata
Definition: meta.h:70
180 degree counter-clockwise
Definition: meta.h:179
A metadata element.
Definition: meta.h:67
Bitmap information.
Definition: meta.h:133
a sequence of timed controls
Definition: pod.h:272