15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 #include <stdio.h> |
18 #include <stdio.h> |
19 #include <stdlib.h> |
19 #include <stdlib.h> |
20 #include <assert.h> |
20 #include <string.h> |
21 #include "xamediarecorder.h" |
21 #include "xamediarecorder.h" |
22 #include "xaaudioencoderitf.h" |
22 #include "xaaudioencoderitf.h" |
23 #include "xaconfigextensionsitf.h" |
|
24 #include "xadynintmgmtitf.h" |
23 #include "xadynintmgmtitf.h" |
25 #include "xametadatainsertionitf.h" |
|
26 #include "xarecorditf.h" |
24 #include "xarecorditf.h" |
27 #include "xavolumeitf.h" |
|
28 #include "xametadataextractionitf.h" |
|
29 #include "xathreadsafety.h" |
25 #include "xathreadsafety.h" |
30 #include <string.h> |
|
31 #include "xacapabilitiesmgr.h" |
26 #include "xacapabilitiesmgr.h" |
32 #include "xamediarecorderadaptctxmmf.h" |
27 #include "xamediarecorderadaptctxmmf.h" |
33 #include "xamediarecorderadaptctx.h" |
28 #include "xamediarecorderadaptctx.h" |
34 /* Static mapping of enumeration XAMediaRecorderInterfaces to interface iids */ |
29 /* Static mapping of enumeration XAMediaRecorderInterfaces to interface iids */ |
35 static const XAInterfaceID* xaMediaRecorderItfIIDs[MR_ITFCOUNT] = |
30 static const XAInterfaceID* xaMediaRecorderItfIIDs[MR_ITFCOUNT] = |
36 { |
31 { |
37 &XA_IID_OBJECT, |
32 &XA_IID_OBJECT, |
38 &XA_IID_AUDIOENCODER, |
33 &XA_IID_AUDIOENCODER, |
39 &XA_IID_CONFIGEXTENSION, |
|
40 &XA_IID_DYNAMICINTERFACEMANAGEMENT, |
34 &XA_IID_DYNAMICINTERFACEMANAGEMENT, |
41 &XA_IID_METADATAINSERTION, |
35 &XA_IID_RECORD |
42 &XA_IID_RECORD, |
|
43 &XA_IID_VOLUME, |
|
44 &XA_IID_METADATAEXTRACTION |
|
45 }; |
36 }; |
46 |
37 |
47 /* Global methods */ |
38 /* Global methods */ |
48 |
39 |
49 /* XAResult XAMediaRecorderImpl_Create |
40 /* XAResult XAMediaRecorderImpl_Create |
65 const char *uri = NULL; |
56 const char *uri = NULL; |
66 |
57 |
67 DEBUG_API("->XAMediaRecorderImpl_CreateMediaRecorder"); |
58 DEBUG_API("->XAMediaRecorderImpl_CreateMediaRecorder"); |
68 XA_IMPL_THREAD_SAFETY_ENTRY( XATSMediaRecorder ); |
59 XA_IMPL_THREAD_SAFETY_ENTRY( XATSMediaRecorder ); |
69 |
60 |
70 if (!pRecorder) |
61 /* check sink&source parameters */ |
|
62 ret = XACommon_ValidateDataLocator(3, pAudioSrc, pImageVideoSrc, |
|
63 pDataSnk); |
|
64 if (ret != XA_RESULT_SUCCESS) |
|
65 { |
|
66 XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaRecorder ); |
|
67 DEBUG_API("<-XAMediaRecorderImpl_CreateMediaRecorder"); |
|
68 return ret; |
|
69 } |
|
70 |
|
71 /* check only sink media type, do not care about return value (availability) */ |
|
72 XACommon_CheckDataSource((XADataSource*) pDataSnk, &mediaType); |
|
73 |
|
74 if (!pRecorder || (!pAudioSrc && !pImageVideoSrc) || !pDataSnk) |
71 { |
75 { |
72 /* invalid parameter */ |
76 /* invalid parameter */ |
73 XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaRecorder ); |
77 XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaRecorder ); |
74 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
78 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
75 DEBUG_API("<-XAMediaRecorderImpl_CreateMediaRecorder"); |
79 DEBUG_API("<-XAMediaRecorderImpl_CreateMediaRecorder"); |
76 return XA_RESULT_PARAMETER_INVALID; |
80 return XA_RESULT_PARAMETER_INVALID; |
77 } |
81 } |
78 |
82 |
79 /* check sink&source parameters */ |
|
80 ret |
|
81 = XACommon_ValidateDataLocator(3, pAudioSrc, pImageVideoSrc, |
|
82 pDataSnk); |
|
83 if (ret != XA_RESULT_SUCCESS) |
|
84 { |
|
85 XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaRecorder ); |
|
86 DEBUG_API("<-XAMediaRecorderImpl_CreateMediaRecorder"); |
|
87 return ret; |
|
88 } |
|
89 |
|
90 /* instantiate object implementation */ |
83 /* instantiate object implementation */ |
91 pImpl = (XAMediaRecorderImpl*) calloc(1, sizeof(XAMediaRecorderImpl)); |
84 pImpl = (XAMediaRecorderImpl*) calloc(1, sizeof(XAMediaRecorderImpl)); |
92 if (!pImpl) |
85 if (!pImpl) |
93 { |
86 { |
94 |
|
95 /* memory allocation failed */ |
87 /* memory allocation failed */ |
96 XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaRecorder ); |
88 XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaRecorder ); |
97 DEBUG_ERR("XA_RESULT_MEMORY_FAILURE"); |
89 DEBUG_ERR("XA_RESULT_MEMORY_FAILURE"); |
98 DEBUG_API("<-XAMediaRecorderImpl_CreateMediaRecorder"); |
90 DEBUG_API("<-XAMediaRecorderImpl_CreateMediaRecorder"); |
99 return XA_RESULT_MEMORY_FAILURE; |
91 return XA_RESULT_MEMORY_FAILURE; |
100 } |
92 } |
|
93 |
101 pBaseObj = &pImpl->baseObj; |
94 pBaseObj = &pImpl->baseObj; |
102 |
95 |
103 /* Initialize base object default implementation */ |
96 /* Initialize base object default implementation */ |
104 XAObjectItfImpl_Init(pBaseObj, MR_ITFCOUNT, xaMediaRecorderItfIIDs, |
97 XAObjectItfImpl_Init(pBaseObj, MR_ITFCOUNT, xaMediaRecorderItfIIDs, |
105 XAMediaRecorderImpl_DoRealize, XAMediaRecorderImpl_DoResume, |
98 XAMediaRecorderImpl_DoRealize, XAMediaRecorderImpl_DoResume, |
106 XAMediaRecorderImpl_FreeResources); |
99 XAMediaRecorderImpl_FreeResources); |
107 |
100 |
108 /* Mark interfaces that need to be exposed */ |
101 /* Mark interfaces that need to be exposed */ |
109 /* Implicit and mandated interfaces */ |
102 /* Mandated Implicit interfaces */ |
110 pBaseObj->interfaceMap[MR_RECORDITF].required = XA_BOOLEAN_TRUE; |
|
111 if (pAudioSrc && mediaType != XA_MEDIATYPE_IMAGE) |
|
112 { |
|
113 pBaseObj->interfaceMap[MR_AUDIOENCODERITF].required = XA_BOOLEAN_TRUE; |
|
114 } |
|
115 |
|
116 pBaseObj->interfaceMap[MR_DIMITF].required = XA_BOOLEAN_TRUE; |
103 pBaseObj->interfaceMap[MR_DIMITF].required = XA_BOOLEAN_TRUE; |
117 |
104 |
118 /* Explicit interfaces */ |
105 /* Mark interfaces that can be handled dynamically */ |
|
106 /* Mandated dynamic itfs */ |
|
107 |
|
108 /*Mandated Explicit interfaces */ |
119 if ((numInterfaces != 0) && pInterfaceIds && pInterfaceRequired) |
109 if ((numInterfaces != 0) && pInterfaceIds && pInterfaceRequired) |
120 { |
110 { |
121 /* check only sink media type, do not care about return value (availability) */ |
|
122 XACommon_CheckDataSource((XADataSource*) pDataSnk, &mediaType); |
|
123 /* Check required interfaces */ |
111 /* Check required interfaces */ |
124 for (itfIdx = 0; itfIdx < numInterfaces; itfIdx++) |
112 for (itfIdx = 0; itfIdx < numInterfaces; itfIdx++) |
125 { |
113 { |
126 /* If mapEntry is null then required interface is not supported.*/ |
114 /* If mapEntry is null then required interface is not supported.*/ |
127 XAObjItfMapEntry *entry = XAObjectItfImpl_GetItfEntry( |
115 XAObjItfMapEntry *entry = XAObjectItfImpl_GetItfEntry( |
139 { |
127 { |
140 DEBUG_INFO("Requested (not required) interface not found - continue creation"); |
128 DEBUG_INFO("Requested (not required) interface not found - continue creation"); |
141 } |
129 } |
142 } |
130 } |
143 else |
131 else |
144 { /* weed out unsupported content-aware itf's */ |
132 { |
145 if ((mediaType == XA_MEDIATYPE_IMAGE || !pAudioSrc) |
133 entry->required = XA_BOOLEAN_TRUE; |
146 && (entry->mapIdx == MR_VOLUMEITF || entry->mapIdx == MR_AUDIOENCODERITF)) |
134 } |
147 { |
|
148 entry->required = XA_BOOLEAN_FALSE; |
|
149 if (pInterfaceRequired[itfIdx]) |
|
150 { |
|
151 DEBUG_ERR("Required interface not supported for given media - abort creation!"); |
|
152 ret = XA_RESULT_FEATURE_UNSUPPORTED; |
|
153 break; |
|
154 } |
|
155 } |
|
156 else |
|
157 { |
|
158 entry->required = XA_BOOLEAN_TRUE; |
|
159 } |
|
160 |
|
161 if (entry->mapIdx == MR_RECORDITF) |
|
162 { |
|
163 DEBUG_ERR("RecordItf requested - support stream mode"); |
|
164 pImpl->recModes |= XA_RECMODE_STREAM; |
|
165 } |
|
166 } |
|
167 } |
|
168 } |
|
169 if (pImpl->recModes == 0) |
|
170 { |
|
171 DEBUG_ERR("Warning!!! No recording interfaces requested - unable to record!!"); |
|
172 } |
|
173 /*check sink and src parameters*/ |
|
174 if (ret == XA_RESULT_SUCCESS) |
|
175 { |
|
176 ret = XACommon_ValidateDataLocator(3, pDataSnk, pAudioSrc, |
|
177 pImageVideoSrc); |
|
178 /*datasink ignored if only snapshotitf is used*/ |
|
179 if (!pDataSnk && (pImpl->recModes & XA_RECMODE_STREAM)) |
|
180 { |
|
181 DEBUG_ERR("No datasink to record to!"); |
|
182 ret = XA_RESULT_PARAMETER_INVALID; |
|
183 } |
|
184 if (!pAudioSrc && !pImageVideoSrc) |
|
185 { |
|
186 DEBUG_ERR("No data sources set!"); |
|
187 ret = XA_RESULT_PARAMETER_INVALID; |
|
188 } |
135 } |
189 } |
136 } |
190 |
137 |
191 if (ret != XA_RESULT_SUCCESS) |
138 if (ret != XA_RESULT_SUCCESS) |
192 { /* creation fails */ |
139 { /* creation fails */ |
193 XAObjectItfImpl_Destroy((XAObjectItf) &(pBaseObj)); |
140 XAObjectItfImpl_Destroy((XAObjectItf) &(pBaseObj)); |
194 XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaRecorder ); |
141 XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaRecorder ); |
195 DEBUG_API("<-XAMediaRecorderImpl_CreateMediaRecorder"); |
142 DEBUG_API("<-XAMediaRecorderImpl_CreateMediaRecorder"); |
196 return ret; |
143 return ret; |
197 } |
144 } |
198 |
145 |
199 /* Mark interfaces that can be handled dynamically */ |
|
200 /* Mandated dynamic itfs */ |
|
201 pBaseObj->interfaceMap[MR_METADATAINSERTIONITF].isDynamic |
|
202 = XA_BOOLEAN_TRUE; |
|
203 |
|
204 /* Initialize XAMediaRecorderImpl variables */ |
146 /* Initialize XAMediaRecorderImpl variables */ |
205 pImpl->audioSrc = pAudioSrc; |
147 pImpl->audioSrc = pAudioSrc; |
206 pImpl->dataSnk = pDataSnk; |
148 pImpl->dataSnk = pDataSnk; |
207 pImpl->imageVideoSrc = pImageVideoSrc; |
149 pImpl->imageVideoSrc = pImageVideoSrc; |
|
150 pImpl->recModes |= XA_RECMODE_STREAM; |
|
151 |
208 /* Determine framework type that can handle recording */ |
152 /* Determine framework type that can handle recording */ |
209 fwType = (FWMgrFwType) FWMgrMOUnknown; |
153 fwType = (FWMgrFwType) FWMgrMOUnknown; |
210 /**/ |
154 /**/ |
211 if (pDataSnk && pDataSnk->pLocator) |
155 if (pDataSnk->pLocator) |
212 { |
156 { |
213 XADataLocator_URI* dataLoc = (XADataLocator_URI*) pDataSnk->pLocator; |
157 XADataLocator_URI* dataLoc = (XADataLocator_URI*) pDataSnk->pLocator; |
214 if (dataLoc->locatorType == XA_DATALOCATOR_URI) |
158 if (dataLoc->locatorType == XA_DATALOCATOR_URI) |
215 { |
159 { |
216 uri = (char*) dataLoc->URI; |
160 uri = (char*) dataLoc->URI; |
217 } |
161 } |
218 } |
162 } |
|
163 |
219 fwType = XAFrameworkMgr_GetFramework(mapper, uri, FWMgrMORecorder); |
164 fwType = XAFrameworkMgr_GetFramework(mapper, uri, FWMgrMORecorder); |
220 |
165 |
221 if (fwType == FWMgrMOUnknown) |
166 switch(fwType) |
222 { |
167 { |
223 ret = XA_RESULT_CONTENT_UNSUPPORTED; |
168 case FWMgrFWMMF: |
|
169 { |
|
170 |
|
171 pImpl->adaptationCtx = XAMediaRecorderAdaptMMF_Create( |
|
172 pImpl->audioSrc, pImpl->imageVideoSrc, pImpl->dataSnk, |
|
173 pImpl->recModes); |
|
174 } |
|
175 break; |
|
176 case FWMgrFWGST: |
|
177 { |
|
178 pImpl->adaptationCtx = XAMediaRecorderAdapt_Create(pImpl->audioSrc, |
|
179 pImpl->imageVideoSrc, pImpl->dataSnk, pImpl->recModes); |
|
180 break; |
|
181 } |
|
182 case FWMgrFWUknown: |
|
183 default: |
|
184 { |
|
185 ret = XA_RESULT_CONTENT_UNSUPPORTED; |
|
186 break; |
|
187 } |
|
188 } |
|
189 |
|
190 if (ret != XA_RESULT_SUCCESS) |
|
191 { /* creation fails */ |
224 XAObjectItfImpl_Destroy((XAObjectItf) &(pBaseObj)); |
192 XAObjectItfImpl_Destroy((XAObjectItf) &(pBaseObj)); |
225 XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaRecorder ); |
193 XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaRecorder ); |
226 DEBUG_API("<-XAMediaRecorderImpl_CreateMediaRecorder"); |
194 DEBUG_API("<-XAMediaRecorderImpl_CreateMediaRecorder"); |
227 return ret; |
195 return ret; |
228 } |
196 } |
|
197 |
|
198 if (pImpl->adaptationCtx) |
|
199 { |
|
200 pImpl->adaptationCtx->capslist = capabilities; |
|
201 pImpl->adaptationCtx->fwtype = fwType; |
|
202 } |
|
203 else |
|
204 { |
|
205 ret = XA_RESULT_MEMORY_FAILURE; |
|
206 XAObjectItfImpl_Destroy((XAObjectItf) &(pBaseObj)); |
|
207 XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaRecorder ); |
|
208 DEBUG_API("<-XAMediaRecorderImpl_CreateMediaRecorder"); |
|
209 return ret; |
|
210 } |
229 |
211 |
230 /* Set ObjectItf to point to newly created object */ |
212 /* Set ObjectItf to point to newly created object */ |
231 *pRecorder = (XAObjectItf) &(pBaseObj->self); |
213 *pRecorder = (XAObjectItf) &(pBaseObj->self); |
232 |
214 |
233 if (fwType == FWMgrFWMMF) |
|
234 { |
|
235 |
|
236 pImpl->adaptationCtx = XAMediaRecorderAdaptMMF_Create( |
|
237 pImpl->audioSrc, pImpl->imageVideoSrc, pImpl->dataSnk, |
|
238 pImpl->recModes); |
|
239 } |
|
240 else |
|
241 { |
|
242 |
|
243 pImpl->adaptationCtx = XAMediaRecorderAdapt_Create(pImpl->audioSrc, |
|
244 pImpl->imageVideoSrc, pImpl->dataSnk, pImpl->recModes); |
|
245 } |
|
246 |
|
247 if (pImpl->adaptationCtx) |
|
248 { |
|
249 pImpl->adaptationCtx->capslist = capabilities; |
|
250 pImpl->adaptationCtx->fwtype = fwType; |
|
251 } |
|
252 else |
|
253 { |
|
254 ret = XA_RESULT_MEMORY_FAILURE; |
|
255 XAObjectItfImpl_Destroy((XAObjectItf) &(pBaseObj)); |
|
256 XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaRecorder ); |
|
257 DEBUG_API("<-XAMediaRecorderImpl_CreateMediaRecorder"); |
|
258 return ret; |
|
259 } |
|
260 |
|
261 XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaRecorder ); |
215 XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaRecorder ); |
262 DEBUG_API("<-XAMediaRecorderImpl_CreateMediaRecorder"); |
216 DEBUG_API("<-XAMediaRecorderImpl_CreateMediaRecorder"); |
263 return XA_RESULT_SUCCESS; |
217 return XA_RESULT_SUCCESS; |
264 } |
218 } |
265 |
219 |
268 */ |
222 */ |
269 XAresult XAMediaRecorderImpl_QueryNumSupportedInterfaces( |
223 XAresult XAMediaRecorderImpl_QueryNumSupportedInterfaces( |
270 XAuint32 *pNumSupportedInterfaces) |
224 XAuint32 *pNumSupportedInterfaces) |
271 { |
225 { |
272 DEBUG_API("->XAMediaRecorderImpl_QueryNumSupportedInterfaces"); |
226 DEBUG_API("->XAMediaRecorderImpl_QueryNumSupportedInterfaces"); |
273 if (pNumSupportedInterfaces) |
227 *pNumSupportedInterfaces = MR_ITFCOUNT; |
274 { |
228 DEBUG_API("<-XAMediaRecorderImpl_QueryNumSupportedInterfaces"); |
275 *pNumSupportedInterfaces = MR_ITFCOUNT; |
229 return XA_RESULT_SUCCESS; |
276 |
230 } |
277 DEBUG_API("<-XAMediaRecorderImpl_QueryNumSupportedInterfaces"); |
231 /* XAResult XAMediaRecorderImpl_QuerySupportedInterfaces |
278 return XA_RESULT_SUCCESS; |
232 * Statically query supported interfaces |
279 } |
233 */ |
280 else |
234 XAresult XAMediaRecorderImpl_QuerySupportedInterfaces(XAuint32 index, |
|
235 XAInterfaceID *pInterfaceId) |
|
236 { |
|
237 DEBUG_API("->XAMediaRecorderImpl_QuerySupportedInterfaces"); |
|
238 if (index >= MR_ITFCOUNT) |
281 { |
239 { |
282 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
240 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
283 return XA_RESULT_PARAMETER_INVALID; |
241 return XA_RESULT_PARAMETER_INVALID; |
284 } |
242 } |
285 } |
|
286 /* XAResult XAMediaRecorderImpl_QuerySupportedInterfaces |
|
287 * Statically query supported interfaces |
|
288 */ |
|
289 XAresult XAMediaRecorderImpl_QuerySupportedInterfaces(XAuint32 index, |
|
290 XAInterfaceID *pInterfaceId) |
|
291 { |
|
292 DEBUG_API("->XAMediaRecorderImpl_QuerySupportedInterfaces"); |
|
293 if (index >= MR_ITFCOUNT || !pInterfaceId) |
|
294 { |
|
295 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
|
296 return XA_RESULT_PARAMETER_INVALID; |
|
297 } |
|
298 else |
243 else |
299 { |
244 { |
300 *pInterfaceId = *(xaMediaRecorderItfIIDs[index]); |
245 *pInterfaceId = *(xaMediaRecorderItfIIDs[index]); |
301 |
|
302 DEBUG_API("<-XAMediaRecorderImpl_QuerySupportedInterfaces"); |
246 DEBUG_API("<-XAMediaRecorderImpl_QuerySupportedInterfaces"); |
303 return XA_RESULT_SUCCESS; |
247 return XA_RESULT_SUCCESS; |
304 } |
248 } |
305 } |
249 } |
306 |
250 |
329 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
273 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
330 /* invalid parameter */ |
274 /* invalid parameter */ |
331 XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaRecorder ); |
275 XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaRecorder ); |
332 return XA_RESULT_PARAMETER_INVALID; |
276 return XA_RESULT_PARAMETER_INVALID; |
333 } |
277 } |
334 |
278 |
335 /* init adaptation */ |
|
336 if (pObjImpl->adaptationCtx->fwtype == FWMgrFWMMF) |
|
337 { |
|
338 ret = XAMediaRecorderAdaptMMF_PostInit( |
|
339 (XAAdaptationMMFCtx*) pObjImpl->adaptationCtx); |
|
340 } |
|
341 else |
|
342 { |
|
343 ret = XAMediaRecorderAdapt_PostInit( |
|
344 (XAAdaptationGstCtx*) pObjImpl->adaptationCtx); |
|
345 } |
|
346 |
|
347 if (ret != XA_RESULT_SUCCESS) |
|
348 { |
|
349 XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaRecorder ); |
|
350 return ret; |
|
351 } |
|
352 |
|
353 /* Realize all implicit and explicitly wanted interfaces */ |
279 /* Realize all implicit and explicitly wanted interfaces */ |
354 for (itfIdx = 0; itfIdx < MR_ITFCOUNT; itfIdx++) |
280 for (itfIdx = 0; itfIdx < MR_ITFCOUNT; itfIdx++) |
355 { |
281 { |
356 if (!(pObj->interfaceMap[itfIdx].pItf) |
282 if (!(pObj->interfaceMap[itfIdx].pItf) |
357 && pObj->interfaceMap[itfIdx].required) |
283 && pObj->interfaceMap[itfIdx].required) |
494 DEBUG_API("<-XAMediaRecorderImpl_FreeResources"); |
412 DEBUG_API("<-XAMediaRecorderImpl_FreeResources"); |
495 XA_IMPL_THREAD_SAFETY_EXIT_FOR_VOID_FUNCTIONS( XATSMediaRecorder ); |
413 XA_IMPL_THREAD_SAFETY_EXIT_FOR_VOID_FUNCTIONS( XATSMediaRecorder ); |
496 return; |
414 return; |
497 } |
415 } |
498 |
416 |
|
417 /* void XARecordItfImpl_AdaptCb |
|
418 * Description: Listen changes in adaptation |
|
419 */ |
|
420 void XAMediaRecorderImpl_AdaptCb(void *pHandlerCtx, XAAdaptEvent *event) |
|
421 { |
|
422 XAObjectItfImpl* impl = (XAObjectItfImpl*) pHandlerCtx; |
|
423 DEBUG_API("->XAMediaRecorderImpl_AdaptCb"); |
|
424 |
|
425 if (!impl) |
|
426 { |
|
427 DEBUG_ERR("XAMediaRecorderImpl_AdaptCb, invalid context pointer!"); |
|
428 DEBUG_API("<-XAMediaRecorderImpl_AdaptCb"); |
|
429 return; |
|
430 } |
|
431 |
|
432 if(impl->callBack) |
|
433 { |
|
434 if(event) |
|
435 { |
|
436 XAObjItfCBData* data = (XAObjItfCBData*)(event->data); |
|
437 if(data->event == XA_OBJECT_EVENT_RESOURCES_LOST ) |
|
438 { |
|
439 impl->state = data->param; |
|
440 } |
|
441 impl->callBack(impl->cbPtrToSelf, impl->context, data->event, data->result, data->param, data->interface); |
|
442 } |
|
443 } |
|
444 |
|
445 DEBUG_API("<-XAMediaRecorderImpl_AdaptCb"); |
|
446 } |
|
447 |
|
448 |
499 /***************************************************************************** |
449 /***************************************************************************** |
500 * MediaRecorderImpl -specific methods |
450 * MediaRecorderImpl -specific methods |
501 *****************************************************************************/ |
451 *****************************************************************************/ |
502 |
452 |
503 /* XAMediaRecorderImpl_DoAddItf |
453 /* XAMediaRecorderImpl_DoAddItf |
504 * Dynamically add an interface, object specific parts |
454 * Dynamically add an interface, object specific parts |
505 */ |
455 */ |
506 XAresult XAMediaRecorderImpl_DoAddItf(XAObjectItf self, |
456 XAresult XAMediaRecorderImpl_DoAddItf(XAObjectItf self, |
507 XAObjItfMapEntry *mapEntry) |
457 XAObjItfMapEntry *mapEntry) |
508 { |
458 { |
509 |
|
510 XAObjectItfImpl* pObj = (XAObjectItfImpl*) (*self); |
|
511 XAMediaRecorderImpl* pImpl = (XAMediaRecorderImpl*) (pObj); |
|
512 |
|
513 XAresult ret = XA_RESULT_SUCCESS; |
459 XAresult ret = XA_RESULT_SUCCESS; |
514 |
460 |
515 DEBUG_API("->XAMediaRecorderImpl_DoAddItf"); |
461 DEBUG_API("->XAMediaRecorderImpl_DoAddItf"); |
516 XA_IMPL_THREAD_SAFETY_ENTRY( XATSMediaRecorder ); |
462 XA_IMPL_THREAD_SAFETY_ENTRY( XATSMediaRecorder ); |
517 |
463 |
518 if (mapEntry) |
464 if (mapEntry) |
519 { |
465 { |
520 switch (mapEntry->mapIdx) |
466 switch (mapEntry->mapIdx) |
521 { |
467 { |
522 |
|
523 case MR_METADATAINSERTIONITF: |
|
524 mapEntry->pItf = XAMetadataInsertionItfImpl_Create(pImpl); |
|
525 break; |
|
526 default: |
468 default: |
527 DEBUG_ERR("XAMediaRecorderImpl_DoAddItf unknown id"); |
469 DEBUG_ERR("XAMediaRecorderImpl_DoAddItf unknown id"); |
528 ret = XA_RESULT_FEATURE_UNSUPPORTED; |
470 ret = XA_RESULT_FEATURE_UNSUPPORTED; |
529 break; |
471 break; |
530 } |
472 } |