textoverlay: fix text buffer leak
[platform/upstream/gst-plugins-base.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 } GstVideoFormat;
123
124 #define GST_VIDEO_BYTE1_MASK_32  "0xFF000000"
125 #define GST_VIDEO_BYTE2_MASK_32  "0x00FF0000"
126 #define GST_VIDEO_BYTE3_MASK_32  "0x0000FF00"
127 #define GST_VIDEO_BYTE4_MASK_32  "0x000000FF"
128
129 #define GST_VIDEO_BYTE1_MASK_24  "0x00FF0000"
130 #define GST_VIDEO_BYTE2_MASK_24  "0x0000FF00"
131 #define GST_VIDEO_BYTE3_MASK_24  "0x000000FF"
132
133 #define GST_VIDEO_BYTE1_MASK_32_INT  0xFF000000
134 #define GST_VIDEO_BYTE2_MASK_32_INT  0x00FF0000
135 #define GST_VIDEO_BYTE3_MASK_32_INT  0x0000FF00
136 #define GST_VIDEO_BYTE4_MASK_32_INT  0x000000FF
137
138 #define GST_VIDEO_BYTE1_MASK_24_INT  0x00FF0000
139 #define GST_VIDEO_BYTE2_MASK_24_INT  0x0000FF00
140 #define GST_VIDEO_BYTE3_MASK_24_INT  0x000000FF
141
142 #define GST_VIDEO_COMP1_MASK_16 "0xf800"
143 #define GST_VIDEO_COMP2_MASK_16 "0x07e0"
144 #define GST_VIDEO_COMP3_MASK_16 "0x001f"
145
146 #define GST_VIDEO_COMP1_MASK_15 "0x7c00"
147 #define GST_VIDEO_COMP2_MASK_15 "0x03e0"
148 #define GST_VIDEO_COMP3_MASK_15 "0x001f"
149
150 #define GST_VIDEO_COMP1_MASK_16_INT 0xf800
151 #define GST_VIDEO_COMP2_MASK_16_INT 0x07e0
152 #define GST_VIDEO_COMP3_MASK_16_INT 0x001f
153
154 #define GST_VIDEO_COMP1_MASK_15_INT 0x7c00
155 #define GST_VIDEO_COMP2_MASK_15_INT 0x03e0
156 #define GST_VIDEO_COMP3_MASK_15_INT 0x001f
157
158 #ifndef GST_DISABLE_DEPRECATED
159 #define GST_VIDEO_RED_MASK_16 GST_VIDEO_COMP1_MASK_16
160 #define GST_VIDEO_GREEN_MASK_16 GST_VIDEO_COMP2_MASK_16
161 #define GST_VIDEO_BLUE_MASK_16 GST_VIDEO_COMP3_MASK_16
162
163 #define GST_VIDEO_RED_MASK_15 GST_VIDEO_COMP1_MASK_15
164 #define GST_VIDEO_GREEN_MASK_15 GST_VIDEO_COMP2_MASK_15
165 #define GST_VIDEO_BLUE_MASK_15 GST_VIDEO_COMP3_MASK_15
166
167 #define GST_VIDEO_RED_MASK_16_INT GST_VIDEO_COMP1_MASK_16_INT
168 #define GST_VIDEO_GREEN_MASK_16_INT GST_VIDEO_COMP2_MASK_16_INT
169 #define GST_VIDEO_BLUE_MASK_16_INT GST_VIDEO_COMP3_MASK_16_INT
170
171 #define GST_VIDEO_RED_MASK_15_INT GST_VIDEO_COMP1_MASK_15_INT
172 #define GST_VIDEO_GREEN_MASK_15_INT GST_VIDEO_COMP2_MASK_15_INT
173 #define GST_VIDEO_BLUE_MASK_15_INT GST_VIDEO_COMP3_MASK_15_INT
174 #endif
175
176 #define GST_VIDEO_SIZE_RANGE "(int) [ 1, max ]"
177 #define GST_VIDEO_FPS_RANGE "(fraction) [ 0, max ]"
178
179 /* consider the next 2 protected */
180 #define __GST_VIDEO_CAPS_MAKE_32A(R, G, B, A)                           \
181     "video/x-raw-rgb, "                                                 \
182     "bpp = (int) 32, "                                                  \
183     "depth = (int) 32, "                                                \
184     "endianness = (int) BIG_ENDIAN, "                                   \
185     "red_mask = (int) " GST_VIDEO_BYTE ## R ## _MASK_32 ", "            \
186     "green_mask = (int) " GST_VIDEO_BYTE ## G ## _MASK_32 ", "          \
187     "blue_mask = (int) " GST_VIDEO_BYTE ## B ## _MASK_32 ", "           \
188     "alpha_mask = (int) " GST_VIDEO_BYTE ## A ## _MASK_32 ", "          \
189     "width = " GST_VIDEO_SIZE_RANGE ", "                                \
190     "height = " GST_VIDEO_SIZE_RANGE ", "                               \
191     "framerate = " GST_VIDEO_FPS_RANGE
192
193 #define __GST_VIDEO_CAPS_MAKE_32(R, G, B)                               \
194     "video/x-raw-rgb, "                                                 \
195     "bpp = (int) 32, "                                                  \
196     "depth = (int) 24, "                                                \
197     "endianness = (int) BIG_ENDIAN, "                                   \
198     "red_mask = (int) " GST_VIDEO_BYTE ## R ## _MASK_32 ", "            \
199     "green_mask = (int) " GST_VIDEO_BYTE ## G ## _MASK_32 ", "          \
200     "blue_mask = (int) " GST_VIDEO_BYTE ## B ## _MASK_32 ", "           \
201     "width = " GST_VIDEO_SIZE_RANGE ", "                                \
202     "height = " GST_VIDEO_SIZE_RANGE ", "                               \
203     "framerate = " GST_VIDEO_FPS_RANGE
204
205 #define __GST_VIDEO_CAPS_MAKE_24(R, G, B)                               \
206     "video/x-raw-rgb, "                                                 \
207     "bpp = (int) 24, "                                                  \
208     "depth = (int) 24, "                                                \
209     "endianness = (int) BIG_ENDIAN, "                                   \
210     "red_mask = (int) " GST_VIDEO_BYTE ## R ## _MASK_24 ", "            \
211     "green_mask = (int) " GST_VIDEO_BYTE ## G ## _MASK_24 ", "          \
212     "blue_mask = (int) " GST_VIDEO_BYTE ## B ## _MASK_24 ", "           \
213     "width = " GST_VIDEO_SIZE_RANGE ", "                                \
214     "height = " GST_VIDEO_SIZE_RANGE ", "                               \
215     "framerate = " GST_VIDEO_FPS_RANGE
216
217 #define __GST_VIDEO_CAPS_MAKE_16(R, G, B)                               \
218     "video/x-raw-rgb, "                                                 \
219     "bpp = (int) 16, "                                                  \
220     "depth = (int) 16, "                                                \
221     "endianness = (int) BYTE_ORDER, "                                   \
222     "red_mask = (int) " GST_VIDEO_COMP ## R ## _MASK_16 ", "            \
223     "green_mask = (int) " GST_VIDEO_COMP ## G ## _MASK_16 ", "          \
224     "blue_mask = (int) " GST_VIDEO_COMP ## B ## _MASK_16 ", "           \
225     "width = " GST_VIDEO_SIZE_RANGE ", "                                \
226     "height = " GST_VIDEO_SIZE_RANGE ", "                               \
227     "framerate = " GST_VIDEO_FPS_RANGE
228
229 #define __GST_VIDEO_CAPS_MAKE_15(R, G, B)                               \
230     "video/x-raw-rgb, "                                                 \
231     "bpp = (int) 16, "                                                  \
232     "depth = (int) 15, "                                                \
233     "endianness = (int) BYTE_ORDER, "                                   \
234     "red_mask = (int) " GST_VIDEO_COMP ## R ## _MASK_15 ", "            \
235     "green_mask = (int) " GST_VIDEO_COMP ## G ## _MASK_15 ", "          \
236     "blue_mask = (int) " GST_VIDEO_COMP ## B ## _MASK_15 ", "           \
237     "width = " GST_VIDEO_SIZE_RANGE ", "                                \
238     "height = " GST_VIDEO_SIZE_RANGE ", "                               \
239     "framerate = " GST_VIDEO_FPS_RANGE
240
241 #define __GST_VIDEO_CAPS_MAKE_64A(R, G, B, A)                           \
242     "video/x-raw-rgb, "                                                 \
243     "bpp = (int) 64, "                                                  \
244     "depth = (int) 64, "                                                \
245     "endianness = (int) BIG_ENDIAN, "                                   \
246     "red_mask = (int) " GST_VIDEO_BYTE ## R ## _MASK_32 ", "            \
247     "green_mask = (int) " GST_VIDEO_BYTE ## G ## _MASK_32 ", "          \
248     "blue_mask = (int) " GST_VIDEO_BYTE ## B ## _MASK_32 ", "           \
249     "alpha_mask = (int) " GST_VIDEO_BYTE ## A ## _MASK_32 ", "          \
250     "width = " GST_VIDEO_SIZE_RANGE ", "                                \
251     "height = " GST_VIDEO_SIZE_RANGE ", "                               \
252     "framerate = " GST_VIDEO_FPS_RANGE
253
254
255 /* 24 bit */
256
257 #define GST_VIDEO_CAPS_RGB \
258     __GST_VIDEO_CAPS_MAKE_24 (1, 2, 3)
259
260 #define GST_VIDEO_CAPS_BGR \
261     __GST_VIDEO_CAPS_MAKE_24 (3, 2, 1)
262
263 /* 32 bit */
264
265 #define GST_VIDEO_CAPS_RGBx \
266     __GST_VIDEO_CAPS_MAKE_32 (1, 2, 3)
267   
268 #define GST_VIDEO_CAPS_xRGB \
269     __GST_VIDEO_CAPS_MAKE_32 (2, 3, 4)
270   
271 #define GST_VIDEO_CAPS_BGRx \
272     __GST_VIDEO_CAPS_MAKE_32 (3, 2, 1)
273   
274 #define GST_VIDEO_CAPS_xBGR \
275     __GST_VIDEO_CAPS_MAKE_32 (4, 3, 2)
276
277 /* 32 bit alpha */
278
279 #define GST_VIDEO_CAPS_RGBA \
280     __GST_VIDEO_CAPS_MAKE_32A (1, 2, 3, 4)
281   
282 #define GST_VIDEO_CAPS_ARGB \
283     __GST_VIDEO_CAPS_MAKE_32A (2, 3, 4, 1)
284   
285 #define GST_VIDEO_CAPS_BGRA \
286     __GST_VIDEO_CAPS_MAKE_32A (3, 2, 1, 4)
287   
288 #define GST_VIDEO_CAPS_ABGR \
289     __GST_VIDEO_CAPS_MAKE_32A (4, 3, 2, 1)
290
291 /* note: the macro name uses the order on BE systems */
292 #if G_BYTE_ORDER == G_BIG_ENDIAN
293   #define GST_VIDEO_CAPS_xRGB_HOST_ENDIAN \
294       GST_VIDEO_CAPS_xRGB
295   #define GST_VIDEO_CAPS_BGRx_HOST_ENDIAN \
296       GST_VIDEO_CAPS_BGRx
297 #else
298   #define GST_VIDEO_CAPS_xRGB_HOST_ENDIAN \
299       GST_VIDEO_CAPS_BGRx
300   #define GST_VIDEO_CAPS_BGRx_HOST_ENDIAN \
301       GST_VIDEO_CAPS_xRGB
302 #endif
303       
304 /* 15/16 bit */
305   
306 #define GST_VIDEO_CAPS_RGB_16 \
307     __GST_VIDEO_CAPS_MAKE_16 (1, 2, 3)
308
309 #define GST_VIDEO_CAPS_BGR_16 \
310     __GST_VIDEO_CAPS_MAKE_16 (3, 2, 1)
311
312 #define GST_VIDEO_CAPS_RGB_15 \
313     __GST_VIDEO_CAPS_MAKE_15 (1, 2, 3)
314
315 #define GST_VIDEO_CAPS_BGR_15 \
316     __GST_VIDEO_CAPS_MAKE_15 (3, 2, 1)
317
318 /* 30 bit */
319 #define GST_VIDEO_CAPS_r210 \
320     "video/x-raw-rgb, "                                                 \
321     "bpp = (int) 32, "                                                  \
322     "depth = (int) 30, "                                                \
323     "endianness = (int) BIG_ENDIAN, "                                   \
324     "red_mask = (int) 0x3ff00000, "                                     \
325     "green_mask = (int) 0x000ffc00, "                                   \
326     "blue_mask = (int) 0x000003ff, "                                    \
327     "width = " GST_VIDEO_SIZE_RANGE ", "                                \
328     "height = " GST_VIDEO_SIZE_RANGE ", "                               \
329     "framerate = " GST_VIDEO_FPS_RANGE
330
331 /* 64 bit alpha */
332
333 #define GST_VIDEO_CAPS_ARGB_64 \
334     __GST_VIDEO_CAPS_MAKE_64A (2, 3, 4, 1)
335
336 /**
337  * GST_VIDEO_CAPS_RGB8_PALETTED:
338  *
339  * Generic caps string for 8-bit paletted RGB video, for use in pad templates.
340  *
341  * Since: 0.10.32
342  */
343 #define GST_VIDEO_CAPS_RGB8_PALETTED \
344   "video/x-raw-rgb, bpp = (int)8, depth = (int)8, "                     \
345       "width = "GST_VIDEO_SIZE_RANGE" , "                               \
346       "height = " GST_VIDEO_SIZE_RANGE ", "                             \
347       "framerate = "GST_VIDEO_FPS_RANGE
348
349 /**
350  * GST_VIDEO_CAPS_YUV:
351  * @fourcc: YUV fourcc format that describes the pixel layout, as string
352  *     (e.g. "I420", "YV12", "YUY2", "AYUV", etc.)
353  *
354  * Generic caps string for YUV video, for use in pad templates.
355  */
356 #define GST_VIDEO_CAPS_YUV(fourcc)                                      \
357         "video/x-raw-yuv, "                                             \
358         "format = (fourcc) " fourcc ", "                                \
359         "width = " GST_VIDEO_SIZE_RANGE ", "                            \
360         "height = " GST_VIDEO_SIZE_RANGE ", "                           \
361         "framerate = " GST_VIDEO_FPS_RANGE
362
363 /**
364  * GST_VIDEO_CAPS_GRAY8:
365  *
366  * Generic caps string for 8-bit grayscale video, for use in pad templates.
367  *
368  * Since: 0.10.29
369  */
370 #define GST_VIDEO_CAPS_GRAY8                                            \
371         "video/x-raw-gray, "                                            \
372         "bpp = (int) 8, "                                               \
373         "depth = (int) 8, "                                             \
374         "width = " GST_VIDEO_SIZE_RANGE ", "                            \
375         "height = " GST_VIDEO_SIZE_RANGE ", "                           \
376         "framerate = " GST_VIDEO_FPS_RANGE
377
378 /**
379  * GST_VIDEO_CAPS_GRAY16:
380  * @endianness: endianness as string, ie. either "1234", "4321", "BIG_ENDIAN"
381  *     or "LITTLE_ENDIAN"
382  *
383  * Generic caps string for 16-bit grayscale video, for use in pad templates.
384  *
385  * Since: 0.10.29
386  */
387 #define GST_VIDEO_CAPS_GRAY16(endianness)                               \
388         "video/x-raw-gray, "                                            \
389         "bpp = (int) 16, "                                              \
390         "depth = (int) 16, "                                            \
391         "endianness = (int) " endianness ", "                           \
392         "width = " GST_VIDEO_SIZE_RANGE ", "                            \
393         "height = " GST_VIDEO_SIZE_RANGE ", "                           \
394         "framerate = " GST_VIDEO_FPS_RANGE
395
396 /* buffer flags */
397
398 /**
399  * GST_VIDEO_BUFFER_TFF:
400  *
401  * If the #GstBuffer is interlaced, then the first field in the video frame is
402  * the top field.  If unset, the bottom field is first.
403  *
404  * Since: 0.10.23
405  */
406 #define GST_VIDEO_BUFFER_TFF GST_BUFFER_FLAG_MEDIA1
407
408 /**
409  * GST_VIDEO_BUFFER_RFF:
410  *
411  * If the #GstBuffer is interlaced, then the first field (as defined by the
412  * %GST_VIDEO_BUFFER_TFF flag setting) is repeated.
413  *
414  * Since: 0.10.23
415  */
416 #define GST_VIDEO_BUFFER_RFF GST_BUFFER_FLAG_MEDIA2
417
418 /**
419  * GST_VIDEO_BUFFER_ONEFIELD:
420  *
421  * If the #GstBuffer is interlaced, then only the first field (as defined by the
422  * %GST_VIDEO_BUFFER_TFF flag setting) is to be displayed.
423  *
424  * Since: 0.10.23
425  */
426 #define GST_VIDEO_BUFFER_ONEFIELD GST_BUFFER_FLAG_MEDIA3
427
428 /**
429  * GST_VIDEO_BUFFER_PROGRESSIVE:
430  *
431  * If the #GstBuffer is telecined, then the buffer is progressive if the
432  * %GST_VIDEO_BUFFER_PROGRESSIVE flag is set, else it is telecine mixed.
433  *
434  * Since: 0.10.33
435  */
436 #define GST_VIDEO_BUFFER_PROGRESSIVE GST_BUFFER_FLAG_MEDIA4
437
438 /* functions */
439
440 const GValue * gst_video_frame_rate (GstPad * pad);
441
442 gboolean       gst_video_get_size   (GstPad * pad,
443                                      gint   * width,
444                                      gint   * height);
445
446 gboolean       gst_video_calculate_display_ratio (guint * dar_n,
447                                                   guint * dar_d,
448                                                   guint   video_width,
449                                                   guint   video_height,
450                                                   guint   video_par_n,
451                                                   guint   video_par_d,
452                                                   guint   display_par_n,
453                                                   guint   display_par_d);
454
455 gboolean       gst_video_format_parse_caps (const GstCaps  * caps,
456                                             GstVideoFormat * format,
457                                             int            * width,
458                                             int            * height);
459
460 gboolean       gst_video_format_parse_caps_interlaced  (GstCaps  * caps,
461                                                         gboolean * interlaced);
462
463
464 gboolean       gst_video_parse_caps_pixel_aspect_ratio (GstCaps  * caps,
465                                                         int      * par_n,
466                                                         int      * par_d);
467
468 gboolean       gst_video_parse_caps_framerate    (GstCaps * caps,
469                                                   int     * fps_n,
470                                                   int     * fps_d);
471
472 const char *   gst_video_parse_caps_color_matrix (GstCaps * caps);
473
474 const char *   gst_video_parse_caps_chroma_site  (GstCaps * caps);
475
476 GstBuffer *    gst_video_parse_caps_palette      (GstCaps * caps);
477
478 /* create caps given format and details */
479
480 GstCaps *      gst_video_format_new_caps (GstVideoFormat format,
481                                           int width, int height,
482                                           int framerate_n,
483                                           int framerate_d,
484                                           int par_n, int par_d);
485
486 GstCaps *      gst_video_format_new_caps_interlaced (GstVideoFormat format,
487                                                      int width, int height,
488                                                      int framerate_n,
489                                                      int framerate_d,
490                                                      int par_n, int par_d,
491                                                      gboolean interlaced);
492
493 GstCaps *      gst_video_format_new_template_caps (GstVideoFormat format);
494
495 /* format properties */
496
497 GstVideoFormat gst_video_format_from_fourcc (guint32 fourcc) G_GNUC_CONST;
498
499 guint32        gst_video_format_to_fourcc (GstVideoFormat format) G_GNUC_CONST;
500
501 gboolean       gst_video_format_is_rgb    (GstVideoFormat format) G_GNUC_CONST;
502
503 gboolean       gst_video_format_is_yuv    (GstVideoFormat format) G_GNUC_CONST;
504
505 gboolean       gst_video_format_is_gray   (GstVideoFormat format) G_GNUC_CONST;
506
507 gboolean       gst_video_format_has_alpha (GstVideoFormat format) G_GNUC_CONST;
508
509
510 int            gst_video_format_get_component_depth  (GstVideoFormat format,
511                                                       int            component) G_GNUC_CONST;
512
513 int            gst_video_format_get_row_stride       (GstVideoFormat format,
514                                                       int            component,
515                                                       int            width) G_GNUC_CONST;
516
517 int            gst_video_format_get_pixel_stride     (GstVideoFormat format,
518                                                       int            component) G_GNUC_CONST;
519
520 int            gst_video_format_get_component_width  (GstVideoFormat format,
521                                                       int            component,
522                                                       int            width) G_GNUC_CONST;
523
524 int            gst_video_format_get_component_height (GstVideoFormat format,
525                                                       int            component,
526                                                       int            height) G_GNUC_CONST;
527
528 int            gst_video_format_get_component_offset (GstVideoFormat format,
529                                                       int            component,
530                                                       int            width,
531                                                       int            height) G_GNUC_CONST;
532
533 int            gst_video_format_get_size             (GstVideoFormat format,
534                                                       int            width,
535                                                       int            height) G_GNUC_CONST;
536
537 gboolean       gst_video_get_size_from_caps (const GstCaps * caps, gint * size);
538
539 gboolean       gst_video_format_convert (GstVideoFormat  format,
540                                          int             width,
541                                          int             height,
542                                          int             fps_n,
543                                          int             fps_d,
544                                          GstFormat       src_format,
545                                          gint64          src_value,
546                                          GstFormat       dest_format,
547                                          gint64        * dest_value);
548
549 /* video still frame event creation and parsing */
550
551 GstEvent *     gst_video_event_new_still_frame   (gboolean in_still);
552
553 gboolean       gst_video_event_parse_still_frame (GstEvent * event, gboolean * in_still);
554
555
556 /* convert/encode video frame from one format to another */
557
558 typedef void (*GstVideoConvertFrameCallback) (GstBuffer * buf, GError *error, gpointer user_data);
559
560 void           gst_video_convert_frame_async (GstBuffer                    * buf,
561                                               const GstCaps                * to_caps,
562                                               GstClockTime                   timeout,
563                                               GstVideoConvertFrameCallback   callback,
564                                               gpointer                       user_data,
565                                               GDestroyNotify                 destroy_notify);
566
567 GstBuffer *    gst_video_convert_frame       (GstBuffer     * buf,
568                                               const GstCaps * to_caps,
569                                               GstClockTime    timeout,
570                                               GError       ** error);
571
572 G_END_DECLS
573
574 #endif /* __GST_VIDEO_H__ */