meta.h
Go to the documentation of this file.
/* Simple Plugin API
*
* Copyright © 2018 Wim Taymans
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
#ifndef SPA_META_H
#define SPA_META_H
#ifdef __cplusplus
extern "C" {
#endif
#include <spa/utils/defs.h>
#include <spa/pod/pod.h>
enum spa_meta_type {
SPA_META_Invalid,
SPA_META_Header,
SPA_META_VideoCrop,
SPA_META_VideoDamage,
SPA_META_Bitmap,
SPA_META_Cursor,
SPA_META_Control,
SPA_META_Busy,
_SPA_META_LAST,
};
struct spa_meta {
uint32_t type;
uint32_t size;
void *data;
};
#define spa_meta_first(m) ((m)->data)
#define spa_meta_end(m) SPA_PTROFF((m)->data,(m)->size,void)
#define spa_meta_check(p,m) (SPA_PTROFF(p,sizeof(*p),void) <= spa_meta_end(m))
struct spa_meta_header {
#define SPA_META_HEADER_FLAG_DISCONT (1 << 0)
#define SPA_META_HEADER_FLAG_CORRUPTED (1 << 1)
#define SPA_META_HEADER_FLAG_MARKER (1 << 2)
#define SPA_META_HEADER_FLAG_HEADER (1 << 3)
#define SPA_META_HEADER_FLAG_GAP (1 << 4)
#define SPA_META_HEADER_FLAG_DELTA_UNIT (1 << 5)
uint32_t flags;
uint32_t offset;
int64_t pts;
int64_t dts_offset;
uint64_t seq;
};
struct spa_meta_region {
struct spa_region region;
};
#define spa_meta_region_is_valid(m) ((m)->region.size.width != 0 && (m)->region.size.height != 0)
#define spa_meta_for_each(pos,meta) \
for (pos = (__typeof(pos))spa_meta_first(meta); \
spa_meta_check(pos, meta); \
(pos)++)
#define spa_meta_bitmap_is_valid(m) ((m)->format != 0)
struct spa_meta_bitmap {
uint32_t format;
struct spa_rectangle size;
int32_t stride;
uint32_t offset;
};
#define spa_meta_cursor_is_valid(m) ((m)->id != 0)
struct spa_meta_cursor {
uint32_t id;
uint32_t flags;
struct spa_point position;
struct spa_point hotspot;
uint32_t bitmap_offset;
};
struct spa_meta_control {
struct spa_pod_sequence sequence;
};
struct spa_meta_busy {
uint32_t flags;
uint32_t count;
};
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* SPA_META_H */
defs.h
spa/utils/defs.h
spa_meta_type
spa_meta_type
Definition: meta.h:45
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:49
SPA_META_Bitmap
@ SPA_META_Bitmap
struct spa_meta_bitmap
Definition: meta.h:50
SPA_META_Cursor
@ SPA_META_Cursor
struct spa_meta_cursor
Definition: meta.h:51
SPA_META_Busy
@ SPA_META_Busy
don't write to buffer when count > 0
Definition: meta.h:54
SPA_META_VideoCrop
@ SPA_META_VideoCrop
struct spa_meta_region with cropping data
Definition: meta.h:48
SPA_META_Header
@ SPA_META_Header
struct spa_meta_header
Definition: meta.h:47
SPA_META_Control
@ SPA_META_Control
metadata contains a spa_meta_control associated with the data
Definition: meta.h:52
SPA_META_Invalid
@ SPA_META_Invalid
Definition: meta.h:46
_SPA_META_LAST
@ _SPA_META_LAST
not part of ABI/API
Definition: meta.h:56
pod.h
spa/pod/pod.h
spa_meta_bitmap
Bitmap information.
Definition: meta.h:123
spa_meta_bitmap::size
struct spa_rectangle size
width and height of bitmap
Definition: meta.h:127
spa_meta_bitmap::format
uint32_t format
bitmap video format, one of enum spa_video_format.
Definition: meta.h:124
spa_meta_bitmap::offset
uint32_t offset
offset of bitmap data in this structure.
Definition: meta.h:129
spa_meta_bitmap::stride
int32_t stride
stride of bitmap data
Definition: meta.h:128
spa_meta_busy
a busy counter for the buffer
Definition: meta.h:161
spa_meta_busy::count
uint32_t count
number of users busy with the buffer
Definition: meta.h:163
spa_meta_busy::flags
uint32_t flags
Definition: meta.h:162
spa_meta_control
a timed set of events associated with the buffer
Definition: meta.h:156
spa_meta_control::sequence
struct spa_pod_sequence sequence
Definition: meta.h:157
spa_meta_cursor
Cursor information.
Definition: meta.h:142
spa_meta_cursor::flags
uint32_t flags
extra flags
Definition: meta.h:145
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:147
spa_meta_cursor::id
uint32_t id
cursor id.
Definition: meta.h:143
spa_meta_cursor::position
struct spa_point position
position on screen
Definition: meta.h:146
spa_meta_cursor::bitmap_offset
uint32_t bitmap_offset
offset of bitmap meta in this structure.
Definition: meta.h:149
spa_meta_header
Describes essential buffer header metadata such as flags and timestamps.
Definition: meta.h:80
spa_meta_header::offset
uint32_t offset
offset in current cycle
Definition: meta.h:94
spa_meta_header::flags
uint32_t flags
flags
Definition: meta.h:93
spa_meta_header::seq
uint64_t seq
sequence number, increments with a media specific frequency
Definition: meta.h:97
spa_meta_header::pts
int64_t pts
presentation timestamp in nanoseconds
Definition: meta.h:95
spa_meta_header::dts_offset
int64_t dts_offset
decoding timestamp as a difference with pts
Definition: meta.h:96
spa_meta_region
metadata structure for Region or an array of these for RegionArray
Definition: meta.h:102
spa_meta_region::region
struct spa_region region
Definition: meta.h:103
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:268
spa_point
Definition: defs.h:107
spa_rectangle
Definition: defs.h:100
spa_region
Definition: defs.h:114