|
1 /* |
|
2 * Copyright (c) 2005 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 |
|
20 |
|
21 #ifndef CMCEAUDIOSTREAM_H |
|
22 #define CMCEAUDIOSTREAM_H |
|
23 |
|
24 // INCLUDES |
|
25 #include <e32std.h> |
|
26 #include <mcemediastream.h> |
|
27 |
|
28 // CONSTANTS |
|
29 const TMceMediaType KMceAudio = 1; |
|
30 |
|
31 // FORWARD DECLARATIONS |
|
32 class CMceAudioCodec; |
|
33 |
|
34 // CLASS DECLARATION |
|
35 |
|
36 /** |
|
37 * Class for representing unidirectional audio stream. |
|
38 * |
|
39 * It defines the used audio codecs for the stream. |
|
40 * In order to be complete structure, at least one codec is required. |
|
41 * |
|
42 * @lib mceclient.lib |
|
43 */ |
|
44 class CMceAudioStream: public CMceMediaStream |
|
45 { |
|
46 public: // Constructors and destructor |
|
47 |
|
48 /** |
|
49 * Two-phased constructor. |
|
50 */ |
|
51 IMPORT_C static CMceAudioStream* NewL(); |
|
52 |
|
53 /** |
|
54 * Two-phased constructor. |
|
55 */ |
|
56 IMPORT_C static CMceAudioStream* NewLC(); |
|
57 |
|
58 /** |
|
59 * Destructor. |
|
60 */ |
|
61 IMPORT_C ~CMceAudioStream(); |
|
62 |
|
63 public: // Functions |
|
64 |
|
65 /** |
|
66 * Returns the available codecs to the session. |
|
67 * For CMEOutSession, array contains all codecs supported by |
|
68 * terminal in default. For CMEInSession, array contains codecs |
|
69 * that were offered by remote terminal, and supported by local terminal. |
|
70 * Codecs are in preference order in the array. |
|
71 * Codec in the first element of the array has highest preference. |
|
72 * @return codecs available for the session. |
|
73 */ |
|
74 IMPORT_C const RPointerArray<CMceAudioCodec>& Codecs(); |
|
75 |
|
76 /** |
|
77 * Adds codec to the stream. |
|
78 * @param aCodec codec added to the stream; ownership is transferred |
|
79 */ |
|
80 IMPORT_C void AddCodecL( CMceAudioCodec* aCodec ); |
|
81 |
|
82 /** |
|
83 * Removes codec from the stream |
|
84 * @param aCodec codec removed from stream |
|
85 */ |
|
86 IMPORT_C void RemoveCodecL( CMceAudioCodec& aCodec ); |
|
87 |
|
88 /** |
|
89 * Replaces codecs of the stream. Codecs should be in preference order in |
|
90 * the passed array. |
|
91 * @param aCodecs array of codecs which will replace existing codecs; |
|
92 * ownership is transferred |
|
93 */ |
|
94 IMPORT_C void ReplaceCodecsL( RPointerArray<CMceAudioCodec>* aCodecs ); |
|
95 |
|
96 public: // serialization |
|
97 |
|
98 /** |
|
99 * Internalizes |
|
100 * @param aReadStream read stream |
|
101 * @param aTarget to which read to |
|
102 */ |
|
103 void InternalizeL( MMceComSerializationContext& aSerCtx ); |
|
104 |
|
105 /** |
|
106 * Externalizes |
|
107 * @param aWriteStream write stream |
|
108 */ |
|
109 void ExternalizeL( MMceComSerializationContext& aSerCtx ); |
|
110 |
|
111 |
|
112 public: //from CMceMediaStream |
|
113 |
|
114 /** |
|
115 * Initializes |
|
116 * @param aParent the parent |
|
117 * @param aDiscardUnusedCodecs |
|
118 */ |
|
119 void InitializeL( CMceSession& aParent, TBool aDiscardUnusedCodecs ); |
|
120 |
|
121 /** |
|
122 * Initializes |
|
123 * @param aManager the manager. Ownership is NOT transferred |
|
124 * @param aSession the Session. |
|
125 */ |
|
126 void InitializeL( CMceManager* aManager, CMceSession& aSession ); |
|
127 |
|
128 /** |
|
129 * Traversal event handler |
|
130 * @param aEvent the event |
|
131 * @return status, if event was consumed or not or object needs update |
|
132 */ |
|
133 TInt EventReceivedL( TMceEvent& aEvent ); |
|
134 |
|
135 /** |
|
136 * Called file source wants to synchronized with stream |
|
137 * @param aFile the file source |
|
138 */ |
|
139 void SynchronizeWithFileL( CMceFileSource& aFile ); |
|
140 |
|
141 /** |
|
142 * Searches for codec matching with input codec instance or sdp name |
|
143 * @param aCodec the search term |
|
144 * @return matching codec or NULL if not found |
|
145 */ |
|
146 CMceCodec* FindCodec( CMceCodec& aCodec ); |
|
147 |
|
148 /** |
|
149 * Arrange audio codecs according codec preferences. |
|
150 */ |
|
151 void ReorderCodecsByPreferenceL( TBool aDiscardUnusedCodecs ); |
|
152 |
|
153 /** |
|
154 * Return codecs of stream. |
|
155 * @return list of codecs in the stream. |
|
156 */ |
|
157 const RPointerArray<CMceCodec>& BaseCodecs(); |
|
158 |
|
159 public: //internal |
|
160 |
|
161 /** |
|
162 * Serches for existence of components needed for dtmf usage. |
|
163 * @param aRtpSourceExists |
|
164 * @param aRtpSinkExists |
|
165 * @param aDtmfCodecExists |
|
166 * @param aBinderOriginated |
|
167 */ |
|
168 void FindDtmfRelatedComponents( TBool& aRtpSourceExists, |
|
169 TBool& aRtpSinkExists, |
|
170 TBool& aDtmfCodecExists, |
|
171 TBool aBinderOriginated ); |
|
172 /** |
|
173 * Removes codec |
|
174 * @param aCodec |
|
175 * @param aBinderOriginated |
|
176 */ |
|
177 void RemoveCodecL( CMceAudioCodec& aCodec, TBool aBinderOriginated ); |
|
178 |
|
179 private: //methods |
|
180 |
|
181 /** |
|
182 * C++ default constructor. |
|
183 */ |
|
184 CMceAudioStream(); |
|
185 |
|
186 /** |
|
187 * Second-phase constructor. |
|
188 */ |
|
189 void ConstructL(); |
|
190 |
|
191 |
|
192 private: // Owned data |
|
193 |
|
194 /** |
|
195 * codecs |
|
196 */ |
|
197 RPointerArray<CMceAudioCodec> iCodecs; |
|
198 |
|
199 //for testing |
|
200 |
|
201 MCE_UNIT_TEST_DEFS |
|
202 }; |
|
203 |
|
204 #endif |