14 * Description: |
14 * Description: |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 |
18 |
19 #ifndef MUSHENGMCESESSION_H |
19 #ifndef MUSENGMCESESSION_H |
20 #define MUSHENGMCESESSION_H |
20 #define MUSENGMCESESSION_H |
21 |
21 |
22 // USER |
22 // USER |
23 #include "musengsession.h" |
|
24 #include "musengsessiondurationtimerobserver.h" |
23 #include "musengsessiondurationtimerobserver.h" |
25 #include "musunittesting.h" |
24 #include "musunittesting.h" |
26 #include "mussipprofileuser.h" |
25 #include "mussipprofileuser.h" |
|
26 #include "musengdisplayhandler.h" |
|
27 #include "musengaudioroutingobserver.h" |
27 |
28 |
28 // SYSTEM |
29 // SYSTEM |
|
30 #include <lcsession.h> |
|
31 #include <lcaudiocontrol.h> |
29 #include <mcesessionobserver.h> |
32 #include <mcesessionobserver.h> |
30 #include <mceinsessionobserver.h> |
33 #include <mceinsessionobserver.h> |
31 #include <mcestreamobserver.h> |
34 #include <mcestreamobserver.h> |
32 #include <mcertpobserver.h> |
35 #include <mcertpobserver.h> |
33 #include <mcetransactiondatacontainer.h> |
36 #include <mcetransactiondatacontainer.h> |
34 |
37 #include <mcemediasource.h> |
|
38 |
|
39 // FORWARD DECLARATIONS |
35 class CMceManager; |
40 class CMceManager; |
36 class CMceSession; |
41 class CMceSession; |
37 class CMceVideoStream; |
42 class CMceVideoStream; |
38 class CMceAudioStream; |
43 class CMceAudioStream; |
39 class CMceVideoCodec; |
44 class CMceVideoCodec; |
40 class CMceAudioCodec; |
45 class CMceAudioCodec; |
41 class CMusEngSessionDurationTimer; |
46 class CMusEngSessionDurationTimer; |
42 class MMusEngSessionObserver; |
|
43 class CMusSipProfileHandler; |
47 class CMusSipProfileHandler; |
|
48 class CMusEngTelephoneUtils; |
|
49 class MMusEngAudioRoutingObserver; |
|
50 class MLcSessionObserver; |
44 |
51 |
45 // CONSTANTS |
52 // CONSTANTS |
46 |
53 |
47 _LIT8( KMusEngAcceptContactHeader, |
54 _LIT8( KMusEngAcceptContactHeader, |
48 "Accept-Contact: *;+g.3gpp.cs-voice; explicit" ); |
55 "Accept-Contact: *;+g.3gpp.cs-voice; explicit" ); |
49 _LIT8( KMusAcceptHeader, |
56 _LIT8( KMusAcceptHeader, |
50 "Accept: application/sdp" ); |
57 "Accept: application/sdp" ); |
51 _LIT8( KMusEngSessionSdpLineXApplication, "a=X-application:com.nokia.rtvs\r\n" ); |
58 _LIT8( KMusEngSessionSdpLineXApplication, "a=X-application:com.nokia.rtvs\r\n" ); |
52 _LIT8( KMusEngSessionSdpLineApplication , "a=application:com.gsma.rts\r\n" ); |
59 _LIT8( KMusEngSessionSdpLineApplication , "a=application:com.gsma.rts\r\n" ); |
53 _LIT8( KMusEngSessionSdpLineType, "a=type:videolive\r\n" ); |
60 _LIT8( KMusEngSessionSdpLineType, "a=type:videolive\r\n" ); |
54 _LIT8( KMusEngSessionSdpLineBandwidthLine , "b=AS" ); |
61 _LIT8( KMusEngSessionSdpLineBandwidthLine , "b=AS:" ); |
55 _LIT8( KMusEngSessionSdpLineBandwidthField , "b=AS:85\r\n" ); |
62 _LIT8( KMusEngSessionSdpLineBandwidthField , "b=AS:85\r\n" ); |
|
63 _LIT8( KMusEngSessionSdpLineTiasLine , "b=TIAS:" ); |
56 _LIT8( KMusPPreferredIdentity, "P-Preferred-Identity" ); |
64 _LIT8( KMusPPreferredIdentity, "P-Preferred-Identity" ); |
57 _LIT8( KMusPrivacyHeader, "Privacy" ); |
65 _LIT8( KMusEngNewLine , "\r\n" ); |
58 _LIT8( KMusAnonymousHeader, "\"Anonymous\" <sip:anonymous@anonymous.invalid>" ); |
66 |
59 |
67 const TInt KMusTiasMultiplier = 1000; |
60 const TInt KMusEngMaxVolume = 10; |
68 const TUint8 KMusEngRtpKeepAliveTimer = 5; |
61 const TInt KMusEngMinVolume = 0; |
69 const TUint8 KMusEngKeepAlivePayloadTypeVideoH263 = 96; |
|
70 const TUint8 KMusEngKeepAlivePayloadTypeAudio = 97; |
|
71 const TUint8 KMusEngKeepAlivePayloadTypeVideoAvc = 98; |
|
72 |
|
73 // Value for uninitialized rect |
|
74 const TInt KMusEngRectNotInit = 1000; |
62 |
75 |
63 // CLASS DECLARATION |
76 // CLASS DECLARATION |
64 |
77 |
65 /** |
78 /** |
66 * Base class for Multimedia Sharing Engine MCE sessions, inherited by |
79 * Base class for Multimedia Sharing Engine MCE sessions, inherited by |
70 * MCE Sessions to user interface. Also splits observers messy events |
83 * MCE Sessions to user interface. Also splits observers messy events |
71 * to simplified function calls. |
84 * to simplified function calls. |
72 * |
85 * |
73 * @lib musengine.lib |
86 * @lib musengine.lib |
74 */ |
87 */ |
75 class CMusEngMceSession : public CMusEngSession, |
88 class CMusEngMceSession : public CBase, |
|
89 public MLcSession, |
|
90 public MLcAudioControl, |
76 public MMceSessionObserver, |
91 public MMceSessionObserver, |
77 public MMceInSessionObserver, |
92 public MMceInSessionObserver, |
78 public MMceStreamObserver, |
93 public MMceStreamObserver, |
79 public MMceRtpObserver, |
94 public MMceRtpObserver, |
80 public MMusEngSessionDurationTimerObserver, |
95 public MMusEngSessionDurationTimerObserver, |
81 public MMusSipProfileUser |
96 public MMusSipProfileUser, |
|
97 public MMusEngDisplayHandler, |
|
98 public MMusEngAudioRoutingObserver |
82 { |
99 { |
83 |
|
84 public: |
|
85 |
|
86 /* |
|
87 * Defines possible rotations |
|
88 */ |
|
89 enum TDisplayOrientation |
|
90 { |
|
91 EPortrait, // Normal |
|
92 ELandscape // 90 degree's clockwise rotation |
|
93 }; |
|
94 |
|
95 public: |
100 public: |
96 |
101 |
97 /** |
102 /** |
98 * Destructor |
103 * Destructor |
99 */ |
104 */ |
100 ~CMusEngMceSession(); |
105 ~CMusEngMceSession(); |
101 |
106 |
102 |
107 |
103 public: // API FUNCTIONS |
108 public: // from MMusEngDisplayHandler |
104 |
109 |
105 /** |
110 /** |
106 * Terminates session. |
111 * Returns currently assigned drawing area |
107 * |
112 * |
108 * @pre Session is established |
113 * @return TRect This session drawing area rectangle |
109 * @post Session is ready to be deleted |
114 */ |
110 * @leave KErrNotReady if precondition is not fullfilled |
115 TRect Rect() const; |
111 */ |
116 |
112 IMPORT_C void TerminateL(); |
117 /** |
113 |
118 * Sets new drawing area |
114 /** |
119 * |
115 * Get session time return estabilished session time |
120 * @param TRect This session new drawing area rectangle |
116 * |
121 */ |
117 * @return TTime returns time if connection established else < 0 |
122 void SetRectL( const TRect& aRect ); |
118 */ |
123 |
119 IMPORT_C TTimeIntervalSeconds GetSessionTime() const; |
124 /** |
120 |
125 * Sets secondary rect (e.g. viewfinder in twoway session) |
121 /** |
126 * @param TRect This session new secondary drawing area rectangle |
122 * Returns current connection state |
127 */ |
123 * |
128 void SetSecondaryRectL( const TRect& aSecondaryRect ); |
124 * @return TBool returns current connection state |
129 |
125 */ |
130 /** |
126 IMPORT_C TBool ConnectionActive() const; |
131 * Gets secondary rect. |
127 |
132 * @return TRect This session secondary drawing area rectangle |
128 /** |
133 */ |
129 * Returns presence or absence of audio in session. |
134 virtual TRect SecondaryRect() const; |
130 * |
135 |
131 * @pre Session is ongoing |
|
132 * @return ETrue if session contains audio. |
|
133 * @leave KErrNotReady if precondition is not fullfilled |
|
134 */ |
|
135 IMPORT_C TBool ContainsAudioL(); |
|
136 |
|
137 /** |
|
138 * Returns state of local playback meaning if playback is muted or not. |
|
139 * |
|
140 * @pre Session is ongoing |
|
141 * @return ETrue if session does not contain audio or contained |
|
142 * audio is muted. |
|
143 * @leave KErrNotReady if precondition is not fullfilled |
|
144 */ |
|
145 IMPORT_C TBool IsMutedL(); |
|
146 |
|
147 /** |
136 /** |
148 * Returns current display orientation. |
137 * Returns current display orientation. |
149 * |
138 * |
150 * @pre Session is ongoing |
139 * @pre Session is ongoing |
151 * @return Current display orientation |
140 * @return Current display orientation |
152 * @leave KErrNotReady if precondition is not fullfilled |
141 * @leave KErrNotReady if precondition is not fullfilled |
153 */ |
142 */ |
154 IMPORT_C TDisplayOrientation OrientationL(); |
143 TDisplayOrientation OrientationL(); |
155 |
144 |
156 /** |
145 /** |
157 * Sets display orientation. |
146 * Sets display orientation. |
158 * |
147 * |
159 * @pre Session is ongoing |
148 * @pre Session is ongoing |
160 * @return Sets display orientation |
149 * @return Sets display orientation |
161 * @leave KErrNotReady if precondition is not fullfilled |
150 * @leave KErrNotReady if precondition is not fullfilled |
162 */ |
151 */ |
163 IMPORT_C void SetOrientationL( TDisplayOrientation aOrientation ); |
152 void SetOrientationL( TDisplayOrientation aOrientation ); |
164 |
|
165 /** |
|
166 * Returns state of the screen device. |
|
167 * |
|
168 * @pre Session is ongoing |
|
169 */ |
|
170 IMPORT_C TBool IsDisplayEnabledL(); |
|
171 |
|
172 public: // VIRTUAL API |
|
173 |
|
174 // No virtual api |
|
175 |
|
176 |
|
177 public: // from CMusEngSession |
|
178 |
|
179 /** |
|
180 * Increases volume level by one |
|
181 * |
|
182 * @pre Session is ongoing |
|
183 */ |
|
184 IMPORT_C void VolumeUpL(); |
|
185 |
|
186 /** |
|
187 * Decreases volume level by one |
|
188 * |
|
189 * @pre Session is ongoing |
|
190 */ |
|
191 IMPORT_C void VolumeDownL(); |
|
192 |
|
193 /** |
|
194 * Set volume value |
|
195 * @pre Session is ongoing |
|
196 * @param aVal the value of volume |
|
197 */ |
|
198 IMPORT_C void SetVolumeL( TInt aVal ); |
|
199 |
153 |
200 /** |
154 /** |
201 * Permission to draw on screen device. |
155 * Permission to draw on screen device. |
202 * |
156 * |
203 * @pre Session is ongoing |
157 * @pre Session is ongoing |
204 */ |
158 */ |
205 IMPORT_C void EnableDisplayL( TBool aEnable ); |
159 void EnableDisplayL( TBool aEnable ); |
206 |
160 |
207 /** |
161 /** |
208 * Implements virtual from CMusEngSession |
162 * Implements virtual from MMusEngDisplayHandler |
209 * |
163 * |
210 * @pre Session is ongoing |
164 * @pre Session is ongoing |
211 */ |
165 */ |
212 IMPORT_C void MuteL(); |
166 TBool IsDisplayEnabled(); |
213 |
167 |
214 /** |
168 /** |
215 * Implements virtual from CMusEngSession |
169 * Implements virtual from MMusEngDisplayHandler |
216 * |
170 * |
217 * @pre Session is ongoing |
171 * @pre Session is ongoing |
218 */ |
172 */ |
219 IMPORT_C void UnmuteL(); |
173 TBool IsDisplayActive(); |
220 |
174 |
221 void RefreshOrientationL(); |
175 |
222 |
176 public: // From MMusEngAudioRoutingObserver |
223 |
177 |
|
178 void AudioRoutingChanged(); |
|
179 |
|
180 |
|
181 public: // From MLcSession |
|
182 |
|
183 virtual TLcSessionState LcSessionState() const; |
|
184 |
|
185 void SetLcSessionObserver( MLcSessionObserver* aObserver ); |
|
186 |
|
187 void SetLcUiProvider( MLcUiProvider* aUiProvider ); |
|
188 |
|
189 virtual MLcVideoPlayer* RemoteVideoPlayer(); |
|
190 |
|
191 virtual MLcVideoPlayer* LocalVideoPlayer(); |
|
192 |
|
193 virtual const TDesC& LocalDisplayName(); |
|
194 |
|
195 virtual const TDesC& RemoteDisplayName(); |
|
196 |
|
197 TInt SetParameter( TInt aId, TInt aValue ); |
|
198 |
|
199 TInt ParameterValue( TInt aId ); |
|
200 |
|
201 TBool IsBackgroundStartup(); |
|
202 |
|
203 TInt SetForegroundStatus( TBool aIsForeground ); |
|
204 |
|
205 const TDesC& RemoteDetails(); |
|
206 |
|
207 void UpdateLcSessionL(); |
|
208 |
|
209 TBool SendDialTone( TChar aKey); |
|
210 |
|
211 |
|
212 public: // From MLcAudioControl |
|
213 |
|
214 TBool IsLcAudioMutedL(); |
|
215 |
|
216 void MuteLcAudioL( TBool aMute ); |
|
217 |
|
218 TBool IsLcMicMutedL(); |
|
219 |
|
220 void MuteLcMicL( TBool aMute ); |
|
221 |
|
222 TBool IsEnablingLcLoudspeakerAllowed(); |
|
223 |
|
224 void EnableLcLoudspeakerL( TBool aEnabled ); |
|
225 |
|
226 TBool IsLcLoudspeakerEnabled(); |
|
227 |
|
228 TInt LcVolumeL(); |
|
229 |
|
230 void SetLcVolumeL( TInt aValue ); |
|
231 |
|
232 void IncreaseLcVolumeL(); |
|
233 |
|
234 void DecreaseLcVolumeL(); |
|
235 |
|
236 public: |
|
237 |
|
238 MLcSessionObserver* LcSessionObserver(); |
|
239 |
|
240 MLcUiProvider* LcUiProvider(); |
|
241 |
224 protected: // CONSTRUCTORS |
242 protected: // CONSTRUCTORS |
225 |
243 |
226 /** |
244 /** |
227 * Constructor |
245 * Constructor |
228 * |
246 * |
229 */ |
247 */ |
230 CMusEngMceSession( const TRect& aRect, |
248 CMusEngMceSession(); |
231 MMusEngSessionObserver& aSessionObserver ); |
|
232 |
249 |
233 /** |
250 /** |
234 * Second-phase constructor |
251 * Second-phase constructor |
235 * |
|
236 */ |
252 */ |
237 void ConstructL(); |
253 void ConstructL(); |
238 |
254 |
239 |
255 |
240 protected: // VIRTUAL HELPER FUNCTIONS |
256 protected: // VIRTUAL HELPER FUNCTIONS |
516 |
557 |
517 void DoBitrateBasedRemovalL( CMceVideoStream& aVideoStream, |
558 void DoBitrateBasedRemovalL( CMceVideoStream& aVideoStream, |
518 const CMceVideoCodec& aBestBitrateVideoCodec ); |
559 const CMceVideoCodec& aBestBitrateVideoCodec ); |
519 |
560 |
520 void DoCodecModeBasedRemovalL( CMceVideoStream& aVideoStream ); |
561 void DoCodecModeBasedRemovalL( CMceVideoStream& aVideoStream ); |
521 /** |
562 |
522 * This function currently used to remove the AVC codec support based on |
563 /** |
523 * cenrep encoder device uid value. |
564 * Get session time return estabilished session time |
|
565 * @return TTime returns time if connection established else < 0 |
|
566 */ |
|
567 TTimeIntervalSeconds GetSessionTime() const; |
|
568 |
|
569 protected: |
|
570 |
|
571 /** |
|
572 * Reads from CenRep and sets encoding device for a codec. |
|
573 */ |
|
574 void SetEncodingDeviceL( CMceVideoCodec& aVideoCodec ); |
|
575 |
|
576 /** |
|
577 * Sets configuration key for a codec |
|
578 */ |
|
579 void SetCodecConfigKeyL( CMceVideoCodec& aVideoCodec ); |
|
580 |
|
581 /** |
|
582 * Reads proper configuration key for a codec. NULL if not available. |
|
583 * Ownership is transferred. |
|
584 */ |
|
585 HBufC8* ReadCodecConfigKeyL( const CMceVideoCodec& aVideoCodec ) const; |
|
586 |
|
587 /** |
|
588 * Constructs and stores to cenrep a concatenation of all AVC config keys. |
|
589 */ |
|
590 void StoreEncoderConfigInfoL() const; |
|
591 |
|
592 /** |
|
593 * Returns config key id for the provided codec. Ownership is transferred |
|
594 */ |
|
595 const TPtrC8 ConfigKeyIdL( const CMceVideoCodec& aVideoCodec ) const; |
|
596 |
|
597 |
|
598 protected: // Data |
|
599 |
|
600 /** |
|
601 * Drawing area rect. |
|
602 */ |
|
603 TRect iRect; |
|
604 |
|
605 /** |
|
606 * Telephone utilities. |
|
607 */ |
|
608 CMusEngTelephoneUtils* iTelephoneUtils; |
|
609 |
|
610 /** |
|
611 * UID used to identify application, needed to create MCE manager |
524 */ |
612 */ |
525 void DoCodecConfigurationBasedRemovalL( CMceVideoStream& aVideoStream ); |
613 TUid iMceManagerUid; |
526 |
|
527 |
|
528 protected: // MEMBERS |
|
529 |
|
530 /** |
|
531 * Callback reference to session observer interface. |
|
532 */ |
|
533 MMusEngSessionObserver& iSessionObserver; |
|
534 |
614 |
535 /** |
615 /** |
536 * Class for connecting to MCE server. |
616 * Class for connecting to MCE server. |
537 * This class provides the connection to the MCE server and |
617 * This class provides the connection to the MCE server and |
538 * provides functions |
618 * provides functions |