|
0
|
1 |
/*
|
|
|
2 |
* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
|
|
|
3 |
* All rights reserved.
|
|
|
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".
|
|
|
8 |
*
|
|
|
9 |
* Initial Contributors:
|
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
|
11 |
*
|
|
|
12 |
* Contributors:
|
|
|
13 |
*
|
|
|
14 |
* Description:
|
|
|
15 |
*
|
|
|
16 |
*/
|
|
|
17 |
|
|
|
18 |
|
|
|
19 |
#ifndef AUDIOSTREAM_H
|
|
|
20 |
#define AUDIOSTREAM_H
|
|
|
21 |
|
|
|
22 |
#include <e32base.h>
|
|
|
23 |
#include <f32file.h>
|
|
|
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"
|
|
|
30 |
|
|
|
31 |
class CAudioCodec;
|
|
|
32 |
class CAudioStream;
|
|
|
33 |
class CAudioDeviceSource;
|
|
|
34 |
class CAudioDeviceSink;
|
|
|
35 |
class CBufferSink;
|
|
|
36 |
class CBufferSource;
|
|
|
37 |
class CAudioGainControl;
|
|
|
38 |
class CFourCCConvertor;
|
|
|
39 |
class MAudioStreamAdaptationObserver;
|
|
|
40 |
class MInputPort;
|
|
|
41 |
class MOutputPort;
|
|
|
42 |
class MAudioCodecObserver;
|
|
|
43 |
|
|
|
44 |
|
|
|
45 |
#include "mlogicalchain.h"
|
|
|
46 |
|
|
|
47 |
class CLogicalAudioStream;
|
|
|
48 |
|
|
|
49 |
/////
|
|
|
50 |
// This is the implementation of audio stream adaptation.
|
|
|
51 |
///
|
|
|
52 |
|
|
|
53 |
class CAudioStream : public CAudioStreamAdaptation,
|
|
|
54 |
public MAudioCodecAdaptationObserver,
|
|
|
55 |
public MConfigurationHelper,
|
|
|
56 |
public MStreamBufferControl,
|
|
|
57 |
public MFlushHandlerObserver
|
|
|
58 |
{
|
|
|
59 |
public:
|
|
|
60 |
|
|
|
61 |
/////
|
|
|
62 |
// Create a new instance.
|
|
|
63 |
//
|
|
|
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.
|
|
|
66 |
///
|
|
|
67 |
static CAudioStream* NewL();
|
|
|
68 |
|
|
|
69 |
/////
|
|
|
70 |
// Destructor.
|
|
|
71 |
//
|
|
|
72 |
// Deletes all objects and releases all resource owned by this instance.
|
|
|
73 |
///
|
|
|
74 |
virtual ~CAudioStream();
|
|
|
75 |
|
|
|
76 |
// From CAudioStreamAdaptation
|
|
|
77 |
TInt RegisterAudioStreamObserver(MAudioStreamAdaptationObserver& aObserver);
|
|
|
78 |
void UnregisterAudioStreamObserver(MAudioStreamAdaptationObserver& aObserver);
|
|
|
79 |
void UnregisterAllAudioStreamObserver();
|
|
|
80 |
void SetFourCC(const CFourCCConvertor& aFourCCConvertor);
|
|
|
81 |
|
|
|
82 |
TInt Message(MLogicalChain& aCurrentChain, MLogicalChain& aDesiredChain, MAudioContext& aContext, TInt aFlags);
|
|
|
83 |
|
|
|
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);
|
|
|
91 |
|
|
|
92 |
// from base clase MStreamBufferControl
|
|
|
93 |
TInt FlushBuffers();
|
|
|
94 |
|
|
|
95 |
// from class MFlushHandlerObserver
|
|
|
96 |
void FlushComplete(TInt aError);
|
|
|
97 |
protected:
|
|
|
98 |
// from base clase MConfigurationhelper
|
|
|
99 |
TInt GetSupportedModes(RArray<TUid>& aSupportedModes);
|
|
|
100 |
TInt GetSupportedSampleRates(RArray<TInt>& aSupportedRates);
|
|
|
101 |
|
|
|
102 |
private:
|
|
|
103 |
TInt CreateDataPath();
|
|
|
104 |
|
|
|
105 |
TInt DemolishDataPath();
|
|
|
106 |
|
|
|
107 |
TInt ChangeState(TAudioState aPreviousState, TAudioState aTargetState);
|
|
|
108 |
|
|
|
109 |
TAny* GetComponent(TUid aType);
|
|
|
110 |
|
|
|
111 |
TInt CreatePhysicalComponents(MLogicalChain& aDesiredChain);
|
|
|
112 |
|
|
|
113 |
void DeletePhysicalComponents();
|
|
|
114 |
|
|
|
115 |
void ConstructL();
|
|
|
116 |
|
|
|
117 |
CAudioStream();
|
|
|
118 |
|
|
|
119 |
private:
|
|
|
120 |
// Flags
|
|
|
121 |
TBool iIsCodecConfig;
|
|
|
122 |
|
|
|
123 |
// Components
|
|
|
124 |
MLogicalChain* iDesiredChain;
|
|
|
125 |
|
|
|
126 |
MLogicalChain* iCurrentChain;
|
|
|
127 |
|
|
|
128 |
MAudioContext* iAudioContext;
|
|
|
129 |
|
|
|
130 |
CAudioCodec* iCodec;
|
|
|
131 |
|
|
|
132 |
CBufferSource* iBufferSource;
|
|
|
133 |
|
|
|
134 |
CBufferSink* iBufferSink;
|
|
|
135 |
|
|
|
136 |
CAudioDeviceSource* iDeviceSource;
|
|
|
137 |
|
|
|
138 |
CAudioDeviceSink* iDeviceSink;
|
|
|
139 |
|
|
|
140 |
CAudioGainControl* iGainControl;
|
|
|
141 |
|
|
|
142 |
// Not owned
|
|
|
143 |
CFourCCConvertor* iFourCCConvertor;
|
|
|
144 |
|
|
|
145 |
TInt iSampleRateConfig;
|
|
|
146 |
|
|
|
147 |
TUid iModeConfig;
|
|
|
148 |
|
|
|
149 |
TAudioState iCurrentStreamState;
|
|
|
150 |
|
|
|
151 |
TAudioState iDesiredStreamState;
|
|
|
152 |
|
|
|
153 |
// Observers
|
|
|
154 |
RPointerArray<MAudioStreamAdaptationObserver> iAudioStreamObservers;
|
|
|
155 |
|
|
|
156 |
RPointerArray<MAudioCodecObserver> iAudioCodecObservers;
|
|
|
157 |
|
|
|
158 |
MOutputPort* iOutputport; // remove ports when changing to Uninitialized
|
|
|
159 |
|
|
|
160 |
MInputPort* iInputport;
|
|
|
161 |
|
|
|
162 |
TTimeIntervalMicroSeconds iTimeProcessed;
|
|
|
163 |
};
|
|
|
164 |
|
|
|
165 |
#endif // AUDIOSTREAM_H__
|