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 // Dual engine test
18 
19 #include <assert.h>
20 #include <stdio.h>
21 #include <stdlib.h>
22 #include <SLES/OpenSLES.h>
23 #include <OMXAL/OpenMAXAL.h>
24 
main(int argc __unused,char ** argv __unused)25 int main(int argc __unused, char **argv __unused)
26 {
27     XAresult xaResult;
28     XAObjectItf xaEngineObject;
29 
30     SLresult slResult;
31     SLObjectItf slEngineObject;
32 
33     printf("xaCreateEngine\n");
34     xaResult = xaCreateEngine(&xaEngineObject, 0, NULL, 0, NULL, NULL);
35     printf("xaResult = %d\n", xaResult);
36     assert(XA_RESULT_SUCCESS == xaResult);
37     printf("xaEngineObject = %p\n", xaEngineObject);
38 
39     printf("realize xaEngineObject\n");
40     xaResult = (*xaEngineObject)->Realize(xaEngineObject, XA_BOOLEAN_FALSE);
41     printf("xaResult = %d\n", xaResult);
42 
43     printf("GetInterface for XA_IID_ENGINE\n");
44     XAEngineItf xaEngineEngine;
45     xaResult = (*xaEngineObject)->GetInterface(xaEngineObject, XA_IID_ENGINE, &xaEngineEngine);
46     printf("xaResult = %d\n", xaResult);
47     printf("xaEngineEngine = %p\n", xaEngineEngine);
48     assert(XA_RESULT_SUCCESS == xaResult);
49 
50     printf("slCreateEngine\n");
51     slResult = slCreateEngine(&slEngineObject, 0, NULL, 0, NULL, NULL);
52     printf("slResult = %d\n", slResult);
53     assert(SL_RESULT_SUCCESS == slResult);
54     printf("slEngineObject = %p\n", slEngineObject);
55 
56     printf("realize slEngineObject\n");
57     slResult = (*slEngineObject)->Realize(slEngineObject, SL_BOOLEAN_FALSE);
58     printf("slResult = %d\n", slResult);
59 
60     printf("GetInterface for SL_IID_ENGINE\n");
61     SLEngineItf slEngineEngine;
62     slResult = (*slEngineObject)->GetInterface(slEngineObject, SL_IID_ENGINE, &slEngineEngine);
63     printf("slResult = %d\n", slResult);
64     printf("slEngineEngine = %p\n", slEngineEngine);
65     assert(SL_RESULT_SUCCESS == slResult);
66 
67     printf("destroying xaEngineObject\n");
68     (*xaEngineObject)->Destroy(xaEngineObject);
69 
70     printf("destroying slEngineObject\n");
71     (*slEngineObject)->Destroy(slEngineObject);
72 
73     printf("exit\n");
74     return EXIT_SUCCESS;
75 }
76