1/*
2 * Copyright (C) 2009 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#ifndef TI_OMX_PLUGIN_H_
18
19#define TI_OMX_PLUGIN_H_
20
21#include <OMXPluginBase.h>
22
23namespace android {
24
25struct TIOMXPlugin : public OMXPluginBase {
26    TIOMXPlugin();
27    virtual ~TIOMXPlugin();
28
29    virtual OMX_ERRORTYPE makeComponentInstance(
30            const char *name,
31            const OMX_CALLBACKTYPE *callbacks,
32            OMX_PTR appData,
33            OMX_COMPONENTTYPE **component);
34
35    virtual OMX_ERRORTYPE destroyComponentInstance(
36            OMX_COMPONENTTYPE *component);
37
38    virtual OMX_ERRORTYPE enumerateComponents(
39            OMX_STRING name,
40            size_t size,
41            OMX_U32 index);
42
43    virtual OMX_ERRORTYPE getRolesOfComponent(
44            const char *name,
45            Vector<String8> *roles);
46
47private:
48    void *mLibHandle;
49
50    typedef OMX_ERRORTYPE (*InitFunc)();
51    typedef OMX_ERRORTYPE (*DeinitFunc)();
52    typedef OMX_ERRORTYPE (*ComponentNameEnumFunc)(
53            OMX_STRING, OMX_U32, OMX_U32);
54
55    typedef OMX_ERRORTYPE (*GetHandleFunc)(
56            OMX_HANDLETYPE *, OMX_STRING, OMX_PTR, OMX_CALLBACKTYPE *);
57
58    typedef OMX_ERRORTYPE (*FreeHandleFunc)(OMX_HANDLETYPE *);
59
60    typedef OMX_ERRORTYPE (*GetRolesOfComponentFunc)(
61            OMX_STRING, OMX_U32 *, OMX_U8 **);
62
63    InitFunc mInit;
64    DeinitFunc mDeinit;
65    ComponentNameEnumFunc mComponentNameEnum;
66    GetHandleFunc mGetHandle;
67    FreeHandleFunc mFreeHandle;
68    GetRolesOfComponentFunc mGetRolesOfComponentHandle;
69
70    TIOMXPlugin(const TIOMXPlugin &);
71    TIOMXPlugin &operator=(const TIOMXPlugin &);
72};
73
74}  // namespace android
75
76#endif  // TI_OMX_PLUGIN_H_
77