1 | /* |
2 | Copyright (c) 2012, Broadcom Europe Ltd |
3 | All rights reserved. |
4 | |
5 | Redistribution and use in source and binary forms, with or without |
6 | modification, are permitted provided that the following conditions are met: |
7 | * Redistributions of source code must retain the above copyright |
8 | notice, this list of conditions and the following disclaimer. |
9 | * Redistributions in binary form must reproduce the above copyright |
10 | notice, this list of conditions and the following disclaimer in the |
11 | documentation and/or other materials provided with the distribution. |
12 | * Neither the name of the copyright holder nor the |
13 | names of its contributors may be used to endorse or promote products |
14 | derived from this software without specific prior written permission. |
15 | |
16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY |
20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ |
27 | |
28 | #ifndef MMAL_ENCODINGS_H |
29 | #define MMAL_ENCODINGS_H |
30 | |
31 | #include "mmal_common.h" |
32 | |
33 | /** \defgroup MmalEncodings List of pre-defined encodings |
34 | * This defines a list of common encodings. This list isn't exhaustive and is only |
35 | * provided as a convenience to avoid clients having to use FourCC codes directly. |
36 | * However components are allowed to define and use their own FourCC codes. */ |
37 | /* @{ */ |
38 | |
39 | /** \name Pre-defined video encodings */ |
40 | /* @{ */ |
41 | #define MMAL_ENCODING_H264 MMAL_FOURCC('H','2','6','4') |
42 | #define MMAL_ENCODING_MVC MMAL_FOURCC('M','V','C',' ') |
43 | #define MMAL_ENCODING_H263 MMAL_FOURCC('H','2','6','3') |
44 | #define MMAL_ENCODING_MP4V MMAL_FOURCC('M','P','4','V') |
45 | #define MMAL_ENCODING_MP2V MMAL_FOURCC('M','P','2','V') |
46 | #define MMAL_ENCODING_MP1V MMAL_FOURCC('M','P','1','V') |
47 | #define MMAL_ENCODING_WMV3 MMAL_FOURCC('W','M','V','3') |
48 | #define MMAL_ENCODING_WMV2 MMAL_FOURCC('W','M','V','2') |
49 | #define MMAL_ENCODING_WMV1 MMAL_FOURCC('W','M','V','1') |
50 | #define MMAL_ENCODING_WVC1 MMAL_FOURCC('W','V','C','1') |
51 | #define MMAL_ENCODING_VP8 MMAL_FOURCC('V','P','8',' ') |
52 | #define MMAL_ENCODING_VP7 MMAL_FOURCC('V','P','7',' ') |
53 | #define MMAL_ENCODING_VP6 MMAL_FOURCC('V','P','6',' ') |
54 | #define MMAL_ENCODING_THEORA MMAL_FOURCC('T','H','E','O') |
55 | #define MMAL_ENCODING_SPARK MMAL_FOURCC('S','P','R','K') |
56 | #define MMAL_ENCODING_MJPEG MMAL_FOURCC('M','J','P','G') |
57 | |
58 | #define MMAL_ENCODING_JPEG MMAL_FOURCC('J','P','E','G') |
59 | #define MMAL_ENCODING_GIF MMAL_FOURCC('G','I','F',' ') |
60 | #define MMAL_ENCODING_PNG MMAL_FOURCC('P','N','G',' ') |
61 | #define MMAL_ENCODING_PPM MMAL_FOURCC('P','P','M',' ') |
62 | #define MMAL_ENCODING_TGA MMAL_FOURCC('T','G','A',' ') |
63 | #define MMAL_ENCODING_BMP MMAL_FOURCC('B','M','P',' ') |
64 | |
65 | #define MMAL_ENCODING_I420 MMAL_FOURCC('I','4','2','0') |
66 | #define MMAL_ENCODING_I420_SLICE MMAL_FOURCC('S','4','2','0') |
67 | #define MMAL_ENCODING_YV12 MMAL_FOURCC('Y','V','1','2') |
68 | #define MMAL_ENCODING_I422 MMAL_FOURCC('I','4','2','2') |
69 | #define MMAL_ENCODING_I422_SLICE MMAL_FOURCC('S','4','2','2') |
70 | #define MMAL_ENCODING_YUYV MMAL_FOURCC('Y','U','Y','V') |
71 | #define MMAL_ENCODING_YVYU MMAL_FOURCC('Y','V','Y','U') |
72 | #define MMAL_ENCODING_UYVY MMAL_FOURCC('U','Y','V','Y') |
73 | #define MMAL_ENCODING_VYUY MMAL_FOURCC('V','Y','U','Y') |
74 | #define MMAL_ENCODING_NV12 MMAL_FOURCC('N','V','1','2') |
75 | #define MMAL_ENCODING_NV21 MMAL_FOURCC('N','V','2','1') |
76 | #define MMAL_ENCODING_ARGB MMAL_FOURCC('A','R','G','B') |
77 | #define MMAL_ENCODING_ARGB_SLICE MMAL_FOURCC('a','r','g','b') |
78 | #define MMAL_ENCODING_RGBA MMAL_FOURCC('R','G','B','A') |
79 | #define MMAL_ENCODING_RGBA_SLICE MMAL_FOURCC('r','g','b','a') |
80 | #define MMAL_ENCODING_ABGR MMAL_FOURCC('A','B','G','R') |
81 | #define MMAL_ENCODING_ABGR_SLICE MMAL_FOURCC('a','b','g','r') |
82 | #define MMAL_ENCODING_BGRA MMAL_FOURCC('B','G','R','A') |
83 | #define MMAL_ENCODING_BGRA_SLICE MMAL_FOURCC('b','g','r','a') |
84 | #define MMAL_ENCODING_RGB16 MMAL_FOURCC('R','G','B','2') |
85 | #define MMAL_ENCODING_RGB16_SLICE MMAL_FOURCC('r','g','b','2') |
86 | #define MMAL_ENCODING_RGB24 MMAL_FOURCC('R','G','B','3') |
87 | #define MMAL_ENCODING_RGB24_SLICE MMAL_FOURCC('r','g','b','3') |
88 | #define MMAL_ENCODING_RGB32 MMAL_FOURCC('R','G','B','4') |
89 | #define MMAL_ENCODING_RGB32_SLICE MMAL_FOURCC('r','g','b','4') |
90 | #define MMAL_ENCODING_BGR16 MMAL_FOURCC('B','G','R','2') |
91 | #define MMAL_ENCODING_BGR16_SLICE MMAL_FOURCC('b','g','r','2') |
92 | #define MMAL_ENCODING_BGR24 MMAL_FOURCC('B','G','R','3') |
93 | #define MMAL_ENCODING_BGR24_SLICE MMAL_FOURCC('b','g','r','3') |
94 | #define MMAL_ENCODING_BGR32 MMAL_FOURCC('B','G','R','4') |
95 | #define MMAL_ENCODING_BGR32_SLICE MMAL_FOURCC('b','g','r','4') |
96 | |
97 | /** YUV 4:2:0 planar, 16bit/component. |
98 | */ |
99 | #define MMAL_ENCODING_I420_16 MMAL_FOURCC('i','4','2','0') |
100 | /** YUV 4:2:0 planar, 10bit/component as least sig 10bits of 16 bit words. |
101 | */ |
102 | #define MMAL_ENCODING_I420_10 MMAL_FOURCC('i','4','1','0') |
103 | |
104 | /** YUV 4:2:0 planar but with U and V in side-by-side format |
105 | * So U and V have same pitch as Y, but V = U + pitch/2 |
106 | */ |
107 | #define MMAL_ENCODING_I420_S MMAL_FOURCC('I','4','2','S') |
108 | |
109 | //Bayer formats |
110 | //FourCC values copied from V4L2 where defined. |
111 | //10 bit per pixel packed Bayer formats. |
112 | #define MMAL_ENCODING_BAYER_SBGGR10P MMAL_FOURCC('p','B','A','A') //BGGR |
113 | #define MMAL_ENCODING_BAYER_SGRBG10P MMAL_FOURCC('p','g','A','A') //GRBG |
114 | #define MMAL_ENCODING_BAYER_SGBRG10P MMAL_FOURCC('p','G','A','A') //GBRG |
115 | #define MMAL_ENCODING_BAYER_SRGGB10P MMAL_FOURCC('p','R','A','A') //RGGB |
116 | |
117 | //8 bit per pixel Bayer formats. |
118 | #define MMAL_ENCODING_BAYER_SBGGR8 MMAL_FOURCC('B','A','8','1') //BGGR |
119 | #define MMAL_ENCODING_BAYER_SGBRG8 MMAL_FOURCC('G','B','R','G') //GBRG |
120 | #define MMAL_ENCODING_BAYER_SGRBG8 MMAL_FOURCC('G','R','B','G') //GRBG |
121 | #define MMAL_ENCODING_BAYER_SRGGB8 MMAL_FOURCC('R','G','G','B') //RGGB |
122 | |
123 | //12 bit per pixel Bayer formats - not defined in V4L2, only 12bit expanded to 16. |
124 | //Copy 10bpp packed 4CC pattern |
125 | #define MMAL_ENCODING_BAYER_SBGGR12P MMAL_FOURCC('p','B','1','2') //BGGR |
126 | #define MMAL_ENCODING_BAYER_SGRBG12P MMAL_FOURCC('p','g','1','2') //GRBG |
127 | #define MMAL_ENCODING_BAYER_SGBRG12P MMAL_FOURCC('p','G','1','2') //GBRG |
128 | #define MMAL_ENCODING_BAYER_SRGGB12P MMAL_FOURCC('p','R','1','2') //RGGB |
129 | |
130 | //16 bit per pixel Bayer formats. |
131 | #define MMAL_ENCODING_BAYER_SBGGR16 MMAL_FOURCC('B','G','1','6') //BGGR |
132 | #define MMAL_ENCODING_BAYER_SGBRG16 MMAL_FOURCC('G','B','1','6') //GBRG |
133 | #define MMAL_ENCODING_BAYER_SGRBG16 MMAL_FOURCC('G','R','1','6') //GRBG |
134 | #define MMAL_ENCODING_BAYER_SRGGB16 MMAL_FOURCC('R','G','1','6') //RGGB |
135 | |
136 | //10 bit per pixel DPCM compressed to 8bits Bayer formats. |
137 | #define MMAL_ENCODING_BAYER_SBGGR10DPCM8 MMAL_FOURCC('b','B','A','8') //BGGR |
138 | #define MMAL_ENCODING_BAYER_SGBRG10DPCM8 MMAL_FOURCC('b','G','A','8') //GBRG |
139 | #define MMAL_ENCODING_BAYER_SGRBG10DPCM8 MMAL_FOURCC('B','D','1','0') //GRBG |
140 | #define MMAL_ENCODING_BAYER_SRGGB10DPCM8 MMAL_FOURCC('b','R','A','8') //RGGB |
141 | |
142 | /** SAND Video (YUVUV128) format, native format understood by VideoCore. |
143 | * This format is *not* opaque - if requested you will receive full frames |
144 | * of YUV_UV video. |
145 | */ |
146 | #define MMAL_ENCODING_YUVUV128 MMAL_FOURCC('S','A','N','D') |
147 | /** HEVC codec format. YUV 420, 10bpc, arranged with 3 values packed into |
148 | * 4 bytes with 2 bits of padding. |
149 | * The image is split into columns or 128 bytes / 96 samples wide, with the |
150 | * column of luma first, followed by the column of sample interleaved chroma. |
151 | */ |
152 | #define MMAL_ENCODING_YUV10_COL MMAL_FOURCC('Y','1','0','C') |
153 | /** 16 bit SAND Video (YUVUV64_16) format. |
154 | * This format is *not* opaque - if requested you will receive full frames |
155 | * of YUV_UV_16 video. |
156 | */ |
157 | #define MMAL_ENCODING_YUVUV64_16 MMAL_FOURCC('S','A','1','6') |
158 | /** 10 bit SAND Video format, packed as least sig 10 bits of 16 bit words. |
159 | */ |
160 | #define MMAL_ENCODING_YUVUV64_10 MMAL_FOURCC('S','A','1','0') |
161 | |
162 | /** VideoCore opaque image format, image handles are returned to |
163 | * the host but not the actual image data. |
164 | */ |
165 | #define MMAL_ENCODING_OPAQUE MMAL_FOURCC('O','P','Q','V') |
166 | |
167 | /** An EGL image handle |
168 | */ |
169 | #define MMAL_ENCODING_EGL_IMAGE MMAL_FOURCC('E','G','L','I') |
170 | |
171 | /* }@ */ |
172 | |
173 | /** \name Pre-defined audio encodings */ |
174 | /* @{ */ |
175 | #define MMAL_ENCODING_PCM_UNSIGNED_BE MMAL_FOURCC('P','C','M','U') |
176 | #define MMAL_ENCODING_PCM_UNSIGNED_LE MMAL_FOURCC('p','c','m','u') |
177 | #define MMAL_ENCODING_PCM_SIGNED_BE MMAL_FOURCC('P','C','M','S') |
178 | #define MMAL_ENCODING_PCM_SIGNED_LE MMAL_FOURCC('p','c','m','s') |
179 | #define MMAL_ENCODING_PCM_FLOAT_BE MMAL_FOURCC('P','C','M','F') |
180 | #define MMAL_ENCODING_PCM_FLOAT_LE MMAL_FOURCC('p','c','m','f') |
181 | /* Defines for native endianness */ |
182 | #ifdef MMAL_IS_BIG_ENDIAN |
183 | #define MMAL_ENCODING_PCM_UNSIGNED MMAL_ENCODING_PCM_UNSIGNED_BE |
184 | #define MMAL_ENCODING_PCM_SIGNED MMAL_ENCODING_PCM_SIGNED_BE |
185 | #define MMAL_ENCODING_PCM_FLOAT MMAL_ENCODING_PCM_FLOAT_BE |
186 | #else |
187 | #define MMAL_ENCODING_PCM_UNSIGNED MMAL_ENCODING_PCM_UNSIGNED_LE |
188 | #define MMAL_ENCODING_PCM_SIGNED MMAL_ENCODING_PCM_SIGNED_LE |
189 | #define MMAL_ENCODING_PCM_FLOAT MMAL_ENCODING_PCM_FLOAT_LE |
190 | #endif |
191 | |
192 | #define MMAL_ENCODING_MP4A MMAL_FOURCC('M','P','4','A') |
193 | #define MMAL_ENCODING_MPGA MMAL_FOURCC('M','P','G','A') |
194 | #define MMAL_ENCODING_ALAW MMAL_FOURCC('A','L','A','W') |
195 | #define MMAL_ENCODING_MULAW MMAL_FOURCC('U','L','A','W') |
196 | #define MMAL_ENCODING_ADPCM_MS MMAL_FOURCC('M','S',0x0,0x2) |
197 | #define MMAL_ENCODING_ADPCM_IMA_MS MMAL_FOURCC('M','S',0x0,0x1) |
198 | #define MMAL_ENCODING_ADPCM_SWF MMAL_FOURCC('A','S','W','F') |
199 | #define MMAL_ENCODING_WMA1 MMAL_FOURCC('W','M','A','1') |
200 | #define MMAL_ENCODING_WMA2 MMAL_FOURCC('W','M','A','2') |
201 | #define MMAL_ENCODING_WMAP MMAL_FOURCC('W','M','A','P') |
202 | #define MMAL_ENCODING_WMAL MMAL_FOURCC('W','M','A','L') |
203 | #define MMAL_ENCODING_WMAV MMAL_FOURCC('W','M','A','V') |
204 | #define MMAL_ENCODING_AMRNB MMAL_FOURCC('A','M','R','N') |
205 | #define MMAL_ENCODING_AMRWB MMAL_FOURCC('A','M','R','W') |
206 | #define MMAL_ENCODING_AMRWBP MMAL_FOURCC('A','M','R','P') |
207 | #define MMAL_ENCODING_AC3 MMAL_FOURCC('A','C','3',' ') |
208 | #define MMAL_ENCODING_EAC3 MMAL_FOURCC('E','A','C','3') |
209 | #define MMAL_ENCODING_DTS MMAL_FOURCC('D','T','S',' ') |
210 | #define MMAL_ENCODING_MLP MMAL_FOURCC('M','L','P',' ') |
211 | #define MMAL_ENCODING_FLAC MMAL_FOURCC('F','L','A','C') |
212 | #define MMAL_ENCODING_VORBIS MMAL_FOURCC('V','O','R','B') |
213 | #define MMAL_ENCODING_SPEEX MMAL_FOURCC('S','P','X',' ') |
214 | #define MMAL_ENCODING_ATRAC3 MMAL_FOURCC('A','T','R','3') |
215 | #define MMAL_ENCODING_ATRACX MMAL_FOURCC('A','T','R','X') |
216 | #define MMAL_ENCODING_ATRACL MMAL_FOURCC('A','T','R','L') |
217 | #define MMAL_ENCODING_MIDI MMAL_FOURCC('M','I','D','I') |
218 | #define MMAL_ENCODING_EVRC MMAL_FOURCC('E','V','R','C') |
219 | #define MMAL_ENCODING_NELLYMOSER MMAL_FOURCC('N','E','L','Y') |
220 | #define MMAL_ENCODING_QCELP MMAL_FOURCC('Q','C','E','L') |
221 | #define MMAL_ENCODING_MP4V_DIVX_DRM MMAL_FOURCC('M','4','V','D') |
222 | /* @} */ |
223 | |
224 | /* @} MmalEncodings List */ |
225 | |
226 | /** \defgroup MmalEncodingVariants List of pre-defined encoding variants |
227 | * This defines a list of common encoding variants. This list isn't exhaustive and is only |
228 | * provided as a convenience to avoid clients having to use FourCC codes directly. |
229 | * However components are allowed to define and use their own FourCC codes. */ |
230 | /* @{ */ |
231 | |
232 | /** \name Pre-defined H264 encoding variants */ |
233 | /* @{ */ |
234 | /** ISO 14496-10 Annex B byte stream format */ |
235 | #define MMAL_ENCODING_VARIANT_H264_DEFAULT 0 |
236 | /** ISO 14496-15 AVC stream format */ |
237 | #define MMAL_ENCODING_VARIANT_H264_AVC1 MMAL_FOURCC('A','V','C','1') |
238 | /** Implicitly delineated NAL units without emulation prevention */ |
239 | #define MMAL_ENCODING_VARIANT_H264_RAW MMAL_FOURCC('R','A','W',' ') |
240 | /* @} */ |
241 | |
242 | /** \name Pre-defined MPEG4 audio encoding variants */ |
243 | /* @{ */ |
244 | /** Raw stream format */ |
245 | #define MMAL_ENCODING_VARIANT_MP4A_DEFAULT 0 |
246 | /** ADTS stream format */ |
247 | #define MMAL_ENCODING_VARIANT_MP4A_ADTS MMAL_FOURCC('A','D','T','S') |
248 | /* @} */ |
249 | |
250 | /* @} MmalEncodingVariants List */ |
251 | |
252 | /** \defgroup MmalColorSpace List of pre-defined video color spaces |
253 | * This defines a list of common color spaces. This list isn't exhaustive and is only |
254 | * provided as a convenience to avoid clients having to use FourCC codes directly. |
255 | * However components are allowed to define and use their own FourCC codes. */ |
256 | /* @{ */ |
257 | |
258 | /** Unknown color space */ |
259 | #define MMAL_COLOR_SPACE_UNKNOWN 0 |
260 | /** ITU-R BT.601-5 [SDTV] */ |
261 | #define MMAL_COLOR_SPACE_ITUR_BT601 MMAL_FOURCC('Y','6','0','1') |
262 | /** ITU-R BT.709-3 [HDTV] */ |
263 | #define MMAL_COLOR_SPACE_ITUR_BT709 MMAL_FOURCC('Y','7','0','9') |
264 | /** JPEG JFIF */ |
265 | #define MMAL_COLOR_SPACE_JPEG_JFIF MMAL_FOURCC('Y','J','F','I') |
266 | /** Title 47 Code of Federal Regulations (2003) 73.682 (a) (20) */ |
267 | #define MMAL_COLOR_SPACE_FCC MMAL_FOURCC('Y','F','C','C') |
268 | /** Society of Motion Picture and Television Engineers 240M (1999) */ |
269 | #define MMAL_COLOR_SPACE_SMPTE240M MMAL_FOURCC('Y','2','4','0') |
270 | /** ITU-R BT.470-2 System M */ |
271 | #define MMAL_COLOR_SPACE_BT470_2_M MMAL_FOURCC('Y','_','_','M') |
272 | /** ITU-R BT.470-2 System BG */ |
273 | #define MMAL_COLOR_SPACE_BT470_2_BG MMAL_FOURCC('Y','_','B','G') |
274 | /** JPEG JFIF, but with 16..255 luma */ |
275 | #define MMAL_COLOR_SPACE_JFIF_Y16_255 MMAL_FOURCC('Y','Y','1','6') |
276 | /** Rec2020 */ |
277 | #define MMAL_COLOR_SPACE_REC2020 MMAL_FOURCC('2','0','2','0') |
278 | /* @} MmalColorSpace List */ |
279 | |
280 | #endif /* MMAL_ENCODINGS_H */ |
281 | |