1 /*
2  * Copyright (C) 2011 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 namespace android {
18 
19 /**************************************************************************
20  * Important note: the functions below are helper functions for the
21  *   implementation of the XAVideoDecoderCapabilitiesItf interface on
22  *   Android. They are ONLY exposing the "hardware" video decoders
23  *   as dynamically discovered on the platform. A hardware video decoder
24  *   is defined as one where video decoding takes advantage of a hardware-
25  *   specific feature of the platform, such as DSP or particular GPU.
26  *   "Software" decoders, such as the ones available as default implementations
27  *   in the Android tree, as not exposed here, but are rather listed in
28  *   the CDD.
29  */
30 
31 /*
32  * Initializes the list of supported video codecs, with their associated profiles and levels
33  * Return
34  *     false if it failed to list the available codecs, true otherwise
35  */
36 extern bool android_videoCodec_expose();
37 
38 /*
39  * Frees all resources associated with the listing and query of the available video codecs
40  */
41 extern void android_videoCodec_deinit();
42 
43 /*
44  * Returns the number of video codecs supported on the platform.
45  * Returns 0 if android_videoCodec_expose() hasn't been called before (and returned true)
46  */
47 extern XAuint32 android_videoCodec_getNbDecoders();
48 
49 /*
50  * Retrieve the supported decoder IDs
51  * Pre-condition
52  *    nbDecoders <= number of decoders
53  *    pDecoderIds != NULL
54  *    android_videoCodec_expose() has been called before (and returned true)
55  */
56 extern void android_videoCodec_getDecoderIds(XAuint32 nbDecoders, XAuint32 *pDecoderIds);
57 
58 /*
59  * Retrieves the number of profile / level combinations for a given codec
60  * Pre-condition
61  *    pNb != NULL
62  *    android_videoCodec_expose() has been called before (and returned true)
63  * Return
64  *    SL_RESULT_SUCCESS if the number of combinations was successfully retrieved and at least
65  *                         one profile/level is supported (*pNb > 0)
66  *    SL_RESULT_PARAMETER_INVALID otherwise
67  */
68 extern SLresult android_videoCodec_getProfileLevelCombinationNb(XAuint32 decoderId, XAuint32 *pNb);
69 
70 /*
71  * Retrieves the profile / level at index plIndex in the list of profile / level combinations
72  *    supported by the given codec
73  * Pre-condition
74  *    pDescr != NULL
75  *    android_videoCodec_expose() has been called before (and returned true)
76  * Post-condition
77  *    pDescr->codecId == decoderId
78  * Return
79  *    SL_RESULT_SUCCESS if the profile/level was successfully retrieved
80  *    SL_RESULT_PARAMETER_INVALID otherwise: invalid codec or invalid profile/level index
81  */
82 extern SLresult android_videoCodec_getProfileLevelCombination(XAuint32 decoderId,
83         XAuint32 plIndex, XAVideoCodecDescriptor *pDescr);
84 
85 }; // namespace android
86