summaryrefslogtreecommitdiff
path: root/gst-libs/gst/video/video.h
blob: e4434afed1640fbbc2959888c6986bf3cca2b098 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
/* GStreamer
 * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
 * Library       <2002> Ronald Bultje <rbultje@ronald.bitfreak.net>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */

#ifndef __GST_VIDEO_H__
#define __GST_VIDEO_H__

#include <gst/gst.h>

#define R_MASK_32 "0xff000000"
#define G_MASK_32 "0x00ff0000"
#define B_MASK_32 "0x0000ff00"

#define R_MASK_32_REVERSE "0x000000ff"
#define G_MASK_32_REVERSE "0x0000ff00"
#define B_MASK_32_REVERSE "0x00ff0000"

#define R_MASK_24 "0xff0000"
#define G_MASK_24 "0x00ff00"
#define B_MASK_24 "0x0000ff"

#define R_MASK_24_REVERSE "0x0000ff"
#define G_MASK_24_REVERSE "0x00ff00"
#define B_MASK_24_REVERSE "0xff0000"

#define R_MASK_16 "0xf800"
#define G_MASK_16 "0x07e0"
#define B_MASK_16 "0x001f"

#define R_MASK_15 "0x8c00"
#define G_MASK_15 "0x03e0"
#define B_MASK_15 "0x001f"

#define SIZE_RANGE "(int) [ 16, 4096 ]"
#define FPS_RANGE "(double) [ 0, max ]"

/* properties for pad templates */
#define GST_VIDEO_RGB_PAD_TEMPLATE_PROPS_24_32 \
        gst_props_new ( \
            "bpp",              GST_PROPS_LIST ( \
                                  GST_PROPS_INT (24), \
                                  GST_PROPS_INT (32) \
                                ), \
            "depth",            GST_PROPS_LIST ( \
                                  GST_PROPS_INT (24), \
                                  GST_PROPS_INT (32) \
                                ), \
            "endianness",       GST_PROPS_INT (G_BIG_ENDIAN), \
            "red_mask",         GST_PROPS_LIST ( \
                                  GST_PROPS_INT (R_MASK_32), \
                                  GST_PROPS_INT (R_MASK_24) \
                                ), \
            "green_mask",       GST_PROPS_LIST ( \
                                  GST_PROPS_INT (G_MASK_32), \
                                  GST_PROPS_INT (G_MASK_24) \
                                ), \
            "blue_mask",        GST_PROPS_LIST ( \
                                  GST_PROPS_INT (B_MASK_32), \
                                  GST_PROPS_INT (B_MASK_24) \
                                ), \
            "width",            SIZE_RANGE, \
            "height",           SIZE_RANGE, \
            "framerate",        FPS_RANGE, \
            NULL)

#define GST_VIDEO_RGB_PAD_TEMPLATE_PROPS_24_32_REVERSE \
        gst_props_new ( \
            "bpp",              GST_PROPS_LIST ( \
                                  GST_PROPS_INT (24), \
                                  GST_PROPS_INT (32) \
                                ), \
            "depth",            GST_PROPS_LIST ( \
                                  GST_PROPS_INT (24), \
                                  GST_PROPS_INT (32) \
                                ), \
            "endianness",       GST_PROPS_INT (G_BIG_ENDIAN), \
            "red_mask",         GST_PROPS_LIST ( \
                                  GST_PROPS_INT (R_MASK_32_REVERSE), \
                                  GST_PROPS_INT (R_MASK_24_REVERSE) \
                                ), \
            "green_mask",       GST_PROPS_LIST ( \
                                  GST_PROPS_INT (G_MASK_32_REVERSE), \
                                  GST_PROPS_INT (G_MASK_24_REVERSE) \
                                ), \
            "blue_mask",        GST_PROPS_LIST ( \
                                  GST_PROPS_INT (B_MASK_32_REVERSE), \
                                  GST_PROPS_INT (B_MASK_24_REVERSE) \
                                ), \
            "width",            SIZE_RANGE, \
            "height",           SIZE_RANGE, \
            "framerate",        FPS_RANGE, \
            NULL)

#define GST_VIDEO_RGB_PAD_TEMPLATE_CAPS_32 \
	    "video/x-raw-rgb, " \
            "bpp = (int) 32, " \
            "depth = (int) 32, " \
            "endianness = (int) BIG_ENDIAN, " \
            "red_mask = (int) " R_MASK_32 ", " \
            "green_mask = (int) " G_MASK_32 ", " \
            "blue_mask = (int) " B_MASK_32 ", " \
            "width = " SIZE_RANGE ", " \
            "height = " SIZE_RANGE ", " \
            "framerate = " FPS_RANGE

