mmhais/refacladapt/src/audiosource/buffersource.h
author hgs
Fri, 08 Oct 2010 19:40:43 +0100
changeset 0 79dd3e2336a0
permissions -rw-r--r--
2010wk36_01
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
79dd3e2336a0 2010wk36_01
hgs
parents:
diff changeset
     1
/*
79dd3e2336a0 2010wk36_01
hgs
parents:
diff changeset
     2
* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
79dd3e2336a0 2010wk36_01
hgs
parents:
diff changeset
     3
* All rights reserved.
79dd3e2336a0 2010wk36_01
hgs
parents:
diff changeset
     4
* This component and the accompanying materials are made available
79dd3e2336a0 2010wk36_01
hgs
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
79dd3e2336a0 2010wk36_01
hgs
parents:
diff changeset
     6
* which accompanies this distribution, and is available
79dd3e2336a0 2010wk36_01
hgs
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
79dd3e2336a0 2010wk36_01
hgs
parents:
diff changeset
     8
*
79dd3e2336a0 2010wk36_01
hgs
parents:
diff changeset
     9
* Initial Contributors:
79dd3e2336a0 2010wk36_01
hgs
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
79dd3e2336a0 2010wk36_01
hgs
parents:
diff changeset
    11
*
79dd3e2336a0 2010wk36_01
hgs
parents:
diff changeset
    12
* Contributors:
79dd3e2336a0 2010wk36_01
hgs
parents:
diff changeset
    13
*
79dd3e2336a0 2010wk36_01
hgs
parents:
diff changeset
    14
* Description:
79dd3e2336a0 2010wk36_01
hgs
parents:
diff changeset
    15
*
79dd3e2336a0 2010wk36_01
hgs
parents:
diff changeset
    16
*/
79dd3e2336a0 2010wk36_01
hgs
parents:
diff changeset
    17
79dd3e2336a0 2010wk36_01
hgs
parents:
diff changeset
    18
79dd3e2336a0 2010wk36_01
hgs
parents:
diff changeset
    19
#ifndef BUFFERSOURCE_H
79dd3e2336a0 2010wk36_01
hgs
parents:
diff changeset
    20
#define BUFFERSOURCE_H
79dd3e2336a0 2010wk36_01
hgs
parents:
diff changeset
    21
79dd3e2336a0 2010wk36_01
hgs
parents:
diff changeset
    22
#include <e32base.h>
79dd3e2336a0 2010wk36_01
hgs
parents:
diff changeset
    23
#include <f32file.h>
79dd3e2336a0 2010wk36_01
hgs
parents:
diff changeset
    24
#include <a3f/mbuffersource.h>
79dd3e2336a0 2010wk36_01
hgs
parents:
diff changeset
    25
79dd3e2336a0 2010wk36_01
hgs
parents:
diff changeset
    26
#include "moutputport.h"
79dd3e2336a0 2010wk36_01
hgs
parents:
diff changeset
    27
#include "mstreambuffercontrol.h"
79dd3e2336a0 2010wk36_01
hgs
parents:
diff changeset
    28
79dd3e2336a0 2010wk36_01
hgs
parents:
diff changeset
    29
#include <a3f/a3f_trace_utils.h>
79dd3e2336a0 2010wk36_01
hgs
parents:
diff changeset
    30
79dd3e2336a0 2010wk36_01
hgs
parents:
diff changeset
    31
79dd3e2336a0 2010wk36_01
hgs
parents:
diff changeset
    32
/////
79dd3e2336a0 2010wk36_01
hgs
parents:
diff changeset
    33
 // This is the implementation of CAudioSource API.
79dd3e2336a0 2010wk36_01
hgs
parents:
diff changeset
    34
 //
79dd3e2336a0 2010wk36_01
hgs
parents:
diff changeset
    35
 // @see CAudioComponent.
79dd3e2336a0 2010wk36_01
hgs
parents:
diff changeset
    36
 ///
79dd3e2336a0 2010wk36_01
hgs
parents:
diff changeset
    37
NONSHARABLE_CLASS(CBufferSource) : 	public CActive,
79dd3e2336a0 2010wk36_01
hgs
parents:
diff changeset
    38
									public MMMFBufferSource,		// A3F interface
79dd3e2336a0 2010wk36_01
hgs
parents:
diff changeset
    39
									public MOutputPort			// Adaptation interface
79dd3e2336a0 2010wk36_01
hgs
parents:
diff changeset
    40
