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