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.
sl@0
     1
/*
sl@0
     2
* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
sl@0
     3
* All rights reserved.
sl@0
     4
* This component and the accompanying materials are made available
sl@0
     5
* under the terms of "Eclipse Public License v1.0"
sl@0
     6
* which accompanies this distribution, and is available
sl@0
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     8
*
sl@0
     9
* Initial Contributors:
sl@0
    10
* Nokia Corporation - initial contribution.
sl@0
    11
*
sl@0
    12
* Contributors:
sl@0
    13
*
sl@0
    14
* Description:   DRM Audio player 
sl@0
    15
*
sl@0
    16
*/
sl@0
    17
sl@0
    18
sl@0
    19
sl@0
    20
#ifndef __CDRM_H
sl@0
    21
#define __CDRM_H
sl@0
    22
sl@0
    23
sl@0
    24
#include <e32base.h>
sl@0
    25
#include <e32cons.h>
sl@0
    26
#include <mmfbase.h>
sl@0
    27
#include <mmfcontrollerframeworkbase.h>
sl@0
    28
#include <mmfaudio.h>
sl@0
    29
#include <mmfcontrollerpluginresolver.h>
sl@0
    30
#include <mmfcontrollerframework.h>
sl@0
    31
#include <mmfstandardcustomcommands.h>
sl@0
    32
#include "mmfdrmSession.h"
sl@0
    33
sl@0
    34
class CDrm: public CActive
sl@0
    35
{
sl@0
    36
public:
sl@0
    37
sl@0
    38
     /**
sl@0
    39
     * Two-phased constructor.
sl@0
    40
    */
sl@0
    41
   	static CDrm* NewL(TInt aPriority);
sl@0
    42
    /**
sl@0
    43
    * Two-phased constructor.
sl@0
    44
    */
sl@0
    45
	static CDrm* NewLC(TInt aPriority);
sl@0
    46
	/**
sl@0
    47
	* Destructor
sl@0
    48
	*/
sl@0
    49
	~CDrm();
sl@0
    50
	TInt Connect(); 
sl@0
    51
	void Play();
sl@0
    52
	void Stop();
sl@0
    53
	void SetVolume(TInt aVolume);
sl@0
    54
	void SetRepeats(TInt aRepeatNumberOfTimes, const TTimeIntervalMicroSeconds& aTrailingSilence);
sl@0
    55
	void SetVolumeRamp(const TTimeIntervalMicroSeconds& aRampDuration);
sl@0
    56
	const TTimeIntervalMicroSeconds& Duration();
sl@0
    57
	TInt MaxVolume();
sl@0
    58
	void OpenFileL(const TDesC& aFileName);
sl@0
    59
	void OpenFileL(const RFile& aFile);
sl@0
    60
	void OpenFileL(const TMMSource& aSource);
sl@0
    61
	void OpenDesL(const TDesC8& aDescriptor);
sl@0
    62
	void OpenUrlL(const TDesC& aUrl, TInt aIapId = KUseDefaultIap, const TDesC8& aMimeType=KNullDesC8);
sl@0
    63
	TInt Pause();
sl@0
    64
	void Close();
sl@0
    65
	TInt GetPosition(TTimeIntervalMicroSeconds& aPosition);
sl@0
    66
	void SetPosition(const TTimeIntervalMicroSeconds& aPosition);
sl@0
    67
	TInt SetPriority(TInt aPriority, TMdaPriorityPreference aPref);
sl@0
    68
	TInt GetVolume(TInt& aVolume);
sl@0
    69
	TInt GetNumberOfMetaDataEntries(TInt& aNumEntries);
sl@0
    70
	CMMFMetaDataEntry* GetMetaDataEntryL(TInt aMetaDataIndex);
sl@0
    71
	TInt SetPlayWindow(const TTimeIntervalMicroSeconds& aStart,
sl@0
    72
							const TTimeIntervalMicroSeconds& aEnd);
sl@0
    73
	TInt ClearPlayWindow();
sl@0
    74
	TInt SetBalance(TInt aBalance = KMMFBalanceCenter);
sl@0
    75
	TInt GetBalance(TInt& aBalance);
sl@0
    76
	void RegisterForAudioLoadingNotification(MAudioLoadingObserver& aCallback);
sl@0
    77
	void GetAudioLoadingProgressL(TInt& aPercentageComplete);
sl@0
    78
	const CMMFControllerImplementationInformation& ControllerImplementationInformationL();
sl@0
    79
	TInt CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom);
sl@0
    80
	TInt CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2);
sl@0
    81
	void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom, TRequestStatus& aStatus);
sl@0
    82
	void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TRequestStatus& aStatus);
sl@0
    83
	TInt GetBitRate(TUint& aBitRate);
sl@0
    84
protected:
sl@0
    85
	//inherited from CActive
sl@0
    86
	void DoCancel();
sl@0
    87
    void RunL();
sl@0
    88
sl@0
    89
sl@0
    90
private:
sl@0
    91
sl@0
    92
	//C++ constructor
sl@0
    93
   CDrm(TInt aPriority);
sl@0
    94
   // 2nd phase construction.
sl@0
    95
   void ConstructL (void);
sl@0
    96
sl@0
    97
   // Session to server   
sl@0
    98
   RDrmSession*	         iSess;
sl@0
    99
   //Current state
sl@0
   100
   TInt		         iState;
sl@0
   101
sl@0
   102
	enum TState  //events
sl@0
   103
		{
sl@0
   104
		EStatePlay = 0,
sl@0
   105
		EStateStop,
sl@0
   106
		EStateSetVolume,
sl@0
   107
		EStateSetRepeats,
sl@0
   108
		EStateSetVolumeRamp,
sl@0
   109
		EStateDuration,
sl@0
   110
		EStateMaxVolume,
sl@0
   111
		EStateOpenFile,
sl@0
   112
		EStateOpenDes,
sl@0
   113
		EStateOpenUrl,
sl@0
   114
		EStatePause,
sl@0
   115
		EStateClose,
sl@0
   116
		EStateGetPosition,
sl@0
   117
		EStateSetPosition,
sl@0
   118
		EStateSetPriority,
sl@0
   119
		EStateGetVolume,
sl@0
   120
		EStateGetNumberOfMetaDataEntries,
sl@0
   121
		EStateGetMetaDataEntry,
sl@0
   122
		EStateSetPlayWindow,
sl@0
   123
		EStateClearPlayWindow,
sl@0
   124
		EStateSetBalance,
sl@0
   125
		EStateGetBalance,
sl@0
   126
		EStateRegisterForAudioLoadingNotification,
sl@0
   127
		EStateGetAudioLoadingProgress,
sl@0
   128
		EStateControllerImplementationInformation,
sl@0
   129
		EStateCustomCommandSync,
sl@0
   130
		EStateCustomCommandSync2,
sl@0
   131
		EStateCustomCommandAsync,
sl@0
   132
		EStateCustomCommandAsync2,
sl@0
   133
		EStateGetBitRate
sl@0
   134
		};
sl@0
   135
sl@0
   136
};
sl@0
   137
sl@0
   138
sl@0
   139
sl@0
   140
sl@0
   141
#endif