1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef XAOBJECTITF_H |
|
19 #define XAOBJECTITF_H |
|
20 |
|
21 #include "openmaxalwrapper.h" |
|
22 #include "xaglobals.h" |
|
23 #include "xaplatform.h" |
|
24 |
|
25 /** MACROS **/ |
|
26 |
|
27 /** TYPES **/ |
|
28 /* object-specific function pointers */ |
|
29 typedef XAresult (*xaDoRealizeImpl)(XAObjectItf self); |
|
30 typedef XAresult (*xaDoResumeImpl)(XAObjectItf self); |
|
31 typedef void (*xaFreeResourcesImpl)(XAObjectItf self); |
|
32 |
|
33 /** ENUMERATIONS **/ |
|
34 |
|
35 /** STRUCTURES **/ |
|
36 typedef struct XAObjItfMapEntry_ |
|
37 { |
|
38 XAInterfaceID iid; |
|
39 XAuint8 mapIdx; |
|
40 void *pItf; |
|
41 XAboolean locEnabled; |
|
42 XAboolean required; |
|
43 XAboolean isDynamic; |
|
44 } XAObjItfMapEntry; |
|
45 |
|
46 /* Definition of XAObjectItf implementation */ |
|
47 typedef struct XAObjectItfImpl_ |
|
48 { |
|
49 /* parent interface */ |
|
50 struct XAObjectItf_ itf; |
|
51 /* pointer to self */ |
|
52 struct XAObjectItfImpl_* self; |
|
53 |
|
54 /* variables */ |
|
55 XAint32 priority; |
|
56 XAboolean preemptable; |
|
57 XAuint32 state; |
|
58 |
|
59 /* array of available interfaces */ |
|
60 XAObjItfMapEntry *interfaceMap; |
|
61 XAuint32 interfaceCount; |
|
62 |
|
63 /* async related variables */ |
|
64 XAImplThreadHandle asyncThr; |
|
65 XAboolean asyncOngoing; |
|
66 xaObjectCallback callBack; |
|
67 void *context; |
|
68 XAObjectItf cbPtrToSelf; |
|
69 |
|
70 /* object-specific function implementation pointers */ |
|
71 /* (must be implemented by every object) */ |
|
72 xaDoRealizeImpl DoRealizeImpl; |
|
73 xaDoResumeImpl DoResumeImpl; |
|
74 xaFreeResourcesImpl FreeResourcesImpl; |
|
75 } XAObjectItfImpl; |
|
76 |
|
77 /** METHODS **/ |
|
78 |
|
79 /* Base interface XAObjectItf implementation */ |
|
80 XAresult XAObjectItfImpl_Realize(XAObjectItf self, XAboolean async); |
|
81 |
|
82 XAresult XAObjectItfImpl_Resume(XAObjectItf self, XAboolean async); |
|
83 |
|
84 XAresult XAObjectItfImpl_GetState(XAObjectItf self, XAuint32 *pState); |
|
85 |
|
86 XAresult XAObjectItfImpl_GetInterface(XAObjectItf self, |
|
87 const XAInterfaceID iid, void *pInterface); |
|
88 |
|
89 XAresult XAObjectItfImpl_RegisterCallback(XAObjectItf self, |
|
90 xaObjectCallback callback, void *pContext); |
|
91 |
|
92 void XAObjectItfImpl_AbortAsyncOperation(XAObjectItf self); |
|
93 |
|
94 void XAObjectItfImpl_Destroy(XAObjectItf self); |
|
95 |
|
96 XAresult XAObjectItfImpl_SetPriority(XAObjectItf self, XAint32 priority, |
|
97 XAboolean preemptable); |
|
98 |
|
99 XAresult XAObjectItfImpl_GetPriority(XAObjectItf self, XAint32 *pPriority, |
|
100 XAboolean *pPreemptable); |
|
101 |
|
102 XAresult XAObjectItfImpl_SetLossOfControlInterfaces(XAObjectItf self, |
|
103 XAint16 numInterfaces, XAInterfaceID *pInterfaceIDs, |
|
104 XAboolean enabled); |
|
105 |
|
106 /* XAObjectItfImpl -specific methods */ |
|
107 |
|
108 /* Allocate and initialize base object */ |
|
109 XAresult XAObjectItfImpl_Init(XAObjectItfImpl* self, XAuint32 itfCount, |
|
110 const XAInterfaceID** itfIIDs, xaDoRealizeImpl doRealizeImpl, |
|
111 xaDoResumeImpl doResumeImpl, xaFreeResourcesImpl freeResourcesImpl); |
|
112 |
|
113 /* methods for asynchronous service */ |
|
114 void* XAObjectItfImpl_AsyncRealize(void* args); |
|
115 void* XAObjectItfImpl_AsyncResume(void* args); |
|
116 |
|
117 XAObjItfMapEntry* XAObjectItfImpl_GetItfEntry(const XAObjectItf self, |
|
118 const XAInterfaceID iid); |
|
119 |
|
120 #endif /* XAOBJECTITF_H */ |
|