diff -r 000000000000 -r 71ca22bcf22a mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/mp3audioplaycontroller/Src/MP3AudioPlayControllerSwDecoder.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/mp3audioplaycontroller/Src/MP3AudioPlayControllerSwDecoder.cpp Tue Feb 02 01:08:46 2010 +0200 @@ -0,0 +1,226 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: The functions in this module implements the common behavior +* for the audio output base class. Audio output provides the +* interface between the controller and the sound device. +* +*/ + + +// INCLUDE FILES +#include "MP3AudioPlayControllerDecoder.h" +#include "DebugMacros.h" + +#include + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CMP3AudioPlayControllerDecoder::CMP3AudioPlayControllerDecoder() + : CAdvancedAudioDecoder(CActive::EPriorityStandard) + { + DP0(_L("CMP3AudioPlayControllerDecoder::CMP3AudioPlayControllerDecoder()")); + } + +// ----------------------------------------------------------------------------- +// CMP3AudioPlayControllerDecoder::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CMP3AudioPlayControllerDecoder::ConstructL() + { + DP0(_L("CMP3AudioPlayControllerDecoder::ConstructL()")); + iSoftCodec = CMMFCodec::NewL(TFourCC(' ','M','P','3'), TFourCC(' ','P','1','6')); + + iFrameTable = CFrameTable::NewL(); + + InitCodecConfigs(); + + CActiveScheduler::Add(this); + } + +// ----------------------------------------------------------------------------- +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CMP3AudioPlayControllerDecoder* CMP3AudioPlayControllerDecoder::NewL() + { + DP0(_L("CMP3AudioPlayControllerDecoder::NewL()")); + CMP3AudioPlayControllerDecoder* self = new(ELeave) CMP3AudioPlayControllerDecoder(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// Destructor +CMP3AudioPlayControllerDecoder::~CMP3AudioPlayControllerDecoder() + { + DP0(_L("CMP3AudioPlayControllerDecoder::~CMP3AudioPlayControllerDecoder()")); + + delete iSoftCodec; + delete iFrameTable; + } + +void CMP3AudioPlayControllerDecoder::InitCodecConfigs() + { + iRenderEnableConfig.Reset(); + iRenderEnableConfig.Append(0); // [0] + iRenderEnableConfig.Append(0); // [1] + iRenderEnableConfig.Append(0); // [2] + iRenderEnableConfig.Append(0); // [3] + iRenderEnableConfig.Append(0); // [4] + iRenderEnableConfig.Append(0); // [5] + iRenderEnableConfig.Append(0); // [6] + iRenderEnableConfig.Append(1); // [7] render enabled + iRenderEnableConfig.Append(0); // [8] + iRenderEnableConfig.Append(0); // [9] + iRenderEnableConfig.Append(0); // [10] + + iRenderDisableConfig.Reset(); + iRenderDisableConfig.Append(0); // [0] + iRenderDisableConfig.Append(0); // [1] + iRenderDisableConfig.Append(0); // [2] + iRenderDisableConfig.Append(0); // [3] + iRenderDisableConfig.Append(0); // [4] + iRenderDisableConfig.Append(0); // [5] + iRenderDisableConfig.Append(0); // [6] + iRenderDisableConfig.Append(2); // [7] render disable + iRenderDisableConfig.Append(0); // [8] + iRenderDisableConfig.Append(0); // [9] + iRenderDisableConfig.Append(0); // [10] + + iMarkPlayEndConfig.Reset(); + iMarkPlayEndConfig.Append(0); // [0] + iMarkPlayEndConfig.Append(0); // [1] + iMarkPlayEndConfig.Append(0); // [2] + iMarkPlayEndConfig.Append(0); // [3] + iMarkPlayEndConfig.Append(0); // [4] + iMarkPlayEndConfig.Append(0); // [5] + iMarkPlayEndConfig.Append(0); // [6] + iMarkPlayEndConfig.Append(0); // [7] + iMarkPlayEndConfig.Append(0); // [8] + iMarkPlayEndConfig.Append(1); // [9] mark play end + iMarkPlayEndConfig.Append(0); // [10] + + iUnMarkPlayEndConfig.Reset(); + iUnMarkPlayEndConfig.Append(0); // [0] + iUnMarkPlayEndConfig.Append(0); // [1] + iUnMarkPlayEndConfig.Append(0); // [2] + iUnMarkPlayEndConfig.Append(0); // [3] + iUnMarkPlayEndConfig.Append(0); // [4] + iUnMarkPlayEndConfig.Append(0); // [5] + iUnMarkPlayEndConfig.Append(0); // [6] + iUnMarkPlayEndConfig.Append(0); // [7] + iUnMarkPlayEndConfig.Append(0); // [8] + iUnMarkPlayEndConfig.Append(2); // [9] unmark play end + iUnMarkPlayEndConfig.Append(0); // [10] + + iEnableConfig.Reset(); + iEnableConfig.Append(0); // [0] + iEnableConfig.Append(0); // [1] + iEnableConfig.Append(0); // [2] + iEnableConfig.Append(0); // [3] + iEnableConfig.Append(0); // [4] + iEnableConfig.Append(0); // [5] + iEnableConfig.Append(0); // [6] + iEnableConfig.Append(0); // [7] + iEnableConfig.Append(0); // [8] + iEnableConfig.Append(0); // [9] + iEnableConfig.Append(1); // [10] enable + + iDisableConfig.Reset(); + iDisableConfig.Append(0); // [0] + iDisableConfig.Append(0); // [1] + iDisableConfig.Append(0); // [2] + iDisableConfig.Append(0); // [3] + iDisableConfig.Append(0); // [4] + iDisableConfig.Append(0); // [5] + iDisableConfig.Append(0); // [6] + iDisableConfig.Append(0); // [7] + iDisableConfig.Append(0); // [8] + iDisableConfig.Append(0); // [9] + iDisableConfig.Append(2); // [10] disable + + RenderEnable(); + UnMarkPlayEnd(); + Enable(); + } + +// ----------------------------------------------------------------------------- +// CMP3AudioPlayControllerDecoder::CodecConfig +// Sets configuration data and configures the codec. +// ----------------------------------------------------------------------------- +// +TInt CMP3AudioPlayControllerDecoder::CodecConfig(RArray& aCodecConfigData) + { + TInt stat; +// RArray& codecArrayConfigData = reinterpret_cast&>(aCodecConfigData); +// codecArrayConfigData[6] = reinterpret_cast(iFrameTable); + aCodecConfigData[6] = reinterpret_cast(iFrameTable); + TRAP(stat, iSoftCodec->ConfigureL(KUidConfig, reinterpret_cast(aCodecConfigData))); + return stat; + } + +// ----------------------------------------------------------------------------- +// CMP3AudioPlayControllerDecoder::IsHwAccelerated +// Always return true since soft codec is used. +// ----------------------------------------------------------------------------- +// +TBool CMP3AudioPlayControllerDecoder::IsHwAccelerated() + { + return CAdvancedAudioDecoder::IsHwAccelerated(); + } + +void CMP3AudioPlayControllerDecoder::ResetL() + { + CAdvancedAudioDecoder::ResetL(); + } + +TCodecProcessResult CMP3AudioPlayControllerDecoder::ProcessL(CMMFBuffer& aSrc, CMMFBuffer& aDst) + { + return CAdvancedAudioDecoder::ProcessL(aSrc, aDst); + } + +TInt CMP3AudioPlayControllerDecoder::CodecCmd(TCodecCmd aCmd) + { + return CAdvancedAudioDecoder::CodecCmd(aCmd); + } + +// ----------------------------------------------------------------------------- +// CMP3AudioPlayControllerDecoder::SeekSync +// Implemented for hw codec +// ----------------------------------------------------------------------------- +TInt CMP3AudioPlayControllerDecoder::SeekSync(TUint8* /*aBuf*/, TInt /*aBufLen*/) + { + return KErrNotSupported; + } + +// ----------------------------------------------------------------------------- +// CMP3AudioPlayControllerDecoder::FrameLength +// Implemented for hw codec +// ----------------------------------------------------------------------------- +TInt CMP3AudioPlayControllerDecoder::FrameLength(const TUint8* /*aBuf*/, TInt /*aBufLen*/, TInt& /*aFrameLength*/) + { + return KErrNotSupported; + } + + + +// End of file