#define GST_VIDEO_RGB_PAD_TEMPLATE_CAPS_24 \
	    "video/x-raw-rgb, " \
            "bpp = (int) 24, " \
            "depth = (int) 24, " \
            "endianness = (int) BIG_ENDIAN, " \
            "red_mask = (int) " R_MASK_24 ", " \
            "green_mask = (int) " G_MASK_24 ", " \
            "blue_mask = (int) " B_MASK_24 ", " \
            "width = " SIZE_RANGE ", " \
            "height = " SIZE_RANGE ", " \
            "framerate = " FPS_RANGE

#define GST_VIDEO_RGB_PAD_TEMPLATE_PROPS_32_REVERSE \
	    "video/x-raw-rgb, " \
            "bpp = (int) 32, " \
            "depth = (int) 32, " \
            "endianness = (int) BIG_ENDIAN, " \
            "red_mask = (int) " R_MASK_32_REVERSE ", " \
            "green_mask = (int) " G_MASK_32_REVERSE ", " \
            "blue_mask = (int) " B_MASK_32_REVERSE ", " \
            "width = " SIZE_RANGE ", " \
            "height = " SIZE_RANGE ", " \
            "framerate = " FPS_RANGE

#define GST_VIDEO_RGB_PAD_TEMPLATE_CAPS_24_REVERSE \
	    "video/x-raw-rgb, " \
            "bpp = (int) 24, " \
            "depth = (int) 24, " \
            "endianness = (int) BIG_ENDIAN, " \
            "red_mask = (int) " R_MASK_24_REVERSE ", " \
            "green_mask = (int) " G_MASK_24_REVERSE ", " \
            "blue_mask = (int) " B_MASK_24_REVERSE ", " \
            "width = " SIZE_RANGE ", " \
            "height = " SIZE_RANGE ", " \
            "framerate = " FPS_RANGE

#define GST_VIDEO_RGB_PAD_TEMPLATE_PROPS_15_16 \
        gst_props_new ( \
            "bpp",              GST_PROPS_INT (16), \
            "depth",            GST_PROPS_LIST ( \
                                  GST_PROPS_INT (15), \
                                  GST_PROPS_INT (16) \
                                ), \
            "endianness",       GST_PROPS_INT (G_BYTE_ORDER), \
            "red_mask",         GST_PROPS_LIST ( \
                                  GST_PROPS_INT (R_MASK_15), \
                                  GST_PROPS_INT (R_MASK_16) \
                                ), \
            "green_mask",       GST_PROPS_LIST ( \
                                  GST_PROPS_INT (G_MASK_15), \
                                  GST_PROPS_INT (G_MASK_16) \
                                ), \
            "blue_mask",        GST_PROPS_LIST ( \
                                  GST_PROPS_INT (B_MASK_15), \
                                  GST_PROPS_INT (B_MASK_16) \
                                ), \
            "width",            SIZE_RANGE, \
            "height",           SIZE_RANGE, \
            "framerate",        FPS_RANGE, \
            NULL)

#define GST_VIDEO_RGB_PAD_TEMPLATE_CAPS_16 \
	    "video/x-raw-rgb, "				\
            "bpp = (int) 16, "				\
            "depth = (int) 16, "			\
            "endianness = (int) BYTE_ORDER, "		\
            "red_mask = (int) " R_MASK_16 ", "		\
            "green_mask = (int) " G_MASK_16 ", "	\
            "blue_mask = (int) " B_MASK_16 ", "		\
            "width = " SIZE_RANGE ", "			\
            "height = " SIZE_RANGE ", "			\
            "framerate = " FPS_RANGE

#define GST_VIDEO_RGB_PAD_TEMPLATE_PROPS_15 \
	    "video/x-raw-rgb, "				\
            "bpp = (int) 16, "				\
            "depth = (int) 15, "			\
            "endianness = (int) BYTE_ORDER, "		\
            "red_mask = (int) " R_MASK_15 ", "		\
            "green_mask = (int) " G_MASK_15 ", "	\
            "blue_mask = (int) " B_MASK_15 ", "		\
            "width = " SIZE_RANGE ", "			\
            "height = " SIZE_RANGE ", "			\
            "framerate = " FPS_RANGE

#define GST_VIDEO_YUV_PAD_TEMPLATE_CAPS(fourcc) \
	"video/x-raw-yuv, " \
	"format = (fourcc) " fourcc ", " \
	"width = " SIZE_RANGE ", " \
	"height = " SIZE_RANGE ", " \
	"framerate = " FPS_RANGE

/* functions */
gdouble  gst_video_frame_rate (GstPad *pad);
gboolean gst_video_get_size   (GstPad *pad,
                               gint   *width,
                               gint   *height);

#endif /* __GST_VIDEO_H__ */