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