blob: 5a409fbf2f2ab90aee81372527df4ec7203ca42c [file] [log] [blame]
Byron Gardner419d3402014-08-12 15:09:23 -07001/*
2* Copyright (c) 2009-2011 Intel Corporation. All rights reserved.
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 * Copyright (C) 2009 The Android Open Source Project
18 *
19 * Licensed under the Apache License, Version 2.0 (the "License");
20 * you may not use this file except in compliance with the License.
21 * You may obtain a copy of the License at
22 *
23 * http://www.apache.org/licenses/LICENSE-2.0
24 *
25 * Unless required by applicable law or agreed to in writing, software
26 * distributed under the License is distributed on an "AS IS" BASIS,
27 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
28 * See the License for the specific language governing permissions and
29 * limitations under the License.
30 */
31
32#ifndef WRS_OMX_PLUGIN_H_
33
34#define WRS_OMX_PLUGIN_H_
35
36#include <OMXPluginBase.h>
37#include <utils/Mutex.h>
38#include <utils/Vector.h>
39
40namespace android {
41
42struct WrsOMXCore {
43 typedef OMX_ERRORTYPE (*InitFunc)();
44 typedef OMX_ERRORTYPE (*DeinitFunc)();
45 typedef OMX_ERRORTYPE (*ComponentNameEnumFunc)(
46 OMX_STRING, OMX_U32, OMX_U32);
47
48 typedef OMX_ERRORTYPE (*GetHandleFunc)(
49 OMX_HANDLETYPE *, OMX_STRING, OMX_PTR, OMX_CALLBACKTYPE *);
50
51 typedef OMX_ERRORTYPE (*FreeHandleFunc)(OMX_HANDLETYPE *);
52
53 typedef OMX_ERRORTYPE (*GetRolesOfComponentFunc)(
54 OMX_STRING, OMX_U32 *, OMX_U8 **);
55
56 void *mLibHandle;
57
58 InitFunc mInit;
59 DeinitFunc mDeinit;
60 ComponentNameEnumFunc mComponentNameEnum;
61 GetHandleFunc mGetHandle;
62 FreeHandleFunc mFreeHandle;
63 GetRolesOfComponentFunc mGetRolesOfComponentHandle;
64
65 OMX_U32 mNumComponents;
66};
67
68struct WrsOMXComponent {
69 OMX_COMPONENTTYPE *mComponent;
70 WrsOMXCore *mCore;
71};
72
73struct WrsOMXPlugin : public OMXPluginBase {
74 WrsOMXPlugin();
75 virtual ~WrsOMXPlugin();
76
77 virtual OMX_ERRORTYPE makeComponentInstance(
78 const char *name,
79 const OMX_CALLBACKTYPE *callbacks,
80 OMX_PTR appData,
81 OMX_COMPONENTTYPE **component);
82
83 virtual OMX_ERRORTYPE destroyComponentInstance(
84 OMX_COMPONENTTYPE *component);
85
86 virtual OMX_ERRORTYPE enumerateComponents(
87 OMX_STRING name,
88 size_t size,
89 OMX_U32 index);
90
91 virtual OMX_ERRORTYPE getRolesOfComponent(
92 const char *name,
93 Vector<String8> *roles);
94
95private:
96
97 Mutex mMutex; // to protect access to mComponents
98
99 Vector<WrsOMXCore*> mCores;
100 Vector<WrsOMXComponent> mComponents;
101
102 OMX_ERRORTYPE AddCore(const char* coreName);
103
104 WrsOMXPlugin(const WrsOMXPlugin &);
105 WrsOMXPlugin &operator=(const WrsOMXPlugin &);
106};
107
108} // namespace android
109
110#endif // WRS_OMX_PLUGIN_H_