19 #include <stdlib.h> |
19 #include <stdlib.h> |
20 #include <assert.h> |
20 #include <assert.h> |
21 #include "xaengineitf.h" |
21 #include "xaengineitf.h" |
22 #include "xavibraitf.h" |
22 #include "xavibraitf.h" |
23 #include "xaledarrayitf.h" |
23 #include "xaledarrayitf.h" |
24 #ifdef _GSTREAMER_BACKEND_ |
24 #include "xaobjects.h" |
25 #include "XAStaticCapsAdaptation.h" |
25 #include "xacapabilitiesmgr.h" |
26 #endif |
|
27 |
|
28 /*static XAchar implementationText[] = "Implementation does not conform to AL Spec";*/ |
26 /*static XAchar implementationText[] = "Implementation does not conform to AL Spec";*/ |
29 |
27 |
30 |
28 /** |
|
29 * XAEngineItfImpl* GetImpl(XAEngineItf self) |
|
30 * Description: Validate interface pointer and cast it to implementation pointer. |
|
31 **/ |
|
32 static XAEngineItfImpl* GetImpl(XAEngineItf self) |
|
33 { |
|
34 if( self ) |
|
35 { |
|
36 XAEngineItfImpl* impl = (XAEngineItfImpl*)(*self); |
|
37 if( impl && (impl == impl->self) ) |
|
38 { |
|
39 return impl; |
|
40 } |
|
41 } |
|
42 return NULL; |
|
43 } |
31 /** |
44 /** |
32 * Base interface XAEngineItf implementation |
45 * Base interface XAEngineItf implementation |
33 */ |
46 */ |
34 XAresult XAEngineItfImpl_CreateCameraDevice(XAEngineItf self, |
47 XAresult XAEngineItfImpl_CreateCameraDevice(XAEngineItf self, |
35 XAObjectItf *pDevice, |
48 XAObjectItf *pDevice, |
36 XAuint32 deviceID, |
49 XAuint32 deviceID, |
37 XAuint32 numInterfaces, |
50 XAuint32 numInterfaces, |
38 const XAInterfaceID *pInterfaceIds, |
51 const XAInterfaceID *pInterfaceIds, |
39 const XAboolean *pInterfaceRequired) |
52 const XAboolean *pInterfaceRequired) |
40 { |
53 { |
41 return XACameraDeviceImpl_CreateCameraDevice( pDevice, deviceID,numInterfaces, |
54 XAEngineItfImpl* impl = GetImpl(self); |
42 pInterfaceIds, pInterfaceRequired ); |
55 return XACameraDeviceImpl_CreateCameraDevice( impl->mapper,impl->capabilities, |
|
56 pDevice, deviceID,numInterfaces, |
|
57 pInterfaceIds, pInterfaceRequired ); |
43 } |
58 } |
44 |
59 |
45 XAresult XAEngineItfImpl_CreateRadioDevice(XAEngineItf self, |
60 XAresult XAEngineItfImpl_CreateRadioDevice(XAEngineItf self, |
46 XAObjectItf *pDevice, |
61 XAObjectItf *pDevice, |
47 XAuint32 numInterfaces, |
62 XAuint32 numInterfaces, |
48 const XAInterfaceID *pInterfaceIds, |
63 const XAInterfaceID *pInterfaceIds, |
49 const XAboolean *pInterfaceRequired) |
64 const XAboolean *pInterfaceRequired) |
50 { |
65 { |
51 return XARadioDeviceImpl_CreateRadioDevice( pDevice, numInterfaces, |
66 return XARadioDeviceImpl_CreateRadioDevice( ((XAEngineItfImpl*)self)->mapper, |
|
67 pDevice, numInterfaces, |
52 pInterfaceIds, pInterfaceRequired ); |
68 pInterfaceIds, pInterfaceRequired ); |
53 } |
69 } |
54 |
70 |
55 XAresult XAEngineItfImpl_CreateLEDDevice(XAEngineItf self, |
71 XAresult XAEngineItfImpl_CreateLEDDevice(XAEngineItf self, |
56 XAObjectItf *pDevice, |
72 XAObjectItf *pDevice, |
57 XAuint32 deviceID, |
73 XAuint32 deviceID, |
58 XAuint32 numInterfaces, |
74 XAuint32 numInterfaces, |
59 const XAInterfaceID *pInterfaceIds, |
75 const XAInterfaceID *pInterfaceIds, |
60 const XAboolean *pInterfaceRequired) |
76 const XAboolean *pInterfaceRequired) |
61 { |
77 { |
62 return XALEDArrayDeviceImpl_CreateLEDArrayDevice( pDevice, deviceID, numInterfaces, |
78 return XALEDArrayDeviceImpl_CreateLEDArrayDevice( ((XAEngineItfImpl*)self)->mapper, |
63 pInterfaceIds, pInterfaceRequired ); |
79 pDevice, deviceID, numInterfaces, |
|
80 pInterfaceIds, pInterfaceRequired ); |
64 } |
81 } |
65 |
82 |
66 XAresult XAEngineItfImpl_CreateVibraDevice(XAEngineItf self, |
83 XAresult XAEngineItfImpl_CreateVibraDevice(XAEngineItf self, |
67 XAObjectItf *pDevice, |
84 XAObjectItf *pDevice, |
68 XAuint32 deviceID, |
85 XAuint32 deviceID, |
69 XAuint32 numInterfaces, |
86 XAuint32 numInterfaces, |
70 const XAInterfaceID *pInterfaceIds, |
87 const XAInterfaceID *pInterfaceIds, |
71 const XAboolean *pInterfaceRequired) |
88 const XAboolean *pInterfaceRequired) |
72 { |
89 { |
73 return XAVibraDeviceImpl_CreateVibraDevice( pDevice, deviceID, numInterfaces, |
90 return XAVibraDeviceImpl_CreateVibraDevice( ((XAEngineItfImpl*)self)->mapper, |
|
91 pDevice, deviceID, numInterfaces, |
74 pInterfaceIds, pInterfaceRequired); |
92 pInterfaceIds, pInterfaceRequired); |
75 } |
93 } |
76 |
94 |
77 XAresult XAEngineItfImpl_CreateMediaPlayer(XAEngineItf self, |
95 XAresult XAEngineItfImpl_CreateMediaPlayer(XAEngineItf self, |
78 XAObjectItf *pPlayer, |
96 XAObjectItf *pPlayer, |
84 XADataSink *pLEDArray, |
102 XADataSink *pLEDArray, |
85 XAuint32 numInterfaces, |
103 XAuint32 numInterfaces, |
86 const XAInterfaceID *pInterfaceIds, |
104 const XAInterfaceID *pInterfaceIds, |
87 const XAboolean *pInterfaceRequired) |
105 const XAboolean *pInterfaceRequired) |
88 { |
106 { |
89 return XAMediaPlayerImpl_CreateMediaPlayer(pPlayer, pDataSrc, pBankSrc, pAudioSnk, |
107 XAEngineItfImpl* impl = GetImpl(self); |
|
108 return XAMediaPlayerImpl_CreateMediaPlayer(impl->mapper,impl->capabilities, pPlayer, |
|
109 pDataSrc, pBankSrc, pAudioSnk, |
90 pImageVideoSnk, pVibra, pLEDArray, |
110 pImageVideoSnk, pVibra, pLEDArray, |
91 numInterfaces, pInterfaceIds, pInterfaceRequired); |
111 numInterfaces, pInterfaceIds, pInterfaceRequired); |
92 } |
112 } |
93 |
113 |
94 XAresult XAEngineItfImpl_CreateMediaRecorder(XAEngineItf self, |
114 XAresult XAEngineItfImpl_CreateMediaRecorder(XAEngineItf self, |
97 XADataSource * pImageVideoSrc, |
117 XADataSource * pImageVideoSrc, |
98 XADataSink * pDataSnk, |
118 XADataSink * pDataSnk, |
99 XAuint32 numInterfaces, |
119 XAuint32 numInterfaces, |
100 const XAInterfaceID * pInterfaceIds, |
120 const XAInterfaceID * pInterfaceIds, |
101 const XAboolean * pInterfaceRequired) |
121 const XAboolean * pInterfaceRequired) |
102 { |
122 { |
103 return XAMediaRecorderImpl_CreateMediaRecorder(pRecorder, pAudioSrc, pImageVideoSrc, pDataSnk, |
123 XAEngineItfImpl* impl = GetImpl(self); |
104 numInterfaces, pInterfaceIds, pInterfaceRequired); |
124 return XAMediaRecorderImpl_CreateMediaRecorder(impl->mapper, |
|
125 impl->capabilities, |
|
126 pRecorder, |
|
127 pAudioSrc, |
|
128 pImageVideoSrc, |
|
129 pDataSnk, |
|
130 numInterfaces, |
|
131 pInterfaceIds, |
|
132 pInterfaceRequired); |
105 } |
133 } |
106 |
134 |
107 XAresult XAEngineItfImpl_CreateOutputMix(XAEngineItf self, |
135 XAresult XAEngineItfImpl_CreateOutputMix(XAEngineItf self, |
108 XAObjectItf *pMix, |
136 XAObjectItf *pMix, |
109 XAuint32 numInterfaces, |
137 XAuint32 numInterfaces, |
110 const XAInterfaceID *pInterfaceIds, |
138 const XAInterfaceID *pInterfaceIds, |
111 const XAboolean *pInterfaceRequired) |
139 const XAboolean *pInterfaceRequired) |
112 { |
140 { |
113 return XAOMixImpl_CreateOutputMix(pMix, numInterfaces, |
141 XAEngineItfImpl* impl = GetImpl(self); |
114 pInterfaceIds, pInterfaceRequired); |
142 return XAOMixImpl_CreateOutputMix(impl->mapper,impl->capabilities, |
|
143 pMix, numInterfaces, |
|
144 pInterfaceIds, pInterfaceRequired); |
115 } |
145 } |
116 |
146 |
117 XAresult XAEngineItfImpl_CreateMetadataExtractor(XAEngineItf self, |
147 XAresult XAEngineItfImpl_CreateMetadataExtractor(XAEngineItf self, |
118 XAObjectItf *pMetadataExtractor, |
148 XAObjectItf *pMetadataExtractor, |
119 XADataSource *pDataSource, |
149 XADataSource *pDataSource, |
120 XAuint32 numInterfaces, |
150 XAuint32 numInterfaces, |
121 const XAInterfaceID *pInterfaceIds, |
151 const XAInterfaceID *pInterfaceIds, |
122 const XAboolean *pInterfaceRequired) |
152 const XAboolean *pInterfaceRequired) |
123 { |
153 { |
124 return XAMetadataExtractorImpl_Create(pMetadataExtractor, pDataSource, |
154 XAEngineItfImpl* impl = GetImpl(self); |
125 numInterfaces, pInterfaceIds, pInterfaceRequired); |
155 return XAMetadataExtractorImpl_Create(impl->mapper, impl->capabilities, |
|
156 pMetadataExtractor, pDataSource, |
|
157 numInterfaces, pInterfaceIds, pInterfaceRequired); |
126 } |
158 } |
127 |
159 |
128 XAresult XAEngineItfImpl_CreateExtensionObject(XAEngineItf self, |
160 XAresult XAEngineItfImpl_CreateExtensionObject(XAEngineItf self, |
129 XAObjectItf *pObject, |
161 XAObjectItf *pObject, |
130 void *pParameters, |
162 void *pParameters, |
357 descriptor.colorMask = COLOR_MASK; |
389 descriptor.colorMask = COLOR_MASK; |
358 descriptor.ledCount = LED_COUNT; |
390 descriptor.ledCount = LED_COUNT; |
359 descriptor.primaryLED = PRIMARY_LED; |
391 descriptor.primaryLED = PRIMARY_LED; |
360 *pDescriptor = descriptor; |
392 *pDescriptor = descriptor; |
361 } |
393 } |
362 #endif |
394 |
363 } |
395 } |
364 DEBUG_API("<-XAEngineItfImpl_QueryLEDCapabilities"); |
396 DEBUG_API("<-XAEngineItfImpl_QueryLEDCapabilities"); |
365 return XA_RESULT_SUCCESS; |
397 return XA_RESULT_SUCCESS; |
366 } |
398 } |
367 |
399 |
368 XAresult XAEngineItfImpl_QueryVibraCapabilities(XAEngineItf self, |
400 XAresult XAEngineItfImpl_QueryVibraCapabilities(XAEngineItf self, |
369 XAuint32 *pIndex, |
401 XAuint32 *pIndex, |
370 XAuint32 *pVibraDeviceID, |
402 XAuint32 *pVibraDeviceID, |
371 XAVibraDescriptor *pDescriptor) |
403 XAVibraDescriptor *pDescriptor) |
372 { |
404 { |
373 #ifdef _GSTREAMER_BACKEND_ |
405 |
374 XAVibraDescriptor descriptor; |
406 XAVibraDescriptor descriptor; |
375 #endif |
407 |
376 DEBUG_API("->XAEngineItfImpl_QueryVibraCapabilities"); |
408 DEBUG_API("->XAEngineItfImpl_QueryVibraCapabilities"); |
377 |
409 |
378 if( !pDescriptor ) |
410 if( !pDescriptor ) |
379 { /*query number of devices*/ |
411 { /*query number of devices*/ |
380 if( !pIndex ) |
412 if( !pIndex ) |