21 #include "xaledarraydevice.h" |
21 #include "xaledarraydevice.h" |
22 #include "xaledarrayitf.h" |
22 #include "xaledarrayitf.h" |
23 #include "xaconfigextensionsitf.h" |
23 #include "xaconfigextensionsitf.h" |
24 #include "xadynintmgmtitf.h" |
24 #include "xadynintmgmtitf.h" |
25 #include "xathreadsafety.h" |
25 #include "xathreadsafety.h" |
26 |
26 #include "xaledarrayadaptctx.h" |
27 |
27 |
28 /* Static mapping of enumeration XALEDArrayDeviceInterfaces to interface iids */ |
28 /* Static mapping of enumeration XALEDArrayDeviceInterfaces to interface iids */ |
29 static const XAInterfaceID* XALEDArrayDeviceItfIIDs[LEDARRAY_ITFCOUNT]= |
29 static const XAInterfaceID* XALEDArrayDeviceItfIIDs[LEDARRAY_ITFCOUNT]= |
30 { |
30 { |
31 &XA_IID_OBJECT, |
31 &XA_IID_OBJECT, |
40 *****************************************************************************/ |
40 *****************************************************************************/ |
41 |
41 |
42 /* XAResult XALEDArrayDeviceImpl_Create |
42 /* XAResult XALEDArrayDeviceImpl_Create |
43 * Description: Create object |
43 * Description: Create object |
44 */ |
44 */ |
45 XAresult XALEDArrayDeviceImpl_CreateLEDArrayDevice(XAObjectItf* pDevice, |
45 XAresult XALEDArrayDeviceImpl_CreateLEDArrayDevice(FrameworkMap* mapper, |
|
46 XAObjectItf* pDevice, |
46 XAuint32 deviceID, |
47 XAuint32 deviceID, |
47 XAuint32 numInterfaces, |
48 XAuint32 numInterfaces, |
48 const XAInterfaceID * pInterfaceIds, |
49 const XAInterfaceID * pInterfaceIds, |
49 const XAboolean * pInterfaceRequired) |
50 const XAboolean * pInterfaceRequired) |
50 { |
51 { |
125 entry->required = XA_BOOLEAN_TRUE; |
126 entry->required = XA_BOOLEAN_TRUE; |
126 } |
127 } |
127 } |
128 } |
128 } |
129 } |
129 |
130 |
130 /* Initialize XALEDArrayDeviceImpl variables */ |
|
131 pImpl->deviceID = deviceID; |
|
132 #ifdef _GSTREAMER_BACKEND_ |
|
133 pImpl->adaptationCtx = XALEDArrayAdapt_Create(pImpl->deviceID); |
|
134 #endif |
|
135 |
131 |
136 /* This code is put here to return Feature Not Supported since adaptation is not present*/ |
132 /* This code is put here to return Feature Not Supported since adaptation is not present*/ |
137 /*************************************************/ |
133 /*************************************************/ |
138 XAObjectItfImpl_Destroy((XAObjectItf)&(pBaseObj)); |
134 XAObjectItfImpl_Destroy((XAObjectItf)&(pBaseObj)); |
139 XA_IMPL_THREAD_SAFETY_EXIT(XATSLEDArray); |
135 XA_IMPL_THREAD_SAFETY_EXIT(XATSLEDArray); |
140 DEBUG_ERR("Required interface not found - abort creation!"); |
136 DEBUG_ERR("Required interface not found - abort creation!"); |
141 DEBUG_API("<-XALEDArrayDeviceImpl_Create"); |
137 DEBUG_API("<-XALEDArrayDeviceImpl_Create"); |
142 return XA_RESULT_FEATURE_UNSUPPORTED; |
138 return XA_RESULT_FEATURE_UNSUPPORTED; |
143 /*************************************************/ |
139 /*************************************************/ |
144 |
140 |
145 /* Set ObjectItf to point to newly created object */ |
141 /* // Initialize XALEDArrayDeviceImpl variables |
146 /* |
142 pImpl->deviceID = deviceID; |
|
143 pImpl->adaptationCtx = XALEDArrayAdapt_Create(pImpl->deviceID); |
|
144 |
|
145 // Set ObjectItf to point to newly created object |
147 *pDevice = (XAObjectItf)&(pBaseObj->self); |
146 *pDevice = (XAObjectItf)&(pBaseObj->self); |
148 XA_IMPL_THREAD_SAFETY_EXIT(XATSLEDArray); |
147 XA_IMPL_THREAD_SAFETY_EXIT(XATSLEDArray); |
149 DEBUG_API("<-XALEDArrayDeviceImpl_Create"); |
148 DEBUG_API("<-XALEDArrayDeviceImpl_Create"); |
150 return XA_RESULT_SUCCESS; |
149 return XA_RESULT_SUCCESS;*/ |
151 */ |
|
152 } |
150 } |
153 |
151 |
154 /* XAResult XALEDArrayDeviceImpl_QueryNumSupportedInterfaces |
152 /* XAResult XALEDArrayDeviceImpl_QueryNumSupportedInterfaces |
155 * Description: Statically query number of supported interfaces |
153 * Description: Statically query number of supported interfaces |
156 */ |
154 */ |
157 XAresult XALEDArrayDeviceImpl_QueryNumSupportedInterfaces( XAuint32 *pNumSupportedInterfaces ) |
155 XAresult XALEDArrayDeviceImpl_QueryNumSupportedInterfaces( XAuint32 *pNumSupportedInterfaces ) |
158 { |
156 { |
159 DEBUG_API("->XALEDArrayDeviceImpl_QueryNumSupportedInterfaces"); |
157 DEBUG_API("->XALEDArrayDeviceImpl_QueryNumSupportedInterfaces"); |
160 if( pNumSupportedInterfaces ) |
158 if( pNumSupportedInterfaces ) |
161 { |
159 { |
162 #ifdef _GSTREAMER_BACKEND_ |
160 |
163 *pNumSupportedInterfaces = LEDARRAY_ITFCOUNT; |
161 *pNumSupportedInterfaces = LEDARRAY_ITFCOUNT; |
164 #endif |
162 |
165 DEBUG_API_A1("<-XALEDArrayDeviceImpl_QueryNumSupportedInterfaces - %ld", *pNumSupportedInterfaces ); |
163 DEBUG_API_A1("<-XALEDArrayDeviceImpl_QueryNumSupportedInterfaces - %ld", *pNumSupportedInterfaces ); |
166 return XA_RESULT_SUCCESS; |
164 return XA_RESULT_SUCCESS; |
167 } |
165 } |
168 else |
166 else |
169 { |
167 { |
178 XAresult XALEDArrayDeviceImpl_QuerySupportedInterfaces( XAuint32 index, |
176 XAresult XALEDArrayDeviceImpl_QuerySupportedInterfaces( XAuint32 index, |
179 XAInterfaceID * pInterfaceId ) |
177 XAInterfaceID * pInterfaceId ) |
180 { |
178 { |
181 DEBUG_API("->XALEDArrayDeviceImpl_QuerySupportedInterfaces"); |
179 DEBUG_API("->XALEDArrayDeviceImpl_QuerySupportedInterfaces"); |
182 |
180 |
183 #ifdef _GSTREAMER_BACKEND_ |
181 |
184 if( index >= LEDARRAY_ITFCOUNT || !pInterfaceId ) |
182 if( index >= LEDARRAY_ITFCOUNT || !pInterfaceId ) |
185 { |
183 { |
186 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
184 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
187 DEBUG_API("<-XALEDArrayDeviceImpl_QuerySupportedInterfaces"); |
185 DEBUG_API("<-XALEDArrayDeviceImpl_QuerySupportedInterfaces"); |
188 return XA_RESULT_PARAMETER_INVALID; |
186 return XA_RESULT_PARAMETER_INVALID; |
189 } |
187 } |
190 else |
188 else |
191 { |
189 { |
192 *pInterfaceId = *(XALEDArrayDeviceItfIIDs[index]); |
190 *pInterfaceId = *(XALEDArrayDeviceItfIIDs[index]); |
193 #endif |
191 |
194 DEBUG_API("<-XALEDArrayDeviceImpl_QuerySupportedInterfaces"); |
192 DEBUG_API("<-XALEDArrayDeviceImpl_QuerySupportedInterfaces"); |
195 return XA_RESULT_SUCCESS; |
193 return XA_RESULT_SUCCESS; |
196 #ifdef _GSTREAMER_BACKEND_ |
194 |
197 } |
195 } |
198 #endif |
196 |
199 } |
197 } |
200 |
198 |
201 |
199 |
202 /***************************************************************************** |
200 /***************************************************************************** |
203 * base object XAObjectItfImpl methods |
201 * base object XAObjectItfImpl methods |
208 * Create and initialize implementation-specific variables. |
206 * Create and initialize implementation-specific variables. |
209 * Called from base object XAObjectItfImpl |
207 * Called from base object XAObjectItfImpl |
210 */ |
208 */ |
211 XAresult XALEDArrayDeviceImpl_DoRealize( XAObjectItf self ) |
209 XAresult XALEDArrayDeviceImpl_DoRealize( XAObjectItf self ) |
212 { |
210 { |
213 #ifdef _GSTREAMER_BACKEND_ |
211 |
214 XAObjectItfImpl* pObj = (XAObjectItfImpl*)(*self); |
212 XAObjectItfImpl* pObj = (XAObjectItfImpl*)(*self); |
215 XAuint8 itfIdx = 0; |
213 XAuint8 itfIdx = 0; |
216 XALEDArrayDeviceImpl* pObjImpl = (XALEDArrayDeviceImpl*)(pObj); |
214 XALEDArrayDeviceImpl* pObjImpl = (XALEDArrayDeviceImpl*)(pObj); |
217 XAresult ret = XA_RESULT_SUCCESS; |
215 XAresult ret = XA_RESULT_SUCCESS; |
218 |
216 |
227 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
225 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
228 DEBUG_API("<-XALEDArrayDeviceImpl_DoRealize"); |
226 DEBUG_API("<-XALEDArrayDeviceImpl_DoRealize"); |
229 return XA_RESULT_PARAMETER_INVALID; |
227 return XA_RESULT_PARAMETER_INVALID; |
230 } |
228 } |
231 |
229 |
232 ret = XALEDArrayAdapt_PostInit( pObjImpl->adaptationCtx ); |
230 ret = XALEDArrayAdapt_PostInit( (XAAdaptationGstCtx*)pObjImpl->adaptationCtx ); |
233 if( ret != XA_RESULT_SUCCESS ) |
231 if( ret != XA_RESULT_SUCCESS ) |
234 { |
232 { |
235 XA_IMPL_THREAD_SAFETY_EXIT(XATSLEDArray); |
233 XA_IMPL_THREAD_SAFETY_EXIT(XATSLEDArray); |
236 DEBUG_ERR_A1("Error: %d",ret); |
234 DEBUG_ERR_A1("Error: %d",ret); |
237 DEBUG_API("<-XALEDArrayDeviceImpl_DoRealize"); |
235 DEBUG_API("<-XALEDArrayDeviceImpl_DoRealize"); |
295 /* void XALEDArrayDeviceImpl_FreeResources |
293 /* void XALEDArrayDeviceImpl_FreeResources |
296 * Description: Free all resources reserved at XALEDArrayDeviceImpl_DoRealize() |
294 * Description: Free all resources reserved at XALEDArrayDeviceImpl_DoRealize() |
297 */ |
295 */ |
298 void XALEDArrayDeviceImpl_FreeResources(XAObjectItf self) |
296 void XALEDArrayDeviceImpl_FreeResources(XAObjectItf self) |
299 { |
297 { |
300 #ifdef _GSTREAMER_BACKEND_ |
298 |
301 XAObjectItfImpl* pObj = (XAObjectItfImpl*)(*self); |
299 XAObjectItfImpl* pObj = (XAObjectItfImpl*)(*self); |
302 XALEDArrayDeviceImpl* pImpl = (XALEDArrayDeviceImpl*)(*self); |
300 XALEDArrayDeviceImpl* pImpl = (XALEDArrayDeviceImpl*)(*self); |
303 XAuint8 itfIdx = 0; |
301 XAuint8 itfIdx = 0; |
304 DEBUG_API("->XALEDArrayDeviceImpl_FreeResources"); |
302 DEBUG_API("->XALEDArrayDeviceImpl_FreeResources"); |
305 XA_IMPL_THREAD_SAFETY_ENTRY_FOR_VOID_FUNCTIONS(XATSLEDArray); |
303 XA_IMPL_THREAD_SAFETY_ENTRY_FOR_VOID_FUNCTIONS(XATSLEDArray); |
306 assert( pObj && pImpl && pObj == pObj->self ); |
304 assert( pObj && pImpl && pObj == pObj->self ); |
307 |
305 |
308 if ( pImpl->adaptationCtx != NULL ) |
306 if ( pImpl->adaptationCtx != NULL ) |
309 { |
307 { |
310 XALEDArrayAdapt_Destroy( pImpl->adaptationCtx ); |
308 XALEDArrayAdapt_Destroy( (XAAdaptationGstCtx*)pImpl->adaptationCtx ); |
311 pImpl->adaptationCtx = NULL; |
309 pImpl->adaptationCtx = NULL; |
312 } |
310 } |
313 |
311 |
314 /* free all allocated interfaces */ |
312 /* free all allocated interfaces */ |
315 for(itfIdx = 0; itfIdx < LEDARRAY_ITFCOUNT; itfIdx++) |
313 for(itfIdx = 0; itfIdx < LEDARRAY_ITFCOUNT; itfIdx++) |