|
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 CMCECOMVIDEOSTREAM_H |
|
22 #define CMCECOMVIDEOSTREAM_H |
|
23 |
|
24 #include <e32std.h> |
|
25 #include "mcecommediastream.h" |
|
26 |
|
27 // FORWARD DECLARATIONS |
|
28 |
|
29 class CMceComVideoCodec; |
|
30 |
|
31 /** |
|
32 * |
|
33 * |
|
34 * @lib |
|
35 */ |
|
36 class CMceComVideoStream: public CMceComMediaStream |
|
37 { |
|
38 |
|
39 public: // Constructors and destructor |
|
40 |
|
41 /** |
|
42 * Constructor |
|
43 */ |
|
44 static CMceComVideoStream* NewL(); |
|
45 |
|
46 /** |
|
47 * Constructor |
|
48 */ |
|
49 static CMceComVideoStream* NewLC(); |
|
50 |
|
51 /** |
|
52 * Destructor. |
|
53 */ |
|
54 ~CMceComVideoStream(); |
|
55 |
|
56 public: // Functions |
|
57 |
|
58 /** |
|
59 * Adds codec to the stream. |
|
60 * @param aCodec codec to be added to the stream. |
|
61 * Ownership is transferred. |
|
62 */ |
|
63 void AddCodecL( CMceComCodec* aCodec); |
|
64 |
|
65 |
|
66 /** |
|
67 * Removes codec from the stream. |
|
68 * @param aCodec codec to be added to the stream. |
|
69 * Ownership is transferred. |
|
70 */ |
|
71 void RemoveCodecL( CMceComCodec* aCodec ); |
|
72 |
|
73 /** |
|
74 * Return pointer to codec from the list of codecs. |
|
75 * aIndex index of codec to get. |
|
76 */ |
|
77 CMceComVideoCodec* CodecL( TInt aIndex ) const; |
|
78 |
|
79 /** |
|
80 * Returns number of codecs in the stream. |
|
81 */ |
|
82 TInt CodecCount() const; |
|
83 |
|
84 /** |
|
85 * Returns the available codecs to the session. |
|
86 * @return codecs available for the session. |
|
87 */ |
|
88 const RPointerArray<CMceComVideoCodec>& Codecs() const; |
|
89 |
|
90 public: // serialization |
|
91 |
|
92 |
|
93 /** |
|
94 * Internalizes flat data |
|
95 * @param aReadStream read stream |
|
96 */ |
|
97 void InternalizeFlatL( RReadStream& aReadStream ); |
|
98 |
|
99 /** |
|
100 * Externalizes flat data |
|
101 * @param aWriteStream write stream |
|
102 */ |
|
103 void ExternalizeFlatL( RWriteStream& aWriteStream ); |
|
104 |
|
105 /** |
|
106 * Internalizes |
|
107 * @param aReadStream read stream |
|
108 */ |
|
109 void InternalizeL( MMceComSerializationContext& aSerCtx ); |
|
110 |
|
111 /** |
|
112 * Externalizes |
|
113 * @param aWriteStream write stream |
|
114 */ |
|
115 void ExternalizeL( MMceComSerializationContext& aSerCtx ); |
|
116 |
|
117 |
|
118 public://from CMceComMediaStream |
|
119 |
|
120 |
|
121 /** |
|
122 * Initializes |
|
123 * @param aParent the parent |
|
124 */ |
|
125 void InitializeL( CMceComSession& aParent ); |
|
126 |
|
127 /** |
|
128 * Updates |
|
129 * @param aStream new stream |
|
130 */ |
|
131 void UpdateL( CMceComMediaStream& aStream ); |
|
132 |
|
133 /** |
|
134 * Clones |
|
135 */ |
|
136 CMceComMediaStream* CloneL(); |
|
137 |
|
138 void ReorderCodecs(); |
|
139 |
|
140 protected: // Functions |
|
141 |
|
142 /** |
|
143 * Constructor |
|
144 */ |
|
145 CMceComVideoStream(); |
|
146 |
|
147 /** |
|
148 * second-phase constructor |
|
149 */ |
|
150 void ConstructL(); |
|
151 |
|
152 /** |
|
153 * second-phase copy constructor |
|
154 */ |
|
155 void ConstructL( CMceComVideoStream& aStream ); |
|
156 |
|
157 /** |
|
158 * Searches for codec matching with input codec instance or sdp name |
|
159 * @param aCodec the search term |
|
160 * @return matching codec or NULL if not found |
|
161 */ |
|
162 CMceComCodec* FindCodecL( CMceComCodec& aCodec ); |
|
163 |
|
164 /** |
|
165 * Find index of codec in the list of codecs. |
|
166 * aCodec codec to search for. |
|
167 */ |
|
168 TInt FindCodecFromList( CMceComCodec* aCodec) const; |
|
169 |
|
170 /** |
|
171 * Removes a codec from the list of codecs. |
|
172 * @param aIndex index of codec to be removed. |
|
173 */ |
|
174 void RemoveCodecFromListL( TInt aIndex ); |
|
175 |
|
176 /** |
|
177 * Clears list of codecs and deletes each codec in it. |
|
178 */ |
|
179 void DestroyCodecs(); |
|
180 |
|
181 |
|
182 #ifdef MCE_COMMON_SERVER_SIDE |
|
183 |
|
184 protected: |
|
185 |
|
186 |
|
187 /** |
|
188 * Synchronizes stream's codecs |
|
189 * @param aRoleAnswerer is answerer |
|
190 */ |
|
191 void SynchronizeL( TBool aRoleAnswerer ); |
|
192 |
|
193 /** |
|
194 * Update default codec to reflect current negotiation |
|
195 */ |
|
196 void UpdateDefaultCodecL(); |
|
197 |
|
198 /** |
|
199 * Prepares stream for offer/answer |
|
200 */ |
|
201 void PrepareL(); |
|
202 |
|
203 /** |
|
204 * Return mcc stream type |
|
205 * @return mcc stream type |
|
206 */ |
|
207 TInt MccStreamType() const; |
|
208 |
|
209 /** |
|
210 * Return mcc link type |
|
211 * @return mcc link type |
|
212 */ |
|
213 TInt MccLinkType() const; |
|
214 |
|
215 /** |
|
216 * Update default codecs of associated local streams to reflect |
|
217 * current negotiation |
|
218 */ |
|
219 void UpdateDefaultCodecForAssociatedLocalL( CMceComCodec* aNewDefaultCodec ); |
|
220 |
|
221 |
|
222 #endif//MCE_COMMON_SERVER_SIDE |
|
223 |
|
224 protected: // Owned data |
|
225 |
|
226 /** |
|
227 * codecs |
|
228 */ |
|
229 RPointerArray<CMceComVideoCodec> iCodecs; |
|
230 |
|
231 #ifdef EUNIT_TEST |
|
232 friend class UT_CMceComVideoStream; |
|
233 friend class UT_CMceMediaSdpCodec; |
|
234 friend class UT_CMceVideoSdpCodec; |
|
235 #endif |
|
236 }; |
|
237 |
|
238 |
|
239 |
|
240 #endif |