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