Update contrib.
2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of "Eclipse Public License v1.0"
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
24 #include <a3f/a3f_trace_utils.h>
25 #include <a3f/a3fbase.h>
26 #include "audiostreamadaptation.h"
27 #include "maudiocodecadaptationobserver.h"
28 #include "mconfigurationhelper.h"
29 #include "mstreambuffercontrol.h"
33 class CAudioDeviceSource;
34 class CAudioDeviceSink;
37 class CAudioGainControl;
38 class CFourCCConvertor;
39 class MAudioStreamAdaptationObserver;
42 class MAudioCodecObserver;
45 #include "mlogicalchain.h"
47 class CLogicalAudioStream;
50 // This is the implementation of audio stream adaptation.
53 class CAudioStream : public CAudioStreamAdaptation,
54 public MAudioCodecAdaptationObserver,
55 public MConfigurationHelper,
56 public MStreamBufferControl,
57 public MFlushHandlerObserver
62 // Create a new instance.
64 // @param aStream the stream implementation. Ownership of the pointer is transferred to the create CAudioStream object instance.
65 // @return CAudioStreamComponent* a pointer to the created instance.
67 static CAudioStream* NewL();
72 // Deletes all objects and releases all resource owned by this instance.
74 virtual ~CAudioStream();
76 // From CAudioStreamAdaptation
77 TInt RegisterAudioStreamObserver(MAudioStreamAdaptationObserver& aObserver);
78 void UnregisterAudioStreamObserver(MAudioStreamAdaptationObserver& aObserver);
79 void UnregisterAllAudioStreamObserver();
80 void SetFourCC(const CFourCCConvertor& aFourCCConvertor);
82 TInt Message(MLogicalChain& aCurrentChain, MLogicalChain& aDesiredChain, MAudioContext& aContext, TInt aFlags);
84 // from class MAudioCodecAdaptationObserver
85 void AllBuffersProcessed();
86 void ProcessingUnitError(TInt aError);
87 TInt RegisterAudioCodecObserver(MAudioCodecObserver& aObserver);
88 void UnregisterAudioCodecObserver(MAudioCodecObserver& aObserver);
89 void GetSupportedAModesComplete(TInt aError);
90 void GetSupportedARatesComplete(TInt aError);
92 // from base clase MStreamBufferControl
95 // from class MFlushHandlerObserver
96 void FlushComplete(TInt aError);
98 // from base clase MConfigurationhelper
99 TInt GetSupportedModes(RArray<TUid>& aSupportedModes);
100 TInt GetSupportedSampleRates(RArray<TInt>& aSupportedRates);
103 TInt CreateDataPath();
105 TInt DemolishDataPath();
107 TInt ChangeState(TAudioState aPreviousState, TAudioState aTargetState);
109 TAny* GetComponent(TUid aType);
111 TInt CreatePhysicalComponents(MLogicalChain& aDesiredChain);
113 void DeletePhysicalComponents();
121 TBool iIsCodecConfig;
124 MLogicalChain* iDesiredChain;
126 MLogicalChain* iCurrentChain;
128 MAudioContext* iAudioContext;
132 CBufferSource* iBufferSource;
134 CBufferSink* iBufferSink;
136 CAudioDeviceSource* iDeviceSource;
138 CAudioDeviceSink* iDeviceSink;
140 CAudioGainControl* iGainControl;
143 CFourCCConvertor* iFourCCConvertor;
145 TInt iSampleRateConfig;
149 TAudioState iCurrentStreamState;
151 TAudioState iDesiredStreamState;
154 RPointerArray<MAudioStreamAdaptationObserver> iAudioStreamObservers;
156 RPointerArray<MAudioCodecObserver> iAudioCodecObservers;
158 MOutputPort* iOutputport; // remove ports when changing to Uninitialized
160 MInputPort* iInputport;
162 TTimeIntervalMicroSeconds iTimeProcessed;
165 #endif // AUDIOSTREAM_H__