os/mm/mmhais/refacladapt/src/audiostream/audiostream.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/mm/mmhais/refacladapt/src/audiostream/audiostream.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,165 @@
     1.4 +/*
     1.5 +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +* All rights reserved.
     1.7 +* This component and the accompanying materials are made available
     1.8 +* under the terms of "Eclipse Public License v1.0"
     1.9 +* which accompanies this distribution, and is available
    1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.11 +*
    1.12 +* Initial Contributors:
    1.13 +* Nokia Corporation - initial contribution.
    1.14 +*
    1.15 +* Contributors:
    1.16 +*
    1.17 +* Description:
    1.18 +*
    1.19 +*/
    1.20 +
    1.21 +
    1.22 +#ifndef AUDIOSTREAM_H
    1.23 +#define AUDIOSTREAM_H
    1.24 +
    1.25 +#include <e32base.h>
    1.26 +#include <f32file.h>
    1.27 +#include <a3f/a3f_trace_utils.h>
    1.28 +#include <a3f/a3fbase.h>
    1.29 +#include "audiostreamadaptation.h"
    1.30 +#include "maudiocodecadaptationobserver.h"
    1.31 +#include "mconfigurationhelper.h"
    1.32 +#include "mstreambuffercontrol.h"
    1.33 +
    1.34 +class CAudioCodec;
    1.35 +class CAudioStream;
    1.36 +class CAudioDeviceSource;
    1.37 +class CAudioDeviceSink;
    1.38 +class CBufferSink;
    1.39 +class CBufferSource;
    1.40 +class CAudioGainControl;
    1.41 +class CFourCCConvertor;
    1.42 +class MAudioStreamAdaptationObserver;
    1.43 +class MInputPort;
    1.44 +class MOutputPort;
    1.45 +class MAudioCodecObserver;
    1.46 +
    1.47 +
    1.48 +#include "mlogicalchain.h"
    1.49 +
    1.50 +class CLogicalAudioStream;
    1.51 +
    1.52 +/////
    1.53 + // This is the implementation of audio stream adaptation.
    1.54 + ///
    1.55 +
    1.56 +class CAudioStream : 	public CAudioStreamAdaptation,
    1.57 +						public MAudioCodecAdaptationObserver,
    1.58 +						public MConfigurationHelper, 
    1.59 +						public MStreamBufferControl, 
    1.60 +						public MFlushHandlerObserver
    1.61 +	{
    1.62 +public:
    1.63 +
    1.64 +	/////
    1.65 +	// Create a new instance.
    1.66 +	//
    1.67 +	// @param aStream the stream implementation. Ownership of the pointer is transferred to the create CAudioStream object instance.
    1.68 +	// @return CAudioStreamComponent* a pointer to the created instance.
    1.69 +	///
    1.70 +	static CAudioStream* NewL();
    1.71 +
    1.72 +	/////
    1.73 +	// Destructor.
    1.74 +	//
    1.75 +	// Deletes all objects and releases all resource owned by this instance.
    1.76 +	///
    1.77 +	virtual ~CAudioStream();
    1.78 +
    1.79 +	// From CAudioStreamAdaptation
    1.80 +	TInt RegisterAudioStreamObserver(MAudioStreamAdaptationObserver& aObserver);
    1.81 +	void UnregisterAudioStreamObserver(MAudioStreamAdaptationObserver& aObserver);
    1.82 +	void UnregisterAllAudioStreamObserver();
    1.83 +	void SetFourCC(const CFourCCConvertor& aFourCCConvertor);
    1.84 +
    1.85 +	TInt Message(MLogicalChain& aCurrentChain, MLogicalChain& aDesiredChain, MAudioContext& aContext, TInt aFlags);
    1.86 +
    1.87 +	// from class MAudioCodecAdaptationObserver
    1.88 +	void AllBuffersProcessed();
    1.89 +	void ProcessingUnitError(TInt aError);
    1.90 +	TInt RegisterAudioCodecObserver(MAudioCodecObserver& aObserver);
    1.91 +	void UnregisterAudioCodecObserver(MAudioCodecObserver& aObserver);
    1.92 +	void GetSupportedAModesComplete(TInt aError);
    1.93 +	void GetSupportedARatesComplete(TInt aError);
    1.94 +
    1.95 +	// from base clase MStreamBufferControl
    1.96 +	TInt FlushBuffers();
    1.97 +
    1.98 +	// from class MFlushHandlerObserver
    1.99 +	void FlushComplete(TInt aError);
   1.100 +protected:
   1.101 +	// from base clase MConfigurationhelper
   1.102 +	TInt GetSupportedModes(RArray<TUid>& aSupportedModes);
   1.103 +	TInt GetSupportedSampleRates(RArray<TInt>& aSupportedRates);
   1.104 +
   1.105 +private:
   1.106 +	TInt CreateDataPath();
   1.107 +
   1.108 +	TInt DemolishDataPath();
   1.109 +
   1.110 +	TInt ChangeState(TAudioState aPreviousState, TAudioState aTargetState);
   1.111 +
   1.112 +	TAny* GetComponent(TUid aType);
   1.113 +
   1.114 +	TInt CreatePhysicalComponents(MLogicalChain& aDesiredChain);
   1.115 +
   1.116 +	void DeletePhysicalComponents();
   1.117 +
   1.118 +	void ConstructL();
   1.119 +
   1.120 +	CAudioStream();
   1.121 +
   1.122 +private:
   1.123 +	// Flags
   1.124 +	TBool				iIsCodecConfig;
   1.125 +
   1.126 +	// Components
   1.127 +	MLogicalChain*		iDesiredChain;
   1.128 +
   1.129 +	MLogicalChain*		iCurrentChain;
   1.130 +
   1.131 +	MAudioContext* 		iAudioContext;
   1.132 +
   1.133 +	CAudioCodec*		iCodec;
   1.134 +
   1.135 +	CBufferSource*		iBufferSource;
   1.136 +
   1.137 +	CBufferSink*		iBufferSink;
   1.138 +
   1.139 +	CAudioDeviceSource*	iDeviceSource;
   1.140 +
   1.141 +	CAudioDeviceSink*	iDeviceSink;
   1.142 +
   1.143 +	CAudioGainControl*	iGainControl;
   1.144 +
   1.145 +	// Not owned
   1.146 +	CFourCCConvertor*	iFourCCConvertor;
   1.147 +
   1.148 +	TInt				iSampleRateConfig;
   1.149 +
   1.150 +	TUid				iModeConfig;
   1.151 +
   1.152 +	TAudioState			iCurrentStreamState;
   1.153 +
   1.154 +	TAudioState			iDesiredStreamState;
   1.155 +
   1.156 +	// Observers
   1.157 +	RPointerArray<MAudioStreamAdaptationObserver> iAudioStreamObservers;
   1.158 +
   1.159 +	RPointerArray<MAudioCodecObserver>	iAudioCodecObservers;
   1.160 +
   1.161 +	MOutputPort*		iOutputport;	// remove ports when changing to Uninitialized
   1.162 +
   1.163 +	MInputPort*			iInputport;
   1.164 +
   1.165 +	TTimeIntervalMicroSeconds iTimeProcessed;
   1.166 +	};
   1.167 +
   1.168 +#endif // AUDIOSTREAM_H__