1 /*
2  * Copyright (C) 2012, Collabora Ltd.
3  *   Author: Sebastian Dröge <sebastian.droege@collabora.co.uk>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation
8  * version 2.1 of the License.
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  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
18  *
19  */
20 
21 #ifndef __GST_AMC_CONSTANTS_H__
22 #define __GST_AMC_CONSTANTS_H__
23 
24 /* FIXME: We might need to get these values from Java if there's
25  * ever a device or Android version that changes these values
26  */
27 
28 /* Copies from MediaCodec.java */
29 
30 enum
31 {
32   BUFFER_FLAG_SYNC_FRAME = 1,
33   BUFFER_FLAG_CODEC_CONFIG = 2,
34   BUFFER_FLAG_END_OF_STREAM = 4
35 };
36 
37 enum
38 {
39   CONFIGURE_FLAG_ENCODE = 1
40 };
41 
42 enum
43 {
44   INFO_TRY_AGAIN_LATER = -1,
45   INFO_OUTPUT_FORMAT_CHANGED = -2,
46   INFO_OUTPUT_BUFFERS_CHANGED = -3
47 };
48 
49 /* Copies from MediaCodecInfo.java */
50 enum
51 {
52   COLOR_FormatMonochrome = 1,
53   COLOR_Format8bitRGB332 = 2,
54   COLOR_Format12bitRGB444 = 3,
55   COLOR_Format16bitARGB4444 = 4,
56   COLOR_Format16bitARGB1555 = 5,
57   COLOR_Format16bitRGB565 = 6,
58   COLOR_Format16bitBGR565 = 7,
59   COLOR_Format18bitRGB666 = 8,
60   COLOR_Format18bitARGB1665 = 9,
61   COLOR_Format19bitARGB1666 = 10,
62   COLOR_Format24bitRGB888 = 11,
63   COLOR_Format24bitBGR888 = 12,
64   COLOR_Format24bitARGB1887 = 13,
65   COLOR_Format25bitARGB1888 = 14,
66   COLOR_Format32bitBGRA8888 = 15,
67   COLOR_Format32bitARGB8888 = 16,
68   COLOR_FormatYUV411Planar = 17,
69   COLOR_FormatYUV411PackedPlanar = 18,
70   COLOR_FormatYUV420Planar = 19,
71   COLOR_FormatYUV420PackedPlanar = 20,
72   COLOR_FormatYUV420SemiPlanar = 21,
73   COLOR_FormatYUV422Planar = 22,
74   COLOR_FormatYUV422PackedPlanar = 23,
75   COLOR_FormatYUV422SemiPlanar = 24,
76   COLOR_FormatYCbYCr = 25,
77   COLOR_FormatYCrYCb = 26,
78   COLOR_FormatCbYCrY = 27,
79   COLOR_FormatCrYCbY = 28,
80   COLOR_FormatYUV444Interleaved = 29,
81   COLOR_FormatRawBayer8bit = 30,
82   COLOR_FormatRawBayer10bit = 31,
83   COLOR_FormatRawBayer8bitcompressed = 32,
84   COLOR_FormatL2 = 33,
85   COLOR_FormatL4 = 34,
86   COLOR_FormatL8 = 35,
87   COLOR_FormatL16 = 36,
88   COLOR_FormatL24 = 37,
89   COLOR_FormatL32 = 38,
90   COLOR_FormatYUV420PackedSemiPlanar = 39,
91   COLOR_FormatYUV422PackedSemiPlanar = 40,
92   COLOR_Format18BitBGR666 = 41,
93   COLOR_Format24BitARGB6666 = 42,
94   COLOR_Format24BitABGR6666 = 43,
95   COLOR_FormatAndroidOpaque = 0x7F000789,
96   COLOR_TI_FormatYUV420PackedSemiPlanar = 0x7f000100,
97   COLOR_INTEL_FormatYUV420PackedSemiPlanar = 0x7fa00e00,
98   COLOR_INTEL_FormatYUV420PackedSemiPlanar_Tiled = 0x7fa00f00,
99   COLOR_QCOM_FormatYUV420SemiPlanar = 0x7fa30c00,
100   COLOR_QCOM_FormatYUV420PackedSemiPlanar64x32Tile2m8ka = 0x7fa30c03,
101   /* NV12 but with stride and plane heights aligned to 32 */
102   COLOR_QCOM_FormatYVU420SemiPlanar32m = 0x7fa30c04,
103   /* NV12 but with stride and plane heights aligned to 32, Stores two images,
104    * one after the other in top-bottom layout */
105   COLOR_QCOM_FormatYVU420SemiPlanar32mMultiView = 0x7fa30c05,
106   /* From hardware/ti/omap4xxx/domx/omx_core/inc/OMX_TI_IVCommon.h */
107   COLOR_TI_FormatYUV420PackedSemiPlanarInterlaced = 0x7f000001,
108   COLOR_FormatYUV420Flexible = 0x7f420888,
109   /* This format is Exynos specific from the OMX vendor-specific
110    * numeric range, but is defined in the Android OMX headers, so
111    * we shouldn't find incompatible usage and crash horribly... right?
112    * FIXME: Not actually implemented in the video decoder, it will just error out
113    * The format seems to be equiv to V4L2_PIX_FMT_NV12MT_16X16 */
114   COLOR_OMX_SEC_FormatNV12Tiled = 0x7fc00002,
115   /* YV12: http://developer.android.com/reference/android/graphics/ImageFormat.html#YV12 */
116   COLOR_FormatYV12 = 0x32315659,
117 };
118 
119 enum
120 {
121   HEVCProfileMain    = 0x01,
122   HEVCProfileMain10  = 0x02
123 };
124 
125 enum
126 {
127   HEVCMainTierLevel1  = 0x1,
128   HEVCHighTierLevel1  = 0x2,
129   HEVCMainTierLevel2  = 0x4,
130   HEVCHighTierLevel2  = 0x8,
131   HEVCMainTierLevel21 = 0x10,
132   HEVCHighTierLevel21 = 0x20,
133   HEVCMainTierLevel3  = 0x40,
134   HEVCHighTierLevel3  = 0x80,
135   HEVCMainTierLevel31 = 0x100,
136   HEVCHighTierLevel31 = 0x200,
137   HEVCMainTierLevel4  = 0x400,
138   HEVCHighTierLevel4  = 0x800,
139   HEVCMainTierLevel41 = 0x1000,
140   HEVCHighTierLevel41 = 0x2000,
141   HEVCMainTierLevel5  = 0x4000,
142   HEVCHighTierLevel5  = 0x8000,
143   HEVCMainTierLevel51 = 0x10000,
144   HEVCHighTierLevel51 = 0x20000,
145   HEVCMainTierLevel52 = 0x40000,
146   HEVCHighTierLevel52 = 0x80000,
147   HEVCMainTierLevel6  = 0x100000,
148   HEVCHighTierLevel6  = 0x200000,
149   HEVCMainTierLevel61 = 0x400000,
150   HEVCHighTierLevel61 = 0x800000,
151   HEVCMainTierLevel62 = 0x1000000
152 };
153 
154 enum
155 {
156   AVCProfileBaseline = 0x01,
157   AVCProfileMain = 0x02,
158   AVCProfileExtended = 0x04,
159   AVCProfileHigh = 0x08,
160   AVCProfileHigh10 = 0x10,
161   AVCProfileHigh422 = 0x20,
162   AVCProfileHigh444 = 0x40
163 };
164 
165 enum
166 {
167   AVCLevel1 = 0x01,
168   AVCLevel1b = 0x02,
169   AVCLevel11 = 0x04,
170   AVCLevel12 = 0x08,
171   AVCLevel13 = 0x10,
172   AVCLevel2 = 0x20,
173   AVCLevel21 = 0x40,
174   AVCLevel22 = 0x80,
175   AVCLevel3 = 0x100,
176   AVCLevel31 = 0x200,
177   AVCLevel32 = 0x400,
178   AVCLevel4 = 0x800,
179   AVCLevel41 = 0x1000,
180   AVCLevel42 = 0x2000,
181   AVCLevel5 = 0x4000,
182   AVCLevel51 = 0x8000
183 };
184 
185 enum
186 {
187   H263ProfileBaseline = 0x01,
188   H263ProfileH320Coding = 0x02,
189   H263ProfileBackwardCompatible = 0x04,
190   H263ProfileISWV2 = 0x08,
191   H263ProfileISWV3 = 0x10,
192   H263ProfileHighCompression = 0x20,
193   H263ProfileInternet = 0x40,
194   H263ProfileInterlace = 0x80,
195   H263ProfileHighLatency = 0x100
196 };
197 
198 enum
199 {
200   H263Level10 = 0x01,
201   H263Level20 = 0x02,
202   H263Level30 = 0x04,
203   H263Level40 = 0x08,
204   H263Level45 = 0x10,
205   H263Level50 = 0x20,
206   H263Level60 = 0x40,
207   H263Level70 = 0x80
208 };
209 
210 enum
211 {
212   MPEG4ProfileSimple = 0x01,
213   MPEG4ProfileSimpleScalable = 0x02,
214   MPEG4ProfileCore = 0x04,
215   MPEG4ProfileMain = 0x08,
216   MPEG4ProfileNbit = 0x10,
217   MPEG4ProfileScalableTexture = 0x20,
218   MPEG4ProfileSimpleFace = 0x40,
219   MPEG4ProfileSimpleFBA = 0x80,
220   MPEG4ProfileBasicAnimated = 0x100,
221   MPEG4ProfileHybrid = 0x200,
222   MPEG4ProfileAdvancedRealTime = 0x400,
223   MPEG4ProfileCoreScalable = 0x800,
224   MPEG4ProfileAdvancedCoding = 0x1000,
225   MPEG4ProfileAdvancedCore = 0x2000,
226   MPEG4ProfileAdvancedScalable = 0x4000,
227   MPEG4ProfileAdvancedSimple = 0x8000
228 };
229 
230 enum
231 {
232   MPEG4Level0 = 0x01,
233   MPEG4Level0b = 0x02,
234   MPEG4Level1 = 0x04,
235   MPEG4Level2 = 0x08,
236   MPEG4Level3 = 0x10,
237   MPEG4Level4 = 0x20,
238   MPEG4Level4a = 0x40,
239   MPEG4Level5 = 0x80
240 };
241 
242 enum
243 {
244   AACObjectMain = 1,
245   AACObjectLC = 2,
246   AACObjectSSR = 3,
247   AACObjectLTP = 4,
248   AACObjectHE = 5,
249   AACObjectScalable = 6,
250   AACObjectERLC = 17,
251   AACObjectLD = 23,
252   AACObjectHE_PS = 29,
253   AACObjectELD = 39
254 };
255 
256 /* Copies from AudioFormat.java */
257 enum
258 {
259   CHANNEL_OUT_FRONT_LEFT = 0x4,
260   CHANNEL_OUT_FRONT_RIGHT = 0x8,
261   CHANNEL_OUT_FRONT_CENTER = 0x10,
262   CHANNEL_OUT_LOW_FREQUENCY = 0x20,
263   CHANNEL_OUT_BACK_LEFT = 0x40,
264   CHANNEL_OUT_BACK_RIGHT = 0x80,
265   CHANNEL_OUT_FRONT_LEFT_OF_CENTER = 0x100,
266   CHANNEL_OUT_FRONT_RIGHT_OF_CENTER = 0x200,
267   CHANNEL_OUT_BACK_CENTER = 0x400,
268   CHANNEL_OUT_SIDE_LEFT = 0x800,
269   CHANNEL_OUT_SIDE_RIGHT = 0x1000,
270   CHANNEL_OUT_TOP_CENTER = 0x2000,
271   CHANNEL_OUT_TOP_FRONT_LEFT = 0x4000,
272   CHANNEL_OUT_TOP_FRONT_CENTER = 0x8000,
273   CHANNEL_OUT_TOP_FRONT_RIGHT = 0x10000,
274   CHANNEL_OUT_TOP_BACK_LEFT = 0x20000,
275   CHANNEL_OUT_TOP_BACK_CENTER = 0x40000,
276   CHANNEL_OUT_TOP_BACK_RIGHT = 0x80000
277 };
278 
279 #endif
280