fixed, c/p typo in CJNIMediaCodecInfoCodecCapabilities
[vuplus_xbmc] / xbmc / android / jni / MediaCodecInfo.cpp
1 /*
2  *      Copyright (C) 2013 Team XBMC
3  *      http://xbmc.org
4  *
5  *  This Program is free software; you can redistribute it and/or modify
6  *  it under the terms of the GNU General Public License as published by
7  *  the Free Software Foundation; either version 2, or (at your option)
8  *  any later version.
9  *
10  *  This Program 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
13  *  GNU General Public License for more details.
14  *
15  *  You should have received a copy of the GNU General Public License
16  *  along with XBMC; see the file COPYING.  If not, see
17  *  <http://www.gnu.org/licenses/>.
18  *
19  */
20
21 #include "MediaCodecInfo.h"
22
23 #include "jutils/jutils-details.hpp"
24
25 using namespace jni;
26
27 int CJNIMediaCodecInfoCodecProfileLevel::AVCProfileBaseline(0);
28 int CJNIMediaCodecInfoCodecProfileLevel::AVCProfileMain(0);
29 int CJNIMediaCodecInfoCodecProfileLevel::AVCProfileExtended(0);
30 int CJNIMediaCodecInfoCodecProfileLevel::AVCProfileHigh(0);
31 int CJNIMediaCodecInfoCodecProfileLevel::AVCProfileHigh10(0);
32 int CJNIMediaCodecInfoCodecProfileLevel::AVCProfileHigh422(0);
33 int CJNIMediaCodecInfoCodecProfileLevel::AVCProfileHigh444(0);
34 int CJNIMediaCodecInfoCodecProfileLevel::AVCLevel1(0);
35 int CJNIMediaCodecInfoCodecProfileLevel::AVCLevel1b(0);
36 int CJNIMediaCodecInfoCodecProfileLevel::AVCLevel11(0);
37 int CJNIMediaCodecInfoCodecProfileLevel::AVCLevel12(0);
38 int CJNIMediaCodecInfoCodecProfileLevel::AVCLevel13(0);
39 int CJNIMediaCodecInfoCodecProfileLevel::AVCLevel2(0);
40 int CJNIMediaCodecInfoCodecProfileLevel::AVCLevel21(0);
41 int CJNIMediaCodecInfoCodecProfileLevel::AVCLevel22(0);
42 int CJNIMediaCodecInfoCodecProfileLevel::AVCLevel3(0);
43 int CJNIMediaCodecInfoCodecProfileLevel::AVCLevel31(0);
44 int CJNIMediaCodecInfoCodecProfileLevel::AVCLevel32(0);
45 int CJNIMediaCodecInfoCodecProfileLevel::AVCLevel4(0);
46 int CJNIMediaCodecInfoCodecProfileLevel::AVCLevel41(0);
47 int CJNIMediaCodecInfoCodecProfileLevel::AVCLevel42(0);
48 int CJNIMediaCodecInfoCodecProfileLevel::AVCLevel5(0);
49 int CJNIMediaCodecInfoCodecProfileLevel::AVCLevel51(0);
50 int CJNIMediaCodecInfoCodecProfileLevel::H263ProfileBaseline(0);
51 int CJNIMediaCodecInfoCodecProfileLevel::H263ProfileH320Coding(0);
52 int CJNIMediaCodecInfoCodecProfileLevel::H263ProfileBackwardCompatible(0);
53 int CJNIMediaCodecInfoCodecProfileLevel::H263ProfileISWV2(0);
54 int CJNIMediaCodecInfoCodecProfileLevel::H263ProfileISWV3(0);
55 int CJNIMediaCodecInfoCodecProfileLevel::H263ProfileHighCompression(0);
56 int CJNIMediaCodecInfoCodecProfileLevel::H263ProfileInternet(0);
57 int CJNIMediaCodecInfoCodecProfileLevel::H263ProfileInterlace(0);
58 int CJNIMediaCodecInfoCodecProfileLevel::H263ProfileHighLatency(0);
59 int CJNIMediaCodecInfoCodecProfileLevel::H263Level10(0);
60 int CJNIMediaCodecInfoCodecProfileLevel::H263Level20(0);
61 int CJNIMediaCodecInfoCodecProfileLevel::H263Level30(0);
62 int CJNIMediaCodecInfoCodecProfileLevel::H263Level40(0);
63 int CJNIMediaCodecInfoCodecProfileLevel::H263Level45(0);
64 int CJNIMediaCodecInfoCodecProfileLevel::H263Level50(0);
65 int CJNIMediaCodecInfoCodecProfileLevel::H263Level60(0);
66 int CJNIMediaCodecInfoCodecProfileLevel::H263Level70(0);
67 int CJNIMediaCodecInfoCodecProfileLevel::MPEG4ProfileSimple(0);
68 int CJNIMediaCodecInfoCodecProfileLevel::MPEG4ProfileSimpleScalable(0);
69 int CJNIMediaCodecInfoCodecProfileLevel::MPEG4ProfileCore(0);
70 int CJNIMediaCodecInfoCodecProfileLevel::MPEG4ProfileMain(0);
71 int CJNIMediaCodecInfoCodecProfileLevel::MPEG4ProfileNbit(0);
72 int CJNIMediaCodecInfoCodecProfileLevel::MPEG4ProfileScalableTexture(0);
73 int CJNIMediaCodecInfoCodecProfileLevel::MPEG4ProfileSimpleFace(0);
74 int CJNIMediaCodecInfoCodecProfileLevel::MPEG4ProfileSimpleFBA(0);
75 int CJNIMediaCodecInfoCodecProfileLevel::MPEG4ProfileBasicAnimated(0);
76 int CJNIMediaCodecInfoCodecProfileLevel::MPEG4ProfileHybrid(0);
77 int CJNIMediaCodecInfoCodecProfileLevel::MPEG4ProfileAdvancedRealTime(0);
78 int CJNIMediaCodecInfoCodecProfileLevel::MPEG4ProfileCoreScalable(0);
79 int CJNIMediaCodecInfoCodecProfileLevel::MPEG4ProfileAdvancedCoding(0);
80 int CJNIMediaCodecInfoCodecProfileLevel::MPEG4ProfileAdvancedCore(0);
81 int CJNIMediaCodecInfoCodecProfileLevel::MPEG4ProfileAdvancedScalable(0);
82 int CJNIMediaCodecInfoCodecProfileLevel::MPEG4ProfileAdvancedSimple(0);
83 int CJNIMediaCodecInfoCodecProfileLevel::MPEG4Level0(0);
84 int CJNIMediaCodecInfoCodecProfileLevel::MPEG4Level0b(0);
85 int CJNIMediaCodecInfoCodecProfileLevel::MPEG4Level1(0);
86 int CJNIMediaCodecInfoCodecProfileLevel::MPEG4Level2(0);
87 int CJNIMediaCodecInfoCodecProfileLevel::MPEG4Level3(0);
88 int CJNIMediaCodecInfoCodecProfileLevel::MPEG4Level4(0);
89 int CJNIMediaCodecInfoCodecProfileLevel::MPEG4Level4a(0);
90 int CJNIMediaCodecInfoCodecProfileLevel::MPEG4Level5(0);
91 int CJNIMediaCodecInfoCodecProfileLevel::AACObjectMain(0);
92 int CJNIMediaCodecInfoCodecProfileLevel::AACObjectLC(0);
93 int CJNIMediaCodecInfoCodecProfileLevel::AACObjectSSR(0);
94 int CJNIMediaCodecInfoCodecProfileLevel::AACObjectLTP(0);
95 int CJNIMediaCodecInfoCodecProfileLevel::AACObjectHE(0);
96 int CJNIMediaCodecInfoCodecProfileLevel::AACObjectScalable(0);
97 int CJNIMediaCodecInfoCodecProfileLevel::AACObjectERLC(0);
98 int CJNIMediaCodecInfoCodecProfileLevel::AACObjectLD(0);
99 int CJNIMediaCodecInfoCodecProfileLevel::AACObjectHE_PS(0);
100 int CJNIMediaCodecInfoCodecProfileLevel::AACObjectELD(0);
101 const char *CJNIMediaCodecInfoCodecProfileLevel::m_classname = "android/media/MediaCodecInfo$CodecProfileLevel";
102
103 void CJNIMediaCodecInfoCodecProfileLevel::PopulateStaticFields()
104 {
105   if(GetSDKVersion() >= 16)
106   {
107     jhclass clazz = find_class(m_classname);
108     AVCProfileBaseline          = (get_static_field<int>(clazz, "AVCProfileBaseline"));
109     AVCProfileMain              = (get_static_field<int>(clazz, "AVCProfileMain"));
110     AVCProfileExtended          = (get_static_field<int>(clazz, "AVCProfileExtended"));
111     AVCProfileHigh              = (get_static_field<int>(clazz, "AVCProfileHigh"));
112     AVCProfileHigh10            = (get_static_field<int>(clazz, "AVCProfileHigh10"));
113     AVCProfileHigh422           = (get_static_field<int>(clazz, "AVCProfileHigh422"));
114     AVCProfileHigh444           = (get_static_field<int>(clazz, "AVCProfileHigh444"));
115     AVCLevel1                   = (get_static_field<int>(clazz, "AVCLevel1"));
116     AVCLevel1b                  = (get_static_field<int>(clazz, "AVCLevel1b"));
117     AVCLevel11                  = (get_static_field<int>(clazz, "AVCLevel11"));
118     AVCLevel12                  = (get_static_field<int>(clazz, "AVCLevel12"));
119     AVCLevel13                  = (get_static_field<int>(clazz, "AVCLevel13"));
120     AVCLevel2                   = (get_static_field<int>(clazz, "AVCLevel2"));
121     AVCLevel21                  = (get_static_field<int>(clazz, "AVCLevel21"));
122     AVCLevel22                  = (get_static_field<int>(clazz, "AVCLevel22"));
123     AVCLevel3                   = (get_static_field<int>(clazz, "AVCLevel3"));
124     AVCLevel31                  = (get_static_field<int>(clazz, "AVCLevel31"));
125     AVCLevel32                  = (get_static_field<int>(clazz, "AVCLevel32"));
126     AVCLevel4                   = (get_static_field<int>(clazz, "AVCLevel4"));
127     AVCLevel41                  = (get_static_field<int>(clazz, "AVCLevel41"));
128     AVCLevel42                  = (get_static_field<int>(clazz, "AVCLevel42"));
129     AVCLevel5                   = (get_static_field<int>(clazz, "AVCLevel5"));
130     AVCLevel51                  = (get_static_field<int>(clazz, "AVCLevel51"));
131     H263ProfileBaseline         = (get_static_field<int>(clazz, "H263ProfileBaseline"));
132     H263ProfileH320Coding       = (get_static_field<int>(clazz, "H263ProfileH320Coding"));
133     H263ProfileBackwardCompatible = (get_static_field<int>(clazz, "H263ProfileBackwardCompatible"));
134     H263ProfileISWV2            = (get_static_field<int>(clazz, "H263ProfileISWV2"));
135     H263ProfileISWV3            = (get_static_field<int>(clazz, "H263ProfileISWV3"));
136     H263ProfileHighCompression  = (get_static_field<int>(clazz, "H263ProfileHighCompression"));
137     H263ProfileInternet         = (get_static_field<int>(clazz, "H263ProfileInternet"));
138     H263ProfileInterlace        = (get_static_field<int>(clazz, "H263ProfileInterlace"));
139     H263ProfileHighLatency      = (get_static_field<int>(clazz, "H263ProfileHighLatency"));
140     H263Level10                 = (get_static_field<int>(clazz, "H263Level10"));
141     H263Level20                 = (get_static_field<int>(clazz, "H263Level20"));
142     H263Level30                 = (get_static_field<int>(clazz, "H263Level30"));
143     H263Level40                 = (get_static_field<int>(clazz, "H263Level40"));
144     H263Level45                 = (get_static_field<int>(clazz, "H263Level45"));
145     H263Level50                 = (get_static_field<int>(clazz, "H263Level50"));
146     H263Level60                 = (get_static_field<int>(clazz, "H263Level60"));
147     H263Level70                 = (get_static_field<int>(clazz, "H263Level70"));
148     MPEG4ProfileSimple          = (get_static_field<int>(clazz, "MPEG4ProfileSimple"));
149     MPEG4ProfileSimpleScalable  = (get_static_field<int>(clazz, "MPEG4ProfileSimpleScalable"));
150     MPEG4ProfileCore            = (get_static_field<int>(clazz, "MPEG4ProfileCore"));
151     MPEG4ProfileMain            = (get_static_field<int>(clazz, "MPEG4ProfileMain"));
152     MPEG4ProfileNbit            = (get_static_field<int>(clazz, "MPEG4ProfileNbit"));
153     MPEG4ProfileScalableTexture = (get_static_field<int>(clazz, "MPEG4ProfileScalableTexture"));
154     MPEG4ProfileSimpleFace      = (get_static_field<int>(clazz, "MPEG4ProfileSimpleFace"));
155     MPEG4ProfileSimpleFBA       = (get_static_field<int>(clazz, "MPEG4ProfileSimpleFBA"));
156     MPEG4ProfileBasicAnimated   = (get_static_field<int>(clazz, "MPEG4ProfileBasicAnimated"));
157     MPEG4ProfileHybrid          = (get_static_field<int>(clazz, "MPEG4ProfileHybrid"));
158     MPEG4ProfileAdvancedRealTime = (get_static_field<int>(clazz, "MPEG4ProfileAdvancedRealTime"));
159     MPEG4ProfileCoreScalable    = (get_static_field<int>(clazz, "MPEG4ProfileCoreScalable"));
160     MPEG4ProfileAdvancedCoding  = (get_static_field<int>(clazz, "MPEG4ProfileAdvancedCoding"));
161     MPEG4ProfileAdvancedCore    = (get_static_field<int>(clazz, "MPEG4ProfileAdvancedCore"));
162     MPEG4ProfileAdvancedScalable= (get_static_field<int>(clazz, "MPEG4ProfileAdvancedScalable"));
163     MPEG4ProfileAdvancedSimple  = (get_static_field<int>(clazz, "MPEG4ProfileAdvancedSimple"));
164     MPEG4Level0                 = (get_static_field<int>(clazz, "MPEG4Level0"));
165     MPEG4Level0b                = (get_static_field<int>(clazz, "MPEG4Level0b"));
166     MPEG4Level1                 = (get_static_field<int>(clazz, "MPEG4Level1"));
167     MPEG4Level2                 = (get_static_field<int>(clazz, "MPEG4Level2"));
168     MPEG4Level3                 = (get_static_field<int>(clazz, "MPEG4Level3"));
169     MPEG4Level4                 = (get_static_field<int>(clazz, "MPEG4Level4"));
170     MPEG4Level4a                = (get_static_field<int>(clazz, "MPEG4Level4a"));
171     MPEG4Level5                 = (get_static_field<int>(clazz, "MPEG4Level5"));
172     AACObjectMain               = (get_static_field<int>(clazz, "AACObjectMain"));
173     AACObjectLC                 = (get_static_field<int>(clazz, "AACObjectLC"));
174     AACObjectSSR                = (get_static_field<int>(clazz, "AACObjectSSR"));
175     AACObjectLTP                = (get_static_field<int>(clazz, "AACObjectLTP"));
176     AACObjectHE                 = (get_static_field<int>(clazz, "AACObjectHE"));
177     AACObjectScalable           = (get_static_field<int>(clazz, "AACObjectScalable"));
178     AACObjectERLC               = (get_static_field<int>(clazz, "AACObjectERLC"));
179     AACObjectLD                 = (get_static_field<int>(clazz, "AACObjectLD"));
180     AACObjectHE_PS              = (get_static_field<int>(clazz, "AACObjectHE_PS"));
181     AACObjectELD                = (get_static_field<int>(clazz, "AACObjectELD"));
182   }
183 }
184
185 int CJNIMediaCodecInfoCodecProfileLevel::profile() const
186 {
187   return get_field<int>(m_object, "profile");
188 }
189
190 int CJNIMediaCodecInfoCodecProfileLevel::level() const
191 {
192   return get_field<int>(m_object, "level");
193 }
194
195 /**********************************************************************************/
196 /**********************************************************************************/
197 int CJNIMediaCodecInfoCodecCapabilities::COLOR_FormatMonochrome(0);
198 int CJNIMediaCodecInfoCodecCapabilities::COLOR_Format8bitRGB332(0);
199 int CJNIMediaCodecInfoCodecCapabilities::COLOR_Format12bitRGB444(0);
200 int CJNIMediaCodecInfoCodecCapabilities::COLOR_Format16bitARGB4444(0);
201 int CJNIMediaCodecInfoCodecCapabilities::COLOR_Format16bitARGB1555(0);
202 int CJNIMediaCodecInfoCodecCapabilities::COLOR_Format16bitRGB565(0);
203 int CJNIMediaCodecInfoCodecCapabilities::COLOR_Format16bitBGR565(0);
204 int CJNIMediaCodecInfoCodecCapabilities::COLOR_Format18bitRGB666(0);
205 int CJNIMediaCodecInfoCodecCapabilities::COLOR_Format18bitARGB1665(0);
206 int CJNIMediaCodecInfoCodecCapabilities::COLOR_Format19bitARGB1666(0);
207 int CJNIMediaCodecInfoCodecCapabilities::COLOR_Format24bitRGB888(0);
208 int CJNIMediaCodecInfoCodecCapabilities::COLOR_Format24bitBGR888(0);
209 int CJNIMediaCodecInfoCodecCapabilities::COLOR_Format24bitARGB1887(0);
210 int CJNIMediaCodecInfoCodecCapabilities::COLOR_Format25bitARGB1888(0);
211 int CJNIMediaCodecInfoCodecCapabilities::COLOR_Format32bitBGRA8888(0);
212 int CJNIMediaCodecInfoCodecCapabilities::COLOR_Format32bitARGB8888(0);
213 int CJNIMediaCodecInfoCodecCapabilities::COLOR_FormatYUV411Planar(0);
214 int CJNIMediaCodecInfoCodecCapabilities::COLOR_FormatYUV411PackedPlanar(0);
215 int CJNIMediaCodecInfoCodecCapabilities::COLOR_FormatYUV420Planar(0);
216 int CJNIMediaCodecInfoCodecCapabilities::COLOR_FormatYUV420PackedPlanar(0);
217 int CJNIMediaCodecInfoCodecCapabilities::COLOR_FormatYUV420SemiPlanar(0);
218 int CJNIMediaCodecInfoCodecCapabilities::COLOR_FormatYUV422Planar(0);
219 int CJNIMediaCodecInfoCodecCapabilities::COLOR_FormatYUV422PackedPlanar(0);
220 int CJNIMediaCodecInfoCodecCapabilities::COLOR_FormatYUV422SemiPlanar(0);
221 int CJNIMediaCodecInfoCodecCapabilities::COLOR_FormatYCbYCr(0);
222 int CJNIMediaCodecInfoCodecCapabilities::COLOR_FormatYCrYCb(0);
223 int CJNIMediaCodecInfoCodecCapabilities::COLOR_FormatCbYCrY(0);
224 int CJNIMediaCodecInfoCodecCapabilities::COLOR_FormatCrYCbY(0);
225 int CJNIMediaCodecInfoCodecCapabilities::COLOR_FormatYUV444Interleaved(0);
226 int CJNIMediaCodecInfoCodecCapabilities::COLOR_FormatRawBayer8bit(0);
227 int CJNIMediaCodecInfoCodecCapabilities::COLOR_FormatRawBayer10bit(0);
228 int CJNIMediaCodecInfoCodecCapabilities::COLOR_FormatRawBayer8bitcompressed(0);
229 int CJNIMediaCodecInfoCodecCapabilities::COLOR_FormatL2(0);
230 int CJNIMediaCodecInfoCodecCapabilities::COLOR_FormatL4(0);
231 int CJNIMediaCodecInfoCodecCapabilities::COLOR_FormatL8(0);
232 int CJNIMediaCodecInfoCodecCapabilities::COLOR_FormatL16(0);
233 int CJNIMediaCodecInfoCodecCapabilities::COLOR_FormatL24(0);
234 int CJNIMediaCodecInfoCodecCapabilities::COLOR_FormatL32(0);
235 int CJNIMediaCodecInfoCodecCapabilities::COLOR_FormatYUV420PackedSemiPlanar(0);
236 int CJNIMediaCodecInfoCodecCapabilities::COLOR_FormatYUV422PackedSemiPlanar(0);
237 int CJNIMediaCodecInfoCodecCapabilities::COLOR_Format18BitBGR666(0);
238 int CJNIMediaCodecInfoCodecCapabilities::COLOR_Format24BitARGB6666(0);
239 int CJNIMediaCodecInfoCodecCapabilities::COLOR_Format24BitABGR6666(0);
240 int CJNIMediaCodecInfoCodecCapabilities::COLOR_TI_FormatYUV420PackedSemiPlanar(0);
241 int CJNIMediaCodecInfoCodecCapabilities::COLOR_QCOM_FormatYUV420SemiPlanar(0);
242 const char *CJNIMediaCodecInfoCodecCapabilities::m_classname = "android/media/MediaCodecInfo$CodecCapabilities";
243
244 void CJNIMediaCodecInfoCodecCapabilities::PopulateStaticFields()
245 {
246   if(GetSDKVersion() >= 16)
247   {
248     jhclass clazz = find_class(m_classname);
249     COLOR_FormatMonochrome            = (get_static_field<int>(clazz, "COLOR_FormatMonochrome"));
250     COLOR_Format8bitRGB332            = (get_static_field<int>(clazz, "COLOR_Format8bitRGB332"));
251     COLOR_Format12bitRGB444           = (get_static_field<int>(clazz, "COLOR_Format12bitRGB444"));
252     COLOR_Format16bitARGB4444         = (get_static_field<int>(clazz, "COLOR_Format16bitARGB4444"));
253     COLOR_Format16bitARGB1555         = (get_static_field<int>(clazz, "COLOR_Format16bitARGB1555"));
254     COLOR_Format16bitRGB565           = (get_static_field<int>(clazz, "COLOR_Format16bitRGB565"));
255     COLOR_Format16bitBGR565           = (get_static_field<int>(clazz, "COLOR_Format16bitBGR565"));
256     COLOR_Format18bitRGB666           = (get_static_field<int>(clazz, "COLOR_Format18bitRGB666"));
257     COLOR_Format18bitARGB1665         = (get_static_field<int>(clazz, "COLOR_Format18bitARGB1665"));
258     COLOR_Format19bitARGB1666         = (get_static_field<int>(clazz, "COLOR_Format19bitARGB1666"));
259     COLOR_Format24bitRGB888           = (get_static_field<int>(clazz, "COLOR_Format24bitRGB888"));
260     COLOR_Format24bitBGR888           = (get_static_field<int>(clazz, "COLOR_Format24bitBGR888"));
261     COLOR_Format24bitARGB1887         = (get_static_field<int>(clazz, "COLOR_Format24bitARGB1887"));
262     COLOR_Format25bitARGB1888         = (get_static_field<int>(clazz, "COLOR_Format25bitARGB1888"));
263     COLOR_Format32bitBGRA8888         = (get_static_field<int>(clazz, "COLOR_Format32bitBGRA8888"));
264     COLOR_Format32bitARGB8888         = (get_static_field<int>(clazz, "COLOR_Format32bitARGB8888"));
265     COLOR_FormatYUV411Planar          = (get_static_field<int>(clazz, "COLOR_FormatYUV411Planar"));
266     COLOR_FormatYUV411PackedPlanar    = (get_static_field<int>(clazz, "COLOR_FormatYUV411PackedPlanar"));
267     COLOR_FormatYUV420Planar          = (get_static_field<int>(clazz, "COLOR_FormatYUV420Planar"));
268     COLOR_FormatYUV420PackedPlanar    = (get_static_field<int>(clazz, "COLOR_FormatYUV420PackedPlanar"));
269     COLOR_FormatYUV420SemiPlanar      = (get_static_field<int>(clazz, "COLOR_FormatYUV420SemiPlanar"));
270     COLOR_FormatYUV422Planar          = (get_static_field<int>(clazz, "COLOR_FormatYUV422Planar"));
271     COLOR_FormatYUV422PackedPlanar    = (get_static_field<int>(clazz, "COLOR_FormatYUV422PackedPlanar"));
272     COLOR_FormatYUV422SemiPlanar      = (get_static_field<int>(clazz, "COLOR_FormatYUV422SemiPlanar"));
273     COLOR_FormatYCbYCr                = (get_static_field<int>(clazz, "COLOR_FormatYCbYCr"));
274     COLOR_FormatYCrYCb                = (get_static_field<int>(clazz, "COLOR_FormatYCrYCb"));
275     COLOR_FormatCbYCrY                = (get_static_field<int>(clazz, "COLOR_FormatCbYCrY"));
276     COLOR_FormatCrYCbY                = (get_static_field<int>(clazz, "COLOR_FormatCrYCbY"));
277     COLOR_FormatYUV444Interleaved     = (get_static_field<int>(clazz, "COLOR_FormatYUV444Interleaved"));
278     COLOR_FormatRawBayer8bit          = (get_static_field<int>(clazz, "COLOR_FormatRawBayer8bit"));
279     COLOR_FormatRawBayer10bit         = (get_static_field<int>(clazz, "COLOR_FormatRawBayer10bit"));
280     COLOR_FormatRawBayer8bitcompressed= (get_static_field<int>(clazz, "COLOR_FormatRawBayer8bitcompressed"));
281     COLOR_FormatL2                    = (get_static_field<int>(clazz, "COLOR_FormatL2"));
282     COLOR_FormatL4                    = (get_static_field<int>(clazz, "COLOR_FormatL4"));
283     COLOR_FormatL8                    = (get_static_field<int>(clazz, "COLOR_FormatL8"));
284     COLOR_FormatL16                   = (get_static_field<int>(clazz, "COLOR_FormatL16"));
285     COLOR_FormatL24                   = (get_static_field<int>(clazz, "COLOR_FormatL24"));
286     COLOR_FormatL32                   = (get_static_field<int>(clazz, "COLOR_FormatL32"));
287     COLOR_FormatYUV420PackedSemiPlanar= (get_static_field<int>(clazz, "COLOR_FormatYUV420PackedSemiPlanar"));
288     COLOR_FormatYUV422PackedSemiPlanar= (get_static_field<int>(clazz, "COLOR_FormatYUV422PackedSemiPlanar"));
289     COLOR_Format18BitBGR666           = (get_static_field<int>(clazz, "COLOR_Format18BitBGR666"));
290     COLOR_Format24BitARGB6666         = (get_static_field<int>(clazz, "COLOR_Format24BitARGB6666"));
291     COLOR_Format24BitABGR6666         = (get_static_field<int>(clazz, "COLOR_Format24BitABGR6666"));
292     COLOR_TI_FormatYUV420PackedSemiPlanar = (get_static_field<int>(clazz, "COLOR_TI_FormatYUV420PackedSemiPlanar"));
293     COLOR_QCOM_FormatYUV420SemiPlanar = (get_static_field<int>(clazz, "COLOR_QCOM_FormatYUV420SemiPlanar"));
294   }
295 }
296
297 std::vector<int> CJNIMediaCodecInfoCodecCapabilities::colorFormats() const
298 {
299   JNIEnv *env = xbmc_jnienv();
300
301   jhintArray colorFormats = get_field<jhintArray>(m_object, "colorFormats");
302   jsize size = env->GetArrayLength(colorFormats.get());
303   std::vector<int> intarray;
304   intarray.resize(size);
305   env->GetIntArrayRegion(colorFormats.get(), 0, size, (jint*)intarray.data());
306
307   return intarray;
308 }
309
310 std::vector<CJNIMediaCodecInfoCodecProfileLevel> CJNIMediaCodecInfoCodecCapabilities::profileLevels() const
311 {
312   JNIEnv *env = xbmc_jnienv();
313
314   jhobjectArray oprofileLevels = get_field<jhobjectArray>(m_object, "profileLevels");
315   jsize size = env->GetArrayLength(oprofileLevels.get());
316   std::vector<CJNIMediaCodecInfoCodecProfileLevel> profileLevels;
317   profileLevels.reserve(size);
318   for (int i = 0; i < size; i++)
319     profileLevels.push_back(CJNIMediaCodecInfoCodecProfileLevel(jhobject(env->GetObjectArrayElement(oprofileLevels.get(), i))));
320
321   return profileLevels;
322 }
323
324 /**********************************************************************************/
325 /**********************************************************************************/
326 std::string CJNIMediaCodecInfo::getName() const
327 {
328   return jcast<std::string>(call_method<jhstring>(m_object,
329     "getName", "()Ljava/lang/String;"));
330 }
331
332 bool CJNIMediaCodecInfo::isEncoder() const
333 {
334   return call_method<jboolean>(m_object,
335     "isEncoder", "()Z");
336 }
337
338 std::vector<std::string> CJNIMediaCodecInfo::getSupportedTypes() const
339 {
340   return jcast<std::vector<std::string>>(call_method<jhobjectArray>(m_object,
341     "getSupportedTypes", "()[Ljava/lang/String;"));
342 }
343
344 const CJNIMediaCodecInfoCodecCapabilities CJNIMediaCodecInfo::getCapabilitiesForType(const std::string &type) const
345 {
346   return call_method<jhobject>(m_object,
347     "getCapabilitiesForType", "(Ljava/lang/String;)Landroid/media/MediaCodecInfo$CodecCapabilities;",
348     jcast<jhstring>(type));
349 }