|
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 #ifndef MUSHENGLIVESESSION_H |
|
20 #define MUSHENGLIVESESSION_H |
|
21 |
|
22 // USER |
|
23 #include "musengmceoutsession.h" |
|
24 #include "musunittesting.h" |
|
25 |
|
26 // SYSTEM |
|
27 #include <ecam.h> |
|
28 |
|
29 // FORWARD DECLARATIONS |
|
30 class MMusEngLiveSessionObserver; |
|
31 |
|
32 class CMusEngLiveSession : public CMusEngMceOutSession |
|
33 { |
|
34 MUS_UNITTEST( UT_CMusEngOutSession ) |
|
35 MUS_UNITTEST( UT_CMusEngLiveSession ) |
|
36 |
|
37 public: |
|
38 |
|
39 /** |
|
40 * Creates new MultimediaSharing Live session. |
|
41 * |
|
42 * @param aFileName Media filename |
|
43 * @param aRect UI drawing area. It is allowed handle from engine |
|
44 * @param aSessionObserver Interface for session specific callbacks |
|
45 * @param aOutSessionObserver Interface for outsession specific callbacks |
|
46 * @param aLiveSessionObserver interface for live session specific |
|
47 * callbacks |
|
48 * @param aSipProfileId SIP profile to be used, 0 is default profile |
|
49 * @return CMusEngLiveSession* New instanse of specified class |
|
50 */ |
|
51 IMPORT_C static CMusEngLiveSession* NewL( |
|
52 const TDesC& aFileName, |
|
53 const TRect& aRect, |
|
54 MMusEngSessionObserver& aSessionObserver, |
|
55 MMusEngOutSessionObserver& aOutSessionObserver, |
|
56 MMusEngLiveSessionObserver& aLiveSessionObserver, |
|
57 TUint aSipProfileId = 0); |
|
58 |
|
59 /** |
|
60 * Creates new MultimediaSharing Live session. |
|
61 * |
|
62 * @param aRect UI drawing area. It is allowed handle from engine |
|
63 * @param aSessionObserver Interface for session specific callbacks |
|
64 * @param aOutSessionObserver Interface for outsession specific callbacks |
|
65 * @param aLiveSessionObserver interface for live session specific |
|
66 * callbacks |
|
67 * @param aSipProfileId SIP profile to be used, 0 is default profile |
|
68 * @return CMusEngLiveSession* New instanse of specified class |
|
69 */ |
|
70 IMPORT_C static CMusEngLiveSession* NewL( |
|
71 const TRect& aRect, |
|
72 MMusEngSessionObserver& aSessionObserver, |
|
73 MMusEngOutSessionObserver& aOutSessionObserver, |
|
74 MMusEngLiveSessionObserver& aLiveSessionObserver, |
|
75 TUint aSipProfileId = 0 ); |
|
76 |
|
77 |
|
78 public: |
|
79 |
|
80 /** |
|
81 * Destructor |
|
82 */ |
|
83 ~CMusEngLiveSession(); |
|
84 |
|
85 |
|
86 |
|
87 public: // NEW LIVE SESSION SPECIFIC API FUNCTIONS |
|
88 |
|
89 /** |
|
90 * Gets current zoom factor |
|
91 * |
|
92 * @pre Session is established |
|
93 * @leave KErrNotReady if precondition not fullfilled |
|
94 */ |
|
95 IMPORT_C TInt CurrentZoomL() const; |
|
96 |
|
97 /** |
|
98 * Sets new zoom factor |
|
99 * |
|
100 * @pre Session is established |
|
101 * @pre MinZoomL <= aNewZoomFactor <= MaxZoomL |
|
102 * @leave KErrNotReady if session is not established |
|
103 */ |
|
104 IMPORT_C void SetZoomL( TInt aNewZoomFactor ); |
|
105 |
|
106 /** |
|
107 * Gets minimum zoom factor |
|
108 * |
|
109 * @pre Session is established |
|
110 * @leave KErrNotReady if precondition not fullfilled |
|
111 */ |
|
112 IMPORT_C TInt MinZoomL() const; |
|
113 |
|
114 /** |
|
115 * Gets maximum zoom factor |
|
116 * |
|
117 * @pre Session is established |
|
118 * @leave KErrNotReady if precondition not fullfilled |
|
119 */ |
|
120 IMPORT_C TInt MaxZoomL() const; |
|
121 |
|
122 /** |
|
123 * Increases zoom factor by one. |
|
124 * |
|
125 * @pre Session is established |
|
126 * @leave KErrNotReady if precondition not fullfilled |
|
127 */ |
|
128 IMPORT_C void ZoomInL(); |
|
129 |
|
130 /** |
|
131 * Decreases zoom factor by one. |
|
132 * |
|
133 * @pre Session is established |
|
134 * @leave KErrNotReady if precondition not fullfilled |
|
135 */ |
|
136 IMPORT_C void ZoomOutL(); |
|
137 |
|
138 /** |
|
139 * Sets zoom factor to default. |
|
140 * |
|
141 * @pre Session is established |
|
142 * @leave KErrNotReady if precondition not fullfilled |
|
143 */ |
|
144 IMPORT_C void ZoomDefaultL(); |
|
145 |
|
146 /** |
|
147 * Sets current brightness |
|
148 * |
|
149 * @pre Session is established |
|
150 * @leave KErrNotReady if precondition not fullfilled |
|
151 */ |
|
152 IMPORT_C void SetBrightnessL( TInt aBrightness ) const; |
|
153 |
|
154 |
|
155 /** |
|
156 * Gets current brightness |
|
157 * |
|
158 * @pre Session is established |
|
159 * @leave KErrNotReady if precondition not fullfilled |
|
160 */ |
|
161 IMPORT_C TInt CurrentBrightnessL() const; |
|
162 |
|
163 /** |
|
164 * Gets maximum brightness |
|
165 * |
|
166 * @pre Session is established |
|
167 * @leave KErrNotReady if precondition not fullfilled |
|
168 */ |
|
169 IMPORT_C TInt MaxBrightnessL() const; |
|
170 |
|
171 /** |
|
172 * Gets minimum brightness |
|
173 * |
|
174 * @pre Session is established |
|
175 * @leave KErrNotReady if precondition not fullfilled |
|
176 */ |
|
177 IMPORT_C TInt MinBrightnessL() const; |
|
178 |
|
179 /** |
|
180 * Increases brightness by one. |
|
181 * |
|
182 * @pre Session is established |
|
183 * @leave KErrNotReady if precondition not fullfilled |
|
184 */ |
|
185 IMPORT_C void IncreaseBrightnessL(); |
|
186 |
|
187 /** |
|
188 * Decreases brightness by one. |
|
189 * |
|
190 * @pre Session is established |
|
191 * @leave KErrNotReady if precondition not fullfilled |
|
192 */ |
|
193 IMPORT_C void DecreaseBrightnessL(); |
|
194 |
|
195 /** |
|
196 * Sets brightness factor to default. |
|
197 * |
|
198 * @pre Session is established |
|
199 * @leave KErrNotReady if precondition not fullfilled |
|
200 */ |
|
201 IMPORT_C void BrightnessDefaultL(); |
|
202 |
|
203 /** |
|
204 * Sets brightness to automatic. |
|
205 * |
|
206 * @pre Session is established |
|
207 * @leave KErrNotReady if precondition not fullfilled |
|
208 */ |
|
209 IMPORT_C void BrightnessAutoL(); |
|
210 |
|
211 /** |
|
212 * Starts or pauses recording |
|
213 */ |
|
214 IMPORT_C void RecordL( TBool aRecord ); |
|
215 |
|
216 /** |
|
217 * Tells whether recording is paused or not |
|
218 */ |
|
219 IMPORT_C TBool IsRecording(); |
|
220 |
|
221 |
|
222 public: // implementation of virtual API from CMusEngMceOutSession |
|
223 |
|
224 /** |
|
225 * Resumes previously paused session. |
|
226 * Continues using viewfinder and enables streaming video. |
|
227 * |
|
228 */ |
|
229 IMPORT_C void PlayL(); |
|
230 |
|
231 /** |
|
232 * Pauses session. |
|
233 * Holds display and disables streaming video to network. |
|
234 * |
|
235 */ |
|
236 IMPORT_C void PauseL(); |
|
237 |
|
238 /** |
|
239 * Tells whether session is paused or not |
|
240 */ |
|
241 IMPORT_C TBool IsPlayingL(); |
|
242 |
|
243 |
|
244 protected: // inherited from CMusEngMceOutSession |
|
245 |
|
246 /** |
|
247 * @param aLocalBundle All local streams are supposed to be added to |
|
248 * this bundle |
|
249 */ |
|
250 void CompleteSessionStructureL( CMceStreamBundle& aLocalBundle ); |
|
251 |
|
252 |
|
253 private: // overrides ancestor class versions |
|
254 |
|
255 /** |
|
256 * The state of the session has changed |
|
257 * @param aSession, the session that has changed. |
|
258 */ |
|
259 virtual void HandleSessionStateChanged( CMceSession& aSession, |
|
260 TInt aStatusCode, |
|
261 const TDesC8& aReasonPhrase ); |
|
262 |
|
263 /** |
|
264 * Sets Multimediasharing specific video codec settings like video |
|
265 * bitrate maxbitrate. This functions gets called for every video codec |
|
266 * in session. This function overrides function in ancestor classes. |
|
267 * Function calls also overridden version. |
|
268 */ |
|
269 virtual void AdjustVideoCodecL( CMceVideoCodec& aVideoCodec ); |
|
270 |
|
271 /** |
|
272 * Sets Multimediasharing specific audio codec settings. This functions |
|
273 * gets called for every audio codec in session. This function overrides |
|
274 * function in base class. Function calls also overridden version. |
|
275 */ |
|
276 virtual void AdjustAudioCodecL( CMceAudioCodec& aAudioCodec ); |
|
277 |
|
278 /** |
|
279 * Removes AVC if known that it is not supported |
|
280 */ |
|
281 virtual void DoCodecSelectionL( CMceVideoStream& aVideoStream ); |
|
282 |
|
283 |
|
284 private: // from MMceStreamObserver, |
|
285 // overrides the function in CMusEngMceSession |
|
286 |
|
287 /** |
|
288 * The state of the sink has changed. |
|
289 * |
|
290 * @param aStream, the stream that uses the sink. |
|
291 * @param aSink, the sink that has changed. |
|
292 */ |
|
293 void StreamStateChanged( CMceMediaStream& aStream, |
|
294 CMceMediaSink& aSink ); |
|
295 |
|
296 |
|
297 private: |
|
298 |
|
299 /** |
|
300 * Constructor |
|
301 */ |
|
302 CMusEngLiveSession( MMusEngSessionObserver& aSessionObserver, |
|
303 MMusEngOutSessionObserver& aOutSessionObserver, |
|
304 MMusEngLiveSessionObserver& aLiveSessionObserver, |
|
305 const TRect& aRect, |
|
306 const TDesC& aRecordedFile = KNullDesC ); |
|
307 |
|
308 /** |
|
309 * Second-phase constructor |
|
310 */ |
|
311 void ConstructL( TUint aSipProfileId ); |
|
312 |
|
313 |
|
314 private: // Helpers |
|
315 |
|
316 /** |
|
317 * Reads from CenRep and sets encoding device for a codec. |
|
318 */ |
|
319 void SetEncodingDeviceL( CMceVideoCodec& aVideoCodec ); |
|
320 |
|
321 /** |
|
322 * Sets configuration key for a codec |
|
323 */ |
|
324 void SetCodecConfigKeyL( CMceVideoCodec& aVideoCodec ); |
|
325 |
|
326 /** |
|
327 * Reads proper configuration key for a codec. NULL if not available. |
|
328 * Ownership is transferred. |
|
329 */ |
|
330 HBufC8* ReadCodecConfigKeyL( const CMceVideoCodec& aVideoCodec ) const; |
|
331 |
|
332 /** |
|
333 * Constructs and stores to cenrep a concatenation of all AVC config keys. |
|
334 */ |
|
335 void StoreEncoderConfigInfoL() const; |
|
336 |
|
337 /** |
|
338 * Returns config key id for the provided codec. Ownership is transferred |
|
339 */ |
|
340 const TPtrC8 ConfigKeyIdL( const CMceVideoCodec& aVideoCodec ) const; |
|
341 |
|
342 |
|
343 /** |
|
344 * Calculate the zoom step size based time escaped. |
|
345 * |
|
346 * @param aTime, start time. pass iZoomInTime or iZoomOutTime as parameter |
|
347 * @return TInt, return calculate result of the step size |
|
348 */ |
|
349 TInt ZoomStepSize( TInt64& aTime ); |
|
350 |
|
351 /** |
|
352 * Calculates iMinZoomStep and iMaxZoomStep zoom step sizes, |
|
353 * should be called before first ZoomIn()/ZoomOut() call |
|
354 */ |
|
355 void InitializeZoomStepSize(); |
|
356 |
|
357 |
|
358 private: |
|
359 |
|
360 /** |
|
361 * Reference to live session observer interface. |
|
362 */ |
|
363 MMusEngLiveSessionObserver& iLiveSessionObserver; |
|
364 |
|
365 /** |
|
366 * |
|
367 */ |
|
368 TCameraInfo iCameraInfo; |
|
369 |
|
370 /** |
|
371 * |
|
372 */ |
|
373 TInt iDefaultZoomFactor; |
|
374 |
|
375 /** |
|
376 * |
|
377 */ |
|
378 TInt iDefaultBrightness; |
|
379 |
|
380 /** |
|
381 * File name for recording. If KNullDesC no recording performed. |
|
382 */ |
|
383 TFileName iRecordedFile; |
|
384 |
|
385 /** |
|
386 * If true, configuration key of current AVC codec must be written to |
|
387 * CenRep after session establishment. |
|
388 */ |
|
389 TBool iStoreEncoderConfigInfo; |
|
390 |
|
391 /** |
|
392 * latest Zoomin time |
|
393 */ |
|
394 |
|
395 TInt64 iZoomInTime; |
|
396 |
|
397 /** |
|
398 * latest Zoomout time |
|
399 */ |
|
400 TInt64 iZoomOutTime; |
|
401 |
|
402 /** |
|
403 * |
|
404 */ |
|
405 TInt iSmallZoomStep; |
|
406 |
|
407 /** |
|
408 * |
|
409 */ |
|
410 TInt iBigZoomStep; |
|
411 |
|
412 }; |
|
413 |
|
414 #endif |
|
415 |