os/mm/devsoundextensions/drmaudioplayer/DRMPlayUtility/src/mmfdrm.h
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     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 Audio player 
    15 *
    16 */
    17 
    18 
    19 
    20 #ifndef __CDRM_H
    21 #define __CDRM_H
    22 
    23 
    24 #include <e32base.h>
    25 #include <e32cons.h>
    26 #include <mmfbase.h>
    27 #include <mmfcontrollerframeworkbase.h>
    28 #include <mmfaudio.h>
    29 #include <mmfcontrollerpluginresolver.h>
    30 #include <mmfcontrollerframework.h>
    31 #include <mmfstandardcustomcommands.h>
    32 #include "mmfdrmSession.h"
    33 
    34 class CDrm: public CActive
    35 {
    36 public:
    37 
    38      /**
    39      * Two-phased constructor.
    40     */
    41    	static CDrm* NewL(TInt aPriority);
    42     /**
    43     * Two-phased constructor.
    44     */
    45 	static CDrm* NewLC(TInt aPriority);
    46 	/**
    47 	* Destructor
    48 	*/
    49 	~CDrm();
    50 	TInt Connect(); 
    51 	void Play();
    52 	void Stop();
    53 	void SetVolume(TInt aVolume);
    54 	void SetRepeats(TInt aRepeatNumberOfTimes, const TTimeIntervalMicroSeconds& aTrailingSilence);
    55 	void SetVolumeRamp(const TTimeIntervalMicroSeconds& aRampDuration);
    56 	const TTimeIntervalMicroSeconds& Duration();
    57 	TInt MaxVolume();
    58 	void OpenFileL(const TDesC& aFileName);
    59 	void OpenFileL(const RFile& aFile);
    60 	void OpenFileL(const TMMSource& aSource);
    61 	void OpenDesL(const TDesC8& aDescriptor);
    62 	void OpenUrlL(const TDesC& aUrl, TInt aIapId = KUseDefaultIap, const TDesC8& aMimeType=KNullDesC8);
    63 	TInt Pause();
    64 	void Close();
    65 	TInt GetPosition(TTimeIntervalMicroSeconds& aPosition);
    66 	void SetPosition(const TTimeIntervalMicroSeconds& aPosition);
    67 	TInt SetPriority(TInt aPriority, TMdaPriorityPreference aPref);
    68 	TInt GetVolume(TInt& aVolume);
    69 	TInt GetNumberOfMetaDataEntries(TInt& aNumEntries);
    70 	CMMFMetaDataEntry* GetMetaDataEntryL(TInt aMetaDataIndex);
    71 	TInt SetPlayWindow(const TTimeIntervalMicroSeconds& aStart,
    72 							const TTimeIntervalMicroSeconds& aEnd);
    73 	TInt ClearPlayWindow();
    74 	TInt SetBalance(TInt aBalance = KMMFBalanceCenter);
    75 	TInt GetBalance(TInt& aBalance);
    76 	void RegisterForAudioLoadingNotification(MAudioLoadingObserver& aCallback);
    77 	void GetAudioLoadingProgressL(TInt& aPercentageComplete);
    78 	const CMMFControllerImplementationInformation& ControllerImplementationInformationL();
    79 	TInt CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom);
    80 	TInt CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2);
    81 	void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom, TRequestStatus& aStatus);
    82 	void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TRequestStatus& aStatus);
    83 	TInt GetBitRate(TUint& aBitRate);
    84 protected:
    85 	//inherited from CActive
    86 	void DoCancel();
    87     void RunL();
    88 
    89 
    90 private:
    91 
    92 	//C++ constructor
    93    CDrm(TInt aPriority);
    94    // 2nd phase construction.
    95    void ConstructL (void);
    96 
    97    // Session to server   
    98    RDrmSession*	         iSess;
    99    //Current state
   100    TInt		         iState;
   101 
   102 	enum TState  //events
   103 		{
   104 		EStatePlay = 0,
   105 		EStateStop,
   106 		EStateSetVolume,
   107 		EStateSetRepeats,
   108 		EStateSetVolumeRamp,
   109 		EStateDuration,
   110 		EStateMaxVolume,
   111 		EStateOpenFile,
   112 		EStateOpenDes,
   113 		EStateOpenUrl,
   114 		EStatePause,
   115 		EStateClose,
   116 		EStateGetPosition,
   117 		EStateSetPosition,
   118 		EStateSetPriority,
   119 		EStateGetVolume,
   120 		EStateGetNumberOfMetaDataEntries,
   121 		EStateGetMetaDataEntry,
   122 		EStateSetPlayWindow,
   123 		EStateClearPlayWindow,
   124 		EStateSetBalance,
   125 		EStateGetBalance,
   126 		EStateRegisterForAudioLoadingNotification,
   127 		EStateGetAudioLoadingProgress,
   128 		EStateControllerImplementationInformation,
   129 		EStateCustomCommandSync,
   130 		EStateCustomCommandSync2,
   131 		EStateCustomCommandAsync,
   132 		EStateCustomCommandAsync2,
   133 		EStateGetBitRate
   134 		};
   135 
   136 };
   137 
   138 
   139 
   140 
   141 #endif