mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/aacaudioplaycontroller/Src/AACAudioPlayControllerSwDecoder.cpp
changeset 0 71ca22bcf22a
child 18 a36789189b53
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 "AACAudioPlayControllerDecoder.h"
       
    23 #include "DebugMacros.h"
       
    24 #include <mmfcodec.h>
       
    25 
       
    26 // CONSTANT
       
    27 
       
    28 // ============================ MEMBER FUNCTIONS ===============================
       
    29 
       
    30 // -----------------------------------------------------------------------------
       
    31 // C++ default constructor can NOT contain any code, that
       
    32 // might leave.
       
    33 // -----------------------------------------------------------------------------
       
    34 //
       
    35 CAACAudioPlayControllerDecoder::CAACAudioPlayControllerDecoder()
       
    36     :   CAdvancedAudioDecoder(CActive::EPriorityStandard)
       
    37     {
       
    38     DP0(_L("CAACAudioPlayControllerDecoder::CAACAudioPlayControllerDecoder()"));
       
    39     }
       
    40 
       
    41 // -----------------------------------------------------------------------------
       
    42 // CAACAudioPlayControllerDecoder::ConstructL
       
    43 // Symbian 2nd phase constructor can leave.
       
    44 // -----------------------------------------------------------------------------
       
    45 //
       
    46 void CAACAudioPlayControllerDecoder::ConstructL()
       
    47     {
       
    48 #ifdef __AAC_PLUS_DECODER_PLUGIN
       
    49     DP0(_L("CAACAudioPlayControllerDecoder::ConstructL() for eAAC+ Codec"));
       
    50 	iSoftCodec = CMMFCodec::NewL(TFourCC(' ','E','A','C'), TFourCC(' ','P','1','6'));
       
    51 #else
       
    52 	DP0(_L("CAACAudioPlayControllerDecoder::ConstructL() for AAC Codec"));
       
    53 	iSoftCodec = CMMFCodec::NewL(TFourCC(' ','A','A','C'), TFourCC(' ','P','1','6'));
       
    54 #endif
       
    55 
       
    56     iFrameTable = CFrameTable::NewL();
       
    57     
       
    58    	InitCodecConfigs();
       
    59 
       
    60    	CActiveScheduler::Add(this);
       
    61     }
       
    62 
       
    63 // -----------------------------------------------------------------------------
       
    64 // C++ default constructor can NOT contain any code, that
       
    65 // might leave.
       
    66 // -----------------------------------------------------------------------------
       
    67 //
       
    68 CAACAudioPlayControllerDecoder* CAACAudioPlayControllerDecoder::NewL()
       
    69     {
       
    70     DP0(_L("CAACAudioPlayControllerDecoder::NewL()"));
       
    71     CAACAudioPlayControllerDecoder* self = new(ELeave) CAACAudioPlayControllerDecoder();
       
    72     CleanupStack::PushL(self);
       
    73     self->ConstructL();
       
    74     CleanupStack::Pop(self);
       
    75     return self;
       
    76     }
       
    77 
       
    78 // Destructor
       
    79 CAACAudioPlayControllerDecoder::~CAACAudioPlayControllerDecoder()
       
    80 	{
       
    81     DP0(_L("CAACAudioPlayControllerDecoder::~CAACAudioPlayControllerDecoder()"));
       
    82     delete iSoftCodec;
       
    83     delete iFrameTable;
       
    84 	}
       
    85 
       
    86 void CAACAudioPlayControllerDecoder::InitCodecConfigs()
       
    87 	{
       
    88 	iRenderEnableConfig.Reset();
       
    89 	iRenderEnableConfig.Append(0); // [0]
       
    90 	iRenderEnableConfig.Append(0); // [1]
       
    91 	iRenderEnableConfig.Append(0); // [2]
       
    92 	iRenderEnableConfig.Append(0); // [3]
       
    93 	iRenderEnableConfig.Append(0); // [4]
       
    94 	iRenderEnableConfig.Append(0); // [5]
       
    95 	iRenderEnableConfig.Append(0); // [6]
       
    96 	iRenderEnableConfig.Append(0); // [7]
       
    97 	iRenderEnableConfig.Append(0); // [8]
       
    98 	iRenderEnableConfig.Append(0); // [9]
       
    99 	iRenderEnableConfig.Append(0); // [10]
       
   100 	iRenderEnableConfig.Append(0); // [11]
       
   101 	iRenderEnableConfig.Append(0); // [12]
       
   102 	iRenderEnableConfig.Append(1); // [13] render enabled
       
   103 	iRenderEnableConfig.Append(0); // [14] 
       
   104 	iRenderEnableConfig.Append(0); // [15] 
       
   105 	
       
   106 	iRenderDisableConfig.Reset();
       
   107 	iRenderDisableConfig.Append(0); // [0]
       
   108 	iRenderDisableConfig.Append(0); // [1]
       
   109 	iRenderDisableConfig.Append(0); // [2]
       
   110 	iRenderDisableConfig.Append(0); // [3]
       
   111 	iRenderDisableConfig.Append(0); // [4]
       
   112 	iRenderDisableConfig.Append(0); // [5]
       
   113 	iRenderDisableConfig.Append(0); // [6]
       
   114 	iRenderDisableConfig.Append(0); // [7]
       
   115 	iRenderDisableConfig.Append(0); // [8]
       
   116 	iRenderDisableConfig.Append(0); // [9]
       
   117 	iRenderDisableConfig.Append(0); // [10]
       
   118 	iRenderDisableConfig.Append(0); // [11]
       
   119 	iRenderDisableConfig.Append(0); // [12]
       
   120 	iRenderDisableConfig.Append(2); // [13] render disable
       
   121 	iRenderDisableConfig.Append(0); // [14]
       
   122 	iRenderDisableConfig.Append(0); // [15]
       
   123 
       
   124 	iMarkPlayEndConfig.Reset();
       
   125 	iMarkPlayEndConfig.Append(0); // [0]
       
   126 	iMarkPlayEndConfig.Append(0); // [1]
       
   127 	iMarkPlayEndConfig.Append(0); // [2]
       
   128 	iMarkPlayEndConfig.Append(0); // [3]
       
   129 	iMarkPlayEndConfig.Append(0); // [4]
       
   130 	iMarkPlayEndConfig.Append(0); // [5]
       
   131 	iMarkPlayEndConfig.Append(0); // [6]
       
   132 	iMarkPlayEndConfig.Append(0); // [7]
       
   133 	iMarkPlayEndConfig.Append(0); // [8]
       
   134 	iMarkPlayEndConfig.Append(0); // [9]
       
   135 	iMarkPlayEndConfig.Append(0); // [10]
       
   136 	iMarkPlayEndConfig.Append(0); // [11]
       
   137 	iMarkPlayEndConfig.Append(0); // [12]
       
   138 	iMarkPlayEndConfig.Append(0); // [13]
       
   139 	iMarkPlayEndConfig.Append(1); // [14] mark play end
       
   140 	iMarkPlayEndConfig.Append(0); // [15]
       
   141 	
       
   142 	iUnMarkPlayEndConfig.Reset();
       
   143 	iUnMarkPlayEndConfig.Append(0); // [0]
       
   144 	iUnMarkPlayEndConfig.Append(0); // [1]
       
   145 	iUnMarkPlayEndConfig.Append(0); // [2]
       
   146 	iUnMarkPlayEndConfig.Append(0); // [3]
       
   147 	iUnMarkPlayEndConfig.Append(0); // [4]
       
   148 	iUnMarkPlayEndConfig.Append(0); // [5]
       
   149 	iUnMarkPlayEndConfig.Append(0); // [6]
       
   150 	iUnMarkPlayEndConfig.Append(0); // [7]
       
   151 	iUnMarkPlayEndConfig.Append(0); // [8]
       
   152 	iUnMarkPlayEndConfig.Append(0); // [9]
       
   153 	iUnMarkPlayEndConfig.Append(0); // [10]
       
   154 	iUnMarkPlayEndConfig.Append(0); // [11]
       
   155 	iUnMarkPlayEndConfig.Append(0); // [12]
       
   156 	iUnMarkPlayEndConfig.Append(0); // [13]
       
   157 	iUnMarkPlayEndConfig.Append(2); // [14] unmark play end
       
   158 	iUnMarkPlayEndConfig.Append(0); // [15]
       
   159 	
       
   160 	iEnableConfig.Reset();
       
   161 	iEnableConfig.Append(0); // [0]
       
   162 	iEnableConfig.Append(0); // [1]
       
   163 	iEnableConfig.Append(0); // [2]
       
   164 	iEnableConfig.Append(0); // [3]
       
   165 	iEnableConfig.Append(0); // [4]
       
   166 	iEnableConfig.Append(0); // [5]
       
   167 	iEnableConfig.Append(0); // [6]
       
   168 	iEnableConfig.Append(0); // [7]
       
   169 	iEnableConfig.Append(0); // [8]
       
   170 	iEnableConfig.Append(0); // [9] 
       
   171 	iEnableConfig.Append(0); // [10]
       
   172 	iEnableConfig.Append(0); // [11]
       
   173 	iEnableConfig.Append(0); // [12]
       
   174 	iEnableConfig.Append(0); // [13]
       
   175 	iEnableConfig.Append(0); // [14]
       
   176 	iEnableConfig.Append(1); // [15] enable
       
   177 	
       
   178 	iDisableConfig.Reset();
       
   179 	iDisableConfig.Append(0); // [0]
       
   180 	iDisableConfig.Append(0); // [1]
       
   181 	iDisableConfig.Append(0); // [2]
       
   182 	iDisableConfig.Append(0); // [3]
       
   183 	iDisableConfig.Append(0); // [4]
       
   184 	iDisableConfig.Append(0); // [5]
       
   185 	iDisableConfig.Append(0); // [6]
       
   186 	iDisableConfig.Append(0); // [7]
       
   187 	iDisableConfig.Append(0); // [8]
       
   188 	iDisableConfig.Append(0); // [9] 
       
   189 	iDisableConfig.Append(0); // [10]
       
   190 	iDisableConfig.Append(0); // [11]
       
   191 	iDisableConfig.Append(0); // [12]
       
   192 	iDisableConfig.Append(0); // [13]
       
   193 	iDisableConfig.Append(0); // [14]
       
   194 	iDisableConfig.Append(2); // [15] disable
       
   195 
       
   196 	RenderEnable();
       
   197 	UnMarkPlayEnd();
       
   198 	Enable();
       
   199 	}
       
   200 
       
   201 // -----------------------------------------------------------------------------
       
   202 // CAACAudioPlayControllerDecoder::CodecConfig
       
   203 // Sets configuration data and configures the codec.
       
   204 // -----------------------------------------------------------------------------
       
   205 //
       
   206 TInt CAACAudioPlayControllerDecoder::CodecConfig(RArray<TInt>& aCodecConfigData)
       
   207 	{
       
   208 	TInt stat;
       
   209    	aCodecConfigData[11] = reinterpret_cast<TInt>(iFrameTable);
       
   210    	iFormatType = (CEAacPlusUtil::TEAacPlusFormatType)(aCodecConfigData[12]);
       
   211 	TRAP(stat, iSoftCodec->ConfigureL(KUidConfig, reinterpret_cast<TDesC8&> (aCodecConfigData)));
       
   212 	return stat;
       
   213 	}
       
   214 
       
   215 // -----------------------------------------------------------------------------
       
   216 // CAACAudioPlayControllerDecoder::IsHwAccelerated
       
   217 // Always return true since soft codec is used.
       
   218 // -----------------------------------------------------------------------------
       
   219 //
       
   220 TBool CAACAudioPlayControllerDecoder::IsHwAccelerated()
       
   221 	{
       
   222 	return CAdvancedAudioDecoder::IsHwAccelerated();
       
   223 	}
       
   224 
       
   225 // -----------------------------------------------------------------------------
       
   226 // CAACAudioPlayControllerDecoder::ResetL
       
   227 // Resets configuration data and configures the codec.
       
   228 // -----------------------------------------------------------------------------
       
   229 //
       
   230 void CAACAudioPlayControllerDecoder::ResetL()
       
   231 	{
       
   232 	CAdvancedAudioDecoder::ResetL();
       
   233 	}
       
   234 
       
   235 TCodecProcessResult CAACAudioPlayControllerDecoder::ProcessL(CMMFBuffer& aSrc, CMMFBuffer& aDst)
       
   236 	{
       
   237 	return CAdvancedAudioDecoder::ProcessL(aSrc, aDst);
       
   238 	}
       
   239 
       
   240 TInt CAACAudioPlayControllerDecoder::CodecCmd(TCodecCmd aCmd)
       
   241 	{
       
   242 	return CAdvancedAudioDecoder::CodecCmd(aCmd);
       
   243 	}
       
   244 
       
   245 TInt CAACAudioPlayControllerDecoder::FrameLength(const TUint8* /*aBuf*/, TInt /*aBufLen*/, TInt& /*aFrameLength*/)
       
   246 	{
       
   247 	return KErrNotSupported;
       
   248 	}
       
   249 
       
   250 TInt CAACAudioPlayControllerDecoder::SeekSync(TUint8* /*aBuf*/, TInt /*aBufLen*/)
       
   251 	{
       
   252 	return KErrNotSupported;
       
   253 	}
       
   254 
       
   255 // End of file