changeset 31 | 8dfd592727cb |
parent 22 | 128eb6a32b84 |
child 32 | 94fc26b6e006 |
22:128eb6a32b84 | 31:8dfd592727cb |
---|---|
1 /* |
1 /* |
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of "Eclipse Public License v1.0" |
5 * under the terms of "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
8 * |
8 * |
9 * Initial Contributors: |
9 * Initial Contributors: |
10 * Nokia Corporation - initial contribution. |
10 * Nokia Corporation - initial contribution. |
11 * |
11 * |
12 * Contributors: |
12 * Contributors: |
13 * |
13 * |
14 * Description: |
14 * Description: |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 #include "cmmfbackendengine.h" |
|
19 #include <string.h> |
18 #include <string.h> |
20 #include <ctype.h> |
19 #include <ctype.h> |
21 #include <uri8.h> |
20 #include <uri8.h> |
22 #include <uri16.h> |
21 #include <uri16.h> |
22 #include "cmmfbackendengine.h" |
|
23 #include "markerpositiontimer.h" |
23 #include "markerpositiontimer.h" |
24 #include "positionupdatetimer.h" |
24 #include "positionupdatetimer.h" |
25 #include "profileutilmacro.h" |
25 #include "profileutilmacro.h" |
26 |
26 |
27 extern "C" { |
27 extern "C" |
28 { |
|
28 #include "xaadaptationmmf.h" |
29 #include "xaadaptationmmf.h" |
29 } |
30 } |
30 |
31 |
31 #define RET_IF_ERR(res, val) if (res != KErrNone) return val |
32 #define RET_IF_ERR(res, val) if (res != KErrNone) return val |
32 |
33 |
33 const XAuint32 XA_PLAYSTATE_PLAYERUNINITIALIZED = 0; |
34 const XAuint32 XA_PLAYSTATE_PLAYERUNINITIALIZED = 0; |
34 |
35 |
45 { |
46 { |
46 Close(); |
47 Close(); |
47 Destroy(); |
48 Destroy(); |
48 } |
49 } |
49 |
50 |
50 CMMFBackendEngine::CMMFBackendEngine() |
51 CMMFBackendEngine::CMMFBackendEngine() : |
51 :iPositionUpdatePeriod(1000), /* default is 1000 millisec */ |
52 iPositionUpdatePeriod(1000), /* default is 1000 millisec */ |
52 iUriPtr(NULL,0) |
53 iUriPtr(NULL, 0) |
53 { |
54 { |
54 /* m_bWindowReferencePassed = FALSE;*/ |
|
55 iRecordState = ERecorderNotReady; |
55 iRecordState = ERecorderNotReady; |
56 iPositionUpdateTimer = NULL; |
56 iPositionUpdateTimer = NULL; |
57 iMediaPlayerState = XA_PLAYSTATE_PLAYERUNINITIALIZED; |
57 iMediaPlayerState = XA_PLAYSTATE_PLAYERUNINITIALIZED; |
58 iMMFPlayerState = EPlayerClosed; |
58 iMMFPlayerState = EPlayerClosed; |
59 } |
59 } |
67 void CMMFBackendEngine::InitAudioRecorderUtilityL() |
67 void CMMFBackendEngine::InitAudioRecorderUtilityL() |
68 { |
68 { |
69 if (!iAudioRecorder) |
69 if (!iAudioRecorder) |
70 { |
70 { |
71 iBaseAudioRecorder = CMdaAudioRecorderUtility::NewL(*this); |
71 iBaseAudioRecorder = CMdaAudioRecorderUtility::NewL(*this); |
72 iAudioRecorder = (CMdaAudioRecorderUtility*)iBaseAudioRecorder; |
72 iAudioRecorder = (CMdaAudioRecorderUtility*) iBaseAudioRecorder; |
73 } |
73 } |
74 } |
74 } |
75 |
75 |
76 void CMMFBackendEngine::InitAudioPlayerUtilityL() |
76 void CMMFBackendEngine::InitAudioPlayerUtilityL() |
77 { |
77 { |
78 if (!iAudioPlayer) |
78 if (!iAudioPlayer) |
79 { |
79 { |
80 iBaseAudioPlayer = CMdaAudioPlayerUtility::NewL(*this); |
80 iBaseAudioPlayer = CMdaAudioPlayerUtility::NewL(*this); |
81 iAudioPlayer = (CMdaAudioPlayerUtility*)iBaseAudioPlayer; |
81 iAudioPlayer = (CMdaAudioPlayerUtility*) iBaseAudioPlayer; |
82 } |
82 } |
83 InitPlayerTimersL(); |
83 InitPlayerTimersL(); |
84 } |
84 } |
85 |
85 |
86 void CMMFBackendEngine::InitVideoPlayerUtilityL() |
86 void CMMFBackendEngine::InitVideoPlayerUtilityL() |
87 { |
87 { |
88 if (!iVideoPlayer) |
88 if (!iVideoPlayer) |
89 { |
89 { |
90 iBaseVideoPlayer = CVideoPlayerUtility2::NewL(*this, EMdaPriorityNormal, EMdaPriorityPreferenceTimeAndQuality); |
90 iBaseVideoPlayer = CVideoPlayerUtility2::NewL(*this, |
91 iVideoPlayer = (CVideoPlayerUtility2*)iBaseVideoPlayer; |
91 EMdaPriorityNormal, EMdaPriorityPreferenceTimeAndQuality); |
92 iVideoPlayer = (CVideoPlayerUtility2*) iBaseVideoPlayer; |
|
92 iVideoPlayer->RegisterForVideoLoadingNotification(*this); |
93 iVideoPlayer->RegisterForVideoLoadingNotification(*this); |
93 } |
94 } |
94 InitPlayerTimersL(); |
95 InitPlayerTimersL(); |
95 } |
96 } |
96 |
97 |
97 void CMMFBackendEngine::InitPlayerTimersL() |
98 void CMMFBackendEngine::InitPlayerTimersL() |
98 { |
99 { |
99 if (!iMarkerPositionTimer) |
100 if (!iMarkerPositionTimer) |
100 { |
101 { |
101 iMarkerPositionTimer = CMarkerPositionTimer::NewL(iAudioPlayer, iVideoPlayer); |
102 iMarkerPositionTimer = CMarkerPositionTimer::NewL(iAudioPlayer, |
103 iVideoPlayer); |
|
102 iMarkerPositionTimer->SetContext(iAdaptContext); |
104 iMarkerPositionTimer->SetContext(iAdaptContext); |
103 } |
105 } |
104 if (!iPlayItfPositionUpdateTimer) |
106 if (!iPlayItfPositionUpdateTimer) |
105 { |
107 { |
106 iPlayItfPositionUpdateTimer = CPositionUpdateTimer::NewL(iAudioPlayer, iVideoPlayer); |
108 iPlayItfPositionUpdateTimer = CPositionUpdateTimer::NewL( |
109 iAudioPlayer, iVideoPlayer); |
|
107 iPlayItfPositionUpdateTimer->SetContext(iAdaptContext); |
110 iPlayItfPositionUpdateTimer->SetContext(iAdaptContext); |
108 } |
111 } |
109 iMarkerPositionTimer->Stop(); |
112 iMarkerPositionTimer->Stop(); |
110 iPlayItfPositionUpdateTimer->Stop(); |
113 iPlayItfPositionUpdateTimer->Stop(); |
111 } |
114 } |
112 |
115 |
113 TInt CMMFBackendEngine::SetFileName(char* uri, XAuint32 format, TFuncInUse func) |
116 TInt CMMFBackendEngine::SetFileName(char* uri, XAuint32 format, |
117 TFuncInUse func) |
|
114 { |
118 { |
115 TInt err(KErrNone); |
119 TInt err(KErrNone); |
116 _LIT8(KFileSlash,"file:///"); |
120 _LIT8(KFileSlash,"file:///"); |
117 TInt fileslashlen = KFileSlash().Length(); |
121 TInt fileslashlen = KFileSlash().Length(); |
118 if (func == ERecord) |
122 if (func == ERecord) |
119 { |
123 { |
120 if (iRecordState == ERecorderNotReady) |
124 if (iRecordState == ERecorderNotReady) |
121 { |
125 { |
122 iFileFormat = format; |
126 iFileFormat = format; |
123 iAPIBeingUsed = DetermineAPIToUse(uri, EPlay); |
127 iAPIBeingUsed = DetermineAPIToUse(uri, ERecord); |
124 err = XA_RESULT_INTERNAL_ERROR; |
128 err = XA_RESULT_INTERNAL_ERROR; |
125 if (iAPIBeingUsed == EAudioRecorderUtility) |
129 if (iAPIBeingUsed == EAudioRecorderUtility) |
126 { |
130 { |
127 /* Initialize URI as needed by MMF utilities */ |
131 /* Initialize URI as needed by MMF utilities */ |
128 err = InitializeURIForMMFUtil(uri); |
132 err = InitializeURIForMMFUtil(uri); |
129 RET_IF_ERR(err, XA_RESULT_INTERNAL_ERROR); |
133 RET_IF_ERR(err, XA_RESULT_INTERNAL_ERROR); |
130 /* Initalize Recorder related objects */ |
134 /* Initalize Recorder related objects */ |
131 TRAP(err, InitAudioRecorderUtilityL()); |
135 TRAP(err, InitAudioRecorderUtilityL()); |
132 RET_IF_ERR(err, XA_RESULT_INTERNAL_ERROR); |
136 RET_IF_ERR(err, XA_RESULT_INTERNAL_ERROR); |
133 |
137 |
134 TRAP(err, iAudioRecorder->OpenFileL(iFileName)); |
138 TRAP(err, iAudioRecorder->OpenFileL(iUriPtr)); |
135 RET_IF_ERR(err, XA_RESULT_INTERNAL_ERROR); |
139 RET_IF_ERR(err, XA_RESULT_INTERNAL_ERROR); |
136 /* Wait until we receive moscostatechanged callback */ |
140 /* Wait until we receive moscostatechanged callback */ |
137 if(!iActiveSchedulerWait->IsStarted()) |
141 if (iActiveSchedulerWait && !iActiveSchedulerWait->IsStarted()) |
138 { |
142 { |
139 iActiveSchedulerWait->Start(); |
143 iActiveSchedulerWait->Start(); |
140 } |
144 } |
141 RET_IF_ERR(iErrorCode, XA_RESULT_INTERNAL_ERROR); |
145 RET_IF_ERR(iErrorCode, XA_RESULT_INTERNAL_ERROR); |
142 } |
146 } |
143 } |
147 } |
144 } |
148 } |
145 else |
149 else |
146 { |
150 { |
147 /* The second one is needed for dynamic source interface */ |
151 /* The second one is needed for dynamic source interface */ |
148 if ((iMediaPlayerState == XA_PLAYSTATE_PLAYERUNINITIALIZED) || |
152 if ((iMediaPlayerState == XA_PLAYSTATE_PLAYERUNINITIALIZED) |
149 (iMediaPlayerState == XA_PLAYSTATE_STOPPED)) |
153 || (iMediaPlayerState == XA_PLAYSTATE_STOPPED)) |
150 { |
154 { |
151 iFileFormat = format; |
155 iFileFormat = format; |
152 iAPIBeingUsed = DetermineAPIToUse(uri, EPlay); |
156 iAPIBeingUsed = DetermineAPIToUse(uri, EPlay); |
153 err = XA_RESULT_INTERNAL_ERROR; |
157 err = XA_RESULT_INTERNAL_ERROR; |
154 if (iAPIBeingUsed == EAudioPlayerUtility) |
158 if (iAPIBeingUsed == EAudioPlayerUtility) |
160 TRAP(err, InitAudioPlayerUtilityL()); |
164 TRAP(err, InitAudioPlayerUtilityL()); |
161 RET_IF_ERR(err, XA_RESULT_INTERNAL_ERROR); |
165 RET_IF_ERR(err, XA_RESULT_INTERNAL_ERROR); |
162 |
166 |
163 TAG_TIME_PROFILING_BEGIN; |
167 TAG_TIME_PROFILING_BEGIN; |
164 TRAP(err, iAudioPlayer->OpenFileL(iUriPtr)); |
168 TRAP(err, iAudioPlayer->OpenFileL(iUriPtr)); |
165 RET_IF_ERR(err, XA_RESULT_INTERNAL_ERROR); |
169 RET_IF_ERR(err, XA_RESULT_INTERNAL_ERROR); |
166 TAG_TIME_PROFILING_END; |
170 TAG_TIME_PROFILING_END; |
167 PRINT_TO_CONSOLE_TIME_DIFF; |
171 PRINT_TO_CONSOLE_TIME_DIFF; |
168 |
172 |
169 /* Wait until we receive mapc init complete */ |
173 /* Wait until we receive mapc init complete */ |
170 PRINT_TO_CONSOLE_HOME_TIME; |
174 PRINT_TO_CONSOLE_HOME_TIME; |
171 if (!iActiveSchedulerWait->IsStarted()) |
175 if (iActiveSchedulerWait && !iActiveSchedulerWait->IsStarted()) |
172 { |
176 { |
173 iActiveSchedulerWait->Start(); |
177 iActiveSchedulerWait->Start(); |
174 } |
178 } |
175 RET_IF_ERR(iErrorCode, XA_RESULT_INTERNAL_ERROR); |
179 RET_IF_ERR(iErrorCode, XA_RESULT_INTERNAL_ERROR); |
176 } |
180 } |
181 RET_IF_ERR(err, XA_RESULT_INTERNAL_ERROR); |
185 RET_IF_ERR(err, XA_RESULT_INTERNAL_ERROR); |
182 /* Initalize Player related objects */ |
186 /* Initalize Player related objects */ |
183 TRAP(err, InitVideoPlayerUtilityL()); |
187 TRAP(err, InitVideoPlayerUtilityL()); |
184 RET_IF_ERR(err, XA_RESULT_INTERNAL_ERROR); |
188 RET_IF_ERR(err, XA_RESULT_INTERNAL_ERROR); |
185 |
189 |
186 /* Open file */ |
190 if (iUriType == ELocal) |
187 TAG_TIME_PROFILING_BEGIN; |
191 { |
188 TRAP(err, iVideoPlayer->OpenFileL(iUriPtr)); |
192 /* Open file */ |
189 RET_IF_ERR(err, XA_RESULT_INTERNAL_ERROR); |
193 TAG_TIME_PROFILING_BEGIN; |
190 TAG_TIME_PROFILING_END; |
194 TRAP(err, iVideoPlayer->OpenFileL(iUriPtr)); |
191 PRINT_TO_CONSOLE_TIME_DIFF; |
195 RET_IF_ERR(err, XA_RESULT_INTERNAL_ERROR); |
192 |
196 TAG_TIME_PROFILING_END; |
197 PRINT_TO_CONSOLE_TIME_DIFF; |
|
198 } |
|
199 else |
|
200 { |
|
201 /* Open URL */ |
|
202 TAG_TIME_PROFILING_BEGIN; |
|
203 TRAP(err, iVideoPlayer->OpenUrlL(iUriPtr)); |
|
204 RET_IF_ERR(err, XA_RESULT_INTERNAL_ERROR); |
|
205 TAG_TIME_PROFILING_END; |
|
206 PRINT_TO_CONSOLE_TIME_DIFF; |
|
207 } |
|
193 /* Wait until we receive MvpuoOpenComplete */ |
208 /* Wait until we receive MvpuoOpenComplete */ |
194 PRINT_TO_CONSOLE_HOME_TIME; |
209 PRINT_TO_CONSOLE_HOME_TIME; |
195 if (!iActiveSchedulerWait->IsStarted()) |
210 if (iActiveSchedulerWait && !iActiveSchedulerWait->IsStarted()) |
196 { |
211 { |
197 iActiveSchedulerWait->Start(); |
212 iActiveSchedulerWait->Start(); |
198 } |
213 } |
199 RET_IF_ERR(iErrorCode, XA_RESULT_INTERNAL_ERROR); |
214 RET_IF_ERR(iErrorCode, XA_RESULT_INTERNAL_ERROR); |
200 |
215 |
201 /* Prepare utility */ |
216 /* Prepare utility */ |
202 TAG_TIME_PROFILING_BEGIN_NO_VAR_DEF; |
217 TAG_TIME_PROFILING_BEGIN_NO_VAR_DEF; |
203 iVideoPlayer->Prepare(); |
218 iVideoPlayer->Prepare(); |
204 TAG_TIME_PROFILING_END_NO_VAR_DEF; |
219 TAG_TIME_PROFILING_END_NO_VAR_DEF; |
205 PRINT_TO_CONSOLE_TIME_DIFF; |
220 PRINT_TO_CONSOLE_TIME_DIFF; |
206 |
221 |
207 /* Wait until we receive MvpuoPrepareComplete */ |
222 /* Wait until we receive MvpuoPrepareComplete */ |
208 PRINT_TO_CONSOLE_HOME_TIME_NO_VAR_DEF; |
223 PRINT_TO_CONSOLE_HOME_TIME_NO_VAR_DEF; |
209 if (!iActiveSchedulerWait->IsStarted()) |
224 if (iActiveSchedulerWait && !iActiveSchedulerWait->IsStarted()) |
210 { |
225 { |
211 iActiveSchedulerWait->Start(); |
226 iActiveSchedulerWait->Start(); |
212 } |
227 } |
213 RET_IF_ERR(iErrorCode, XA_RESULT_INTERNAL_ERROR); |
228 RET_IF_ERR(iErrorCode, XA_RESULT_INTERNAL_ERROR); |
214 } |
229 } |
215 } |
230 } |
216 } |
231 } |
217 if (err != KErrNone) |
232 if (err != KErrNone) |
218 { |
233 { |
219 err = XA_RESULT_INTERNAL_ERROR; |
234 err = XA_RESULT_INTERNAL_ERROR; |
220 } |
235 } |
222 } |
237 } |
223 |
238 |
224 TInt CMMFBackendEngine::DetermineAPIToUse(char* uri, TFuncInUse aFunc) |
239 TInt CMMFBackendEngine::DetermineAPIToUse(char* uri, TFuncInUse aFunc) |
225 { |
240 { |
226 char* dotPtr = NULL; |
241 char* dotPtr = NULL; |
227 char ext[MAX_EXTENSION_SIZE] = { 0 }; |
242 char ext[MAX_EXTENSION_SIZE] = |
243 { |
|
244 0 |
|
245 }; |
|
228 int extLen; |
246 int extLen; |
229 |
247 |
230 dotPtr = strrchr(uri, (int)'.'); |
248 int colpos; |
249 char urischeme[MAX_EXTENSION_SIZE] = |
|
250 { |
|
251 0 |
|
252 }; |
|
253 int urischemeLen; |
|
254 |
|
255 dotPtr = strrchr(uri, (int) '.'); |
|
231 if (!dotPtr) |
256 if (!dotPtr) |
232 { |
257 { |
233 return KErrNotFound; |
258 return KErrNotFound; |
234 } |
259 } |
235 |
260 |
236 strncpy(ext, dotPtr,strlen(dotPtr)); |
261 strncpy(ext, dotPtr, strlen(dotPtr)); |
237 /*Null terminate the string*/ |
262 /*Null terminate the string*/ |
238 ext[strlen(dotPtr)] = '\0'; |
263 ext[strlen(dotPtr)] = '\0'; |
239 extLen = sizeof(ext); |
264 extLen = sizeof(ext); |
240 for(unsigned int i=0; i < extLen; i++) |
265 for (unsigned int i = 0; i < extLen; i++) |
241 { |
266 { |
242 ext[i] = tolower(ext[i]); |
267 ext[i] = tolower(ext[i]); |
243 } |
268 } |
244 |
269 |
270 colpos = strcspn(uri, ":"); |
|
271 |
|
272 strncpy(urischeme, uri, colpos + 1); |
|
273 /*Null terminate the string*/ |
|
274 urischeme[colpos + 1] = '\0'; |
|
275 urischemeLen = sizeof(urischeme); |
|
276 for (unsigned int i = 0; i < urischemeLen; i++) |
|
277 { |
|
278 urischeme[i] = tolower(urischeme[i]); |
|
279 } |
|
280 |
|
245 if (aFunc == ERecord) |
281 if (aFunc == ERecord) |
246 { |
282 { |
247 return EAudioRecorderUtility; |
283 return EAudioRecorderUtility; |
248 } |
284 } |
249 else |
285 else |
250 { |
286 { |
251 if (!strcasecmp(ext, ".mp3") || |
287 if (!strcmp(urischeme, "file:")) |
252 !strcasecmp(ext, ".amr") || |
288 { |
253 !strcasecmp(ext, ".aac") || |
289 if (!strcmp(ext, ".mp3") || !strcmp(ext, ".amr") |
254 !strcasecmp(ext, ".mid") || |
290 || !strcmp(ext, ".aac") || !strcmp(ext, ".mid") |
255 !strcasecmp(ext, ".wav") || |
291 || !strcmp(ext, ".wav") || !strcmp(ext, ".awb")) |
256 !strcasecmp(ext, ".awb")) |
292 { |
257 { |
293 return EAudioPlayerUtility; |
258 return EAudioPlayerUtility; |
294 } |
259 } |
295 else |
260 else |
296 { |
297 return EVideoPlayerUtility; |
|
298 } |
|
299 } |
|
300 else |
|
261 { |
301 { |
262 return EVideoPlayerUtility; |
302 return EVideoPlayerUtility; |
263 } |
303 } |
264 } |
304 } |
265 } |
305 } |
272 iErrorCode = aError; |
312 iErrorCode = aError; |
273 if (iErrorCode == KErrNone) |
313 if (iErrorCode == KErrNone) |
274 { |
314 { |
275 iMMFPlayerState = EPlayerOpened; |
315 iMMFPlayerState = EPlayerOpened; |
276 } |
316 } |
277 if (iActiveSchedulerWait->IsStarted()) |
317 if (iActiveSchedulerWait && iActiveSchedulerWait->IsStarted()) |
278 { |
318 { |
279 iActiveSchedulerWait->AsyncStop(); |
319 iActiveSchedulerWait->AsyncStop(); |
280 } |
320 } |
281 } |
321 } |
282 |
322 |
292 iPlayItfPositionUpdateTimer->ResetPlayer(); |
332 iPlayItfPositionUpdateTimer->ResetPlayer(); |
293 if (iErrorCode == KErrNone) |
333 if (iErrorCode == KErrNone) |
294 { |
334 { |
295 iMMFPlayerState = EPlayerPrepared; |
335 iMMFPlayerState = EPlayerPrepared; |
296 TAG_TIME_PROFILING_BEGIN; |
336 TAG_TIME_PROFILING_BEGIN; |
297 TRAP(iErrorCode, iMediaDuration = iVideoPlayer->DurationL()); |
337 TRAP(iErrorCode, iMediaDuration = iVideoPlayer->DurationL()); |
298 TAG_TIME_PROFILING_END; |
338 TAG_TIME_PROFILING_END; |
299 PRINT_TO_CONSOLE_TIME_DIFF; |
339 PRINT_TO_CONSOLE_TIME_DIFF; |
300 if (iErrorCode == KErrNone) |
340 if (iErrorCode == KErrNone) |
301 { |
341 { |
302 iPlaybackHead = 0; |
342 iPlaybackHead = 0; |
303 iMediaPlayerState = XA_PLAYSTATE_STOPPED; |
343 iMediaPlayerState = XA_PLAYSTATE_STOPPED; |
304 iMarkerPositionTimer->UseVideoPlayer(); |
344 iMarkerPositionTimer->UseVideoPlayer(); |
305 iPlayItfPositionUpdateTimer->UseVideoPlayer(); |
345 iPlayItfPositionUpdateTimer->UseVideoPlayer(); |
306 if (m_pWs && m_pScr && m_pWindow) |
346 if (m_pWs && m_pScr && m_pWindow) |
307 { |
347 { |
308 TRect videoExtent = TRect(m_pWindow->Size()); |
348 TRect videoExtent = TRect(m_pWindow->Size()); |
309 TRect clipRect = TRect(m_pWindow->Size()); |
349 TRect clipRect = TRect(m_pWindow->Size()); |
310 TAG_TIME_PROFILING_BEGIN; |
350 TAG_TIME_PROFILING_BEGIN; |
311 TRAP_IGNORE(iVideoPlayer->AddDisplayWindowL(*m_pWs, *m_pScr, *m_pWindow, videoExtent, clipRect)); |
351 TRAP_IGNORE(iVideoPlayer->AddDisplayWindowL(*m_pWs, *m_pScr, *m_pWindow, videoExtent, clipRect)); |
312 TRAP_IGNORE(iVideoPlayer->SetAutoScaleL(*m_pWindow, autoScale)); |
352 TRAP_IGNORE(iVideoPlayer->SetAutoScaleL(*m_pWindow, autoScale)); |
313 TAG_TIME_PROFILING_END; |
353 TAG_TIME_PROFILING_END; |
314 PRINT_TO_CONSOLE_TIME_DIFF; |
354 PRINT_TO_CONSOLE_TIME_DIFF; |
315 } |
355 } |
316 } |
356 } |
317 } |
357 } |
318 if (iActiveSchedulerWait->IsStarted()) |
358 if (iActiveSchedulerWait && iActiveSchedulerWait->IsStarted()) |
319 { |
359 { |
320 iActiveSchedulerWait->AsyncStop(); |
360 iActiveSchedulerWait->AsyncStop(); |
321 } |
361 } |
322 } |
362 } |
323 |
363 |
324 void CMMFBackendEngine::MvpuoFrameReady(CFbsBitmap& /*aFrame*/,TInt /*aError*/) |
364 void CMMFBackendEngine::MvpuoFrameReady(CFbsBitmap& /*aFrame*/, TInt /*aError*/) |
325 { |
365 { |
326 |
366 |
327 } |
367 } |
328 void CMMFBackendEngine::MvpuoPlayComplete(TInt aError) |
368 void CMMFBackendEngine::MvpuoPlayComplete(TInt aError) |
329 { |
369 { |
338 } |
378 } |
339 else |
379 else |
340 { |
380 { |
341 iPlaybackHead = 0; |
381 iPlaybackHead = 0; |
342 iMediaPlayerState = XA_PLAYSTATE_STOPPED; |
382 iMediaPlayerState = XA_PLAYSTATE_STOPPED; |
343 XAAdaptEvent event = {XA_PLAYITFEVENTS, XA_OBJECT_EVENT_RESOURCES_LOST, 0, NULL}; |
383 XAAdaptEvent event = |
344 XAAdaptationBase_SendAdaptEvents((XAAdaptationBaseCtx*)iAdaptContext, &event ); |
384 { |
385 XA_PLAYITFEVENTS, XA_OBJECT_EVENT_RESOURCES_LOST, 0, NULL |
|
386 }; |
|
387 XAAdaptationBase_SendAdaptEvents( |
|
388 (XAAdaptationBaseCtx*) iAdaptContext, &event); |
|
345 } |
389 } |
346 iMMFPlayerState = EPlayerPrepared; |
390 iMMFPlayerState = EPlayerPrepared; |
347 iMarkerPositionTimer->Stop(); |
391 iMarkerPositionTimer->Stop(); |
348 iPlayItfPositionUpdateTimer->Stop(); |
392 iPlayItfPositionUpdateTimer->Stop(); |
349 } |
393 } |
350 |
394 |
351 void CMMFBackendEngine::MvpuoEvent(class TMMFEvent const & event) |
395 void CMMFBackendEngine::MvpuoEvent(class TMMFEvent const & event) |
352 { |
396 { |
353 //RDebug::Print(_L("CMMFBackendEngine::MvpuoEvent (0x%x %d)"), event.iEventType, event.iErrorCode); |
397 //RDebug::Print(_L("CMMFBackendEngine::MvpuoEvent (0x%x %d)"), event.iEventType, event.iErrorCode); |
354 |
398 |
355 if (event.iEventType == KMMFEventCategoryVideoPlayerGeneralError && |
399 if (event.iEventType == KMMFEventCategoryVideoPlayerGeneralError |
356 event.iErrorCode == KErrHardwareNotAvailable) |
400 && event.iErrorCode == KErrHardwareNotAvailable) |
357 { |
401 { |
358 //RDebug::Print(_L("CMMFBackendEngine::MvpuoEvent: Hardware Not Available")); |
402 //RDebug::Print(_L("CMMFBackendEngine::MvpuoEvent: Hardware Not Available")); |
359 } |
403 } |
360 |
404 |
361 else if (event.iEventType == KMMFEventCategoryVideoPlayerGeneralError && |
405 else if (event.iEventType == KMMFEventCategoryVideoPlayerGeneralError |
362 event.iErrorCode == KErrMMPartialPlayback) |
406 && event.iErrorCode == KErrMMPartialPlayback) |
363 { |
407 { |
364 //RDebug::Print(_L("CMMFBackendEngine::MvpuoEvent: Partial playback")); |
408 //RDebug::Print(_L("CMMFBackendEngine::MvpuoEvent: Partial playback")); |
365 } |
409 } |
366 if (event.iEventType == KMMFEventCategoryVideoPlayerGeneralError && |
410 if (event.iEventType == KMMFEventCategoryVideoPlayerGeneralError |
367 event.iErrorCode == -12014) |
411 && event.iErrorCode == -12014) |
368 { |
412 { |
369 //RDebug::Print(_L("CMMFBackendEngine::MvpuoEvent: Audio Device taken")); |
413 //RDebug::Print(_L("CMMFBackendEngine::MvpuoEvent: Audio Device taken")); |
370 PausePlayback(); |
414 PausePlayback(); |
371 XAAdaptEvent event = {XA_PLAYITFEVENTS, XA_OBJECT_EVENT_RESOURCES_LOST, 0, NULL}; |
415 XAAdaptEvent event = |
372 XAAdaptationBase_SendAdaptEvents((XAAdaptationBaseCtx*)iAdaptContext, &event ); |
416 { |
417 XA_PLAYITFEVENTS, XA_OBJECT_EVENT_RESOURCES_LOST, 0, NULL |
|
418 }; |
|
419 XAAdaptationBase_SendAdaptEvents( |
|
420 (XAAdaptationBaseCtx*) iAdaptContext, &event); |
|
373 } |
421 } |
374 else if (event.iEventType == KMMFRefreshMetaData) |
422 else if (event.iEventType == KMMFRefreshMetaData) |
375 { |
423 { |
376 //RDebug::Print(_L("CMMFBackendEngine::MvpuoEvent: EventType == KMMFRefreshMetaData")); |
424 //RDebug::Print(_L("CMMFBackendEngine::MvpuoEvent: EventType == KMMFRefreshMetaData")); |
377 } |
425 } |
392 //file playing |
440 //file playing |
393 } |
441 } |
394 |
442 |
395 //MMdaAudioPlayerCallback |
443 //MMdaAudioPlayerCallback |
396 void CMMFBackendEngine::MapcInitComplete(TInt aError, |
444 void CMMFBackendEngine::MapcInitComplete(TInt aError, |
397 const TTimeIntervalMicroSeconds& aDuration) |
445 const TTimeIntervalMicroSeconds& aDuration) |
398 { |
446 { |
399 PRINT_TO_CONSOLE_HOME_TIME; |
447 PRINT_TO_CONSOLE_HOME_TIME; |
400 |
448 |
401 iErrorCode = aError; |
449 iErrorCode = aError; |
402 iMediaPlayerState = XA_PLAYSTATE_PLAYERUNINITIALIZED; |
450 iMediaPlayerState = XA_PLAYSTATE_PLAYERUNINITIALIZED; |
411 iMediaPlayerState = XA_PLAYSTATE_STOPPED; |
459 iMediaPlayerState = XA_PLAYSTATE_STOPPED; |
412 iMMFPlayerState = EPlayerOpened; |
460 iMMFPlayerState = EPlayerOpened; |
413 iMarkerPositionTimer->UseAudioPlayer(); |
461 iMarkerPositionTimer->UseAudioPlayer(); |
414 iPlayItfPositionUpdateTimer->UseAudioPlayer(); |
462 iPlayItfPositionUpdateTimer->UseAudioPlayer(); |
415 } |
463 } |
416 if (iActiveSchedulerWait->IsStarted()) |
464 if (iActiveSchedulerWait && iActiveSchedulerWait->IsStarted()) |
417 { |
465 { |
418 iActiveSchedulerWait->AsyncStop(); |
466 iActiveSchedulerWait->AsyncStop(); |
419 } |
467 } |
420 } |
468 } |
421 |
|
422 |
469 |
423 void CMMFBackendEngine::MapcPlayComplete(TInt aError) |
470 void CMMFBackendEngine::MapcPlayComplete(TInt aError) |
424 { |
471 { |
425 iErrorCode = aError; |
472 iErrorCode = aError; |
426 if (iErrorCode == KErrNone) |
473 if (iErrorCode == KErrNone) |
437 else |
484 else |
438 { |
485 { |
439 iAudioPlayer->GetPosition(iPlaybackHead); |
486 iAudioPlayer->GetPosition(iPlaybackHead); |
440 iMediaPlayerState = XA_PLAYSTATE_PAUSED; |
487 iMediaPlayerState = XA_PLAYSTATE_PAUSED; |
441 iMMFPlayerState = EPlayerPaused; |
488 iMMFPlayerState = EPlayerPaused; |
442 XAAdaptEvent event = {XA_PLAYITFEVENTS, XA_OBJECT_EVENT_RESOURCES_LOST, 0, NULL}; |
489 XAAdaptEvent event = |
443 XAAdaptationBase_SendAdaptEvents((XAAdaptationBaseCtx*)iAdaptContext, &event ); |
490 { |
491 XA_PLAYITFEVENTS, XA_OBJECT_EVENT_RESOURCES_LOST, 0, NULL |
|
492 }; |
|
493 XAAdaptationBase_SendAdaptEvents( |
|
494 (XAAdaptationBaseCtx*) iAdaptContext, &event); |
|
444 } |
495 } |
445 iMarkerPositionTimer->Stop(); |
496 iMarkerPositionTimer->Stop(); |
446 iPlayItfPositionUpdateTimer->Stop(); |
497 iPlayItfPositionUpdateTimer->Stop(); |
447 } |
498 } |
448 |
499 |
449 // from MMdaObjectStateChangeObserver |
500 // from MMdaObjectStateChangeObserver |
450 void CMMFBackendEngine::MoscoStateChangeEvent(CBase* /*aObject*/, TInt aPreviousState, TInt aCurrentState, TInt aErrorCode) |
501 void CMMFBackendEngine::MoscoStateChangeEvent(CBase* /*aObject*/, |
502 TInt aPreviousState, TInt aCurrentState, TInt aErrorCode) |
|
451 { |
503 { |
452 TInt err(KErrNone); |
504 TInt err(KErrNone); |
453 iPreviousRecordState = aPreviousState; |
505 iPreviousRecordState = aPreviousState; |
454 iCurrentRecordState = aCurrentState; |
506 iCurrentRecordState = aCurrentState; |
455 iErrorCode = aErrorCode; |
507 iErrorCode = aErrorCode; |
456 //RDebug::Print(_L("CMMFBackendEngine::MoscoStateChangeEvent 1 Error[%d]"),aErrorCode); |
508 //RDebug::Print(_L("CMMFBackendEngine::MoscoStateChangeEvent 1 Error[%d]"),aErrorCode); |
457 if (iCurrentRecordState == CMdaAudioClipUtility::EOpen) //EOpen |
509 if (iCurrentRecordState == CMdaAudioClipUtility::EOpen) //EOpen |
458 { |
510 { |
459 //outputfile is open and ready for recording |
511 //outputfile is open and ready for recording |
460 iRecordState = CMMFBackendEngine::ERecorderOpen; |
512 iRecordState = CMMFBackendEngine::ERecorderOpen; |
461 if (iErrorCode == KErrNone) |
513 if (iErrorCode == KErrNone) |
462 { |
514 { |
463 if (iPreviousRecordState == CMdaAudioClipUtility::ENotReady) |
515 if (iPreviousRecordState == CMdaAudioClipUtility::ENotReady) |
464 { |
516 { |
465 //RDebug::Print(_L("CMMFBackendEngine::MoscoStateChangeEvent 2")); |
517 //RDebug::Print(_L("CMMFBackendEngine::MoscoStateChangeEvent 2")); |
466 TRAP(err,iaudioInputRecord = CAudioInput::NewL( *iAudioRecorder )); |
518 TRAP(err,iAudioInputRecord = CAudioInput::NewL( *iAudioRecorder )); |
467 RArray<CAudioInput::TAudioInputPreference> inputArray; |
519 if (err == KErrNone) |
468 inputArray.Append( CAudioInput::EDefaultMic ); |
520 { |
469 // Set Audio Input |
521 RArray<CAudioInput::TAudioInputPreference> inputArray; |
470 iaudioInputRecord->SetAudioInputL( inputArray.Array( ) ); |
522 inputArray.Append(CAudioInput::EDefaultMic); |
471 inputArray.Close(); |
523 // Set Audio Input |
472 TMMFMessageDestination destination(KUidMetaDataWriteCustomCommand); |
524 TRAP(err, iAudioInputRecord->SetAudioInputL( inputArray.Array( ) )); |
473 TMMFMessageDestinationPckg pckg = TMMFMessageDestinationPckg(destination); |
525 inputArray.Close(); |
474 TInt ret = iAudioRecorder->RecordControllerCustomCommandSync(pckg, 0, KNullDesC8, KNullDesC8); |
526 } |
527 TMMFMessageDestination destination( |
|
528 KUidMetaDataWriteCustomCommand); |
|
529 TMMFMessageDestinationPckg pckg = TMMFMessageDestinationPckg( |
|
530 destination); |
|
531 TInt ret = iAudioRecorder->RecordControllerCustomCommandSync( |
|
532 pckg, 0, KNullDesC8, KNullDesC8); |
|
475 //RDebug::Print(_L("CMMFBackendEngine::MoscoStateChangeEvent 3 [%d]"),ret); |
533 //RDebug::Print(_L("CMMFBackendEngine::MoscoStateChangeEvent 3 [%d]"),ret); |
476 if (ret != KErrNone && iFileFormat == XA_CONTAINERTYPE_MP4) |
534 if (ret != KErrNone && iFileFormat == XA_CONTAINERTYPE_MP4) |
477 { |
535 { |
478 iPauseSupportMP4 = FALSE; |
536 iPauseSupportMP4 = FALSE; |
479 } |
537 } |
480 if (iActiveSchedulerWait->IsStarted()) |
538 if (iActiveSchedulerWait && iActiveSchedulerWait->IsStarted()) |
481 { |
539 { |
482 iActiveSchedulerWait->AsyncStop(); |
540 iActiveSchedulerWait->AsyncStop(); |
483 } |
541 } |
484 } |
542 } |
485 } |
543 } |
486 else |
544 else |
487 { |
545 { |
488 XAAdaptEvent event = {XA_RECORDITFEVENTS, XA_OBJECT_EVENT_RESOURCES_LOST, 0, NULL}; |
546 XAAdaptEvent event = |
489 XAAdaptationBase_SendAdaptEvents((XAAdaptationBaseCtx*)iAdaptContext, &event ); |
547 { |
490 } |
548 XA_RECORDITFEVENTS, XA_OBJECT_EVENT_RESOURCES_LOST, 0, NULL |
491 } |
549 }; |
492 else if (iCurrentRecordState == CMdaAudioClipUtility::ERecording) //ERecording |
550 XAAdaptationBase_SendAdaptEvents( |
551 (XAAdaptationBaseCtx*) iAdaptContext, &event); |
|
552 } |
|
553 } |
|
554 else if (iCurrentRecordState == CMdaAudioClipUtility::ERecording) //ERecording |
|
493 { |
555 { |
494 iRecordState = CMMFBackendEngine::ERecorderRecording; |
556 iRecordState = CMMFBackendEngine::ERecorderRecording; |
495 iPositionUpdateTimer->Start(iTimerDelay); |
557 iPositionUpdateTimer->Start(iTimerDelay); |
496 XAAdaptEvent event = {XA_RECORDITFEVENTS, XA_RECORDEVENT_HEADMOVING, 0, NULL}; |
558 XAAdaptEvent event = |
497 XAAdaptationBase_SendAdaptEvents((XAAdaptationBaseCtx*)iAdaptContext, &event ); |
559 { |
498 } |
560 XA_RECORDITFEVENTS, XA_RECORDEVENT_HEADMOVING, 0, NULL |
499 else //ENotReady |
561 }; |
562 XAAdaptationBase_SendAdaptEvents( |
|
563 (XAAdaptationBaseCtx*) iAdaptContext, &event); |
|
564 } |
|
565 else //ENotReady |
|
500 { |
566 { |
501 //outputfile is not open |
567 //outputfile is not open |
502 iRecordState = CMMFBackendEngine::ERecorderNotReady; |
568 iRecordState = CMMFBackendEngine::ERecorderNotReady; |
503 } |
569 } |
504 } |
570 } |
505 |
571 |
506 TInt CMMFBackendEngine::SetRecorderState(TRecorderState state, XAboolean stopCalled) |
572 TInt CMMFBackendEngine::SetRecorderState(TRecorderState state, |
573 XAboolean stopCalled) |
|
507 { |
574 { |
508 TInt err(KErrNone); |
575 TInt err(KErrNone); |
509 |
576 |
510 if (iAPIBeingUsed != EAudioRecorderUtility) |
577 if (iAPIBeingUsed != EAudioRecorderUtility) |
511 { |
578 { |
512 return XA_RESULT_INTERNAL_ERROR; |
579 return XA_RESULT_INTERNAL_ERROR; |
513 } |
580 } |
514 |
581 |
515 switch(state) |
582 switch (state) |
516 { |
583 { |
517 case ERecorderNotReady: |
584 case ERecorderNotReady: |
518 iAudioRecorder->Close(); |
585 iAudioRecorder->Close(); |
519 iRecordState = ERecorderNotReady; |
586 iRecordState = ERecorderNotReady; |
520 break; |
587 break; |
521 case ERecorderOpen: |
588 case ERecorderOpen: |
522 if (iFileFormat == XA_CONTAINERTYPE_MP4 && !iPauseSupportMP4 && !stopCalled) |
589 if (iFileFormat == XA_CONTAINERTYPE_MP4 && !iPauseSupportMP4 |
590 && !stopCalled) |
|
523 { |
591 { |
524 err = KErrNotSupported; |
592 err = KErrNotSupported; |
525 return err; |
593 return err; |
526 } |
594 } |
527 iPositionUpdateTimer->Stop(); |
595 iPositionUpdateTimer->Stop(); |
528 iAudioRecorder->Stop(); |
596 iAudioRecorder->Stop(); |
529 iRecordState = ERecorderOpen; |
597 iRecordState = ERecorderOpen; |
530 break; |
598 break; |
531 case ERecorderRecording: |
599 case ERecorderRecording: |
532 TRAP(err, iAudioRecorder->RecordL()); |
600 TRAP(err, iAudioRecorder->RecordL()) |
601 ; |
|
533 break; |
602 break; |
534 } |
603 } |
535 return err; |
604 return err; |
536 } |
605 } |
537 |
606 |
546 iPlayItfPositionUpdateTimer->Stop(); |
615 iPlayItfPositionUpdateTimer->Stop(); |
547 } |
616 } |
548 |
617 |
549 if (iBaseVideoPlayer && iVideoPlayer) |
618 if (iBaseVideoPlayer && iVideoPlayer) |
550 { |
619 { |
551 switch(iMMFPlayerState) |
620 switch (iMMFPlayerState) |
552 { |
621 { |
553 case EPlayerPlaying: |
622 case EPlayerPlaying: |
554 case EPlayerPaused: |
623 case EPlayerPaused: |
555 case EPlayerPrepared: |
624 case EPlayerPrepared: |
556 iVideoPlayer->Stop(); |
625 iVideoPlayer->Stop(); |
557 case EPlayerOpened: |
626 case EPlayerOpened: |
558 if (m_pWs && m_pScr && m_pWindow) |
627 if (m_pWs && m_pScr && m_pWindow) |
559 { |
628 { |
560 iVideoPlayer->RemoveDisplayWindow(*m_pWindow); |
629 iVideoPlayer->RemoveDisplayWindow(*m_pWindow); |
561 } |
630 } |
562 iVideoPlayer->Close(); |
631 iVideoPlayer->Close(); |
563 case EPlayerClosed: |
632 case EPlayerClosed: |
564 default: |
633 default: |
565 break; |
634 break; |
566 }; |
635 }; |
567 } |
636 } |
568 |
637 |
638 // deleting the AudioInput object |
|
639 if (iAudioInputRecord) |
|
640 { |
|
641 delete iAudioInputRecord; |
|
642 iAudioInputRecord = NULL; |
|
643 } |
|
644 |
|
569 if (iBaseAudioPlayer && iAudioPlayer) |
645 if (iBaseAudioPlayer && iAudioPlayer) |
570 { |
646 { |
571 iAudioPlayer->Close(); |
647 iAudioPlayer->Close(); |
572 } |
648 } |
573 |
649 |
574 if (iBaseAudioRecorder) |
650 if (iBaseAudioRecorder) |
575 { |
651 { |
576 iAudioRecorder->Close(); |
652 iAudioRecorder->Close(); |
577 } |
653 } |
578 |
654 |
579 if(iPositionUpdateTimer) |
655 if (iPositionUpdateTimer) |
580 { |
656 { |
581 iPositionUpdateTimer->Stop(); |
657 iPositionUpdateTimer->Stop(); |
582 } |
658 } |
583 |
659 |
584 if (iActiveSchedulerWait && iActiveSchedulerWait->IsStarted()) |
660 if (iActiveSchedulerWait && iActiveSchedulerWait->IsStarted()) |
598 delete iPlayItfPositionUpdateTimer; |
674 delete iPlayItfPositionUpdateTimer; |
599 iPlayItfPositionUpdateTimer = NULL; |
675 iPlayItfPositionUpdateTimer = NULL; |
600 delete iBaseVideoPlayer; |
676 delete iBaseVideoPlayer; |
601 iBaseVideoPlayer = NULL; |
677 iBaseVideoPlayer = NULL; |
602 iVideoPlayer = NULL; |
678 iVideoPlayer = NULL; |
603 delete iaudioInputRecord; |
|
604 iaudioInputRecord = NULL; |
|
605 delete iBaseAudioPlayer; |
679 delete iBaseAudioPlayer; |
606 iBaseAudioPlayer = NULL; |
680 iBaseAudioPlayer = NULL; |
607 iAudioPlayer = NULL; |
681 iAudioPlayer = NULL; |
608 delete iBaseAudioRecorder; |
682 delete iBaseAudioRecorder; |
609 iBaseAudioRecorder = NULL; |
683 iBaseAudioRecorder = NULL; |
642 |
716 |
643 TInt CMMFBackendEngine::GetCodecId(XAuint32* codecid) |
717 TInt CMMFBackendEngine::GetCodecId(XAuint32* codecid) |
644 { |
718 { |
645 TInt err(KErrNone); |
719 TInt err(KErrNone); |
646 |
720 |
647 if(iAPIBeingUsed == EAudioRecorderUtility) |
721 if (iAPIBeingUsed == EAudioRecorderUtility) |
648 { |
722 { |
649 if(iRecordState != CMMFBackendEngine::ERecorderNotReady) |
723 if (iRecordState != CMMFBackendEngine::ERecorderNotReady) |
650 { |
724 { |
651 TFourCC dest; |
725 TFourCC dest; |
652 TRAP(err, dest = iAudioRecorder->DestinationDataTypeL()); |
726 TRAP(err, dest = iAudioRecorder->DestinationDataTypeL()); |
653 if(err == KErrNone) |
727 if (err == KErrNone) |
654 { |
728 { |
655 *codecid = dest.FourCC(); |
729 *codecid = dest.FourCC(); |
656 } |
730 } |
657 } |
731 } |
658 } |
732 } |
659 else if(iAPIBeingUsed == EAudioPlayerUtility) |
733 else if (iAPIBeingUsed == EAudioPlayerUtility) |
660 { |
734 { |
661 if(iMediaPlayerState != XA_PLAYSTATE_PLAYERUNINITIALIZED) |
735 if (iMediaPlayerState != XA_PLAYSTATE_PLAYERUNINITIALIZED) |
662 { |
736 { |
663 TMMFMessageDestinationPckg pckg(KUidInterfaceMMFAudioController); |
737 TMMFMessageDestinationPckg pckg(KUidInterfaceMMFAudioController); |
664 TPckgBuf<TMMFAudioConfig> configPackage; |
738 TPckgBuf<TMMFAudioConfig> configPackage; |
665 TInt err = iAudioPlayer->CustomCommandSync(pckg, |
739 TInt err = iAudioPlayer->CustomCommandSync(pckg, |
666 EMMFAudioControllerGetSourceDataType, |
740 EMMFAudioControllerGetSourceDataType, KNullDesC8, |
667 KNullDesC8, |
741 KNullDesC8, configPackage); |
668 KNullDesC8, |
742 if (err == KErrNone) |
669 configPackage); |
|
670 if(err == KErrNone) |
|
671 { |
743 { |
672 *codecid = configPackage().iSourceDataTypeCode.FourCC(); |
744 *codecid = configPackage().iSourceDataTypeCode.FourCC(); |
673 } |
745 } |
674 } |
746 } |
675 } |
747 } |
678 |
750 |
679 TInt CMMFBackendEngine::GetBitRate(XAuint32* bitrate) |
751 TInt CMMFBackendEngine::GetBitRate(XAuint32* bitrate) |
680 { |
752 { |
681 TInt err(KErrNone); |
753 TInt err(KErrNone); |
682 TUint br(0); |
754 TUint br(0); |
683 if(iAPIBeingUsed == EAudioRecorderUtility) |
755 if (iAPIBeingUsed == EAudioRecorderUtility) |
684 { |
756 { |
685 if(iRecordState != CMMFBackendEngine::ERecorderNotReady) |
757 if (iRecordState != CMMFBackendEngine::ERecorderNotReady) |
686 { |
758 { |
687 TRAP(err, br = iAudioRecorder->DestinationBitRateL()); |
759 TRAP(err, br = iAudioRecorder->DestinationBitRateL()); |
688 if(err == KErrNone) |
760 if (err == KErrNone) |
689 { |
761 { |
690 *bitrate = br; |
762 *bitrate = br; |
691 } |
763 } |
692 } |
764 } |
693 } |
765 } |
694 else if(iAPIBeingUsed == EAudioPlayerUtility) |
766 else if (iAPIBeingUsed == EAudioPlayerUtility) |
695 { |
767 { |
696 if(iMediaPlayerState != XA_PLAYSTATE_PLAYERUNINITIALIZED) |
768 if (iMediaPlayerState != XA_PLAYSTATE_PLAYERUNINITIALIZED) |
697 { |
769 { |
698 TInt err = iAudioPlayer->GetBitRate(br); |
770 TInt err = iAudioPlayer->GetBitRate(br); |
699 *bitrate = br; |
771 *bitrate = br; |
700 } |
772 } |
701 } |
773 } |
702 return err; |
774 return err; |
703 } |
775 } |
704 |
776 |
705 TInt CMMFBackendEngine::GetSampleRate(XAmilliHertz* samplerate) |
777 TInt CMMFBackendEngine::GetSampleRate(XAmilliHertz* samplerate) |
706 { |
778 { |
707 TInt err(KErrNone); |
779 TInt err(KErrNone); |
708 TUint sr(0); |
780 TUint sr(0); |
709 if(iAPIBeingUsed == EAudioRecorderUtility) |
781 if (iAPIBeingUsed == EAudioRecorderUtility) |
710 { |
782 { |
711 if(iRecordState != CMMFBackendEngine::ERecorderNotReady) |
783 if (iRecordState != CMMFBackendEngine::ERecorderNotReady) |
712 { |
784 { |
713 TRAP(err, sr = iAudioRecorder->DestinationSampleRateL()); |
785 TRAP(err, sr = iAudioRecorder->DestinationSampleRateL()); |
714 if(err == KErrNone) |
786 if (err == KErrNone) |
715 { |
787 { |
716 *samplerate = sr; |
788 *samplerate = sr * 1000; |
717 } |
789 } |
718 } |
790 } |
719 } |
791 } |
720 else if(iAPIBeingUsed == EAudioPlayerUtility) |
792 else if (iAPIBeingUsed == EAudioPlayerUtility) |
721 { |
793 { |
722 if(iMediaPlayerState != XA_PLAYSTATE_PLAYERUNINITIALIZED) |
794 if (iMediaPlayerState != XA_PLAYSTATE_PLAYERUNINITIALIZED) |
723 { |
795 { |
724 TMMFMessageDestinationPckg pckg(KUidInterfaceMMFAudioController); |
796 TMMFMessageDestinationPckg pckg(KUidInterfaceMMFAudioController); |
725 TPckgBuf<TMMFAudioConfig> configPackage; |
797 TPckgBuf<TMMFAudioConfig> configPackage; |
726 TInt err = iAudioPlayer->CustomCommandSync(pckg, |
798 TInt err = iAudioPlayer->CustomCommandSync(pckg, |
727 EMMFAudioControllerGetSourceSampleRate, |
799 EMMFAudioControllerGetSourceSampleRate, KNullDesC8, |
728 KNullDesC8, |
800 KNullDesC8, configPackage); |
729 KNullDesC8, |
801 if (err == KErrNone) |
730 configPackage); |
802 { |
731 if(err == KErrNone) |
803 *samplerate = configPackage().iSampleRate * 1000; |
732 { |
|
733 *samplerate = configPackage().iSampleRate; |
|
734 } |
804 } |
735 } |
805 } |
736 } |
806 } |
737 return err; |
807 return err; |
738 } |
808 } |
739 |
809 |
740 TInt CMMFBackendEngine::GetChannels(XAuint32* channels) |
810 TInt CMMFBackendEngine::GetChannels(XAuint32* channels) |
741 { |
811 { |
742 TInt err(KErrNone); |
812 TInt err(KErrNone); |
743 TUint ch(0); |
813 TUint ch(0); |
744 if(iAPIBeingUsed == EAudioRecorderUtility) |
814 if (iAPIBeingUsed == EAudioRecorderUtility) |
745 { |
815 { |
746 if(iRecordState != CMMFBackendEngine::ERecorderNotReady) |
816 if (iRecordState != CMMFBackendEngine::ERecorderNotReady) |
747 { |
817 { |
748 TRAP(err,ch = iAudioRecorder->DestinationNumberOfChannelsL()); |
818 TRAP(err,ch = iAudioRecorder->DestinationNumberOfChannelsL()); |
749 if(err == KErrNone) |
819 if (err == KErrNone) |
750 { |
820 { |
751 *channels = ch; |
821 *channels = ch; |
752 } |
822 } |
753 } |
823 } |
754 } |
824 } |
755 else if(iAPIBeingUsed == EAudioPlayerUtility) |
825 else if (iAPIBeingUsed == EAudioPlayerUtility) |
756 { |
826 { |
757 if(iMediaPlayerState != XA_PLAYSTATE_PLAYERUNINITIALIZED) |
827 if (iMediaPlayerState != XA_PLAYSTATE_PLAYERUNINITIALIZED) |
758 { |
828 { |
759 TMMFMessageDestinationPckg pckg(KUidInterfaceMMFAudioController); |
829 TMMFMessageDestinationPckg pckg(KUidInterfaceMMFAudioController); |
760 TPckgBuf<TMMFAudioConfig> configPackage; |
830 TPckgBuf<TMMFAudioConfig> configPackage; |
761 TInt err = iAudioPlayer->CustomCommandSync( pckg, |
831 TInt err = iAudioPlayer->CustomCommandSync(pckg, |
762 EMMFAudioControllerGetSourceNumChannels, |
832 EMMFAudioControllerGetSourceNumChannels, KNullDesC8, |
763 KNullDesC8, |
833 KNullDesC8, configPackage); |
764 KNullDesC8, |
834 if (err == KErrNone) |
765 configPackage ); |
|
766 if(err == KErrNone) |
|
767 { |
835 { |
768 *channels = configPackage().iChannels; |
836 *channels = configPackage().iChannels; |
769 } |
837 } |
770 } |
838 } |
771 } |
839 } |
772 return err; |
840 return err; |
773 } |
841 } |
774 |
842 |
775 TInt CMMFBackendEngine::SetDestinationBitRate(XAuint32* bitrate) |
843 TInt CMMFBackendEngine::SetDestinationBitRate(XAuint32* bitrate) |
776 { |
|
777 TInt err(KErrNone); |
|
778 if(iRecordState == CMMFBackendEngine::ERecorderOpen) |
|
779 { |
|
780 TRAP(err, iAudioRecorder->SetDestinationBitRateL(*bitrate)); |
|
781 if(err != KErrNone) |
|
782 { |
|
783 return XA_RESULT_PARAMETER_INVALID; |
|
784 } |
|
785 } |
|
786 return err; |
|
787 } |
|
788 |
|
789 TInt CMMFBackendEngine::SetDestinationSampleRate(XAmilliHertz* samplerate) |
|
790 { |
|
791 TInt err(KErrNone); |
|
792 if(iRecordState == CMMFBackendEngine::ERecorderOpen) |
|
793 { |
|
794 TRAP(err, iAudioRecorder->SetDestinationSampleRateL(*samplerate)); |
|
795 if(err != KErrNone) |
|
796 { |
|
797 return XA_RESULT_PARAMETER_INVALID; |
|
798 } |
|
799 } |
|
800 return err; |
|
801 } |
|
802 |
|
803 TInt CMMFBackendEngine::SetDestinationChannels(XAuint32* channels) |
|
804 { |
844 { |
805 TInt err(KErrNone); |
845 TInt err(KErrNone); |
806 if (iRecordState == CMMFBackendEngine::ERecorderOpen) |
846 if (iRecordState == CMMFBackendEngine::ERecorderOpen) |
807 { |
847 { |
848 TRAP(err, iAudioRecorder->SetDestinationBitRateL(*bitrate)); |
|
849 if (err != KErrNone) |
|
850 { |
|
851 return XA_RESULT_PARAMETER_INVALID; |
|
852 } |
|
853 } |
|
854 return err; |
|
855 } |
|
856 |
|
857 TInt CMMFBackendEngine::SetDestinationSampleRate(XAmilliHertz* samplerate) |
|
858 { |
|
859 TInt err(KErrNone); |
|
860 if (iRecordState == CMMFBackendEngine::ERecorderOpen) |
|
861 { |
|
862 TRAP(err, iAudioRecorder->SetDestinationSampleRateL(*samplerate/1000)); |
|
863 if (err != KErrNone) |
|
864 { |
|
865 return XA_RESULT_PARAMETER_INVALID; |
|
866 } |
|
867 } |
|
868 return err; |
|
869 } |
|
870 |
|
871 TInt CMMFBackendEngine::SetDestinationChannels(XAuint32* channels) |
|
872 { |
|
873 TInt err(KErrNone); |
|
874 if (iRecordState == CMMFBackendEngine::ERecorderOpen) |
|
875 { |
|
808 TRAP(err,iAudioRecorder->SetDestinationNumberOfChannelsL(*channels)); |
876 TRAP(err,iAudioRecorder->SetDestinationNumberOfChannelsL(*channels)); |
809 if (err != KErrNone) |
877 if (err != KErrNone) |
810 { |
878 { |
811 return XA_RESULT_PARAMETER_INVALID; |
879 return XA_RESULT_PARAMETER_INVALID; |
812 } |
880 } |
813 } |
881 } |
814 return err; |
882 return err; |
815 } |
883 } |
816 |
884 |
817 /* |
885 /* |
818 XAresult CMMFBackendEngine::SetWindowHandle(void* display_info) |
886 XAresult CMMFBackendEngine::SetWindowHandle(void* display_info) |
819 { |
887 { |
820 XADataLocator_NativeDisplay* nativeDisplay; |
888 XADataLocator_NativeDisplay* nativeDisplay; |
821 XADataSink* videoSink = (XADataSink*)display_info; |
889 XADataSink* videoSink = (XADataSink*)display_info; |
822 |
890 |
823 nativeDisplay = (XADataLocator_NativeDisplay*) (videoSink->pLocator); |
891 nativeDisplay = (XADataLocator_NativeDisplay*) (videoSink->pLocator); |
824 |
892 |
825 m_pWindow = ((RWindow*)(nativeDisplay->hWindow)); |
893 m_pWindow = ((RWindow*)(nativeDisplay->hWindow)); |
826 m_pWs = ((RWsSession*)(nativeDisplay->hDisplay)); |
894 m_pWs = ((RWsSession*)(nativeDisplay->hDisplay)); |
827 |
895 |
828 m_bWindowReferencePassed = TRUE; |
896 m_bWindowReferencePassed = TRUE; |
829 return XA_RESULT_SUCCESS; |
897 return XA_RESULT_SUCCESS; |
830 } |
898 } |
831 |
899 |
832 */ |
900 */ |
833 XAresult CMMFBackendEngine::CreateAndConfigureWindowL() |
901 XAresult CMMFBackendEngine::CreateAndConfigureWindowL() |
834 { |
902 { |
835 #ifdef USE_LOCAL_WINDOW_RESOURCES |
903 #ifdef USE_LOCAL_WINDOW_RESOURCES |
836 // create window for attaching the surface as its background |
904 // create window for attaching the surface as its background |
837 //RWsSession ws; |
905 //RWsSession ws; |
873 { |
941 { |
874 XAresult retVal(XA_RESULT_SUCCESS); |
942 XAresult retVal(XA_RESULT_SUCCESS); |
875 //display_info is of type XADataSink |
943 //display_info is of type XADataSink |
876 //display_info.pLocator is of type XADataLocator_NativeDisplay |
944 //display_info.pLocator is of type XADataLocator_NativeDisplay |
877 XADataLocator_NativeDisplay* nativeDisplay; |
945 XADataLocator_NativeDisplay* nativeDisplay; |
878 XADataSink* videoSink = (XADataSink*)display_info; |
946 XADataSink* videoSink = (XADataSink*) display_info; |
879 |
947 |
880 if (videoSink) |
948 if (videoSink) |
881 { |
949 { |
882 nativeDisplay = (XADataLocator_NativeDisplay*) (videoSink->pLocator); |
950 nativeDisplay = (XADataLocator_NativeDisplay*) (videoSink->pLocator); |
883 m_pWindow = ((RWindow*)(nativeDisplay->hWindow)); |
951 m_pWindow = ((RWindow*) (nativeDisplay->hWindow)); |
884 m_pWs = ((RWsSession*)(nativeDisplay->hDisplay)); |
952 m_pWs = ((RWsSession*) (nativeDisplay->hDisplay)); |
885 /* |
953 /* |
886 m_cropRegion = TRect(m_pWindow->Size()); |
954 m_cropRegion = TRect(m_pWindow->Size()); |
887 m_videoExtent = TRect(m_pWindow->Size()); |
955 m_videoExtent = TRect(m_pWindow->Size()); |
888 m_cropRect = TRect(m_pWindow->Size()); |
956 m_cropRect = TRect(m_pWindow->Size()); |
889 m_clipRect = TRect(m_pWindow->Size()); |
957 m_clipRect = TRect(m_pWindow->Size()); |
890 m_cropRegion = TRect(m_pWindow->Size()); |
958 m_cropRegion = TRect(m_pWindow->Size()); |
891 */ |
959 */ |
892 if (m_pWs) |
960 if (m_pWs) |
893 { |
961 { |
894 delete m_pScr; |
962 delete m_pScr; |
895 m_pScr = NULL; |
963 m_pScr = NULL; |
896 TRAPD(err, m_pScr = new CWsScreenDevice(*m_pWs)); |
964 TRAPD(err, m_pScr = new CWsScreenDevice(*m_pWs)); |
909 { |
977 { |
910 case XA_PLAYSTATE_STOPPED: |
978 case XA_PLAYSTATE_STOPPED: |
911 case XA_PLAYSTATE_PAUSED: |
979 case XA_PLAYSTATE_PAUSED: |
912 /* If we are already at the end of clip, do nothing |
980 /* If we are already at the end of clip, do nothing |
913 * check ::MapcPlayComplete for documentation */ |
981 * check ::MapcPlayComplete for documentation */ |
914 if ((iPlaybackHead < iMediaDuration) && |
982 if ((iPlaybackHead < iMediaDuration) && ((iAPIBeingUsed |
915 ((iAPIBeingUsed == EAudioPlayerUtility) || |
983 == EAudioPlayerUtility) || (iAPIBeingUsed |
916 (iAPIBeingUsed == EVideoPlayerUtility)) ) |
984 == EVideoPlayerUtility))) |
917 { |
985 { |
918 if (iAPIBeingUsed == EAudioPlayerUtility) |
986 if (iAPIBeingUsed == EAudioPlayerUtility) |
919 { |
987 { |
920 TAG_TIME_PROFILING_BEGIN; |
988 TAG_TIME_PROFILING_BEGIN; |
921 iAudioPlayer->Play(); |
989 iAudioPlayer->Play(); |
922 TAG_TIME_PROFILING_END; |
990 TAG_TIME_PROFILING_END; PRINT_TO_CONSOLE_TIME_DIFF; |
923 PRINT_TO_CONSOLE_TIME_DIFF; |
|
924 } |
991 } |
925 else if (iAPIBeingUsed == EVideoPlayerUtility) |
992 else if (iAPIBeingUsed == EVideoPlayerUtility) |
926 { |
993 { |
927 TAG_TIME_PROFILING_BEGIN; |
994 TAG_TIME_PROFILING_BEGIN; |
928 //iVideoPlayer->Play( iPlaybackHead, iMediaDuration); |
995 //iVideoPlayer->Play( iPlaybackHead, iMediaDuration); |
929 iVideoPlayer->Play(); |
996 iVideoPlayer->Play(); |
930 TAG_TIME_PROFILING_END; |
997 TAG_TIME_PROFILING_END; PRINT_TO_CONSOLE_TIME_DIFF; |
931 PRINT_TO_CONSOLE_TIME_DIFF; |
|
932 } |
998 } |
933 postHeadMovingEvent = ETrue; |
999 postHeadMovingEvent = ETrue; |
934 iMediaPlayerState = XA_PLAYSTATE_PLAYING; |
1000 iMediaPlayerState = XA_PLAYSTATE_PLAYING; |
935 iMMFPlayerState = EPlayerPlaying; |
1001 iMMFPlayerState = EPlayerPlaying; |
936 iMarkerPositionTimer->Start(); |
1002 iMarkerPositionTimer->Start(); |
957 XAresult retVal(XA_RESULT_SUCCESS); |
1023 XAresult retVal(XA_RESULT_SUCCESS); |
958 switch (iMediaPlayerState) |
1024 switch (iMediaPlayerState) |
959 { |
1025 { |
960 case XA_PLAYSTATE_PLAYING: |
1026 case XA_PLAYSTATE_PLAYING: |
961 case XA_PLAYSTATE_STOPPED: |
1027 case XA_PLAYSTATE_STOPPED: |
962 if ((iAPIBeingUsed == EAudioPlayerUtility) || |
1028 if ((iAPIBeingUsed == EAudioPlayerUtility) || (iAPIBeingUsed |
963 (iAPIBeingUsed == EVideoPlayerUtility) ) |
1029 == EVideoPlayerUtility)) |
964 { |
1030 { |
965 TInt pauseOpRes(KErrNone); |
1031 TInt pauseOpRes(KErrNone); |
966 if (iAPIBeingUsed == EAudioPlayerUtility) |
1032 if (iAPIBeingUsed == EAudioPlayerUtility) |
967 { |
1033 { |
968 TAG_TIME_PROFILING_BEGIN; |
1034 TAG_TIME_PROFILING_BEGIN; |
969 pauseOpRes = iAudioPlayer->Pause(); |
1035 pauseOpRes = iAudioPlayer->Pause(); |
970 TAG_TIME_PROFILING_END; |
1036 TAG_TIME_PROFILING_END; PRINT_TO_CONSOLE_TIME_DIFF; |
971 PRINT_TO_CONSOLE_TIME_DIFF; |
|
972 } |
1037 } |
973 else if (iAPIBeingUsed == EVideoPlayerUtility) |
1038 else if (iAPIBeingUsed == EVideoPlayerUtility) |
974 { |
1039 { |
975 TAG_TIME_PROFILING_BEGIN; |
1040 TAG_TIME_PROFILING_BEGIN; |
976 TRAP(pauseOpRes, iVideoPlayer->PauseL()); |
1041 TRAP(pauseOpRes, iVideoPlayer->PauseL()); |
979 TRAPD(err, iPlaybackHead = iVideoPlayer->PositionL()); |
1044 TRAPD(err, iPlaybackHead = iVideoPlayer->PositionL()); |
980 if (err != KErrNone) |
1045 if (err != KErrNone) |
981 { |
1046 { |
982 iPlaybackHead = 0; |
1047 iPlaybackHead = 0; |
983 } |
1048 } |
984 } |
1049 } TAG_TIME_PROFILING_END; PRINT_TO_CONSOLE_TIME_DIFF; |
985 TAG_TIME_PROFILING_END; |
1050 } |
986 PRINT_TO_CONSOLE_TIME_DIFF; |
1051 if (pauseOpRes == KErrNone) |
987 } |
|
988 if ( pauseOpRes == KErrNone) |
|
989 { |
1052 { |
990 iMediaPlayerState = XA_PLAYSTATE_PAUSED; |
1053 iMediaPlayerState = XA_PLAYSTATE_PAUSED; |
991 iMMFPlayerState = EPlayerPaused; |
1054 iMMFPlayerState = EPlayerPaused; |
992 iMarkerPositionTimer->Stop(); |
1055 iMarkerPositionTimer->Stop(); |
993 iPlayItfPositionUpdateTimer->Stop(); |
1056 iPlayItfPositionUpdateTimer->Stop(); |
1009 XAresult retVal(XA_RESULT_SUCCESS); |
1072 XAresult retVal(XA_RESULT_SUCCESS); |
1010 switch (iMediaPlayerState) |
1073 switch (iMediaPlayerState) |
1011 { |
1074 { |
1012 case XA_PLAYSTATE_PAUSED: |
1075 case XA_PLAYSTATE_PAUSED: |
1013 case XA_PLAYSTATE_PLAYING: |
1076 case XA_PLAYSTATE_PLAYING: |
1014 if ((iAPIBeingUsed == EAudioPlayerUtility) || |
1077 if ((iAPIBeingUsed == EAudioPlayerUtility) || (iAPIBeingUsed |
1015 (iAPIBeingUsed == EVideoPlayerUtility) ) |
1078 == EVideoPlayerUtility)) |
1016 { |
1079 { |
1017 if (iAPIBeingUsed == EAudioPlayerUtility) |
1080 if (iAPIBeingUsed == EAudioPlayerUtility) |
1018 { |
1081 { |
1019 TAG_TIME_PROFILING_BEGIN; |
1082 TAG_TIME_PROFILING_BEGIN; |
1020 iAudioPlayer->Stop(); |
1083 iAudioPlayer->Stop(); |
1021 TAG_TIME_PROFILING_END; |
1084 TAG_TIME_PROFILING_END; PRINT_TO_CONSOLE_TIME_DIFF; |
1022 PRINT_TO_CONSOLE_TIME_DIFF; |
|
1023 |
1085 |
1024 iMMFPlayerState = EPlayerOpened; |
1086 iMMFPlayerState = EPlayerOpened; |
1025 } |
1087 } |
1026 else if (iAPIBeingUsed == EVideoPlayerUtility) |
1088 else if (iAPIBeingUsed == EVideoPlayerUtility) |
1027 { |
1089 { |
1028 TAG_TIME_PROFILING_BEGIN; |
1090 TAG_TIME_PROFILING_BEGIN; |
1029 iVideoPlayer->Stop(); |
1091 iVideoPlayer->Stop(); |
1030 TAG_TIME_PROFILING_END; |
1092 TAG_TIME_PROFILING_END; PRINT_TO_CONSOLE_TIME_DIFF; |
1031 PRINT_TO_CONSOLE_TIME_DIFF; |
1093 |
1032 |
|
1033 iMMFPlayerState = EPlayerPrepared; |
1094 iMMFPlayerState = EPlayerPrepared; |
1034 } |
1095 } |
1035 iMediaPlayerState = XA_PLAYSTATE_STOPPED; |
1096 iMediaPlayerState = XA_PLAYSTATE_STOPPED; |
1036 iPlaybackHead = 0; |
1097 iPlaybackHead = 0; |
1037 iMarkerPositionTimer->Stop(); |
1098 iMarkerPositionTimer->Stop(); |
1108 { |
1169 { |
1109 TInt err(KErrNone); |
1170 TInt err(KErrNone); |
1110 TRAP(err, pos = iVideoPlayer->PositionL()); |
1171 TRAP(err, pos = iVideoPlayer->PositionL()); |
1111 if (err == KErrNone) |
1172 if (err == KErrNone) |
1112 { |
1173 { |
1113 *pMsec = pos.Int64() / divider; |
1174 *pMsec = pos.Int64() / divider; |
1114 retVal = XA_RESULT_SUCCESS; |
1175 retVal = XA_RESULT_SUCCESS; |
1115 } |
1176 } |
1116 } |
1177 } |
1117 break; |
1178 break; |
1118 case XA_PLAYSTATE_PLAYERUNINITIALIZED: |
1179 case XA_PLAYSTATE_PLAYERUNINITIALIZED: |
1130 switch (iMediaPlayerState) |
1191 switch (iMediaPlayerState) |
1131 { |
1192 { |
1132 case XA_PLAYSTATE_STOPPED: |
1193 case XA_PLAYSTATE_STOPPED: |
1133 case XA_PLAYSTATE_PAUSED: |
1194 case XA_PLAYSTATE_PAUSED: |
1134 case XA_PLAYSTATE_PLAYING: |
1195 case XA_PLAYSTATE_PLAYING: |
1135 if(iAPIBeingUsed == EAudioPlayerUtility) |
1196 if (iAPIBeingUsed == EAudioPlayerUtility) |
1136 { |
1197 { |
1137 pos = pMsec * multiplier; |
1198 pos = pMsec * multiplier; |
1138 TAG_TIME_PROFILING_BEGIN; |
1199 TAG_TIME_PROFILING_BEGIN; |
1139 iAudioPlayer->SetPosition(pos); |
1200 iAudioPlayer->SetPosition(pos); |
1140 TAG_TIME_PROFILING_END; |
1201 TAG_TIME_PROFILING_END; PRINT_TO_CONSOLE_TIME_DIFF; |
1141 PRINT_TO_CONSOLE_TIME_DIFF; |
|
1142 |
1202 |
1143 retVal = XA_RESULT_SUCCESS; |
1203 retVal = XA_RESULT_SUCCESS; |
1144 } |
1204 } |
1145 else if (iAPIBeingUsed == EVideoPlayerUtility) |
1205 else if (iAPIBeingUsed == EVideoPlayerUtility) |
1146 { |
1206 { |
1147 pos = pMsec * multiplier; |
1207 pos = pMsec * multiplier; |
1148 TAG_TIME_PROFILING_BEGIN; |
1208 TAG_TIME_PROFILING_BEGIN; |
1149 TRAPD(err, iVideoPlayer->SetPositionL(pos)); |
1209 TRAPD(err, iVideoPlayer->SetPositionL(pos)); |
1150 TAG_TIME_PROFILING_END; |
1210 TAG_TIME_PROFILING_END; |
1151 PRINT_TO_CONSOLE_TIME_DIFF; |
1211 PRINT_TO_CONSOLE_TIME_DIFF; |
1152 if (err == KErrNone) |
1212 if (err == KErrNone) |
1153 { |
1213 { |
1154 retVal = XA_RESULT_SUCCESS; |
1214 retVal = XA_RESULT_SUCCESS; |
1155 } |
1215 } |
1169 switch (iMediaPlayerState) |
1229 switch (iMediaPlayerState) |
1170 { |
1230 { |
1171 case XA_PLAYSTATE_STOPPED: |
1231 case XA_PLAYSTATE_STOPPED: |
1172 case XA_PLAYSTATE_PAUSED: |
1232 case XA_PLAYSTATE_PAUSED: |
1173 case XA_PLAYSTATE_PLAYING: |
1233 case XA_PLAYSTATE_PLAYING: |
1174 if(iAPIBeingUsed == EAudioPlayerUtility) |
1234 if (iAPIBeingUsed == EAudioPlayerUtility) |
1175 { |
1235 { |
1176 numRepeats = repeat ? -2 : 0; |
1236 numRepeats = repeat ? -2 : 0; |
1177 iAudioPlayer->SetRepeats(numRepeats, 0); |
1237 iAudioPlayer->SetRepeats(numRepeats, 0); |
1178 retVal = XA_RESULT_SUCCESS; |
1238 retVal = XA_RESULT_SUCCESS; |
1179 } |
1239 } |
1186 break; |
1246 break; |
1187 } |
1247 } |
1188 return retVal; |
1248 return retVal; |
1189 } |
1249 } |
1190 |
1250 |
1191 XAresult CMMFBackendEngine::SetPlayWindow(XAmillisecond start, XAmillisecond end) |
1251 XAresult CMMFBackendEngine::SetPlayWindow(XAmillisecond start, |
1252 XAmillisecond end) |
|
1192 { |
1253 { |
1193 XAresult retVal(XA_RESULT_INTERNAL_ERROR); |
1254 XAresult retVal(XA_RESULT_INTERNAL_ERROR); |
1194 TInt64 multiplier(1000); |
1255 TInt64 multiplier(1000); |
1195 TTimeIntervalMicroSeconds startpos(0); |
1256 TTimeIntervalMicroSeconds startpos(0); |
1196 TTimeIntervalMicroSeconds endpos(0); |
1257 TTimeIntervalMicroSeconds endpos(0); |
1198 switch (iMediaPlayerState) |
1259 switch (iMediaPlayerState) |
1199 { |
1260 { |
1200 case XA_PLAYSTATE_STOPPED: |
1261 case XA_PLAYSTATE_STOPPED: |
1201 case XA_PLAYSTATE_PAUSED: |
1262 case XA_PLAYSTATE_PAUSED: |
1202 case XA_PLAYSTATE_PLAYING: |
1263 case XA_PLAYSTATE_PLAYING: |
1203 if(iAPIBeingUsed == EAudioPlayerUtility) |
1264 if (iAPIBeingUsed == EAudioPlayerUtility) |
1204 { |
1265 { |
1205 startpos = start * multiplier; |
1266 startpos = start * multiplier; |
1206 endpos = end * multiplier; |
1267 endpos = end * multiplier; |
1207 retVal = iAudioPlayer->SetPlayWindow(startpos,endpos); |
1268 retVal = iAudioPlayer->SetPlayWindow(startpos, endpos); |
1208 } |
1269 } |
1209 else |
1270 else |
1210 { |
1271 { |
1211 } |
1272 } |
1212 break; |
1273 break; |
1266 iMarkerPositionTimer->RegisterCallback(iPlayItfCBFunction); |
1327 iMarkerPositionTimer->RegisterCallback(iPlayItfCBFunction); |
1267 iMarkerPositionTimer->SetMarkerPosition(iMarkerPosition); |
1328 iMarkerPositionTimer->SetMarkerPosition(iMarkerPosition); |
1268 |
1329 |
1269 iPlayItfPositionUpdateTimer->SetCallbackEventMask(iPlayItfEventFlags); |
1330 iPlayItfPositionUpdateTimer->SetCallbackEventMask(iPlayItfEventFlags); |
1270 iPlayItfPositionUpdateTimer->RegisterCallback(iPlayItfCBFunction); |
1331 iPlayItfPositionUpdateTimer->RegisterCallback(iPlayItfCBFunction); |
1271 iPlayItfPositionUpdateTimer->SetPositionUpdatePeriod(iPositionUpdatePeriod); |
1332 iPlayItfPositionUpdateTimer->SetPositionUpdatePeriod( |
1333 iPositionUpdatePeriod); |
|
1272 |
1334 |
1273 switch (iMediaPlayerState) |
1335 switch (iMediaPlayerState) |
1274 { |
1336 { |
1275 case XA_PLAYSTATE_STOPPED: |
1337 case XA_PLAYSTATE_STOPPED: |
1276 case XA_PLAYSTATE_PAUSED: |
1338 case XA_PLAYSTATE_PAUSED: |
1286 return retVal; |
1348 return retVal; |
1287 } |
1349 } |
1288 |
1350 |
1289 void CMMFBackendEngine::DoPostEvent(XAuint32 event) |
1351 void CMMFBackendEngine::DoPostEvent(XAuint32 event) |
1290 { |
1352 { |
1291 if ((iPlayItfEventFlags & event) && |
1353 if ((iPlayItfEventFlags & event) && (iPlayItfCBFunction != NULL)) |
1292 (iPlayItfCBFunction != NULL)) |
1354 { |
1293 { |
1355 XAAdaptEvent xaevent = |
1294 XAAdaptEvent xaevent = {XA_PLAYITFEVENTS, event, 0, 0 }; |
1356 { |
1295 XAAdaptationBase_SendAdaptEvents((XAAdaptationBaseCtx*)iAdaptContext, &xaevent ); |
1357 XA_PLAYITFEVENTS, event, 0, 0 |
1358 }; |
|
1359 XAAdaptationBase_SendAdaptEvents( |
|
1360 (XAAdaptationBaseCtx*) iAdaptContext, &xaevent); |
|
1296 } |
1361 } |
1297 } |
1362 } |
1298 |
1363 |
1299 XAresult CMMFBackendEngine::GetNumStreams(XAuint32* numstreams) |
1364 XAresult CMMFBackendEngine::GetNumStreams(XAuint32* numstreams) |
1300 { |
1365 { |
1301 XAresult retVal(XA_RESULT_SUCCESS); |
1366 XAresult retVal(XA_RESULT_SUCCESS); |
1302 TInt bitRate(0); |
1367 TInt bitRate(0); |
1303 TInt numS(0); |
1368 TInt numS(0); |
1304 if(iAPIBeingUsed == EAudioPlayerUtility) |
1369 if (iAPIBeingUsed == EAudioPlayerUtility) |
1305 { |
1370 { |
1306 numS = 1; |
1371 numS = 1; |
1307 *numstreams = numS; |
1372 *numstreams = numS; |
1308 } |
1373 } |
1309 else if (iAPIBeingUsed == EVideoPlayerUtility) |
1374 else if (iAPIBeingUsed == EVideoPlayerUtility) |
1310 { |
1375 { |
1311 TRAPD(err, bitRate = iVideoPlayer->VideoBitRateL()); |
1376 TRAPD(err, bitRate = iVideoPlayer->VideoBitRateL()); |
1312 if(!err && bitRate) |
1377 if (!err && bitRate) |
1313 { |
1378 { |
1314 numS++; |
1379 numS++; |
1315 *numstreams = numS; |
1380 *numstreams = numS; |
1316 } |
1381 } |
1317 |
1382 |
1318 bitRate = 0; |
1383 bitRate = 0; |
1319 TRAP(err, bitRate = iVideoPlayer->AudioBitRateL()); |
1384 TRAP(err, bitRate = iVideoPlayer->AudioBitRateL()); |
1320 if(!err && bitRate) |
1385 if (!err && bitRate) |
1321 { |
1386 { |
1322 numS++; |
1387 numS++; |
1323 *numstreams = numS; |
1388 *numstreams = numS; |
1324 } |
1389 } |
1325 } |
1390 } |
1326 return retVal; |
1391 return retVal; |
1327 } |
1392 } |
1328 |
1393 |
1329 XAresult CMMFBackendEngine::GetStreamInfo(XAuint32 streamindex, XAuint32* streamtype) |
1394 XAresult CMMFBackendEngine::GetStreamInfo(XAuint32 streamindex, |
1395 XAuint32* streamtype) |
|
1330 { |
1396 { |
1331 XAresult retVal(XA_RESULT_SUCCESS); |
1397 XAresult retVal(XA_RESULT_SUCCESS); |
1332 if(iAPIBeingUsed == EAudioPlayerUtility) |
1398 if (iAPIBeingUsed == EAudioPlayerUtility) |
1333 { |
1399 { |
1334 *streamtype = XA_DOMAINTYPE_AUDIO; |
1400 *streamtype = XA_DOMAINTYPE_AUDIO; |
1335 } |
1401 } |
1336 else if (iAPIBeingUsed == EVideoPlayerUtility) |
1402 else if (iAPIBeingUsed == EVideoPlayerUtility) |
1337 { |
1403 { |
1338 switch(streamindex) |
1404 switch (streamindex) |
1339 { |
1405 { |
1340 case 1: |
1406 case 1: |
1341 *streamtype = XA_DOMAINTYPE_VIDEO; |
1407 *streamtype = XA_DOMAINTYPE_VIDEO; |
1342 break; |
1408 break; |
1343 case 2: |
1409 case 2: |
1349 } |
1415 } |
1350 } |
1416 } |
1351 return retVal; |
1417 return retVal; |
1352 } |
1418 } |
1353 |
1419 |
1354 |
1420 XAresult CMMFBackendEngine::GetVideoFrameSize(XAuint32* height, |
1355 XAresult CMMFBackendEngine::GetVideoFrameSize(XAuint32* height, XAuint32* width, XAuint32* frameRate) |
1421 XAuint32* width, XAuint32* frameRate) |
1356 { |
1422 { |
1357 XAresult retVal(XA_RESULT_SUCCESS); |
1423 XAresult retVal(XA_RESULT_SUCCESS); |
1358 if(iAPIBeingUsed == EVideoPlayerUtility) |
1424 if (iAPIBeingUsed == EVideoPlayerUtility) |
1359 { |
1425 { |
1360 if(iMediaPlayerState != XA_PLAYSTATE_PLAYERUNINITIALIZED) |
1426 if (iMediaPlayerState != XA_PLAYSTATE_PLAYERUNINITIALIZED) |
1361 { |
1427 { |
1362 TSize size; |
1428 TSize size; |
1363 TReal32 framerate(0); |
1429 TReal32 framerate(0); |
1364 TRAPD(err, iVideoPlayer->VideoFrameSizeL(size)); |
1430 TRAPD(err, iVideoPlayer->VideoFrameSizeL(size)); |
1365 if(!err) |
1431 if (!err) |
1366 { |
1432 { |
1367 *height = size.iHeight; |
1433 *height = size.iHeight; |
1368 *width = size.iWidth; |
1434 *width = size.iWidth; |
1369 } |
1435 } |
1370 else |
1436 else |
1371 { |
1437 { |
1372 retVal = err; |
1438 retVal = err; |
1373 } |
1439 } |
1374 |
1440 |
1375 TRAP(err, framerate = iVideoPlayer->VideoFrameRateL()); |
1441 TRAP(err, framerate = iVideoPlayer->VideoFrameRateL()); |
1376 if(!err) |
1442 if (!err) |
1377 { |
1443 { |
1378 *frameRate = framerate; |
1444 *frameRate = framerate; |
1379 } |
1445 } |
1380 } |
1446 } |
1381 else |
1447 else |
1388 retVal = XA_RESULT_FEATURE_UNSUPPORTED; |
1454 retVal = XA_RESULT_FEATURE_UNSUPPORTED; |
1389 } |
1455 } |
1390 return retVal; |
1456 return retVal; |
1391 } |
1457 } |
1392 |
1458 |
1393 XAresult CMMFBackendEngine::SetActiveState(XAuint32 streamindex, XAboolean active) |
1459 XAresult CMMFBackendEngine::SetActiveState(XAuint32 streamindex, |
1460 XAboolean active) |
|
1394 { |
1461 { |
1395 XAresult retVal(XA_RESULT_SUCCESS); |
1462 XAresult retVal(XA_RESULT_SUCCESS); |
1396 TInt err(KErrNone); |
1463 TInt err(KErrNone); |
1397 if(iAPIBeingUsed == EAudioPlayerUtility) |
1464 if (iAPIBeingUsed == EAudioPlayerUtility) |
1398 { |
1465 { |
1399 retVal = XA_RESULT_FEATURE_UNSUPPORTED; |
1466 retVal = XA_RESULT_FEATURE_UNSUPPORTED; |
1400 } |
1467 } |
1401 else if (iAPIBeingUsed == EVideoPlayerUtility) |
1468 else if (iAPIBeingUsed == EVideoPlayerUtility) |
1402 { |
1469 { |
1403 switch(streamindex) |
1470 switch (streamindex) |
1404 { |
1471 { |
1405 case 1: |
1472 case 1: |
1406 TRAP(err, iVideoPlayer->SetVideoEnabledL(active)); |
1473 TRAP(err, iVideoPlayer->SetVideoEnabledL(active)) |
1474 ; |
|
1407 retVal = err; |
1475 retVal = err; |
1408 break; |
1476 break; |
1409 case 2: |
1477 case 2: |
1410 TRAP(err, iVideoPlayer->SetAudioEnabledL(active)); |
1478 TRAP(err, iVideoPlayer->SetAudioEnabledL(active)) |
1479 ; |
|
1411 retVal = err; |
1480 retVal = err; |
1412 break; |
1481 break; |
1413 default: |
1482 default: |
1414 retVal = XA_RESULT_PARAMETER_INVALID; |
1483 retVal = XA_RESULT_PARAMETER_INVALID; |
1415 break; |
1484 break; |
1421 TInt CMMFBackendEngine::InitializeURIForMMFUtil(char *uri) |
1490 TInt CMMFBackendEngine::InitializeURIForMMFUtil(char *uri) |
1422 { |
1491 { |
1423 /* Initializes and save uri param into iUri structure */ |
1492 /* Initializes and save uri param into iUri structure */ |
1424 TInt err(KErrNone); |
1493 TInt err(KErrNone); |
1425 TInt uriLen; |
1494 TInt uriLen; |
1426 |
1495 |
1427 if (!uri) |
1496 if (!uri) |
1428 return KErrArgument; |
1497 return KErrArgument; |
1429 |
1498 |
1430 if (iUri) |
1499 if (iUri) |
1431 { |
1500 { |
1432 delete iUri; |
1501 delete iUri; |
1433 iUri = NULL; |
1502 iUri = NULL; |
1434 } |
1503 } |
1435 |
1504 |
1436 uriLen = strlen(uri); |
1505 uriLen = strlen(uri); |
1437 TPtr8 uriParam((TUint8*)uri, uriLen, uriLen); |
1506 TPtr8 uriParam((TUint8*) uri, uriLen, uriLen); |
1438 |
1507 |
1439 TRAP(err, iUri = HBufC::NewL(uriLen)); |
1508 TRAP(err, iUri = HBufC::NewL(uriLen)); |
1440 if (err != KErrNone) |
1509 if (err != KErrNone) |
1441 return err; |
1510 return err; |
1442 |
1511 |
1443 iUriPtr.Set(iUri->Des()); |
1512 iUriPtr.Set(iUri->Des()); |
1444 iUriPtr.Copy(uriParam); /* Copy data*/ |
1513 iUriPtr.Copy(uriParam); /* Copy data*/ |
1445 iUriPtr.LowerCase(); |
1514 //iUriPtr.LowerCase(); |
1446 |
|
1447 /* For file scheme convert from file:///c:/folder/file.ext |
1515 /* For file scheme convert from file:///c:/folder/file.ext |
1448 * format to c:\\folder\\file.ext using TUriParser. */ |
1516 * format to c:\\folder\\file.ext using TUriParser. */ |
1449 _LIT(KFileScheme,"file:///"); |
1517 _LIT(KFileScheme,"file:///"); |
1450 if (iUriPtr.Find(KFileScheme) >= 0) |
1518 if (iUriPtr.Find(KFileScheme) >= 0) |
1451 { |
1519 { |
1452 TPtr tmp(const_cast<TUint16 *>(iUriPtr.Ptr()) + KFileScheme().Length(), |
1520 iUriType = ELocal; |
1453 iUriPtr.Length(), |
1521 TPtr tmp(const_cast<TUint16 *> (iUriPtr.Ptr()) |
1454 iUriPtr.Length()); |
1522 + KFileScheme().Length(), iUriPtr.Length(), iUriPtr.Length()); |
1455 /* Convert from c:/folder/file.ext format to |
1523 /* Convert from c:/folder/file.ext format to |
1456 * c:\\folder\\file.ext using TUriParser. |
1524 * c:\\folder\\file.ext using TUriParser. |
1457 * TUriParser8 accepts uri in format file:///c/folder/file.ext, |
1525 * TUriParser8 accepts uri in format file:///c/folder/file.ext, |
1458 * so get rid of ':' after drive letter (if any) */ |
1526 * so get rid of ':' after drive letter (if any) */ |
1459 TInt pos = tmp.Find(_L(":")); |
1527 TInt pos = tmp.Find(_L(":")); |
1475 iUriPtr.Copy(file->Des()); |
1543 iUriPtr.Copy(file->Des()); |
1476 delete file; |
1544 delete file; |
1477 file = NULL; |
1545 file = NULL; |
1478 |
1546 |
1479 } |
1547 } |
1548 else |
|
1549 { |
|
1550 iUriType = EStreaming; |
|
1551 } |
|
1480 return err; |
1552 return err; |
1481 } |
1553 } |
1482 |
|
1483 |
1554 |
1484 XAresult CMMFBackendEngine::SetVolume(XAuint32 volume) |
1555 XAresult CMMFBackendEngine::SetVolume(XAuint32 volume) |
1485 { |
1556 { |
1486 XAresult retVal(XA_RESULT_SUCCESS); |
1557 XAresult retVal(XA_RESULT_SUCCESS); |
1487 TInt err(KErrNone); |
1558 TInt err(KErrNone); |
1488 if(iAPIBeingUsed == EAudioPlayerUtility) |
1559 if (iAPIBeingUsed == EAudioPlayerUtility) |
1489 { |
1560 { |
1490 retVal = iAudioPlayer->SetVolume(volume); |
1561 retVal = iAudioPlayer->SetVolume(volume); |
1491 } |
1562 } |
1492 else if (iAPIBeingUsed == EVideoPlayerUtility) |
1563 else if (iAPIBeingUsed == EVideoPlayerUtility) |
1493 { |
1564 { |
1494 TRAP(err, iVideoPlayer->SetVolumeL(volume)); |
1565 TRAP(err, iVideoPlayer->SetVolumeL(volume)); |
1495 retVal = err; |
1566 retVal = err; |
1496 } |
1567 } |
1497 else if(iAPIBeingUsed == EAudioRecorderUtility) |
1568 else if (iAPIBeingUsed == EAudioRecorderUtility) |
1498 { |
1569 { |
1499 retVal = iAudioRecorder->SetVolume(volume); |
1570 retVal = iAudioRecorder->SetVolume(volume); |
1500 } |
1571 } |
1501 return retVal; |
1572 return retVal; |
1502 } |
1573 } |
1503 |
1574 |
1504 XAresult CMMFBackendEngine::GetMaxVolume(XAuint32* maxvolume) |
1575 XAresult CMMFBackendEngine::GetMaxVolume(XAuint32* maxvolume) |
1505 { |
1576 { |
1506 XAresult retVal(XA_RESULT_SUCCESS); |
1577 XAresult retVal(XA_RESULT_SUCCESS); |
1507 if(iAPIBeingUsed == EAudioPlayerUtility) |
1578 if (iAPIBeingUsed == EAudioPlayerUtility) |
1508 { |
1579 { |
1509 *maxvolume = iAudioPlayer->MaxVolume(); |
1580 *maxvolume = iAudioPlayer->MaxVolume(); |
1510 } |
1581 } |
1511 else if (iAPIBeingUsed == EVideoPlayerUtility) |
1582 else if (iAPIBeingUsed == EVideoPlayerUtility) |
1512 { |
1583 { |
1513 *maxvolume = iVideoPlayer->MaxVolume(); |
1584 *maxvolume = iVideoPlayer->MaxVolume(); |
1514 } |
1585 } |
1515 else if(iAPIBeingUsed == EAudioRecorderUtility) |
1586 else if (iAPIBeingUsed == EAudioRecorderUtility) |
1516 { |
1587 { |
1517 *maxvolume = iAudioRecorder->MaxVolume(); |
1588 *maxvolume = iAudioRecorder->MaxVolume(); |
1518 } |
1589 } |
1519 return retVal; |
1590 return retVal; |
1520 } |
1591 } |
1521 |
1592 |
1522 XAresult CMMFBackendEngine::GetVolume(XAuint32* volume) |
1593 XAresult CMMFBackendEngine::GetVolume(XAuint32* volume) |
1523 { |
1594 { |
1524 XAresult retVal(XA_RESULT_SUCCESS); |
1595 XAresult retVal(XA_RESULT_SUCCESS); |
1525 TInt mmfvolume(0); |
1596 TInt mmfvolume(0); |
1526 if(iAPIBeingUsed == EAudioPlayerUtility) |
1597 if (iAPIBeingUsed == EAudioPlayerUtility) |
1527 { |
1598 { |
1528 retVal = iAudioPlayer->GetVolume(mmfvolume); |
1599 retVal = iAudioPlayer->GetVolume(mmfvolume); |
1529 if(retVal == XA_RESULT_SUCCESS) |
1600 if (retVal == XA_RESULT_SUCCESS) |
1530 { |
1601 { |
1531 *volume = mmfvolume; |
1602 *volume = mmfvolume; |
1532 } |
1603 } |
1533 } |
1604 } |
1534 else if (iAPIBeingUsed == EVideoPlayerUtility) |
1605 else if (iAPIBeingUsed == EVideoPlayerUtility) |
1535 { |
1606 { |
1536 *volume = iVideoPlayer->Volume(); |
1607 *volume = iVideoPlayer->Volume(); |
1537 } |
1608 } |
1538 else if(iAPIBeingUsed == EAudioRecorderUtility) |
1609 else if (iAPIBeingUsed == EAudioRecorderUtility) |
1539 { |
1610 { |
1540 retVal = iAudioRecorder->GetVolume(mmfvolume); |
1611 retVal = iAudioRecorder->GetVolume(mmfvolume); |
1541 if(retVal == XA_RESULT_SUCCESS) |
1612 if (retVal == XA_RESULT_SUCCESS) |
1542 { |
1613 { |
1543 *volume = mmfvolume; |
1614 *volume = mmfvolume; |
1544 } |
1615 } |
1545 } |
1616 } |
1546 return retVal; |
1617 return retVal; |
1547 } |
1618 } |
1548 |
1619 |
1549 extern "C" { |
1620 extern "C" |
1621 { |
|
1550 |
1622 |
1551 int mmf_backend_engine_init(void** engine) |
1623 int mmf_backend_engine_init(void** engine) |
1552 { |
1624 { |
1553 TRAPD(err, *engine = CMMFBackendEngine::NewL()); |
1625 TRAPD(err, *engine = CMMFBackendEngine::NewL()); |
1554 return err; |
1626 return err; |
1555 } |
1627 } |
1556 |
1628 |
1557 void mmf_backend_engine_deinit(void* engine) |
1629 void mmf_backend_engine_deinit(void* engine) |
1558 { |
1630 { |
1559 delete ((CMMFBackendEngine*)engine); |
1631 delete ((CMMFBackendEngine*) engine); |
1560 } |
1632 } |
1561 |
1633 |
1562 int mmf_set_recorder_uri(void* context, char* uri, XAuint32 format) |
1634 int mmf_set_recorder_uri(void* context, char* uri, XAuint32 format) |
1563 { |
1635 { |
1564 return ((CMMFBackendEngine*)(context))->SetFileName(uri,format,CMMFBackendEngine::ERecord); |
1636 return ((CMMFBackendEngine*) (context))->SetFileName(uri, format, |
1565 } |
1637 CMMFBackendEngine::ERecord); |
1638 } |
|
1566 |
1639 |
1567 int mmf_set_adapt_context(void* context, void* adaptcontext) |
1640 int mmf_set_adapt_context(void* context, void* adaptcontext) |
1568 { |
1641 { |
1569 return ((CMMFBackendEngine*)(context))->SetAdaptContext(adaptcontext); |
1642 return ((CMMFBackendEngine*) (context))->SetAdaptContext(adaptcontext); |
1570 } |
1643 } |
1571 |
1644 |
1572 void mmf_close(void* context) |
1645 void mmf_close(void* context) |
1573 { |
1646 { |
1574 ((CMMFBackendEngine*)context)->Close(); |
1647 ((CMMFBackendEngine*) context)->Close(); |
1575 } |
1648 } |
1576 |
1649 |
1577 int mmf_start_recording(void* context) |
1650 int mmf_start_recording(void* context) |
1578 { |
1651 { |
1579 return ((CMMFBackendEngine*)(context))->SetRecorderState(CMMFBackendEngine::ERecorderRecording,FALSE); |
1652 return ((CMMFBackendEngine*) (context))->SetRecorderState( |
1580 } |
1653 CMMFBackendEngine::ERecorderRecording, FALSE); |
1581 |
1654 } |
1582 int mmf_stop_recording(void* context, XAboolean stopCalled ) |
1655 |
1583 { |
1656 int mmf_stop_recording(void* context, XAboolean stopCalled) |
1584 return ((CMMFBackendEngine*)(context))->SetRecorderState(CMMFBackendEngine::ERecorderOpen, stopCalled); |
1657 { |
1585 } |
1658 return ((CMMFBackendEngine*) (context))->SetRecorderState( |
1659 CMMFBackendEngine::ERecorderOpen, stopCalled); |
|
1660 } |
|
1586 |
1661 |
1587 int mmf_get_record_position(void* context, XAuint64* position) |
1662 int mmf_get_record_position(void* context, XAuint64* position) |
1588 { |
1663 { |
1589 return ((CMMFBackendEngine*)(context))->GetRecordPosition(position); |
1664 return ((CMMFBackendEngine*) (context))->GetRecordPosition(position); |
1590 } |
1665 } |
1591 |
1666 |
1592 int mmf_set_record_position_update_period(void* context, XAmillisecond msec) |
1667 int mmf_set_record_position_update_period(void* context, |
1593 { |
1668 XAmillisecond msec) |
1594 return ((CMMFBackendEngine*)(context))->SetPositionUpdatePerioed(msec); |
1669 { |
1595 } |
1670 return ((CMMFBackendEngine*) (context))->SetPositionUpdatePerioed( |
1671 msec); |
|
1672 } |
|
1596 |
1673 |
1597 int mmf_get_codec_id(void* context, XAuint32* encoderId) |
1674 int mmf_get_codec_id(void* context, XAuint32* encoderId) |
1598 { |
1675 { |
1599 return ((CMMFBackendEngine*)(context))->GetCodecId(encoderId); |
1676 return ((CMMFBackendEngine*) (context))->GetCodecId(encoderId); |
1600 } |
1677 } |
1601 |
1678 |
1602 int mmf_get_channels(void* context, XAuint32* channelsIn) |
1679 int mmf_get_channels(void* context, XAuint32* channelsIn) |
1603 { |
1680 { |
1604 return ((CMMFBackendEngine*)(context))->GetChannels(channelsIn); |
1681 return ((CMMFBackendEngine*) (context))->GetChannels(channelsIn); |
1605 } |
1682 } |
1606 |
1683 |
1607 int mmf_get_samplerate(void* context, XAmilliHertz* sampleRate) |
1684 int mmf_get_samplerate(void* context, XAmilliHertz* sampleRate) |
1608 { |
1685 { |
1609 return ((CMMFBackendEngine*)(context))->GetSampleRate(sampleRate); |
1686 return ((CMMFBackendEngine*) (context))->GetSampleRate(sampleRate); |
1610 } |
1687 } |
1611 |
1688 |
1612 int mmf_get_bitrate(void* context, XAuint32* bitRate) |
1689 int mmf_get_bitrate(void* context, XAuint32* bitRate) |
1613 { |
1690 { |
1614 return ((CMMFBackendEngine*)(context))->GetBitRate(bitRate); |
1691 return ((CMMFBackendEngine*) (context))->GetBitRate(bitRate); |
1615 } |
1692 } |
1616 |
1693 |
1617 int mmf_set_destination_channels(void* context, XAuint32* channelsIn) |
1694 int mmf_set_destination_channels(void* context, XAuint32* channelsIn) |
1618 { |
1695 { |
1619 return ((CMMFBackendEngine*)(context))->SetDestinationChannels(channelsIn); |
1696 return ((CMMFBackendEngine*) (context))->SetDestinationChannels( |
1620 } |
1697 channelsIn); |
1621 |
1698 } |
1622 int mmf_set_destination_samplerate(void* context, XAmilliHertz* sampleRate) |
1699 |
1623 { |
1700 int mmf_set_destination_samplerate(void* context, |
1624 return ((CMMFBackendEngine*)(context))->SetDestinationSampleRate(sampleRate); |
1701 XAmilliHertz* sampleRate) |
1625 } |
1702 { |
1703 return ((CMMFBackendEngine*) (context))->SetDestinationSampleRate( |
|
1704 sampleRate); |
|
1705 } |
|
1626 |
1706 |
1627 int mmf_set_destination_bitrate(void* context, XAuint32* bitRate) |
1707 int mmf_set_destination_bitrate(void* context, XAuint32* bitRate) |
1628 { |
1708 { |
1629 return ((CMMFBackendEngine*)(context))->SetDestinationBitRate(bitRate); |
1709 return ((CMMFBackendEngine*) (context))->SetDestinationBitRate( |
1630 } |
1710 bitRate); |
1711 } |
|
1631 |
1712 |
1632 XAresult mmf_set_play_adapt_context(void * context, void * adaptcontext) |
1713 XAresult mmf_set_play_adapt_context(void * context, void * adaptcontext) |
1633 { |
1714 { |
1634 return ((CMMFBackendEngine *)(context))->SetPlayAdaptContext(adaptcontext); |
1715 return ((CMMFBackendEngine *) (context))->SetPlayAdaptContext( |
1635 } |
1716 adaptcontext); |
1717 } |
|
1636 |
1718 |
1637 XAresult mmf_set_player_uri(void * context, char * uri, XAuint32 format) |
1719 XAresult mmf_set_player_uri(void * context, char * uri, XAuint32 format) |
1638 { |
1720 { |
1639 return ((CMMFBackendEngine *)(context))->SetFileName(uri,format,CMMFBackendEngine::EPlay); |
1721 return ((CMMFBackendEngine *) (context))->SetFileName(uri, format, |
1640 } |
1722 CMMFBackendEngine::EPlay); |
1641 |
1723 } |
1642 /* |
1724 |
1643 XAresult mmf_set_window_handle(void * context, void * display_info) |
1725 /* |
1644 { |
1726 XAresult mmf_set_window_handle(void * context, void * display_info) |
1645 return ((CMMFBackendEngine *)(context))->SetWindowHandle(display_info); |
1727 { |
1646 } |
1728 return ((CMMFBackendEngine *)(context))->SetWindowHandle(display_info); |
1647 |
1729 } |
1648 */ |
1730 |
1731 */ |
|
1649 XAresult mmf_setup_native_display(void * context, void * display_info) |
1732 XAresult mmf_setup_native_display(void * context, void * display_info) |
1650 { |
1733 { |
1651 return ((CMMFBackendEngine *)(context))->SetNativeDisplayInformation(display_info); |
1734 return ((CMMFBackendEngine *) (context))->SetNativeDisplayInformation( |
1652 } |
1735 display_info); |
1736 } |
|
1653 |
1737 |
1654 XAresult mmf_playitf_resume_playback(void * context) |
1738 XAresult mmf_playitf_resume_playback(void * context) |
1655 { |
1739 { |
1656 return ((CMMFBackendEngine *)(context))->ResumePlayback(); |
1740 return ((CMMFBackendEngine *) (context))->ResumePlayback(); |
1657 } |
1741 } |
1658 |
1742 |
1659 XAresult mmf_playitf_pause_playback(void * context) |
1743 XAresult mmf_playitf_pause_playback(void * context) |
1660 { |
1744 { |
1661 return ((CMMFBackendEngine *)(context))->PausePlayback(); |
1745 return ((CMMFBackendEngine *) (context))->PausePlayback(); |
1662 } |
1746 } |
1663 |
1747 |
1664 XAresult mmf_playitf_stop_playback(void * context) |
1748 XAresult mmf_playitf_stop_playback(void * context) |
1665 { |
1749 { |
1666 return ((CMMFBackendEngine *)(context))->StopPlayback(); |
1750 return ((CMMFBackendEngine *) (context))->StopPlayback(); |
1667 } |
1751 } |
1668 |
1752 |
1669 XAresult mmf_playitf_get_play_state(void * context, XAuint32 * pState) |
1753 XAresult mmf_playitf_get_play_state(void * context, XAuint32 * pState) |
1670 { |
1754 { |
1671 return ((CMMFBackendEngine *)(context))->GetPlayState(pState); |
1755 return ((CMMFBackendEngine *) (context))->GetPlayState(pState); |
1672 } |
1756 } |
1673 |
1757 |
1674 XAresult mmf_playitf_get_duration(void * context, XAmillisecond * pMsec) |
1758 XAresult mmf_playitf_get_duration(void * context, XAmillisecond * pMsec) |
1675 { |
1759 { |
1676 return ((CMMFBackendEngine *)(context))->GetDuration(pMsec); |
1760 return ((CMMFBackendEngine *) (context))->GetDuration(pMsec); |
1677 } |
1761 } |
1678 |
1762 |
1679 XAresult mmf_playitf_get_position(void * context, XAmillisecond * pMsec) |
1763 XAresult mmf_playitf_get_position(void * context, XAmillisecond * pMsec) |
1680 { |
1764 { |
1681 return ((CMMFBackendEngine *)(context))->GetPosition(pMsec); |
1765 return ((CMMFBackendEngine *) (context))->GetPosition(pMsec); |
1682 } |
1766 } |
1683 |
1767 |
1684 XAresult mmf_playitf_register_callback(void * context, xaPlayCallback callback) |
1768 XAresult mmf_playitf_register_callback(void * context, |
1685 { |
1769 xaPlayCallback callback) |
1686 return ((CMMFBackendEngine *)(context))->RegisterCallback(callback); |
1770 { |
1687 } |
1771 return ((CMMFBackendEngine *) (context))->RegisterCallback(callback); |
1688 |
1772 } |
1689 XAresult mmf_playitf_set_callback_events_mask(void * context, XAuint32 eventflags) |
1773 |
1690 { |
1774 XAresult mmf_playitf_set_callback_events_mask(void * context, |
1691 return ((CMMFBackendEngine *)(context))->SetCallbackEventsMask(eventflags); |
1775 XAuint32 eventflags) |
1692 } |
1776 { |
1693 |
1777 return ((CMMFBackendEngine *) (context))->SetCallbackEventsMask( |
1694 XAresult mmf_playitf_set_marker_position(void * context, XAmillisecond mSec) |
1778 eventflags); |
1695 { |
1779 } |
1696 return ((CMMFBackendEngine *)(context))->SetMarkerPosition(mSec); |
1780 |
1697 } |
1781 XAresult mmf_playitf_set_marker_position(void * context, |
1782 XAmillisecond mSec) |
|
1783 { |
|
1784 return ((CMMFBackendEngine *) (context))->SetMarkerPosition(mSec); |
|
1785 } |
|
1698 |
1786 |
1699 XAresult mmf_playitf_clear_marker_position(void * context) |
1787 XAresult mmf_playitf_clear_marker_position(void * context) |
1700 { |
1788 { |
1701 return ((CMMFBackendEngine *)(context))->ClearMarkerPosition(); |
1789 return ((CMMFBackendEngine *) (context))->ClearMarkerPosition(); |
1702 |
1790 |
1703 } |
1791 } |
1704 |
1792 |
1705 XAresult mmf_playitf_set_position_update_period(void * context, XAmillisecond mSec) |
1793 XAresult mmf_playitf_set_position_update_period(void * context, |
1706 { |
1794 XAmillisecond mSec) |
1707 return ((CMMFBackendEngine *)(context))->SetPositionUpdatePeriod(mSec); |
1795 { |
1708 } |
1796 return ((CMMFBackendEngine *) (context))->SetPositionUpdatePeriod( |
1797 mSec); |
|
1798 } |
|
1709 |
1799 |
1710 XAresult mmf_seekitf_set_position(void * context, XAmillisecond pMsec) |
1800 XAresult mmf_seekitf_set_position(void * context, XAmillisecond pMsec) |
1711 { |
1801 { |
1712 return ((CMMFBackendEngine *)(context))->SetPosition(pMsec); |
1802 return ((CMMFBackendEngine *) (context))->SetPosition(pMsec); |
1713 } |
1803 } |
1714 |
1804 |
1715 XAresult mmf_seekitf_set_playwindow(void * context, XAmillisecond start, XAmillisecond end) |
1805 XAresult mmf_seekitf_set_playwindow(void * context, XAmillisecond start, |
1716 { |
1806 XAmillisecond end) |
1717 return ((CMMFBackendEngine *)(context))->SetPlayWindow(start,end); |
1807 { |
1718 } |
1808 return ((CMMFBackendEngine *) (context))->SetPlayWindow(start, end); |
1809 } |
|
1719 |
1810 |
1720 XAresult mmf_seekitf_set_repeats(void * context, XAboolean repeat) |
1811 XAresult mmf_seekitf_set_repeats(void * context, XAboolean repeat) |
1721 { |
1812 { |
1722 return ((CMMFBackendEngine *)(context))->SetRepeats(repeat); |
1813 return ((CMMFBackendEngine *) (context))->SetRepeats(repeat); |
1723 } |
1814 } |
1724 |
1815 |
1725 XAresult mmf_streaminformationitf_get_streaminfo(void * context, XAuint32 streamindex, |
1816 XAresult mmf_streaminformationitf_get_streaminfo(void * context, |
1726 XAuint32* streamtype) |
1817 XAuint32 streamindex, XAuint32* streamtype) |
1727 { |
1818 { |
1728 return ((CMMFBackendEngine *)(context))->GetStreamInfo(streamindex, streamtype); |
1819 return ((CMMFBackendEngine *) (context))->GetStreamInfo(streamindex, |
1729 } |
1820 streamtype); |
1730 |
1821 } |
1731 XAresult mmf_streaminformationitf_get_numstreams(void * context, XAuint32* numstreams) |
1822 |
1732 { |
1823 XAresult mmf_streaminformationitf_get_numstreams(void * context, |
1733 return ((CMMFBackendEngine *)(context))->GetNumStreams(numstreams); |
1824 XAuint32* numstreams) |
1734 } |
1825 { |
1735 |
1826 return ((CMMFBackendEngine *) (context))->GetNumStreams(numstreams); |
1736 XAresult mmf_streaminformationitf_get_videoframesize(void * context, XAuint32* height, |
1827 } |
1737 XAuint32* width, XAuint32* frameRate) |
1828 |
1738 { |
1829 XAresult mmf_streaminformationitf_get_videoframesize(void * context, |
1739 return ((CMMFBackendEngine *)(context))->GetVideoFrameSize(height,width,frameRate); |
1830 XAuint32* height, XAuint32* width, XAuint32* frameRate) |
1740 } |
1831 { |
1741 |
1832 return ((CMMFBackendEngine *) (context))->GetVideoFrameSize(height, |
1742 XAresult mmf_streaminformationitf_set_activestream(void * context, XAuint32 streamindex, |
1833 width, frameRate); |
1743 XAboolean active) |
1834 } |
1744 { |
1835 |
1745 return ((CMMFBackendEngine *)(context))->SetActiveState(streamindex, active); |
1836 XAresult mmf_streaminformationitf_set_activestream(void * context, |
1746 } |
1837 XAuint32 streamindex, XAboolean active) |
1747 |
1838 { |
1839 return ((CMMFBackendEngine *) (context))->SetActiveState(streamindex, |
|
1840 active); |
|
1841 } |
|
1842 |
|
1748 XAresult mmf_volumeitf_set_volume(void * context, XAuint32 volume) |
1843 XAresult mmf_volumeitf_set_volume(void * context, XAuint32 volume) |
1749 { |
1844 { |
1750 return ((CMMFBackendEngine *)(context))->SetVolume(volume); |
1845 return ((CMMFBackendEngine *) (context))->SetVolume(volume); |
1751 } |
1846 } |
1752 |
1847 |
1753 XAresult mmf_volumeitf_get_maxvolume(void * context, XAuint32* volume) |
1848 XAresult mmf_volumeitf_get_maxvolume(void * context, XAuint32* volume) |
1754 { |
1849 { |
1755 return ((CMMFBackendEngine *)(context))->GetMaxVolume(volume); |
1850 return ((CMMFBackendEngine *) (context))->GetMaxVolume(volume); |
1756 } |
1851 } |
1757 |
1852 |
1758 XAresult mmf_volumeitf_get_volume(void * context, XAuint32* volume) |
1853 XAresult mmf_volumeitf_get_volume(void * context, XAuint32* volume) |
1759 { |
1854 { |
1760 return ((CMMFBackendEngine *)(context))->GetVolume(volume); |
1855 return ((CMMFBackendEngine *) (context))->GetVolume(volume); |
1761 } |
1856 } |
1762 } |
1857 } |