sl@0: /* sl@0: * Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: DRM Audio player sl@0: * sl@0: */ sl@0: sl@0: sl@0: sl@0: #ifndef __CDRM_H sl@0: #define __CDRM_H sl@0: sl@0: sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include "mmfdrmSession.h" sl@0: sl@0: class CDrm: public CActive sl@0: { sl@0: public: sl@0: sl@0: /** sl@0: * Two-phased constructor. sl@0: */ sl@0: static CDrm* NewL(TInt aPriority); sl@0: /** sl@0: * Two-phased constructor. sl@0: */ sl@0: static CDrm* NewLC(TInt aPriority); sl@0: /** sl@0: * Destructor sl@0: */ sl@0: ~CDrm(); sl@0: TInt Connect(); sl@0: void Play(); sl@0: void Stop(); sl@0: void SetVolume(TInt aVolume); sl@0: void SetRepeats(TInt aRepeatNumberOfTimes, const TTimeIntervalMicroSeconds& aTrailingSilence); sl@0: void SetVolumeRamp(const TTimeIntervalMicroSeconds& aRampDuration); sl@0: const TTimeIntervalMicroSeconds& Duration(); sl@0: TInt MaxVolume(); sl@0: void OpenFileL(const TDesC& aFileName); sl@0: void OpenFileL(const RFile& aFile); sl@0: void OpenFileL(const TMMSource& aSource); sl@0: void OpenDesL(const TDesC8& aDescriptor); sl@0: void OpenUrlL(const TDesC& aUrl, TInt aIapId = KUseDefaultIap, const TDesC8& aMimeType=KNullDesC8); sl@0: TInt Pause(); sl@0: void Close(); sl@0: TInt GetPosition(TTimeIntervalMicroSeconds& aPosition); sl@0: void SetPosition(const TTimeIntervalMicroSeconds& aPosition); sl@0: TInt SetPriority(TInt aPriority, TMdaPriorityPreference aPref); sl@0: TInt GetVolume(TInt& aVolume); sl@0: TInt GetNumberOfMetaDataEntries(TInt& aNumEntries); sl@0: CMMFMetaDataEntry* GetMetaDataEntryL(TInt aMetaDataIndex); sl@0: TInt SetPlayWindow(const TTimeIntervalMicroSeconds& aStart, sl@0: const TTimeIntervalMicroSeconds& aEnd); sl@0: TInt ClearPlayWindow(); sl@0: TInt SetBalance(TInt aBalance = KMMFBalanceCenter); sl@0: TInt GetBalance(TInt& aBalance); sl@0: void RegisterForAudioLoadingNotification(MAudioLoadingObserver& aCallback); sl@0: void GetAudioLoadingProgressL(TInt& aPercentageComplete); sl@0: const CMMFControllerImplementationInformation& ControllerImplementationInformationL(); sl@0: TInt CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom); sl@0: TInt CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2); sl@0: void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom, TRequestStatus& aStatus); sl@0: void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TRequestStatus& aStatus); sl@0: TInt GetBitRate(TUint& aBitRate); sl@0: protected: sl@0: //inherited from CActive sl@0: void DoCancel(); sl@0: void RunL(); sl@0: sl@0: sl@0: private: sl@0: sl@0: //C++ constructor sl@0: CDrm(TInt aPriority); sl@0: // 2nd phase construction. sl@0: void ConstructL (void); sl@0: sl@0: // Session to server sl@0: RDrmSession* iSess; sl@0: //Current state sl@0: TInt iState; sl@0: sl@0: enum TState //events sl@0: { sl@0: EStatePlay = 0, sl@0: EStateStop, sl@0: EStateSetVolume, sl@0: EStateSetRepeats, sl@0: EStateSetVolumeRamp, sl@0: EStateDuration, sl@0: EStateMaxVolume, sl@0: EStateOpenFile, sl@0: EStateOpenDes, sl@0: EStateOpenUrl, sl@0: EStatePause, sl@0: EStateClose, sl@0: EStateGetPosition, sl@0: EStateSetPosition, sl@0: EStateSetPriority, sl@0: EStateGetVolume, sl@0: EStateGetNumberOfMetaDataEntries, sl@0: EStateGetMetaDataEntry, sl@0: EStateSetPlayWindow, sl@0: EStateClearPlayWindow, sl@0: EStateSetBalance, sl@0: EStateGetBalance, sl@0: EStateRegisterForAudioLoadingNotification, sl@0: EStateGetAudioLoadingProgress, sl@0: EStateControllerImplementationInformation, sl@0: EStateCustomCommandSync, sl@0: EStateCustomCommandSync2, sl@0: EStateCustomCommandAsync, sl@0: EStateCustomCommandAsync2, sl@0: EStateGetBitRate sl@0: }; sl@0: sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: #endif