sl@0: /* sl@0: * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: sl@0: * sl@0: */ sl@0: sl@0: sl@0: #ifndef AUDIOSTREAM_H sl@0: #define AUDIOSTREAM_H sl@0: sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include "audiostreamadaptation.h" sl@0: #include "maudiocodecadaptationobserver.h" sl@0: #include "mconfigurationhelper.h" sl@0: #include "mstreambuffercontrol.h" sl@0: sl@0: class CAudioCodec; sl@0: class CAudioStream; sl@0: class CAudioDeviceSource; sl@0: class CAudioDeviceSink; sl@0: class CBufferSink; sl@0: class CBufferSource; sl@0: class CAudioGainControl; sl@0: class CFourCCConvertor; sl@0: class MAudioStreamAdaptationObserver; sl@0: class MInputPort; sl@0: class MOutputPort; sl@0: class MAudioCodecObserver; sl@0: sl@0: sl@0: #include "mlogicalchain.h" sl@0: sl@0: class CLogicalAudioStream; sl@0: sl@0: ///// sl@0: // This is the implementation of audio stream adaptation. sl@0: /// sl@0: sl@0: class CAudioStream : public CAudioStreamAdaptation, sl@0: public MAudioCodecAdaptationObserver, sl@0: public MConfigurationHelper, sl@0: public MStreamBufferControl, sl@0: public MFlushHandlerObserver sl@0: { sl@0: public: sl@0: sl@0: ///// sl@0: // Create a new instance. sl@0: // sl@0: // @param aStream the stream implementation. Ownership of the pointer is transferred to the create CAudioStream object instance. sl@0: // @return CAudioStreamComponent* a pointer to the created instance. sl@0: /// sl@0: static CAudioStream* NewL(); sl@0: sl@0: ///// sl@0: // Destructor. sl@0: // sl@0: // Deletes all objects and releases all resource owned by this instance. sl@0: /// sl@0: virtual ~CAudioStream(); sl@0: sl@0: // From CAudioStreamAdaptation sl@0: TInt RegisterAudioStreamObserver(MAudioStreamAdaptationObserver& aObserver); sl@0: void UnregisterAudioStreamObserver(MAudioStreamAdaptationObserver& aObserver); sl@0: void UnregisterAllAudioStreamObserver(); sl@0: void SetFourCC(const CFourCCConvertor& aFourCCConvertor); sl@0: sl@0: TInt Message(MLogicalChain& aCurrentChain, MLogicalChain& aDesiredChain, MAudioContext& aContext, TInt aFlags); sl@0: sl@0: // from class MAudioCodecAdaptationObserver sl@0: void AllBuffersProcessed(); sl@0: void ProcessingUnitError(TInt aError); sl@0: TInt RegisterAudioCodecObserver(MAudioCodecObserver& aObserver); sl@0: void UnregisterAudioCodecObserver(MAudioCodecObserver& aObserver); sl@0: void GetSupportedAModesComplete(TInt aError); sl@0: void GetSupportedARatesComplete(TInt aError); sl@0: sl@0: // from base clase MStreamBufferControl sl@0: TInt FlushBuffers(); sl@0: sl@0: // from class MFlushHandlerObserver sl@0: void FlushComplete(TInt aError); sl@0: protected: sl@0: // from base clase MConfigurationhelper sl@0: TInt GetSupportedModes(RArray& aSupportedModes); sl@0: TInt GetSupportedSampleRates(RArray& aSupportedRates); sl@0: sl@0: private: sl@0: TInt CreateDataPath(); sl@0: sl@0: TInt DemolishDataPath(); sl@0: sl@0: TInt ChangeState(TAudioState aPreviousState, TAudioState aTargetState); sl@0: sl@0: TAny* GetComponent(TUid aType); sl@0: sl@0: TInt CreatePhysicalComponents(MLogicalChain& aDesiredChain); sl@0: sl@0: void DeletePhysicalComponents(); sl@0: sl@0: void ConstructL(); sl@0: sl@0: CAudioStream(); sl@0: sl@0: private: sl@0: // Flags sl@0: TBool iIsCodecConfig; sl@0: sl@0: // Components sl@0: MLogicalChain* iDesiredChain; sl@0: sl@0: MLogicalChain* iCurrentChain; sl@0: sl@0: MAudioContext* iAudioContext; sl@0: sl@0: CAudioCodec* iCodec; sl@0: sl@0: CBufferSource* iBufferSource; sl@0: sl@0: CBufferSink* iBufferSink; sl@0: sl@0: CAudioDeviceSource* iDeviceSource; sl@0: sl@0: CAudioDeviceSink* iDeviceSink; sl@0: sl@0: CAudioGainControl* iGainControl; sl@0: sl@0: // Not owned sl@0: CFourCCConvertor* iFourCCConvertor; sl@0: sl@0: TInt iSampleRateConfig; sl@0: sl@0: TUid iModeConfig; sl@0: sl@0: TAudioState iCurrentStreamState; sl@0: sl@0: TAudioState iDesiredStreamState; sl@0: sl@0: // Observers sl@0: RPointerArray iAudioStreamObservers; sl@0: sl@0: RPointerArray iAudioCodecObservers; sl@0: sl@0: MOutputPort* iOutputport; // remove ports when changing to Uninitialized sl@0: sl@0: MInputPort* iInputport; sl@0: sl@0: TTimeIntervalMicroSeconds iTimeProcessed; sl@0: }; sl@0: sl@0: #endif // AUDIOSTREAM_H__