Update contrib.
1 // Copyright (c) 2003-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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // This is a test codec which takes MP3 data & gives it back to the datapath
15 // pretending it has converted it to PCM16 data thus producing lots of noise
21 #include <mmf/plugin/mmfcodecimplementationuids.hrh>
22 #include <ecom/implementationproxy.h>
24 #include "MP3Uids.hrh"
26 #include "mmfmp3Codec.h"
28 //*******************************************************************
29 //* MP3 Codec to 16 bit PCM Class:
30 //*******************************************************************
32 // __________________________________________________________________________
35 CMMFCodec* CMMFMP3To16PcmCodec::NewL(TAny* aInitParams)
37 CMMFMP3To16PcmCodec* self=new(ELeave) CMMFMP3To16PcmCodec();
38 CleanupStack::PushL(self);
39 self->ConstructL(aInitParams);
40 CleanupStack::Pop(self);
41 return STATIC_CAST( CMMFCodec*, self );
44 CMMFMP3To16PcmCodec::~CMMFMP3To16PcmCodec()
48 CMMFMP3To16PcmCodec::CMMFMP3To16PcmCodec()
53 void CMMFMP3To16PcmCodec::ConstructL(TAny* /*aInitParams*/)
58 void CMMFMP3To16PcmCodec::ResetL()
63 TCodecProcessResult CMMFMP3To16PcmCodec::ProcessL(const CMMFBuffer& aSrc, CMMFBuffer& aDst)
66 TCodecProcessResult result;
67 result.iStatus = TCodecProcessResult::EProcessIncomplete; // dest full
68 result.iSrcBytesProcessed = 0;
69 result.iDstBytesAdded = 0;
71 // convert from generic CMMFBuffer to CMMFDataBuffer
72 const CMMFDataBuffer* src = STATIC_CAST(const CMMFDataBuffer*, &aSrc);
73 CMMFDataBuffer* dst = STATIC_CAST(CMMFDataBuffer*, &aDst);
75 TUint srcLen = src->Data().Length() - src->Position();
76 TUint dstMaxLen = dst->Data().MaxLength() - dst->Position();
77 TUint dstLen = dstMaxLen;
79 dst->Data().SetLength(0);
83 result.iStatus = TCodecProcessResult::EDstNotFilled; // get some more source data
87 TPtrC8 srcPtrC(src->Data().Ptr(), dstLen);
89 dst->Data() = srcPtrC;
91 result.iSrcBytesProcessed = srcLen;
92 result.iDstBytesAdded = dst->Data().Length();
93 result.iStatus = TCodecProcessResult::EProcessIncomplete; // dest full
100 // __________________________________________________________________________
101 // Exported proxy for instantiation method resolution
102 // Define the interface UIDs
105 const TImplementationProxy ImplementationTable[] =
107 IMPLEMENTATION_PROXY_ENTRY(KUidMP3ImplementationCodec, CMMFMP3To16PcmCodec::NewL)
112 EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
114 aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
116 return ImplementationTable;