1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/mm/mmhais/a3facl/src/buffersink/logicalbuffersink.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,175 @@
1.4 +// Copyright (c) 2006-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 +//
1.18 +
1.19 +
1.20 +
1.21 +#include "logicalbuffersink.h"
1.22 +#include <a3f/audioprocessingunittypeuids.h>
1.23 +#include <ecom/implementationproxy.h> // For making it ECom plugin
1.24 +
1.25 +// Exported proxy for instantiation method resolution
1.26 +// Define the interface UIDs
1.27 +const TImplementationProxy ImplementationTable[] =
1.28 + {
1.29 + IMPLEMENTATION_PROXY_ENTRY(KMmfBufferSinkUid, CLogicalBufferSink::NewL)
1.30 + };
1.31 +
1.32 +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
1.33 + {
1.34 + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
1.35 + return ImplementationTable;
1.36 + }
1.37 +// ---------------------------------------------------------------------------
1.38 +// Constructor
1.39 +// ---------------------------------------------------------------------------
1.40 +//
1.41 +CLogicalBufferSink::CLogicalBufferSink(TAny* aParam) : CAudioProcessingUnit(aParam)
1.42 + {
1.43 + TRACE_CREATE();
1.44 + DP_CONTEXT(CLogicalBufferSink::CLogicalBufferSink *CD1*, CtxDevSound, DPLOCAL);
1.45 + DP_IN();
1.46 + DP_OUT();
1.47 + }
1.48 +
1.49 +// ---------------------------------------------------------------------------
1.50 +// Factory method
1.51 +// ---------------------------------------------------------------------------
1.52 +//
1.53 +CLogicalBufferSink* CLogicalBufferSink::NewL(TAny* aParameters)
1.54 + {
1.55 + DP_STATIC_CONTEXT(CLogicalBufferSink::NewL *CD0*, CtxDevSound, DPLOCAL);
1.56 + DP_IN();
1.57 + CLogicalBufferSink* self = new(ELeave)CLogicalBufferSink(aParameters);
1.58 + CleanupStack::PushL(self);
1.59 + self->ConstructL();
1.60 + CleanupStack::Pop(self);
1.61 + DP0_RET(self, "0x%x");
1.62 + }
1.63 +
1.64 +// ---------------------------------------------------------------------------
1.65 +// Second phase constructor
1.66 +// ---------------------------------------------------------------------------
1.67 +//
1.68 +void CLogicalBufferSink::ConstructL()
1.69 + {
1.70 + DP_CONTEXT(CLogicalBufferSink::ConstructL *CD1*, CtxDevSound, DPLOCAL);
1.71 + DP_IN();
1.72 + DP_OUT();
1.73 + }
1.74 +
1.75 +// ---------------------------------------------------------------------------
1.76 +// Destructor
1.77 +// ---------------------------------------------------------------------------
1.78 +//
1.79 +CLogicalBufferSink::~CLogicalBufferSink()
1.80 + {
1.81 + DP_CONTEXT(CLogicalBufferSink::~CLogicalBufferSink *CD1*, CtxDevSound, DPLOCAL);
1.82 + DP_IN();
1.83 + DP_OUT();
1.84 + }
1.85 +
1.86 +// from class MMMFBufferSink
1.87 +// ---------------------------------------------------------------------------
1.88 +// CLogicalBufferSink::SetDataConsumer
1.89 +// ---------------------------------------------------------------------------
1.90 +//
1.91 +TInt CLogicalBufferSink::SetDataConsumer(MMMFAudioDataConsumer& aConsumer)
1.92 + {
1.93 + DP_CONTEXT(CLogicalBufferSink::SetDataConsumer *CD1*, CtxDevSound, DPLOCAL);
1.94 + DP_IN();
1.95 + iConsumer = &aConsumer;
1.96 + DP0_RET(KErrNone,"%d");
1.97 + }
1.98 +
1.99 +// ---------------------------------------------------------------------------
1.100 +// CLogicalBufferSink::BufferEmptied
1.101 +// ---------------------------------------------------------------------------
1.102 +//
1.103 +TInt CLogicalBufferSink::BufferEmptied(CMMFBuffer* aBuffer)
1.104 + {
1.105 + DP_CONTEXT(CLogicalBufferSink::BufferEmptied *CD1*, CtxDevSound, DPLOCAL);
1.106 + DP_IN();
1.107 + TInt err = KErrNone;
1.108 + err = iAdaptationBufferSink->BufferEmptied(aBuffer);
1.109 + DP0_RET(err,"%d");
1.110 + }
1.111 +
1.112 +// ---------------------------------------------------------------------------
1.113 +// CLogicalBufferSink::BuffersDiscarded
1.114 +// ---------------------------------------------------------------------------
1.115 +//
1.116 +TInt CLogicalBufferSink::BuffersDiscarded()
1.117 + {
1.118 + DP_CONTEXT(CLogicalBufferSink::BuffersDiscarded *CD1*, CtxDevSound, DPLOCAL);
1.119 + DP_IN();
1.120 + TInt err = KErrNone;
1.121 + err = iAdaptationBufferSink->BuffersDiscarded();
1.122 + DP0_RET(err,"%d");
1.123 + }
1.124 +
1.125 +// From CAudioProcessingUnit
1.126 +// ---------------------------------------------------------------------------
1.127 +// CLogicalBufferSink::IsTypeOf
1.128 +// ---------------------------------------------------------------------------
1.129 +//
1.130 +TBool CLogicalBufferSink::IsTypeOf(TUid aTypeId) const
1.131 + {
1.132 + DP_CONTEXT(CLogicalBufferSink::IsTypeOf *CD1*, CtxDevSound, DPLOCAL);
1.133 + DP_IN();
1.134 + TBool result = EFalse;
1.135 + if (iType == aTypeId)
1.136 + {
1.137 + result = ETrue;
1.138 + }
1.139 + DP0_RET(result, "%d");
1.140 + }
1.141 +
1.142 +// ---------------------------------------------------------------------------
1.143 +// CLogicalBufferSink::Interface
1.144 +// ---------------------------------------------------------------------------
1.145 +//
1.146 +TAny* CLogicalBufferSink::Interface(TUid aType)
1.147 + {
1.148 + DP_CONTEXT(CLogicalBufferSink::Interface *CD1*, CtxDevSound, DPLOCAL);
1.149 + DP_IN();
1.150 + MMMFBufferSink* ptr = NULL;
1.151 + if(aType==KUidMmfBufferSink)
1.152 + {
1.153 + ptr = static_cast<MMMFBufferSink*>(this);
1.154 + }
1.155 + DP_OUT();
1.156 + return ptr;
1.157 + }
1.158 +
1.159 +// From MMMFAudioDataConsumer
1.160 +// ---------------------------------------------------------------------------
1.161 +// CLogicalBufferSink::BufferToBeFilled
1.162 +// ---------------------------------------------------------------------------
1.163 +//
1.164 +void CLogicalBufferSink::BufferToBeEmptied(MMMFBufferSink* /*aSink*/, CMMFBuffer* aBuffer)
1.165 + {
1.166 + iConsumer->BufferToBeEmptied(this, aBuffer);
1.167 + }
1.168 +
1.169 +// ---------------------------------------------------------------------------
1.170 +// CLogicalBufferSource::DiscardBuffers
1.171 +// ---------------------------------------------------------------------------
1.172 +//
1.173 +void CLogicalBufferSink::DiscardBuffers(MMMFBufferSink* /*aSink*/)
1.174 + {
1.175 + iConsumer->DiscardBuffers(this);
1.176 + }
1.177 +
1.178 +// end of file