First public contribution.
1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
20 OMX_ERRORTYPE OMXComponentGetComponentVersion(
21 OMX_IN OMX_HANDLETYPE hComponent,
22 OMX_OUT OMX_STRING pComponentName,
23 OMX_OUT OMX_VERSIONTYPE* pComponentVersion,
24 OMX_OUT OMX_VERSIONTYPE* pSpecVersion,
25 OMX_OUT OMX_UUIDTYPE* pComponentUUID);
26 OMX_ERRORTYPE OMXComponentSendCommand(
27 OMX_IN OMX_HANDLETYPE hComponent,
28 OMX_IN OMX_COMMANDTYPE Cmd,
29 OMX_IN OMX_U32 nParam1,
30 OMX_IN OMX_PTR pCmdData);
31 OMX_ERRORTYPE OMXComponentGetParameter(
32 OMX_IN OMX_HANDLETYPE hComponent,
33 OMX_IN OMX_INDEXTYPE nParamIndex,
34 OMX_INOUT OMX_PTR ComponentParameterStructure);
35 OMX_ERRORTYPE OMXComponentSetParameter(
36 OMX_IN OMX_HANDLETYPE hComponent,
37 OMX_IN OMX_INDEXTYPE nIndex,
38 OMX_IN OMX_PTR ComponentParameterStructure);
39 OMX_ERRORTYPE OMXComponentGetConfig(
40 OMX_IN OMX_HANDLETYPE hComponent,
41 OMX_IN OMX_INDEXTYPE nIndex,
42 OMX_INOUT OMX_PTR value);
43 OMX_ERRORTYPE OMXComponentSetConfig(
44 OMX_IN OMX_HANDLETYPE hComponent,
45 OMX_IN OMX_INDEXTYPE nIndex,
46 OMX_IN OMX_PTR value);
47 OMX_ERRORTYPE OMXComponentGetExtensionIndex(
48 OMX_IN OMX_HANDLETYPE hComponent,
49 OMX_IN OMX_STRING ParameterName,
50 OMX_OUT OMX_INDEXTYPE* pIndexType);
51 OMX_ERRORTYPE OMXComponentGetState(
52 OMX_IN OMX_HANDLETYPE hComponent,
53 OMX_OUT OMX_STATETYPE* pState);
54 OMX_ERRORTYPE OMXComponentComponentTunnelRequest(
55 OMX_IN OMX_HANDLETYPE hInput,
56 OMX_IN OMX_U32 nPortInput,
57 OMX_IN OMX_HANDLETYPE hOutput,
58 OMX_IN OMX_U32 nPortOutput,
59 OMX_IN OMX_TUNNELSETUPTYPE* pTunnelSetup);
60 OMX_ERRORTYPE OMXComponentUseBuffer(
61 OMX_IN OMX_HANDLETYPE hComponent,
62 OMX_INOUT OMX_BUFFERHEADERTYPE** ppBufferHdr,
63 OMX_IN OMX_U32 nPortIndex,
64 OMX_IN OMX_PTR pAppPrivate,
65 OMX_IN OMX_U32 nSizeBytes,
66 OMX_IN OMX_U8* pBuffer);
67 OMX_ERRORTYPE OMXComponentAllocateBuffer(
68 OMX_IN OMX_HANDLETYPE hComponent,
69 OMX_INOUT OMX_BUFFERHEADERTYPE** pBuffer,
70 OMX_IN OMX_U32 nPortIndex,
71 OMX_IN OMX_PTR pAppData,
72 OMX_IN OMX_U32 nSizeBytes);
73 OMX_ERRORTYPE OMXComponentFreeBuffer(
74 OMX_IN OMX_HANDLETYPE hComponent,
75 OMX_IN OMX_U32 nPortIndex,
76 OMX_IN OMX_BUFFERHEADERTYPE* pBuffer);
77 OMX_ERRORTYPE OMXComponentEmptyThisBuffer(
78 OMX_IN OMX_HANDLETYPE hComponent,
79 OMX_IN OMX_BUFFERHEADERTYPE* pBuffer);
80 OMX_ERRORTYPE OMXComponentFillThisBuffer(
81 OMX_IN OMX_HANDLETYPE hComponent,
82 OMX_IN OMX_BUFFERHEADERTYPE* pBuffer);
83 OMX_ERRORTYPE OMXComponentSetCallbacks(
84 OMX_IN OMX_HANDLETYPE hComponent,
85 OMX_IN OMX_CALLBACKTYPE* pCallbacks,
86 OMX_IN OMX_PTR pAppData);
87 OMX_ERRORTYPE OMXComponentDeInit(OMX_IN OMX_HANDLETYPE hComponent);
90 void EventHandler(OMX_OUT OMX_HANDLETYPE hComponent,
91 OMX_OUT OMX_PTR pAppData,
92 OMX_OUT OMX_EVENTTYPE eEvent,
94 OMX_OUT OMX_STRING cExtraInfo);
96 void InputBufferCallback(
97 OMX_OUT OMX_HANDLETYPE hComponent,
98 OMX_OUT OMX_PTR pAppData,
99 OMX_OUT OMX_BUFFERHEADERTYPE* pBuffer);
101 void OutputBufferCallback(
102 OMX_OUT OMX_HANDLETYPE hComponent,
103 OMX_OUT OMX_PTR pAppData,
104 OMX_OUT OMX_BUFFERHEADERTYPE* pBuffer);
106 COmxComponentImpl::COmxComponentImpl(OMX_HANDLETYPE hComponent)
108 iHandle = static_cast<OMX_COMPONENTTYPE*>(hComponent);
109 OMX_VERSIONTYPE ver =
114 // fill in handle structure
115 iHandle->nVersion = ver;
116 iHandle->pComponentPrivate = this;
117 iHandle->GetComponentVersion = &::OMXComponentGetComponentVersion;
118 iHandle->SendCommand = &::OMXComponentSendCommand;
119 iHandle->GetParameter = &::OMXComponentGetParameter;
120 iHandle->SetParameter = &::OMXComponentSetParameter;
121 iHandle->GetConfig = &::OMXComponentGetConfig;
122 iHandle->SetConfig = &::OMXComponentSetConfig;
123 iHandle->GetExtensionIndex = &::OMXComponentGetExtensionIndex;
124 iHandle->GetState = &::OMXComponentGetState;
125 iHandle->ComponentTunnelRequest = &::OMXComponentComponentTunnelRequest;
126 iHandle->UseBuffer = &::OMXComponentUseBuffer;
127 iHandle->AllocateBuffer = &::OMXComponentAllocateBuffer;
128 iHandle->FreeBuffer = &::OMXComponentFreeBuffer;
129 iHandle->EmptyThisBuffer = &::OMXComponentEmptyThisBuffer;
130 iHandle->FillThisBuffer = &::OMXComponentFillThisBuffer;
131 iHandle->SetCallbacks = &::OMXComponentSetCallbacks;
132 iHandle->ComponentDeInit = &::OMXComponentDeInit;
135 COmxComponentImpl::~COmxComponentImpl()
139 COmxComponentImpl::operator OMX_HANDLETYPE()
141 return (OMX_HANDLETYPE)&iHandle;
144 OMX_ERRORTYPE OMXComponentGetComponentVersion(
145 OMX_IN OMX_HANDLETYPE hComponent,
146 OMX_OUT OMX_STRING pComponentName,
147 OMX_OUT OMX_VERSIONTYPE* pComponentVersion,
148 OMX_OUT OMX_VERSIONTYPE* pSpecVersion,
149 OMX_OUT OMX_UUIDTYPE* pComponentUUID)
151 return ((COmxComponentImpl*)((OMX_COMPONENTTYPE*)hComponent)->pComponentPrivate)->GetComponentVersion(pComponentName,pComponentVersion,pSpecVersion, pComponentUUID);
154 OMX_ERRORTYPE OMXComponentSendCommand(
155 OMX_IN OMX_HANDLETYPE hComponent,
156 OMX_IN OMX_COMMANDTYPE Cmd,
157 OMX_IN OMX_U32 nParam1,
158 OMX_IN OMX_PTR pCmdData)
160 return ((COmxComponentImpl*)((OMX_COMPONENTTYPE*)hComponent)->pComponentPrivate)->SendCommand(Cmd ,nParam1, pCmdData);
163 OMX_ERRORTYPE OMXComponentGetParameter(
164 OMX_IN OMX_HANDLETYPE hComponent,
165 OMX_IN OMX_INDEXTYPE nParamIndex,
166 OMX_INOUT OMX_PTR ComponentParameterStructure)
168 return ((COmxComponentImpl*)((OMX_COMPONENTTYPE*)hComponent)->pComponentPrivate)->GetParameter(nParamIndex, ComponentParameterStructure);
171 OMX_ERRORTYPE OMXComponentSetParameter(
172 OMX_IN OMX_HANDLETYPE hComponent,
173 OMX_IN OMX_INDEXTYPE nIndex,
174 OMX_IN OMX_PTR ComponentParameterStructure)
176 return ((COmxComponentImpl*)((OMX_COMPONENTTYPE*)hComponent)->pComponentPrivate)->SetParameter(nIndex, ComponentParameterStructure);
179 OMX_ERRORTYPE OMXComponentGetConfig(
180 OMX_IN OMX_HANDLETYPE hComponent,
181 OMX_IN OMX_INDEXTYPE nIndex,
182 OMX_INOUT OMX_PTR value)
184 return ((COmxComponentImpl*)((OMX_COMPONENTTYPE*)hComponent)->pComponentPrivate)->GetConfig(nIndex, value);
187 OMX_ERRORTYPE OMXComponentSetConfig(
188 OMX_IN OMX_HANDLETYPE hComponent,
189 OMX_IN OMX_INDEXTYPE nIndex,
190 OMX_IN OMX_PTR value)
192 return ((COmxComponentImpl*)((OMX_COMPONENTTYPE*)hComponent)->pComponentPrivate)->SetConfig(nIndex, value);
195 OMX_ERRORTYPE OMXComponentGetExtensionIndex(
196 OMX_IN OMX_HANDLETYPE hComponent,
197 OMX_IN OMX_STRING ParameterName,
198 OMX_OUT OMX_INDEXTYPE* pIndexType)
200 return ((COmxComponentImpl*)((OMX_COMPONENTTYPE*)hComponent)->pComponentPrivate)->GetExtensionIndex(ParameterName, pIndexType);
203 OMX_ERRORTYPE OMXComponentGetState(
204 OMX_IN OMX_HANDLETYPE hComponent,
205 OMX_OUT OMX_STATETYPE* pState)
207 return ((COmxComponentImpl*)((OMX_COMPONENTTYPE*)hComponent)->pComponentPrivate)->GetState(pState);
210 OMX_ERRORTYPE OMXComponentComponentTunnelRequest(
211 OMX_IN OMX_HANDLETYPE hInput,
212 OMX_IN OMX_U32 nInputPort,
213 OMX_IN OMX_HANDLETYPE hOutput,
214 OMX_IN OMX_U32 nOutputPort,
215 OMX_IN OMX_TUNNELSETUPTYPE* pTunnelSetup)
217 return ((COmxComponentImpl*)((OMX_COMPONENTTYPE*)hInput)->pComponentPrivate)->ComponentTunnelRequest(hInput, nInputPort, hOutput, nOutputPort, pTunnelSetup);
220 OMX_ERRORTYPE OMXComponentUseBuffer(
221 OMX_IN OMX_HANDLETYPE hComponent,
222 OMX_INOUT OMX_BUFFERHEADERTYPE** ppBufferHdr,
223 OMX_IN OMX_U32 nPortIndex,
224 OMX_IN OMX_PTR pAppPrivate,
225 OMX_IN OMX_U32 nSizeBytes,
226 OMX_IN OMX_U8* pBuffer)
228 return ((COmxComponentImpl*)((OMX_COMPONENTTYPE*)hComponent)->pComponentPrivate)->UseBuffer(ppBufferHdr, nPortIndex, pAppPrivate, nSizeBytes, pBuffer);
231 OMX_ERRORTYPE OMXComponentAllocateBuffer(
232 OMX_IN OMX_HANDLETYPE hComponent,
233 OMX_INOUT OMX_BUFFERHEADERTYPE** pBuffer,
234 OMX_IN OMX_U32 nPortIndex,
235 OMX_IN OMX_PTR pAppData,
236 OMX_IN OMX_U32 nSizeBytes)
238 return ((COmxComponentImpl*)((OMX_COMPONENTTYPE*)hComponent)->pComponentPrivate)->AllocateBuffer(pBuffer, nPortIndex, pAppData, nSizeBytes);
241 OMX_ERRORTYPE OMXComponentFreeBuffer(
242 OMX_IN OMX_HANDLETYPE hComponent,
243 OMX_IN OMX_U32 nPortIndex,
244 OMX_IN OMX_BUFFERHEADERTYPE* pBuffer)
246 return ((COmxComponentImpl*)((OMX_COMPONENTTYPE*)hComponent)->pComponentPrivate)->FreeBuffer(nPortIndex, pBuffer);
249 OMX_ERRORTYPE OMXComponentEmptyThisBuffer(
250 OMX_IN OMX_HANDLETYPE hComponent,
251 OMX_IN OMX_BUFFERHEADERTYPE* pBuffer)
253 return ((COmxComponentImpl*)((OMX_COMPONENTTYPE*)hComponent)->pComponentPrivate)->EmptyThisBuffer(pBuffer);
256 OMX_ERRORTYPE OMXComponentFillThisBuffer(
257 OMX_IN OMX_HANDLETYPE hComponent,
258 OMX_IN OMX_BUFFERHEADERTYPE* pBuffer)
260 return ((COmxComponentImpl*)((OMX_COMPONENTTYPE*)hComponent)->pComponentPrivate)->FillThisBuffer(pBuffer);
263 OMX_ERRORTYPE OMXComponentSetCallbacks(
264 OMX_IN OMX_HANDLETYPE hComponent,
265 OMX_IN OMX_CALLBACKTYPE* pCallbacks,
266 OMX_IN OMX_PTR pAppData)
268 return ((COmxComponentImpl*)((OMX_COMPONENTTYPE*)hComponent)->pComponentPrivate)->SetCallbacks(pCallbacks, pAppData);
271 OMX_ERRORTYPE OMXComponentDeInit(OMX_IN OMX_HANDLETYPE hComponent)
273 delete ((COmxComponentImpl*)((OMX_COMPONENTTYPE*)hComponent)->pComponentPrivate);
274 return OMX_ErrorNone;