Update contrib.
1 // Copyright (c) 2006-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.
18 #include "logicalbuffersink.h"
19 #include <a3f/audioprocessingunittypeuids.h>
20 #include <ecom/implementationproxy.h> // For making it ECom plugin
22 // Exported proxy for instantiation method resolution
23 // Define the interface UIDs
24 const TImplementationProxy ImplementationTable[] =
26 IMPLEMENTATION_PROXY_ENTRY(KMmfBufferSinkUid, CLogicalBufferSink::NewL)
29 EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
31 aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
32 return ImplementationTable;
34 // ---------------------------------------------------------------------------
36 // ---------------------------------------------------------------------------
38 CLogicalBufferSink::CLogicalBufferSink(TAny* aParam) : CAudioProcessingUnit(aParam)
41 DP_CONTEXT(CLogicalBufferSink::CLogicalBufferSink *CD1*, CtxDevSound, DPLOCAL);
46 // ---------------------------------------------------------------------------
48 // ---------------------------------------------------------------------------
50 CLogicalBufferSink* CLogicalBufferSink::NewL(TAny* aParameters)
52 DP_STATIC_CONTEXT(CLogicalBufferSink::NewL *CD0*, CtxDevSound, DPLOCAL);
54 CLogicalBufferSink* self = new(ELeave)CLogicalBufferSink(aParameters);
55 CleanupStack::PushL(self);
57 CleanupStack::Pop(self);
58 DP0_RET(self, "0x%x");
61 // ---------------------------------------------------------------------------
62 // Second phase constructor
63 // ---------------------------------------------------------------------------
65 void CLogicalBufferSink::ConstructL()
67 DP_CONTEXT(CLogicalBufferSink::ConstructL *CD1*, CtxDevSound, DPLOCAL);
72 // ---------------------------------------------------------------------------
74 // ---------------------------------------------------------------------------
76 CLogicalBufferSink::~CLogicalBufferSink()
78 DP_CONTEXT(CLogicalBufferSink::~CLogicalBufferSink *CD1*, CtxDevSound, DPLOCAL);
83 // from class MMMFBufferSink
84 // ---------------------------------------------------------------------------
85 // CLogicalBufferSink::SetDataConsumer
86 // ---------------------------------------------------------------------------
88 TInt CLogicalBufferSink::SetDataConsumer(MMMFAudioDataConsumer& aConsumer)
90 DP_CONTEXT(CLogicalBufferSink::SetDataConsumer *CD1*, CtxDevSound, DPLOCAL);
92 iConsumer = &aConsumer;
93 DP0_RET(KErrNone,"%d");
96 // ---------------------------------------------------------------------------
97 // CLogicalBufferSink::BufferEmptied
98 // ---------------------------------------------------------------------------
100 TInt CLogicalBufferSink::BufferEmptied(CMMFBuffer* aBuffer)
102 DP_CONTEXT(CLogicalBufferSink::BufferEmptied *CD1*, CtxDevSound, DPLOCAL);
105 err = iAdaptationBufferSink->BufferEmptied(aBuffer);
109 // ---------------------------------------------------------------------------
110 // CLogicalBufferSink::BuffersDiscarded
111 // ---------------------------------------------------------------------------
113 TInt CLogicalBufferSink::BuffersDiscarded()
115 DP_CONTEXT(CLogicalBufferSink::BuffersDiscarded *CD1*, CtxDevSound, DPLOCAL);
118 err = iAdaptationBufferSink->BuffersDiscarded();
122 // From CAudioProcessingUnit
123 // ---------------------------------------------------------------------------
124 // CLogicalBufferSink::IsTypeOf
125 // ---------------------------------------------------------------------------
127 TBool CLogicalBufferSink::IsTypeOf(TUid aTypeId) const
129 DP_CONTEXT(CLogicalBufferSink::IsTypeOf *CD1*, CtxDevSound, DPLOCAL);
131 TBool result = EFalse;
132 if (iType == aTypeId)
136 DP0_RET(result, "%d");
139 // ---------------------------------------------------------------------------
140 // CLogicalBufferSink::Interface
141 // ---------------------------------------------------------------------------
143 TAny* CLogicalBufferSink::Interface(TUid aType)
145 DP_CONTEXT(CLogicalBufferSink::Interface *CD1*, CtxDevSound, DPLOCAL);
147 MMMFBufferSink* ptr = NULL;
148 if(aType==KUidMmfBufferSink)
150 ptr = static_cast<MMMFBufferSink*>(this);
156 // From MMMFAudioDataConsumer
157 // ---------------------------------------------------------------------------
158 // CLogicalBufferSink::BufferToBeFilled
159 // ---------------------------------------------------------------------------
161 void CLogicalBufferSink::BufferToBeEmptied(MMMFBufferSink* /*aSink*/, CMMFBuffer* aBuffer)
163 iConsumer->BufferToBeEmptied(this, aBuffer);
166 // ---------------------------------------------------------------------------
167 // CLogicalBufferSource::DiscardBuffers
168 // ---------------------------------------------------------------------------
170 void CLogicalBufferSink::DiscardBuffers(MMMFBufferSink* /*aSink*/)
172 iConsumer->DiscardBuffers(this);