PipeWire  0.3.33
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
29 extern "C" {
30 #endif
31 
32 #include <spa/utils/defs.h>
33 #include <spa/pod/pod.h>
34 
52 };
53 
61 struct spa_meta {
62  uint32_t type;
63  uint32_t size;
64  void *data;
65 };
66 
67 #define spa_meta_first(m) ((m)->data)
68 #define spa_meta_end(m) SPA_PTROFF((m)->data,(m)->size,void)
69 #define spa_meta_check(p,m) (SPA_PTROFF(p,sizeof(*p),void) <= spa_meta_end(m))
70 
76 #define SPA_META_HEADER_FLAG_DISCONT (1 << 0)
77 #define SPA_META_HEADER_FLAG_CORRUPTED (1 << 1)
78 #define SPA_META_HEADER_FLAG_MARKER (1 << 2)
79 #define SPA_META_HEADER_FLAG_HEADER (1 << 3)
80 #define SPA_META_HEADER_FLAG_GAP (1 << 4)
81 #define SPA_META_HEADER_FLAG_DELTA_UNIT (1 << 5)
82  uint32_t flags;
83  uint32_t offset;
84  int64_t pts;
85  int64_t dts_offset;
86  uint64_t seq;
88 };
89 
92  struct spa_region region;
93 };
94 
95 #define spa_meta_region_is_valid(m) ((m)->region.size.width != 0 && (m)->region.size.height != 0)
96 
98 #define spa_meta_for_each(pos,meta) \
99  for (pos = (__typeof(pos))spa_meta_first(meta); \
100  spa_meta_check(pos, meta); \
101  (pos)++)
102 
103 #define spa_meta_bitmap_is_valid(m) ((m)->format != 0)
104 
113  uint32_t format;
116  struct spa_rectangle size;
117  int32_t stride;
118  uint32_t offset;
122 };
123 
124 #define spa_meta_cursor_is_valid(m) ((m)->id != 0)
125 
132  uint32_t id;
134  uint32_t flags;
135  struct spa_point position;
136  struct spa_point hotspot;
138  uint32_t bitmap_offset;
142 };
143 
146  struct spa_pod_sequence sequence;
147 };
148 
151  uint32_t flags;
152  uint32_t count;
153 };
154 
159 #ifdef __cplusplus
160 } /* extern "C" */
161 #endif
162 
163 #endif /* SPA_META_H */
spa_meta_busy::count
uint32_t count
number of users busy with the buffer
Definition: meta.h:152
spa_meta::data
void * data
pointer to metadata
Definition: meta.h:64
SPA_META_Cursor
@ SPA_META_Cursor
struct spa_meta_cursor
Definition: meta.h:46
SPA_META_Invalid
@ SPA_META_Invalid
Definition: meta.h:41
SPA_META_VideoCrop
@ SPA_META_VideoCrop
struct spa_meta_region with cropping data
Definition: meta.h:43
SPA_META_VideoDamage
@ SPA_META_VideoDamage
array of struct spa_meta_region with damage
Definition: meta.h:44
spa_meta_busy
a busy counter for the buffer
Definition: meta.h:150
spa_meta_cursor
Cursor information.
Definition: meta.h:131
spa_point
Definition: defs.h:92
spa_rectangle
Definition: defs.h:86
SPA_META_Busy
@ SPA_META_Busy
don't write to buffer when count > 0
Definition: meta.h:49
spa_meta_busy::flags
uint32_t flags
Definition: meta.h:151
spa_meta_header
Describes essential buffer header metadata such as flags and timestamps.
Definition: meta.h:75
spa_meta
A metadata element.
Definition: meta.h:61
spa_meta::type
uint32_t type
metadata type, one of enum spa_meta_type
Definition: meta.h:62
spa_meta_region
metadata structure for Region or an array of these for RegionArray
Definition: meta.h:91
_SPA_META_LAST
@ _SPA_META_LAST
not part of ABI/API
Definition: meta.h:51
SPA_META_Bitmap
@ SPA_META_Bitmap
struct spa_meta_bitmap
Definition: meta.h:45
spa_meta_control
a timed set of events associated with the buffer
Definition: meta.h:145
spa_pod_sequence
a sequence of timed controls
Definition: pod/pod.h:233
spa_meta_bitmap::offset
uint32_t offset
offset of bitmap data in this structure.
Definition: meta.h:118
spa_region
Definition: defs.h:98
spa_meta_bitmap
Bitmap information.
Definition: meta.h:112
spa_meta_type
spa_meta_type
Definition: meta.h:40
defs.h
spa_meta::size
uint32_t size
size of metadata
Definition: meta.h:63
spa_meta_cursor::id
uint32_t id
cursor id.
Definition: meta.h:132
spa_meta_bitmap::stride
int32_t stride
stride of bitmap data
Definition: meta.h:117
spa_meta_header::flags
uint32_t flags
flags
Definition: meta.h:82
SPA_META_Header
@ SPA_META_Header
struct spa_meta_header
Definition: meta.h:42
SPA_META_Control
@ SPA_META_Control
metadata contains a spa_meta_control associated with the data
Definition: meta.h:47
pod.h