|
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 /** |
|
29 * GstVideoFormat: |
|
30 * @GST_VIDEO_FORMAT_UNKNOWN, |
|
31 * @GST_VIDEO_FORMAT_I420: planar 4:2:0 YUV |
|
32 * @GST_VIDEO_FORMAT_YV12: planar 4:2:0 YVU (like I420 but UV planes swapped) |
|
33 * @GST_VIDEO_FORMAT_YUY2: packed 4:2:2 YUV (Y0-U0-Y1-V0 Y2-U2-Y3-V2 Y4 ...) |
|
34 * @GST_VIDEO_FORMAT_UYVY: packed 4:2:2 YUV (U0-Y0-V0-Y1 U2-Y2-V2-Y3 U4 ...) |
|
35 * @GST_VIDEO_FORMAT_AYUV: packed 4:4:4 YUV with alpha channel (A0-Y0-U0-V0 ...) |
|
36 * @GST_VIDEO_FORMAT_RGBx: |
|
37 * @GST_VIDEO_FORMAT_BGRx: |
|
38 * @GST_VIDEO_FORMAT_xRGB: |
|
39 * @GST_VIDEO_FORMAT_xBGR: |
|
40 * @GST_VIDEO_FORMAT_RGBA: |
|
41 * @GST_VIDEO_FORMAT_BGRA: |
|
42 * @GST_VIDEO_FORMAT_ARGB: |
|
43 * @GST_VIDEO_FORMAT_ABGR: |
|
44 * @GST_VIDEO_FORMAT_RGB: |
|
45 * @GST_VIDEO_FORMAT_BGR: |
|
46 * @GST_VIDEO_FORMAT_Y41B: planar 4:1:1 YUV (Since: 0.10.18) |
|
47 * @GST_VIDEO_FORMAT_Y42B: planar 4:2:2 YUV (Since: 0.10.18) |
|
48 * |
|
49 * Enum value describing the most common video formats. |
|
50 */ |
|
51 typedef enum { |
|
52 GST_VIDEO_FORMAT_UNKNOWN, |
|
53 GST_VIDEO_FORMAT_I420, |
|
54 GST_VIDEO_FORMAT_YV12, |
|
55 GST_VIDEO_FORMAT_YUY2, |
|
56 GST_VIDEO_FORMAT_UYVY, |
|
57 GST_VIDEO_FORMAT_AYUV, |
|
58 GST_VIDEO_FORMAT_RGBx, |
|
59 GST_VIDEO_FORMAT_BGRx, |
|
60 GST_VIDEO_FORMAT_xRGB, |
|
61 GST_VIDEO_FORMAT_xBGR, |
|
62 GST_VIDEO_FORMAT_RGBA, |
|
63 GST_VIDEO_FORMAT_BGRA, |
|
64 GST_VIDEO_FORMAT_ARGB, |
|
65 GST_VIDEO_FORMAT_ABGR, |
|
66 GST_VIDEO_FORMAT_RGB, |
|
67 GST_VIDEO_FORMAT_BGR, |
|
68 GST_VIDEO_FORMAT_Y41B, |
|
69 GST_VIDEO_FORMAT_Y42B |
|
70 } GstVideoFormat; |
|
71 |
|
72 #define GST_VIDEO_BYTE1_MASK_32 "0xFF000000" |
|
73 #define GST_VIDEO_BYTE2_MASK_32 "0x00FF0000" |
|
74 #define GST_VIDEO_BYTE3_MASK_32 "0x0000FF00" |
|
75 #define GST_VIDEO_BYTE4_MASK_32 "0x000000FF" |
|
76 |
|
77 #define GST_VIDEO_BYTE1_MASK_24 "0x00FF0000" |
|
78 #define GST_VIDEO_BYTE2_MASK_24 "0x0000FF00" |
|
79 #define GST_VIDEO_BYTE3_MASK_24 "0x000000FF" |
|
80 |
|
81 #define GST_VIDEO_BYTE1_MASK_32_INT 0xFF000000 |
|
82 #define GST_VIDEO_BYTE2_MASK_32_INT 0x00FF0000 |
|
83 #define GST_VIDEO_BYTE3_MASK_32_INT 0x0000FF00 |
|
84 #define GST_VIDEO_BYTE4_MASK_32_INT 0x000000FF |
|
85 |
|
86 #define GST_VIDEO_BYTE1_MASK_24_INT 0x00FF0000 |
|
87 #define GST_VIDEO_BYTE2_MASK_24_INT 0x0000FF00 |
|
88 #define GST_VIDEO_BYTE3_MASK_24_INT 0x000000FF |
|
89 |
|
90 #define GST_VIDEO_RED_MASK_16 "0xf800" |
|
91 #define GST_VIDEO_GREEN_MASK_16 "0x07e0" |
|
92 #define GST_VIDEO_BLUE_MASK_16 "0x001f" |
|
93 |
|
94 #define GST_VIDEO_RED_MASK_15 "0x7c00" |
|
95 #define GST_VIDEO_GREEN_MASK_15 "0x03e0" |
|
96 #define GST_VIDEO_BLUE_MASK_15 "0x001f" |
|
97 |
|
98 #define GST_VIDEO_RED_MASK_16_INT 0xf800 |
|
99 #define GST_VIDEO_GREEN_MASK_16_INT 0x07e0 |
|
100 #define GST_VIDEO_BLUE_MASK_16_INT 0x001f |
|
101 |
|
102 #define GST_VIDEO_RED_MASK_15_INT 0x7c00 |
|
103 #define GST_VIDEO_GREEN_MASK_15_INT 0x03e0 |
|
104 #define GST_VIDEO_BLUE_MASK_15_INT 0x001f |
|
105 |
|
106 #define GST_VIDEO_SIZE_RANGE "(int) [ 1, max ]" |
|
107 #define GST_VIDEO_FPS_RANGE "(fraction) [ 0, max ]" |
|
108 |
|
109 /* consider the next 2 protected */ |
|
110 #define __GST_VIDEO_CAPS_MAKE_32A(R, G, B, A) \ |
|
111 "video/x-raw-rgb, " \ |
|
112 "bpp = (int) 32, " \ |
|
113 "depth = (int) 32, " \ |
|
114 "endianness = (int) BIG_ENDIAN, " \ |
|
115 "red_mask = (int) " GST_VIDEO_BYTE ## R ## _MASK_32 ", " \ |
|
116 "green_mask = (int) " GST_VIDEO_BYTE ## G ## _MASK_32 ", " \ |
|
117 "blue_mask = (int) " GST_VIDEO_BYTE ## B ## _MASK_32 ", " \ |
|
118 "alpha_mask = (int) " GST_VIDEO_BYTE ## A ## _MASK_32 ", " \ |
|
119 "width = " GST_VIDEO_SIZE_RANGE ", " \ |
|
120 "height = " GST_VIDEO_SIZE_RANGE ", " \ |
|
121 "framerate = " GST_VIDEO_FPS_RANGE |
|
122 |
|
123 #define __GST_VIDEO_CAPS_MAKE_32(R, G, B) \ |
|
124 "video/x-raw-rgb, " \ |
|
125 "bpp = (int) 32, " \ |
|
126 "depth = (int) 24, " \ |
|
127 "endianness = (int) BIG_ENDIAN, " \ |
|
128 "red_mask = (int) " GST_VIDEO_BYTE ## R ## _MASK_32 ", " \ |
|
129 "green_mask = (int) " GST_VIDEO_BYTE ## G ## _MASK_32 ", " \ |
|
130 "blue_mask = (int) " GST_VIDEO_BYTE ## B ## _MASK_32 ", " \ |
|
131 "width = " GST_VIDEO_SIZE_RANGE ", " \ |
|
132 "height = " GST_VIDEO_SIZE_RANGE ", " \ |
|
133 "framerate = " GST_VIDEO_FPS_RANGE |
|
134 |
|
135 #define __GST_VIDEO_CAPS_MAKE_24(R, G, B) \ |
|
136 "video/x-raw-rgb, " \ |
|
137 "bpp = (int) 24, " \ |
|
138 "depth = (int) 24, " \ |
|
139 "endianness = (int) BIG_ENDIAN, " \ |
|
140 "red_mask = (int) " GST_VIDEO_BYTE ## R ## _MASK_24 ", " \ |
|
141 "green_mask = (int) " GST_VIDEO_BYTE ## G ## _MASK_24 ", " \ |
|
142 "blue_mask = (int) " GST_VIDEO_BYTE ## B ## _MASK_24 ", " \ |
|
143 "width = " GST_VIDEO_SIZE_RANGE ", " \ |
|
144 "height = " GST_VIDEO_SIZE_RANGE ", " \ |
|
145 "framerate = " GST_VIDEO_FPS_RANGE |
|
146 |
|
147 |
|
148 /* 24 bit */ |
|
149 |
|
150 #define GST_VIDEO_CAPS_RGB \ |
|
151 __GST_VIDEO_CAPS_MAKE_24 (1, 2, 3) |
|
152 |
|
153 #define GST_VIDEO_CAPS_BGR \ |
|
154 __GST_VIDEO_CAPS_MAKE_24 (3, 2, 1) |
|
155 |
|
156 /* 32 bit */ |
|
157 |
|
158 #define GST_VIDEO_CAPS_RGBx \ |
|
159 __GST_VIDEO_CAPS_MAKE_32 (1, 2, 3) |
|
160 |
|
161 #define GST_VIDEO_CAPS_xRGB \ |
|
162 __GST_VIDEO_CAPS_MAKE_32 (2, 3, 4) |
|
163 |
|
164 #define GST_VIDEO_CAPS_BGRx \ |
|
165 __GST_VIDEO_CAPS_MAKE_32 (3, 2, 1) |
|
166 |
|
167 #define GST_VIDEO_CAPS_xBGR \ |
|
168 __GST_VIDEO_CAPS_MAKE_32 (4, 3, 2) |
|
169 |
|
170 /* 32 bit alpha */ |
|
171 |
|
172 #define GST_VIDEO_CAPS_RGBA \ |
|
173 __GST_VIDEO_CAPS_MAKE_32A (1, 2, 3, 4) |
|
174 |
|
175 #define GST_VIDEO_CAPS_ARGB \ |
|
176 __GST_VIDEO_CAPS_MAKE_32A (2, 3, 4, 1) |
|
177 |
|
178 #define GST_VIDEO_CAPS_BGRA \ |
|
179 __GST_VIDEO_CAPS_MAKE_32A (3, 2, 1, 4) |
|
180 |
|
181 #define GST_VIDEO_CAPS_ABGR \ |
|
182 __GST_VIDEO_CAPS_MAKE_32A (4, 3, 2, 1) |
|
183 |
|
184 /* note: the macro name uses the order on BE systems */ |
|
185 #if G_BYTE_ORDER == G_BIG_ENDIAN |
|
186 #define GST_VIDEO_CAPS_xRGB_HOST_ENDIAN \ |
|
187 GST_VIDEO_CAPS_xRGB |
|
188 #define GST_VIDEO_CAPS_BGRx_HOST_ENDIAN \ |
|
189 GST_VIDEO_CAPS_BGRx |
|
190 #else |
|
191 #define GST_VIDEO_CAPS_xRGB_HOST_ENDIAN \ |
|
192 GST_VIDEO_CAPS_BGRx |
|
193 #define GST_VIDEO_CAPS_BGRx_HOST_ENDIAN \ |
|
194 GST_VIDEO_CAPS_xRGB |
|
195 #endif |
|
196 |
|
197 /* 15/16 bit */ |
|
198 |
|
199 #define GST_VIDEO_CAPS_RGB_16 \ |
|
200 "video/x-raw-rgb, " \ |
|
201 "bpp = (int) 16, " \ |
|
202 "depth = (int) 16, " \ |
|
203 "endianness = (int) BYTE_ORDER, " \ |
|
204 "red_mask = (int) " GST_VIDEO_RED_MASK_16 ", " \ |
|
205 "green_mask = (int) " GST_VIDEO_GREEN_MASK_16 ", " \ |
|
206 "blue_mask = (int) " GST_VIDEO_BLUE_MASK_16 ", " \ |
|
207 "width = " GST_VIDEO_SIZE_RANGE ", " \ |
|
208 "height = " GST_VIDEO_SIZE_RANGE ", " \ |
|
209 "framerate = " GST_VIDEO_FPS_RANGE |
|
210 |
|
211 #define GST_VIDEO_CAPS_RGB_15 \ |
|
212 "video/x-raw-rgb, " \ |
|
213 "bpp = (int) 16, " \ |
|
214 "depth = (int) 15, " \ |
|
215 "endianness = (int) BYTE_ORDER, " \ |
|
216 "red_mask = (int) " GST_VIDEO_RED_MASK_15 ", " \ |
|
217 "green_mask = (int) " GST_VIDEO_GREEN_MASK_15 ", " \ |
|
218 "blue_mask = (int) " GST_VIDEO_BLUE_MASK_15 ", " \ |
|
219 "width = " GST_VIDEO_SIZE_RANGE ", " \ |
|
220 "height = " GST_VIDEO_SIZE_RANGE ", " \ |
|
221 "framerate = " GST_VIDEO_FPS_RANGE |
|
222 |
|
223 #define GST_VIDEO_CAPS_YUV(fourcc) \ |
|
224 "video/x-raw-yuv, " \ |
|
225 "format = (fourcc) " fourcc ", " \ |
|
226 "width = " GST_VIDEO_SIZE_RANGE ", " \ |
|
227 "height = " GST_VIDEO_SIZE_RANGE ", " \ |
|
228 "framerate = " GST_VIDEO_FPS_RANGE |
|
229 |
|
230 /* functions */ |
|
231 #ifdef __SYMBIAN32__ |
|
232 IMPORT_C |
|
233 #endif |
|
234 |
|
235 const GValue *gst_video_frame_rate (GstPad *pad); |
|
236 #ifdef __SYMBIAN32__ |
|
237 IMPORT_C |
|
238 #endif |
|
239 |
|
240 gboolean gst_video_get_size (GstPad *pad, |
|
241 gint *width, |
|
242 gint *height); |
|
243 #ifdef __SYMBIAN32__ |
|
244 IMPORT_C |
|
245 #endif |
|
246 |
|
247 |
|
248 gboolean gst_video_calculate_display_ratio (guint *dar_n, guint *dar_d, |
|
249 guint video_width, guint video_height, |
|
250 guint video_par_n, guint video_par_d, |
|
251 guint display_par_n, guint display_par_d); |
|
252 #ifdef __SYMBIAN32__ |
|
253 IMPORT_C |
|
254 #endif |
|
255 |
|
256 |
|
257 gboolean gst_video_format_parse_caps (GstCaps *caps, GstVideoFormat *format, |
|
258 int *width, int *height); |
|
259 #ifdef __SYMBIAN32__ |
|
260 IMPORT_C |
|
261 #endif |
|
262 |
|
263 gboolean gst_video_parse_caps_framerate (GstCaps *caps, |
|
264 int *fps_n, int *fps_d); |
|
265 #ifdef __SYMBIAN32__ |
|
266 IMPORT_C |
|
267 #endif |
|
268 |
|
269 gboolean gst_video_parse_caps_pixel_aspect_ratio (GstCaps *caps, |
|
270 int *par_n, int *par_d); |
|
271 #ifdef __SYMBIAN32__ |
|
272 IMPORT_C |
|
273 #endif |
|
274 |
|
275 GstCaps * gst_video_format_new_caps (GstVideoFormat format, |
|
276 int width, int height, int framerate_n, int framerate_d, |
|
277 int par_n, int par_d); |
|
278 #ifdef __SYMBIAN32__ |
|
279 IMPORT_C |
|
280 #endif |
|
281 |
|
282 GstVideoFormat gst_video_format_from_fourcc (guint32 fourcc); |
|
283 #ifdef __SYMBIAN32__ |
|
284 IMPORT_C |
|
285 #endif |
|
286 |
|
287 guint32 gst_video_format_to_fourcc (GstVideoFormat format); |
|
288 #ifdef __SYMBIAN32__ |
|
289 IMPORT_C |
|
290 #endif |
|
291 |
|
292 gboolean gst_video_format_is_rgb (GstVideoFormat format); |
|
293 #ifdef __SYMBIAN32__ |
|
294 IMPORT_C |
|
295 #endif |
|
296 |
|
297 gboolean gst_video_format_is_yuv (GstVideoFormat format); |
|
298 #ifdef __SYMBIAN32__ |
|
299 IMPORT_C |
|
300 #endif |
|
301 |
|
302 gboolean gst_video_format_has_alpha (GstVideoFormat format); |
|
303 #ifdef __SYMBIAN32__ |
|
304 IMPORT_C |
|
305 #endif |
|
306 |
|
307 int gst_video_format_get_row_stride (GstVideoFormat format, int component, |
|
308 int width); |
|
309 #ifdef __SYMBIAN32__ |
|
310 IMPORT_C |
|
311 #endif |
|
312 |
|
313 int gst_video_format_get_pixel_stride (GstVideoFormat format, int component); |
|
314 #ifdef __SYMBIAN32__ |
|
315 IMPORT_C |
|
316 #endif |
|
317 |
|
318 int gst_video_format_get_component_width (GstVideoFormat format, int component, |
|
319 int width); |
|
320 #ifdef __SYMBIAN32__ |
|
321 IMPORT_C |
|
322 #endif |
|
323 |
|
324 int gst_video_format_get_component_height (GstVideoFormat format, int component, |
|
325 int height); |
|
326 #ifdef __SYMBIAN32__ |
|
327 IMPORT_C |
|
328 #endif |
|
329 |
|
330 int gst_video_format_get_component_offset (GstVideoFormat format, int component, |
|
331 int width, int height); |
|
332 #ifdef __SYMBIAN32__ |
|
333 IMPORT_C |
|
334 #endif |
|
335 |
|
336 int gst_video_format_get_size (GstVideoFormat format, int width, int height); |
|
337 #ifdef __SYMBIAN32__ |
|
338 IMPORT_C |
|
339 #endif |
|
340 |
|
341 gboolean gst_video_format_convert (GstVideoFormat format, int width, int height, |
|
342 int fps_n, int fps_d, |
|
343 GstFormat src_format, gint64 src_value, |
|
344 GstFormat dest_format, gint64 * dest_value); |
|
345 |
|
346 |
|
347 G_END_DECLS |
|
348 |
|
349 #endif /* __GST_VIDEO_H__ */ |