expand tabs
[platform/upstream/gstreamer.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 #define GST_VIDEO_BYTE1_MASK_32  "0xFF000000"
29 #define GST_VIDEO_BYTE2_MASK_32  "0x00FF0000"
30 #define GST_VIDEO_BYTE3_MASK_32  "0x0000FF00"
31 #define GST_VIDEO_BYTE4_MASK_32  "0x000000FF"
32
33 #define GST_VIDEO_BYTE1_MASK_24  "0x00FF0000"
34 #define GST_VIDEO_BYTE2_MASK_24  "0x0000FF00"
35 #define GST_VIDEO_BYTE3_MASK_24  "0x000000FF"
36
37 #define GST_VIDEO_BYTE1_MASK_32_INT  0xFF000000
38 #define GST_VIDEO_BYTE2_MASK_32_INT  0x00FF0000
39 #define GST_VIDEO_BYTE3_MASK_32_INT  0x0000FF00
40 #define GST_VIDEO_BYTE4_MASK_32_INT  0x000000FF
41
42 #define GST_VIDEO_BYTE1_MASK_24_INT  0x00FF0000
43 #define GST_VIDEO_BYTE2_MASK_24_INT  0x0000FF00
44 #define GST_VIDEO_BYTE3_MASK_24_INT  0x000000FF
45
46 #define GST_VIDEO_RED_MASK_16 "0xf800"
47 #define GST_VIDEO_GREEN_MASK_16 "0x07e0"
48 #define GST_VIDEO_BLUE_MASK_16 "0x001f"
49
50 #define GST_VIDEO_RED_MASK_15 "0x7c00"
51 #define GST_VIDEO_GREEN_MASK_15 "0x03e0"
52 #define GST_VIDEO_BLUE_MASK_15 "0x001f"
53
54 #define GST_VIDEO_RED_MASK_16_INT 0xf800
55 #define GST_VIDEO_GREEN_MASK_16_INT 0x07e0
56 #define GST_VIDEO_BLUE_MASK_16_INT 0x001f
57
58 #define GST_VIDEO_RED_MASK_15_INT 0x7c00
59 #define GST_VIDEO_GREEN_MASK_15_INT 0x03e0
60 #define GST_VIDEO_BLUE_MASK_15_INT 0x001f
61
62 #define GST_VIDEO_SIZE_RANGE "(int) [ 1, max ]"
63 #define GST_VIDEO_FPS_RANGE "(fraction) [ 0, max ]"
64
65 /* consider the next 2 protected */
66 #define __GST_VIDEO_CAPS_MAKE_32A(R, G, B, A)                           \
67     "video/x-raw-rgb, "                                                 \
68     "bpp = (int) 32, "                                                  \
69     "depth = (int) 32, "                                                \
70     "endianness = (int) BIG_ENDIAN, "                                   \
71     "red_mask = (int) " GST_VIDEO_BYTE ## R ## _MASK_32 ", "            \
72     "green_mask = (int) " GST_VIDEO_BYTE ## G ## _MASK_32 ", "          \
73     "blue_mask = (int) " GST_VIDEO_BYTE ## B ## _MASK_32 ", "           \
74     "alpha_mask = (int) " GST_VIDEO_BYTE ## A ## _MASK_32 ", "          \
75     "width = " GST_VIDEO_SIZE_RANGE ", "                                \
76     "height = " GST_VIDEO_SIZE_RANGE ", "                               \
77     "framerate = " GST_VIDEO_FPS_RANGE
78
79 #define __GST_VIDEO_CAPS_MAKE_32(R, G, B)                               \
80     "video/x-raw-rgb, "                                                 \
81     "bpp = (int) 32, "                                                  \
82     "depth = (int) 24, "                                                \
83     "endianness = (int) BIG_ENDIAN, "                                   \
84     "red_mask = (int) " GST_VIDEO_BYTE ## R ## _MASK_32 ", "            \
85     "green_mask = (int) " GST_VIDEO_BYTE ## G ## _MASK_32 ", "          \
86     "blue_mask = (int) " GST_VIDEO_BYTE ## B ## _MASK_32 ", "           \
87     "width = " GST_VIDEO_SIZE_RANGE ", "                                \
88     "height = " GST_VIDEO_SIZE_RANGE ", "                               \
89     "framerate = " GST_VIDEO_FPS_RANGE
90
91 #define __GST_VIDEO_CAPS_MAKE_24(R, G, B)                               \
92     "video/x-raw-rgb, "                                                 \
93     "bpp = (int) 24, "                                                  \
94     "depth = (int) 24, "                                                \
95     "endianness = (int) BIG_ENDIAN, "                                   \
96     "red_mask = (int) " GST_VIDEO_BYTE ## R ## _MASK_24 ", "            \
97     "green_mask = (int) " GST_VIDEO_BYTE ## G ## _MASK_24 ", "          \
98     "blue_mask = (int) " GST_VIDEO_BYTE ## B ## _MASK_24 ", "           \
99     "width = " GST_VIDEO_SIZE_RANGE ", "                                \
100     "height = " GST_VIDEO_SIZE_RANGE ", "                               \
101     "framerate = " GST_VIDEO_FPS_RANGE
102
103
104 /* 24 bit */
105
106 #define GST_VIDEO_CAPS_RGB \
107     __GST_VIDEO_CAPS_MAKE_24 (1, 2, 3)
108
109 #define GST_VIDEO_CAPS_BGR \
110     __GST_VIDEO_CAPS_MAKE_24 (3, 2, 1)
111
112 /* 32 bit */
113
114 #define GST_VIDEO_CAPS_RGBx \
115     __GST_VIDEO_CAPS_MAKE_32 (1, 2, 3)
116   
117 #define GST_VIDEO_CAPS_xRGB \
118     __GST_VIDEO_CAPS_MAKE_32 (2, 3, 4)
119   
120 #define GST_VIDEO_CAPS_BGRx \
121     __GST_VIDEO_CAPS_MAKE_32 (3, 2, 1)
122   
123 #define GST_VIDEO_CAPS_xBGR \
124     __GST_VIDEO_CAPS_MAKE_32 (4, 3, 2)
125
126 /* 32 bit alpha */
127
128 #define GST_VIDEO_CAPS_RGBA \
129     __GST_VIDEO_CAPS_MAKE_32A (1, 2, 3, 4)
130   
131 #define GST_VIDEO_CAPS_ARGB \
132     __GST_VIDEO_CAPS_MAKE_32A (2, 3, 4, 1)
133   
134 #define GST_VIDEO_CAPS_BGRA \
135     __GST_VIDEO_CAPS_MAKE_32A (3, 2, 1, 4)
136   
137 #define GST_VIDEO_CAPS_ABGR \
138     __GST_VIDEO_CAPS_MAKE_32A (4, 3, 2, 1)
139
140 /* note: the macro name uses the order on BE systems */
141 #if G_BYTE_ORDER == G_BIG_ENDIAN
142   #define GST_VIDEO_CAPS_xRGB_HOST_ENDIAN \
143       GST_VIDEO_CAPS_xRGB
144   #define GST_VIDEO_CAPS_BGRx_HOST_ENDIAN \
145       GST_VIDEO_CAPS_BGRx
146 #else
147   #define GST_VIDEO_CAPS_xRGB_HOST_ENDIAN \
148       GST_VIDEO_CAPS_BGRx
149   #define GST_VIDEO_CAPS_BGRx_HOST_ENDIAN \
150       GST_VIDEO_CAPS_xRGB
151 #endif
152       
153 /* 15/16 bit */
154   
155 #define GST_VIDEO_CAPS_RGB_16                                           \
156             "video/x-raw-rgb, "                                         \
157             "bpp = (int) 16, "                                          \
158             "depth = (int) 16, "                                        \
159             "endianness = (int) BYTE_ORDER, "                           \
160             "red_mask = (int) " GST_VIDEO_RED_MASK_16 ", "              \
161             "green_mask = (int) " GST_VIDEO_GREEN_MASK_16 ", "          \
162             "blue_mask = (int) " GST_VIDEO_BLUE_MASK_16 ", "            \
163             "width = " GST_VIDEO_SIZE_RANGE ", "                        \
164             "height = " GST_VIDEO_SIZE_RANGE ", "                       \
165             "framerate = " GST_VIDEO_FPS_RANGE
166
167 #define GST_VIDEO_CAPS_RGB_15                                           \
168             "video/x-raw-rgb, "                                         \
169             "bpp = (int) 16, "                                          \
170             "depth = (int) 15, "                                        \
171             "endianness = (int) BYTE_ORDER, "                           \
172             "red_mask = (int) " GST_VIDEO_RED_MASK_15 ", "              \
173             "green_mask = (int) " GST_VIDEO_GREEN_MASK_15 ", "          \
174             "blue_mask = (int) " GST_VIDEO_BLUE_MASK_15 ", "            \
175             "width = " GST_VIDEO_SIZE_RANGE ", "                        \
176             "height = " GST_VIDEO_SIZE_RANGE ", "                       \
177             "framerate = " GST_VIDEO_FPS_RANGE
178
179 #define GST_VIDEO_CAPS_YUV(fourcc)                                      \
180         "video/x-raw-yuv, "                                             \
181         "format = (fourcc) " fourcc ", "                                \
182         "width = " GST_VIDEO_SIZE_RANGE ", "                            \
183         "height = " GST_VIDEO_SIZE_RANGE ", "                           \
184         "framerate = " GST_VIDEO_FPS_RANGE
185
186 /* functions */
187 const GValue *gst_video_frame_rate (GstPad *pad);
188 gboolean gst_video_get_size   (GstPad *pad,
189                                gint   *width,
190                                gint   *height);
191
192 G_END_DECLS
193
194 #endif /* __GST_VIDEO_H__ */