os/mm/devsoundextensions/drmaudioplayer/DRMPlayServer/inc/DRMPlaySession.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200 (2014-06-10)
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     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 #ifndef __CDRMPLAYSESSION_H
    20 #define __CDRMPLAYSESSION_H
    21 
    22 
    23 #include <e32base.h>
    24 #include <e32cons.h>
    25 #include <f32file.h>
    26 #include "DRMPlayServer.h"
    27 #include "DRMCustomCommandAsyncAO.h"
    28 #include <mdaaudiosampleplayer.h>
    29 #include <s32mem.h>
    30 #include <mmfcontrollerframeworkbase.h>
    31 
    32 
    33 class CDRMCustomCommandAsyncAO;
    34 class CDRMPlayServer;
    35 #ifdef RD_TSP_CLIENT_MAPPER
    36 class CTspClientMapper;
    37 #endif // #ifdef RD_TSP_CLIENT_MAPPER
    38 
    39 class CDRMPlayServerSession : public CSession2, 
    40                               public MMdaAudioPlayerCallback,
    41 							  public MAudioLoadingObserver
    42 	{
    43 	friend class CDRMPlayServer;
    44 public:
    45 	// construct/destruct
    46 	CDRMPlayServerSession(CDRMPlayServer* aServer);
    47     static CDRMPlayServerSession* NewL(CDRMPlayServer* aServer, const RMessage2& aMessage );
    48 	~CDRMPlayServerSession();
    49 	//service request
    50 	virtual void ServiceL(const RMessage2 &aMessage);
    51 	TInt DispatchMessageL(const RMessage2 &aMessage);
    52 
    53 	//services available 
    54 	void NewFilePlayerL(const RMessage2 aMessage);
    55 	void NewDesPlayerL(const RMessage2 aMessage);
    56 	void NewDesPlayerReadOnlyL(const RMessage2 aMessage);
    57 	void NewPlayerL(const RMessage2 aMessage);	
    58 	void OpenFileL(const RMessage2 &aMessage);
    59 	void OpenFileByHandleL(const RMessage2 &aMessage);
    60 	void OpenFileBySourceL(const RMessage2 &aMessage);
    61 	void OpenDesL(const RMessage2 &aMessage);
    62 	void OpenUrlL(const RMessage2 &aMessage);
    63 	void Play();
    64 	void Stop();
    65 	void SetVolume(const RMessage2 &aMessage);
    66 	void SetRepeats(const RMessage2 &aMessage);
    67 	void SetVolumeRamp(const RMessage2 &aMessage);
    68 	void Duration(const RMessage2&aMessage); 
    69 	TInt MaxVolume();
    70 
    71 	// API Additions since version 7.0	
    72 	TInt Pause();
    73 	void Close();
    74 	TInt GetPosition(const RMessage2 &aMessage);
    75 	void SetPosition(const RMessage2 &aMessage);
    76 
    77 	TInt SetPriority(const RMessage2 &aMessage);
    78 	TInt GetVolume(const RMessage2 &aMessage);
    79 	TInt GetNumberOfMetaDataEntries(const RMessage2 &aMessage);
    80 	void GetMetaDataEntryL(const RMessage2 &aMessage);
    81 	TInt SetPlayWindow(const RMessage2 &aMessage);
    82 	TInt ClearPlayWindow();
    83 	TInt SetBalance(const RMessage2 &aMessage);
    84 	TInt GetBalance(const RMessage2 &aMessage);
    85 	TInt GetBitRate(const RMessage2 &aMessage);
    86 	
    87 	void RegisterForAudioLoadingNotification(const RMessage2 &aMessage);
    88 	void GetAudioLoadingProgressL(const RMessage2 &aMessage);
    89 	void ControllerImplementationInformationL(const RMessage2 &aMessage);
    90 
    91 	void CustomCommandSyncL(const RMessage2 &aMessage);
    92     void CustomCommandAsyncStep1L(const RMessage2 &aMessage);
    93     void CustomCommandAsyncStep2L(const RMessage2 &aMessage);
    94     
    95     void SetPriorityPreference(const RMessage2 &aMessage);
    96     void AsyncCustomCommandCompleted( CDRMCustomCommandAsyncAO* aObject );
    97 
    98 
    99 
   100 protected:
   101 	// panic the client
   102 	void PanicClient(const RMessage2 &aMessage, TInt aPanic) const;
   103 
   104 private:
   105     void ConstructL( const RMessage2& aMessage );
   106 
   107 	//MMdaAudioPlayerCallback
   108     void MapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds& aDuration);
   109     void MapcPlayComplete(TInt aError);
   110 
   111     //MAudioLoadingObserver
   112 	void MaloLoadingStarted();
   113 	void MaloLoadingComplete();
   114 
   115     //Returns False if Destination CustomCommand needs to be blocked
   116 	TBool IsValidCustomCommandDestination(TUid aDestinationUid, TDesC8& aParam);
   117 	TBool CheckCustomInterfaceBuilderImplL(TDesC8& aParam);
   118 
   119 private:
   120 	enum{EIdle,EPlaying,EStopped};
   121 
   122 	CDRMPlayServer *iServer;
   123 	CMdaAudioPlayerUtility* iPlayUtil;
   124 	RMessage2 iMessage;
   125 	RMessage2* iMessage2;
   126 	CBufFlat* iMetaDataBuffer;
   127 	//CAsyncCallback* iAsyncCallback;
   128 	TErrorDurationStructPckgBuf iErrDurPckg;
   129 	TAsyncCallbackStatePckgBuf  iCallbackState;
   130     TInt iAsyncComplete;
   131 	TInt iCount;
   132 	TInt iState;
   133 	TInt iPriority;
   134 	TMdaPriorityPreference iPref;
   135 	TBool iFileHandleUsed;
   136 	RFile iFileHandle;
   137 #ifdef RD_TSP_CLIENT_MAPPER
   138     // Handle to TSP Client Mapper for Rem Con Framework
   139     CTspClientMapper*   iTSPClientMapper;
   140     // Process id of client to DRM Session
   141     TProcessId          iClientProcessId;
   142 #endif // RD_TSP_CLIENT_MAPPER
   143 	RPointerArray<CDRMCustomCommandAsyncAO> iActiveAsyncCustomCommands;
   144 	CDRMCustomCommandAsyncAO* iCDRMCustomCommandAsyncAO2Phase;
   145 	};
   146 
   147 #endif
   148 
   149 // End of file