1/* GStreamer
2 * Copyright (C) <2011> Wim Taymans <wim.taymans@gmail.com>
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
13 *
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18 */
19
20#ifndef __GST_VIDEO_FORMAT_H__
21#define __GST_VIDEO_FORMAT_H__
22
23#include <gst/gst.h>
24
25G_BEGIN_DECLS
26
27#include <gst/video/video-enumtypes.h>
28#include <gst/video/video-tile.h>
29
30/**
31 * GstVideoFormat:
32 * @GST_VIDEO_FORMAT_UNKNOWN: Unknown or unset video format id
33 * @GST_VIDEO_FORMAT_ENCODED: Encoded video format. Only ever use that in caps for
34 * special video formats in combination with non-system
35 * memory GstCapsFeatures where it does not make sense
36 * to specify a real video format.
37 * @GST_VIDEO_FORMAT_I420: planar 4:2:0 YUV
38 * @GST_VIDEO_FORMAT_YV12: planar 4:2:0 YVU (like I420 but UV planes swapped)
39 * @GST_VIDEO_FORMAT_YUY2: packed 4:2:2 YUV (Y0-U0-Y1-V0 Y2-U2-Y3-V2 Y4 ...)
40 * @GST_VIDEO_FORMAT_UYVY: packed 4:2:2 YUV (U0-Y0-V0-Y1 U2-Y2-V2-Y3 U4 ...)
41 * @GST_VIDEO_FORMAT_VYUY: packed 4:2:2 YUV (V0-Y0-U0-Y1 V2-Y2-U2-Y3 V4 ...)
42 * @GST_VIDEO_FORMAT_AYUV: packed 4:4:4 YUV with alpha channel (A0-Y0-U0-V0 ...)
43 * @GST_VIDEO_FORMAT_RGBx: sparse rgb packed into 32 bit, space last
44 * @GST_VIDEO_FORMAT_BGRx: sparse reverse rgb packed into 32 bit, space last
45 * @GST_VIDEO_FORMAT_xRGB: sparse rgb packed into 32 bit, space first
46 * @GST_VIDEO_FORMAT_xBGR: sparse reverse rgb packed into 32 bit, space first
47 * @GST_VIDEO_FORMAT_RGBA: rgb with alpha channel last
48 * @GST_VIDEO_FORMAT_BGRA: reverse rgb with alpha channel last
49 * @GST_VIDEO_FORMAT_ARGB: rgb with alpha channel first
50 * @GST_VIDEO_FORMAT_ABGR: reverse rgb with alpha channel first
51 * @GST_VIDEO_FORMAT_RGB: RGB packed into 24 bits without padding (`R-G-B-R-G-B`)
52 * @GST_VIDEO_FORMAT_BGR: reverse RGB packed into 24 bits without padding (`B-G-R-B-G-R`)
53 * @GST_VIDEO_FORMAT_Y41B: planar 4:1:1 YUV
54 * @GST_VIDEO_FORMAT_Y42B: planar 4:2:2 YUV
55 * @GST_VIDEO_FORMAT_YVYU: packed 4:2:2 YUV (Y0-V0-Y1-U0 Y2-V2-Y3-U2 Y4 ...)
56 * @GST_VIDEO_FORMAT_Y444: planar 4:4:4 YUV
57 * @GST_VIDEO_FORMAT_v210: packed 4:2:2 10-bit YUV, complex format
58 * @GST_VIDEO_FORMAT_v216: packed 4:2:2 16-bit YUV, Y0-U0-Y1-V1 order
59 * @GST_VIDEO_FORMAT_NV12: planar 4:2:0 YUV with interleaved UV plane
60 * @GST_VIDEO_FORMAT_NV21: planar 4:2:0 YUV with interleaved VU plane
61 * @GST_VIDEO_FORMAT_NV12_10LE32: 10-bit variant of @GST_VIDEO_FORMAT_NV12, packed into 32bit words (MSB 2 bits padding) (Since: 1.14)
62 * @GST_VIDEO_FORMAT_GRAY8: 8-bit grayscale
63 * @GST_VIDEO_FORMAT_GRAY10_LE32: 10-bit grayscale, packed into 32bit words (2 bits padding) (Since: 1.14)
64 * @GST_VIDEO_FORMAT_GRAY16_BE: 16-bit grayscale, most significant byte first
65 * @GST_VIDEO_FORMAT_GRAY16_LE: 16-bit grayscale, least significant byte first
66 * @GST_VIDEO_FORMAT_v308: packed 4:4:4 YUV (Y-U-V ...)
67 * @GST_VIDEO_FORMAT_IYU2: packed 4:4:4 YUV (U-Y-V ...) (Since: 1.10)
68 * @GST_VIDEO_FORMAT_RGB16: rgb 5-6-5 bits per component
69 * @GST_VIDEO_FORMAT_BGR16: reverse rgb 5-6-5 bits per component
70 * @GST_VIDEO_FORMAT_RGB15: rgb 5-5-5 bits per component
71 * @GST_VIDEO_FORMAT_BGR15: reverse rgb 5-5-5 bits per component
72 * @GST_VIDEO_FORMAT_UYVP: packed 10-bit 4:2:2 YUV (U0-Y0-V0-Y1 U2-Y2-V2-Y3 U4 ...)
73 * @GST_VIDEO_FORMAT_A420: planar 4:4:2:0 AYUV
74 * @GST_VIDEO_FORMAT_RGB8P: 8-bit paletted RGB
75 * @GST_VIDEO_FORMAT_YUV9: planar 4:1:0 YUV
76 * @GST_VIDEO_FORMAT_YVU9: planar 4:1:0 YUV (like YUV9 but UV planes swapped)
77 * @GST_VIDEO_FORMAT_IYU1: packed 4:1:1 YUV (Cb-Y0-Y1-Cr-Y2-Y3 ...)
78 * @GST_VIDEO_FORMAT_ARGB64: rgb with alpha channel first, 16 bits (native endianness) per channel
79 * @GST_VIDEO_FORMAT_AYUV64: packed 4:4:4 YUV with alpha channel, 16 bits (native endianness) per channel (A0-Y0-U0-V0 ...)
80 * @GST_VIDEO_FORMAT_r210: packed 4:4:4 RGB, 10 bits per channel
81 * @GST_VIDEO_FORMAT_I420_10BE: planar 4:2:0 YUV, 10 bits per channel
82 * @GST_VIDEO_FORMAT_I420_10LE: planar 4:2:0 YUV, 10 bits per channel
83 * @GST_VIDEO_FORMAT_I422_10BE: planar 4:2:2 YUV, 10 bits per channel
84 * @GST_VIDEO_FORMAT_I422_10LE: planar 4:2:2 YUV, 10 bits per channel
85 * @GST_VIDEO_FORMAT_Y444_10BE: planar 4:4:4 YUV, 10 bits per channel (Since: 1.2)
86 * @GST_VIDEO_FORMAT_Y444_10LE: planar 4:4:4 YUV, 10 bits per channel (Since: 1.2)
87 * @GST_VIDEO_FORMAT_GBR: planar 4:4:4 RGB, 8 bits per channel (Since: 1.2)
88 * @GST_VIDEO_FORMAT_GBR_10BE: planar 4:4:4 RGB, 10 bits per channel (Since: 1.2)
89 * @GST_VIDEO_FORMAT_GBR_10LE: planar 4:4:4 RGB, 10 bits per channel (Since: 1.2)
90 * @GST_VIDEO_FORMAT_NV16: planar 4:2:2 YUV with interleaved UV plane (Since: 1.2)
91 * @GST_VIDEO_FORMAT_NV16_10LE32: 10-bit variant of @GST_VIDEO_FORMAT_NV16, packed into 32bit words (MSB 2 bits padding) (Since: 1.14)
92 * @GST_VIDEO_FORMAT_NV24: planar 4:4:4 YUV with interleaved UV plane (Since: 1.2)
93 * @GST_VIDEO_FORMAT_NV12_64Z32: NV12 with 64x32 tiling in zigzag pattern (Since: 1.4)
94 * @GST_VIDEO_FORMAT_A420_10BE: planar 4:4:2:0 YUV, 10 bits per channel (Since: 1.6)
95 * @GST_VIDEO_FORMAT_A420_10LE: planar 4:4:2:0 YUV, 10 bits per channel (Since: 1.6)
96 * @GST_VIDEO_FORMAT_A422_10BE: planar 4:4:2:2 YUV, 10 bits per channel (Since: 1.6)
97 * @GST_VIDEO_FORMAT_A422_10LE: planar 4:4:2:2 YUV, 10 bits per channel (Since: 1.6)
98 * @GST_VIDEO_FORMAT_A444_10BE: planar 4:4:4:4 YUV, 10 bits per channel (Since: 1.6)
99 * @GST_VIDEO_FORMAT_A444_10LE: planar 4:4:4:4 YUV, 10 bits per channel (Since: 1.6)
100 * @GST_VIDEO_FORMAT_NV61: planar 4:2:2 YUV with interleaved VU plane (Since: 1.6)
101 * @GST_VIDEO_FORMAT_P010_10BE: planar 4:2:0 YUV with interleaved UV plane, 10 bits per channel (Since: 1.10)
102 * @GST_VIDEO_FORMAT_P010_10LE: planar 4:2:0 YUV with interleaved UV plane, 10 bits per channel (Since: 1.10)
103 * @GST_VIDEO_FORMAT_GBRA: planar 4:4:4:4 ARGB, 8 bits per channel (Since: 1.12)
104 * @GST_VIDEO_FORMAT_GBRA_10BE: planar 4:4:4:4 ARGB, 10 bits per channel (Since: 1.12)
105 * @GST_VIDEO_FORMAT_GBRA_10LE: planar 4:4:4:4 ARGB, 10 bits per channel (Since: 1.12)
106 * @GST_VIDEO_FORMAT_GBR_12BE: planar 4:4:4 RGB, 12 bits per channel (Since: 1.12)
107 * @GST_VIDEO_FORMAT_GBR_12LE: planar 4:4:4 RGB, 12 bits per channel (Since: 1.12)
108 * @GST_VIDEO_FORMAT_GBRA_12BE: planar 4:4:4:4 ARGB, 12 bits per channel (Since: 1.12)
109 * @GST_VIDEO_FORMAT_GBRA_12LE: planar 4:4:4:4 ARGB, 12 bits per channel (Since: 1.12)
110 * @GST_VIDEO_FORMAT_I420_12BE: planar 4:2:0 YUV, 12 bits per channel (Since: 1.12)
111 * @GST_VIDEO_FORMAT_I420_12LE: planar 4:2:0 YUV, 12 bits per channel (Since: 1.12)
112 * @GST_VIDEO_FORMAT_I422_12BE: planar 4:2:2 YUV, 12 bits per channel (Since: 1.12)
113 * @GST_VIDEO_FORMAT_I422_12LE: planar 4:2:2 YUV, 12 bits per channel (Since: 1.12)
114 * @GST_VIDEO_FORMAT_Y444_12BE: planar 4:4:4 YUV, 12 bits per channel (Since: 1.12)
115 * @GST_VIDEO_FORMAT_Y444_12LE: planar 4:4:4 YUV, 12 bits per channel (Since: 1.12)
116 * @GST_VIDEO_FORMAT_NV12_10LE40: Fully packed variant of NV12_10LE32 (Since: 1.16)
117 * @GST_VIDEO_FORMAT_Y210: packed 4:2:2 YUV, 10 bits per channel (Since: 1.16)
118 * @GST_VIDEO_FORMAT_Y410: packed 4:4:4 YUV, 10 bits per channel(A-V-Y-U...) (Since: 1.16)
119 * @GST_VIDEO_FORMAT_VUYA: packed 4:4:4 YUV with alpha channel (V0-U0-Y0-A0...) (Since: 1.16)
120 * @GST_VIDEO_FORMAT_BGR10A2_LE: packed 4:4:4 RGB with alpha channel(B-G-R-A), 10 bits for R/G/B channel and MSB 2 bits for alpha channel (Since: 1.16)
121 * @GST_VIDEO_FORMAT_RGB10A2_LE: packed 4:4:4 RGB with alpha channel(R-G-B-A), 10 bits for R/G/B channel and MSB 2 bits for alpha channel (Since: 1.18)
122 * @GST_VIDEO_FORMAT_Y444_16BE: planar 4:4:4 YUV, 16 bits per channel (Since: 1.18)
123 * @GST_VIDEO_FORMAT_Y444_16LE: planar 4:4:4 YUV, 16 bits per channel (Since: 1.18)
124 * @GST_VIDEO_FORMAT_P016_BE: planar 4:2:0 YUV with interleaved UV plane, 16 bits per channel (Since: 1.18)
125 * @GST_VIDEO_FORMAT_P016_LE: planar 4:2:0 YUV with interleaved UV plane, 16 bits per channel (Since: 1.18)
126 * @GST_VIDEO_FORMAT_P012_BE: planar 4:2:0 YUV with interleaved UV plane, 12 bits per channel (Since: 1.18)
127 * @GST_VIDEO_FORMAT_P012_LE: planar 4:2:0 YUV with interleaved UV plane, 12 bits per channel (Since: 1.18)
128 * @GST_VIDEO_FORMAT_Y212_BE: packed 4:2:2 YUV, 12 bits per channel (Y-U-Y-V) (Since: 1.18)
129 * @GST_VIDEO_FORMAT_Y212_LE: packed 4:2:2 YUV, 12 bits per channel (Y-U-Y-V) (Since: 1.18)
130 * @GST_VIDEO_FORMAT_Y412_BE: packed 4:4:4:4 YUV, 12 bits per channel(U-Y-V-A...) (Since: 1.18)
131 * @GST_VIDEO_FORMAT_Y412_LE: packed 4:4:4:4 YUV, 12 bits per channel(U-Y-V-A...) (Since: 1.18)
132 * @GST_VIDEO_FORMAT_NV12_4L4: NV12 with 4x4 tiles in linear order (Since: 1.18)
133 * @GST_VIDEO_FORMAT_NV12_32L32: NV12 with 32x32 tiles in linear order (Since: 1.18)
134 * @GST_VIDEO_FORMAT_RGBP: planar 4:4:4 RGB, 8 bits per channel (Since: 1.20)
135 * @GST_VIDEO_FORMAT_BGRP: planar 4:4:4 RGB, 8 bits per channel (Since: 1.20)
136 * @GST_VIDEO_FORMAT_AV12: Planar 4:2:0 YUV with interleaved UV plane with alpha as 3rd plane (Since: 1.20)
137 * @GST_VIDEO_FORMAT_ARGB64_LE: RGB with alpha channel first, 16 bits per channel
138 * @GST_VIDEO_FORMAT_ARGB64_BE: RGB with alpha channel first, 16 bits per channel
139 * @GST_VIDEO_FORMAT_RGBA64_LE: RGB with alpha channel last, 16 bits per channel
140 * @GST_VIDEO_FORMAT_RGBA64_BE: RGB with alpha channel last, 16 bits per channel
141 * @GST_VIDEO_FORMAT_BGRA64_LE: reverse RGB with alpha channel last, 16 bits per channel
142 * @GST_VIDEO_FORMAT_BGRA64_BE: reverse RGB with alpha channel last, 16 bits per channel
143 * @GST_VIDEO_FORMAT_ABGR64_LE: reverse RGB with alpha channel first, 16 bits per channel
144 * @GST_VIDEO_FORMAT_ABGR64_BE: reverse RGB with alpha channel first, 16 bits per channel
145 * @GST_VIDEO_FORMAT_NV12_16L32S: NV12 with 16x32 Y tiles and 16x16 UV tiles. (Since: 1.22)
146 * @GST_VIDEO_FORMAT_NV12_8L128 : NV12 with 8x128 tiles in linear order (Since: 1.22)
147 * @GST_VIDEO_FORMAT_NV12_10BE_8L128 : NV12 10bit big endian with 8x128 tiles in linear order (Since: 1.22)
148 * @GST_VIDEO_FORMAT_NV12_10LE40_4L4: @GST_VIDEO_FORMAT_NV12_10LE40 with 4x4 pixels tiles (5 bytes per tile row) (Since: 1.24)
149 * @GST_VIDEO_FORMAT_DMA_DRM: DMA DRM special format. It's only used with
150 * memory:DMABuf #GstCapsFeatures, where an extra
151 * parameter (drm-format) is required to define the
152 * image format and its memory layout.
153 * @GST_VIDEO_FORMAT_MT2110T : Mediatek 10bit NV12 little endian with 16x32 tiles in linear order, tiled 2 bits (Since: 1.24)
154 * @GST_VIDEO_FORMAT_MT2110R : Mediatek 10bit NV12 little endian with 16x32 tiles in linear order, raster 2 bits (Since: 1.24)
155 * @GST_VIDEO_FORMAT_A422: planar 4:4:2:2 YUV, 8 bits per channel (Since: 1.24)
156 * @GST_VIDEO_FORMAT_A444: planar 4:4:4:4 YUV, 8 bits per channel (Since: 1.24)
157 * @GST_VIDEO_FORMAT_A444_12LE: planar 4:4:4:4 YUV, 12 bits per channel (Since: 1.24)
158 * @GST_VIDEO_FORMAT_A444_12BE: planar 4:4:4:4 YUV, 12 bits per channel (Since: 1.24)
159 * @GST_VIDEO_FORMAT_A422_12LE: planar 4:4:2:2 YUV, 12 bits per channel (Since: 1.24)
160 * @GST_VIDEO_FORMAT_A422_12BE: planar 4:4:2:2 YUV, 12 bits per channel (Since: 1.24)
161 * @GST_VIDEO_FORMAT_A420_12LE: planar 4:4:2:0 YUV, 12 bits per channel (Since: 1.24)
162 * @GST_VIDEO_FORMAT_A420_12BE: planar 4:4:2:0 YUV, 12 bits per channel (Since: 1.24)
163 * @GST_VIDEO_FORMAT_A444_16LE: planar 4:4:4:4 YUV, 16 bits per channel (Since: 1.24)
164 * @GST_VIDEO_FORMAT_A444_16BE: planar 4:4:4:4 YUV, 16 bits per channel (Since: 1.24)
165 * @GST_VIDEO_FORMAT_A422_16LE: planar 4:4:2:2 YUV, 16 bits per channel (Since: 1.24)
166 * @GST_VIDEO_FORMAT_A422_16BE: planar 4:4:2:2 YUV, 16 bits per channel (Since: 1.24)
167 * @GST_VIDEO_FORMAT_A420_16LE: planar 4:4:2:0 YUV, 16 bits per channel (Since: 1.24)
168 * @GST_VIDEO_FORMAT_A420_16BE: planar 4:4:2:0 YUV, 16 bits per channel (Since: 1.24)
169 * @GST_VIDEO_FORMAT_GBR_16LE: planar 4:4:4 RGB, 16 bits per channel (Since: 1.24)
170 * @GST_VIDEO_FORMAT_GBR_16BE: planar 4:4:4 RGB, 16 bits per channel (Since: 1.24)
171 * @GST_VIDEO_FORMAT_RBGA: packed RGB with alpha, 8 bits per channel (Since: 1.24)
172 *
173 * Enum value describing the most common video formats.
174 *
175 * See the [GStreamer raw video format design document](https://gstreamer.freedesktop.org/documentation/additional/design/mediatype-video-raw.html#formats)
176 * for details about the layout and packing of these formats in memory.
177 */
178typedef enum {
179 GST_VIDEO_FORMAT_UNKNOWN,
180 GST_VIDEO_FORMAT_ENCODED,
181 GST_VIDEO_FORMAT_I420,
182 GST_VIDEO_FORMAT_YV12,
183 GST_VIDEO_FORMAT_YUY2,
184 GST_VIDEO_FORMAT_UYVY,
185 GST_VIDEO_FORMAT_AYUV,
186 GST_VIDEO_FORMAT_RGBx,
187 GST_VIDEO_FORMAT_BGRx,
188 GST_VIDEO_FORMAT_xRGB,
189 GST_VIDEO_FORMAT_xBGR,
190 GST_VIDEO_FORMAT_RGBA,
191 GST_VIDEO_FORMAT_BGRA,
192 GST_VIDEO_FORMAT_ARGB,
193 GST_VIDEO_FORMAT_ABGR,
194 GST_VIDEO_FORMAT_RGB,
195 GST_VIDEO_FORMAT_BGR,
196 GST_VIDEO_FORMAT_Y41B,
197 GST_VIDEO_FORMAT_Y42B,
198 GST_VIDEO_FORMAT_YVYU,
199 GST_VIDEO_FORMAT_Y444,
200 GST_VIDEO_FORMAT_v210,
201 GST_VIDEO_FORMAT_v216,
202 GST_VIDEO_FORMAT_NV12,
203 GST_VIDEO_FORMAT_NV21,
204 GST_VIDEO_FORMAT_GRAY8,
205 GST_VIDEO_FORMAT_GRAY16_BE,
206 GST_VIDEO_FORMAT_GRAY16_LE,
207 GST_VIDEO_FORMAT_v308,
208 GST_VIDEO_FORMAT_RGB16,
209 GST_VIDEO_FORMAT_BGR16,
210 GST_VIDEO_FORMAT_RGB15,
211 GST_VIDEO_FORMAT_BGR15,
212 GST_VIDEO_FORMAT_UYVP,
213 GST_VIDEO_FORMAT_A420,
214 GST_VIDEO_FORMAT_RGB8P,
215 GST_VIDEO_FORMAT_YUV9,
216 GST_VIDEO_FORMAT_YVU9,
217 GST_VIDEO_FORMAT_IYU1,
218 GST_VIDEO_FORMAT_ARGB64,
219 GST_VIDEO_FORMAT_AYUV64,
220 GST_VIDEO_FORMAT_r210,
221 GST_VIDEO_FORMAT_I420_10BE,
222 GST_VIDEO_FORMAT_I420_10LE,
223 GST_VIDEO_FORMAT_I422_10BE,
224 GST_VIDEO_FORMAT_I422_10LE,
225 GST_VIDEO_FORMAT_Y444_10BE,
226 GST_VIDEO_FORMAT_Y444_10LE,
227 GST_VIDEO_FORMAT_GBR,
228 GST_VIDEO_FORMAT_GBR_10BE,
229 GST_VIDEO_FORMAT_GBR_10LE,
230 GST_VIDEO_FORMAT_NV16,
231 GST_VIDEO_FORMAT_NV24,
232 GST_VIDEO_FORMAT_NV12_64Z32,
233 GST_VIDEO_FORMAT_A420_10BE,
234 GST_VIDEO_FORMAT_A420_10LE,
235 GST_VIDEO_FORMAT_A422_10BE,
236 GST_VIDEO_FORMAT_A422_10LE,
237 GST_VIDEO_FORMAT_A444_10BE,
238 GST_VIDEO_FORMAT_A444_10LE,
239 GST_VIDEO_FORMAT_NV61,
240 GST_VIDEO_FORMAT_P010_10BE,
241 GST_VIDEO_FORMAT_P010_10LE,
242 GST_VIDEO_FORMAT_IYU2,
243 GST_VIDEO_FORMAT_VYUY,
244 GST_VIDEO_FORMAT_GBRA,
245 GST_VIDEO_FORMAT_GBRA_10BE,
246 GST_VIDEO_FORMAT_GBRA_10LE,
247 GST_VIDEO_FORMAT_GBR_12BE,
248 GST_VIDEO_FORMAT_GBR_12LE,
249 GST_VIDEO_FORMAT_GBRA_12BE,
250 GST_VIDEO_FORMAT_GBRA_12LE,
251 GST_VIDEO_FORMAT_I420_12BE,
252 GST_VIDEO_FORMAT_I420_12LE,
253 GST_VIDEO_FORMAT_I422_12BE,
254 GST_VIDEO_FORMAT_I422_12LE,
255 GST_VIDEO_FORMAT_Y444_12BE,
256 GST_VIDEO_FORMAT_Y444_12LE,
257 GST_VIDEO_FORMAT_GRAY10_LE32,
258 GST_VIDEO_FORMAT_NV12_10LE32,
259 GST_VIDEO_FORMAT_NV16_10LE32,
260 GST_VIDEO_FORMAT_NV12_10LE40,
261 GST_VIDEO_FORMAT_Y210,
262 GST_VIDEO_FORMAT_Y410,
263 GST_VIDEO_FORMAT_VUYA,
264 GST_VIDEO_FORMAT_BGR10A2_LE,
265 GST_VIDEO_FORMAT_RGB10A2_LE,
266 GST_VIDEO_FORMAT_Y444_16BE,
267 GST_VIDEO_FORMAT_Y444_16LE,
268 GST_VIDEO_FORMAT_P016_BE,
269 GST_VIDEO_FORMAT_P016_LE,
270 GST_VIDEO_FORMAT_P012_BE,
271 GST_VIDEO_FORMAT_P012_LE,
272 GST_VIDEO_FORMAT_Y212_BE,
273 GST_VIDEO_FORMAT_Y212_LE,
274 GST_VIDEO_FORMAT_Y412_BE,
275 GST_VIDEO_FORMAT_Y412_LE,
276 /**
277 * GST_VIDEO_FORMAT_NV12_4L4:
278 *
279 * NV12 with 4x4 tiles in linear order.
280 *
281 * Since: 1.18
282 */
283 GST_VIDEO_FORMAT_NV12_4L4,
284 /**
285 * GST_VIDEO_FORMAT_NV12_32L32:
286 *
287 * NV12 with 32x32 tiles in linear order.
288 *
289 * Since: 1.18
290 */
291 GST_VIDEO_FORMAT_NV12_32L32,
292
293 /**
294 * GST_VIDEO_FORMAT_RGBP:
295 *
296 * Planar 4:4:4 RGB, R-G-B order
297 *
298 * Since: 1.20
299 */
300 GST_VIDEO_FORMAT_RGBP,
301
302 /**
303 * GST_VIDEO_FORMAT_BGRP:
304 *
305 * Planar 4:4:4 RGB, B-G-R order
306 *
307 * Since: 1.20
308 */
309 GST_VIDEO_FORMAT_BGRP,
310
311 /**
312 * GST_VIDEO_FORMAT_AV12:
313 *
314 * Planar 4:2:0 YUV with interleaved UV plane with alpha as
315 * 3rd plane.
316 *
317 * Since: 1.20
318 */
319 GST_VIDEO_FORMAT_AV12,
320
321 /**
322 * GST_VIDEO_FORMAT_ARGB64_LE:
323 *
324 * RGB with alpha channel first, 16 bits (little endian)
325 * per channel.
326 *
327 * Since: 1.20
328 */
329 GST_VIDEO_FORMAT_ARGB64_LE,
330
331 /**
332 * GST_VIDEO_FORMAT_ARGB64_BE:
333 *
334 * RGB with alpha channel first, 16 bits (big endian)
335 * per channel.
336 *
337 * Since: 1.20
338 */
339 GST_VIDEO_FORMAT_ARGB64_BE,
340
341 /**
342 * GST_VIDEO_FORMAT_RGBA64_LE:
343 *
344 * RGB with alpha channel last, 16 bits (little endian)
345 * per channel.
346 *
347 * Since: 1.20
348 */
349 GST_VIDEO_FORMAT_RGBA64_LE,
350
351 /**
352 * GST_VIDEO_FORMAT_RGBA64_BE:
353 *
354 * RGB with alpha channel last, 16 bits (big endian)
355 * per channel.
356 *
357 * Since: 1.20
358 */
359 GST_VIDEO_FORMAT_RGBA64_BE,
360
361 /**
362 * GST_VIDEO_FORMAT_BGRA64_LE:
363 *
364 * Reverse RGB with alpha channel last, 16 bits (little endian)
365 * per channel.
366 *
367 * Since: 1.20
368 */
369 GST_VIDEO_FORMAT_BGRA64_LE,
370
371 /**
372 * GST_VIDEO_FORMAT_BGRA64_BE:
373 *
374 * Reverse RGB with alpha channel last, 16 bits (big endian)
375 * per channel.
376 *
377 * Since: 1.20
378 */
379 GST_VIDEO_FORMAT_BGRA64_BE,
380
381 /**
382 * GST_VIDEO_FORMAT_ABGR64_LE:
383 *
384 * Reverse RGB with alpha channel first, 16 bits (little endian)
385 * per channel.
386 *
387 * Since: 1.20
388 */
389 GST_VIDEO_FORMAT_ABGR64_LE,
390
391 /**
392 * GST_VIDEO_FORMAT_ABGR64_BE:
393 *
394 * Reverse RGB with alpha channel first, 16 bits (big endian)
395 * per channel.
396 *
397 * Since: 1.20
398 */
399 GST_VIDEO_FORMAT_ABGR64_BE,
400
401 /**
402 * GST_VIDEO_FORMAT_NV12_16L32S:
403 *
404 * NV12 with 16x32 Y tiles and 16x16 UV tiles.
405 *
406 * Since: 1.22
407 */
408 GST_VIDEO_FORMAT_NV12_16L32S,
409
410 /**
411 * GST_VIDEO_FORMAT_NV12_8L128:
412 *
413 * NV12 with 8x128 tiles in linear order.
414 *
415 * Since: 1.22
416 */
417 GST_VIDEO_FORMAT_NV12_8L128,
418
419 /**
420 * GST_VIDEO_FORMAT_NV12_10BE_8L128:
421 *
422 * NV12 10bit big endian with 8x128 tiles in linear order.
423 *
424 * Since: 1.22
425 */
426 GST_VIDEO_FORMAT_NV12_10BE_8L128,
427
428 /**
429 * GST_VIDEO_FORMAT_NV12_10LE40_4L4:
430 *
431 * @GST_VIDEO_FORMAT_NV12_10LE40 with 4x4 pixels tiles (5 bytes
432 * per tile row). This format is produced by Verisilicon/Hantro decoders.
433 *
434 * Since: 1.24
435 */
436 GST_VIDEO_FORMAT_NV12_10LE40_4L4,
437
438 /**
439 * GST_VIDEO_FORMAT_DMA_DRM:
440 *
441 * @GST_VIDEO_FORMAT_DMA_DRM represent the DMA DRM special format. It's
442 * only used with memory:DMABuf #GstCapsFeatures, where an extra
443 * parameter (drm-format) is required to define the image format and
444 * its memory layout.
445 *
446 * Since: 1.24
447 */
448 GST_VIDEO_FORMAT_DMA_DRM,
449
450 /**
451 * GST_VIDEO_FORMAT_MT2110T:
452 *
453 * Mediatek 10bit NV12 little endian with 16x32 tiles in linear order, tile 2
454 * bits.
455 *
456 * Since: 1.24
457 */
458 GST_VIDEO_FORMAT_MT2110T,
459
460 /**
461 * GST_VIDEO_FORMAT_MT2110R:
462 *
463 * Mediatek 10bit NV12 little endian with 16x32 tiles in linear order, raster
464 * 2 bits.
465 *
466 * Since: 1.24
467 */
468 GST_VIDEO_FORMAT_MT2110R,
469
470 /**
471 * GST_VIDEO_FORMAT_A422:
472 *
473 * planar 4:4:2:2 YUV, 8 bits per channel
474 *
475 * Since: 1.24
476 */
477 GST_VIDEO_FORMAT_A422,
478
479 /**
480 * GST_VIDEO_FORMAT_A444:
481 *
482 * planar 4:4:4:4 YUV, 8 bits per channel
483 *
484 * Since: 1.24
485 */
486 GST_VIDEO_FORMAT_A444,
487
488 /**
489 * GST_VIDEO_FORMAT_A444_12LE:
490 *
491 * planar 4:4:4:4 YUV, 12 bits per channel
492 *
493 * Since: 1.24
494 */
495 GST_VIDEO_FORMAT_A444_12LE,
496
497 /**
498 * GST_VIDEO_FORMAT_A444_12BE:
499 *
500 * planar 4:4:4:4 YUV, 12 bits per channel
501 *
502 * Since: 1.24
503 */
504 GST_VIDEO_FORMAT_A444_12BE,
505
506 /**
507 * GST_VIDEO_FORMAT_A422_12LE:
508 *
509 * planar 4:4:2:2 YUV, 12 bits per channel
510 *
511 * Since: 1.24
512 */
513 GST_VIDEO_FORMAT_A422_12LE,
514
515 /**
516 * GST_VIDEO_FORMAT_A422_12BE:
517 *
518 * planar 4:4:2:2 YUV, 12 bits per channel
519 *
520 * Since: 1.24
521 */
522 GST_VIDEO_FORMAT_A422_12BE,
523
524 /**
525 * GST_VIDEO_FORMAT_A420_12LE:
526 *
527 * planar 4:4:2:0 YUV, 12 bits per channel
528 *
529 * Since: 1.24
530 */
531 GST_VIDEO_FORMAT_A420_12LE,
532
533 /**
534 * GST_VIDEO_FORMAT_A420_12BE:
535 *
536 * planar 4:4:2:0 YUV, 12 bits per channel
537 *
538 * Since: 1.24
539 */
540 GST_VIDEO_FORMAT_A420_12BE,
541
542 /**
543 * GST_VIDEO_FORMAT_A444_16LE:
544 *
545 * planar 4:4:4:4 YUV, 16 bits per channel
546 *
547 * Since: 1.24
548 */
549 GST_VIDEO_FORMAT_A444_16LE,
550
551 /**
552 * GST_VIDEO_FORMAT_A444_16BE:
553 *
554 * planar 4:4:4:4 YUV, 16 bits per channel
555 *
556 * Since: 1.24
557 */
558 GST_VIDEO_FORMAT_A444_16BE,
559
560 /**
561 * GST_VIDEO_FORMAT_A422_16LE:
562 *
563 * planar 4:4:2:2 YUV, 16 bits per channel
564 *
565 * Since: 1.24
566 */
567 GST_VIDEO_FORMAT_A422_16LE,
568
569 /**
570 * GST_VIDEO_FORMAT_A422_16BE:
571 *
572 * planar 4:4:2:2 YUV, 16 bits per channel
573 *
574 * Since: 1.24
575 */
576 GST_VIDEO_FORMAT_A422_16BE,
577
578 /**
579 * GST_VIDEO_FORMAT_A420_16LE:
580 *
581 * planar 4:4:2:0 YUV, 16 bits per channel
582 *
583 * Since: 1.24
584 */
585 GST_VIDEO_FORMAT_A420_16LE,
586
587 /**
588 * GST_VIDEO_FORMAT_A420_16BE:
589 *
590 * planar 4:4:2:0 YUV, 16 bits per channel
591 *
592 * Since: 1.24
593 */
594 GST_VIDEO_FORMAT_A420_16BE,
595
596 /**
597 * GST_VIDEO_FORMAT_GBR_16LE:
598 *
599 * planar 4:4:4 RGB, 16 bits per channel
600 *
601 * Since: 1.24
602 */
603 GST_VIDEO_FORMAT_GBR_16LE,
604
605 /**
606 * GST_VIDEO_FORMAT_GBR_16BE:
607 *
608 * planar 4:4:4 RGB, 16 bits per channel
609 *
610 * Since: 1.24
611 */
612 GST_VIDEO_FORMAT_GBR_16BE,
613
614 /**
615 * GST_VIDEO_FORMAT_RBGA:
616 *
617 * packed RGB with alpha, 8 bits per channel
618 *
619 * Since: 1.24
620 */
621 GST_VIDEO_FORMAT_RBGA,
622} GstVideoFormat;
623
624#define GST_VIDEO_MAX_PLANES 4
625#define GST_VIDEO_MAX_COMPONENTS 4
626
627typedef struct _GstVideoFormatInfo GstVideoFormatInfo;
628
629/**
630 * GstVideoFormatFlags:
631 * @GST_VIDEO_FORMAT_FLAG_YUV: The video format is YUV, components are numbered
632 * 0=Y, 1=U, 2=V.
633 * @GST_VIDEO_FORMAT_FLAG_RGB: The video format is RGB, components are numbered
634 * 0=R, 1=G, 2=B.
635 * @GST_VIDEO_FORMAT_FLAG_GRAY: The video is gray, there is one gray component
636 * with index 0.
637 * @GST_VIDEO_FORMAT_FLAG_ALPHA: The video format has an alpha components with
638 * the number 3.
639 * @GST_VIDEO_FORMAT_FLAG_LE: The video format has data stored in little
640 * endianness.
641 * @GST_VIDEO_FORMAT_FLAG_PALETTE: The video format has a palette. The palette
642 * is stored in the second plane and indexes are stored in the first plane.
643 * @GST_VIDEO_FORMAT_FLAG_COMPLEX: The video format has a complex layout that
644 * can't be described with the usual information in the #GstVideoFormatInfo.
645 * @GST_VIDEO_FORMAT_FLAG_UNPACK: This format can be used in a
646 * #GstVideoFormatUnpack and #GstVideoFormatPack function.
647 * @GST_VIDEO_FORMAT_FLAG_TILED: The format is tiled, there is tiling information
648 * in the last plane.
649 * @GST_VIDEO_FORMAT_FLAG_SUBTILES: The tile size varies per plane
650 * according to the subsampling. (Since: 1.22)
651 *
652 * The different video flags that a format info can have.
653 */
654typedef enum
655{
656 GST_VIDEO_FORMAT_FLAG_YUV = (1 << 0),
657 GST_VIDEO_FORMAT_FLAG_RGB = (1 << 1),
658 GST_VIDEO_FORMAT_FLAG_GRAY = (1 << 2),
659 GST_VIDEO_FORMAT_FLAG_ALPHA = (1 << 3),
660 GST_VIDEO_FORMAT_FLAG_LE = (1 << 4),
661 GST_VIDEO_FORMAT_FLAG_PALETTE = (1 << 5),
662 GST_VIDEO_FORMAT_FLAG_COMPLEX = (1 << 6),
663 GST_VIDEO_FORMAT_FLAG_UNPACK = (1 << 7),
664 GST_VIDEO_FORMAT_FLAG_TILED = (1 << 8),
665 /**
666 * GST_VIDEO_FORMAT_FLAG_SUBTILES:
667 *
668 * The tile size varies per plane according to the subsampling.
669 *
670 * Since: 1.22
671 */
672 GST_VIDEO_FORMAT_FLAG_SUBTILES = (1 << 9)
673} GstVideoFormatFlags;
674
675/* YUV components */
676#define GST_VIDEO_COMP_Y 0
677#define GST_VIDEO_COMP_U 1
678#define GST_VIDEO_COMP_V 2
679
680/* RGB components */
681#define GST_VIDEO_COMP_R 0
682#define GST_VIDEO_COMP_G 1
683#define GST_VIDEO_COMP_B 2
684
685/* alpha component */
686#define GST_VIDEO_COMP_A 3
687
688/* palette components */
689#define GST_VIDEO_COMP_INDEX 0
690#define GST_VIDEO_COMP_PALETTE 1
691
692#include <gst/video/video-chroma.h>
693
694/**
695 * GstVideoPackFlags:
696 * @GST_VIDEO_PACK_FLAG_NONE: No flag
697 * @GST_VIDEO_PACK_FLAG_TRUNCATE_RANGE: When the source has a smaller depth
698 * than the target format, set the least significant bits of the target
699 * to 0. This is likely slightly faster but less accurate. When this flag
700 * is not specified, the most significant bits of the source are duplicated
701 * in the least significant bits of the destination.
702 * @GST_VIDEO_PACK_FLAG_INTERLACED: The source is interlaced. The unpacked
703 * format will be interlaced as well with each line containing
704 * information from alternating fields. (Since: 1.2)
705 *
706 * The different flags that can be used when packing and unpacking.
707 */
708typedef enum
709{
710 GST_VIDEO_PACK_FLAG_NONE = 0,
711 GST_VIDEO_PACK_FLAG_TRUNCATE_RANGE = (1 << 0),
712 GST_VIDEO_PACK_FLAG_INTERLACED = (1 << 1)
713} GstVideoPackFlags;
714
715/**
716 * GstVideoFormatUnpack:
717 * @info: a #GstVideoFormatInfo
718 * @flags: flags to control the unpacking
719 * @dest: a destination array
720 * @data: pointers to the data planes
721 * @stride: strides of the planes
722 * @x: the x position in the image to start from
723 * @y: the y position in the image to start from
724 * @width: the amount of pixels to unpack.
725 *
726 * Unpacks @width pixels from the given planes and strides containing data of
727 * format @info. The pixels will be unpacked into @dest with each component
728 * interleaved as per @info's unpack_format, which will usually be one of
729 * #GST_VIDEO_FORMAT_ARGB, #GST_VIDEO_FORMAT_AYUV, #GST_VIDEO_FORMAT_ARGB64 or
730 * #GST_VIDEO_FORMAT_AYUV64 depending on the format to unpack.
731 * @dest should at least be big enough to hold @width * bytes_per_pixel bytes
732 * where bytes_per_pixel relates to the unpack format and will usually be
733 * either 4 or 8 depending on the unpack format. bytes_per_pixel will be
734 * the same as the pixel stride for plane 0 for the above formats.
735 *
736 * For subsampled formats, the components will be duplicated in the destination
737 * array. Reconstruction of the missing components can be performed in a
738 * separate step after unpacking.
739 */
740typedef void (*GstVideoFormatUnpack) (const GstVideoFormatInfo *info,
741 GstVideoPackFlags flags, gpointer dest,
742 const gpointer data[GST_VIDEO_MAX_PLANES],
743 const gint stride[GST_VIDEO_MAX_PLANES],
744 gint x, gint y, gint width);
745/**
746 * GstVideoFormatPack:
747 * @info: a #GstVideoFormatInfo
748 * @flags: flags to control the packing
749 * @src: a source array
750 * @sstride: the source array stride
751 * @data: pointers to the destination data planes
752 * @stride: strides of the destination planes
753 * @chroma_site: the chroma siting of the target when subsampled (not used)
754 * @y: the y position in the image to pack to
755 * @width: the amount of pixels to pack.
756 *
757 * Packs @width pixels from @src to the given planes and strides in the
758 * format @info. The pixels from source have each component interleaved
759 * and will be packed into the planes in @data.
760 *
761 * This function operates on pack_lines lines, meaning that @src should
762 * contain at least pack_lines lines with a stride of @sstride and @y
763 * should be a multiple of pack_lines.
764 *
765 * Subsampled formats will use the horizontally and vertically cosited
766 * component from the source. Subsampling should be performed before
767 * packing.
768 *
769 * Because this function does not have a x coordinate, it is not possible to
770 * pack pixels starting from an unaligned position. For tiled images this
771 * means that packing should start from a tile coordinate. For subsampled
772 * formats this means that a complete pixel needs to be packed.
773 */
774/* FIXME(2.0): remove the chroma_site, it is unused and is not relevant for
775 * packing, chroma subsampling based on chroma-site should be done in a separate
776 * step before packing*/
777typedef void (*GstVideoFormatPack) (const GstVideoFormatInfo *info,
778 GstVideoPackFlags flags,
779 const gpointer src, gint sstride,
780 gpointer data[GST_VIDEO_MAX_PLANES],
781 const gint stride[GST_VIDEO_MAX_PLANES],
782 GstVideoChromaSite chroma_site,
783 gint y, gint width);
784
785/**
786 * GstVideoFormatInfo:
787 * @format: #GstVideoFormat
788 * @name: string representation of the format
789 * @description: use readable description of the format
790 * @flags: #GstVideoFormatFlags
791 * @bits: The number of bits used to pack data items. This can be less than 8
792 * when multiple pixels are stored in a byte. for values > 8 multiple bytes
793 * should be read according to the endianness flag before applying the shift
794 * and mask.
795 * @n_components: the number of components in the video format.
796 * @shift: the number of bits to shift away to get the component data
797 * @depth: the depth in bits for each component
798 * @pixel_stride: the pixel stride of each component. This is the amount of
799 * bytes to the pixel immediately to the right. When bits < 8, the stride is
800 * expressed in bits. For 24-bit RGB, this would be 3 bytes, for example,
801 * while it would be 4 bytes for RGBx or ARGB.
802 * @n_planes: the number of planes for this format. The number of planes can be
803 * less than the amount of components when multiple components are packed into
804 * one plane.
805 * @plane: the plane number where a component can be found
806 * @poffset: the offset in the plane where the first pixel of the components
807 * can be found.
808 * @w_sub: subsampling factor of the width for the component. Use
809 * GST_VIDEO_SUB_SCALE to scale a width.
810 * @h_sub: subsampling factor of the height for the component. Use
811 * GST_VIDEO_SUB_SCALE to scale a height.
812 * @unpack_format: the format of the unpacked pixels. This format must have the
813 * #GST_VIDEO_FORMAT_FLAG_UNPACK flag set.
814 * @unpack_func: an unpack function for this format
815 * @pack_lines: the amount of lines that will be packed
816 * @pack_func: an pack function for this format
817 * @tile_mode: The tiling mode
818 * @tile_ws: The width of a tile, in bytes, represented as a shift. DEPRECATED,
819 * use tile_info[] array instead.
820 * @tile_hs: The height of a tile, in bytes, represented as a shift. DEPREACTED,
821 * use tile_info[] array instead.
822 * @tile_info: Per-plane tile information
823 *
824 * Information for a video format.
825 */
826struct _GstVideoFormatInfo {
827 GstVideoFormat format;
828 const gchar *name;
829 const gchar *description;
830 GstVideoFormatFlags flags;
831 guint bits;
832 guint n_components;
833 guint shift[GST_VIDEO_MAX_COMPONENTS];
834 guint depth[GST_VIDEO_MAX_COMPONENTS];
835 gint pixel_stride[GST_VIDEO_MAX_COMPONENTS];
836 guint n_planes;
837 guint plane[GST_VIDEO_MAX_COMPONENTS];
838 guint poffset[GST_VIDEO_MAX_COMPONENTS];
839 guint w_sub[GST_VIDEO_MAX_COMPONENTS];
840 guint h_sub[GST_VIDEO_MAX_COMPONENTS];
841
842 GstVideoFormat unpack_format;
843 GstVideoFormatUnpack unpack_func;
844 gint pack_lines;
845 GstVideoFormatPack pack_func;
846
847 GstVideoTileMode tile_mode;
848 G_DEPRECATED_FOR(tile_info) guint tile_ws;
849 G_DEPRECATED_FOR(tile_info) guint tile_hs;
850
851 /**
852 * GstVideoFormatInfo.tile_info:
853 *
854 * Information about the tiles for each of the planes.
855 *
856 * Since: 1.22
857 */
858 GstVideoTileInfo tile_info[GST_VIDEO_MAX_PLANES];
859};
860
861/**
862 * GST_VIDEO_FORMAT_INFO_IS_VALID_RAW:
863 *
864 * Tests that the given #GstVideoFormatInfo represents a valid un-encoded
865 * format.
866 *
867 * Since: 1.22
868 */
869#define GST_VIDEO_FORMAT_INFO_IS_VALID_RAW(info) \
870 (info != NULL && (info)->format > GST_VIDEO_FORMAT_ENCODED)
871
872#define GST_VIDEO_FORMAT_INFO_FORMAT(info) ((info)->format)
873#define GST_VIDEO_FORMAT_INFO_NAME(info) ((info)->name)
874#define GST_VIDEO_FORMAT_INFO_FLAGS(info) ((info)->flags)
875
876#define GST_VIDEO_FORMAT_INFO_IS_YUV(info) (((info)->flags & GST_VIDEO_FORMAT_FLAG_YUV) != 0)
877#define GST_VIDEO_FORMAT_INFO_IS_RGB(info) (((info)->flags & GST_VIDEO_FORMAT_FLAG_RGB) != 0)
878#define GST_VIDEO_FORMAT_INFO_IS_GRAY(info) (((info)->flags & GST_VIDEO_FORMAT_FLAG_GRAY) != 0)
879#define GST_VIDEO_FORMAT_INFO_HAS_ALPHA(info) (((info)->flags & GST_VIDEO_FORMAT_FLAG_ALPHA) != 0)
880#define GST_VIDEO_FORMAT_INFO_IS_LE(info) (((info)->flags & GST_VIDEO_FORMAT_FLAG_LE) != 0)
881#define GST_VIDEO_FORMAT_INFO_HAS_PALETTE(info) (((info)->flags & GST_VIDEO_FORMAT_FLAG_PALETTE) != 0)
882#define GST_VIDEO_FORMAT_INFO_IS_COMPLEX(info) (((info)->flags & GST_VIDEO_FORMAT_FLAG_COMPLEX) != 0)
883#define GST_VIDEO_FORMAT_INFO_IS_TILED(info) (((info)->flags & GST_VIDEO_FORMAT_FLAG_TILED) != 0)
884/**
885 * GST_VIDEO_FORMAT_INFO_HAS_SUBTILES:
886 * @info: a #GstVideoFormatInfo
887 *
888 * This macro checks if %GST_VIDEO_FORMAT_FLAG_SUBTILES is set. When this
889 * flag is set, it means that the tile sizes must be scaled as per the
890 * subsampling.
891 *
892 * Returns: %TRUE if the format uses subsampled tile sizes.
893 *
894 * Since: 1.22
895 */
896#define GST_VIDEO_FORMAT_INFO_HAS_SUBTILES(info) (((info)->flags & GST_VIDEO_FORMAT_FLAG_SUBTILES) != 0)
897
898#define GST_VIDEO_FORMAT_INFO_BITS(info) ((info)->bits)
899#define GST_VIDEO_FORMAT_INFO_N_COMPONENTS(info) ((info)->n_components)
900#define GST_VIDEO_FORMAT_INFO_SHIFT(info,c) ((info)->shift[c])
901#define GST_VIDEO_FORMAT_INFO_DEPTH(info,c) ((info)->depth[c])
902/**
903 * GST_VIDEO_FORMAT_INFO_PSTRIDE:
904 * @info: a #GstVideoFormatInfo
905 * @c: the component index
906 *
907 * pixel stride for the given component. This is the amount of bytes to the
908 * pixel immediately to the right, so basically bytes from one pixel to the
909 * next. When bits < 8, the stride is expressed in bits.
910 *
911 * Examples: for 24-bit RGB, the pixel stride would be 3 bytes, while it
912 * would be 4 bytes for RGBx or ARGB, and 8 bytes for ARGB64 or AYUV64.
913 * For planar formats such as I420 the pixel stride is usually 1. For
914 * YUY2 it would be 2 bytes.
915 */
916#define GST_VIDEO_FORMAT_INFO_PSTRIDE(info,c) ((info)->pixel_stride[c])
917/**
918 * GST_VIDEO_FORMAT_INFO_N_PLANES:
919 * @info: a #GstVideoFormatInfo
920 *
921 * Number of planes. This is the number of planes the pixel layout is
922 * organized in in memory. The number of planes can be less than the
923 * number of components (e.g. Y,U,V,A or R, G, B, A) when multiple
924 * components are packed into one plane.
925 *
926 * Examples: RGB/RGBx/RGBA: 1 plane, 3/3/4 components;
927 * I420: 3 planes, 3 components; NV21/NV12: 2 planes, 3 components.
928 */
929#define GST_VIDEO_FORMAT_INFO_N_PLANES(info) ((info)->n_planes)
930/**
931 * GST_VIDEO_FORMAT_INFO_PLANE:
932 * @info: a #GstVideoFormatInfo
933 * @c: the component index
934 *
935 * Plane number where the given component can be found. A plane may
936 * contain data for multiple components.
937 */
938#define GST_VIDEO_FORMAT_INFO_PLANE(info,c) ((info)->plane[c])
939#define GST_VIDEO_FORMAT_INFO_POFFSET(info,c) ((info)->poffset[c])
940#define GST_VIDEO_FORMAT_INFO_W_SUB(info,c) ((info)->w_sub[c])
941#define GST_VIDEO_FORMAT_INFO_H_SUB(info,c) ((info)->h_sub[c])
942
943/* rounds up */
944#define GST_VIDEO_SUB_SCALE(scale,val) (-((-((gint)(val)))>>(scale)))
945
946#define GST_VIDEO_FORMAT_INFO_SCALE_WIDTH(info,c,w) GST_VIDEO_SUB_SCALE ((info)->w_sub[c],(w))
947#define GST_VIDEO_FORMAT_INFO_SCALE_HEIGHT(info,c,h) GST_VIDEO_SUB_SCALE ((info)->h_sub[c],(h))
948
949#define GST_VIDEO_FORMAT_INFO_DATA(info,planes,comp) \
950 (((guint8*)(planes)[(info)->plane[comp]]) + (info)->poffset[comp])
951/**
952 * GST_VIDEO_FORMAT_INFO_STRIDE:
953 * @info: a #GstVideoFormatInfo
954 * @strides: an array of strides
955 * @comp: the component index
956 *
957 * Row stride in bytes, that is number of bytes from the first pixel component
958 * of a row to the first pixel component in the next row. This might include
959 * some row padding (memory not actually used for anything, to make sure the
960 * beginning of the next row is aligned in a particular way).
961 */
962#define GST_VIDEO_FORMAT_INFO_STRIDE(info,strides,comp) ((strides)[(info)->plane[comp]])
963#define GST_VIDEO_FORMAT_INFO_OFFSET(info,offsets,comp) \
964 (((offsets)[(info)->plane[comp]]) + (info)->poffset[comp])
965
966#define GST_VIDEO_FORMAT_INFO_TILE_MODE(info) ((info)->tile_mode)
967#define GST_VIDEO_FORMAT_INFO_TILE_WS(info) ((info)->tile_ws)
968#define GST_VIDEO_FORMAT_INFO_TILE_HS(info) ((info)->tile_hs)
969
970/**
971 * GST_VIDEO_FORMAT_INFO_TILE_SIZE:
972 * @info: a #GstVideoFormatInfo
973 * @plane: the plane index
974 *
975 * Provides the size in bytes of a tile in the specified @plane. This replaces
976 * the width and height shift, which was limited to power of two dimensions.
977 *
978 * Since: 1.22
979 */
980#define GST_VIDEO_FORMAT_INFO_TILE_SIZE(info,plane) ((info)->tile_info[plane].size)
981
982/**
983 * GST_VIDEO_FORMAT_INFO_TILE_WIDTH:
984 * @info: a #GstVideoFormatInfo
985 * @plane: the plane index
986 *
987 * See #GstVideoTileInfo.width.
988 *
989 * Return the width of one tile in pixels, zero if its not an integer.
990 *
991 * Since: 1.22
992 */
993#define GST_VIDEO_FORMAT_INFO_TILE_WIDTH(info,plane) ((info)->tile_info[plane].width)
994
995/**
996 * GST_VIDEO_FORMAT_INFO_TILE_HEIGHT:
997 * @info: a #GstVideoFormatInfo
998 * @plane: the plane index
999 *
1000 * See #GstVideoTileInfo.height.
1001 *
1002 * Returns the tile height.
1003 *
1004 * Since: 1.22
1005 */
1006#define GST_VIDEO_FORMAT_INFO_TILE_HEIGHT(info,plane) ((info)->tile_info[plane].height)
1007
1008/**
1009 * GST_VIDEO_FORMAT_INFO_TILE_STRIDE:
1010 * @info: a #GstVideoFormatInfo
1011 * @plane: the plane index
1012 *
1013 * See #GstVideoTileInfo.stride.
1014 *
1015 * Returns the stride of one tile, regardless of the internal details of the
1016 * tile (could be a complex system with subtile) the tiles size should alway
1017 * match the tile width multiplied by the tile stride.
1018 *
1019 * Since: 1.22
1020 */
1021#define GST_VIDEO_FORMAT_INFO_TILE_STRIDE(info,plane) ((info)->tile_info[plane].stride)
1022
1023
1024GST_VIDEO_API
1025void gst_video_format_info_component (const GstVideoFormatInfo *info, guint plane, gint components[GST_VIDEO_MAX_COMPONENTS]);
1026
1027GST_VIDEO_API
1028gint gst_video_format_info_extrapolate_stride (const GstVideoFormatInfo * finfo,
1029 gint plane, gint stride);
1030
1031/* format properties */
1032
1033GST_VIDEO_API
1034GstVideoFormat gst_video_format_from_masks (gint depth, gint bpp, gint endianness,
1035 guint red_mask, guint green_mask,
1036 guint blue_mask, guint alpha_mask) G_GNUC_CONST;
1037
1038GST_VIDEO_API
1039GstVideoFormat gst_video_format_from_fourcc (guint32 fourcc) G_GNUC_CONST;
1040
1041GST_VIDEO_API
1042GstVideoFormat gst_video_format_from_string (const gchar *format) G_GNUC_CONST;
1043
1044GST_VIDEO_API
1045guint32 gst_video_format_to_fourcc (GstVideoFormat format) G_GNUC_CONST;
1046
1047GST_VIDEO_API
1048const gchar * gst_video_format_to_string (GstVideoFormat format) G_GNUC_CONST;
1049
1050GST_VIDEO_API
1051const GstVideoFormatInfo *
1052 gst_video_format_get_info (GstVideoFormat format) G_GNUC_CONST;
1053
1054GST_VIDEO_API
1055gconstpointer gst_video_format_get_palette (GstVideoFormat format, gsize *size);
1056
1057#define GST_VIDEO_SIZE_RANGE "(int) [ 1, max ]"
1058#define GST_VIDEO_FPS_RANGE "(fraction) [ 0, max ]"
1059
1060#if G_BYTE_ORDER == G_LITTLE_ENDIAN
1061# define GST_VIDEO_NE(s) G_STRINGIFY(s)"_LE"
1062# define GST_VIDEO_OE(s) G_STRINGIFY(s)"_BE"
1063#else
1064# define GST_VIDEO_NE(s) G_STRINGIFY(s)"_BE"
1065# define GST_VIDEO_OE(s) G_STRINGIFY(s)"_LE"
1066#endif
1067
1068/**
1069 * GST_VIDEO_FORMATS_ALL_STR:
1070 *
1071 * Declare all video formats as a string.
1072 *
1073 * Formats are sorted by decreasing "quality", using these criteria by priority:
1074 * - number of components
1075 * - depth
1076 * - subsampling factor of the width
1077 * - subsampling factor of the height
1078 * - number of planes
1079 * - native endianness preferred
1080 * - pixel stride
1081 * - poffset
1082 * - prefer non-complex formats
1083 * - prefer YUV formats over RGB ones
1084 * - prefer I420 over YV12
1085 * - format name
1086 *
1087 * Since: 1.24
1088 */
1089#if G_BYTE_ORDER == G_BIG_ENDIAN
1090#define GST_VIDEO_FORMATS_ALL_STR "A444_16BE, A444_16LE, AYUV64, ARGB64, " \
1091 "RGBA64_BE, ARGB64_BE, BGRA64_BE, ABGR64_BE, RGBA64_LE, ARGB64_LE, " \
1092 "BGRA64_LE, ABGR64_LE, A422_16BE, A422_16LE, A420_16BE, A420_16LE, " \
1093 "A444_12BE, GBRA_12BE, A444_12LE, GBRA_12LE, Y412_BE, Y412_LE, A422_12BE, " \
1094 "A422_12LE, A420_12BE, A420_12LE, A444_10BE, GBRA_10BE, A444_10LE, " \
1095 "GBRA_10LE, A422_10BE, A422_10LE, A420_10BE, A420_10LE, Y410, BGR10A2_LE, " \
1096 "RGB10A2_LE, A444, GBRA, AYUV, VUYA, RGBA, RBGA, ARGB, BGRA, ABGR, A422, " \
1097 "A420, AV12, Y444_16BE, GBR_16BE, Y444_16LE, GBR_16LE, v216, P016_BE, " \
1098 "P016_LE, Y444_12BE, GBR_12BE, Y444_12LE, GBR_12LE, I422_12BE, I422_12LE, " \
1099 "Y212_BE, Y212_LE, I420_12BE, I420_12LE, P012_BE, P012_LE, Y444_10BE, " \
1100 "GBR_10BE, Y444_10LE, GBR_10LE, r210, I422_10BE, I422_10LE, NV16_10LE32, " \
1101 "Y210, UYVP, v210, I420_10BE, I420_10LE, P010_10BE, MT2110R, MT2110T, " \
1102 "NV12_10BE_8L128, NV12_10LE40_4L4, P010_10LE, NV12_10LE40, NV12_10LE32, " \
1103 "Y444, BGRP, GBR, RGBP, NV24, v308, IYU2, RGBx, xRGB, BGRx, xBGR, RGB, " \
1104 "BGR, Y42B, NV16, NV61, YUY2, YVYU, UYVY, VYUY, I420, YV12, NV12, NV21, " \
1105 "NV12_16L32S, NV12_32L32, NV12_4L4, NV12_64Z32, NV12_8L128, Y41B, IYU1, " \
1106 "YUV9, YVU9, BGR16, RGB16, BGR15, RGB15, RGB8P, GRAY16_BE, GRAY16_LE, " \
1107 "GRAY10_LE32, GRAY8"
1108#elif G_BYTE_ORDER == G_LITTLE_ENDIAN
1109#define GST_VIDEO_FORMATS_ALL_STR "A444_16LE, A444_16BE, AYUV64, RGBA64_LE, " \
1110 "ARGB64, ARGB64_LE, BGRA64_LE, ABGR64_LE, RGBA64_BE, ARGB64_BE, BGRA64_BE, " \
1111 "ABGR64_BE, A422_16LE, A422_16BE, A420_16LE, A420_16BE, A444_12LE, " \
1112 "GBRA_12LE, A444_12BE, GBRA_12BE, Y412_LE, Y412_BE, A422_12LE, A422_12BE, " \
1113 "A420_12LE, A420_12BE, A444_10LE, GBRA_10LE, A444_10BE, GBRA_10BE, " \
1114 "A422_10LE, A422_10BE, A420_10LE, A420_10BE, BGR10A2_LE, RGB10A2_LE, Y410, " \
1115 "A444, GBRA, AYUV, VUYA, RGBA, RBGA, ARGB, BGRA, ABGR, A422, A420, AV12, " \
1116 "Y444_16LE, GBR_16LE, Y444_16BE, GBR_16BE, v216, P016_LE, P016_BE, " \
1117 "Y444_12LE, GBR_12LE, Y444_12BE, GBR_12BE, I422_12LE, I422_12BE, Y212_LE, " \
1118 "Y212_BE, I420_12LE, I420_12BE, P012_LE, P012_BE, Y444_10LE, GBR_10LE, " \
1119 "Y444_10BE, GBR_10BE, r210, I422_10LE, I422_10BE, NV16_10LE32, Y210, UYVP, " \
1120 "v210, I420_10LE, I420_10BE, P010_10LE, NV12_10LE40, NV12_10LE32, " \
1121 "P010_10BE, MT2110R, MT2110T, NV12_10BE_8L128, NV12_10LE40_4L4, Y444, " \
1122 "BGRP, GBR, RGBP, NV24, v308, IYU2, RGBx, xRGB, BGRx, xBGR, RGB, BGR, " \
1123 "Y42B, NV16, NV61, YUY2, YVYU, UYVY, VYUY, I420, YV12, NV12, NV21, " \
1124 "NV12_16L32S, NV12_32L32, NV12_4L4, NV12_64Z32, NV12_8L128, Y41B, IYU1, " \
1125 "YUV9, YVU9, BGR16, RGB16, BGR15, RGB15, RGB8P, GRAY16_LE, GRAY16_BE, " \
1126 "GRAY10_LE32, GRAY8"
1127#endif
1128
1129/**
1130 * GST_VIDEO_FORMATS_ANY_STR:
1131 *
1132 * This is similar to %GST_VIDEO_FORMATS_ALL_STR but includes formats like
1133 * DMA_DRM for which no software converter exists. This should be used for
1134 * passthrough template caps.
1135 *
1136 * Since: 1.24
1137 */
1138#define GST_VIDEO_FORMATS_ANY_STR "DMA_DRM, " GST_VIDEO_FORMATS_ALL_STR
1139
1140/**
1141 * GST_VIDEO_FORMATS_ALL:
1142 *
1143 * List of all video formats, for use in template caps strings.
1144 *
1145 * Formats are sorted by decreasing "quality", using these criteria by priority:
1146 * - number of components
1147 * - depth
1148 * - subsampling factor of the width
1149 * - subsampling factor of the height
1150 * - number of planes
1151 * - native endianness preferred
1152 * - pixel stride
1153 * - poffset
1154 * - prefer non-complex formats
1155 * - prefer YUV formats over RGB ones
1156 * - prefer I420 over YV12
1157 * - format name
1158 */
1159#define GST_VIDEO_FORMATS_ALL "{ " GST_VIDEO_FORMATS_ALL_STR " }"
1160
1161/**
1162 * GST_VIDEO_FORMATS_ANY:
1163 *
1164 * This is similar to %GST_VIDEO_FORMATS_ALL but includes formats like DMA_DRM
1165 * that do not have a software converter. This should be used for passthrough
1166 * template caps.
1167 *
1168 * Since: 1.24
1169 */
1170#define GST_VIDEO_FORMATS_ANY "{ " GST_VIDEO_FORMATS_ANY_STR " }"
1171
1172GST_VIDEO_API
1173const GstVideoFormat * gst_video_formats_raw (guint * len);
1174
1175GST_VIDEO_API
1176const GstVideoFormat * gst_video_formats_any (guint * len);
1177
1178/**
1179 * GST_VIDEO_CAPS_MAKE:
1180 * @format: string format that describes the pixel layout, as string
1181 * (e.g. "I420", "RGB", "YV12", "YUY2", "AYUV", etc.)
1182 *
1183 * Generic caps string for video, for use in pad templates.
1184 */
1185#define GST_VIDEO_CAPS_MAKE(format) \
1186 "video/x-raw, " \
1187 "format = (string) " format ", " \
1188 "width = " GST_VIDEO_SIZE_RANGE ", " \
1189 "height = " GST_VIDEO_SIZE_RANGE ", " \
1190 "framerate = " GST_VIDEO_FPS_RANGE
1191
1192/**
1193 * GST_VIDEO_CAPS_MAKE_WITH_FEATURES:
1194 * @format: string format that describes the pixel layout, as string
1195 * (e.g. "I420", "RGB", "YV12", "YUY2", "AYUV", etc.)
1196 * @features: Requires caps features as a string, e.g.
1197 * "memory:SystemMemory".
1198 *
1199 * Generic caps string for video, for use in pad templates.
1200 *
1201 * Since: 1.2
1202 */
1203#define GST_VIDEO_CAPS_MAKE_WITH_FEATURES(features,format) \
1204 "video/x-raw(" features "), " \
1205 "format = (string) " format ", " \
1206 "width = " GST_VIDEO_SIZE_RANGE ", " \
1207 "height = " GST_VIDEO_SIZE_RANGE ", " \
1208 "framerate = " GST_VIDEO_FPS_RANGE
1209
1210GST_VIDEO_API
1211GstCaps * gst_video_make_raw_caps (const GstVideoFormat formats[], guint len);
1212
1213GST_VIDEO_API
1214GstCaps * gst_video_make_raw_caps_with_features (const GstVideoFormat formats[], guint len,
1215 GstCapsFeatures * features);
1216
1217
1218G_END_DECLS
1219
1220#endif /* __GST_VIDEO_FORMAT_H__ */
1221

source code of include/gstreamer-1.0/gst/video/video-format.h