os/mm/mmhais/a3facl/src/buffersource/logicalbuffersource.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
// Name        : logicalbuffersource.cpp
sl@0
    15
// Part of     : ACL Logical Layer
sl@0
    16
//
sl@0
    17
sl@0
    18
sl@0
    19
sl@0
    20
#include "logicalbuffersource.h"
sl@0
    21
#include <a3f/audioprocessingunittypeuids.h>
sl@0
    22
#include <ecom/implementationproxy.h> // For making it ECom plugin
sl@0
    23
sl@0
    24
// Map the interface implementation UIDs to implementation factory functions
sl@0
    25
const TImplementationProxy ImplementationTable[] =
sl@0
    26
	{
sl@0
    27
	IMPLEMENTATION_PROXY_ENTRY(KMmfBufferSourceUid,  CLogicalBufferSource::NewL),
sl@0
    28
	};
sl@0
    29
sl@0
    30
// Exported proxy for instantiation method resolution.
sl@0
    31
EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
sl@0
    32
	{
sl@0
    33
	aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
sl@0
    34
	return ImplementationTable;
sl@0
    35
	}
sl@0
    36
// ---------------------------------------------------------------------------
sl@0
    37
// Constructor
sl@0
    38
// ---------------------------------------------------------------------------
sl@0
    39
//
sl@0
    40
CLogicalBufferSource::CLogicalBufferSource(TAny* aParam) : CAudioProcessingUnit(aParam)
sl@0
    41
	{
sl@0
    42
	TRACE_CREATE();
sl@0
    43
	DP_CONTEXT(CLogicalBufferSource::CLogicalBufferSource *CD1*, CtxDevSound, DPLOCAL);
sl@0
    44
	DP_IN();
sl@0
    45
	DP_OUT();
sl@0
    46
	}
sl@0
    47
sl@0
    48
// ---------------------------------------------------------------------------
sl@0
    49
// Factory method
sl@0
    50
// ---------------------------------------------------------------------------
sl@0
    51
//
sl@0
    52
CLogicalBufferSource* CLogicalBufferSource::NewL(TAny* aParameters)
sl@0
    53
	{
sl@0
    54
	DP_STATIC_CONTEXT(CLogicalBufferSource::NewL *CD0*, CtxDevSound, DPLOCAL);
sl@0
    55
	DP_IN();
sl@0
    56
	CLogicalBufferSource* self = new(ELeave)CLogicalBufferSource(aParameters);
sl@0
    57
	CleanupStack::PushL(self);
sl@0
    58
	self->ConstructL();
sl@0
    59
	CleanupStack::Pop(self);
sl@0
    60
	DP0_RET(self, "0x%x");
sl@0
    61
	}
sl@0
    62
sl@0
    63
// ---------------------------------------------------------------------------
sl@0
    64
// Second phase constructor
sl@0
    65
// ---------------------------------------------------------------------------
sl@0
    66
//
sl@0
    67
void CLogicalBufferSource::ConstructL()
sl@0
    68
	{
sl@0
    69
	DP_CONTEXT(CLogicalBufferSource::ConstructL *CD1*, CtxDevSound, DPLOCAL);
sl@0
    70
	DP_IN();
sl@0
    71
	DP_OUT();
sl@0
    72
	}
sl@0
    73
sl@0
    74
// ---------------------------------------------------------------------------
sl@0
    75
// Destructor
sl@0
    76
// ---------------------------------------------------------------------------
sl@0
    77
//
sl@0
    78
CLogicalBufferSource::~CLogicalBufferSource()
sl@0
    79
	{
sl@0
    80
	DP_CONTEXT(CLogicalBufferSource::~CLogicalBufferSource *CD1*, CtxDevSound, DPLOCAL);
sl@0
    81
	DP_IN();
sl@0
    82
	DP_OUT();
sl@0
    83
	}
sl@0
    84
sl@0
    85
// from MMMFBufferSource
sl@0
    86
// ---------------------------------------------------------------------------
sl@0
    87
// CLogicalBufferSource::SetDataSupplier
sl@0
    88
// ---------------------------------------------------------------------------
sl@0
    89
//  
sl@0
    90
TInt CLogicalBufferSource::SetDataSupplier(MMMFAudioDataSupplier& aSupplier)
sl@0
    91
	{
sl@0
    92
	DP_CONTEXT(CLogicalBufferSource::SetDataSupplier *CD1*, CtxDevSound, DPLOCAL);
sl@0
    93
	DP_IN();
sl@0
    94
	TInt err = KErrNone;
sl@0
    95
	iSupplier = &aSupplier;
sl@0
    96
	DP0_RET(err, "%d");
sl@0
    97
	}
