os/mm/devsoundextensions/drmaudioplayer/DRMPlayUtility/src/MediaClientDrm.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/mm/devsoundextensions/drmaudioplayer/DRMPlayUtility/src/MediaClientDrm.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,1567 @@
     1.4 +/*
     1.5 +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
     1.6 +* All rights reserved.
     1.7 +* This component and the accompanying materials are made available
     1.8 +* under the terms of "Eclipse Public License v1.0"
     1.9 +* which accompanies this distribution, and is available
    1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.11 +*
    1.12 +* Initial Contributors:
    1.13 +* Nokia Corporation - initial contribution.
    1.14 +*
    1.15 +* Contributors:
    1.16 +*
    1.17 +* Description:   DRM PlayUtility
    1.18 +*
    1.19 +*/
    1.20 +
    1.21 +
    1.22 +
    1.23 +
    1.24 +// INCLUDE FILES
    1.25 +#include <DrmAudioSamplePlayer.h>
    1.26 +#include "DRMPlayClientServer.h"
    1.27 +#include "mmfclientdrmaudioplayer.h"
    1.28 +#include <mmf/common/mmfcontrollerpluginresolver.h>
    1.29 +#include <mmf/common/mmfbase.h>
    1.30 +#include <mmf/common/mmfdrmcustomcommands.h>
    1.31 +#include "drmaudioplayeradaptation.h"
    1.32 +
    1.33 +// This is the UID defined by custom interface builder
    1.34 +const TUid KUidCustomInterfaceBuilderImpl = {0x10207A8E};
    1.35 +
    1.36 +#ifdef _DEBUG
    1.37 +#define DEP_PRN0(str)   RDebug::Print(str)
    1.38 +#define DEP_PRN1(str, v1)   RDebug::Print(str, v1)
    1.39 +#define DEP_PRN2(str, v1, v2)   RDebug::Print(str, v1, v2)
    1.40 +#else
    1.41 +#define DEP_PRN0(str)
    1.42 +#define DEP_PRN1(str, v1)
    1.43 +#define DEP_PRN2(str, v1, v2)
    1.44 +#endif // _DEBUG
    1.45 +
    1.46 +
    1.47 +// ============================= LOCAL FUNCTIONS ===============================
    1.48 +
    1.49 +// -----------------------------------------------------------------------------
    1.50 +// CDrmPlayerUtility::NewL
    1.51 +// Constructs and initialises a new instance of the audio player utility.
    1.52 +// (other items were commented in a header).
    1.53 +// -----------------------------------------------------------------------------
    1.54 +//
    1.55 +EXPORT_C CDrmPlayerUtility* CDrmPlayerUtility::NewL(
    1.56 +    MDrmAudioPlayerCallback& aCallback,
    1.57 +    TInt aPriority,
    1.58 +    TMdaPriorityPreference aPref)
    1.59 +    {
    1.60 +    CDrmPlayerUtility* self = new(ELeave) CDrmPlayerUtility();
    1.61 +    CleanupStack::PushL(self);
    1.62 +    self->iProperties = CDrmAudioPlayerAdaptation::NewL( aCallback, aPriority, aPref );
    1.63 +    CleanupStack::Pop(self);
    1.64 +    return self;
    1.65 +    }
    1.66 +
    1.67 +// -----------------------------------------------------------------------------
    1.68 +// CDrmPlayerUtility::NewFilePlayerL
    1.69 +// Constructs and initialises a new instance of the audio player utility for
    1.70 +// playing sampled audio data from a file. The audio data must be in a supported
    1.71 +// format (e.g. WAV and AU).
    1.72 +// (other items were commented in a header).
    1.73 +// -----------------------------------------------------------------------------
    1.74 +//
    1.75 +EXPORT_C CDrmPlayerUtility* CDrmPlayerUtility::NewFilePlayerL(
    1.76 +    const TDesC& aFileName,
    1.77 +    MDrmAudioPlayerCallback& aCallback,
    1.78 +    TInt aPriority,
    1.79 +    TMdaPriorityPreference aPref)
    1.80 +    {
    1.81 +    CDrmPlayerUtility* self = new(ELeave) CDrmPlayerUtility();
    1.82 +    CleanupStack::PushL(self);
    1.83 +    self->iProperties = CDrmAudioPlayerAdaptation::NewFilePlayerL(aFileName, aCallback, aPriority, aPref);
    1.84 +    CleanupStack::Pop(self);
    1.85 +    return self;
    1.86 +    }
    1.87 +
    1.88 +// -----------------------------------------------------------------------------
    1.89 +// CDrmPlayerUtility::NewDesPlayerL
    1.90 +// Constructs and initialises a new instance of the audio player utility for
    1.91 +// playing sampled audio data from a descriptor.  The audio data must be in a
    1.92 +// supported format (e.g. WAV and AU).
    1.93 +// (other items were commented in a header).
    1.94 +// -----------------------------------------------------------------------------
    1.95 +//
    1.96 +EXPORT_C CDrmPlayerUtility* CDrmPlayerUtility::NewDesPlayerL(
    1.97 +    const TDesC8& aData,
    1.98 +    MDrmAudioPlayerCallback& aCallback,
    1.99 +    TInt aPriority,
   1.100 +    TMdaPriorityPreference aPref)
   1.101 +    {
   1.102 +    CDrmPlayerUtility* self = new(ELeave) CDrmPlayerUtility();
   1.103 +    CleanupStack::PushL(self);
   1.104 +    self->iProperties = CDrmAudioPlayerAdaptation::NewDesPlayerL( aData, aCallback, aPriority, aPref );
   1.105 +    CleanupStack::Pop(self);
   1.106 +    return self;
   1.107 +    }
   1.108 +
   1.109 +// -----------------------------------------------------------------------------
   1.110 +// CDrmPlayerUtility::NewDesPlayerReadOnlyL
   1.111 +// Constructs and initialises a new instance of the audio player utility for
   1.112 +// playing sampled audio data from a read only descriptor.  The audio data must
   1.113 +// be in a supported format (e.g. WAV and AU).
   1.114 +// (other items were commented in a header).
   1.115 +// -----------------------------------------------------------------------------
   1.116 +//
   1.117 +EXPORT_C CDrmPlayerUtility* CDrmPlayerUtility::NewDesPlayerReadOnlyL(
   1.118 +    const TDesC8& aData,
   1.119 +    MDrmAudioPlayerCallback& aCallback,
   1.120 +    TInt aPriority,
   1.121 +    TMdaPriorityPreference aPref)
   1.122 +    {
   1.123 +    CDrmPlayerUtility* self = new(ELeave) CDrmPlayerUtility();
   1.124 +    CleanupStack::PushL(self);
   1.125 +    self->iProperties = CDrmAudioPlayerAdaptation::NewDesPlayerReadOnlyL(aData, aCallback, aPriority, aPref);
   1.126 +    CleanupStack::Pop(self);
   1.127 +    return self;
   1.128 +    }
   1.129 +
   1.130 +// Destructor
   1.131 +EXPORT_C CDrmPlayerUtility::~CDrmPlayerUtility()
   1.132 +    {
   1.133 +    delete iProperties;
   1.134 +    }
   1.135 +
   1.136 +// -----------------------------------------------------------------------------
   1.137 +// CDrmPlayerUtility::Play
   1.138 +// Begins playback of the initialised audio sample at the current volume and
   1.139 +// priority levels.  When playing of the audio sample is complete, successfully
   1.140 +// or otherwise, the callback function MMdaAudioPlayerCallback::MapcPlayComplete()
   1.141 +// is called.
   1.142 +// (other items were commented in a header).
   1.143 +// -----------------------------------------------------------------------------
   1.144 +//
   1.145 +EXPORT_C void CDrmPlayerUtility::Play()
   1.146 +    {
   1.147 +    iProperties->Play();
   1.148 +    }
   1.149 +
   1.150 +// -----------------------------------------------------------------------------
   1.151 +// CDrmPlayerUtility::Stop
   1.152 +// Stops playback of the audio sample as soon as possible.  If the audio sample
   1.153 +// is playing, playback is stopped as soon as possible. If playback is already
   1.154 +// complete, nothing further happens as a result of calling this function. The
   1.155 +// callback function MMdaAudioPlayerCallback::MapcPlayComplete() is not called.
   1.156 +// (other items were commented in a header).
   1.157 +// -----------------------------------------------------------------------------
   1.158 +//
   1.159 +EXPORT_C void CDrmPlayerUtility::Stop()
   1.160 +    {
   1.161 +    iProperties->Stop();
   1.162 +    }
   1.163 +
   1.164 +// -----------------------------------------------------------------------------
   1.165 +// CDrmPlayerUtility::Pause
   1.166 +// Pauses the playback of the audio clip.
   1.167 +// (other items were commented in a header).
   1.168 +// -----------------------------------------------------------------------------
   1.169 +//
   1.170 +EXPORT_C TInt CDrmPlayerUtility::Pause()
   1.171 +    {
   1.172 +    return iProperties->Pause();
   1.173 +    }
   1.174 +
   1.175 +
   1.176 +// -----------------------------------------------------------------------------
   1.177 +// CDrmPlayerUtility::SetVolume
   1.178 +// Changes the current playback volume to a specified value.  The volume can be
   1.179 +// changed before or during playback and is effective immediately.
   1.180 +// (other items were commented in a header).
   1.181 +// -----------------------------------------------------------------------------
   1.182 +//
   1.183 +EXPORT_C void CDrmPlayerUtility::SetVolume(
   1.184 +    TInt aVolume)
   1.185 +    {
   1.186 +    iProperties->SetVolume(aVolume);
   1.187 +    }
   1.188 +
   1.189 +
   1.190 +// -----------------------------------------------------------------------------
   1.191 +// CDrmPlayerUtility::SetRepeats
   1.192 +// Sets the number of times the audio sample is to be repeated during the playback
   1.193 +// operation.  A period of silence can follow each playing of the sample. The
   1.194 +// audio sample can be repeated indefinitely.
   1.195 +// (other items were commented in a header).
   1.196 +// -----------------------------------------------------------------------------
   1.197 +//
   1.198 +EXPORT_C void CDrmPlayerUtility::SetRepeats(
   1.199 +    TInt aRepeatNumberOfTimes,
   1.200 +    const TTimeIntervalMicroSeconds& aTrailingSilence)
   1.201 +    {
   1.202 +    iProperties->SetRepeats(aRepeatNumberOfTimes,aTrailingSilence);
   1.203 +    }
   1.204 +
   1.205 +// -----------------------------------------------------------------------------
   1.206 +// CDrmPlayerUtility::SetVolumeRamp
   1.207 +// Defines the period over which the volume level is to rise smoothly from nothing
   1.208 +// to the normal volume level.
   1.209 +// (other items were commented in a header).
   1.210 +// -----------------------------------------------------------------------------
   1.211 +//
   1.212 +EXPORT_C void CDrmPlayerUtility::SetVolumeRamp(
   1.213 +    const TTimeIntervalMicroSeconds& aRampDuration)
   1.214 +    {
   1.215 +    iProperties->SetVolumeRamp(aRampDuration);
   1.216 +    }
   1.217 +
   1.218 +// -----------------------------------------------------------------------------
   1.219 +// CDrmPlayerUtility::Duration
   1.220 +// Returns the duration of the audio sample.  The function raises a
   1.221 +// CMdaAudioPlayerUtility 1 panic if the audio player utility is not initialised.
   1.222 +// (other items were commented in a header).
   1.223 +// -----------------------------------------------------------------------------
   1.224 +//
   1.225 +EXPORT_C const TTimeIntervalMicroSeconds& CDrmPlayerUtility::Duration()
   1.226 +    {
   1.227 +    return iProperties->Duration();
   1.228 +    }
   1.229 +
   1.230 +// -----------------------------------------------------------------------------
   1.231 +// CDrmPlayerUtility::MaxVolume
   1.232 +// Returns an integer representing the maximum volume.  This is the maximum value
   1.233 +// which can be passed to CMdaAudioPlayerUtility::SetVolume().
   1.234 +// (other items were commented in a header).
   1.235 +// -----------------------------------------------------------------------------
   1.236 +//
   1.237 +EXPORT_C TInt CDrmPlayerUtility::MaxVolume()
   1.238 +    {
   1.239 +    return iProperties->MaxVolume();
   1.240 +    }
   1.241 +
   1.242 +// -----------------------------------------------------------------------------
   1.243 +// CDrmPlayerUtility::OpenFileL
   1.244 +// Opens an audio clip from a file.  The audio data must be in a supported
   1.245 +// format (for example, WAV or AU).  This function leaves with KErrInUse if there
   1.246 +// is a previous open statement awaiting notification of completion.
   1.247 +// (other items were commented in a header).
   1.248 +// -----------------------------------------------------------------------------
   1.249 +//
   1.250 +EXPORT_C void CDrmPlayerUtility::OpenFileL(
   1.251 +    const TDesC &aFileName)
   1.252 +    {
   1.253 +    iProperties->OpenFileL(aFileName);
   1.254 +    }
   1.255 +
   1.256 +// -----------------------------------------------------------------------------
   1.257 +// CDrmPlayerUtility::OpenFileL
   1.258 +// Opens an audio clip from a file.  The audio data must be in a supported
   1.259 +// format (for example, WAV or AU).  This function leaves with KErrInUse if there
   1.260 +// is a previous open statement awaiting notification of completion.
   1.261 +// (other items were commented in a header).
   1.262 +// -----------------------------------------------------------------------------
   1.263 +//
   1.264 +EXPORT_C void CDrmPlayerUtility::OpenFileL(
   1.265 +    const RFile& aFile)
   1.266 +    {
   1.267 +    iProperties->OpenFileL(aFile);
   1.268 +    }
   1.269 +
   1.270 +// -----------------------------------------------------------------------------
   1.271 +// CDrmPlayerUtility::OpenFileL
   1.272 +// Opens an audio clip from a file.  The audio data must be in a supported
   1.273 +// format (for example, WAV or AU).  This function leaves with KErrInUse if there
   1.274 +// is a previous open statement awaiting notification of completion.
   1.275 +// (other items were commented in a header).
   1.276 +// -----------------------------------------------------------------------------
   1.277 +//
   1.278 +EXPORT_C void CDrmPlayerUtility::OpenFileL(
   1.279 +#ifdef SYMBIAN_CAF_V2
   1.280 +    const TMMSource& aSource
   1.281 +#else
   1.282 +    const TMMSource& /*aSource*/
   1.283 +#endif
   1.284 +    )
   1.285 +    {
   1.286 +#ifdef SYMBIAN_CAF_V2
   1.287 +    iProperties->OpenFileL(aSource);
   1.288 +#else
   1.289 +    User::Leave(KErrNotSupported);
   1.290 +#endif
   1.291 +    }
   1.292 +
   1.293 +// -----------------------------------------------------------------------------
   1.294 +// CDrmPlayerUtility::OpenDesL
   1.295 +// Opens an audio clip from a descriptor.  The audio data must be in a supported
   1.296 +// format (for example, WAV or AU).
   1.297 +// (other items were commented in a header).
   1.298 +// -----------------------------------------------------------------------------
   1.299 +//
   1.300 +EXPORT_C void CDrmPlayerUtility::OpenDesL(
   1.301 +    const TDesC8& aDescriptor)
   1.302 +    {
   1.303 +    iProperties->OpenDesL(aDescriptor);
   1.304 +    }
   1.305 +
   1.306 +// -----------------------------------------------------------------------------
   1.307 +// CDrmPlayerUtility::OpenUrlL
   1.308 +// Opens an audio clip from a URL.  The audio data must be in a supported format
   1.309 +// (for example, WAV or AU).
   1.310 +// (other items were commented in a header).
   1.311 +// -----------------------------------------------------------------------------
   1.312 +//
   1.313 +EXPORT_C void CDrmPlayerUtility::OpenUrlL(
   1.314 +    const TDesC& aUrl,
   1.315 +    TInt aIapId,
   1.316 +    const TDesC8& aMimeType)
   1.317 +    {
   1.318 +    iProperties->OpenUrlL(aUrl,aIapId,aMimeType);
   1.319 +    }
   1.320 +
   1.321 +// -----------------------------------------------------------------------------
   1.322 +// CDrmPlayerUtility::Close
   1.323 +// Closes the current audio clip (allowing another clip to be opened).
   1.324 +// (other items were commented in a header).
   1.325 +// -----------------------------------------------------------------------------
   1.326 +//
   1.327 +EXPORT_C void CDrmPlayerUtility::Close()
   1.328 +   {
   1.329 +   iProperties->Close();
   1.330 +   }
   1.331 +
   1.332 +// -----------------------------------------------------------------------------
   1.333 +// CDrmPlayerUtility::GetPosition
   1.334 +// Returns the current playback position in microseconds from the start
   1.335 +// of the clip.
   1.336 +// (other items were commented in a header).
   1.337 +// -----------------------------------------------------------------------------
   1.338 +//
   1.339 +EXPORT_C TInt CDrmPlayerUtility::GetPosition(
   1.340 +    TTimeIntervalMicroSeconds& aPosition)
   1.341 +    {
   1.342 +    return iProperties->GetPosition(aPosition);
   1.343 +    }
   1.344 +
   1.345 +// -----------------------------------------------------------------------------
   1.346 +// CDrmPlayerUtility::SetPosition
   1.347 +// Sets the current playback position in microseconds from the start of the clip.
   1.348 +// (other items were commented in a header).
   1.349 +// -----------------------------------------------------------------------------
   1.350 +//
   1.351 +EXPORT_C void CDrmPlayerUtility::SetPosition(
   1.352 +    const TTimeIntervalMicroSeconds& aPosition)
   1.353 +    {
   1.354 +    iProperties->SetPosition(aPosition);
   1.355 +    }
   1.356 +
   1.357 +// -----------------------------------------------------------------------------
   1.358 +// CDrmPlayerUtility::SetPriority
   1.359 +// Sets the priority for playback. This is used to arbitrate between multiple
   1.360 +// objects trying to access a single sound device.
   1.361 +// (other items were commented in a header).
   1.362 +// -----------------------------------------------------------------------------
   1.363 +//
   1.364 +EXPORT_C TInt CDrmPlayerUtility::SetPriority(
   1.365 +    TInt aPriority,
   1.366 +    TMdaPriorityPreference aPref)
   1.367 +    {
   1.368 +    return iProperties->SetPriority(aPriority,aPref);
   1.369 +    }
   1.370 +
   1.371 +// -----------------------------------------------------------------------------
   1.372 +// CDrmPlayerUtility::GetVolume
   1.373 +// Returns the current playback volume.
   1.374 +// (other items were commented in a header).
   1.375 +// -----------------------------------------------------------------------------
   1.376 +//
   1.377 +EXPORT_C TInt CDrmPlayerUtility::GetVolume(
   1.378 +    TInt& aVolume)
   1.379 +    {
   1.380 +    return iProperties->GetVolume(aVolume);
   1.381 +    }
   1.382 +
   1.383 +// -----------------------------------------------------------------------------
   1.384 +// CDrmPlayerUtility::GetNumberOfMetaDataEntries
   1.385 +// Returns the number of meta data entries in the current audio clip.
   1.386 +// (other items were commented in a header).
   1.387 +// -----------------------------------------------------------------------------
   1.388 +//
   1.389 +EXPORT_C TInt CDrmPlayerUtility::GetNumberOfMetaDataEntries(
   1.390 +    TInt& aNumEntries)
   1.391 +    {
   1.392 +    return iProperties->GetNumberOfMetaDataEntries(aNumEntries);
   1.393 +    }
   1.394 +
   1.395 +// -----------------------------------------------------------------------------
   1.396 +// CDrmPlayerUtility::GetMetaDataEntryL
   1.397 +// Returns the requested meta data entry.
   1.398 +// (other items were commented in a header).
   1.399 +// -----------------------------------------------------------------------------
   1.400 +//
   1.401 +EXPORT_C CMMFMetaDataEntry* CDrmPlayerUtility::GetMetaDataEntryL(
   1.402 +    TInt aMetaDataIndex)
   1.403 +    {
   1.404 +    return iProperties->GetMetaDataEntryL(aMetaDataIndex);
   1.405 +    }
   1.406 +
   1.407 +// -----------------------------------------------------------------------------
   1.408 +// CDrmPlayerUtility::SetPlayWindow
   1.409 +// Sets the current playback window.
   1.410 +// (other items were commented in a header).
   1.411 +// -----------------------------------------------------------------------------
   1.412 +//
   1.413 +EXPORT_C TInt CDrmPlayerUtility::SetPlayWindow(
   1.414 +    const TTimeIntervalMicroSeconds& aStart,
   1.415 +    const TTimeIntervalMicroSeconds& aEnd)
   1.416 +    {
   1.417 +    return  iProperties->SetPlayWindow(aStart,aEnd);
   1.418 +    }
   1.419 +
   1.420 +// -----------------------------------------------------------------------------
   1.421 +// CDrmPlayerUtility::ClearPlayWindow
   1.422 +// Clears the current playback window.
   1.423 +// (other items were commented in a header).
   1.424 +// -----------------------------------------------------------------------------
   1.425 +//
   1.426 +EXPORT_C TInt CDrmPlayerUtility::ClearPlayWindow()
   1.427 +    {
   1.428 +    return iProperties->ClearPlayWindow();
   1.429 +    }
   1.430 +
   1.431 +// -----------------------------------------------------------------------------
   1.432 +// CDrmPlayerUtility::SetBalance
   1.433 +// Sets the current playback balance.
   1.434 +// (other items were commented in a header).
   1.435 +// -----------------------------------------------------------------------------
   1.436 +//
   1.437 +EXPORT_C TInt CDrmPlayerUtility::SetBalance(
   1.438 +    TInt aBalance)
   1.439 +    {
   1.440 +    return iProperties->SetBalance(aBalance);
   1.441 +    }
   1.442 +
   1.443 +// -----------------------------------------------------------------------------
   1.444 +// CDrmPlayerUtility::GetBalance
   1.445 +// Returns the current playback balance.
   1.446 +// (other items were commented in a header).
   1.447 +// -----------------------------------------------------------------------------
   1.448 +//
   1.449 +EXPORT_C TInt CDrmPlayerUtility::GetBalance(
   1.450 +    TInt& aBalance)
   1.451 +    {
   1.452 +    return iProperties->GetBalance(aBalance);
   1.453 +    }
   1.454 +
   1.455 +// -----------------------------------------------------------------------------
   1.456 +// CDrmPlayerUtility::GetBitRate
   1.457 +// Returns the bit rate of the audio clip
   1.458 +// (other items were commented in a header).
   1.459 +// -----------------------------------------------------------------------------
   1.460 +//
   1.461 +EXPORT_C TInt CDrmPlayerUtility::GetBitRate(
   1.462 +    TUint& aBitRate)
   1.463 +    {
   1.464 +    return iProperties->GetBitRate(aBitRate);
   1.465 +    }
   1.466 +
   1.467 +// -----------------------------------------------------------------------------
   1.468 +// CDrmPlayerUtility::RegisterForAudioLoadingNotification
   1.469 +// Registers callback object to receive notifications of audio loading/rebuffering.
   1.470 +// (other items were commented in a header).
   1.471 +// -----------------------------------------------------------------------------
   1.472 +//
   1.473 +EXPORT_C void CDrmPlayerUtility::RegisterForAudioLoadingNotification(
   1.474 +    MAudioLoadingObserver& aCallback)
   1.475 +    {
   1.476 +    iProperties->RegisterForAudioLoadingNotification(aCallback);
   1.477 +    }
   1.478 +
   1.479 +// -----------------------------------------------------------------------------
   1.480 +// CDrmPlayerUtility::GetAudioLoadingProgressL
   1.481 +// Returns the current progress of audio loading
   1.482 +// (other items were commented in a header).
   1.483 +// -----------------------------------------------------------------------------
   1.484 +//
   1.485 +EXPORT_C void CDrmPlayerUtility::GetAudioLoadingProgressL(
   1.486 +    TInt& aPercentageProgress)
   1.487 +    {
   1.488 +    iProperties->GetAudioLoadingProgressL(aPercentageProgress);
   1.489 +    }
   1.490 +
   1.491 +// -----------------------------------------------------------------------------
   1.492 +// CDrmPlayerUtility::ControllerImplementationInformationL
   1.493 +// Returns the controller implementation information associated with the current controller.
   1.494 +// (other items were commented in a header).
   1.495 +// -----------------------------------------------------------------------------
   1.496 +//
   1.497 +EXPORT_C const CMMFControllerImplementationInformation& CDrmPlayerUtility::ControllerImplementationInformationL()
   1.498 +    {
   1.499 +    return iProperties->ControllerImplementationInformationL();
   1.500 +    }
   1.501 +
   1.502 +// -----------------------------------------------------------------------------
   1.503 +// CDrmPlayerUtility::CustomCommandSync
   1.504 +// Sends a synchronous custom command to the controller.
   1.505 +// (other items were commented in a header).
   1.506 +// -----------------------------------------------------------------------------
   1.507 +//
   1.508 +EXPORT_C TInt CDrmPlayerUtility::CustomCommandSync(
   1.509 +    const TMMFMessageDestinationPckg& aDestination,
   1.510 +    TInt aFunction,
   1.511 +    const TDesC8& aDataTo1,
   1.512 +    const TDesC8& aDataTo2,
   1.513 +    TDes8& aDataFrom)
   1.514 +    {
   1.515 +      TInt status( KErrAccessDenied );
   1.516 +      status = iProperties->CustomCommandSync(aDestination,aFunction,aDataTo1,aDataTo2,aDataFrom);
   1.517 +
   1.518 +    return status;
   1.519 +    }
   1.520 +
   1.521 +// -----------------------------------------------------------------------------
   1.522 +// CDrmPlayerUtility::CustomCommandSync
   1.523 +// Sends a synchronous custom command to the controller.
   1.524 +// (other items were commented in a header).
   1.525 +// -----------------------------------------------------------------------------
   1.526 +//
   1.527 +EXPORT_C TInt CDrmPlayerUtility::CustomCommandSync(
   1.528 +    const TMMFMessageDestinationPckg& aDestination,
   1.529 +    TInt aFunction,
   1.530 +    const TDesC8& aDataTo1,
   1.531 +    const TDesC8& aDataTo2)
   1.532 +    {
   1.533 +
   1.534 +      TInt status( KErrAccessDenied );
   1.535 +      status = iProperties->CustomCommandSync(aDestination,aFunction,aDataTo1,aDataTo2);
   1.536 +    return status;
   1.537 +
   1.538 +    }
   1.539 +
   1.540 +// -----------------------------------------------------------------------------
   1.541 +// CDrmPlayerUtility::CustomCommandAsync
   1.542 +// Sends an asynchronous custom command to the controller
   1.543 +// (other items were commented in a header).
   1.544 +// -----------------------------------------------------------------------------
   1.545 +//
   1.546 +EXPORT_C void CDrmPlayerUtility::CustomCommandAsync(
   1.547 +    const TMMFMessageDestinationPckg& aDestination,
   1.548 +    TInt aFunction,
   1.549 +    const TDesC8& aDataTo1,
   1.550 +    const TDesC8& aDataTo2,
   1.551 +    TDes8& aDataFrom,
   1.552 +    TRequestStatus& aStatus)
   1.553 +    {
   1.554 +
   1.555 +        iProperties->CustomCommandAsync(aDestination,aFunction,aDataTo1,aDataTo2,aDataFrom,aStatus);
   1.556 +
   1.557 +    }
   1.558 +
   1.559 +// -----------------------------------------------------------------------------
   1.560 +// CDrmPlayerUtility::CustomCommandAsync
   1.561 +// Sends an asynchronous custom command to the controller
   1.562 +// (other items were commented in a header).
   1.563 +// -----------------------------------------------------------------------------
   1.564 +//
   1.565 +EXPORT_C void CDrmPlayerUtility::CustomCommandAsync(
   1.566 +    const TMMFMessageDestinationPckg& aDestination,
   1.567 +    TInt aFunction,
   1.568 +    const TDesC8& aDataTo1,
   1.569 +    const TDesC8& aDataTo2,
   1.570 +    TRequestStatus& aStatus)
   1.571 +    {
   1.572 +
   1.573 +        iProperties->CustomCommandAsync(aDestination,aFunction,aDataTo1,aDataTo2,aStatus);
   1.574 +
   1.575 +    }
   1.576 +//=========================================================================================================================
   1.577 +
   1.578 +
   1.579 +
   1.580 +
   1.581 +// -----------------------------------------------------------------------------
   1.582 +// CMMFDrmAudioPlayerUtility::NewL
   1.583 +//
   1.584 +// (other items were commented in a header).
   1.585 +// -----------------------------------------------------------------------------
   1.586 +//
   1.587 +CMMFDrmAudioPlayerUtility* CMMFDrmAudioPlayerUtility::NewL(
   1.588 +    MDrmAudioPlayerCallback& aCallback,
   1.589 +    TInt aPriority,
   1.590 +    TMdaPriorityPreference aPref)
   1.591 +    {
   1.592 +    CMMFDrmAudioPlayerUtility* self = new(ELeave) CMMFDrmAudioPlayerUtility(aCallback,EPriorityStandard);
   1.593 +    CleanupStack::PushL(self);
   1.594 +    self->ConstructL(aPriority, aPref);
   1.595 +    CleanupStack::Pop(self);
   1.596 +    return self;
   1.597 +    }
   1.598 +
   1.599 +// -----------------------------------------------------------------------------
   1.600 +// CMMFDrmAudioPlayerUtility::NewFilePlayerL
   1.601 +//
   1.602 +// (other items were commented in a header).
   1.603 +// -----------------------------------------------------------------------------
   1.604 +//
   1.605 +CMMFDrmAudioPlayerUtility* CMMFDrmAudioPlayerUtility::NewFilePlayerL(
   1.606 +    const TDesC& aFileName,
   1.607 +    MDrmAudioPlayerCallback& aCallback,
   1.608 +    TInt aPriority,
   1.609 +    TMdaPriorityPreference aPref)
   1.610 +    {
   1.611 +    CMMFDrmAudioPlayerUtility* self = new(ELeave) CMMFDrmAudioPlayerUtility(aCallback,EPriorityStandard);
   1.612 +    CleanupStack::PushL(self);
   1.613 +    self->ConstructL(aFileName,aPriority,aPref);
   1.614 +    CleanupStack::Pop(self);
   1.615 +    return self;
   1.616 +    }
   1.617 +
   1.618 +// -----------------------------------------------------------------------------
   1.619 +// CMMFDrmAudioPlayerUtility::NewDesPlayerL
   1.620 +//
   1.621 +// (other items were commented in a header).
   1.622 +// -----------------------------------------------------------------------------
   1.623 +//
   1.624 +CMMFDrmAudioPlayerUtility* CMMFDrmAudioPlayerUtility::NewDesPlayerL(
   1.625 +    const TDesC8& aData,
   1.626 +    MDrmAudioPlayerCallback& aCallback,
   1.627 +    TInt aPriority,
   1.628 +    TMdaPriorityPreference aPref)
   1.629 +    {
   1.630 +    CMMFDrmAudioPlayerUtility* self = new(ELeave) CMMFDrmAudioPlayerUtility(aCallback,EPriorityStandard);
   1.631 +    CleanupStack::PushL(self);
   1.632 +    self->ConstructL(aData,aPriority,aPref);
   1.633 +    CleanupStack::Pop(self);
   1.634 +    return self;
   1.635 +    }
   1.636 +
   1.637 +// -----------------------------------------------------------------------------
   1.638 +// CMMFDrmAudioPlayerUtility::NewDesPlayerReadOnlyL
   1.639 +//
   1.640 +// (other items were commented in a header).
   1.641 +// -----------------------------------------------------------------------------
   1.642 +//
   1.643 +CMMFDrmAudioPlayerUtility* CMMFDrmAudioPlayerUtility::NewDesPlayerReadOnlyL(
   1.644 +    const TDesC8& aData,
   1.645 +    MDrmAudioPlayerCallback& aCallback,
   1.646 +    TInt aPriority,
   1.647 +    TMdaPriorityPreference aPref)
   1.648 +    {
   1.649 +    CMMFDrmAudioPlayerUtility* self = new(ELeave) CMMFDrmAudioPlayerUtility(aCallback,EPriorityStandard);
   1.650 +    CleanupStack::PushL(self);
   1.651 +    self->ConstructReadOnlyL(aData,aPriority,aPref);
   1.652 +    CleanupStack::Pop(self);
   1.653 +    return self;
   1.654 +    }
   1.655 +
   1.656 +
   1.657 +// Destructor
   1.658 +CMMFDrmAudioPlayerUtility::~CMMFDrmAudioPlayerUtility()
   1.659 +    {
   1.660 +    Stop();
   1.661 +    Cancel();
   1.662 +    delete iDrm;
   1.663 +    delete iMetaDataBuffer;
   1.664 +    if(iDrmSession)
   1.665 +      {
   1.666 +      iDrmSession->Disconnect();
   1.667 +      iDrmSession->Close();
   1.668 +      delete iDrmSession;
   1.669 +      iDrmSession = NULL;
   1.670 +      }
   1.671 +    }
   1.672 +
   1.673 +// -----------------------------------------------------------------------------
   1.674 +// CMMFDrmAudioPlayerUtility::CMMFDrmAudioPlayerUtility
   1.675 +//
   1.676 +// (other items were commented in a header).
   1.677 +// -----------------------------------------------------------------------------
   1.678 +//
   1.679 +CMMFDrmAudioPlayerUtility::CMMFDrmAudioPlayerUtility(
   1.680 +    MDrmAudioPlayerCallback& aCallback,
   1.681 +    TInt aActivePriority)
   1.682 +    : CActive(aActivePriority),
   1.683 +    iCallback(aCallback)
   1.684 +    {
   1.685 +    }
   1.686 +
   1.687 +// -----------------------------------------------------------------------------
   1.688 +// CMMFDrmAudioPlayerUtility::ConstructL
   1.689 +//
   1.690 +// (other items were commented in a header).
   1.691 +// -----------------------------------------------------------------------------
   1.692 +//
   1.693 +void CMMFDrmAudioPlayerUtility::ConstructL(
   1.694 +    TInt aPriority,
   1.695 +    TMdaPriorityPreference aPref)
   1.696 +    {
   1.697 +    ConnectL();
   1.698 +    TDataStruct theStruct;
   1.699 +
   1.700 +    theStruct.iPriority = aPriority;
   1.701 +    theStruct.iPref = aPref;
   1.702 +
   1.703 +    TDataStructPckgBuf pckg(theStruct);
   1.704 +    iState = EInitializing;
   1.705 +    iDrmSession->Send(EDRMPlayServNewPlayerL,TIpcArgs(&iAsyncCallback,&pckg,&iErrorDurationStruct));
   1.706 +    }
   1.707 +
   1.708 +// -----------------------------------------------------------------------------
   1.709 +// CMMFDrmAudioPlayerUtility::ConstructL
   1.710 +//
   1.711 +// (other items were commented in a header).
   1.712 +// -----------------------------------------------------------------------------
   1.713 +//
   1.714 +void CMMFDrmAudioPlayerUtility::ConstructL(
   1.715 +    const TDesC& aFileName,
   1.716 +    TInt aPriority,
   1.717 +    TMdaPriorityPreference aPref)
   1.718 +    {
   1.719 +    ConnectL();
   1.720 +
   1.721 +    iDrmSession->Send(EDRMPlayServSetPriorityPreference,TIpcArgs(aPriority,aPref));
   1.722 +    TDataStructPckgBuf pckgBuf;
   1.723 +    TDataStruct &theStruct = pckgBuf();
   1.724 +
   1.725 +
   1.726 +
   1.727 +    theStruct.iPriority = aPriority;
   1.728 +    theStruct.iPref = aPref;
   1.729 +    iFileName = aFileName;
   1.730 +
   1.731 +    iState = EInitializing;
   1.732 +    if (!IsActive())
   1.733 +        {
   1.734 +        iDrmSession->Send(EDRMPlayServNewFilePlayerL,TIpcArgs(&iAsyncCallback,&pckgBuf,&iErrorDurationStruct,&iFileName),iStatus);
   1.735 +        SetActive();
   1.736 +        }
   1.737 +    else
   1.738 +        {
   1.739 +        User::Leave(KErrNotReady);
   1.740 +        }
   1.741 +    }
   1.742 +
   1.743 +// -----------------------------------------------------------------------------
   1.744 +// CMMFDrmAudioPlayerUtility::ConstructL
   1.745 +//
   1.746 +// (other items were commented in a header).
   1.747 +// -----------------------------------------------------------------------------
   1.748 +//
   1.749 +void CMMFDrmAudioPlayerUtility::ConstructL(
   1.750 +    const TDesC8& aData,
   1.751 +    TInt aPriority,
   1.752 +    TMdaPriorityPreference aPref)
   1.753 +    {
   1.754 +    ConnectL();
   1.755 +    TDataStruct theStruct;
   1.756 +
   1.757 +    theStruct.iData = aData;
   1.758 +    iDrmSession->Send(EDRMPlayServSetPriorityPreference,TIpcArgs(aPriority,aPref));
   1.759 +
   1.760 +    TDataStructPckgBuf pckg(theStruct);
   1.761 +
   1.762 +    iState = EInitializing;
   1.763 +    if (!IsActive())
   1.764 +        {
   1.765 +        iDrmSession->Send(EDRMPlayServNewDesPlayerL,TIpcArgs(&iAsyncCallback,&pckg,&iErrorDurationStruct),iStatus);
   1.766 +        SetActive();
   1.767 +        }
   1.768 +    else
   1.769 +        {
   1.770 +        User::Leave(KErrNotReady);
   1.771 +        }
   1.772 +    }
   1.773 +
   1.774 +// -----------------------------------------------------------------------------
   1.775 +// CMMFDrmAudioPlayerUtility::ConstructReadOnlyL
   1.776 +//
   1.777 +// (other items were commented in a header).
   1.778 +// -----------------------------------------------------------------------------
   1.779 +//
   1.780 +void CMMFDrmAudioPlayerUtility::ConstructReadOnlyL(
   1.781 +    const TDesC8& aData,
   1.782 +    TInt aPriority,
   1.783 +    TMdaPriorityPreference aPref)
   1.784 +    {
   1.785 +    ConnectL();
   1.786 +    TDataStruct theStruct;
   1.787 +
   1.788 +    theStruct.iData = aData;
   1.789 +    iDrmSession->Send(EDRMPlayServSetPriorityPreference,TIpcArgs(aPriority,aPref));
   1.790 +
   1.791 +    TDataStructPckgBuf pckg(theStruct);
   1.792 +
   1.793 +    iState = EInitializing;
   1.794 +    if (!IsActive())
   1.795 +        {
   1.796 +        iDrmSession->Send(EDRMPlayServNewDesPlayerReadOnlyL,TIpcArgs(&iAsyncCallback,&pckg,&iErrorDurationStruct),iStatus);
   1.797 +        SetActive();
   1.798 +        }
   1.799 +    else
   1.800 +        {
   1.801 +        User::Leave(KErrNotReady);
   1.802 +        }
   1.803 +    }
   1.804 +
   1.805 +// -----------------------------------------------------------------------------
   1.806 +// CMMFDrmAudioPlayerUtility::ConnectL
   1.807 +//
   1.808 +// (other items were commented in a header).
   1.809 +// -----------------------------------------------------------------------------
   1.810 +//
   1.811 +void CMMFDrmAudioPlayerUtility::ConnectL()
   1.812 +    {
   1.813 +    CActiveScheduler::Add(this);
   1.814 +    iDrmSession = new(ELeave) RDrmSession();
   1.815 +    User::LeaveIfError( iDrmSession->Connect() );
   1.816 +    }
   1.817 +
   1.818 +// -----------------------------------------------------------------------------
   1.819 +// CMMFDrmAudioPlayerUtility::OpenFileL
   1.820 +//
   1.821 +// (other items were commented in a header).
   1.822 +// -----------------------------------------------------------------------------
   1.823 +//
   1.824 +void CMMFDrmAudioPlayerUtility::OpenFileL(
   1.825 +    const TDesC& aFileName)
   1.826 +    {
   1.827 +    iState = EInitializing;
   1.828 +    if (!IsActive())
   1.829 +        {
   1.830 +        iDrmSession->Send(EDRMPlayServOpenFile,TIpcArgs(&iAsyncCallback,&aFileName,&iErrorDurationStruct),iStatus);
   1.831 +        SetActive();
   1.832 +        }
   1.833 +    else
   1.834 +        {
   1.835 +        User::Leave(KErrNotReady);
   1.836 +        }
   1.837 +    }
   1.838 +
   1.839 +// -----------------------------------------------------------------------------
   1.840 +// CMMFDrmAudioPlayerUtility::OpenFileL
   1.841 +//
   1.842 +// (other items were commented in a header).
   1.843 +// -----------------------------------------------------------------------------
   1.844 +//
   1.845 +void CMMFDrmAudioPlayerUtility::OpenFileL(
   1.846 +    const RFile& aFile)
   1.847 +    {
   1.848 +    TIpcArgs ipcArgs;
   1.849 +    aFile.TransferToServer(ipcArgs, 1, 3);
   1.850 +    ipcArgs.Set(0,&iAsyncCallback);
   1.851 +    ipcArgs.Set(2,&iErrorDurationStruct);
   1.852 +    iState = EInitializing;
   1.853 +    if (!IsActive())
   1.854 +        {
   1.855 +        iDrmSession->Send(EDRMPlayServOpenFileByHandle,ipcArgs,iStatus);
   1.856 +        SetActive();
   1.857 +        }
   1.858 +    else
   1.859 +        {
   1.860 +        User::Leave(KErrNotReady);
   1.861 +        }
   1.862 +    }
   1.863 +
   1.864 +// -----------------------------------------------------------------------------
   1.865 +// CMMFDrmAudioPlayerUtility::OpenFileL
   1.866 +//
   1.867 +// (other items were commented in a header).
   1.868 +// -----------------------------------------------------------------------------
   1.869 +//
   1.870 +#ifdef SYMBIAN_CAF_V2
   1.871 +void CMMFDrmAudioPlayerUtility::OpenFileL(const TMMSource& aSource)
   1.872 +    {
   1.873 +    if (aSource.SourceType()==KUidMMFileHandleSource)
   1.874 +        {
   1.875 +#ifdef SYMBIAN_SECURITY_CAF_RFILE_HANDLE
   1.876 +        RFile& fileHandle = static_cast<const TMMFileHandleSource&>(aSource).Handle();
   1.877 +        OpenFileL(fileHandle);
   1.878 +#else
   1.879 +        User::Leave(KErrNotSupported);
   1.880 +#endif
   1.881 +        }
   1.882 +    if (aSource.SourceType()==KUidMMFileSource)
   1.883 +        {
   1.884 +        const TDesC& fileName = static_cast<const TMMFileSource&>(aSource).Name();
   1.885 +        OpenFileL(fileName);
   1.886 +        }
   1.887 +    }
   1.888 +#endif
   1.889 +
   1.890 +
   1.891 +// -----------------------------------------------------------------------------
   1.892 +// CMMFDrmAudioPlayerUtility::OpenDesL
   1.893 +//
   1.894 +// (other items were commented in a header).
   1.895 +// -----------------------------------------------------------------------------
   1.896 +//
   1.897 +void CMMFDrmAudioPlayerUtility::OpenDesL(
   1.898 +    const TDesC8& aDescriptor)
   1.899 +    {
   1.900 +    iStatus = EInitializing;
   1.901 +    if (!IsActive())
   1.902 +        {
   1.903 +        iDrmSession->Send(EDRMPlayServOpenDes,TIpcArgs(&iAsyncCallback,&aDescriptor,&iErrorDurationStruct),iStatus);
   1.904 +        SetActive();
   1.905 +        }
   1.906 +    else
   1.907 +        {
   1.908 +        User::Leave(KErrNotReady);
   1.909 +        }
   1.910 +    }
   1.911 +
   1.912 +// -----------------------------------------------------------------------------
   1.913 +// CMMFDrmAudioPlayerUtility::OpenUrlL
   1.914 +//
   1.915 +// (other items were commented in a header).
   1.916 +// -----------------------------------------------------------------------------
   1.917 +//
   1.918 +void CMMFDrmAudioPlayerUtility::OpenUrlL(
   1.919 +    const TDesC& aUrl,
   1.920 +    const TInt aIapId,
   1.921 +    const TDesC8& aMimeType)
   1.922 +    {
   1.923 +    TUrlStruct theStruct;
   1.924 +
   1.925 +    theStruct.iUrl = aUrl;
   1.926 +    theStruct.iIapId = aIapId;
   1.927 +    theStruct.iMimeType = aMimeType;
   1.928 +
   1.929 +    TUrlStructPckgBuf pckg(theStruct);
   1.930 +    iStatus = EInitializing;
   1.931 +    if (!IsActive())
   1.932 +        {
   1.933 +        iDrmSession->Send(EDRMPlayServOpenUrl,TIpcArgs(&iAsyncCallback,&pckg,&iErrorDurationStruct),iStatus);
   1.934 +        SetActive();
   1.935 +        }
   1.936 +    else
   1.937 +        {
   1.938 +        User::Leave(KErrNotReady);
   1.939 +        }
   1.940 +    }
   1.941 +
   1.942 +// -----------------------------------------------------------------------------
   1.943 +// CMMFDrmAudioPlayerUtility::Play
   1.944 +//
   1.945 +// (other items were commented in a header).
   1.946 +// -----------------------------------------------------------------------------
   1.947 +//
   1.948 +void CMMFDrmAudioPlayerUtility::Play()
   1.949 +    {
   1.950 +    if (iState != EPlaying)
   1.951 +        {
   1.952 +        iState = EPlaying;
   1.953 +        if (!IsActive())
   1.954 +            {
   1.955 +            SetActive();
   1.956 +            iDrmSession->Send(EDRMPlayServPlay,TIpcArgs(&iAsyncCallback,0,&iErrorDurationStruct),iStatus);
   1.957 +            }
   1.958 +        }
   1.959 +    }
   1.960 +
   1.961 +// -----------------------------------------------------------------------------
   1.962 +// CMMFDrmAudioPlayerUtility::Stop
   1.963 +//
   1.964 +// (other items were commented in a header).
   1.965 +// -----------------------------------------------------------------------------
   1.966 +//
   1.967 +void CMMFDrmAudioPlayerUtility::Stop()
   1.968 +    {
   1.969 +    iDrmSession->Send(EDRMPlayServStop);
   1.970 +    if (IsActive())
   1.971 +            {
   1.972 +            Cancel();
   1.973 +            }
   1.974 +
   1.975 +    iState = EIdle;
   1.976 +    }
   1.977 +
   1.978 +// -----------------------------------------------------------------------------
   1.979 +// CMMFDrmAudioPlayerUtility::Pause
   1.980 +//
   1.981 +// (other items were commented in a header).
   1.982 +// -----------------------------------------------------------------------------
   1.983 +//
   1.984 +TInt CMMFDrmAudioPlayerUtility::Pause()
   1.985 +    {
   1.986 +    iDrmSession->Send(EDRMPlayServPause);
   1.987 +    iState = EPaused;
   1.988 +    return KErrNone;
   1.989 +    }
   1.990 +
   1.991 +// -----------------------------------------------------------------------------
   1.992 +// CMMFDrmAudioPlayerUtility::Close
   1.993 +//
   1.994 +// (other items were commented in a header).
   1.995 +// -----------------------------------------------------------------------------
   1.996 +//
   1.997 +void CMMFDrmAudioPlayerUtility::Close()
   1.998 +    {
   1.999 +    if (IsActive())
  1.1000 +            {
  1.1001 +                Cancel();
  1.1002 +            }
  1.1003 +    iDrmSession->Send(EDRMPlayServClose);
  1.1004 +    }
  1.1005 +
  1.1006 +// -----------------------------------------------------------------------------
  1.1007 +// CMMFDrmAudioPlayerUtility::SetVolume
  1.1008 +//
  1.1009 +// (other items were commented in a header).
  1.1010 +// -----------------------------------------------------------------------------
  1.1011 +//
  1.1012 +void CMMFDrmAudioPlayerUtility::SetVolume(
  1.1013 +    TInt aVolume)
  1.1014 +    {
  1.1015 +    iDrmSession->Send(EDRMPlayServSetVolume,TIpcArgs(aVolume));
  1.1016 +    }
  1.1017 +
  1.1018 +// -----------------------------------------------------------------------------
  1.1019 +// CMMFDrmAudioPlayerUtility::SetRepeats
  1.1020 +//
  1.1021 +// (other items were commented in a header).
  1.1022 +// -----------------------------------------------------------------------------
  1.1023 +//
  1.1024 +void CMMFDrmAudioPlayerUtility::SetRepeats(
  1.1025 +    TInt aRepeatNumberOfTimes,
  1.1026 +    const TTimeIntervalMicroSeconds& aTrailingSilence)
  1.1027 +    {
  1.1028 +
  1.1029 +    TPckgTTimeIntervalMicroSeconds trailingSilencePckg(aTrailingSilence);
  1.1030 +    iDrmSession->Send(EDRMPlayServSetRepeats,TIpcArgs(aRepeatNumberOfTimes,&trailingSilencePckg));
  1.1031 +    }
  1.1032 +
  1.1033 +// -----------------------------------------------------------------------------
  1.1034 +// CMMFDrmAudioPlayerUtility::SetVolumeRamp
  1.1035 +//
  1.1036 +// (other items were commented in a header).
  1.1037 +// -----------------------------------------------------------------------------
  1.1038 +//
  1.1039 +void CMMFDrmAudioPlayerUtility::SetVolumeRamp(
  1.1040 +    const TTimeIntervalMicroSeconds& aRampDuration)
  1.1041 +    {
  1.1042 +
  1.1043 +    TPckgTTimeIntervalMicroSeconds volumeRampPckg(aRampDuration);
  1.1044 +    iDrmSession->Send(EDRMPlayServSetVolumeRamp,TIpcArgs(&volumeRampPckg));
  1.1045 +    }
  1.1046 +
  1.1047 +// -----------------------------------------------------------------------------
  1.1048 +// CMMFDrmAudioPlayerUtility::SetPriority
  1.1049 +//
  1.1050 +// (other items were commented in a header).
  1.1051 +// -----------------------------------------------------------------------------
  1.1052 +//
  1.1053 +TInt CMMFDrmAudioPlayerUtility::SetPriority(
  1.1054 +    TInt aPriority,
  1.1055 +    TMdaPriorityPreference aPref)
  1.1056 +    {
  1.1057 +    return iDrmSession->Send(EDRMPlayServSetPriority,TIpcArgs(aPriority,aPref));
  1.1058 +    }
  1.1059 +
  1.1060 +// -----------------------------------------------------------------------------
  1.1061 +// CMMFDrmAudioPlayerUtility::Duration
  1.1062 +//
  1.1063 +// (other items were commented in a header).
  1.1064 +// -----------------------------------------------------------------------------
  1.1065 +//
  1.1066 +const TTimeIntervalMicroSeconds& CMMFDrmAudioPlayerUtility::Duration()
  1.1067 +    {
  1.1068 +    TPckgBufTTimeIntervalMicroSeconds pckg;
  1.1069 +    iDrmSession->Send(EDRMPlayServDuration,TIpcArgs(&pckg));
  1.1070 +    return pckg();
  1.1071 +    }
  1.1072 +
  1.1073 +
  1.1074 +// -----------------------------------------------------------------------------
  1.1075 +// CMMFDrmAudioPlayerUtility::MaxVolume
  1.1076 +//
  1.1077 +// (other items were commented in a header).
  1.1078 +// -----------------------------------------------------------------------------
  1.1079 +//
  1.1080 +TInt CMMFDrmAudioPlayerUtility::MaxVolume()
  1.1081 +    {
  1.1082 +    return iDrmSession->Send(EDRMPlayServMaxVolume);
  1.1083 +    }
  1.1084 +
  1.1085 +// -----------------------------------------------------------------------------
  1.1086 +// CMMFDrmAudioPlayerUtility::GetPosition
  1.1087 +//
  1.1088 +// (other items were commented in a header).
  1.1089 +// -----------------------------------------------------------------------------
  1.1090 +//
  1.1091 +TInt CMMFDrmAudioPlayerUtility::GetPosition(
  1.1092 +    TTimeIntervalMicroSeconds& aPosition)
  1.1093 +    {
  1.1094 +    TPckgTTimeIntervalMicroSeconds thePositionPckg(aPosition);
  1.1095 +    TInt ret = iDrmSession->Send(EDRMPlayServGetPosition,TIpcArgs(&thePositionPckg));
  1.1096 +    aPosition = thePositionPckg();
  1.1097 +    return ret;
  1.1098 +    }
  1.1099 +
  1.1100 +// -----------------------------------------------------------------------------
  1.1101 +// CMMFDrmAudioPlayerUtility::SetPosition
  1.1102 +//
  1.1103 +// (other items were commented in a header).
  1.1104 +// -----------------------------------------------------------------------------
  1.1105 +//
  1.1106 +void CMMFDrmAudioPlayerUtility::SetPosition(
  1.1107 +    const TTimeIntervalMicroSeconds& aPosition)
  1.1108 +    {
  1.1109 +    TSetPositionStruct sendPckg;
  1.1110 +    sendPckg.iPosition = aPosition;
  1.1111 +
  1.1112 +    TSetPositionStructBuf pckg(sendPckg);
  1.1113 +    iDrmSession->Send(EDRMPlayServSetPosition,TIpcArgs(&pckg));
  1.1114 +    }
  1.1115 +
  1.1116 +// -----------------------------------------------------------------------------
  1.1117 +// CMMFDrmAudioPlayerUtility::GetVolume
  1.1118 +//
  1.1119 +// (other items were commented in a header).
  1.1120 +// -----------------------------------------------------------------------------
  1.1121 +//
  1.1122 +TInt CMMFDrmAudioPlayerUtility::GetVolume(TInt& aVolume)
  1.1123 +    {
  1.1124 +    TInt theReturnValue;
  1.1125 +    TPckgBufTInt theVolume;
  1.1126 +    theReturnValue = iDrmSession->Send(EDRMPlayServGetVolume,TIpcArgs(&theVolume));
  1.1127 +    aVolume = theVolume();
  1.1128 +    return theReturnValue;
  1.1129 +    }
  1.1130 +
  1.1131 +// -----------------------------------------------------------------------------
  1.1132 +// CMMFDrmAudioPlayerUtility::GetNumberOfMetaDataEntries
  1.1133 +//
  1.1134 +// (other items were commented in a header).
  1.1135 +// -----------------------------------------------------------------------------
  1.1136 +//
  1.1137 +TInt CMMFDrmAudioPlayerUtility::GetNumberOfMetaDataEntries(
  1.1138 +    TInt& aNumEntries)
  1.1139 +    {
  1.1140 +    TPckgBufTInt theNumEntries;
  1.1141 +    TInt retValue = iDrmSession->Send(EDRMPlayServGetNumberOfMetaDataEntries,TIpcArgs(&theNumEntries));
  1.1142 +    aNumEntries = theNumEntries();
  1.1143 +    return retValue;
  1.1144 +    }
  1.1145 +
  1.1146 +// -----------------------------------------------------------------------------
  1.1147 +// CMMFDrmAudioPlayerUtility::GetMetaDataEntryL
  1.1148 +//
  1.1149 +// (other items were commented in a header).
  1.1150 +// -----------------------------------------------------------------------------
  1.1151 +//
  1.1152 +CMMFMetaDataEntry* CMMFDrmAudioPlayerUtility::GetMetaDataEntryL(
  1.1153 +    TInt aMetaDataIndex)
  1.1154 +    {
  1.1155 +    TBuf8<100> data;
  1.1156 +    iDrmSession->Send(EDRMPlayServGetMetaDataEntry,TIpcArgs(aMetaDataIndex,&data));
  1.1157 +    delete iMetaDataBuffer;
  1.1158 +    iMetaDataBuffer = NULL;
  1.1159 +    iMetaDataBuffer = CBufFlat::NewL(32);
  1.1160 +    HBufC8* theData = data.Alloc();
  1.1161 +    iMetaDataBuffer->InsertL(0,theData->Des());
  1.1162 +    RBufReadStream s;
  1.1163 +    s.Open(*iMetaDataBuffer);
  1.1164 +    CleanupClosePushL(s);
  1.1165 +    CMMFMetaDataEntry* theMetaDataEntry  = CMMFMetaDataEntry::NewL();
  1.1166 +    theMetaDataEntry->InternalizeL(s);
  1.1167 +    CleanupStack::PopAndDestroy();//s
  1.1168 +    return theMetaDataEntry;
  1.1169 +    }
  1.1170 +
  1.1171 +// -----------------------------------------------------------------------------
  1.1172 +// CMMFDrmAudioPlayerUtility::SetPlayWindow
  1.1173 +//
  1.1174 +// (other items were commented in a header).
  1.1175 +// -----------------------------------------------------------------------------
  1.1176 +//
  1.1177 +TInt CMMFDrmAudioPlayerUtility::SetPlayWindow(
  1.1178 +    const TTimeIntervalMicroSeconds& aPlayStart,
  1.1179 +    const TTimeIntervalMicroSeconds& aPlayEnd)
  1.1180 +    {
  1.1181 +    TPlayWindowStruct sendPckg;
  1.1182 +    sendPckg.iPlayStart = aPlayStart;
  1.1183 +    sendPckg.iPlayEnd = aPlayEnd;
  1.1184 +
  1.1185 +    TPlayWindowStructBuf pckg(sendPckg);
  1.1186 +
  1.1187 +    return iDrmSession->Send(EDRMPlayServSetPlayWindow,TIpcArgs(&pckg));
  1.1188 +    }
  1.1189 +
  1.1190 +// -----------------------------------------------------------------------------
  1.1191 +// CMMFDrmAudioPlayerUtility::ClearPlayWindow
  1.1192 +//
  1.1193 +// (other items were commented in a header).
  1.1194 +// -----------------------------------------------------------------------------
  1.1195 +//
  1.1196 +TInt CMMFDrmAudioPlayerUtility::ClearPlayWindow()
  1.1197 +    {
  1.1198 +    return iDrmSession->Send(EDRMPlayServClearPlayWindow);
  1.1199 +    }
  1.1200 +
  1.1201 +// -----------------------------------------------------------------------------
  1.1202 +// CMMFDrmAudioPlayerUtility::SetBalance
  1.1203 +//
  1.1204 +// (other items were commented in a header).
  1.1205 +// -----------------------------------------------------------------------------
  1.1206 +//
  1.1207 +TInt CMMFDrmAudioPlayerUtility::SetBalance(
  1.1208 +    TInt aBalance)
  1.1209 +    {
  1.1210 +    return iDrmSession->Send(EDRMPlayServSetBalance,TIpcArgs(aBalance));
  1.1211 +    }
  1.1212 +
  1.1213 +// -----------------------------------------------------------------------------
  1.1214 +// CMMFDrmAudioPlayerUtility::GetBitRate
  1.1215 +//
  1.1216 +// (other items were commented in a header).
  1.1217 +// -----------------------------------------------------------------------------
  1.1218 +//
  1.1219 +TInt CMMFDrmAudioPlayerUtility::GetBitRate(
  1.1220 +    TUint& aBitRate)
  1.1221 +    {
  1.1222 +    TPckgBufTUint pckg;
  1.1223 +    TInt retValue = iDrmSession->Send(EDRMPlayServGetBitRate,TIpcArgs(&pckg));
  1.1224 +    aBitRate = pckg();
  1.1225 +    return retValue;
  1.1226 +    }
  1.1227 +
  1.1228 +// -----------------------------------------------------------------------------
  1.1229 +// CMMFDrmAudioPlayerUtility::ControllerImplementationInformationL
  1.1230 +//
  1.1231 +// (other items were commented in a header).
  1.1232 +// -----------------------------------------------------------------------------
  1.1233 +//
  1.1234 +const CMMFControllerImplementationInformation& CMMFDrmAudioPlayerUtility::ControllerImplementationInformationL()
  1.1235 +    {
  1.1236 +    TUid theUid;
  1.1237 +    iDrmSession->Send(EDRMPlayServControllerImplementationInformation,TIpcArgs(&theUid));
  1.1238 +    iControllerImplementationInformation = CMMFControllerImplementationInformation::NewL(theUid);
  1.1239 +    return *iControllerImplementationInformation;
  1.1240 +    }
  1.1241 +
  1.1242 +// -----------------------------------------------------------------------------
  1.1243 +// CMMFDrmAudioPlayerUtility::GetAudioLoadingProgressL
  1.1244 +//
  1.1245 +// (other items were commented in a header).
  1.1246 +// -----------------------------------------------------------------------------
  1.1247 +//
  1.1248 +void CMMFDrmAudioPlayerUtility::GetAudioLoadingProgressL(
  1.1249 +    TInt& aPercentageProgress)
  1.1250 +    {
  1.1251 +    TPckgBufTInt pckg;
  1.1252 +    iDrmSession->Send(EDRMPlayServGetAudioLoadingProgress,TIpcArgs(&pckg));
  1.1253 +    aPercentageProgress = pckg();
  1.1254 +    }
  1.1255 +
  1.1256 +// -----------------------------------------------------------------------------
  1.1257 +// CMMFDrmAudioPlayerUtility::CustomCommandSync
  1.1258 +//
  1.1259 +// (other items were commented in a header).
  1.1260 +// -----------------------------------------------------------------------------
  1.1261 +//
  1.1262 +TInt CMMFDrmAudioPlayerUtility::CustomCommandSync(
  1.1263 +    const TMMFMessageDestinationPckg& aDestination,
  1.1264 +    TInt aFunction,
  1.1265 +    const TDesC8& aDataTo1,
  1.1266 +    const TDesC8& aDataTo2,
  1.1267 +    TDes8& aDataFrom)
  1.1268 +    {
  1.1269 +    TInt theReturnValue(KErrPermissionDenied);
  1.1270 +
  1.1271 +    TPckgCustomCommand thePckg;
  1.1272 +    thePckg().iDestination = aDestination;
  1.1273 +    thePckg().iFunction = aFunction;
  1.1274 +/*
  1.1275 +    RDebug::Print(_L("CMMFDrmAudioPlayerUtility::CustomCommandSync:IFId[%x]DestHndl[%x]Fn[%d]RetDesLen[%d]"),
  1.1276 +                                thePckg().iDestination().InterfaceId(),
  1.1277 +                                thePckg().iDestination().DestinationHandle(),
  1.1278 +                                thePckg().iFunction,
  1.1279 +                                aDataFrom.Length());
  1.1280 +*/
  1.1281 +     // Only Pass 'Allowed CustomCommand
  1.1282 +     if ( IsValidCustomCommandDestination(aDestination().InterfaceId(), aDataTo1) )
  1.1283 +        {
  1.1284 +        theReturnValue = iDrmSession->Send( EDRMPlayServCustomCommandSyncWithReturn,
  1.1285 +                                            TIpcArgs(&thePckg, &aDataTo1, &aDataTo2, &aDataFrom));
  1.1286 +        }
  1.1287 +    return theReturnValue;
  1.1288 +    }
  1.1289 +
  1.1290 +// -----------------------------------------------------------------------------
  1.1291 +// CMMFDrmAudioPlayerUtility::CustomCommandSync
  1.1292 +//
  1.1293 +// (other items were commented in a header).
  1.1294 +// -----------------------------------------------------------------------------
  1.1295 +//
  1.1296 +TInt CMMFDrmAudioPlayerUtility::CustomCommandSync(
  1.1297 +    const TMMFMessageDestinationPckg& aDestination,
  1.1298 +    TInt aFunction,
  1.1299 +    const TDesC8& aDataTo1,
  1.1300 +    const TDesC8& aDataTo2)
  1.1301 +    {
  1.1302 +    TInt theReturnValue(KErrPermissionDenied);
  1.1303 +
  1.1304 +    TPckgCustomCommand thePckg;
  1.1305 +    thePckg().iDestination = aDestination;
  1.1306 +    thePckg().iFunction = aFunction;
  1.1307 +/*
  1.1308 +    RDebug::Print(_L("CMMFDrmAudioPlayerUtility::CustomCommandSync:IFId[%x]DestHndl[%x]Fn[%d]"),
  1.1309 +                                thePckg().iDestination().InterfaceId(),
  1.1310 +                                thePckg().iDestination().DestinationHandle(),
  1.1311 +                                thePckg().iFunction);
  1.1312 +*/
  1.1313 +    // Only Pass 'Allowed CustomCommand
  1.1314 +    if ( IsValidCustomCommandDestination(aDestination().InterfaceId(), aDataTo1) )
  1.1315 +        {
  1.1316 +        theReturnValue = iDrmSession->Send( EDRMPlayServCustomCommandSyncWithoutReturn,
  1.1317 +                                            TIpcArgs(&thePckg, &aDataTo1, &aDataTo2));
  1.1318 +        }
  1.1319 +    return theReturnValue;
  1.1320 +    }
  1.1321 +
  1.1322 +// -----------------------------------------------------------------------------
  1.1323 +// CMMFDrmAudioPlayerUtility::CustomCommandAsync
  1.1324 +//
  1.1325 +// (other items were commented in a header).
  1.1326 +// -----------------------------------------------------------------------------
  1.1327 +//
  1.1328 +void CMMFDrmAudioPlayerUtility::CustomCommandAsync(
  1.1329 +    const TMMFMessageDestinationPckg& aDestination,
  1.1330 +    TInt aFunction,
  1.1331 +    const TDesC8& aDataTo1,
  1.1332 +    const TDesC8& aDataTo2,
  1.1333 +    TDes8& aDataFrom,
  1.1334 +    TRequestStatus& aStatus )
  1.1335 +    {
  1.1336 +    TPckgCustomCommand thePckg;
  1.1337 +    thePckg().iDestination = aDestination;
  1.1338 +    thePckg().iFunction = aFunction;
  1.1339 +    TInt status(KErrPermissionDenied);
  1.1340 +/*
  1.1341 +    RDebug::Print(_L("CMMFDrmAudioPlayerUtility::CustomCommandAsync:IFId[%x]DestHndl[%x]Fn[%d]Data1[Len:%d]Data2Len[Len:%d]RetDesLen[Len:%d:MaxLen:%d]"),
  1.1342 +                                thePckg().iDestination().InterfaceId(),
  1.1343 +                                thePckg().iDestination().DestinationHandle(),
  1.1344 +                                thePckg().iFunction,
  1.1345 +                                aDataTo1.Length(),
  1.1346 +                                aDataTo2.Length(),
  1.1347 +                                aDataFrom.Length(),
  1.1348 +                                aDataFrom.MaxLength() );
  1.1349 +*/
  1.1350 +    // Only Pass 'Allowed CustomCommand
  1.1351 +    if ( IsValidCustomCommandDestination(aDestination().InterfaceId(), aDataTo1) )
  1.1352 +        {
  1.1353 +        // Send in two steps, data in first step and async request in second step
  1.1354 +        // othewise thePckg will become invalid when tried to read from server
  1.1355 +        status = iDrmSession->Send( EDRMPlayServCustomCommandAsyncWithReturnStep1,
  1.1356 +                                    TIpcArgs(&thePckg, &aDataTo1, &aDataTo2) );
  1.1357 +        if ( status == KErrNone )
  1.1358 +            {
  1.1359 +            // Pass descriptor place holder to get data back in the async call
  1.1360 +            iDrmSession->Send( EDRMPlayServCustomCommandAsyncWithReturnStep2,
  1.1361 +                               TIpcArgs(&aDataFrom),
  1.1362 +                               aStatus );
  1.1363 +            }
  1.1364 +#ifdef _DEBUG
  1.1365 +        else
  1.1366 +            {
  1.1367 +            RDebug::Print(_L("CMMFDrmAudioPlayerUtility::CustomCommandAsync:IFId[%x]DestHndl[%x]Fn[%d]Data1[Len:%d]Data2Len[Len:%d]RetDesLen[Len:%d:MaxLen:%d]DRM Proxy CustCmdAsyncWRet Step1[%d]"),
  1.1368 +                                        thePckg().iDestination().InterfaceId(),
  1.1369 +                                        thePckg().iDestination().DestinationHandle(),
  1.1370 +                                        thePckg().iFunction,
  1.1371 +                                        aDataTo1.Length(),
  1.1372 +                                        aDataTo2.Length(),
  1.1373 +                                        aDataFrom.Length(),
  1.1374 +                                        aDataFrom.MaxLength(),
  1.1375 +                                        status );
  1.1376 +            }
  1.1377 +#endif // _DEBUG
  1.1378 +        }
  1.1379 +     if ( status != KErrNone )
  1.1380 +        {
  1.1381 +        TRequestStatus* s = &aStatus;
  1.1382 +        User::RequestComplete( s , status );
  1.1383 +        }
  1.1384 +    }
  1.1385 +
  1.1386 +// -----------------------------------------------------------------------------
  1.1387 +// CMMFDrmAudioPlayerUtility::CustomCommandAsync
  1.1388 +//
  1.1389 +// (other items were commented in a header).
  1.1390 +// -----------------------------------------------------------------------------
  1.1391 +//
  1.1392 +void CMMFDrmAudioPlayerUtility::CustomCommandAsync(
  1.1393 +    const TMMFMessageDestinationPckg& aDestination,
  1.1394 +    TInt aFunction,
  1.1395 +    const TDesC8& aDataTo1,
  1.1396 +    const TDesC8& aDataTo2,
  1.1397 +    TRequestStatus& aStatus)
  1.1398 +    {
  1.1399 +    TPckgCustomCommand thePckg;
  1.1400 +    thePckg().iDestination = aDestination;
  1.1401 +    thePckg().iFunction = aFunction;
  1.1402 +
  1.1403 +    TInt status(KErrPermissionDenied);
  1.1404 +/*
  1.1405 +    RDebug::Print(_L("CMMFDrmAudioPlayerUtility::CustomCommandAsync:IFId[%x]DestHndl[%x]Fn[%d]Data1[Len:%d]Data2Len[Len:%d]"),
  1.1406 +                                thePckg().iDestination().InterfaceId(),
  1.1407 +                                thePckg().iDestination().DestinationHandle(),
  1.1408 +                                thePckg().iFunction,
  1.1409 +                                aDataTo1.Length(),
  1.1410 +                                aDataTo2.Length() );
  1.1411 +*/
  1.1412 +     // Only Pass 'Allowed CustomCommand
  1.1413 +    if ( IsValidCustomCommandDestination(aDestination().InterfaceId(), aDataTo1) )
  1.1414 +        {
  1.1415 +        // Send in two steps, data in first step and async request in second step
  1.1416 +        // othewise thePckg will become invalid when tried to read from server
  1.1417 +        status = iDrmSession->Send( EDRMPlayServCustomCommandAsyncWithoutReturnStep1,
  1.1418 +                                    TIpcArgs(&thePckg, &aDataTo1, &aDataTo2) );
  1.1419 +        if ( status == KErrNone )
  1.1420 +            {
  1.1421 +            iDrmSession->Send( EDRMPlayServCustomCommandAsyncWithoutReturnStep2,
  1.1422 +                               TIpcArgs(),
  1.1423 +                               aStatus );
  1.1424 +            }
  1.1425 +#ifdef _DEBUG
  1.1426 +        else
  1.1427 +            {
  1.1428 +            RDebug::Print(_L("CMMFDrmAudioPlayerUtility::CustomCommandAsync:IFId[%x]DestHndl[%x]Fn[%d]Data1[Len:%d]Data2Len[Len:%d]DRM Proxy CustCmdAsyncWoRet Step1[%d]"),
  1.1429 +                                        thePckg().iDestination().InterfaceId(),
  1.1430 +                                        thePckg().iDestination().DestinationHandle(),
  1.1431 +                                        thePckg().iFunction,
  1.1432 +                                        aDataTo1.Length(),
  1.1433 +                                        aDataTo2.Length(),
  1.1434 +                                        status );
  1.1435 +            }
  1.1436 +#endif // _DEBUG
  1.1437 +        }
  1.1438 +     if ( status != KErrNone )
  1.1439 +        {
  1.1440 +        TRequestStatus* s = &aStatus;
  1.1441 +        User::RequestComplete( s , status );
  1.1442 +        }
  1.1443 +    }
  1.1444 +
  1.1445 +// -----------------------------------------------------------------------------
  1.1446 +// CMMFDrmAudioPlayerUtility::GetBalance
  1.1447 +//
  1.1448 +// (other items were commented in a header).
  1.1449 +// -----------------------------------------------------------------------------
  1.1450 +//
  1.1451 +TInt CMMFDrmAudioPlayerUtility::GetBalance(
  1.1452 +    TInt& aBalance)
  1.1453 +    {
  1.1454 +    TPckgBufTInt theBalance;
  1.1455 +
  1.1456 +    TInt retValue = iDrmSession->Send(EDRMPlayServGetBalance,TIpcArgs(&theBalance));
  1.1457 +    aBalance = theBalance();
  1.1458 +    return retValue;
  1.1459 +    }
  1.1460 +
  1.1461 +// -----------------------------------------------------------------------------
  1.1462 +// CMMFDrmAudioPlayerUtility::RegisterForAudioLoadingNotification
  1.1463 +//
  1.1464 +// (other items were commented in a header).
  1.1465 +// -----------------------------------------------------------------------------
  1.1466 +//
  1.1467 +void CMMFDrmAudioPlayerUtility::RegisterForAudioLoadingNotification(
  1.1468 +    MAudioLoadingObserver& aLoadingObserver)
  1.1469 +    {
  1.1470 +    iAsyncCallback() = ELoadingStarted;
  1.1471 +    iLoadingObserver = &aLoadingObserver;
  1.1472 +    iDrmSession->Send(EDRMPlayServRegisterForAudioLoadingNotification,TIpcArgs(&iAsyncCallback));
  1.1473 +    }
  1.1474 +
  1.1475 +
  1.1476 +// -----------------------------------------------------------------------------
  1.1477 +// CMMFDrmAudioPlayerUtility::DoCancel
  1.1478 +//
  1.1479 +// (other items were commented in a header).
  1.1480 +// -----------------------------------------------------------------------------
  1.1481 +//
  1.1482 +void CMMFDrmAudioPlayerUtility::DoCancel()
  1.1483 +   {
  1.1484 +   }
  1.1485 +
  1.1486 +// -----------------------------------------------------------------------------
  1.1487 +// CMMFDrmAudioPlayerUtility::RunL
  1.1488 +//
  1.1489 +// (other items were commented in a header).
  1.1490 +// -----------------------------------------------------------------------------
  1.1491 +//
  1.1492 +void CMMFDrmAudioPlayerUtility::RunL()
  1.1493 +   {
  1.1494 +    DEP_PRN1(_L("CMMFDrmAudioPlayerUtility::RunL:iStatus[%d]"), iStatus.Int());
  1.1495 +
  1.1496 +    if (iState == EPaused)
  1.1497 +        {
  1.1498 +        return;
  1.1499 +        }
  1.1500 +    if ( iStatus.Int() == KErrCancel )
  1.1501 +        return;
  1.1502 +    switch (iAsyncCallback())
  1.1503 +        {
  1.1504 +        case EInitComplete:
  1.1505 +            if (iState != EIdle)
  1.1506 +                {
  1.1507 +                DEP_PRN0(_L("CMMFDrmAudioPlayerUtility::RunL - InitComplete"));
  1.1508 +                iState = EIdle;
  1.1509 +                iCallback.MdapcInitComplete(iErrorDurationStruct().iError, iErrorDurationStruct().iDuration);
  1.1510 +                }
  1.1511 +        break;
  1.1512 +
  1.1513 +        case EPlayComplete:
  1.1514 +            DEP_PRN0(_L("CMMFDrmAudioPlayerUtility::RunL - PlayComplete"));
  1.1515 +            iState = EIdle;
  1.1516 +            iCallback.MdapcPlayComplete(iErrorDurationStruct().iError);
  1.1517 +        break;
  1.1518 +
  1.1519 +        case ELoadingStarted:
  1.1520 +            DEP_PRN0(_L("CMMFDrmAudioPlayerUtility::RunL - MaloLoadingStarted"));
  1.1521 +
  1.1522 +            iDrmSession->Send(EDRMPlayServRegisterForAudioLoadingNotification,TIpcArgs(&iAsyncCallback),iStatus);
  1.1523 +            SetActive();
  1.1524 +            iLoadingObserver->MaloLoadingStarted();
  1.1525 +        break;
  1.1526 +
  1.1527 +        case ELoadingComplete:
  1.1528 +            DEP_PRN0(_L("CMMFDrmAudioPlayerUtility::RunL - MaloLoadingComplete"));
  1.1529 +
  1.1530 +            iAsyncCallback() = ELoadingStarted;
  1.1531 +            iLoadingObserver->MaloLoadingComplete();
  1.1532 +        break;
  1.1533 +
  1.1534 +        default:
  1.1535 +        break;
  1.1536 +        }
  1.1537 +   }
  1.1538 +
  1.1539 +TBool CMMFDrmAudioPlayerUtility::IsValidCustomCommandDestination(TUid aDestinationUid, const TDesC8& aParam)
  1.1540 +    {
  1.1541 +    TBool retValue(ETrue);
  1.1542 +    if (aDestinationUid == KUidInterfaceMMFDRMControl)
  1.1543 +        {
  1.1544 +        retValue = EFalse;
  1.1545 +        }
  1.1546 +    else if ( aDestinationUid == KUidCustomInterfaceBuilderImpl )
  1.1547 +        {
  1.1548 +             TRAPD(err, retValue = CheckCustomInterfaceBuilderImplL(aParam));
  1.1549 +             if((err != KErrNone) || (retValue == EFalse))
  1.1550 +                retValue = EFalse;
  1.1551 +        }
  1.1552 +    return retValue;
  1.1553 +    }
  1.1554 +
  1.1555 +TBool CMMFDrmAudioPlayerUtility::CheckCustomInterfaceBuilderImplL(const TDesC8& aParam)
  1.1556 +{
  1.1557 +    TBool retValue(ETrue);
  1.1558 +    RDesReadStream stream(aParam);
  1.1559 +    CleanupClosePushL(stream);
  1.1560 +    TUid paramUid;
  1.1561 +    paramUid.iUid = stream.ReadInt32L();
  1.1562 +    CleanupStack::PopAndDestroy(&stream);
  1.1563 +    if ( paramUid == KUidAudioOutput )
  1.1564 +         {
  1.1565 +         retValue = EFalse;
  1.1566 +         }
  1.1567 +   return retValue;
  1.1568 +}
  1.1569 +
  1.1570 +// End of file