7a645ccaab763e0d621e8087544b22e5b891e2d8
[platform/upstream/gstreamer.git] / subprojects / gst-plugins-base / gst-libs / gst / video / video-format.h
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
25 G_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  *
149  * Enum value describing the most common video formats.
150  *
151  * See the [GStreamer raw video format design document](https://gstreamer.freedesktop.org/documentation/additional/design/mediatype-video-raw.html#formats)
152  * for details about the layout and packing of these formats in memory.
153  */
154 typedef enum {
155   GST_VIDEO_FORMAT_UNKNOWN,
156   GST_VIDEO_FORMAT_ENCODED,
157   GST_VIDEO_FORMAT_I420,
158   GST_VIDEO_FORMAT_YV12,
159   GST_VIDEO_FORMAT_YUY2,
160   GST_VIDEO_FORMAT_UYVY,
161   GST_VIDEO_FORMAT_AYUV,
162   GST_VIDEO_FORMAT_RGBx,
163   GST_VIDEO_FORMAT_BGRx,
164   GST_VIDEO_FORMAT_xRGB,
165   GST_VIDEO_FORMAT_xBGR,
166   GST_VIDEO_FORMAT_RGBA,
167   GST_VIDEO_FORMAT_BGRA,
168   GST_VIDEO_FORMAT_ARGB,
169   GST_VIDEO_FORMAT_ABGR,
170   GST_VIDEO_FORMAT_RGB,
171   GST_VIDEO_FORMAT_BGR,
172   GST_VIDEO_FORMAT_Y41B,
173   GST_VIDEO_FORMAT_Y42B,
174   GST_VIDEO_FORMAT_YVYU,
175   GST_VIDEO_FORMAT_Y444,
176   GST_VIDEO_FORMAT_v210,
177   GST_VIDEO_FORMAT_v216,
178   GST_VIDEO_FORMAT_NV12,
179   GST_VIDEO_FORMAT_NV21,
180   GST_VIDEO_FORMAT_GRAY8,
181   GST_VIDEO_FORMAT_GRAY16_BE,
182   GST_VIDEO_FORMAT_GRAY16_LE,
183   GST_VIDEO_FORMAT_v308,
184   GST_VIDEO_FORMAT_RGB16,
185   GST_VIDEO_FORMAT_BGR16,
186   GST_VIDEO_FORMAT_RGB15,
187   GST_VIDEO_FORMAT_BGR15,
188   GST_VIDEO_FORMAT_UYVP,
189   GST_VIDEO_FORMAT_A420,
190   GST_VIDEO_FORMAT_RGB8P,
191   GST_VIDEO_FORMAT_YUV9,
192   GST_VIDEO_FORMAT_YVU9,
193   GST_VIDEO_FORMAT_IYU1,
194   GST_VIDEO_FORMAT_ARGB64,
195   GST_VIDEO_FORMAT_AYUV64,
196   GST_VIDEO_FORMAT_r210,
197   GST_VIDEO_FORMAT_I420_10BE,
198   GST_VIDEO_FORMAT_I420_10LE,
199   GST_VIDEO_FORMAT_I422_10BE,
200   GST_VIDEO_FORMAT_I422_10LE,
201   GST_VIDEO_FORMAT_Y444_10BE,
202   GST_VIDEO_FORMAT_Y444_10LE,
203   GST_VIDEO_FORMAT_GBR,
204   GST_VIDEO_FORMAT_GBR_10BE,
205   GST_VIDEO_FORMAT_GBR_10LE,
206   GST_VIDEO_FORMAT_NV16,
207   GST_VIDEO_FORMAT_NV24,
208   GST_VIDEO_FORMAT_NV12_64Z32,
209   GST_VIDEO_FORMAT_A420_10BE,
210   GST_VIDEO_FORMAT_A420_10LE,
211   GST_VIDEO_FORMAT_A422_10BE,
212   GST_VIDEO_FORMAT_A422_10LE,
213   GST_VIDEO_FORMAT_A444_10BE,
214   GST_VIDEO_FORMAT_A444_10LE,
215   GST_VIDEO_FORMAT_NV61,
216   GST_VIDEO_FORMAT_P010_10BE,
217   GST_VIDEO_FORMAT_P010_10LE,
218   GST_VIDEO_FORMAT_IYU2,
219   GST_VIDEO_FORMAT_VYUY,
220   GST_VIDEO_FORMAT_GBRA,
221   GST_VIDEO_FORMAT_GBRA_10BE,
222   GST_VIDEO_FORMAT_GBRA_10LE,
223   GST_VIDEO_FORMAT_GBR_12BE,
224   GST_VIDEO_FORMAT_GBR_12LE,
225   GST_VIDEO_FORMAT_GBRA_12BE,
226   GST_VIDEO_FORMAT_GBRA_12LE,
227   GST_VIDEO_FORMAT_I420_12BE,
228   GST_VIDEO_FORMAT_I420_12LE,
229   GST_VIDEO_FORMAT_I422_12BE,
230   GST_VIDEO_FORMAT_I422_12LE,
231   GST_VIDEO_FORMAT_Y444_12BE,
232   GST_VIDEO_FORMAT_Y444_12LE,
233   GST_VIDEO_FORMAT_GRAY10_LE32,
234   GST_VIDEO_FORMAT_NV12_10LE32,
235   GST_VIDEO_FORMAT_NV16_10LE32,
236   GST_VIDEO_FORMAT_NV12_10LE40,
237   GST_VIDEO_FORMAT_Y210,
238   GST_VIDEO_FORMAT_Y410,
239   GST_VIDEO_FORMAT_VUYA,
240   GST_VIDEO_FORMAT_BGR10A2_LE,
241   GST_VIDEO_FORMAT_RGB10A2_LE,
242   GST_VIDEO_FORMAT_Y444_16BE,
243   GST_VIDEO_FORMAT_Y444_16LE,
244   GST_VIDEO_FORMAT_P016_BE,
245   GST_VIDEO_FORMAT_P016_LE,
246   GST_VIDEO_FORMAT_P012_BE,
247   GST_VIDEO_FORMAT_P012_LE,
248   GST_VIDEO_FORMAT_Y212_BE,
249   GST_VIDEO_FORMAT_Y212_LE,
250   GST_VIDEO_FORMAT_Y412_BE,
251   GST_VIDEO_FORMAT_Y412_LE,
252   /**
253    * GST_VIDEO_FORMAT_NV12_4L4:
254    *
255    * NV12 with 4x4 tiles in linear order.
256    *
257    * Since: 1.18
258    */
259   GST_VIDEO_FORMAT_NV12_4L4,
260   /**
261    * GST_VIDEO_FORMAT_NV12_32L32:
262    *
263    * NV12 with 32x32 tiles in linear order.
264    *
265    * Since: 1.18
266    */
267   GST_VIDEO_FORMAT_NV12_32L32,
268
269   /**
270    * GST_VIDEO_FORMAT_RGBP:
271    *
272    * Planar 4:4:4 RGB, R-G-B order
273    *
274    * Since: 1.20
275    */
276   GST_VIDEO_FORMAT_RGBP,
277
278   /**
279    * GST_VIDEO_FORMAT_BGRP:
280    *
281    * Planar 4:4:4 RGB, B-G-R order
282    *
283    * Since: 1.20
284    */
285   GST_VIDEO_FORMAT_BGRP,
286
287   /**
288    * GST_VIDEO_FORMAT_AV12:
289    *
290    * Planar 4:2:0 YUV with interleaved UV plane with alpha as
291    * 3rd plane.
292    *
293    * Since: 1.20
294    */
295   GST_VIDEO_FORMAT_AV12,
296
297   /**
298    * GST_VIDEO_FORMAT_ARGB64_LE:
299    *
300    * RGB with alpha channel first, 16 bits (little endian)
301    * per channel.
302    *
303    * Since: 1.20
304    */
305   GST_VIDEO_FORMAT_ARGB64_LE,
306
307   /**
308    * GST_VIDEO_FORMAT_ARGB64_BE:
309    *
310    * RGB with alpha channel first, 16 bits (big endian)
311    * per channel.
312    *
313    * Since: 1.20
314    */
315   GST_VIDEO_FORMAT_ARGB64_BE,
316
317   /**
318    * GST_VIDEO_FORMAT_RGBA64_LE:
319    *
320    * RGB with alpha channel last, 16 bits (little endian)
321    * per channel.
322    *
323    * Since: 1.20
324    */
325   GST_VIDEO_FORMAT_RGBA64_LE,
326
327   /**
328    * GST_VIDEO_FORMAT_RGBA64_BE:
329    *
330    * RGB with alpha channel last, 16 bits (big endian)
331    * per channel.
332    *
333    * Since: 1.20
334    */
335   GST_VIDEO_FORMAT_RGBA64_BE,
336
337   /**
338    * GST_VIDEO_FORMAT_BGRA64_LE:
339    *
340    * Reverse RGB with alpha channel last, 16 bits (little endian)
341    * per channel.
342    *
343    * Since: 1.20
344    */
345   GST_VIDEO_FORMAT_BGRA64_LE,
346
347   /**
348    * GST_VIDEO_FORMAT_BGRA64_BE:
349    *
350    * Reverse RGB with alpha channel last, 16 bits (big endian)
351    * per channel.
352    *
353    * Since: 1.20
354    */
355   GST_VIDEO_FORMAT_BGRA64_BE,
356
357   /**
358    * GST_VIDEO_FORMAT_ABGR64_LE:
359    *
360    * Reverse RGB with alpha channel first, 16 bits (little endian)
361    * per channel.
362    *
363    * Since: 1.20
364    */
365   GST_VIDEO_FORMAT_ABGR64_LE,
366
367   /**
368    * GST_VIDEO_FORMAT_ABGR64_BE:
369    *
370    * Reverse RGB with alpha channel first, 16 bits (big endian)
371    * per channel.
372    *
373    * Since: 1.20
374    */
375   GST_VIDEO_FORMAT_ABGR64_BE,
376
377   /**
378    * GST_VIDEO_FORMAT_NV12_16L32S:
379    *
380    * NV12 with 16x32 Y tiles and 16x16 UV tiles.
381    *
382    * Since: 1.22
383    */
384   GST_VIDEO_FORMAT_NV12_16L32S,
385
386   /**
387    * GST_VIDEO_FORMAT_NV12_8L128:
388    *
389    * NV12 with 8x128 tiles in linear order.
390    *
391    * Since: 1.22
392    */
393   GST_VIDEO_FORMAT_NV12_8L128,
394
395   /**
396    * GST_VIDEO_FORMAT_NV12_10BE_8L128:
397    *
398    * NV12 10bit big endian with 8x128 tiles in linear order.
399    *
400    * Since: 1.22
401    */
402   GST_VIDEO_FORMAT_NV12_10BE_8L128,
403 } GstVideoFormat;
404
405 #define GST_VIDEO_MAX_PLANES 4
406 #define GST_VIDEO_MAX_COMPONENTS 4
407
408 typedef struct _GstVideoFormatInfo GstVideoFormatInfo;
409
410 /**
411  * GstVideoFormatFlags:
412  * @GST_VIDEO_FORMAT_FLAG_YUV: The video format is YUV, components are numbered
413  *   0=Y, 1=U, 2=V.
414  * @GST_VIDEO_FORMAT_FLAG_RGB: The video format is RGB, components are numbered
415  *   0=R, 1=G, 2=B.
416  * @GST_VIDEO_FORMAT_FLAG_GRAY: The video is gray, there is one gray component
417  *   with index 0.
418  * @GST_VIDEO_FORMAT_FLAG_ALPHA: The video format has an alpha components with
419  *   the number 3.
420  * @GST_VIDEO_FORMAT_FLAG_LE: The video format has data stored in little
421  *   endianness.
422  * @GST_VIDEO_FORMAT_FLAG_PALETTE: The video format has a palette. The palette
423  *   is stored in the second plane and indexes are stored in the first plane.
424  * @GST_VIDEO_FORMAT_FLAG_COMPLEX: The video format has a complex layout that
425  *   can't be described with the usual information in the #GstVideoFormatInfo.
426  * @GST_VIDEO_FORMAT_FLAG_UNPACK: This format can be used in a
427  *   #GstVideoFormatUnpack and #GstVideoFormatPack function.
428  * @GST_VIDEO_FORMAT_FLAG_TILED: The format is tiled, there is tiling information
429  *   in the last plane.
430  * @GST_VIDEO_FORMAT_FLAG_SUBTILES: The tile size varies per plane
431  *   according to the subsampling. (Since: 1.22)
432  *
433  * The different video flags that a format info can have.
434  */
435 typedef enum
436 {
437   GST_VIDEO_FORMAT_FLAG_YUV      = (1 << 0),
438   GST_VIDEO_FORMAT_FLAG_RGB      = (1 << 1),
439   GST_VIDEO_FORMAT_FLAG_GRAY     = (1 << 2),
440   GST_VIDEO_FORMAT_FLAG_ALPHA    = (1 << 3),
441   GST_VIDEO_FORMAT_FLAG_LE       = (1 << 4),
442   GST_VIDEO_FORMAT_FLAG_PALETTE  = (1 << 5),
443   GST_VIDEO_FORMAT_FLAG_COMPLEX  = (1 << 6),
444   GST_VIDEO_FORMAT_FLAG_UNPACK   = (1 << 7),
445   GST_VIDEO_FORMAT_FLAG_TILED    = (1 << 8),
446   /**
447    * GST_VIDEO_FORMAT_FLAG_SUBTILES:
448    *
449    * The tile size varies per plane according to the subsampling.
450    *
451    * Since: 1.22
452    */
453   GST_VIDEO_FORMAT_FLAG_SUBTILES = (1 << 9)
454 } GstVideoFormatFlags;
455
456 /* YUV components */
457 #define GST_VIDEO_COMP_Y  0
458 #define GST_VIDEO_COMP_U  1
459 #define GST_VIDEO_COMP_V  2
460
461 /* RGB components */
462 #define GST_VIDEO_COMP_R  0
463 #define GST_VIDEO_COMP_G  1
464 #define GST_VIDEO_COMP_B  2
465
466 /* alpha component */
467 #define GST_VIDEO_COMP_A  3
468
469 /* palette components */
470 #define GST_VIDEO_COMP_INDEX    0
471 #define GST_VIDEO_COMP_PALETTE  1
472
473 #include <gst/video/video-chroma.h>
474
475 /**
476  * GstVideoPackFlags:
477  * @GST_VIDEO_PACK_FLAG_NONE: No flag
478  * @GST_VIDEO_PACK_FLAG_TRUNCATE_RANGE: When the source has a smaller depth
479  *   than the target format, set the least significant bits of the target
480  *   to 0. This is likely slightly faster but less accurate. When this flag
481  *   is not specified, the most significant bits of the source are duplicated
482  *   in the least significant bits of the destination.
483  * @GST_VIDEO_PACK_FLAG_INTERLACED: The source is interlaced. The unpacked
484  *   format will be interlaced as well with each line containing
485  *   information from alternating fields. (Since: 1.2)
486  *
487  * The different flags that can be used when packing and unpacking.
488  */
489 typedef enum
490 {
491   GST_VIDEO_PACK_FLAG_NONE           = 0,
492   GST_VIDEO_PACK_FLAG_TRUNCATE_RANGE = (1 << 0),
493   GST_VIDEO_PACK_FLAG_INTERLACED     = (1 << 1)
494 } GstVideoPackFlags;
495
496 /**
497  * GstVideoFormatUnpack:
498  * @info: a #GstVideoFormatInfo
499  * @flags: flags to control the unpacking
500  * @dest: a destination array
501  * @data: pointers to the data planes
502  * @stride: strides of the planes
503  * @x: the x position in the image to start from
504  * @y: the y position in the image to start from
505  * @width: the amount of pixels to unpack.
506  *
507  * Unpacks @width pixels from the given planes and strides containing data of
508  * format @info. The pixels will be unpacked into @dest with each component
509  * interleaved as per @info's unpack_format, which will usually be one of
510  * #GST_VIDEO_FORMAT_ARGB, #GST_VIDEO_FORMAT_AYUV, #GST_VIDEO_FORMAT_ARGB64 or
511  * #GST_VIDEO_FORMAT_AYUV64 depending on the format to unpack.
512  * @dest should at least be big enough to hold @width * bytes_per_pixel bytes
513  * where bytes_per_pixel relates to the unpack format and will usually be
514  * either 4 or 8 depending on the unpack format. bytes_per_pixel will be
515  * the same as the pixel stride for plane 0 for the above formats.
516  *
517  * For subsampled formats, the components will be duplicated in the destination
518  * array. Reconstruction of the missing components can be performed in a
519  * separate step after unpacking.
520  */
521 typedef void (*GstVideoFormatUnpack)         (const GstVideoFormatInfo *info,
522                                               GstVideoPackFlags flags, gpointer dest,
523                                               const gpointer data[GST_VIDEO_MAX_PLANES],
524                                               const gint stride[GST_VIDEO_MAX_PLANES],
525                                               gint x, gint y, gint width);
526 /**
527  * GstVideoFormatPack:
528  * @info: a #GstVideoFormatInfo
529  * @flags: flags to control the packing
530  * @src: a source array
531  * @sstride: the source array stride
532  * @data: pointers to the destination data planes
533  * @stride: strides of the destination planes
534  * @chroma_site: the chroma siting of the target when subsampled (not used)
535  * @y: the y position in the image to pack to
536  * @width: the amount of pixels to pack.
537  *
538  * Packs @width pixels from @src to the given planes and strides in the
539  * format @info. The pixels from source have each component interleaved
540  * and will be packed into the planes in @data.
541  *
542  * This function operates on pack_lines lines, meaning that @src should
543  * contain at least pack_lines lines with a stride of @sstride and @y
544  * should be a multiple of pack_lines.
545  *
546  * Subsampled formats will use the horizontally and vertically cosited
547  * component from the source. Subsampling should be performed before
548  * packing.
549  *
550  * Because this function does not have a x coordinate, it is not possible to
551  * pack pixels starting from an unaligned position. For tiled images this
552  * means that packing should start from a tile coordinate. For subsampled
553  * formats this means that a complete pixel needs to be packed.
554  */
555 /* FIXME(2.0): remove the chroma_site, it is unused and is not relevant for
556  * packing, chroma subsampling based on chroma-site should be done in a separate
557  * step before packing*/
558 typedef void (*GstVideoFormatPack)           (const GstVideoFormatInfo *info,
559                                               GstVideoPackFlags flags,
560                                               const gpointer src, gint sstride,
561                                               gpointer data[GST_VIDEO_MAX_PLANES],
562                                               const gint stride[GST_VIDEO_MAX_PLANES],
563                                               GstVideoChromaSite chroma_site,
564                                               gint y, gint width);
565
566 /**
567  * GstVideoFormatInfo:
568  * @format: #GstVideoFormat
569  * @name: string representation of the format
570  * @description: use readable description of the format
571  * @flags: #GstVideoFormatFlags
572  * @bits: The number of bits used to pack data items. This can be less than 8
573  *    when multiple pixels are stored in a byte. for values > 8 multiple bytes
574  *    should be read according to the endianness flag before applying the shift
575  *    and mask.
576  * @n_components: the number of components in the video format.
577  * @shift: the number of bits to shift away to get the component data
578  * @depth: the depth in bits for each component
579  * @pixel_stride: the pixel stride of each component. This is the amount of
580  *    bytes to the pixel immediately to the right. When bits < 8, the stride is
581  *    expressed in bits. For 24-bit RGB, this would be 3 bytes, for example,
582  *    while it would be 4 bytes for RGBx or ARGB.
583  * @n_planes: the number of planes for this format. The number of planes can be
584  *    less than the amount of components when multiple components are packed into
585  *    one plane.
586  * @plane: the plane number where a component can be found
587  * @poffset: the offset in the plane where the first pixel of the components
588  *    can be found.
589  * @w_sub: subsampling factor of the width for the component. Use
590  *     GST_VIDEO_SUB_SCALE to scale a width.
591  * @h_sub: subsampling factor of the height for the component. Use
592  *     GST_VIDEO_SUB_SCALE to scale a height.
593  * @unpack_format: the format of the unpacked pixels. This format must have the
594  *     #GST_VIDEO_FORMAT_FLAG_UNPACK flag set.
595  * @unpack_func: an unpack function for this format
596  * @pack_lines: the amount of lines that will be packed
597  * @pack_func: an pack function for this format
598  * @tile_mode: The tiling mode
599  * @tile_ws: The width of a tile, in bytes, represented as a shift. DEPRECATED,
600  * use tile_info[] array instead.
601  * @tile_hs: The height of a tile, in bytes, represented as a shift. DEPREACTED,
602  * use tile_info[] array instead.
603  * @tile_info: Per-plane tile information
604  *
605  * Information for a video format.
606  */
607 struct _GstVideoFormatInfo {
608   GstVideoFormat format;
609   const gchar *name;
610   const gchar *description;
611   GstVideoFormatFlags flags;
612   guint bits;
613   guint n_components;
614   guint shift[GST_VIDEO_MAX_COMPONENTS];
615   guint depth[GST_VIDEO_MAX_COMPONENTS];
616   gint  pixel_stride[GST_VIDEO_MAX_COMPONENTS];
617   guint n_planes;
618   guint plane[GST_VIDEO_MAX_COMPONENTS];
619   guint poffset[GST_VIDEO_MAX_COMPONENTS];
620   guint w_sub[GST_VIDEO_MAX_COMPONENTS];
621   guint h_sub[GST_VIDEO_MAX_COMPONENTS];
622
623   GstVideoFormat unpack_format;
624   GstVideoFormatUnpack unpack_func;
625   gint pack_lines;
626   GstVideoFormatPack pack_func;
627
628   GstVideoTileMode tile_mode;
629   G_DEPRECATED_FOR(tile_info) guint tile_ws;
630   G_DEPRECATED_FOR(tile_info) guint tile_hs;
631
632   /**
633    * GstVideoFormatInfo.tile_info:
634    *
635    * Information about the tiles for each of the planes.
636    *
637    * Since: 1.22
638    */
639   GstVideoTileInfo tile_info[GST_VIDEO_MAX_PLANES];
640 };
641
642 /**
643  * GST_VIDEO_FORMAT_INFO_IS_VALID_RAW:
644  *
645  * Tests that the given #GstVideoFormatInfo represents a valid un-encoded
646  * format.
647  *
648  * Since: 1.22
649  */
650 #define GST_VIDEO_FORMAT_INFO_IS_VALID_RAW(info)              \
651   (info != NULL && (info)->format > GST_VIDEO_FORMAT_ENCODED)
652
653 #define GST_VIDEO_FORMAT_INFO_FORMAT(info)       ((info)->format)
654 #define GST_VIDEO_FORMAT_INFO_NAME(info)         ((info)->name)
655 #define GST_VIDEO_FORMAT_INFO_FLAGS(info)        ((info)->flags)
656
657 #define GST_VIDEO_FORMAT_INFO_IS_YUV(info)       (((info)->flags & GST_VIDEO_FORMAT_FLAG_YUV) != 0)
658 #define GST_VIDEO_FORMAT_INFO_IS_RGB(info)       (((info)->flags & GST_VIDEO_FORMAT_FLAG_RGB) != 0)
659 #define GST_VIDEO_FORMAT_INFO_IS_GRAY(info)      (((info)->flags & GST_VIDEO_FORMAT_FLAG_GRAY) != 0)
660 #define GST_VIDEO_FORMAT_INFO_HAS_ALPHA(info)    (((info)->flags & GST_VIDEO_FORMAT_FLAG_ALPHA) != 0)
661 #define GST_VIDEO_FORMAT_INFO_IS_LE(info)        (((info)->flags & GST_VIDEO_FORMAT_FLAG_LE) != 0)
662 #define GST_VIDEO_FORMAT_INFO_HAS_PALETTE(info)  (((info)->flags & GST_VIDEO_FORMAT_FLAG_PALETTE) != 0)
663 #define GST_VIDEO_FORMAT_INFO_IS_COMPLEX(info)   (((info)->flags & GST_VIDEO_FORMAT_FLAG_COMPLEX) != 0)
664 #define GST_VIDEO_FORMAT_INFO_IS_TILED(info)     (((info)->flags & GST_VIDEO_FORMAT_FLAG_TILED) != 0)
665 /**
666  * GST_VIDEO_FORMAT_INFO_HAS_SUBTILES:
667  * @info: a #GstVideoFormatInfo
668  *
669  * This macro checks if %GST_VIDEO_FORMAT_FLAG_SUBTILES is set. When this
670  * flag is set, it means that the tile sizes must be scaled as per the
671  * subsampling.
672  *
673  * Returns: %TRUE if the format uses subsampled tile sizes.
674  *
675  * Since: 1.22
676  */
677 #define GST_VIDEO_FORMAT_INFO_HAS_SUBTILES(info) (((info)->flags & GST_VIDEO_FORMAT_FLAG_SUBTILES) != 0)
678
679 #define GST_VIDEO_FORMAT_INFO_BITS(info)         ((info)->bits)
680 #define GST_VIDEO_FORMAT_INFO_N_COMPONENTS(info) ((info)->n_components)
681 #define GST_VIDEO_FORMAT_INFO_SHIFT(info,c)      ((info)->shift[c])
682 #define GST_VIDEO_FORMAT_INFO_DEPTH(info,c)      ((info)->depth[c])
683 /**
684  * GST_VIDEO_FORMAT_INFO_PSTRIDE:
685  * @info: a #GstVideoFormatInfo
686  * @c: the component index
687  *
688  * pixel stride for the given component. This is the amount of bytes to the
689  * pixel immediately to the right, so basically bytes from one pixel to the
690  * next. When bits < 8, the stride is expressed in bits.
691  *
692  * Examples: for 24-bit RGB, the pixel stride would be 3 bytes, while it
693  * would be 4 bytes for RGBx or ARGB, and 8 bytes for ARGB64 or AYUV64.
694  * For planar formats such as I420 the pixel stride is usually 1. For
695  * YUY2 it would be 2 bytes.
696  */
697 #define GST_VIDEO_FORMAT_INFO_PSTRIDE(info,c)    ((info)->pixel_stride[c])
698 /**
699  * GST_VIDEO_FORMAT_INFO_N_PLANES:
700  * @info: a #GstVideoFormatInfo
701  *
702  * Number of planes. This is the number of planes the pixel layout is
703  * organized in in memory. The number of planes can be less than the
704  * number of components (e.g. Y,U,V,A or R, G, B, A) when multiple
705  * components are packed into one plane.
706  *
707  * Examples: RGB/RGBx/RGBA: 1 plane, 3/3/4 components;
708  * I420: 3 planes, 3 components; NV21/NV12: 2 planes, 3 components.
709  */
710 #define GST_VIDEO_FORMAT_INFO_N_PLANES(info)     ((info)->n_planes)
711 /**
712  * GST_VIDEO_FORMAT_INFO_PLANE:
713  * @info: a #GstVideoFormatInfo
714  * @c: the component index
715  *
716  * Plane number where the given component can be found. A plane may
717  * contain data for multiple components.
718  */
719 #define GST_VIDEO_FORMAT_INFO_PLANE(info,c)      ((info)->plane[c])
720 #define GST_VIDEO_FORMAT_INFO_POFFSET(info,c)    ((info)->poffset[c])
721 #define GST_VIDEO_FORMAT_INFO_W_SUB(info,c)      ((info)->w_sub[c])
722 #define GST_VIDEO_FORMAT_INFO_H_SUB(info,c)      ((info)->h_sub[c])
723
724 /* rounds up */
725 #define GST_VIDEO_SUB_SCALE(scale,val)   (-((-((gint)(val)))>>(scale)))
726
727 #define GST_VIDEO_FORMAT_INFO_SCALE_WIDTH(info,c,w)  GST_VIDEO_SUB_SCALE ((info)->w_sub[c],(w))
728 #define GST_VIDEO_FORMAT_INFO_SCALE_HEIGHT(info,c,h) GST_VIDEO_SUB_SCALE ((info)->h_sub[c],(h))
729
730 #define GST_VIDEO_FORMAT_INFO_DATA(info,planes,comp) \
731   (((guint8*)(planes)[(info)->plane[comp]]) + (info)->poffset[comp])
732 /**
733  * GST_VIDEO_FORMAT_INFO_STRIDE:
734  * @info: a #GstVideoFormatInfo
735  * @strides: an array of strides
736  * @comp: the component index
737  *
738  * Row stride in bytes, that is number of bytes from the first pixel component
739  * of a row to the first pixel component in the next row. This might include
740  * some row padding (memory not actually used for anything, to make sure the
741  * beginning of the next row is aligned in a particular way).
742  */
743 #define GST_VIDEO_FORMAT_INFO_STRIDE(info,strides,comp) ((strides)[(info)->plane[comp]])
744 #define GST_VIDEO_FORMAT_INFO_OFFSET(info,offsets,comp) \
745   (((offsets)[(info)->plane[comp]]) + (info)->poffset[comp])
746
747 #define GST_VIDEO_FORMAT_INFO_TILE_MODE(info) ((info)->tile_mode)
748 #define GST_VIDEO_FORMAT_INFO_TILE_WS(info) ((info)->tile_ws)
749 #define GST_VIDEO_FORMAT_INFO_TILE_HS(info) ((info)->tile_hs)
750
751 /**
752  * GST_VIDEO_FORMAT_INFO_TILE_SIZE:
753  * @info: a #GstVideoFormatInfo
754  * @plane: the plane index
755  *
756  * Provides the size in bytes of a tile in the specified @plane. This replaces
757  * the width and height shift, which was limited to power of two dimensions.
758  *
759  * Since: 1.22
760  */
761 #define GST_VIDEO_FORMAT_INFO_TILE_SIZE(info,plane) ((info)->tile_info[plane].size)
762
763 /**
764  * GST_VIDEO_FORMAT_INFO_TILE_WIDTH:
765  * @info: a #GstVideoFormatInfo
766  * @plane: the plane index
767  *
768  * See #GstVideoTileInfo.width.
769  *
770  * Return the width of one tile in pixels, zero if its not an integer.
771  *
772  * Since: 1.22
773  */
774 #define GST_VIDEO_FORMAT_INFO_TILE_WIDTH(info,plane) ((info)->tile_info[plane].width)
775
776 /**
777  * GST_VIDEO_FORMAT_INFO_TILE_HEIGHT:
778  * @info: a #GstVideoFormatInfo
779  * @plane: the plane index
780  *
781  * See #GstVideoTileInfo.height.
782  *
783  * Returns the tile height.
784  *
785  * Since: 1.22
786  */
787 #define GST_VIDEO_FORMAT_INFO_TILE_HEIGHT(info,plane) ((info)->tile_info[plane].height)
788
789 /**
790  * GST_VIDEO_FORMAT_INFO_TILE_STRIDE:
791  * @info: a #GstVideoFormatInfo
792  * @plane: the plane index
793  *
794  * See #GstVideoTileInfo.stride.
795  *
796  * Returns the stride of one tile, regardless of the internal details of the
797  * tile (could be a complex system with subtile) the tiles size should alway
798  * match the tile width multiplied by the tile stride.
799  *
800  * Since: 1.22
801  */
802 #define GST_VIDEO_FORMAT_INFO_TILE_STRIDE(info,plane) ((info)->tile_info[plane].stride)
803
804
805 GST_VIDEO_API
806 void gst_video_format_info_component                  (const GstVideoFormatInfo *info, guint plane, gint components[GST_VIDEO_MAX_COMPONENTS]);
807
808 GST_VIDEO_API
809 gint gst_video_format_info_extrapolate_stride        (const GstVideoFormatInfo * finfo,
810                                                       gint plane, gint stride);
811
812 /* format properties */
813
814 GST_VIDEO_API
815 GstVideoFormat gst_video_format_from_masks           (gint depth, gint bpp, gint endianness,
816                                                       guint red_mask, guint green_mask,
817                                                       guint blue_mask, guint alpha_mask) G_GNUC_CONST;
818
819 GST_VIDEO_API
820 GstVideoFormat gst_video_format_from_fourcc          (guint32 fourcc) G_GNUC_CONST;
821
822 GST_VIDEO_API
823 GstVideoFormat gst_video_format_from_string          (const gchar *format) G_GNUC_CONST;
824
825 GST_VIDEO_API
826 guint32        gst_video_format_to_fourcc            (GstVideoFormat format) G_GNUC_CONST;
827
828 GST_VIDEO_API
829 const gchar *  gst_video_format_to_string            (GstVideoFormat format) G_GNUC_CONST;
830
831 GST_VIDEO_API
832 const GstVideoFormatInfo *
833                gst_video_format_get_info             (GstVideoFormat format) G_GNUC_CONST;
834
835 GST_VIDEO_API
836 gconstpointer  gst_video_format_get_palette          (GstVideoFormat format, gsize *size);
837
838 #define GST_VIDEO_SIZE_RANGE "(int) [ 1, max ]"
839 #define GST_VIDEO_FPS_RANGE "(fraction) [ 0, max ]"
840
841 #if G_BYTE_ORDER == G_LITTLE_ENDIAN
842 # define GST_VIDEO_NE(s) G_STRINGIFY(s)"_LE"
843 # define GST_VIDEO_OE(s) G_STRINGIFY(s)"_BE"
844 #else
845 # define GST_VIDEO_NE(s) G_STRINGIFY(s)"_BE"
846 # define GST_VIDEO_OE(s) G_STRINGIFY(s)"_LE"
847 #endif
848
849 /**
850  * GST_VIDEO_FORMATS_ALL:
851  *
852  * List of all video formats, for use in template caps strings.
853  *
854  * Formats are sorted by decreasing "quality", using these criteria by priority:
855  *   - number of components
856  *   - depth
857  *   - subsampling factor of the width
858  *   - subsampling factor of the height
859  *   - number of planes
860  *   - native endianness preferred
861  *   - pixel stride
862  *   - poffset
863  *   - prefer non-complex formats
864  *   - prefer YUV formats over RGB ones
865  *   - prefer I420 over YV12
866  *   - format name
867  */
868 #if G_BYTE_ORDER == G_BIG_ENDIAN
869 #define GST_VIDEO_FORMATS_ALL "{ ABGR64_BE, BGRA64_BE, AYUV64, ARGB64_BE, ARGB64, " \
870     "RGBA64_BE, ABGR64_LE, BGRA64_LE, ARGB64_LE, RGBA64_LE, GBRA_12BE, GBRA_12LE, Y412_BE, " \
871     "Y412_LE, A444_10BE, GBRA_10BE, A444_10LE, GBRA_10LE, A422_10BE, A422_10LE, " \
872     "A420_10BE, A420_10LE, Y410, RGB10A2_LE, BGR10A2_LE, GBRA, ABGR, VUYA, BGRA, " \
873     "AYUV, ARGB, RGBA, A420, AV12, Y444_16BE, Y444_16LE, v216, P016_BE, P016_LE, Y444_12BE, " \
874     "GBR_12BE, Y444_12LE, GBR_12LE, I422_12BE, I422_12LE, Y212_BE, Y212_LE, I420_12BE, " \
875     "I420_12LE, P012_BE, P012_LE, Y444_10BE, GBR_10BE, Y444_10LE, GBR_10LE, r210, " \
876     "I422_10BE, I422_10LE, NV16_10LE32, Y210, v210, UYVP, I420_10BE, I420_10LE, " \
877     "P010_10BE, P010_10LE, NV12_10LE32, NV12_10LE40, NV12_10BE_8L128, Y444, RGBP, GBR, BGRP, NV24, xBGR, BGRx, " \
878     "xRGB, RGBx, BGR, IYU2, v308, RGB, Y42B, NV61, NV16, VYUY, UYVY, YVYU, YUY2, I420, " \
879     "YV12, NV21, NV12, NV12_8L128, NV12_64Z32, NV12_4L4, NV12_32L32, NV12_16L32S, Y41B, IYU1, YVU9, YUV9, RGB16, " \
880     "BGR16, RGB15, BGR15, RGB8P, GRAY16_BE, GRAY16_LE, GRAY10_LE32, GRAY8 }"
881 #elif G_BYTE_ORDER == G_LITTLE_ENDIAN
882 #define GST_VIDEO_FORMATS_ALL "{ ABGR64_LE, BGRA64_LE, AYUV64, ARGB64_LE, ARGB64, " \
883     "RGBA64_LE, ABGR64_BE, BGRA64_BE, ARGB64_BE, RGBA64_BE, GBRA_12LE, GBRA_12BE, Y412_LE, " \
884     "Y412_BE, A444_10LE, GBRA_10LE, A444_10BE, GBRA_10BE, A422_10LE, A422_10BE, " \
885     "A420_10LE, A420_10BE, RGB10A2_LE, BGR10A2_LE, Y410, GBRA, ABGR, VUYA, BGRA, " \
886     "AYUV, ARGB, RGBA, A420, AV12, Y444_16LE, Y444_16BE, v216, P016_LE, P016_BE, Y444_12LE, " \
887     "GBR_12LE, Y444_12BE, GBR_12BE, I422_12LE, I422_12BE, Y212_LE, Y212_BE, I420_12LE, " \
888     "I420_12BE, P012_LE, P012_BE, Y444_10LE, GBR_10LE, Y444_10BE, GBR_10BE, r210, " \
889     "I422_10LE, I422_10BE, NV16_10LE32, Y210, v210, UYVP, I420_10LE, I420_10BE, " \
890     "P010_10LE, NV12_10LE32, NV12_10LE40, P010_10BE, NV12_10BE_8L128, Y444, RGBP, GBR, BGRP, NV24, xBGR, BGRx, " \
891     "xRGB, RGBx, BGR, IYU2, v308, RGB, Y42B, NV61, NV16, VYUY, UYVY, YVYU, YUY2, I420, " \
892     "YV12, NV21, NV12, NV12_8L128, NV12_64Z32, NV12_4L4, NV12_32L32, NV12_16L32S, Y41B, IYU1, YVU9, YUV9, RGB16, " \
893     "BGR16, RGB15, BGR15, RGB8P, GRAY16_LE, GRAY16_BE, GRAY10_LE32, GRAY8 }"
894 #endif
895
896 GST_VIDEO_API
897 const GstVideoFormat * gst_video_formats_raw (guint * len);
898
899 /**
900  * GST_VIDEO_CAPS_MAKE:
901  * @format: string format that describes the pixel layout, as string
902  *     (e.g. "I420", "RGB", "YV12", "YUY2", "AYUV", etc.)
903  *
904  * Generic caps string for video, for use in pad templates.
905  */
906 #define GST_VIDEO_CAPS_MAKE(format)                                     \
907     "video/x-raw, "                                                     \
908     "format = (string) " format ", "                                    \
909     "width = " GST_VIDEO_SIZE_RANGE ", "                                \
910     "height = " GST_VIDEO_SIZE_RANGE ", "                               \
911     "framerate = " GST_VIDEO_FPS_RANGE
912
913 /**
914  * GST_VIDEO_CAPS_MAKE_WITH_FEATURES:
915  * @format: string format that describes the pixel layout, as string
916  *     (e.g. "I420", "RGB", "YV12", "YUY2", "AYUV", etc.)
917  * @features: Requires caps features as a string, e.g.
918  *     "memory:SystemMemory".
919  *
920  * Generic caps string for video, for use in pad templates.
921  *
922  * Since: 1.2
923  */
924 #define GST_VIDEO_CAPS_MAKE_WITH_FEATURES(features,format)              \
925     "video/x-raw(" features "), "                                       \
926     "format = (string) " format ", "                                    \
927     "width = " GST_VIDEO_SIZE_RANGE ", "                                \
928     "height = " GST_VIDEO_SIZE_RANGE ", "                               \
929     "framerate = " GST_VIDEO_FPS_RANGE
930
931 GST_VIDEO_API
932 GstCaps * gst_video_make_raw_caps (const GstVideoFormat formats[], guint len);
933
934 GST_VIDEO_API
935 GstCaps * gst_video_make_raw_caps_with_features (const GstVideoFormat formats[], guint len,
936                                                  GstCapsFeatures * features);
937
938
939 G_END_DECLS
940
941 #endif /* __GST_VIDEO_FORMAT_H__ */