sl@0
    98
sl@0
    99
// ---------------------------------------------------------------------------
sl@0
   100
// CLogicalBufferSource::BufferFilled
sl@0
   101
// ---------------------------------------------------------------------------
sl@0
   102
//  
sl@0
   103
TInt CLogicalBufferSource::BufferFilled(CMMFBuffer* aBuffer)
sl@0
   104
	{
sl@0
   105
	DP_CONTEXT(CLogicalBufferSource::BufferFilled *CD1*, CtxDevSound, DPLOCAL);
sl@0
   106
	DP_IN();
sl@0
   107
	TInt err = KErrNone;
sl@0
   108
	err = iAdaptationBufferSource->BufferFilled(aBuffer);
sl@0
   109
	DP0_RET(err, "%d");
sl@0
   110
	}
sl@0
   111
sl@0
   112
// ---------------------------------------------------------------------------
sl@0
   113
// CLogicalBufferSource::BuffersDiscarded
sl@0
   114
// ---------------------------------------------------------------------------
sl@0
   115
//  
sl@0
   116
TInt CLogicalBufferSource::BuffersDiscarded()
sl@0
   117
	{
sl@0
   118
	DP_CONTEXT(CLogicalBufferSource::BuffersDiscarded *CD1*, CtxDevSound, DPLOCAL);
sl@0
   119
	DP_IN();
sl@0
   120
	TInt err = KErrNone;
sl@0
   121
	err = iAdaptationBufferSource->BuffersDiscarded();
sl@0
   122
	DP0_RET(err, "%d");
sl@0
   123
	}
sl@0
   124
sl@0
   125
// ---------------------------------------------------------------------------
sl@0
   126
// CLogicalBufferSource::IsTypeOf
sl@0
   127
// ---------------------------------------------------------------------------
sl@0
   128
//  
sl@0
   129
TBool CLogicalBufferSource::IsTypeOf(TUid aTypeId) const
sl@0
   130
	{
sl@0
   131
	DP_CONTEXT(CLogicalBufferSource::IsTypeOf *CD1*, CtxDevSound, DPLOCAL);
sl@0
   132
	DP_IN();
sl@0
   133
	TBool result = EFalse;
sl@0
   134
	if (iType == aTypeId)
sl@0
   135
		{
sl@0
   136
		result = ETrue;
sl@0
   137
		}
sl@0
   138
	DP0_RET(result, "%d");
sl@0
   139
	}
sl@0
   140
sl@0
   141
// ---------------------------------------------------------------------------
sl@0
   142
// CLogicalBufferSource::Interface
sl@0
   143
// ---------------------------------------------------------------------------
sl@0
   144
// 
sl@0
   145
TAny* CLogicalBufferSource::Interface(TUid aType)
sl@0
   146
	{
sl@0
   147
	DP_CONTEXT(CLogicalBufferSource::Interface *CD1*, CtxDevSound, DPLOCAL);
sl@0
   148
	DP_IN();
sl@0
   149
	TAny* interface = NULL;
sl@0
   150
	if(aType==KUidMmfBufferSource)
sl@0
   151
		{
sl@0
   152
		interface = static_cast<MMMFBufferSource*>(this);
sl@0
   153
		}
sl@0
   154
	DP0_RET(interface, "%d");
sl@0
   155
	}
sl@0
   156
sl@0
   157
// From MMMFAudioDataSupplier
sl@0
   158
// ---------------------------------------------------------------------------
sl@0
   159
// CLogicalBufferSource::BufferToBeFilled
sl@0
   160
// ---------------------------------------------------------------------------
sl@0
   161
// 
sl@0
   162
void CLogicalBufferSource::BufferToBeFilled(MMMFBufferSource* /*aSource*/, CMMFBuffer* aBuffer)
sl@0
   163
	{
sl@0
   164
	iSupplier->BufferToBeFilled(this, aBuffer);
sl@0
   165
	}
sl@0
   166
sl@0
   167
// ---------------------------------------------------------------------------
sl@0
   168
// CLogicalBufferSource::DiscardBuffers
sl@0
   169
// ---------------------------------------------------------------------------
sl@0
   170
// 
sl@0
   171
void CLogicalBufferSource::DiscardBuffers(MMMFBufferSource* /*aSource*/)
sl@0
   172
	{
sl@0
   173
	iSupplier->DiscardBuffers(this);
sl@0
   174
	}
sl@0
   175
sl@0
   176
// end of file