omxil/mmilapi/unittest/test_plugins/dummypcmrenderer/dummypcmrenderer.h
changeset 56 b6488ac24ddc
parent 47 481b3bce574a
child 57 1cbb0d5bf7f2
equal deleted inserted replaced
47:481b3bce574a 56:b6488ac24ddc
     1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 /**
       
    17  @file
       
    18  @internalComponent
       
    19 */
       
    20 
       
    21 #ifndef DUMMYPCMRENDERER_H
       
    22 #define DUMMYPCMRENDERER_H
       
    23 
       
    24 #include <e32msgqueue.h>
       
    25 #include <mmf/server/mmfhwdevicesetup.h>
       
    26 #include <mdf/mdfcommon.h>
       
    27 
       
    28 #include "milcomponentportif.h"
       
    29 #include "milifobserver.h"
       
    30 #include "ilcomponentif.h"
       
    31 
       
    32 #ifdef SYMBIAN_MDF_SHAREDCHUNK_SOUNDDRIVER
       
    33     #include "mdasoundadapter.h"
       
    34 #else
       
    35     #include <mdasound.h>
       
    36 #endif
       
    37 
       
    38 class CMMFBuffer;
       
    39 
       
    40 /* 
       
    41 PCM sink renderer component (this is just a simple non-omx component for testing)
       
    42 This component is used together with the omxilvorbdechwdevice and the OMXVorbisDecoder 
       
    43 for testing when requesting a HwDevice supporting VRB2 fourCC.
       
    44 */
       
    45 class CDummyPcmRenderer : public CILComponentIf
       
    46     {
       
    47 public:    
       
    48     /* 
       
    49     PCM sink input port
       
    50     */
       
    51     class CInputPort: public CActive, 
       
    52                       public MILComponentPortIf, 
       
    53                       public MPlayCustomInterface
       
    54         {
       
    55     friend class CDummyPcmRenderer;
       
    56 
       
    57     public:    
       
    58         static CInputPort* NewL(CDummyPcmRenderer& aParent);
       
    59         
       
    60         // MILComponentPortIf
       
    61         TInt FillThisBuffer(CMMFBuffer& aBuffer);
       
    62         TInt EmptyThisBuffer(const CMMFBuffer& aBuffer);
       
    63         TInt TunnelRequest(MILComponentPortIf* aPort);
       
    64         TInt DisconnectTunnel(MILComponentPortIf* aPort);
       
    65         TInt PortIndex() const;
       
    66         TPortDirection PortDirection() const;
       
    67         CMMFBuffer* CreateBufferL(TInt aBufferSize);
       
    68         TInt UseBuffer(CMMFBuffer& aBuffer);
       
    69         TInt FreeBuffer(CMMFBuffer* aBuffer);
       
    70         TInt FlushPort();
       
    71         TInt EnablePort();
       
    72         TInt DisablePort();
       
    73         MILComponentIf* PortComponent() const; 
       
    74     
       
    75         // from MPlayCustomInterface
       
    76         void SetVolume(TUint aVolume);
       
    77         TUint Volume();
       
    78         TUint BytesPlayed();
       
    79         void SetVolumeRamp(const TTimeIntervalMicroSeconds& aRampDuration);
       
    80         TTimeIntervalMicroSeconds& VolumeRamp();
       
    81         TInt SampleRate();
       
    82         TInt Channels();
       
    83                 
       
    84         // from CActive
       
    85         void RunL();
       
    86         void DoCancel();
       
    87         
       
    88         // Internal
       
    89         TUint32 BufferSize() const;
       
    90         void Execute();
       
    91         void Pause();
       
    92         void Stop();
       
    93         ~CInputPort();
       
    94         
       
    95     private:
       
    96         explicit CInputPort(CDummyPcmRenderer& aParent);
       
    97 
       
    98     private:
       
    99         CDummyPcmRenderer&        iParent;
       
   100         MILComponentPortIf*       iPortConnectedTo;
       
   101         CMMFBuffer*               iCurrentBuffer;
       
   102         RPointerArray<CMMFBuffer> iBuffers;
       
   103         TInt                      iSampleRate;
       
   104         TInt                      iChannels;
       
   105         TBool                     iInterleaved;    
       
   106         TUint                     iVolume;
       
   107         TTimeIntervalMicroSeconds iRampDuration;
       
   108         TUint                     iBytesPlayed;
       
   109         TBool                     iPaused;
       
   110         TBool                     iStopped;
       
   111         TUint                     iBufferSize;
       
   112         };
       
   113 public:
       
   114     static CDummyPcmRenderer* NewL();
       
   115 
       
   116     // from MILComponentIf
       
   117     void CreateComponentL(const TDesC8& aComponentName, MILIfObserver& aComponentIfObserver);
       
   118     void CreateComponentL(const TUid& aUid, MILIfObserver& aComponentIfObserver);
       
   119     void ReleaseComponent();
       
   120     TInt GetComponentInputPorts(RPointerArray<MILComponentPortIf>& aComponentPorts) const;
       
   121     TInt GetComponentOutputPorts(RPointerArray<MILComponentPortIf>& aComponentPorts) const;
       
   122     TInt SetConfig(const TILStruct& aConfig, const MILComponentPortIf* aComponentPort);
       
   123     TInt GetConfig(TILStruct& aConfig, const MILComponentPortIf* aComponentPort) const;    
       
   124     TInt Initialize();
       
   125     TInt Execute(); 
       
   126     TInt Pause();
       
   127     TInt Stop();
       
   128     TInt UnInitialize();
       
   129     TInt GetState(TILComponentState& aState) const;
       
   130     TInt SendCommand(const TILCommand& aCommand);
       
   131     TInt FlushAllPorts();
       
   132     TInt ComponentRoleEnum(TPtr8& aComponentRole, TUint32 aIndex) const;
       
   133     TInt GetComponentVersion(TILComponentVersion& aVersion) const;
       
   134     TInt SetComponentIfRole(const TUid& aFormat);
       
   135     TInt SetComponentIfRole(const TDesC8& aComponentRole);
       
   136     TInt GetComponentIfRole(TUid& aFormat) const;
       
   137     TInt GetComponentIfRole(TDes8& aComponentRole) const;
       
   138     TInt SetExtConfig(const TDesC8& aParameterName, const TILStruct& aConfig, const MILComponentPortIf* aComponentPort);
       
   139     TInt GetExtConfig(const TDesC8& aParameterName, TILStruct& aConfig, const MILComponentPortIf* aComponentPort) const;
       
   140     TAny* CustomInterface(TUid aUid);    
       
   141     
       
   142 
       
   143     ~CDummyPcmRenderer();
       
   144     
       
   145 private:
       
   146     CDummyPcmRenderer();    
       
   147  
       
   148     RMdaDevSound& SoundDevice();
       
   149     MILIfObserver* Observer() const;
       
   150     
       
   151 private:
       
   152     RMdaDevSound        iSoundDevice;
       
   153     TILComponentState   iState;
       
   154 
       
   155     CInputPort*         iInputPort;		
       
   156 	MILIfObserver*      iObserver;	// Not owned
       
   157     };
       
   158     
       
   159 #endif // DUMMYPCMRENDERER_H