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