1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/mm/mmlibs/mmfw/tsrc/mmfunittest/ctlfrm/mp3/MmfMP3NullCodec/mmfmp3Codec.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,118 @@
1.4 +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// This is a test codec which takes MP3 data & gives it back to the datapath
1.18 +// pretending it has converted it to PCM16 data thus producing lots of noise
1.19 +//
1.20 +//
1.21 +
1.22 +#include <e32std.h>
1.23 +
1.24 +#include <mmf/plugin/mmfcodecimplementationuids.hrh>
1.25 +#include <ecom/implementationproxy.h>
1.26 +
1.27 +#include "MP3Uids.hrh"
1.28 +
1.29 +#include "mmfmp3Codec.h"
1.30 +
1.31 +//*******************************************************************
1.32 +//* MP3 Codec to 16 bit PCM Class:
1.33 +//*******************************************************************
1.34 +
1.35 +// __________________________________________________________________________
1.36 +// Implementation
1.37 +
1.38 +CMMFCodec* CMMFMP3To16PcmCodec::NewL(TAny* aInitParams)
1.39 + {
1.40 + CMMFMP3To16PcmCodec* self=new(ELeave) CMMFMP3To16PcmCodec();
1.41 + CleanupStack::PushL(self);
1.42 + self->ConstructL(aInitParams);
1.43 + CleanupStack::Pop(self);
1.44 + return STATIC_CAST( CMMFCodec*, self );
1.45 + }
1.46 +
1.47 +CMMFMP3To16PcmCodec::~CMMFMP3To16PcmCodec()
1.48 + {
1.49 + }
1.50 +
1.51 +CMMFMP3To16PcmCodec::CMMFMP3To16PcmCodec()
1.52 + {
1.53 +
1.54 + }
1.55 +
1.56 +void CMMFMP3To16PcmCodec::ConstructL(TAny* /*aInitParams*/)
1.57 + {
1.58 +
1.59 + }
1.60 +
1.61 +void CMMFMP3To16PcmCodec::ResetL()
1.62 + {
1.63 + }
1.64 +
1.65 +
1.66 +TCodecProcessResult CMMFMP3To16PcmCodec::ProcessL(const CMMFBuffer& aSrc, CMMFBuffer& aDst)
1.67 + {
1.68 +
1.69 + TCodecProcessResult result;
1.70 + result.iStatus = TCodecProcessResult::EProcessIncomplete; // dest full
1.71 + result.iSrcBytesProcessed = 0;
1.72 + result.iDstBytesAdded = 0;
1.73 +
1.74 + // convert from generic CMMFBuffer to CMMFDataBuffer
1.75 + const CMMFDataBuffer* src = STATIC_CAST(const CMMFDataBuffer*, &aSrc);
1.76 + CMMFDataBuffer* dst = STATIC_CAST(CMMFDataBuffer*, &aDst);
1.77 +
1.78 + TUint srcLen = src->Data().Length() - src->Position();
1.79 + TUint dstMaxLen = dst->Data().MaxLength() - dst->Position();
1.80 + TUint dstLen = dstMaxLen;
1.81 +
1.82 + dst->Data().SetLength(0);
1.83 +
1.84 + if (srcLen == 0)
1.85 + {
1.86 + result.iStatus = TCodecProcessResult::EDstNotFilled; // get some more source data
1.87 + }
1.88 + else
1.89 + {
1.90 + TPtrC8 srcPtrC(src->Data().Ptr(), dstLen);
1.91 +
1.92 + dst->Data() = srcPtrC;
1.93 +
1.94 + result.iSrcBytesProcessed = srcLen;
1.95 + result.iDstBytesAdded = dst->Data().Length();
1.96 + result.iStatus = TCodecProcessResult::EProcessIncomplete; // dest full
1.97 + }
1.98 +
1.99 + return result;
1.100 + }
1.101 +
1.102 +
1.103 +// __________________________________________________________________________
1.104 +// Exported proxy for instantiation method resolution
1.105 +// Define the interface UIDs
1.106 +
1.107 +
1.108 +const TImplementationProxy ImplementationTable[] =
1.109 + {
1.110 + IMPLEMENTATION_PROXY_ENTRY(KUidMP3ImplementationCodec, CMMFMP3To16PcmCodec::NewL)
1.111 + };
1.112 +
1.113 +
1.114 +
1.115 +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
1.116 + {
1.117 + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
1.118 +
1.119 + return ImplementationTable;
1.120 + }
1.121 +