+ +
2da5fe7 OpenAVX v0.2.0 - High-performance open-standard IP audio and video transport suite
saifmukhtar · 2026-11-24
c · 202 lines · 6.8 KB · SPDX: MIT
main
1 /* Simple Plugin API */
2 /* SPDX-FileCopyrightText: Copyright © 2018 Wim Taymans */
3 /* SPDX-License-Identifier: MIT */
4  
5 #ifndef SPA_VIDEO_RAW_H
6 #define SPA_VIDEO_RAW_H
7  
8 #include <spa/param/format.h>
9 #include <spa/param/video/chroma.h>
10 #include <spa/param/video/color.h>
11 #include <spa/param/video/multiview.h>
12  
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
16  
17 /**
18 * \addtogroup spa_param
19 * \{
20 */
21  
22 #define SPA_VIDEO_MAX_PLANES 4
23 #define SPA_VIDEO_MAX_COMPONENTS 4
24  
25 /**
26 * Video formats
27 *
28 * The components are in general described in big-endian order. There are some
29 * exceptions (e.g. RGB15 and RGB16) which use the host endianness.
30 *
31 * Most of the formats are identical to their GStreamer equivalent. See the
32 * GStreamer video formats documentation for more details:
33 *
34 * https://gstreamer.freedesktop.org/documentation/additional/design/mediatype-video-raw.html#formats
35 */
36 enum spa_video_format {
37 SPA_VIDEO_FORMAT_UNKNOWN,
38 SPA_VIDEO_FORMAT_ENCODED,
39  
40 SPA_VIDEO_FORMAT_I420,
41 SPA_VIDEO_FORMAT_YV12,
42 SPA_VIDEO_FORMAT_YUY2,
43 SPA_VIDEO_FORMAT_UYVY,
44 SPA_VIDEO_FORMAT_AYUV,
45 SPA_VIDEO_FORMAT_RGBx,
46 SPA_VIDEO_FORMAT_BGRx,
47 SPA_VIDEO_FORMAT_xRGB,
48 SPA_VIDEO_FORMAT_xBGR,
49 SPA_VIDEO_FORMAT_RGBA,
50 SPA_VIDEO_FORMAT_BGRA,
51 SPA_VIDEO_FORMAT_ARGB,
52 SPA_VIDEO_FORMAT_ABGR,
53 SPA_VIDEO_FORMAT_RGB,
54 SPA_VIDEO_FORMAT_BGR,
55 SPA_VIDEO_FORMAT_Y41B,
56 SPA_VIDEO_FORMAT_Y42B,
57 SPA_VIDEO_FORMAT_YVYU,
58 SPA_VIDEO_FORMAT_Y444,
59 SPA_VIDEO_FORMAT_v210,
60 SPA_VIDEO_FORMAT_v216,
61 SPA_VIDEO_FORMAT_NV12,
62 SPA_VIDEO_FORMAT_NV21,
63 SPA_VIDEO_FORMAT_GRAY8,
64 SPA_VIDEO_FORMAT_GRAY16_BE,
65 SPA_VIDEO_FORMAT_GRAY16_LE,
66 SPA_VIDEO_FORMAT_v308,
67 SPA_VIDEO_FORMAT_RGB16,
68 SPA_VIDEO_FORMAT_BGR16,
69 SPA_VIDEO_FORMAT_RGB15,
70 SPA_VIDEO_FORMAT_BGR15,
71 SPA_VIDEO_FORMAT_UYVP,
72 SPA_VIDEO_FORMAT_A420,
73 SPA_VIDEO_FORMAT_RGB8P,
74 SPA_VIDEO_FORMAT_YUV9,
75 SPA_VIDEO_FORMAT_YVU9,
76 SPA_VIDEO_FORMAT_IYU1,
77 SPA_VIDEO_FORMAT_ARGB64,
78 SPA_VIDEO_FORMAT_AYUV64,
79 SPA_VIDEO_FORMAT_r210,
80 SPA_VIDEO_FORMAT_I420_10BE,
81 SPA_VIDEO_FORMAT_I420_10LE,
82 SPA_VIDEO_FORMAT_I422_10BE,
83 SPA_VIDEO_FORMAT_I422_10LE,
84 SPA_VIDEO_FORMAT_Y444_10BE,
85 SPA_VIDEO_FORMAT_Y444_10LE,
86 SPA_VIDEO_FORMAT_GBR,
87 SPA_VIDEO_FORMAT_GBR_10BE,
88 SPA_VIDEO_FORMAT_GBR_10LE,
89 SPA_VIDEO_FORMAT_NV16,
90 SPA_VIDEO_FORMAT_NV24,
91 SPA_VIDEO_FORMAT_NV12_64Z32,
92 SPA_VIDEO_FORMAT_A420_10BE,
93 SPA_VIDEO_FORMAT_A420_10LE,
94 SPA_VIDEO_FORMAT_A422_10BE,
95 SPA_VIDEO_FORMAT_A422_10LE,
96 SPA_VIDEO_FORMAT_A444_10BE,
97 SPA_VIDEO_FORMAT_A444_10LE,
98 SPA_VIDEO_FORMAT_NV61,
99 SPA_VIDEO_FORMAT_P010_10BE,
100 SPA_VIDEO_FORMAT_P010_10LE,
101 SPA_VIDEO_FORMAT_IYU2,
102 SPA_VIDEO_FORMAT_VYUY,
103 SPA_VIDEO_FORMAT_GBRA,
104 SPA_VIDEO_FORMAT_GBRA_10BE,
105 SPA_VIDEO_FORMAT_GBRA_10LE,
106 SPA_VIDEO_FORMAT_GBR_12BE,
107 SPA_VIDEO_FORMAT_GBR_12LE,
108 SPA_VIDEO_FORMAT_GBRA_12BE,
109 SPA_VIDEO_FORMAT_GBRA_12LE,
110 SPA_VIDEO_FORMAT_I420_12BE,
111 SPA_VIDEO_FORMAT_I420_12LE,
112 SPA_VIDEO_FORMAT_I422_12BE,
113 SPA_VIDEO_FORMAT_I422_12LE,
114 SPA_VIDEO_FORMAT_Y444_12BE,
115 SPA_VIDEO_FORMAT_Y444_12LE,
116  
117 SPA_VIDEO_FORMAT_RGBA_F16,
118 SPA_VIDEO_FORMAT_RGBA_F32,
119  
120 SPA_VIDEO_FORMAT_xRGB_210LE, /**< 32-bit x:R:G:B 2:10:10:10 little endian */
121 SPA_VIDEO_FORMAT_xBGR_210LE, /**< 32-bit x:B:G:R 2:10:10:10 little endian */
122 SPA_VIDEO_FORMAT_RGBx_102LE, /**< 32-bit R:G:B:x 10:10:10:2 little endian */
123 SPA_VIDEO_FORMAT_BGRx_102LE, /**< 32-bit B:G:R:x 10:10:10:2 little endian */
124 SPA_VIDEO_FORMAT_ARGB_210LE, /**< 32-bit A:R:G:B 2:10:10:10 little endian */
125 SPA_VIDEO_FORMAT_ABGR_210LE, /**< 32-bit A:B:G:R 2:10:10:10 little endian */
126 SPA_VIDEO_FORMAT_RGBA_102LE, /**< 32-bit R:G:B:A 10:10:10:2 little endian */
127 SPA_VIDEO_FORMAT_BGRA_102LE, /**< 32-bit B:G:R:A 10:10:10:2 little endian */
128  
129 /* Aliases */
130 SPA_VIDEO_FORMAT_DSP_F32 = SPA_VIDEO_FORMAT_RGBA_F32,
131 };
132  
133 /**
134 * Extra video flags
135 */
136 enum spa_video_flags {
137 SPA_VIDEO_FLAG_NONE = 0, /**< no flags */
138 SPA_VIDEO_FLAG_VARIABLE_FPS = (1 << 0), /**< a variable fps is selected, fps_n and fps_d
139 * denote the maximum fps of the video */
140 SPA_VIDEO_FLAG_PREMULTIPLIED_ALPHA = (1 << 1), /**< Each color has been scaled by the alpha value. */
141 SPA_VIDEO_FLAG_MODIFIER = (1 << 2), /**< use the format modifier */
142 SPA_VIDEO_FLAG_MODIFIER_FIXATION_REQUIRED = (1 << 3), /**< format modifier was not fixated yet */
143 };
144  
145 /**
146 * The possible values of the #spa_video_interlace_mode describing the interlace
147 * mode of the stream.
148 */
149 enum spa_video_interlace_mode {
150 SPA_VIDEO_INTERLACE_MODE_PROGRESSIVE = 0, /**< all frames are progressive */
151 SPA_VIDEO_INTERLACE_MODE_INTERLEAVED, /**< 2 fields are interleaved in one video frame.
152 * Extra buffer flags describe the field order. */
153 SPA_VIDEO_INTERLACE_MODE_MIXED, /**< frames contains both interlaced and progressive
154 * video, the buffer flags describe the frame and
155 * fields. */
156 SPA_VIDEO_INTERLACE_MODE_FIELDS, /**< 2 fields are stored in one buffer, use the
157 * frame ID to get access to the required
158 * field. For multiview (the 'views'
159 * property > 1) the fields of view N can
160 * be found at frame ID (N * 2) and (N *
161 * 2) + 1. Each field has only half the
162 * amount of lines as noted in the height
163 * property. This mode requires multiple
164 * spa_data to describe the fields. */
165 };
166  
167 /**
168 */
169 struct spa_video_info_raw {
170 enum spa_video_format format; /**< the format */
171 uint32_t flags; /**< extra video flags */
172 uint64_t modifier; /**< format modifier
173 * only used with DMA-BUF */
174 struct spa_rectangle size; /**< the frame size of the video */
175 struct spa_fraction framerate; /**< the framerate of the video, 0/1 means variable rate */
176 struct spa_fraction max_framerate; /**< the maximum framerate of the video. This is only valid when
177 \ref framerate is 0/1 */
178 uint32_t views; /**< the number of views in this video */
179 enum spa_video_interlace_mode interlace_mode; /**< the interlace mode */
180 struct spa_fraction pixel_aspect_ratio; /**< the pixel aspect ratio */
181 enum spa_video_multiview_mode multiview_mode; /**< multiview mode */
182 enum spa_video_multiview_flags multiview_flags; /**< multiview flags */
183 enum spa_video_chroma_site chroma_site; /**< the chroma siting */
184 enum spa_video_color_range color_range; /**< the color range. This is the valid range for the samples.
185 * It is used to convert the samples to Y'PbPr values. */
186 enum spa_video_color_matrix color_matrix; /**< the color matrix. Used to convert between Y'PbPr and
187 * non-linear RGB (R'G'B') */
188 enum spa_video_transfer_function transfer_function; /**< the transfer function. used to convert between R'G'B' and RGB */
189 enum spa_video_color_primaries color_primaries; /**< color primaries. used to convert between R'G'B' and CIE XYZ */
190 };
191  
192 #define SPA_VIDEO_INFO_RAW_INIT(...) ((struct spa_video_info_raw) { __VA_ARGS__ })
193  
194 /**
195 * \}
196 */
197  
198 #ifdef __cplusplus
199 } /* extern "C" */
200 #endif
201  
202 #endif /* SPA_VIDEO_RAW_H */