tizen 2.3.1 release
[framework/multimedia/gst-plugins-base0.10.git] / gst-libs / gst / video / video.h
1 /* GStreamer
2  * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
3  * Library       <2002> Ronald Bultje <rbultje@ronald.bitfreak.net>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public
16  * License along with this library; if not, write to the
17  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18  * Boston, MA 02111-1307, USA.
19  */
20
21 #ifndef __GST_VIDEO_H__
22 #define __GST_VIDEO_H__
23
24 #include <gst/gst.h>
25
26 G_BEGIN_DECLS
27
28 #include <gst/video/video-enumtypes.h>
29
30 /**
31  * GstVideoFormat:
32  * @GST_VIDEO_FORMAT_UNKNOWN: Unknown or unset video format id
33  * @GST_VIDEO_FORMAT_I420: planar 4:2:0 YUV
34  * @GST_VIDEO_FORMAT_YV12: planar 4:2:0 YVU (like I420 but UV planes swapped)
35  * @GST_VIDEO_FORMAT_YUY2: packed 4:2:2 YUV (Y0-U0-Y1-V0 Y2-U2-Y3-V2 Y4 ...)
36  * @GST_VIDEO_FORMAT_UYVY: packed 4:2:2 YUV (U0-Y0-V0-Y1 U2-Y2-V2-Y3 U4 ...)
37  * @GST_VIDEO_FORMAT_AYUV: packed 4:4:4 YUV with alpha channel (A0-Y0-U0-V0 ...)
38  * @GST_VIDEO_FORMAT_RGBx: sparse rgb packed into 32 bit, space last
39  * @GST_VIDEO_FORMAT_BGRx: sparse reverse rgb packed into 32 bit, space last
40  * @GST_VIDEO_FORMAT_xRGB: sparse rgb packed into 32 bit, space first
41  * @GST_VIDEO_FORMAT_xBGR: sparse reverse rgb packed into 32 bit, space first
42  * @GST_VIDEO_FORMAT_RGBA: rgb with alpha channel last
43  * @GST_VIDEO_FORMAT_BGRA: reverse rgb with alpha channel last
44  * @GST_VIDEO_FORMAT_ARGB: rgb with alpha channel first
45  * @GST_VIDEO_FORMAT_ABGR: reverse rgb with alpha channel first
46  * @GST_VIDEO_FORMAT_RGB: rgb
47  * @GST_VIDEO_FORMAT_BGR: reverse rgb
48  * @GST_VIDEO_FORMAT_Y41B: planar 4:1:1 YUV (Since: 0.10.18)
49  * @GST_VIDEO_FORMAT_Y42B: planar 4:2:2 YUV (Since: 0.10.18)
50  * @GST_VIDEO_FORMAT_YVYU: packed 4:2:2 YUV (Y0-V0-Y1-U0 Y2-V2-Y3-U2 Y4 ...) (Since: 0.10.23)
51  * @GST_VIDEO_FORMAT_Y444: planar 4:4:4 YUV (Since: 0.10.24)
52  * @GST_VIDEO_FORMAT_v210: packed 4:2:2 10-bit YUV, complex format (Since: 0.10.24)
53  * @GST_VIDEO_FORMAT_v216: packed 4:2:2 16-bit YUV, Y0-U0-Y1-V1 order (Since: 0.10.24)
54  * @GST_VIDEO_FORMAT_NV12: planar 4:2:0 YUV with interleaved UV plane (Since: 0.10.26)
55  * @GST_VIDEO_FORMAT_NV21: planar 4:2:0 YUV with interleaved VU plane (Since: 0.10.26)
56  * @GST_VIDEO_FORMAT_GRAY8: 8-bit grayscale (Since: 0.10.29)
57  * @GST_VIDEO_FORMAT_GRAY16_BE: 16-bit grayscale, most significant byte first (Since: 0.10.29)
58  * @GST_VIDEO_FORMAT_GRAY16_LE: 16-bit grayscale, least significant byte first (Since: 0.10.29)
59  * @GST_VIDEO_FORMAT_v308: packed 4:4:4 YUV (Since: 0.10.29)
60  * @GST_VIDEO_FORMAT_Y800: same as GST_VIDEO_FORMAT_GRAY8 (Since: 0.10.30)
61  * @GST_VIDEO_FORMAT_Y16: same as GST_VIDEO_FORMAT_GRAY16_LE (Since: 0.10.30)
62  * @GST_VIDEO_FORMAT_RGB16: rgb 5-6-5 bits per component (Since: 0.10.30)
63  * @GST_VIDEO_FORMAT_BGR16: reverse rgb 5-6-5 bits per component (Since: 0.10.30)
64  * @GST_VIDEO_FORMAT_RGB15: rgb 5-5-5 bits per component (Since: 0.10.30)
65  * @GST_VIDEO_FORMAT_BGR15: reverse rgb 5-5-5 bits per component (Since: 0.10.30)
66  * @GST_VIDEO_FORMAT_UYVP: packed 10-bit 4:2:2 YUV (U0-Y0-V0-Y1 U2-Y2-V2-Y3 U4 ...) (Since: 0.10.31)
67  * @GST_VIDEO_FORMAT_A420: planar 4:4:2:0 AYUV (Since: 0.10.31)
68  * @GST_VIDEO_FORMAT_RGB8_PALETTED: 8-bit paletted RGB (Since: 0.10.32)
69  * @GST_VIDEO_FORMAT_YUV9: planar 4:1:0 YUV (Since: 0.10.32)
70  * @GST_VIDEO_FORMAT_YVU9: planar 4:1:0 YUV (like YUV9 but UV planes swapped) (Since: 0.10.32)
71  * @GST_VIDEO_FORMAT_IYU1: packed 4:1:1 YUV (Cb-Y0-Y1-Cr-Y2-Y3 ...) (Since: 0.10.32)
72  * @GST_VIDEO_FORMAT_ARGB64: rgb with alpha channel first, 16 bits per channel (Since: 0.10.33)
73  * @GST_VIDEO_FORMAT_AYUV64: packed 4:4:4 YUV with alpha channel, 16 bits per channel (A0-Y0-U0-V0 ...) (Since: 0.10.33)
74  * @GST_VIDEO_FORMAT_r210: packed 4:4:4 RGB, 10 bits per channel (Since: 0.10.33)
75  *
76  * Enum value describing the most common video formats.
77  */
78 typedef enum {
79   GST_VIDEO_FORMAT_UNKNOWN,
80   GST_VIDEO_FORMAT_I420,
81   GST_VIDEO_FORMAT_YV12,
82   GST_VIDEO_FORMAT_YUY2,
83   GST_VIDEO_FORMAT_UYVY,
84   GST_VIDEO_FORMAT_AYUV,
85   GST_VIDEO_FORMAT_RGBx,
86   GST_VIDEO_FORMAT_BGRx,
87   GST_VIDEO_FORMAT_xRGB,
88   GST_VIDEO_FORMAT_xBGR,
89   GST_VIDEO_FORMAT_RGBA,
90   GST_VIDEO_FORMAT_BGRA,
91   GST_VIDEO_FORMAT_ARGB,
92   GST_VIDEO_FORMAT_ABGR,
93   GST_VIDEO_FORMAT_RGB,
94   GST_VIDEO_FORMAT_BGR,
95   GST_VIDEO_FORMAT_Y41B,
96   GST_VIDEO_FORMAT_Y42B,
97   GST_VIDEO_FORMAT_YVYU,
98   GST_VIDEO_FORMAT_Y444,
99   GST_VIDEO_FORMAT_v210,
100   GST_VIDEO_FORMAT_v216,
101   GST_VIDEO_FORMAT_NV12,
102   GST_VIDEO_FORMAT_NV21,
103   GST_VIDEO_FORMAT_GRAY8,
104   GST_VIDEO_FORMAT_GRAY16_BE,
105   GST_VIDEO_FORMAT_GRAY16_LE,
106   GST_VIDEO_FORMAT_v308,
107   GST_VIDEO_FORMAT_Y800,
108   GST_VIDEO_FORMAT_Y16,
109   GST_VIDEO_FORMAT_RGB16,
110   GST_VIDEO_FORMAT_BGR16,
111   GST_VIDEO_FORMAT_RGB15,
112   GST_VIDEO_FORMAT_BGR15,
113   GST_VIDEO_FORMAT_UYVP,
114   GST_VIDEO_FORMAT_A420,
115   GST_VIDEO_FORMAT_RGB8_PALETTED,
116   GST_VIDEO_FORMAT_YUV9,
117   GST_VIDEO_FORMAT_YVU9,
118   GST_VIDEO_FORMAT_IYU1,
119   GST_VIDEO_FORMAT_ARGB64,
120   GST_VIDEO_FORMAT_AYUV64,
121   GST_VIDEO_FORMAT_r210
122 #ifdef GST_EXT_XV_ENHANCEMENT
123 , GST_VIDEO_FORMAT_ST12,
124   GST_VIDEO_FORMAT_SN12,
125   GST_VIDEO_FORMAT_SUYV,
126   GST_VIDEO_FORMAT_SUY2,
127   GST_VIDEO_FORMAT_S420,
128   GST_VIDEO_FORMAT_SYVY
129 #endif
130 } GstVideoFormat;
131
132 #define GST_VIDEO_BYTE1_MASK_32  "0xFF000000"
133 #define GST_VIDEO_BYTE2_MASK_32  "0x00FF0000"
134 #define GST_VIDEO_BYTE3_MASK_32  "0x0000FF00"
135 #define GST_VIDEO_BYTE4_MASK_32  "0x000000FF"
136
137 #define GST_VIDEO_BYTE1_MASK_24  "0x00FF0000"
138 #define GST_VIDEO_BYTE2_MASK_24  "0x0000FF00"
139 #define GST_VIDEO_BYTE3_MASK_24  "0x000000FF"
140
141 #define GST_VIDEO_BYTE1_MASK_32_INT  0xFF000000
142 #define GST_VIDEO_BYTE2_MASK_32_INT  0x00FF0000
143 #define GST_VIDEO_BYTE3_MASK_32_INT  0x0000FF00
144 #define GST_VIDEO_BYTE4_MASK_32_INT  0x000000FF
145
146 #define GST_VIDEO_BYTE1_MASK_24_INT  0x00FF0000
147 #define GST_VIDEO_BYTE2_MASK_24_INT  0x0000FF00
148 #define GST_VIDEO_BYTE3_MASK_24_INT  0x000000FF
149
150 #define GST_VIDEO_COMP1_MASK_16 "0xf800"
151 #define GST_VIDEO_COMP2_MASK_16 "0x07e0"
152 #define GST_VIDEO_COMP3_MASK_16 "0x001f"
153
154 #define GST_VIDEO_COMP1_MASK_15 "0x7c00"
155 #define GST_VIDEO_COMP2_MASK_15 "0x03e0"
156 #define GST_VIDEO_COMP3_MASK_15 "0x001f"
157
158 #define GST_VIDEO_COMP1_MASK_16_INT 0xf800
159 #define GST_VIDEO_COMP2_MASK_16_INT 0x07e0
160 #define GST_VIDEO_COMP3_MASK_16_INT 0x001f
161
162 #define GST_VIDEO_COMP1_MASK_15_INT 0x7c00
163 #define GST_VIDEO_COMP2_MASK_15_INT 0x03e0
164 #define GST_VIDEO_COMP3_MASK_15_INT 0x001f
165
166 #ifndef GST_DISABLE_DEPRECATED
167 #define GST_VIDEO_RED_MASK_16 GST_VIDEO_COMP1_MASK_16
168 #define GST_VIDEO_GREEN_MASK_16 GST_VIDEO_COMP2_MASK_16
169 #define GST_VIDEO_BLUE_MASK_16 GST_VIDEO_COMP3_MASK_16
170
171 #define GST_VIDEO_RED_MASK_15 GST_VIDEO_COMP1_MASK_15
172 #define GST_VIDEO_GREEN_MASK_15 GST_VIDEO_COMP2_MASK_15
173 #define GST_VIDEO_BLUE_MASK_15 GST_VIDEO_COMP3_MASK_15
174
175 #define GST_VIDEO_RED_MASK_16_INT GST_VIDEO_COMP1_MASK_16_INT
176 #define GST_VIDEO_GREEN_MASK_16_INT GST_VIDEO_COMP2_MASK_16_INT
177 #define GST_VIDEO_BLUE_MASK_16_INT GST_VIDEO_COMP3_MASK_16_INT
178
179 #define GST_VIDEO_RED_MASK_15_INT GST_VIDEO_COMP1_MASK_15_INT
180 #define GST_VIDEO_GREEN_MASK_15_INT GST_VIDEO_COMP2_MASK_15_INT
181 #define GST_VIDEO_BLUE_MASK_15_INT GST_VIDEO_COMP3_MASK_15_INT
182 #endif
183
184 #define GST_VIDEO_SIZE_RANGE "(int) [ 1, max ]"
185 #define GST_VIDEO_FPS_RANGE "(fraction) [ 0, max ]"
186
187 /* consider the next 2 protected */
188 #define __GST_VIDEO_CAPS_MAKE_32A(R, G, B, A)                           \
189     "video/x-raw-rgb, "                                                 \
190     "bpp = (int) 32, "                                                  \
191     "depth = (int) 32, "                                                \
192     "endianness = (int) BIG_ENDIAN, "                                   \
193     "red_mask = (int) " GST_VIDEO_BYTE ## R ## _MASK_32 ", "            \
194     "green_mask = (int) " GST_VIDEO_BYTE ## G ## _MASK_32 ", "          \
195     "blue_mask = (int) " GST_VIDEO_BYTE ## B ## _MASK_32 ", "           \
196     "alpha_mask = (int) " GST_VIDEO_BYTE ## A ## _MASK_32 ", "          \
197     "width = " GST_VIDEO_SIZE_RANGE ", "                                \
198     "height = " GST_VIDEO_SIZE_RANGE ", "                               \
199     "framerate = " GST_VIDEO_FPS_RANGE
200
201 #define __GST_VIDEO_CAPS_MAKE_32(R, G, B)                               \
202     "video/x-raw-rgb, "                                                 \
203     "bpp = (int) 32, "                                                  \
204     "depth = (int) 24, "                                                \
205     "endianness = (int) BIG_ENDIAN, "                                   \
206     "red_mask = (int) " GST_VIDEO_BYTE ## R ## _MASK_32 ", "            \
207     "green_mask = (int) " GST_VIDEO_BYTE ## G ## _MASK_32 ", "          \
208     "blue_mask = (int) " GST_VIDEO_BYTE ## B ## _MASK_32 ", "           \
209     "width = " GST_VIDEO_SIZE_RANGE ", "                                \
210     "height = " GST_VIDEO_SIZE_RANGE ", "                               \
211     "framerate = " GST_VIDEO_FPS_RANGE
212
213 #define __GST_VIDEO_CAPS_MAKE_24(R, G, B)                               \
214     "video/x-raw-rgb, "                                                 \
215     "bpp = (int) 24, "                                                  \
216     "depth = (int) 24, "                                                \
217     "endianness = (int) BIG_ENDIAN, "                                   \
218     "red_mask = (int) " GST_VIDEO_BYTE ## R ## _MASK_24 ", "            \
219     "green_mask = (int) " GST_VIDEO_BYTE ## G ## _MASK_24 ", "          \
220     "blue_mask = (int) " GST_VIDEO_BYTE ## B ## _MASK_24 ", "           \
221     "width = " GST_VIDEO_SIZE_RANGE ", "                                \
222     "height = " GST_VIDEO_SIZE_RANGE ", "                               \
223     "framerate = " GST_VIDEO_FPS_RANGE
224
225 #define __GST_VIDEO_CAPS_MAKE_16(R, G, B)                               \
226     "video/x-raw-rgb, "                                                 \
227     "bpp = (int) 16, "                                                  \
228     "depth = (int) 16, "                                                \
229     "endianness = (int) BYTE_ORDER, "                                   \
230     "red_mask = (int) " GST_VIDEO_COMP ## R ## _MASK_16 ", "            \
231     "green_mask = (int) " GST_VIDEO_COMP ## G ## _MASK_16 ", "          \
232     "blue_mask = (int) " GST_VIDEO_COMP ## B ## _MASK_16 ", "           \
233     "width = " GST_VIDEO_SIZE_RANGE ", "                                \
234     "height = " GST_VIDEO_SIZE_RANGE ", "                               \
235     "framerate = " GST_VIDEO_FPS_RANGE
236
237 #define __GST_VIDEO_CAPS_MAKE_15(R, G, B)                               \
238     "video/x-raw-rgb, "                                                 \
239     "bpp = (int) 16, "                                                  \
240     "depth = (int) 15, "                                                \
241     "endianness = (int) BYTE_ORDER, "                                   \
242     "red_mask = (int) " GST_VIDEO_COMP ## R ## _MASK_15 ", "            \
243     "green_mask = (int) " GST_VIDEO_COMP ## G ## _MASK_15 ", "          \
244     "blue_mask = (int) " GST_VIDEO_COMP ## B ## _MASK_15 ", "           \
245     "width = " GST_VIDEO_SIZE_RANGE ", "                                \
246     "height = " GST_VIDEO_SIZE_RANGE ", "                               \
247     "framerate = " GST_VIDEO_FPS_RANGE
248
249 #define __GST_VIDEO_CAPS_MAKE_64A(R, G, B, A)                           \
250     "video/x-raw-rgb, "                                                 \
251     "bpp = (int) 64, "                                                  \
252     "depth = (int) 64, "                                                \
253     "endianness = (int) BIG_ENDIAN, "                                   \
254     "red_mask = (int) " GST_VIDEO_BYTE ## R ## _MASK_32 ", "            \
255     "green_mask = (int) " GST_VIDEO_BYTE ## G ## _MASK_32 ", "          \
256     "blue_mask = (int) " GST_VIDEO_BYTE ## B ## _MASK_32 ", "           \
257     "alpha_mask = (int) " GST_VIDEO_BYTE ## A ## _MASK_32 ", "          \
258     "width = " GST_VIDEO_SIZE_RANGE ", "                                \
259     "height = " GST_VIDEO_SIZE_RANGE ", "                               \
260     "framerate = " GST_VIDEO_FPS_RANGE
261
262
263 /* 24 bit */
264
265 #define GST_VIDEO_CAPS_RGB \
266     __GST_VIDEO_CAPS_MAKE_24 (1, 2, 3)
267
268 #define GST_VIDEO_CAPS_BGR \
269     __GST_VIDEO_CAPS_MAKE_24 (3, 2, 1)
270
271 /* 32 bit */
272
273 #define GST_VIDEO_CAPS_RGBx \
274     __GST_VIDEO_CAPS_MAKE_32 (1, 2, 3)
275
276 #define GST_VIDEO_CAPS_xRGB \
277     __GST_VIDEO_CAPS_MAKE_32 (2, 3, 4)
278
279 #define GST_VIDEO_CAPS_BGRx \
280     __GST_VIDEO_CAPS_MAKE_32 (3, 2, 1)
281
282 #define GST_VIDEO_CAPS_xBGR \
283     __GST_VIDEO_CAPS_MAKE_32 (4, 3, 2)
284
285 /* 32 bit alpha */
286
287 #define GST_VIDEO_CAPS_RGBA \
288     __GST_VIDEO_CAPS_MAKE_32A (1, 2, 3, 4)
289
290 #define GST_VIDEO_CAPS_ARGB \
291     __GST_VIDEO_CAPS_MAKE_32A (2, 3, 4, 1)
292
293 #define GST_VIDEO_CAPS_BGRA \
294     __GST_VIDEO_CAPS_MAKE_32A (3, 2, 1, 4)
295
296 #define GST_VIDEO_CAPS_ABGR \
297     __GST_VIDEO_CAPS_MAKE_32A (4, 3, 2, 1)
298
299 /* note: the macro name uses the order on BE systems */
300 #if G_BYTE_ORDER == G_BIG_ENDIAN
301   #define GST_VIDEO_CAPS_xRGB_HOST_ENDIAN \
302       GST_VIDEO_CAPS_xRGB
303   #define GST_VIDEO_CAPS_BGRx_HOST_ENDIAN \
304       GST_VIDEO_CAPS_BGRx
305 #else
306   #define GST_VIDEO_CAPS_xRGB_HOST_ENDIAN \
307       GST_VIDEO_CAPS_BGRx
308   #define GST_VIDEO_CAPS_BGRx_HOST_ENDIAN \
309       GST_VIDEO_CAPS_xRGB
310 #endif
311
312 /* 15/16 bit */
313
314 #define GST_VIDEO_CAPS_RGB_16 \
315     __GST_VIDEO_CAPS_MAKE_16 (1, 2, 3)
316
317 #define GST_VIDEO_CAPS_BGR_16 \
318     __GST_VIDEO_CAPS_MAKE_16 (3, 2, 1)
319
320 #define GST_VIDEO_CAPS_RGB_15 \
321     __GST_VIDEO_CAPS_MAKE_15 (1, 2, 3)
322
323 #define GST_VIDEO_CAPS_BGR_15 \
324     __GST_VIDEO_CAPS_MAKE_15 (3, 2, 1)
325
326 /* 30 bit */
327 #define GST_VIDEO_CAPS_r210 \
328     "video/x-raw-rgb, "                                                 \
329     "bpp = (int) 32, "                                                  \
330     "depth = (int) 30, "                                                \
331     "endianness = (int) BIG_ENDIAN, "                                   \
332     "red_mask = (int) 0x3ff00000, "                                     \
333     "green_mask = (int) 0x000ffc00, "                                   \
334     "blue_mask = (int) 0x000003ff, "                                    \
335     "width = " GST_VIDEO_SIZE_RANGE ", "                                \
336     "height = " GST_VIDEO_SIZE_RANGE ", "                               \
337     "framerate = " GST_VIDEO_FPS_RANGE
338
339 /* 64 bit alpha */
340
341 #define GST_VIDEO_CAPS_ARGB_64 \
342     __GST_VIDEO_CAPS_MAKE_64A (2, 3, 4, 1)
343
344 /**
345  * GST_VIDEO_CAPS_RGB8_PALETTED:
346  *
347  * Generic caps string for 8-bit paletted RGB video, for use in pad templates.
348  *
349  * Since: 0.10.32
350  */
351 #define GST_VIDEO_CAPS_RGB8_PALETTED \
352   "video/x-raw-rgb, bpp = (int)8, depth = (int)8, "                     \
353       "width = " GST_VIDEO_SIZE_RANGE ", "                              \
354       "height = " GST_VIDEO_SIZE_RANGE ", "                             \
355       "framerate = " GST_VIDEO_FPS_RANGE
356
357 /**
358  * GST_VIDEO_CAPS_YUV:
359  * @fourcc: YUV fourcc format that describes the pixel layout, as string
360  *     (e.g. "I420", "YV12", "YUY2", "AYUV", etc.)
361  *
362  * Generic caps string for YUV video, for use in pad templates.
363  */
364 #define GST_VIDEO_CAPS_YUV(fourcc)                                      \
365         "video/x-raw-yuv, "                                             \
366         "format = (fourcc) " fourcc ", "                                \
367         "width = " GST_VIDEO_SIZE_RANGE ", "                            \
368         "height = " GST_VIDEO_SIZE_RANGE ", "                           \
369         "framerate = " GST_VIDEO_FPS_RANGE
370
371 /**
372  * GST_VIDEO_CAPS_GRAY8:
373  *
374  * Generic caps string for 8-bit grayscale video, for use in pad templates.
375  *
376  * Since: 0.10.29
377  */
378 #define GST_VIDEO_CAPS_GRAY8                                            \
379         "video/x-raw-gray, "                                            \
380         "bpp = (int) 8, "                                               \
381         "depth = (int) 8, "                                             \
382         "width = " GST_VIDEO_SIZE_RANGE ", "                            \
383         "height = " GST_VIDEO_SIZE_RANGE ", "                           \
384         "framerate = " GST_VIDEO_FPS_RANGE
385
386 /**
387  * GST_VIDEO_CAPS_GRAY16:
388  * @endianness: endianness as string, ie. either "1234", "4321", "BIG_ENDIAN"
389  *     or "LITTLE_ENDIAN"
390  *
391  * Generic caps string for 16-bit grayscale video, for use in pad templates.
392  *
393  * Since: 0.10.29
394  */
395 #define GST_VIDEO_CAPS_GRAY16(endianness)                               \
396         "video/x-raw-gray, "                                            \
397         "bpp = (int) 16, "                                              \
398         "depth = (int) 16, "                                            \
399         "endianness = (int) " endianness ", "                           \
400         "width = " GST_VIDEO_SIZE_RANGE ", "                            \
401         "height = " GST_VIDEO_SIZE_RANGE ", "                           \
402         "framerate = " GST_VIDEO_FPS_RANGE
403
404 /* buffer flags */
405
406 /**
407  * GST_VIDEO_BUFFER_TFF:
408  *
409  * If the #GstBuffer is interlaced, then the first field in the video frame is
410  * the top field.  If unset, the bottom field is first.
411  *
412  * Since: 0.10.23
413  */
414 #define GST_VIDEO_BUFFER_TFF GST_BUFFER_FLAG_MEDIA1
415
416 /**
417  * GST_VIDEO_BUFFER_RFF:
418  *
419  * If the #GstBuffer is interlaced, then the first field (as defined by the
420  * %GST_VIDEO_BUFFER_TFF flag setting) is repeated.
421  *
422  * Since: 0.10.23
423  */
424 #define GST_VIDEO_BUFFER_RFF GST_BUFFER_FLAG_MEDIA2
425
426 /**
427  * GST_VIDEO_BUFFER_ONEFIELD:
428  *
429  * If the #GstBuffer is interlaced, then only the first field (as defined by the
430  * %GST_VIDEO_BUFFER_TFF flag setting) is to be displayed.
431  *
432  * Since: 0.10.23
433  */
434 #define GST_VIDEO_BUFFER_ONEFIELD GST_BUFFER_FLAG_MEDIA3
435
436 /**
437  * GST_VIDEO_BUFFER_PROGRESSIVE:
438  *
439  * If the #GstBuffer is telecined, then the buffer is progressive if the
440  * %GST_VIDEO_BUFFER_PROGRESSIVE flag is set, else it is telecine mixed.
441  *
442  * Since: 0.10.33
443  */
444 #define GST_VIDEO_BUFFER_PROGRESSIVE GST_BUFFER_FLAG_MEDIA4
445
446 /* functions */
447
448 const GValue * gst_video_frame_rate (GstPad * pad);
449
450 gboolean       gst_video_get_size   (GstPad * pad,
451                                      gint   * width,
452                                      gint   * height);
453
454 gboolean       gst_video_calculate_display_ratio (guint * dar_n,
455                                                   guint * dar_d,
456                                                   guint   video_width,
457                                                   guint   video_height,
458                                                   guint   video_par_n,
459                                                   guint   video_par_d,
460                                                   guint   display_par_n,
461                                                   guint   display_par_d);
462
463 gboolean       gst_video_format_parse_caps (const GstCaps  * caps,
464                                             GstVideoFormat * format,
465                                             int            * width,
466                                             int            * height);
467
468 gboolean       gst_video_format_parse_caps_interlaced  (GstCaps  * caps,
469                                                         gboolean * interlaced);
470
471
472 gboolean       gst_video_parse_caps_pixel_aspect_ratio (GstCaps  * caps,
473                                                         int      * par_n,
474                                                         int      * par_d);
475
476 gboolean       gst_video_parse_caps_framerate    (GstCaps * caps,
477                                                   int     * fps_n,
478                                                   int     * fps_d);
479
480 const char *   gst_video_parse_caps_color_matrix (GstCaps * caps);
481
482 const char *   gst_video_parse_caps_chroma_site  (GstCaps * caps);
483
484 GstBuffer *    gst_video_parse_caps_palette      (GstCaps * caps);
485
486 /* create caps given format and details */
487
488 GstCaps *      gst_video_format_new_caps (GstVideoFormat format,
489                                           int width, int height,
490                                           int framerate_n,
491                                           int framerate_d,
492                                           int par_n, int par_d);
493
494 GstCaps *      gst_video_format_new_caps_interlaced (GstVideoFormat format,
495                                                      int width, int height,
496                                                      int framerate_n,
497                                                      int framerate_d,
498                                                      int par_n, int par_d,
499                                                      gboolean interlaced);
500
501 GstCaps *      gst_video_format_new_template_caps (GstVideoFormat format);
502
503 /* format properties */
504
505 GstVideoFormat gst_video_format_from_fourcc (guint32 fourcc) G_GNUC_CONST;
506
507 guint32        gst_video_format_to_fourcc (GstVideoFormat format) G_GNUC_CONST;
508
509 gboolean       gst_video_format_is_rgb    (GstVideoFormat format) G_GNUC_CONST;
510
511 gboolean       gst_video_format_is_yuv    (GstVideoFormat format) G_GNUC_CONST;
512
513 gboolean       gst_video_format_is_gray   (GstVideoFormat format) G_GNUC_CONST;
514
515 gboolean       gst_video_format_has_alpha (GstVideoFormat format) G_GNUC_CONST;
516
517
518 int            gst_video_format_get_component_depth  (GstVideoFormat format,
519                                                       int            component) G_GNUC_CONST;
520
521 int            gst_video_format_get_row_stride       (GstVideoFormat format,
522                                                       int            component,
523                                                       int            width) G_GNUC_CONST;
524
525 int            gst_video_format_get_pixel_stride     (GstVideoFormat format,
526                                                       int            component) G_GNUC_CONST;
527
528 int            gst_video_format_get_component_width  (GstVideoFormat format,
529                                                       int            component,
530                                                       int            width) G_GNUC_CONST;
531
532 int            gst_video_format_get_component_height (GstVideoFormat format,
533                                                       int            component,
534                                                       int            height) G_GNUC_CONST;
535
536 int            gst_video_format_get_component_offset (GstVideoFormat format,
537                                                       int            component,
538                                                       int            width,
539                                                       int            height) G_GNUC_CONST;
540
541 int            gst_video_format_get_size             (GstVideoFormat format,
542                                                       int            width,
543                                                       int            height) G_GNUC_CONST;
544
545 gboolean       gst_video_get_size_from_caps (const GstCaps * caps, gint * size);
546
547 gboolean       gst_video_format_convert (GstVideoFormat  format,
548                                          int             width,
549                                          int             height,
550                                          int             fps_n,
551                                          int             fps_d,
552                                          GstFormat       src_format,
553                                          gint64          src_value,
554                                          GstFormat       dest_format,
555                                          gint64        * dest_value);
556
557 /* video still frame event creation and parsing */
558
559 GstEvent *     gst_video_event_new_still_frame   (gboolean in_still);
560
561 gboolean       gst_video_event_parse_still_frame (GstEvent * event, gboolean * in_still);
562
563 /* video force key unit event creation and parsing */
564
565 GstEvent * gst_video_event_new_downstream_force_key_unit (GstClockTime timestamp,
566                                                           GstClockTime streamtime,
567                                                           GstClockTime runningtime,
568                                                           gboolean all_headers,
569                                                           guint count);
570
571 gboolean gst_video_event_parse_downstream_force_key_unit (GstEvent * event,
572                                                           GstClockTime * timestamp,
573                                                           GstClockTime * streamtime,
574                                                           GstClockTime * runningtime,
575                                                           gboolean * all_headers,
576                                                           guint * count);
577
578 GstEvent * gst_video_event_new_upstream_force_key_unit (GstClockTime running_time,
579                                                         gboolean all_headers,
580                                                         guint count);
581
582 gboolean gst_video_event_parse_upstream_force_key_unit (GstEvent * event,
583                                                         GstClockTime * running_time,
584                                                         gboolean * all_headers,
585                                                         guint * count);
586
587 gboolean gst_video_event_is_force_key_unit(GstEvent *event);
588
589 /* convert/encode video frame from one format to another */
590
591 typedef void (*GstVideoConvertFrameCallback) (GstBuffer * buf, GError *error, gpointer user_data);
592
593 void           gst_video_convert_frame_async (GstBuffer                    * buf,
594                                               const GstCaps                * to_caps,
595                                               GstClockTime                   timeout,
596                                               GstVideoConvertFrameCallback   callback,
597                                               gpointer                       user_data,
598                                               GDestroyNotify                 destroy_notify);
599
600 GstBuffer *    gst_video_convert_frame       (GstBuffer     * buf,
601                                               const GstCaps * to_caps,
602                                               GstClockTime    timeout,
603                                               GError       ** error);
604
605 G_END_DECLS
606
607 #endif /* __GST_VIDEO_H__ */