79dd3e2336a0 2010wk36_01
hgs
parents:
diff changeset
    41
	{
79dd3e2336a0 2010wk36_01
hgs
parents:
diff changeset
    42
public:
79dd3e2336a0 2010wk36_01
hgs
parents:
diff changeset
    43
79dd3e2336a0 2010wk36_01
hgs
parents:
diff changeset
    44
	IMPORT_C static CBufferSource* NewL();
79dd3e2336a0 2010wk36_01
hgs
parents:
diff changeset
    45
	/////
79dd3e2336a0 2010wk36_01
hgs
parents:
diff changeset
    46
	// Destructor.
79dd3e2336a0 2010wk36_01
hgs
parents:
diff changeset
    47
	//
79dd3e2336a0 2010wk36_01
hgs
parents:
diff changeset
    48
	// Deletes all objects and releases all resource owned by this instance.
79dd3e2336a0 2010wk36_01
hgs
parents:
diff changeset
    49
	///
79dd3e2336a0 2010wk36_01
hgs
parents:
diff changeset
    50
	virtual ~CBufferSource();
79dd3e2336a0 2010wk36_01
hgs
parents:
diff changeset
    51
79dd3e2336a0 2010wk36_01
hgs
parents:
diff changeset
    52
	// from MMMFBufferSource
79dd3e2336a0 2010wk36_01
hgs
parents:
diff changeset
    53
	TInt SetDataSupplier(MMMFAudioDataSupplier& aSupplier);
79dd3e2336a0 2010wk36_01
hgs
parents:
diff changeset
    54
	TInt BufferFilled(CMMFBuffer* aBuffer);
79dd3e2336a0 2010wk36_01
hgs
parents:
diff changeset
    55
	TInt BuffersDiscarded();
79dd3e2336a0 2010wk36_01
hgs
parents:
diff changeset
    56
79dd3e2336a0 2010wk36_01
hgs
parents:
diff changeset
    57
	// from class MOutputPort
79dd3e2336a0 2010wk36_01
hgs
parents:
diff changeset
    58
	TInt GetOutputPort(MOutputPort*& aOutputPort);
79dd3e2336a0 2010wk36_01
hgs
parents:
diff changeset
    59
	TInt FillBuffer(CMMFBuffer* aBuffer, MInputPort* aConsumer);
79dd3e2336a0 2010wk36_01
hgs
parents:
diff changeset
    60
	TInt BufferEmptied(CMMFBuffer* aBuffer);
79dd3e2336a0 2010wk36_01
hgs
parents:
diff changeset
    61
	TInt SetInput(MInputPort* aInput);
79dd3e2336a0 2010wk36_01
hgs
parents:
diff changeset
    62
	TInt RemoveInput(MInputPort* aInput);
79dd3e2336a0 2010wk36_01
hgs
parents:
diff changeset
    63
	TInt FlushBuffer(MFlushHandlerObserver* aFlushObserver);
79dd3e2336a0 2010wk36_01
hgs
parents:
diff changeset
    64
private:
79dd3e2336a0 2010wk36_01
hgs
parents:
diff changeset
    65
79dd3e2336a0 2010wk36_01
hgs
parents:
diff changeset
    66
	void ConstructL();
79dd3e2336a0 2010wk36_01
hgs
parents:
diff changeset
    67
79dd3e2336a0 2010wk36_01
hgs
parents:
diff changeset
    68
	CBufferSource();
79dd3e2336a0 2010wk36_01
hgs
parents:
diff changeset
    69
79dd3e2336a0 2010wk36_01
hgs
parents:
diff changeset
    70
	void DoCancel();
79dd3e2336a0 2010wk36_01
hgs
parents:
diff changeset
    71
79dd3e2336a0 2010wk36_01
hgs
parents:
diff changeset
    72
	void RunL();
79dd3e2336a0 2010wk36_01
hgs
parents:
diff changeset
    73
79dd3e2336a0 2010wk36_01
hgs
parents:
diff changeset
    74
private:
79dd3e2336a0 2010wk36_01
hgs
parents:
diff changeset
    75
	MFlushHandlerObserver* iObserver;
79dd3e2336a0 2010wk36_01
hgs
parents:
diff changeset
    76
79dd3e2336a0 2010wk36_01
hgs
parents:
diff changeset
    77
	MMMFAudioDataSupplier* iSupplier;
79dd3e2336a0 2010wk36_01
hgs
parents:
diff changeset
    78
79dd3e2336a0 2010wk36_01
hgs
parents:
diff changeset
    79
	MInputPort* iInput;
79dd3e2336a0 2010wk36_01
hgs
parents:
diff changeset
    80
79dd3e2336a0 2010wk36_01
hgs
parents:
diff changeset
    81
	CMMFBuffer* iBuffer;
79dd3e2336a0 2010wk36_01
hgs
parents:
diff changeset
    82
	};
79dd3e2336a0 2010wk36_01
hgs
parents:
diff changeset
    83
79dd3e2336a0 2010wk36_01
hgs
parents:
diff changeset
    84
#endif // BUFFERSOURCE_H