14 * Description: |
14 * Description: |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 |
18 |
19 #ifndef MUSENGMCESESSION_H |
19 #ifndef MUSHENGMCESESSION_H |
20 #define MUSENGMCESESSION_H |
20 #define MUSHENGMCESESSION_H |
21 |
21 |
22 // USER |
22 // USER |
|
23 #include "musengsession.h" |
23 #include "musengsessiondurationtimerobserver.h" |
24 #include "musengsessiondurationtimerobserver.h" |
24 #include "musunittesting.h" |
25 #include "musunittesting.h" |
25 #include "mussipprofileuser.h" |
26 #include "mussipprofileuser.h" |
26 #include "musengdisplayhandler.h" |
|
27 #include "musengaudioroutingobserver.h" |
|
28 |
27 |
29 // SYSTEM |
28 // SYSTEM |
30 #include <lcsession.h> |
|
31 #include <lcaudiocontrol.h> |
|
32 #include <mcesessionobserver.h> |
29 #include <mcesessionobserver.h> |
33 #include <mceinsessionobserver.h> |
30 #include <mceinsessionobserver.h> |
34 #include <mcestreamobserver.h> |
31 #include <mcestreamobserver.h> |
35 #include <mcertpobserver.h> |
32 #include <mcertpobserver.h> |
36 #include <mcetransactiondatacontainer.h> |
33 #include <mcetransactiondatacontainer.h> |
37 #include <mcemediasource.h> |
34 |
38 |
|
39 // FORWARD DECLARATIONS |
|
40 class CMceManager; |
35 class CMceManager; |
41 class CMceSession; |
36 class CMceSession; |
42 class CMceVideoStream; |
37 class CMceVideoStream; |
43 class CMceAudioStream; |
38 class CMceAudioStream; |
44 class CMceVideoCodec; |
39 class CMceVideoCodec; |
45 class CMceAudioCodec; |
40 class CMceAudioCodec; |
46 class CMusEngSessionDurationTimer; |
41 class CMusEngSessionDurationTimer; |
|
42 class MMusEngSessionObserver; |
47 class CMusSipProfileHandler; |
43 class CMusSipProfileHandler; |
48 class CMusEngTelephoneUtils; |
|
49 class MMusEngAudioRoutingObserver; |
|
50 class MLcSessionObserver; |
|
51 |
44 |
52 // CONSTANTS |
45 // CONSTANTS |
53 |
46 |
54 _LIT8( KMusEngAcceptContactHeader, |
47 _LIT8( KMusEngAcceptContactHeader, |
55 "Accept-Contact: *;+g.3gpp.cs-voice; explicit" ); |
48 "Accept-Contact: *;+g.3gpp.cs-voice; explicit" ); |
56 _LIT8( KMusAcceptHeader, |
49 _LIT8( KMusAcceptHeader, |
57 "Accept: application/sdp" ); |
50 "Accept: application/sdp" ); |
58 _LIT8( KMusEngSessionSdpLineXApplication, "a=X-application:com.nokia.rtvs\r\n" ); |
51 _LIT8( KMusEngSessionSdpLineXApplication, "a=X-application:com.nokia.rtvs\r\n" ); |
59 _LIT8( KMusEngSessionSdpLineApplication , "a=application:com.gsma.rts\r\n" ); |
52 _LIT8( KMusEngSessionSdpLineApplication , "a=application:com.gsma.rts\r\n" ); |
60 _LIT8( KMusEngSessionSdpLineType, "a=type:videolive\r\n" ); |
53 _LIT8( KMusEngSessionSdpLineType, "a=type:videolive\r\n" ); |
61 _LIT8( KMusEngSessionSdpLineBandwidthLine , "b=AS:" ); |
54 _LIT8( KMusEngSessionSdpLineBandwidthLine , "b=AS" ); |
62 _LIT8( KMusEngSessionSdpLineBandwidthField , "b=AS:85\r\n" ); |
55 _LIT8( KMusEngSessionSdpLineBandwidthField , "b=AS:85\r\n" ); |
63 _LIT8( KMusEngSessionSdpLineTiasLine , "b=TIAS:" ); |
|
64 _LIT8( KMusPPreferredIdentity, "P-Preferred-Identity" ); |
56 _LIT8( KMusPPreferredIdentity, "P-Preferred-Identity" ); |
65 _LIT8( KMusEngNewLine , "\r\n" ); |
57 _LIT8( KMusPrivacyHeader, "Privacy" ); |
66 |
58 _LIT8( KMusAnonymousHeader, "\"Anonymous\" <sip:anonymous@anonymous.invalid>" ); |
67 const TInt KMusTiasMultiplier = 1000; |
59 |
68 const TUint8 KMusEngRtpKeepAliveTimer = 5; |
60 const TInt KMusEngMaxVolume = 10; |
69 const TUint8 KMusEngKeepAlivePayloadTypeVideoH263 = 96; |
61 const TInt KMusEngMinVolume = 0; |
70 const TUint8 KMusEngKeepAlivePayloadTypeAudio = 97; |
|
71 const TUint8 KMusEngKeepAlivePayloadTypeVideoAvc = 98; |
|
72 |
|
73 // Value for uninitialized rect |
|
74 const TInt KMusEngRectNotInit = 1000; |
|
75 |
62 |
76 // CLASS DECLARATION |
63 // CLASS DECLARATION |
77 |
64 |
78 /** |
65 /** |
79 * Base class for Multimedia Sharing Engine MCE sessions, inherited by |
66 * Base class for Multimedia Sharing Engine MCE sessions, inherited by |
83 * MCE Sessions to user interface. Also splits observers messy events |
70 * MCE Sessions to user interface. Also splits observers messy events |
84 * to simplified function calls. |
71 * to simplified function calls. |
85 * |
72 * |
86 * @lib musengine.lib |
73 * @lib musengine.lib |
87 */ |
74 */ |
88 class CMusEngMceSession : public CBase, |
75 class CMusEngMceSession : public CMusEngSession, |
89 public MLcSession, |
|
90 public MLcAudioControl, |
|
91 public MMceSessionObserver, |
76 public MMceSessionObserver, |
92 public MMceInSessionObserver, |
77 public MMceInSessionObserver, |
93 public MMceStreamObserver, |
78 public MMceStreamObserver, |
94 public MMceRtpObserver, |
79 public MMceRtpObserver, |
95 public MMusEngSessionDurationTimerObserver, |
80 public MMusEngSessionDurationTimerObserver, |
96 public MMusSipProfileUser, |
81 public MMusSipProfileUser |
97 public MMusEngDisplayHandler, |
|
98 public MMusEngAudioRoutingObserver |
|
99 { |
82 { |
|
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 |
100 public: |
95 public: |
101 |
96 |
102 /** |
97 /** |
103 * Destructor |
98 * Destructor |
104 */ |
99 */ |
105 ~CMusEngMceSession(); |
100 ~CMusEngMceSession(); |
106 |
101 |
107 |
102 |
108 public: // from MMusEngDisplayHandler |
103 public: // API FUNCTIONS |
109 |
104 |
110 /** |
105 /** |
111 * Returns currently assigned drawing area |
106 * Terminates session. |
112 * |
107 * |
113 * @return TRect This session drawing area rectangle |
108 * @pre Session is established |
114 */ |
109 * @post Session is ready to be deleted |
115 TRect Rect() const; |
110 * @leave KErrNotReady if precondition is not fullfilled |
116 |
111 */ |
117 /** |
112 IMPORT_C void TerminateL(); |
118 * Sets new drawing area |
113 |
119 * |
114 /** |
120 * @param TRect This session new drawing area rectangle |
115 * Get session time return estabilished session time |
121 */ |
116 * |
122 void SetRectL( const TRect& aRect ); |
117 * @return TTime returns time if connection established else < 0 |
123 |
118 */ |
124 /** |
119 IMPORT_C TTimeIntervalSeconds GetSessionTime() const; |
125 * Sets secondary rect (e.g. viewfinder in twoway session) |
120 |
126 * @param TRect This session new secondary drawing area rectangle |
121 /** |
127 */ |
122 * Returns current connection state |
128 void SetSecondaryRectL( const TRect& aSecondaryRect ); |
123 * |
129 |
124 * @return TBool returns current connection state |
130 /** |
125 */ |
131 * Gets secondary rect. |
126 IMPORT_C TBool ConnectionActive() const; |
132 * @return TRect This session secondary drawing area rectangle |
127 |
133 */ |
128 /** |
134 virtual TRect SecondaryRect() const; |
129 * Returns presence or absence of audio in session. |
135 |
130 * |
|
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 |
136 /** |
147 /** |
137 * Returns current display orientation. |
148 * Returns current display orientation. |
138 * |
149 * |
139 * @pre Session is ongoing |
150 * @pre Session is ongoing |
140 * @return Current display orientation |
151 * @return Current display orientation |
141 * @leave KErrNotReady if precondition is not fullfilled |
152 * @leave KErrNotReady if precondition is not fullfilled |
142 */ |
153 */ |
143 TDisplayOrientation OrientationL(); |
154 IMPORT_C TDisplayOrientation OrientationL(); |
144 |
155 |
145 /** |
156 /** |
146 * Sets display orientation. |
157 * Sets display orientation. |
147 * |
158 * |
148 * @pre Session is ongoing |
159 * @pre Session is ongoing |
149 * @return Sets display orientation |
160 * @return Sets display orientation |
150 * @leave KErrNotReady if precondition is not fullfilled |
161 * @leave KErrNotReady if precondition is not fullfilled |
151 */ |
162 */ |
152 void SetOrientationL( TDisplayOrientation aOrientation ); |
163 IMPORT_C 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 ); |
153 |
199 |
154 /** |
200 /** |
155 * Permission to draw on screen device. |
201 * Permission to draw on screen device. |
156 * |
202 * |
157 * @pre Session is ongoing |
203 * @pre Session is ongoing |
158 */ |
204 */ |
159 void EnableDisplayL( TBool aEnable ); |
205 IMPORT_C void EnableDisplayL( TBool aEnable ); |
160 |
206 |
161 /** |
207 /** |
162 * Implements virtual from MMusEngDisplayHandler |
208 * Implements virtual from CMusEngSession |
163 * |
209 * |
164 * @pre Session is ongoing |
210 * @pre Session is ongoing |
165 */ |
211 */ |
166 TBool IsDisplayEnabled(); |
212 IMPORT_C void MuteL(); |
167 |
213 |
168 /** |
214 /** |
169 * Implements virtual from MMusEngDisplayHandler |
215 * Implements virtual from CMusEngSession |
170 * |
216 * |
171 * @pre Session is ongoing |
217 * @pre Session is ongoing |
172 */ |
218 */ |
173 TBool IsDisplayActive(); |
219 IMPORT_C void UnmuteL(); |
174 |
220 |
175 |
221 void RefreshOrientationL(); |
176 public: // From MMusEngAudioRoutingObserver |
222 |
177 |
223 |
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 |
|
242 protected: // CONSTRUCTORS |
224 protected: // CONSTRUCTORS |
243 |
225 |
244 /** |
226 /** |
245 * Constructor |
227 * Constructor |
246 * |
228 * |
247 */ |
229 */ |
248 CMusEngMceSession(); |
230 CMusEngMceSession( const TRect& aRect, |
|
231 MMusEngSessionObserver& aSessionObserver ); |
249 |
232 |
250 /** |
233 /** |
251 * Second-phase constructor |
234 * Second-phase constructor |
|
235 * |
252 */ |
236 */ |
253 void ConstructL(); |
237 void ConstructL(); |
254 |
238 |
255 |
239 |
256 protected: // VIRTUAL HELPER FUNCTIONS |
240 protected: // VIRTUAL HELPER FUNCTIONS |
557 |
516 |
558 void DoBitrateBasedRemovalL( CMceVideoStream& aVideoStream, |
517 void DoBitrateBasedRemovalL( CMceVideoStream& aVideoStream, |
559 const CMceVideoCodec& aBestBitrateVideoCodec ); |
518 const CMceVideoCodec& aBestBitrateVideoCodec ); |
560 |
519 |
561 void DoCodecModeBasedRemovalL( CMceVideoStream& aVideoStream ); |
520 void DoCodecModeBasedRemovalL( CMceVideoStream& aVideoStream ); |
562 |
521 /** |
563 /** |
522 * This function currently used to remove the AVC codec support based on |
564 * Get session time return estabilished session time |
523 * cenrep encoder device uid value. |
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 |
|
612 */ |
524 */ |
613 TUid iMceManagerUid; |
525 void DoCodecConfigurationBasedRemovalL( CMceVideoStream& aVideoStream ); |
|
526 |
|
527 |
|
528 protected: // MEMBERS |
|
529 |
|
530 /** |
|
531 * Callback reference to session observer interface. |
|
532 */ |
|
533 MMusEngSessionObserver& iSessionObserver; |
614 |
534 |
615 /** |
535 /** |
616 * Class for connecting to MCE server. |
536 * Class for connecting to MCE server. |
617 * This class provides the connection to the MCE server and |
537 * This class provides the connection to the MCE server and |
618 * provides functions |
538 * provides functions |