author | hgs |
Tue, 21 Sep 2010 11:38:43 -0500 | |
changeset 53 | eabc8c503852 |
parent 43 | 9894ed580e4a |
permissions | -rw-r--r-- |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1 |
/* |
25 | 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: MediaRecoder Object Impl |
|
15 |
* |
|
16 |
*/ |
|
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
17 |
|
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
18 |
#include <stdio.h> |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
19 |
#include <stdlib.h> |
53 | 20 |
#include <string.h> |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
21 |
#include "xamediarecorder.h" |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
22 |
#include "xaaudioencoderitf.h" |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
23 |
#include "xadynintmgmtitf.h" |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
24 |
#include "xarecorditf.h" |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
25 |
#include "xathreadsafety.h" |
19 | 26 |
#include "xacapabilitiesmgr.h" |
27 |
#include "xamediarecorderadaptctxmmf.h" |
|
28 |
#include "xamediarecorderadaptctx.h" |
|
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
29 |
/* Static mapping of enumeration XAMediaRecorderInterfaces to interface iids */ |
25 | 30 |
static const XAInterfaceID* xaMediaRecorderItfIIDs[MR_ITFCOUNT] = |
31 |
{ |
|
33 | 32 |
&XA_IID_OBJECT, |
33 |
&XA_IID_AUDIOENCODER, |
|
34 |
&XA_IID_DYNAMICINTERFACEMANAGEMENT, |
|
53 | 35 |
&XA_IID_RECORD |
25 | 36 |
}; |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
37 |
|
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
38 |
/* Global methods */ |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
39 |
|
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
40 |
/* XAResult XAMediaRecorderImpl_Create |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
41 |
* Create object |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
42 |
*/ |
19 | 43 |
XAresult XAMediaRecorderImpl_CreateMediaRecorder(FrameworkMap* mapper, |
25 | 44 |
XACapabilities* capabilities, XAObjectItf* pRecorder, |
45 |
XADataSource* pAudioSrc, XADataSource* pImageVideoSrc, |
|
46 |
XADataSink* pDataSnk, XAuint32 numInterfaces, |
|
47 |
const XAInterfaceID *pInterfaceIds, |
|
48 |
const XAboolean *pInterfaceRequired) |
|
49 |
{ |
|
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
50 |
XAMediaRecorderImpl* pImpl = NULL; |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
51 |
XAObjectItfImpl* pBaseObj = NULL; |
19 | 52 |
FWMgrFwType fwType; |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
53 |
XAuint8 itfIdx; |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
54 |
XAMediaType mediaType = XA_MEDIATYPE_UNKNOWN; |
25 | 55 |
XAresult ret = XA_RESULT_SUCCESS; |
19 | 56 |
const char *uri = NULL; |
25 | 57 |
|
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
58 |
DEBUG_API("->XAMediaRecorderImpl_CreateMediaRecorder"); |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
59 |
XA_IMPL_THREAD_SAFETY_ENTRY( XATSMediaRecorder ); |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
60 |
|
53 | 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) |
|
25 | 75 |
{ |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
76 |
/* invalid parameter */ |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
77 |
XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaRecorder ); |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
78 |
DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
79 |
DEBUG_API("<-XAMediaRecorderImpl_CreateMediaRecorder"); |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
80 |
return XA_RESULT_PARAMETER_INVALID; |
25 | 81 |
} |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
82 |
|
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
83 |
/* instantiate object implementation */ |
25 | 84 |
pImpl = (XAMediaRecorderImpl*) calloc(1, sizeof(XAMediaRecorderImpl)); |
85 |
if (!pImpl) |
|
86 |
{ |
|
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
87 |
/* memory allocation failed */ |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
88 |
XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaRecorder ); |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
89 |
DEBUG_ERR("XA_RESULT_MEMORY_FAILURE"); |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
90 |
DEBUG_API("<-XAMediaRecorderImpl_CreateMediaRecorder"); |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
91 |
return XA_RESULT_MEMORY_FAILURE; |
25 | 92 |
} |
53 | 93 |
|
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
94 |
pBaseObj = &pImpl->baseObj; |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
95 |
|
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
96 |
/* Initialize base object default implementation */ |
25 | 97 |
XAObjectItfImpl_Init(pBaseObj, MR_ITFCOUNT, xaMediaRecorderItfIIDs, |
98 |
XAMediaRecorderImpl_DoRealize, XAMediaRecorderImpl_DoResume, |
|
99 |
XAMediaRecorderImpl_FreeResources); |
|
53 | 100 |
|
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
101 |
/* Mark interfaces that need to be exposed */ |
53 | 102 |
/* Mandated Implicit interfaces */ |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
103 |
pBaseObj->interfaceMap[MR_DIMITF].required = XA_BOOLEAN_TRUE; |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
104 |
|
53 | 105 |
/* Mark interfaces that can be handled dynamically */ |
106 |
/* Mandated dynamic itfs */ |
|
107 |
||
108 |
/*Mandated Explicit interfaces */ |
|
25 | 109 |
if ((numInterfaces != 0) && pInterfaceIds && pInterfaceRequired) |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
110 |
{ |
25 | 111 |
/* Check required interfaces */ |
112 |
for (itfIdx = 0; itfIdx < numInterfaces; itfIdx++) |
|
113 |
{ |
|
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
114 |
/* If mapEntry is null then required interface is not supported.*/ |
25 | 115 |
XAObjItfMapEntry *entry = XAObjectItfImpl_GetItfEntry( |
116 |
(XAObjectItf) &(pBaseObj), pInterfaceIds[itfIdx]); |
|
117 |
if (!entry) |
|
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
118 |
{ |
25 | 119 |
if (pInterfaceRequired[itfIdx]) |
120 |
{ |
|
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
121 |
/* required interface cannot be accommodated - fail creation */ |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
122 |
DEBUG_ERR("Required interface not found - abort creation!"); |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
123 |
ret = XA_RESULT_FEATURE_UNSUPPORTED; |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
124 |
break; |
25 | 125 |
} |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
126 |
else |
25 | 127 |
{ |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
128 |
DEBUG_INFO("Requested (not required) interface not found - continue creation"); |
25 | 129 |
} |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
130 |
} |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
131 |
else |
53 | 132 |
{ |
133 |
entry->required = XA_BOOLEAN_TRUE; |
|
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
134 |
} |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
135 |
} |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
136 |
} |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
137 |
|
25 | 138 |
if (ret != XA_RESULT_SUCCESS) |
139 |
{ /* creation fails */ |
|
140 |
XAObjectItfImpl_Destroy((XAObjectItf) &(pBaseObj)); |
|
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
141 |
XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaRecorder ); |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
142 |
DEBUG_API("<-XAMediaRecorderImpl_CreateMediaRecorder"); |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
143 |
return ret; |
25 | 144 |
} |
53 | 145 |
|
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
146 |
/* Initialize XAMediaRecorderImpl variables */ |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
147 |
pImpl->audioSrc = pAudioSrc; |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
148 |
pImpl->dataSnk = pDataSnk; |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
149 |
pImpl->imageVideoSrc = pImageVideoSrc; |
53 | 150 |
pImpl->recModes |= XA_RECMODE_STREAM; |
151 |
||
19 | 152 |
/* Determine framework type that can handle recording */ |
25 | 153 |
fwType = (FWMgrFwType) FWMgrMOUnknown; |
19 | 154 |
/**/ |
53 | 155 |
if (pDataSnk->pLocator) |
25 | 156 |
{ |
157 |
XADataLocator_URI* dataLoc = (XADataLocator_URI*) pDataSnk->pLocator; |
|
19 | 158 |
if (dataLoc->locatorType == XA_DATALOCATOR_URI) |
159 |
{ |
|
25 | 160 |
uri = (char*) dataLoc->URI; |
19 | 161 |
} |
25 | 162 |
} |
53 | 163 |
|
25 | 164 |
fwType = XAFrameworkMgr_GetFramework(mapper, uri, FWMgrMORecorder); |
19 | 165 |
|
53 | 166 |
switch(fwType) |
19 | 167 |
{ |
53 | 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 */ |
|
25 | 192 |
XAObjectItfImpl_Destroy((XAObjectItf) &(pBaseObj)); |
19 | 193 |
XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaRecorder ); |
194 |
DEBUG_API("<-XAMediaRecorderImpl_CreateMediaRecorder"); |
|
195 |
return ret; |
|
196 |
} |
|
53 | 197 |
|
25 | 198 |
if (pImpl->adaptationCtx) |
19 | 199 |
{ |
200 |
pImpl->adaptationCtx->capslist = capabilities; |
|
201 |
pImpl->adaptationCtx->fwtype = fwType; |
|
202 |
} |
|
203 |
else |
|
204 |
{ |
|
205 |
ret = XA_RESULT_MEMORY_FAILURE; |
|
25 | 206 |
XAObjectItfImpl_Destroy((XAObjectItf) &(pBaseObj)); |
19 | 207 |
XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaRecorder ); |
208 |
DEBUG_API("<-XAMediaRecorderImpl_CreateMediaRecorder"); |
|
209 |
return ret; |
|
210 |
} |
|
25 | 211 |
|
53 | 212 |
/* Set ObjectItf to point to newly created object */ |
213 |
*pRecorder = (XAObjectItf) &(pBaseObj->self); |
|
214 |
||
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
215 |
XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaRecorder ); |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
216 |
DEBUG_API("<-XAMediaRecorderImpl_CreateMediaRecorder"); |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
217 |
return XA_RESULT_SUCCESS; |
25 | 218 |
} |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
219 |
|
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
220 |
/* XAResult XAMediaRecorderImpl_QueryNumSupportedInterfaces |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
221 |
* Statically query supported interfaces |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
222 |
*/ |
25 | 223 |
XAresult XAMediaRecorderImpl_QueryNumSupportedInterfaces( |
224 |
XAuint32 *pNumSupportedInterfaces) |
|
225 |
{ |
|
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
226 |
DEBUG_API("->XAMediaRecorderImpl_QueryNumSupportedInterfaces"); |
53 | 227 |
*pNumSupportedInterfaces = MR_ITFCOUNT; |
228 |
DEBUG_API("<-XAMediaRecorderImpl_QueryNumSupportedInterfaces"); |
|
229 |
return XA_RESULT_SUCCESS; |
|
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
230 |
} |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
231 |
/* XAResult XAMediaRecorderImpl_QuerySupportedInterfaces |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
232 |
* Statically query supported interfaces |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
233 |
*/ |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
234 |
XAresult XAMediaRecorderImpl_QuerySupportedInterfaces(XAuint32 index, |
25 | 235 |
XAInterfaceID *pInterfaceId) |
236 |
{ |
|
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
237 |
DEBUG_API("->XAMediaRecorderImpl_QuerySupportedInterfaces"); |
53 | 238 |
if (index >= MR_ITFCOUNT) |
25 | 239 |
{ |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
240 |
DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
241 |
return XA_RESULT_PARAMETER_INVALID; |
25 | 242 |
} |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
243 |
else |
25 | 244 |
{ |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
245 |
*pInterfaceId = *(xaMediaRecorderItfIIDs[index]); |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
246 |
DEBUG_API("<-XAMediaRecorderImpl_QuerySupportedInterfaces"); |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
247 |
return XA_RESULT_SUCCESS; |
25 | 248 |
} |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
249 |
} |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
250 |
|
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
251 |
/***************************************************************************** |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
252 |
* base object XAObjectItfImpl methods |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
253 |
*****************************************************************************/ |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
254 |
|
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
255 |
/* XAresult XAMediaRecorderImpl_DoRealize( XAObjectItf self ) |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
256 |
* Description: Realize all implicit and explicitly wanted interfaces. |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
257 |
* Create and initialize implementation-specific variables. |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
258 |
* Called from base object XAObjectItfImpl |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
259 |
*/ |
25 | 260 |
XAresult XAMediaRecorderImpl_DoRealize(XAObjectItf self) |
261 |
{ |
|
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
262 |
XAuint8 itfIdx; |
25 | 263 |
XAObjectItfImpl* pObj = (XAObjectItfImpl*) (*self); |
264 |
XAMediaRecorderImpl* pObjImpl = (XAMediaRecorderImpl*) (pObj); |
|
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
265 |
XAresult ret = XA_RESULT_SUCCESS; |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
266 |
|
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
267 |
DEBUG_API("->XAMediaRecorderImpl_DoRealize"); |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
268 |
XA_IMPL_THREAD_SAFETY_ENTRY( XATSMediaRecorder ); |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
269 |
|
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
270 |
/* check casting from correct pointer type */ |
25 | 271 |
if (!pObjImpl || pObj != pObjImpl->baseObj.self) |
272 |
{ |
|
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
273 |
DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
274 |
/* invalid parameter */ |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
275 |
XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaRecorder ); |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
276 |
return XA_RESULT_PARAMETER_INVALID; |
25 | 277 |
} |
53 | 278 |
|
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
279 |
/* Realize all implicit and explicitly wanted interfaces */ |
25 | 280 |
for (itfIdx = 0; itfIdx < MR_ITFCOUNT; itfIdx++) |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
281 |
{ |
25 | 282 |
if (!(pObj->interfaceMap[itfIdx].pItf) |
283 |
&& pObj->interfaceMap[itfIdx].required) |
|
284 |
{ |
|
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
285 |
void *pItf = NULL; |
25 | 286 |
switch (itfIdx) |
287 |
{ |
|
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
288 |
case MR_DIMITF: |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
289 |
pItf = XADIMItfImpl_Create(); |
25 | 290 |
if (pItf) |
291 |
{ |
|
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
292 |
XADIMItfImpl_Init(pItf, self, |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
293 |
XAMediaRecorderImpl_DoAddItf, |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
294 |
XAMediaRecorderImpl_DoResumeItf, |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
295 |
XAMediaRecorderImpl_DoRemoveItf); |
25 | 296 |
} |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
297 |
break; |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
298 |
case MR_RECORDITF: |
25 | 299 |
pItf = XARecordItfImpl_Create(pObjImpl); |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
300 |
break; |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
301 |
case MR_AUDIOENCODERITF: |
19 | 302 |
pItf = XAAudioEncoderItfImpl_Create(pObjImpl); |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
303 |
break; |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
304 |
default: |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
305 |
break; |
25 | 306 |
} |
307 |
if (!pItf) |
|
308 |
{ |
|
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
309 |
DEBUG_ERR("XA_RESULT_MEMORY_FAILURE"); |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
310 |
/* memory allocation failed */ |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
311 |
XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaRecorder ); |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
312 |
return XA_RESULT_MEMORY_FAILURE; |
25 | 313 |
} |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
314 |
else |
25 | 315 |
{ |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
316 |
pObj->interfaceMap[itfIdx].pItf = pItf; |
25 | 317 |
} |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
318 |
} |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
319 |
} |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
320 |
|
53 | 321 |
/* init adaptation */ |
322 |
if (pObjImpl->adaptationCtx->fwtype == FWMgrFWMMF) |
|
323 |
{ |
|
324 |
ret = XAMediaRecorderAdaptMMF_PostInit( |
|
325 |
(XAAdaptationMMFCtx*) pObjImpl->adaptationCtx); |
|
326 |
} |
|
327 |
else |
|
328 |
{ |
|
329 |
ret = XAMediaRecorderAdapt_PostInit( |
|
330 |
(XAAdaptationGstCtx*) pObjImpl->adaptationCtx); |
|
331 |
} |
|
332 |
||
333 |
if (ret != XA_RESULT_SUCCESS) |
|
334 |
{ |
|
335 |
XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaRecorder ); |
|
336 |
return ret; |
|
337 |
} |
|
338 |
||
339 |
XAAdaptationBase_AddEventHandler(pObjImpl->adaptationCtx, |
|
340 |
&XAMediaRecorderImpl_AdaptCb, XA_OBJECTITFEVENTS, pObjImpl); |
|
341 |
||
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
342 |
pObj->state = XA_OBJECT_STATE_REALIZED; |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
343 |
DEBUG_API("<-XAMediaRecorderImpl_DoRealize"); |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
344 |
XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaRecorder ); |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
345 |
return XA_RESULT_SUCCESS; |
25 | 346 |
} |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
347 |
|
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
348 |
/* XAresult XAMediaRecorderImpl_DoResume |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
349 |
* Description: Resume object from suspended state |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
350 |
*/ |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
351 |
XAresult XAMediaRecorderImpl_DoResume(XAObjectItf self) |
25 | 352 |
{ |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
353 |
DEBUG_API("->XAMediaRecorderImpl_DoResume"); |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
354 |
DEBUG_API("<-XAMediaRecorderImpl_DoResume"); |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
355 |
/* This implementation does not support suspended state */ |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
356 |
return XA_RESULT_PRECONDITIONS_VIOLATED; |
25 | 357 |
} |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
358 |
|
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
359 |
/* void XAMediaRecorderImpl_FreeResources |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
360 |
* Description: Free all resources reserved at XAMediaRecorderImpl_DoRealize() |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
361 |
*/ |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
362 |
void XAMediaRecorderImpl_FreeResources(XAObjectItf self) |
25 | 363 |
{ |
364 |
XAObjectItfImpl* pObj = (XAObjectItfImpl*) (*self); |
|
365 |
XAMediaRecorderImpl* pObjImpl = (XAMediaRecorderImpl*) (pObj); |
|
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
366 |
XAuint8 itfIdx; |
25 | 367 |
XAMediaRecorderImpl* pImpl = (XAMediaRecorderImpl*) (*self); |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
368 |
DEBUG_API("->XAMediaRecorderImpl_FreeResources"); |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
369 |
XA_IMPL_THREAD_SAFETY_ENTRY_FOR_VOID_FUNCTIONS( XATSMediaRecorder ); |
19 | 370 |
|
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
371 |
/* free all allocated interfaces */ |
25 | 372 |
for (itfIdx = 0; itfIdx < MR_ITFCOUNT; itfIdx++) |
373 |
{ |
|
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
374 |
void *pItf = pObj->interfaceMap[itfIdx].pItf; |
25 | 375 |
if (pItf) |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
376 |
{ |
25 | 377 |
switch (itfIdx) |
378 |
{ |
|
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
379 |
case MR_AUDIOENCODERITF: |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
380 |
XAAudioEncoderItfImpl_Free(pItf); |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
381 |
break; |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
382 |
case MR_DIMITF: |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
383 |
XADIMItfImpl_Free(pItf); |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
384 |
break; |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
385 |
case MR_RECORDITF: |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
386 |
XARecordItfImpl_Free(pItf); |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
387 |
break; |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
388 |
default: |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
389 |
break; |
25 | 390 |
} |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
391 |
pObj->interfaceMap[itfIdx].pItf = NULL; |
25 | 392 |
} |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
393 |
} |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
394 |
|
25 | 395 |
if (pImpl->adaptationCtx != NULL) |
396 |
{ |
|
397 |
if (pImpl->adaptationCtx->fwtype == FWMgrFWMMF) |
|
19 | 398 |
{ |
25 | 399 |
XAMediaRecorderAdaptMMF_Destroy( |
400 |
(XAAdaptationMMFCtx*) pObjImpl->adaptationCtx); |
|
19 | 401 |
} |
402 |
else |
|
403 |
{ |
|
25 | 404 |
XAMediaRecorderAdapt_Destroy( |
405 |
(XAAdaptationGstCtx*) pImpl->adaptationCtx); |
|
19 | 406 |
} |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
407 |
pImpl->adaptationCtx = NULL; |
25 | 408 |
} |
19 | 409 |
|
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
410 |
/* free all other allocated resources*/ |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
411 |
|
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
412 |
DEBUG_API("<-XAMediaRecorderImpl_FreeResources"); |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
413 |
XA_IMPL_THREAD_SAFETY_EXIT_FOR_VOID_FUNCTIONS( XATSMediaRecorder ); |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
414 |
return; |
25 | 415 |
} |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
416 |
|
53 | 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 |
||
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
449 |
/***************************************************************************** |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
450 |
* MediaRecorderImpl -specific methods |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
451 |
*****************************************************************************/ |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
452 |
|
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
453 |
/* XAMediaRecorderImpl_DoAddItf |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
454 |
* Dynamically add an interface, object specific parts |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
455 |
*/ |
25 | 456 |
XAresult XAMediaRecorderImpl_DoAddItf(XAObjectItf self, |
457 |
XAObjItfMapEntry *mapEntry) |
|
458 |
{ |
|
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
459 |
XAresult ret = XA_RESULT_SUCCESS; |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
460 |
|
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
461 |
DEBUG_API("->XAMediaRecorderImpl_DoAddItf"); |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
462 |
XA_IMPL_THREAD_SAFETY_ENTRY( XATSMediaRecorder ); |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
463 |
|
25 | 464 |
if (mapEntry) |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
465 |
{ |
25 | 466 |
switch (mapEntry->mapIdx) |
467 |
{ |
|
468 |
default: |
|
33 | 469 |
DEBUG_ERR("XAMediaRecorderImpl_DoAddItf unknown id"); |
25 | 470 |
ret = XA_RESULT_FEATURE_UNSUPPORTED; |
471 |
break; |
|
472 |
} |
|
473 |
||
474 |
if (!mapEntry->pItf && ret == XA_RESULT_SUCCESS) |
|
475 |
{ |
|
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
476 |
DEBUG_ERR("XAMediaRecorderImpl_DoAddItf itf creation failed"); |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
477 |
ret = XA_RESULT_MEMORY_FAILURE; |
25 | 478 |
} |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
479 |
} |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
480 |
else |
25 | 481 |
{ |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
482 |
ret = XA_RESULT_PARAMETER_INVALID; |
25 | 483 |
} |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
484 |
|
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
485 |
XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaRecorder ); |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
486 |
DEBUG_API("<-XAMediaRecorderImpl_DoAddItf"); |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
487 |
return ret; |
25 | 488 |
} |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
489 |
|
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
490 |
/* XAMediaRecorderImpl_DoResumeItf |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
491 |
* Try to resume lost interface, object specific parts |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
492 |
*/ |
25 | 493 |
XAresult XAMediaRecorderImpl_DoResumeItf(XAObjectItf self, |
494 |
XAObjItfMapEntry *mapEntry) |
|
495 |
{ |
|
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
496 |
XAresult ret; |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
497 |
/* For now, no difference between suspended and unrealised itfs */ |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
498 |
DEBUG_API("->XAMediaRecorderImpl_DoResumeItf"); |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
499 |
XA_IMPL_THREAD_SAFETY_ENTRY( XATSMediaRecorder ); |
25 | 500 |
ret = XAMediaRecorderImpl_DoAddItf(self, mapEntry); |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
501 |
XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaRecorder ); |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
502 |
DEBUG_API("<-XAMediaRecorderImpl_DoResumeItf"); |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
503 |
return ret; |
25 | 504 |
} |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
505 |
|
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
506 |
/* XAMediaRecorderImpl_DoRemoveItf |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
507 |
* Dynamically remove an interface, object specific parts |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
508 |
*/ |
25 | 509 |
XAresult XAMediaRecorderImpl_DoRemoveItf(XAObjectItf self, |
510 |
XAObjItfMapEntry *mapEntry) |
|
511 |
{ |
|
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
512 |
XAresult ret = XA_RESULT_SUCCESS; |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
513 |
DEBUG_API("->XAMediaRecorderImpl_DoRemoveItf"); |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
514 |
XA_IMPL_THREAD_SAFETY_ENTRY( XATSMediaRecorder ); |
25 | 515 |
if (mapEntry) |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
516 |
{ |
25 | 517 |
switch (mapEntry->mapIdx) |
518 |
{ |
|
519 |
default: |
|
33 | 520 |
DEBUG_ERR("XAMediaRecorderImpl_DoRemoveItf unknown id"); |
25 | 521 |
ret = XA_RESULT_FEATURE_UNSUPPORTED; |
522 |
break; |
|
523 |
} |
|
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
524 |
mapEntry->pItf = NULL; |
25 | 525 |
} |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
526 |
else |
25 | 527 |
{ |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
528 |
ret = XA_RESULT_PARAMETER_INVALID; |
25 | 529 |
} |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
530 |
|
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
531 |
XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaRecorder ); |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
532 |
DEBUG_API("<-XAMediaRecorderImpl_DoRemoveItf"); |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
533 |
return ret; |
25 | 534 |
} |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
535 |
|
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
536 |
/* END OF FILE */ |