mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/awbaudioplaycontroller/Src/AWBAudioPlayControllerSwDecoder.cpp
changeset 0 71ca22bcf22a
equal deleted inserted replaced
-1:000000000000 0:71ca22bcf22a
       
     1 /*
       
     2 * Copyright (c) 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:  The functions in this module implements the common behavior
       
    15 *                for the audio output base class. Audio output provides the
       
    16 *                interface between the controller and the sound device.
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 // INCLUDE FILES
       
    22 #include "AWBAudioPlayControllerDecoder.h"
       
    23 #include <mmfcodec.h>
       
    24 #include "DebugMacros.h"
       
    25 
       
    26 // ============================ MEMBER FUNCTIONS ===============================
       
    27 
       
    28 // -----------------------------------------------------------------------------
       
    29 // C++ default constructor can NOT contain any code, that
       
    30 // might leave.
       
    31 // -----------------------------------------------------------------------------
       
    32 //
       
    33 CAWBAudioPlayControllerDecoder::CAWBAudioPlayControllerDecoder()
       
    34     :   CAdvancedAudioDecoder(CActive::EPriorityStandard)
       
    35     {
       
    36     DP0(_L("CAWBAudioPlayControllerDecoder::CAWBAudioPlayControllerDecoder()"));
       
    37     }
       
    38 
       
    39 // -----------------------------------------------------------------------------
       
    40 // CAWBAudioPlayControllerDecoder::ConstructL
       
    41 // Symbian 2nd phase constructor can leave.
       
    42 // -----------------------------------------------------------------------------
       
    43 //
       
    44 void CAWBAudioPlayControllerDecoder::ConstructL()
       
    45     {
       
    46     DP0(_L("CAWBAudioPlayControllerDecoder::ConstructL()"));
       
    47 	iSoftCodec = CMMFCodec::NewL(TFourCC(' ','A','W','B'), TFourCC(' ','P','1','6'));
       
    48 
       
    49     iFrameTable = CFrameTable::NewL();
       
    50     
       
    51     InitCodecConfigs();
       
    52 
       
    53     CActiveScheduler::Add(this);
       
    54     }
       
    55 
       
    56 // -----------------------------------------------------------------------------
       
    57 // C++ default constructor can NOT contain any code, that
       
    58 // might leave.
       
    59 // -----------------------------------------------------------------------------
       
    60 //
       
    61 CAWBAudioPlayControllerDecoder* CAWBAudioPlayControllerDecoder::NewL()
       
    62     {
       
    63     DP0(_L("CAWBAudioPlayControllerDecoder::NewL()"));
       
    64     CAWBAudioPlayControllerDecoder* self = new(ELeave) CAWBAudioPlayControllerDecoder();
       
    65     CleanupStack::PushL(self);
       
    66     self->ConstructL();
       
    67     CleanupStack::Pop(self);
       
    68     return self;
       
    69     }
       
    70 
       
    71 // Destructor
       
    72 CAWBAudioPlayControllerDecoder::~CAWBAudioPlayControllerDecoder()
       
    73 	{
       
    74     DP0(_L("CAWBAudioPlayControllerDecoder::~CAWBAudioPlayControllerDecoder()"));
       
    75 	delete iSoftCodec;
       
    76     delete iFrameTable;	
       
    77 	}
       
    78 
       
    79 
       
    80 void CAWBAudioPlayControllerDecoder::InitCodecConfigs()
       
    81 	{
       
    82 	iRenderEnableConfig.Reset();
       
    83 	iRenderEnableConfig.Append(0); // [0]
       
    84 	iRenderEnableConfig.Append(0); // [1] 
       
    85 	iRenderEnableConfig.Append(0); // [2] table pointer
       
    86 	iRenderEnableConfig.Append(1); // [3] render enable
       
    87 	iRenderEnableConfig.Append(0); // [4]
       
    88 	iRenderEnableConfig.Append(0); // [5]
       
    89 
       
    90 	iRenderDisableConfig.Reset();
       
    91 	iRenderDisableConfig.Append(0); // [0]
       
    92 	iRenderDisableConfig.Append(0); // [1] 	
       
    93 	iRenderDisableConfig.Append(0); // [2] 
       
    94 	iRenderDisableConfig.Append(2); // [3] render disable
       
    95 	iRenderDisableConfig.Append(0); // [4]
       
    96 	iRenderDisableConfig.Append(0); // [5]
       
    97 	
       
    98 	iMarkPlayEndConfig.Reset();
       
    99 	iMarkPlayEndConfig.Append(0); // [0]
       
   100 	iMarkPlayEndConfig.Append(0); // [1]
       
   101 	iMarkPlayEndConfig.Append(0); // [2]
       
   102 	iMarkPlayEndConfig.Append(0); // [3]
       
   103 	iMarkPlayEndConfig.Append(1); // [4] mark play end
       
   104 	iMarkPlayEndConfig.Append(0); // [5] 
       
   105 	
       
   106 	iUnMarkPlayEndConfig.Reset();
       
   107 	iUnMarkPlayEndConfig.Append(0); // [0]	
       
   108 	iUnMarkPlayEndConfig.Append(0); // [1]
       
   109 	iUnMarkPlayEndConfig.Append(0); // [2]
       
   110 	iUnMarkPlayEndConfig.Append(0); // [3]
       
   111 	iUnMarkPlayEndConfig.Append(2); // [4] unmark play end
       
   112 	iUnMarkPlayEndConfig.Append(0); // [5] 
       
   113 	
       
   114 	iEnableConfig.Reset();
       
   115 	iEnableConfig.Append(0); // [0]	
       
   116 	iEnableConfig.Append(0); // [1]
       
   117 	iEnableConfig.Append(0); // [2]
       
   118 	iEnableConfig.Append(0); // [3]
       
   119 	iEnableConfig.Append(0); // [4]
       
   120 	iEnableConfig.Append(1); // [5] enable
       
   121 	
       
   122 	iDisableConfig.Reset();
       
   123 	iDisableConfig.Append(0); // [0]	
       
   124 	iDisableConfig.Append(0); // [1]
       
   125 	iDisableConfig.Append(0); // [2]
       
   126 	iDisableConfig.Append(0); // [3]
       
   127 	iDisableConfig.Append(0); // [4]
       
   128 	iDisableConfig.Append(2); // [5] disable
       
   129 	
       
   130 	RenderEnable();
       
   131 	UnMarkPlayEnd();
       
   132 	Enable();
       
   133 	}
       
   134 
       
   135 // -----------------------------------------------------------------------------
       
   136 // CAMRAudioPlayControllerDecoder::CodecConfig
       
   137 // Sets configuration data and configures the codec.
       
   138 // -----------------------------------------------------------------------------
       
   139 //
       
   140 TInt CAWBAudioPlayControllerDecoder::CodecConfig(RArray<TInt>& aCodecConfigData)
       
   141 	{
       
   142 	TInt stat;
       
   143    	aCodecConfigData[2] = reinterpret_cast<TInt>(iFrameTable);
       
   144 	TRAP(stat, iSoftCodec->ConfigureL(KUidConfig, reinterpret_cast<TDesC8&>(aCodecConfigData)));
       
   145 	return stat;
       
   146 	}
       
   147 
       
   148 
       
   149 // -----------------------------------------------------------------------------
       
   150 // CAWBAudioPlayControllerDecoder::IsHwAccelerated
       
   151 // Always return true since soft codec is used.
       
   152 // -----------------------------------------------------------------------------
       
   153 //
       
   154 TBool CAWBAudioPlayControllerDecoder::IsHwAccelerated()
       
   155 	{
       
   156 	return CAdvancedAudioDecoder::IsHwAccelerated();
       
   157 	}
       
   158 
       
   159 void CAWBAudioPlayControllerDecoder::ResetL()
       
   160 	{
       
   161 	CAdvancedAudioDecoder::ResetL();
       
   162 	}
       
   163 
       
   164 TCodecProcessResult CAWBAudioPlayControllerDecoder::ProcessL(CMMFBuffer& aSrc, CMMFBuffer& aDst)
       
   165 	{
       
   166 	return CAdvancedAudioDecoder::ProcessL(aSrc, aDst);
       
   167 	}
       
   168 
       
   169 TInt CAWBAudioPlayControllerDecoder::CodecCmd(TCodecCmd aCmd)
       
   170 	{
       
   171 	return CAdvancedAudioDecoder::CodecCmd(aCmd);
       
   172 	}
       
   173 
       
   174 // -----------------------------------------------------------------------------
       
   175 // CAWBAudioPlayControllerDecoder::SeekSync
       
   176 // Implemented for hw codec
       
   177 // -----------------------------------------------------------------------------
       
   178 TInt CAWBAudioPlayControllerDecoder::SeekSync(TUint8* /*aBuf*/, TInt /*aBufLen*/)
       
   179     {
       
   180     return KErrNotSupported;
       
   181     }
       
   182 
       
   183 // -----------------------------------------------------------------------------
       
   184 // CAWBAudioPlayControllerDecoder::FrameLength
       
   185 // Implemented for hw codec
       
   186 // -----------------------------------------------------------------------------
       
   187 TInt CAWBAudioPlayControllerDecoder::FrameLength(const TUint8* /*aBuf*/, TInt /*aBufLen*/, TInt& /*aFrameLength*/)
       
   188 	{
       
   189     return KErrNotSupported;
       
   190 	}
       
   191 
       
   192 // End of file