0
|
1 |
/*
|
|
2 |
* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description: DRM Play Session
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#include "DRMPlaySession.h"
|
|
20 |
#include <e32test.h>
|
|
21 |
#include <e32std.h>
|
|
22 |
#include <e32svr.h>
|
|
23 |
#include <mmf/common/mmfcontrollerframework.h>
|
|
24 |
#ifdef RD_TSP_CLIENT_MAPPER
|
|
25 |
#include <tspclientmapper.h>
|
|
26 |
#endif // #ifdef RD_TSP_CLIENT_MAPPER
|
|
27 |
|
|
28 |
#ifdef _DEBUG
|
|
29 |
#define DEP_PRN0(str) RDebug::Print(str)
|
|
30 |
#define DEP_PRN1(str, v1) RDebug::Print(str, v1)
|
|
31 |
#define DEP_PRN2(str, v1, v2) RDebug::Print(str, v1, v2)
|
|
32 |
#else
|
|
33 |
#define DEP_PRN0(str)
|
|
34 |
#define DEP_PRN1(str, v1)
|
|
35 |
#define DEP_PRN2(str, v1, v2)
|
|
36 |
#endif // _DEBUG
|
|
37 |
|
|
38 |
// This is the UID defined by custom interface builder
|
|
39 |
const TUid KUidCustomInterfaceBuilderImpl = {0x10207A8E};
|
|
40 |
|
|
41 |
// panic the client
|
|
42 |
void CDRMPlayServerSession::PanicClient(const RMessage2 &aMessage, TInt aPanic) const
|
|
43 |
{
|
|
44 |
_LIT(KTxtServer,"DRM Play server");
|
|
45 |
aMessage.Panic(KTxtServer,aPanic);
|
|
46 |
}
|
|
47 |
|
|
48 |
CDRMPlayServerSession::CDRMPlayServerSession(CDRMPlayServer* aServer)
|
|
49 |
:iMessage2(NULL)
|
|
50 |
{
|
|
51 |
iServer=aServer;
|
|
52 |
}
|
|
53 |
|
|
54 |
CDRMPlayServerSession* CDRMPlayServerSession::NewL(CDRMPlayServer* aServer, const RMessage2& aMessage )
|
|
55 |
{
|
|
56 |
DEP_PRN0(_L("CDRMPlayServerSession::NewL"));
|
|
57 |
|
|
58 |
CDRMPlayServerSession* self = new(ELeave) CDRMPlayServerSession(aServer);
|
|
59 |
CleanupStack::PushL(self);
|
|
60 |
self->ConstructL( aMessage );
|
|
61 |
CleanupStack::Pop(self);
|
|
62 |
return self;
|
|
63 |
}
|
|
64 |
|
|
65 |
#ifdef RD_TSP_CLIENT_MAPPER
|
|
66 |
void CDRMPlayServerSession::ConstructL( const RMessage2& aMessage )
|
|
67 |
#else
|
|
68 |
void CDRMPlayServerSession::ConstructL( const RMessage2& /*aMessage*/ )
|
|
69 |
#endif //RD_TSP_CLIENT_MAPPER
|
|
70 |
{
|
|
71 |
#ifdef RD_TSP_CLIENT_MAPPER
|
|
72 |
iTSPClientMapper = CTspClientMapper::NewL();
|
|
73 |
// Get client process ID
|
|
74 |
RThread clientThread;
|
|
75 |
RProcess clientProcess;
|
|
76 |
// Open client thread and process handles
|
|
77 |
User::LeaveIfError( aMessage.Client(clientThread) );
|
|
78 |
User::LeaveIfError( clientThread.Process(clientProcess) );
|
|
79 |
// Get process id
|
|
80 |
iClientProcessId = clientProcess.Id();
|
|
81 |
// Close client thread and client process handles
|
|
82 |
clientThread.Close();
|
|
83 |
clientProcess.Close();
|
|
84 |
|
|
85 |
iTSPClientMapper->SetTspTargetClient(
|
|
86 |
CTspClientMapper::ERegisteredClients,
|
|
87 |
iClientProcessId );
|
|
88 |
#endif // #ifdef RD_TSP_CLIENT_MAPPER
|
|
89 |
|
|
90 |
// Increment number of sessions in server
|
|
91 |
iServer->iClients++;
|
|
92 |
|
|
93 |
DEP_PRN1(_L("CDRMPlayServerSession::iClients = %d"), iServer->iClients);
|
|
94 |
}
|
|
95 |
|
|
96 |
CDRMPlayServerSession::~CDRMPlayServerSession()
|
|
97 |
{
|
|
98 |
if(iMetaDataBuffer)
|
|
99 |
{
|
|
100 |
delete iMetaDataBuffer;
|
|
101 |
iMetaDataBuffer = NULL;
|
|
102 |
}
|
|
103 |
// Delete any pending message objects
|
|
104 |
// This will never happen, only happens when
|
|
105 |
// Client closes the session in the middle of playback
|
|
106 |
// but we cannot complete the message as RSession Handle is invalid
|
|
107 |
/* if (iMessage2)
|
|
108 |
{
|
|
109 |
iMessage2->Complete(KErrCancel);
|
|
110 |
}
|
|
111 |
*/
|
|
112 |
if(iMessage2)
|
|
113 |
{
|
|
114 |
delete iMessage2;
|
|
115 |
iMessage2 = NULL;
|
|
116 |
}
|
|
117 |
|
|
118 |
// Delete play utility
|
|
119 |
if (iPlayUtil)
|
|
120 |
{
|
|
121 |
delete iPlayUtil;
|
|
122 |
iPlayUtil = NULL;
|
|
123 |
}
|
|
124 |
//delete iAsyncCallback;
|
|
125 |
//iAsyncCallback = NULL;
|
|
126 |
|
|
127 |
#ifdef RD_TSP_CLIENT_MAPPER
|
|
128 |
if (iTSPClientMapper)
|
|
129 |
{
|
|
130 |
|
|
131 |
TInt status = iTSPClientMapper->RemoveTspTargetClient(
|
|
132 |
CTspClientMapper::ERegisteredClients,
|
|
133 |
iClientProcessId );
|
|
134 |
DEP_PRN2(_L("CDRMPlayServerSession::~CDRMPlayServerSession:Unreg PID[%x]Status[%d]"), iClientProcessId.Id(), status );
|
|
135 |
delete iTSPClientMapper;
|
|
136 |
}
|
|
137 |
#endif // #ifdef RD_TSP_CLIENT_MAPPER
|
|
138 |
|
|
139 |
// Cancel any pending async messages.
|
|
140 |
TInt index(0);
|
|
141 |
CDRMCustomCommandAsyncAO* tempAO(NULL);
|
|
142 |
for (;index < iActiveAsyncCustomCommands.Count(); index++)
|
|
143 |
{
|
|
144 |
tempAO = iActiveAsyncCustomCommands[0];
|
|
145 |
if ( iCDRMCustomCommandAsyncAO2Phase == tempAO )
|
|
146 |
{
|
|
147 |
iCDRMCustomCommandAsyncAO2Phase = NULL;
|
|
148 |
}
|
|
149 |
delete tempAO;
|
|
150 |
iActiveAsyncCustomCommands.Remove(0);
|
|
151 |
}
|
|
152 |
iActiveAsyncCustomCommands.Reset();
|
|
153 |
iActiveAsyncCustomCommands.Close();
|
|
154 |
|
|
155 |
delete iCDRMCustomCommandAsyncAO2Phase;
|
|
156 |
|
|
157 |
iServer->iClients--;
|
|
158 |
|
|
159 |
if(!iServer->iClients)
|
|
160 |
{
|
|
161 |
CActiveScheduler::Stop();
|
|
162 |
}
|
|
163 |
}
|
|
164 |
|
|
165 |
void CDRMPlayServerSession::ServiceL(const RMessage2& aMessage)
|
|
166 |
{
|
|
167 |
TInt ret = KErrNone;
|
|
168 |
TRAPD(err,ret = DispatchMessageL(aMessage));
|
|
169 |
if (KErrNone != err)
|
|
170 |
{
|
|
171 |
ret = err;
|
|
172 |
}
|
|
173 |
if(iAsyncComplete == EFalse)
|
|
174 |
{
|
|
175 |
DEP_PRN1(_L("CDRMPlayServerSession::ServiceL - ret = %d"),ret);
|
|
176 |
aMessage.Complete(ret);
|
|
177 |
}
|
|
178 |
}
|
|
179 |
|
|
180 |
|
|
181 |
|
|
182 |
// service a client request; test the opcode and then do appropriate servicing
|
|
183 |
TInt CDRMPlayServerSession::DispatchMessageL(const RMessage2 &aMessage)
|
|
184 |
{
|
|
185 |
TInt ret=KErrNone;
|
|
186 |
iAsyncComplete= EFalse;
|
|
187 |
DEP_PRN1(_L("CDRMPlayServerSession::DispatchMessageL:FnId[%d]"),aMessage.Function());
|
|
188 |
switch (aMessage.Function())
|
|
189 |
{
|
|
190 |
case EDRMPlayServCreate:
|
|
191 |
break;
|
|
192 |
case EDRMPlayServNewFilePlayerL:
|
|
193 |
iMessage = aMessage;
|
|
194 |
NewFilePlayerL(aMessage);
|
|
195 |
iAsyncComplete = ETrue;
|
|
196 |
break;
|
|
197 |
case EDRMPlayServNewDesPlayerL:
|
|
198 |
iMessage = aMessage;
|
|
199 |
NewDesPlayerL(aMessage);
|
|
200 |
iAsyncComplete = ETrue;
|
|
201 |
break;
|
|
202 |
case EDRMPlayServNewDesPlayerReadOnlyL:
|
|
203 |
iMessage = aMessage;
|
|
204 |
NewDesPlayerReadOnlyL(aMessage);
|
|
205 |
iAsyncComplete = ETrue;
|
|
206 |
break;
|
|
207 |
case EDRMPlayServNewPlayerL:
|
|
208 |
NewPlayerL(aMessage);
|
|
209 |
break;
|
|
210 |
case EDRMPlayServOpenFile:
|
|
211 |
iMessage = aMessage;
|
|
212 |
OpenFileL(aMessage);
|
|
213 |
iAsyncComplete = ETrue;
|
|
214 |
break;
|
|
215 |
case EDRMPlayServOpenFileByHandle:
|
|
216 |
iMessage = aMessage;
|
|
217 |
OpenFileByHandleL(aMessage);
|
|
218 |
iAsyncComplete = ETrue;
|
|
219 |
break;
|
|
220 |
case EDRMPlayServOpenFileBySource:
|
|
221 |
iMessage = aMessage;
|
|
222 |
OpenFileBySourceL(aMessage);
|
|
223 |
iAsyncComplete = ETrue;
|
|
224 |
break;
|
|
225 |
case EDRMPlayServOpenDes:
|
|
226 |
iMessage = aMessage;
|
|
227 |
OpenDesL(aMessage);
|
|
228 |
iAsyncComplete = ETrue;
|
|
229 |
break;
|
|
230 |
case EDRMPlayServOpenUrl:
|
|
231 |
iMessage = aMessage;
|
|
232 |
OpenUrlL(aMessage);
|
|
233 |
iAsyncComplete = ETrue;
|
|
234 |
break;
|
|
235 |
case EDRMPlayServPlay:
|
|
236 |
iMessage = aMessage;
|
|
237 |
if(iMessage2)
|
|
238 |
{
|
|
239 |
iMessage2->Complete(KErrCancel);
|
|
240 |
delete iMessage2;
|
|
241 |
iMessage2 = NULL;
|
|
242 |
}
|
|
243 |
iMessage2 = new (ELeave) RMessage2(aMessage);
|
|
244 |
Play();
|
|
245 |
iAsyncComplete = ETrue;
|
|
246 |
break;
|
|
247 |
case EDRMPlayServStop:
|
|
248 |
if(iState == EStopped)
|
|
249 |
break;
|
|
250 |
if(iMessage2)
|
|
251 |
{
|
|
252 |
iMessage2->Complete(KErrCancel);
|
|
253 |
delete iMessage2;
|
|
254 |
iMessage2 = NULL;
|
|
255 |
}
|
|
256 |
Stop();
|
|
257 |
break;
|
|
258 |
case EDRMPlayServSetVolume:
|
|
259 |
SetVolume(aMessage);
|
|
260 |
break;
|
|
261 |
case EDRMPlayServSetRepeats:
|
|
262 |
SetRepeats(aMessage);
|
|
263 |
break;
|
|
264 |
case EDRMPlayServSetVolumeRamp:
|
|
265 |
SetVolumeRamp(aMessage);
|
|
266 |
break;
|
|
267 |
case EDRMPlayServDuration:
|
|
268 |
Duration(aMessage);
|
|
269 |
break;
|
|
270 |
case EDRMPlayServMaxVolume:
|
|
271 |
ret = MaxVolume();
|
|
272 |
break;
|
|
273 |
case EDRMPlayServPause:
|
|
274 |
ret = Pause();
|
|
275 |
if(iMessage2)
|
|
276 |
{
|
|
277 |
iMessage2->Complete(KErrCancel);
|
|
278 |
delete iMessage2;
|
|
279 |
iMessage2 = NULL;
|
|
280 |
}
|
|
281 |
iAsyncComplete = EFalse;
|
|
282 |
break;
|
|
283 |
case EDRMPlayServClose:
|
|
284 |
Close();
|
|
285 |
break;
|
|
286 |
case EDRMPlayServGetPosition:
|
|
287 |
ret = GetPosition(aMessage);
|
|
288 |
break;
|
|
289 |
case EDRMPlayServSetPosition:
|
|
290 |
SetPosition(aMessage);
|
|
291 |
break;
|
|
292 |
case EDRMPlayServSetPriority:
|
|
293 |
ret = SetPriority(aMessage);
|
|
294 |
break;
|
|
295 |
case EDRMPlayServGetVolume:
|
|
296 |
ret = GetVolume(aMessage);
|
|
297 |
break;
|
|
298 |
case EDRMPlayServGetNumberOfMetaDataEntries:
|
|
299 |
ret = GetNumberOfMetaDataEntries(aMessage);
|
|
300 |
break;
|
|
301 |
case EDRMPlayServGetMetaDataEntry:
|
|
302 |
GetMetaDataEntryL(aMessage);
|
|
303 |
break;
|
|
304 |
case EDRMPlayServClearPlayWindow:
|
|
305 |
ret = ClearPlayWindow();
|
|
306 |
break;
|
|
307 |
case EDRMPlayServSetBalance:
|
|
308 |
ret = SetBalance(aMessage);
|
|
309 |
break;
|
|
310 |
case EDRMPlayServGetBalance:
|
|
311 |
ret = GetBalance(aMessage);
|
|
312 |
break;
|
|
313 |
case EDRMPlayServGetBitRate:
|
|
314 |
ret = GetBitRate(aMessage);
|
|
315 |
break;
|
|
316 |
case EDRMPlayServRegisterForAudioLoadingNotification:
|
|
317 |
iMessage = aMessage;
|
|
318 |
RegisterForAudioLoadingNotification(aMessage);
|
|
319 |
iAsyncComplete = ETrue;
|
|
320 |
break;
|
|
321 |
case EDRMPlayServGetAudioLoadingProgress:
|
|
322 |
GetAudioLoadingProgressL(aMessage);
|
|
323 |
break;
|
|
324 |
case EDRMPlayServSetPlayWindow:
|
|
325 |
SetPlayWindow(aMessage);
|
|
326 |
break;
|
|
327 |
case EDRMPlayServControllerImplementationInformation:
|
|
328 |
ControllerImplementationInformationL(aMessage);
|
|
329 |
break;
|
|
330 |
case EDRMPlayServCustomCommandSyncWithReturn:
|
|
331 |
case EDRMPlayServCustomCommandSyncWithoutReturn:
|
|
332 |
CustomCommandSyncL(aMessage);
|
|
333 |
break;
|
|
334 |
case EDRMPlayServCustomCommandAsyncWithReturnStep1:
|
|
335 |
case EDRMPlayServCustomCommandAsyncWithoutReturnStep1:
|
|
336 |
CustomCommandAsyncStep1L(aMessage);
|
|
337 |
// Setting this flag does not complete message in ServiceL,
|
|
338 |
iAsyncComplete = ETrue;
|
|
339 |
break;
|
|
340 |
case EDRMPlayServCustomCommandAsyncWithReturnStep2:
|
|
341 |
case EDRMPlayServCustomCommandAsyncWithoutReturnStep2:
|
|
342 |
CustomCommandAsyncStep2L(aMessage);
|
|
343 |
// Setting this flag does not complete message in ServiceL,
|
|
344 |
iAsyncComplete = ETrue;
|
|
345 |
break;
|
|
346 |
case EDRMPlayServSetPriorityPreference:
|
|
347 |
SetPriorityPreference(aMessage);
|
|
348 |
break;
|
|
349 |
|
|
350 |
default:
|
|
351 |
PanicClient(aMessage, EBadRequest);
|
|
352 |
break;
|
|
353 |
}
|
|
354 |
return ret;
|
|
355 |
}
|
|
356 |
|
|
357 |
void CDRMPlayServerSession::NewFilePlayerL(const RMessage2 aMessage)
|
|
358 |
{
|
|
359 |
TDataStructPckgBuf params;
|
|
360 |
|
|
361 |
aMessage.Read(0,iCallbackState);
|
|
362 |
aMessage.Read(1,params);
|
|
363 |
aMessage.Read(2,iErrDurPckg);
|
|
364 |
HBufC16* inputBuf = HBufC16::NewL(aMessage.GetDesLengthL(3));
|
2
|
365 |
CleanupStack::PushL(inputBuf);
|
0
|
366 |
TPtr16 ptr = inputBuf->Des();
|
|
367 |
aMessage.Read(3,ptr);
|
|
368 |
const TDataStruct &theStruct = params();
|
|
369 |
delete iPlayUtil;
|
|
370 |
iPlayUtil = NULL;
|
|
371 |
iPlayUtil = CMdaAudioPlayerUtility::NewFilePlayerL( inputBuf->Des(),
|
|
372 |
*this,
|
|
373 |
iPriority,
|
|
374 |
iPref);
|
2
|
375 |
CleanupStack::Pop(inputBuf);
|
0
|
376 |
delete inputBuf;
|
|
377 |
}
|
|
378 |
|
|
379 |
void CDRMPlayServerSession::NewDesPlayerL(const RMessage2 aMessage)
|
|
380 |
{
|
|
381 |
TDataStructPckgBuf thePckg;
|
|
382 |
aMessage.Read(0,iCallbackState);
|
|
383 |
aMessage.Read(1,thePckg);
|
|
384 |
aMessage.Read(2,iErrDurPckg);
|
|
385 |
|
|
386 |
delete iPlayUtil;
|
|
387 |
iPlayUtil = NULL;
|
|
388 |
iPlayUtil = CMdaAudioPlayerUtility::NewDesPlayerL(thePckg().iData,
|
|
389 |
*this,
|
|
390 |
iPriority,
|
|
391 |
iPref);
|
|
392 |
|
|
393 |
}
|
|
394 |
|
|
395 |
void CDRMPlayServerSession::NewDesPlayerReadOnlyL(const RMessage2 aMessage)
|
|
396 |
{
|
|
397 |
TDataStructPckgBuf thePckg;
|
|
398 |
aMessage.Read(0,iCallbackState);
|
|
399 |
aMessage.Read(1,thePckg);
|
|
400 |
aMessage.Read(2,iErrDurPckg);
|
|
401 |
|
|
402 |
delete iPlayUtil;
|
|
403 |
iPlayUtil = NULL;
|
|
404 |
iPlayUtil = CMdaAudioPlayerUtility::NewDesPlayerReadOnlyL(thePckg().iData,
|
|
405 |
*this,
|
|
406 |
iPriority,
|
|
407 |
iPref);
|
|
408 |
}
|
|
409 |
|
|
410 |
void CDRMPlayServerSession::NewPlayerL(const RMessage2 aMessage)
|
|
411 |
{
|
|
412 |
|
|
413 |
TDataStructPckgBuf thePckg;
|
|
414 |
aMessage.Read(0,iCallbackState);
|
|
415 |
aMessage.Read(1,thePckg);
|
|
416 |
aMessage.Read(2,iErrDurPckg);
|
|
417 |
|
|
418 |
delete iPlayUtil;
|
|
419 |
iPlayUtil = NULL;
|
|
420 |
iPlayUtil = CMdaAudioPlayerUtility::NewL(*this,
|
|
421 |
iPriority,
|
|
422 |
iPref);
|
|
423 |
}
|
|
424 |
|
|
425 |
void CDRMPlayServerSession::OpenFileL(const RMessage2 &aMessage)
|
|
426 |
{
|
|
427 |
//call mmfclientaudioplayer open file
|
|
428 |
iFileHandleUsed = EFalse;
|
|
429 |
|
|
430 |
aMessage.Read(0,iCallbackState);
|
|
431 |
// Get the file length
|
|
432 |
TInt len = aMessage.GetDesLengthL(1);
|
|
433 |
HBufC* fileName = HBufC::NewLC(len);
|
|
434 |
TPtr fileNamePtr = fileName->Des();
|
|
435 |
aMessage.Read(1,fileNamePtr);
|
|
436 |
aMessage.Read(2,iErrDurPckg);
|
|
437 |
if(iPlayUtil)
|
|
438 |
{
|
|
439 |
iPlayUtil->OpenFileL(fileNamePtr);
|
|
440 |
}
|
|
441 |
CleanupStack::PopAndDestroy(fileName);
|
|
442 |
}
|
|
443 |
|
|
444 |
void CDRMPlayServerSession::OpenFileByHandleL(const RMessage2 &aMessage)
|
|
445 |
{
|
|
446 |
iFileHandleUsed = ETrue;
|
|
447 |
TInt err = iFileHandle.AdoptFromClient(aMessage,1,3);
|
|
448 |
|
|
449 |
aMessage.Read(0,iCallbackState);
|
|
450 |
aMessage.Read(2,iErrDurPckg);
|
|
451 |
|
|
452 |
if (err == KErrNone)
|
|
453 |
{
|
|
454 |
if(iPlayUtil)
|
|
455 |
{
|
|
456 |
iPlayUtil->OpenFileL(iFileHandle);
|
|
457 |
}
|
|
458 |
}
|
|
459 |
else
|
|
460 |
{
|
|
461 |
User::Leave(err);
|
|
462 |
}
|
|
463 |
}
|
|
464 |
|
|
465 |
void CDRMPlayServerSession::OpenFileBySourceL(const RMessage2 &/*aMessage*/)
|
|
466 |
{
|
|
467 |
|
|
468 |
}
|
|
469 |
|
|
470 |
void CDRMPlayServerSession::OpenDesL(const RMessage2 &aMessage)
|
|
471 |
{
|
|
472 |
//call mmfclientaudioplayer OpenDesL
|
|
473 |
TBuf8<50> aDes;
|
|
474 |
|
|
475 |
aMessage.Read(0,iCallbackState);
|
|
476 |
aMessage.Read(1,aDes);
|
|
477 |
aMessage.Read(2,iErrDurPckg);
|
|
478 |
|
|
479 |
if(iPlayUtil)
|
|
480 |
{
|
|
481 |
iPlayUtil->OpenDesL(aDes);
|
|
482 |
}
|
|
483 |
}
|
|
484 |
|
|
485 |
void CDRMPlayServerSession::OpenUrlL(const RMessage2 &aMessage)
|
|
486 |
{
|
|
487 |
//call mmfclientaudioplayer OpenUrlL
|
|
488 |
TUrlStructPckgBuf thePckg;
|
|
489 |
|
|
490 |
aMessage.Read(0,iCallbackState);
|
|
491 |
aMessage.Read(1,thePckg);
|
|
492 |
aMessage.Read(2,iErrDurPckg);
|
|
493 |
|
|
494 |
if(iPlayUtil)
|
|
495 |
{
|
|
496 |
iPlayUtil->OpenUrlL(thePckg().iUrl,
|
|
497 |
thePckg().iIapId,
|
|
498 |
thePckg().iMimeType);
|
|
499 |
}
|
|
500 |
}
|
|
501 |
|
|
502 |
void CDRMPlayServerSession::Play()
|
|
503 |
{
|
|
504 |
//call mmfclientaudioplayer Play
|
|
505 |
iState = EPlaying;
|
|
506 |
if(iPlayUtil)
|
|
507 |
{
|
|
508 |
iPlayUtil->Play();
|
|
509 |
#ifdef RD_TSP_CLIENT_MAPPER
|
|
510 |
TInt status = iTSPClientMapper->SetTspTargetClientToOtherType(
|
|
511 |
CTspClientMapper::EPlayingClients,
|
|
512 |
iClientProcessId );
|
|
513 |
DEP_PRN2(_L("CDRMPlayServerSession::Play:Change PID[%x]Status[%d]"), iClientProcessId.Id(), status );
|
|
514 |
#endif // #ifdef RD_TSP_CLIENT_MAPPER
|
|
515 |
}
|
|
516 |
}
|
|
517 |
|
|
518 |
void CDRMPlayServerSession::Stop()
|
|
519 |
{
|
|
520 |
//call mmfclientaudioplayer Stop
|
|
521 |
if(iPlayUtil)
|
|
522 |
{
|
|
523 |
iPlayUtil->Stop();
|
|
524 |
#ifdef RD_TSP_CLIENT_MAPPER
|
|
525 |
TInt status = iTSPClientMapper->SetTspTargetClientToOtherType(
|
|
526 |
CTspClientMapper::EStoppedClients,
|
|
527 |
iClientProcessId );
|
|
528 |
DEP_PRN2(_L("CDRMPlayServerSession::Stop:Change PID[%x]Status[%d]"), iClientProcessId.Id(), status );
|
|
529 |
#endif // #ifdef RD_TSP_CLIENT_MAPPER
|
|
530 |
}
|
|
531 |
iState = EStopped;
|
|
532 |
}
|
|
533 |
|
|
534 |
void CDRMPlayServerSession::SetVolume(const RMessage2 & aMessage)
|
|
535 |
{
|
|
536 |
//call mmfclientaudioplayer SetVolume
|
|
537 |
TInt theVolume = aMessage.Int0();
|
|
538 |
|
|
539 |
if(iPlayUtil)
|
|
540 |
{
|
|
541 |
iPlayUtil->SetVolume(theVolume);
|
|
542 |
}
|
|
543 |
}
|
|
544 |
|
|
545 |
void CDRMPlayServerSession::SetRepeats(const RMessage2 &aMessage)
|
|
546 |
{
|
|
547 |
//call mmfclientaudioplayer SetRepeats
|
|
548 |
TInt theRepeatNumberOfTimes = aMessage.Int0();
|
|
549 |
TTimeIntervalMicroSeconds theTrailingSilence;
|
|
550 |
|
|
551 |
TPckgTTimeIntervalMicroSeconds theTrailingSilencePckg(theTrailingSilence);
|
|
552 |
aMessage.Read(1,theTrailingSilencePckg);
|
|
553 |
|
|
554 |
iPlayUtil->SetRepeats(theRepeatNumberOfTimes,theTrailingSilence);
|
|
555 |
}
|
|
556 |
|
|
557 |
void CDRMPlayServerSession::SetVolumeRamp(const RMessage2 &aMessage)
|
|
558 |
{
|
|
559 |
//call mmfclientaudioplayer SetVolumeRamp
|
|
560 |
TTimeIntervalMicroSeconds theRampDuration;
|
|
561 |
TPckgTTimeIntervalMicroSeconds theRampDurationPckg(theRampDuration);
|
|
562 |
aMessage.Read(0,theRampDurationPckg);
|
|
563 |
|
|
564 |
iPlayUtil->SetVolumeRamp(theRampDuration);
|
|
565 |
}
|
|
566 |
|
|
567 |
void CDRMPlayServerSession::Duration(const RMessage2& aMessage)
|
|
568 |
{
|
|
569 |
TTimeIntervalMicroSeconds theDuration;
|
|
570 |
theDuration = iPlayUtil->Duration();
|
|
571 |
|
|
572 |
TPckgBufTTimeIntervalMicroSeconds theDurationPckg(theDuration);
|
|
573 |
aMessage.Write(0,theDurationPckg);
|
|
574 |
}
|
|
575 |
|
|
576 |
TInt CDRMPlayServerSession::MaxVolume()
|
|
577 |
{
|
|
578 |
TInt theMaxVolume;
|
|
579 |
theMaxVolume = iPlayUtil->MaxVolume();
|
|
580 |
|
|
581 |
return theMaxVolume;
|
|
582 |
}
|
|
583 |
|
|
584 |
// API Additions since version 7.0
|
|
585 |
TInt CDRMPlayServerSession::Pause()
|
|
586 |
{
|
|
587 |
TInt ret = KErrNone;
|
|
588 |
if(iPlayUtil)
|
|
589 |
{
|
|
590 |
ret = iPlayUtil->Pause();
|
|
591 |
}
|
|
592 |
|
|
593 |
// This message should not be completed here. It should be completed in ServiceL()
|
|
594 |
/* if(iState == EPlaying)
|
|
595 |
{
|
|
596 |
iMessage.Complete(KErrNone);
|
|
597 |
}*/
|
|
598 |
iState = EStopped;
|
|
599 |
return ret;
|
|
600 |
}
|
|
601 |
|
|
602 |
void CDRMPlayServerSession::Close()
|
|
603 |
{
|
|
604 |
|
|
605 |
if(iFileHandleUsed)
|
|
606 |
iFileHandle.Close();
|
|
607 |
|
|
608 |
iPlayUtil->Close();
|
|
609 |
}
|
|
610 |
|
|
611 |
TInt CDRMPlayServerSession::GetPosition(const RMessage2 &aMessage)
|
|
612 |
{
|
|
613 |
TInt ret;
|
|
614 |
TTimeIntervalMicroSeconds thePosition;
|
|
615 |
|
|
616 |
ret = iPlayUtil->GetPosition(thePosition);
|
|
617 |
|
|
618 |
|
|
619 |
TPckgTTimeIntervalMicroSeconds thePositionPckg(thePosition);
|
|
620 |
aMessage.Write(0,thePositionPckg);
|
|
621 |
|
|
622 |
return ret;
|
|
623 |
}
|
|
624 |
|
|
625 |
void CDRMPlayServerSession::SetPosition(const RMessage2 &aMessage)
|
|
626 |
{
|
|
627 |
TTimeIntervalMicroSeconds thePosition;
|
|
628 |
TPckgTTimeIntervalMicroSeconds thePositionPckg(thePosition);
|
|
629 |
aMessage.Read(0,thePositionPckg);
|
|
630 |
iPlayUtil->SetPosition(thePosition);
|
|
631 |
}
|
|
632 |
|
|
633 |
TInt CDRMPlayServerSession::SetPriority(const RMessage2 &aMessage)
|
|
634 |
{
|
|
635 |
TInt thePriority = aMessage.Int0();
|
|
636 |
TMdaPriorityPreference thePref = (TMdaPriorityPreference)aMessage.Int1();
|
|
637 |
|
|
638 |
TInt ret = iPlayUtil->SetPriority(thePriority,thePref);
|
|
639 |
|
|
640 |
return ret;
|
|
641 |
}
|
|
642 |
|
|
643 |
TInt CDRMPlayServerSession::GetVolume(const RMessage2 &aMessage)
|
|
644 |
{
|
|
645 |
TInt theVolume;
|
|
646 |
TInt ret = iPlayUtil->GetVolume(theVolume);
|
|
647 |
TPckgBufTInt pckg(theVolume);
|
|
648 |
aMessage.Write(0,pckg);
|
|
649 |
return ret;
|
|
650 |
}
|
|
651 |
|
|
652 |
TInt CDRMPlayServerSession::GetNumberOfMetaDataEntries(const RMessage2 &aMessage)
|
|
653 |
{
|
|
654 |
TInt ret;
|
|
655 |
TInt theNumOfMetaDataEntries;
|
|
656 |
|
|
657 |
ret = iPlayUtil->GetNumberOfMetaDataEntries(theNumOfMetaDataEntries);
|
|
658 |
|
|
659 |
TPckgBufTInt pckg(theNumOfMetaDataEntries);
|
|
660 |
aMessage.Write(0,pckg);
|
|
661 |
|
|
662 |
return ret;
|
|
663 |
}
|
|
664 |
|
|
665 |
|
|
666 |
void CDRMPlayServerSession::GetMetaDataEntryL(const RMessage2 &aMessage)
|
|
667 |
{
|
|
668 |
//Get the index of the required entry
|
|
669 |
TInt theIndex = aMessage.Int0();
|
|
670 |
CMMFMetaDataEntry* entry = iPlayUtil->GetMetaDataEntryL(theIndex);
|
|
671 |
CleanupStack::PushL(entry);
|
|
672 |
// Delete any existing buffer
|
|
673 |
if (iMetaDataBuffer)
|
|
674 |
{
|
|
675 |
delete iMetaDataBuffer;
|
|
676 |
iMetaDataBuffer = NULL;
|
|
677 |
}
|
|
678 |
|
|
679 |
// Create a buffer to hold the externalised entry
|
|
680 |
iMetaDataBuffer = CBufFlat::NewL(32);
|
|
681 |
RBufWriteStream s;
|
|
682 |
s.Open(*iMetaDataBuffer);
|
|
683 |
CleanupClosePushL(s);
|
|
684 |
entry->ExternalizeL(s);
|
|
685 |
CleanupStack::PopAndDestroy(2);//s, entry
|
|
686 |
|
|
687 |
//Write the externalised data back to the client
|
|
688 |
aMessage.Write(1,iMetaDataBuffer->Ptr(0));
|
|
689 |
}
|
|
690 |
|
|
691 |
|
|
692 |
TInt CDRMPlayServerSession::SetPlayWindow(const RMessage2 &aMessage)
|
|
693 |
{
|
|
694 |
TPlayWindowStructBuf buf;
|
|
695 |
aMessage.Read(0,buf);
|
|
696 |
|
|
697 |
TTimeIntervalMicroSeconds playStart = buf().iPlayStart;
|
|
698 |
TTimeIntervalMicroSeconds playEnd = buf().iPlayEnd;
|
|
699 |
|
|
700 |
TInt ret = iPlayUtil->SetPlayWindow(playStart,playEnd);
|
|
701 |
|
|
702 |
return ret;
|
|
703 |
}
|
|
704 |
|
|
705 |
TInt CDRMPlayServerSession::ClearPlayWindow()
|
|
706 |
{
|
|
707 |
return iPlayUtil->ClearPlayWindow();
|
|
708 |
}
|
|
709 |
|
|
710 |
TInt CDRMPlayServerSession::SetBalance(const RMessage2 &aMessage)
|
|
711 |
{
|
|
712 |
TInt theBalance = aMessage.Int0();
|
|
713 |
return iPlayUtil->SetBalance(theBalance);
|
|
714 |
}
|
|
715 |
|
|
716 |
TInt CDRMPlayServerSession::GetBalance(const RMessage2 &aMessage)
|
|
717 |
{
|
|
718 |
TInt theBalance;
|
|
719 |
TInt ret;
|
|
720 |
|
|
721 |
ret = iPlayUtil->GetBalance(theBalance);
|
|
722 |
|
|
723 |
TPckgBufTInt pckg(theBalance);
|
|
724 |
aMessage.Write(0,pckg);
|
|
725 |
|
|
726 |
return ret;
|
|
727 |
}
|
|
728 |
|
|
729 |
TInt CDRMPlayServerSession::GetBitRate(const RMessage2 &aMessage)
|
|
730 |
{
|
|
731 |
TUint theBitRate;
|
|
732 |
TInt ret;
|
|
733 |
|
|
734 |
ret = iPlayUtil->GetBitRate(theBitRate);
|
|
735 |
|
|
736 |
TPckgBufTUint pckg(theBitRate);
|
|
737 |
aMessage.Write(0,pckg);
|
|
738 |
|
|
739 |
return ret;
|
|
740 |
}
|
|
741 |
|
|
742 |
void CDRMPlayServerSession::RegisterForAudioLoadingNotification(const RMessage2 &aMessage)
|
|
743 |
{
|
|
744 |
aMessage.Read(0,iCallbackState);
|
|
745 |
|
|
746 |
if(iCallbackState()==ELoadingStarted)
|
|
747 |
{
|
|
748 |
iPlayUtil->RegisterForAudioLoadingNotification(*this);
|
|
749 |
}
|
|
750 |
}
|
|
751 |
|
|
752 |
void CDRMPlayServerSession::GetAudioLoadingProgressL(const RMessage2 &aMessage)
|
|
753 |
{
|
|
754 |
TInt thePercentProgress;
|
|
755 |
|
|
756 |
iPlayUtil->GetAudioLoadingProgressL(thePercentProgress);
|
|
757 |
|
|
758 |
TPckgBufTInt pckg(thePercentProgress);
|
|
759 |
|
|
760 |
aMessage.Write(0,pckg);
|
|
761 |
}
|
|
762 |
|
|
763 |
void CDRMPlayServerSession::ControllerImplementationInformationL(const RMessage2 &aMessage)
|
|
764 |
{
|
|
765 |
const CMMFControllerImplementationInformation& x= iPlayUtil->ControllerImplementationInformationL();
|
|
766 |
|
|
767 |
//for now just write Uid by to client
|
|
768 |
typedef TPckg<TUid> TPckgTUid;
|
|
769 |
|
|
770 |
TPckgTUid thePckg(x.Uid());
|
|
771 |
aMessage.Write(0,thePckg);
|
|
772 |
}
|
|
773 |
|
|
774 |
|
|
775 |
void CDRMPlayServerSession::CustomCommandSyncL(const RMessage2 &aMessage)
|
|
776 |
{
|
|
777 |
DEP_PRN0(_L("CDRMPlayServerSession::CustomCommandSyncL:Enter"));
|
|
778 |
|
|
779 |
TPckgCustomCommand thePckgCustomCommand;
|
|
780 |
User::LeaveIfError(aMessage.Read(0,thePckgCustomCommand));
|
|
781 |
|
|
782 |
HBufC8* dataTo1Buf(NULL);
|
|
783 |
HBufC8* dataTo2Buf(NULL);
|
|
784 |
HBufC8* dataFromBuf(NULL);
|
|
785 |
TPtr8 ptr1(NULL, NULL);
|
|
786 |
TPtr8 ptr2(NULL, NULL);
|
|
787 |
TPtr8 ptr3(NULL, NULL);
|
|
788 |
|
|
789 |
// Read data1
|
|
790 |
dataTo1Buf = HBufC8::NewL(aMessage.GetDesLengthL(1));
|
|
791 |
CleanupStack::PushL(dataTo1Buf);
|
|
792 |
ptr1.Set(dataTo1Buf->Des());
|
|
793 |
User::LeaveIfError(aMessage.Read(1,ptr1));
|
|
794 |
|
|
795 |
// Check and filter the messages
|
|
796 |
// Dont Allow Select Custom Commands
|
|
797 |
if( !IsValidCustomCommandDestination(thePckgCustomCommand().iDestination().InterfaceId(), ptr1) )
|
|
798 |
User::Leave(KErrAccessDenied);
|
|
799 |
|
|
800 |
// Read data2
|
|
801 |
dataTo2Buf = HBufC8::NewL(aMessage.GetDesLengthL(2));
|
|
802 |
CleanupStack::PushL(dataTo2Buf);
|
|
803 |
ptr2.Set(dataTo2Buf->Des());
|
|
804 |
User::LeaveIfError(aMessage.Read(2,ptr2));
|
|
805 |
|
|
806 |
if ( aMessage.Function() == EDRMPlayServCustomCommandSyncWithReturn )
|
|
807 |
{
|
|
808 |
// Read data3
|
|
809 |
dataFromBuf = HBufC8::NewL(aMessage.GetDesLengthL(3));
|
|
810 |
CleanupStack::PushL(dataFromBuf);
|
|
811 |
ptr3.Set(dataFromBuf->Des());
|
|
812 |
User::LeaveIfError(aMessage.Read(3,ptr3));
|
|
813 |
/*
|
|
814 |
RDebug::Print(_L("CDRMPlayServerSession::CustomCommandSync:IFId[%x]DestHndl[%x]Fn[%d]RetDesLen[%d]"),
|
|
815 |
thePckgCustomCommand().iDestination().InterfaceId(),
|
|
816 |
thePckgCustomCommand().iDestination().DestinationHandle(),
|
|
817 |
thePckgCustomCommand().iFunction,
|
|
818 |
ptr3.MaxLength());
|
|
819 |
*/
|
|
820 |
// Call CustomCommandSync on play util
|
|
821 |
User::LeaveIfError(iPlayUtil->CustomCommandSync(
|
|
822 |
thePckgCustomCommand().iDestination,
|
|
823 |
thePckgCustomCommand().iFunction,
|
|
824 |
ptr1,
|
|
825 |
ptr2,
|
|
826 |
ptr3));
|
|
827 |
User::LeaveIfError(aMessage.Write(3,ptr3));
|
|
828 |
|
|
829 |
// Free heap allocated for data3
|
|
830 |
CleanupStack::PopAndDestroy(dataFromBuf);
|
|
831 |
}
|
|
832 |
else
|
|
833 |
{
|
|
834 |
/*
|
|
835 |
RDebug::Print(_L("CDRMPlayServerSession::CustomCommandSync:IFId[%x]DestHndl[%x]Fn[%d]"),
|
|
836 |
thePckgCustomCommand().iDestination().InterfaceId(),
|
|
837 |
thePckgCustomCommand().iDestination().DestinationHandle(),
|
|
838 |
thePckgCustomCommand().iFunction );
|
|
839 |
*/
|
|
840 |
// Call CustomCommandSync on play util
|
|
841 |
User::LeaveIfError(iPlayUtil->CustomCommandSync(
|
|
842 |
thePckgCustomCommand().iDestination,
|
|
843 |
thePckgCustomCommand().iFunction,
|
|
844 |
ptr1,
|
|
845 |
ptr2));
|
|
846 |
}
|
|
847 |
|
|
848 |
// Free heap allocated for data2
|
|
849 |
CleanupStack::PopAndDestroy(dataTo2Buf);
|
|
850 |
// Free heap allocated for data1
|
|
851 |
CleanupStack::PopAndDestroy(dataTo1Buf);
|
|
852 |
|
|
853 |
DEP_PRN0(_L("CDRMPlayServerSession::CustomCommandSyncL:Exit"));
|
|
854 |
}
|
|
855 |
|
|
856 |
void CDRMPlayServerSession::CustomCommandAsyncStep1L( const RMessage2& aMessage )
|
|
857 |
{
|
|
858 |
DEP_PRN0(_L("CDRMPlayServerSession::CustomCommandAsyncStep1L:Enter"));
|
|
859 |
|
|
860 |
// If there is a pending phase1, then there is something wrong.
|
|
861 |
if ( iCDRMCustomCommandAsyncAO2Phase )
|
|
862 |
{
|
|
863 |
User::Leave(KErrAlreadyExists);
|
|
864 |
}
|
|
865 |
|
|
866 |
if ( aMessage.Function() == EDRMPlayServCustomCommandAsyncWithReturnStep1 )
|
|
867 |
{
|
|
868 |
iCDRMCustomCommandAsyncAO2Phase = CDRMCustomCommandAsyncAO::NewL(
|
|
869 |
aMessage,
|
|
870 |
CDRMCustomCommandAsyncAO::ECustomCommandWithResult,
|
|
871 |
*this );
|
|
872 |
}
|
|
873 |
else /*if ( aMessage.Function() == EDRMPlayServCustomCommandAsyncWithoutReturnStep1 )*/
|
|
874 |
{
|
|
875 |
iCDRMCustomCommandAsyncAO2Phase = CDRMCustomCommandAsyncAO::NewL(
|
|
876 |
aMessage,
|
|
877 |
CDRMCustomCommandAsyncAO::ECustomCommandWithoutResult,
|
|
878 |
*this );
|
|
879 |
}
|
|
880 |
// Get reference to data1 descriptor
|
|
881 |
TPtr8 data1Ptr(iCDRMCustomCommandAsyncAO2Phase->GetData1FromClient()->Des());
|
|
882 |
|
|
883 |
// Check and filter the messages
|
|
884 |
// Dont Allow Select Custom Commands
|
|
885 |
if( !IsValidCustomCommandDestination((iCDRMCustomCommandAsyncAO2Phase->GetMMFMessageDestinationPckg())().InterfaceId(), data1Ptr) )
|
|
886 |
{
|
|
887 |
User::Leave( KErrAccessDenied );
|
|
888 |
}
|
|
889 |
|
|
890 |
aMessage.Complete( KErrNone );
|
|
891 |
DEP_PRN0(_L("CDRMPlayServerSession::CustomCommandAsyncStep1L:Exit"));
|
|
892 |
}
|
|
893 |
|
|
894 |
void CDRMPlayServerSession::CustomCommandAsyncStep2L( const RMessage2& aMessage )
|
|
895 |
{
|
|
896 |
DEP_PRN0(_L("CDRMPlayServerSession::CustomCommandAsyncStep2L:Enter"));
|
|
897 |
|
|
898 |
// Read info from client session
|
|
899 |
TPtr8 data1Ptr(NULL,NULL);
|
|
900 |
TPtr8 data2Ptr(NULL,NULL);
|
|
901 |
TPtr8 dataToClientPtr(NULL,NULL);
|
|
902 |
|
|
903 |
// If there is no pending phase1, then there is something wrong.
|
|
904 |
if ( !iCDRMCustomCommandAsyncAO2Phase )
|
|
905 |
{
|
|
906 |
User::Leave(KErrNotReady);
|
|
907 |
}
|
|
908 |
|
|
909 |
// Add custCmdAsyncAO object to array of async custom command objects
|
|
910 |
iActiveAsyncCustomCommands.AppendL( iCDRMCustomCommandAsyncAO2Phase );
|
|
911 |
|
|
912 |
// aMessage ownership is transferred to custCmdAsyncAO.
|
|
913 |
// After succesful transfer, aMessage should not be completed
|
|
914 |
// anywhere outside of this object.
|
|
915 |
iCDRMCustomCommandAsyncAO2Phase->TransferOwnershipL(aMessage);
|
|
916 |
|
|
917 |
CDRMCustomCommandAsyncAO* drmCCAsyncAO = iCDRMCustomCommandAsyncAO2Phase;
|
|
918 |
iCDRMCustomCommandAsyncAO2Phase = NULL;
|
|
919 |
|
|
920 |
// Get reference to descriptors
|
|
921 |
data1Ptr.Set(drmCCAsyncAO->GetData1FromClient()->Des());
|
|
922 |
data2Ptr.Set(drmCCAsyncAO->GetData2FromClient()->Des());
|
|
923 |
|
|
924 |
// Make call on controller
|
|
925 |
drmCCAsyncAO->SetActive();
|
|
926 |
if ( aMessage.Function() == EDRMPlayServCustomCommandAsyncWithReturnStep2 )
|
|
927 |
{
|
|
928 |
// If date needs to be returned, get reference to the descriptor
|
|
929 |
dataToClientPtr.Set(drmCCAsyncAO->GetDataToClient()->Des());
|
|
930 |
/*
|
|
931 |
RDebug::Print(_L("CDRMPlayServerSession::CustomCommandAsyncStep2L:IFId[%x]DestHndl[%x]Fn[%d]Data1[Len:%d:MaxLen:%d]Data2Len[Len:%d:MaxLen:%d]RetDesLen[Len:%d:MaxLen:%d]"),
|
|
932 |
(drmCCAsyncAO->GetMMFMessageDestinationPckg())().InterfaceId(),
|
|
933 |
(drmCCAsyncAO->GetMMFMessageDestinationPckg())().DestinationHandle(),
|
|
934 |
drmCCAsyncAO->GetMMFMessageFunction(),
|
|
935 |
data1Ptr.Length(),
|
|
936 |
data1Ptr.MaxLength(),
|
|
937 |
data2Ptr.Length(),
|
|
938 |
data2Ptr.MaxLength(),
|
|
939 |
dataToClientPtr.Length(),
|
|
940 |
dataToClientPtr.MaxLength() );
|
|
941 |
*/
|
|
942 |
// Call CustomCommandAsync on play util
|
|
943 |
iPlayUtil->CustomCommandAsync(
|
|
944 |
drmCCAsyncAO->GetMMFMessageDestinationPckg(),
|
|
945 |
drmCCAsyncAO->GetMMFMessageFunction(),
|
|
946 |
data1Ptr,
|
|
947 |
data2Ptr,
|
|
948 |
dataToClientPtr,
|
|
949 |
drmCCAsyncAO->iStatus );
|
|
950 |
}
|
|
951 |
else /*if ( aMessage.Function() == EDRMPlayServCustomCommandAsyncWithoutReturnStep2 )*/
|
|
952 |
{
|
|
953 |
/*
|
|
954 |
RDebug::Print(_L("CDRMPlayServerSession::CustomCommandAsyncStep2L:IFId[%x]DestHndl[%x]Fn[%d]Data1[Len:%d:MaxLen:%d]Data2Len[Len:%d:MaxLen:%d]"),
|
|
955 |
(drmCCAsyncAO->GetMMFMessageDestinationPckg())().InterfaceId(),
|
|
956 |
(drmCCAsyncAO->GetMMFMessageDestinationPckg())().DestinationHandle(),
|
|
957 |
drmCCAsyncAO->GetMMFMessageFunction(),
|
|
958 |
data1Ptr.Length(),
|
|
959 |
data1Ptr.MaxLength(),
|
|
960 |
data2Ptr.Length(),
|
|
961 |
data2Ptr.MaxLength() );
|
|
962 |
*/
|
|
963 |
// Call CustomCommandAsync on play util
|
|
964 |
iPlayUtil->CustomCommandAsync(
|
|
965 |
drmCCAsyncAO->GetMMFMessageDestinationPckg(),
|
|
966 |
drmCCAsyncAO->GetMMFMessageFunction(),
|
|
967 |
data1Ptr,
|
|
968 |
data2Ptr,
|
|
969 |
drmCCAsyncAO->iStatus );
|
|
970 |
}
|
|
971 |
|
|
972 |
DEP_PRN0(_L("CDRMPlayServerSession::CustomCommandAsyncStep2L:Exit"));
|
|
973 |
}
|
|
974 |
|
|
975 |
void CDRMPlayServerSession::MapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds& aDuration)
|
|
976 |
{
|
|
977 |
|
|
978 |
DEP_PRN2(_L("CDRMPlayServerSession::MapcInitComplete :-> Status[%d] Duration[%d]"), aError, I64INT(aDuration.Int64()));
|
|
979 |
//iMessage.Write aError & aDuration to client
|
|
980 |
iCallbackState() = EInitComplete;
|
|
981 |
|
|
982 |
iMessage.Write(0,iCallbackState);
|
|
983 |
|
|
984 |
iErrDurPckg().iError = aError;
|
|
985 |
iErrDurPckg().iDuration = aDuration;
|
|
986 |
|
|
987 |
iMessage.Write(2,iErrDurPckg);
|
|
988 |
iMessage.Complete(aError);
|
|
989 |
iAsyncComplete= EFalse;
|
|
990 |
}
|
|
991 |
|
|
992 |
void CDRMPlayServerSession::MapcPlayComplete(TInt aError)
|
|
993 |
{
|
|
994 |
DEP_PRN1(_L("CDRMPlayServerSession::MapcPlayComplete :-> Error[%d]"), aError);
|
|
995 |
|
|
996 |
#ifdef RD_TSP_CLIENT_MAPPER
|
|
997 |
TInt status = iTSPClientMapper->SetTspTargetClientToOtherType(
|
|
998 |
CTspClientMapper::EStoppedClients,
|
|
999 |
iClientProcessId );
|
|
1000 |
DEP_PRN2(_L("CDRMPlayServerSession::MapcPlayComplete:Change PID[%x]Status[%d]"), iClientProcessId.Id(), status );
|
|
1001 |
#endif // #ifdef RD_TSP_CLIENT_MAPPER
|
|
1002 |
|
|
1003 |
|
|
1004 |
iState = EStopped;
|
|
1005 |
|
|
1006 |
iCallbackState()= EPlayComplete;
|
|
1007 |
/*
|
|
1008 |
iMessage.Write(0,iCallbackState);
|
|
1009 |
iErrDurPckg().iError = aError;
|
|
1010 |
iErrDurPckg().iDuration = 0;
|
|
1011 |
iMessage.Write(2,iErrDurPckg);
|
|
1012 |
iMessage.Complete(aError);
|
|
1013 |
*/
|
|
1014 |
if ( iMessage2 )
|
|
1015 |
{
|
|
1016 |
//iMessage2. Write aError & aDuration to client
|
|
1017 |
iCallbackState() = EPlayComplete;
|
|
1018 |
|
|
1019 |
iMessage2->Write(0,iCallbackState);
|
|
1020 |
|
|
1021 |
iErrDurPckg().iError = aError;
|
|
1022 |
iErrDurPckg().iDuration = 0;
|
|
1023 |
iMessage2->Write(2,iErrDurPckg);
|
|
1024 |
iMessage2->Complete(aError);
|
|
1025 |
delete iMessage2;
|
|
1026 |
iMessage2 = NULL;
|
|
1027 |
}
|
|
1028 |
|
|
1029 |
iAsyncComplete= EFalse;
|
|
1030 |
}
|
|
1031 |
|
|
1032 |
|
|
1033 |
void CDRMPlayServerSession::MaloLoadingStarted()
|
|
1034 |
{
|
|
1035 |
//send event to client
|
|
1036 |
iCallbackState() = ELoadingStarted;
|
|
1037 |
iMessage.Write(0,iCallbackState);
|
|
1038 |
iMessage.Complete(KErrNone);
|
|
1039 |
iAsyncComplete= EFalse;
|
|
1040 |
}
|
|
1041 |
void CDRMPlayServerSession::MaloLoadingComplete()
|
|
1042 |
{
|
|
1043 |
//send event to client
|
|
1044 |
iCallbackState() = ELoadingComplete;
|
|
1045 |
iMessage.Write(0,iCallbackState);
|
|
1046 |
iMessage.Complete(KErrNone);
|
|
1047 |
iAsyncComplete= EFalse;
|
|
1048 |
}
|
|
1049 |
|
|
1050 |
void CDRMPlayServerSession::AsyncCustomCommandCompleted( CDRMCustomCommandAsyncAO* aObject)
|
|
1051 |
{
|
|
1052 |
TInt index = iActiveAsyncCustomCommands.Find( aObject );
|
|
1053 |
// This should never happen. Else there is something wrong....
|
|
1054 |
if ( index != KErrNotFound )
|
|
1055 |
{
|
|
1056 |
iActiveAsyncCustomCommands.Remove(index);
|
|
1057 |
}
|
|
1058 |
delete aObject;
|
|
1059 |
}
|
|
1060 |
|
|
1061 |
void CDRMPlayServerSession::SetPriorityPreference(const RMessage2 &aMessage)
|
|
1062 |
{
|
|
1063 |
iPriority = aMessage.Int0();
|
|
1064 |
iPref = (TMdaPriorityPreference)aMessage.Int1();
|
|
1065 |
}
|
|
1066 |
|
|
1067 |
TBool CDRMPlayServerSession::IsValidCustomCommandDestination(TUid aDestinationUid, TDesC8& aParam)
|
|
1068 |
{
|
|
1069 |
TBool retValue(ETrue);
|
|
1070 |
if (aDestinationUid == KUidInterfaceMMFDRMControl)
|
|
1071 |
{
|
|
1072 |
retValue = EFalse;
|
|
1073 |
}
|
|
1074 |
else if ( aDestinationUid == KUidCustomInterfaceBuilderImpl )
|
|
1075 |
{
|
|
1076 |
RDesReadStream stream(aParam);
|
|
1077 |
CleanupClosePushL(stream);
|
|
1078 |
TUid paramUid;
|
|
1079 |
TRAPD(status, paramUid.iUid = stream.ReadInt32L());
|
|
1080 |
CleanupStack::PopAndDestroy(&stream);
|
|
1081 |
if ( (status == KErrNone ) && (paramUid == KUidAudioOutput) )
|
|
1082 |
{
|
|
1083 |
retValue = EFalse;
|
|
1084 |
}
|
|
1085 |
}
|
|
1086 |
return retValue;
|
|
1087 |
}
|
|
1088 |
|
|
1089 |
// End of File
|
|
1090 |
|