mmsharing/mmshengine/inc/musengreceivesession.h
changeset 22 496ad160a278
equal deleted inserted replaced
15:ccd8e69b5392 22:496ad160a278
       
     1 /*
       
     2 * Copyright (c) 2006 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 MUSHENGREVEIVESESSION_H
       
    20 #define MUSHENGREVEIVESESSION_H
       
    21 
       
    22 // INCLUDES
       
    23 #include "musengmcesession.h"
       
    24 #include "musenguriparser.h"
       
    25 #include "musunittesting.h"
       
    26 #include <mcemediasink.h>
       
    27 
       
    28 // FORWARD DECLARATIONS
       
    29 class MMusEngReceiveSessionObserver;
       
    30 class CMceInSession;
       
    31 class CMusEngRemoteVideoPlayer;
       
    32 
       
    33 
       
    34 class CMusEngReceiveSession : 
       
    35     public CMusEngMceSession
       
    36     {
       
    37     MUS_UNITTEST( UT_CMusEngMceSession )
       
    38     MUS_UNITTEST( UT_CMusEngReceiveSession )
       
    39     
       
    40     public: // Contructors and destructor
       
    41 
       
    42        /**
       
    43         * Creates new MultimediaSharing Receive session.
       
    44         * @return CMusEngReceiveSession* New instanse of specified class
       
    45         */
       
    46         static CMusEngReceiveSession* NewL();
       
    47         
       
    48        /**
       
    49         * Destructor
       
    50         *
       
    51         * @since S60 v3.2
       
    52         */
       
    53         ~CMusEngReceiveSession();
       
    54    
       
    55     public: // From MLcSession
       
    56         
       
    57         TLcSessionState LcSessionState() const;
       
    58         
       
    59         void EstablishLcSessionL();
       
    60         
       
    61         void TerminateLcSessionL(); 
       
    62         
       
    63         MLcVideoPlayer* RemoteVideoPlayer();    
       
    64         
       
    65         const TDesC& RemoteDisplayName();         
       
    66         
       
    67     protected: // Overrides function in CMusEngMceSession
       
    68     
       
    69         /**
       
    70         * The state of the session has changed.
       
    71         *
       
    72         * @since S60 v3.2
       
    73         * @param aSession, the session that has changed.
       
    74         */
       
    75         virtual void HandleSessionStateChanged( CMceSession& aSession,
       
    76                                                 TInt aStatusCode,
       
    77                                                 const TDesC8& aReasonPhrase );
       
    78         
       
    79         /**
       
    80         * Sets Multimediasharing specific video codec settings like keepalive
       
    81         * timer. This functions gets called for every video codec in 
       
    82         * session. This function overrides function in base class. 
       
    83         * Function calls also overridden version.
       
    84         */ 
       
    85         virtual void AdjustVideoCodecL( CMceVideoCodec& aVideoCodec,
       
    86                                         TMceSourceType aSourceType );
       
    87         
       
    88         /**
       
    89         * Sets Multimediasharing specific audio codec settings like keepalive
       
    90         * timer. This functions gets called for every audio 
       
    91         * codec in session.  This function overrides function in base class. 
       
    92         * Function calls also overridden version.
       
    93         */ 
       
    94         virtual void AdjustAudioCodecL( CMceAudioCodec& aAudioCodec );
       
    95         
       
    96         /**
       
    97         * Removes multiples of H.263 codec, prefers H263-2000 over H263-1998.
       
    98         * Additionally selects just the one with best quality from selected mode.
       
    99         * Removes all the H.263 codecs if any AVC codecs found. Prefers
       
   100         * non-interleaved AVC over single NAL AVC
       
   101         * @param aVideoStream
       
   102         */
       
   103         virtual void DoCodecSelectionL( CMceVideoStream& aVideoStream );
       
   104         
       
   105     protected: // from MMceInSessionObserver
       
   106                // overrides the function in CMusEngMceSession
       
   107 
       
   108         /**
       
   109 	    * Incoming session invitation. The CMCEInSession is given to the
       
   110 		* application as a callback.
       
   111 	    * @param aSession, pointer to the incoming session. Ownership is
       
   112 		*	     transferred.
       
   113 	    * @param aContainer, if present, holds details of
       
   114 	    *        transaction causing state change.
       
   115 	    */
       
   116         void IncomingSession(
       
   117 	                CMceInSession* aSession,
       
   118     				TMceTransactionDataContainer* aContainer );
       
   119     				
       
   120     				
       
   121 	    /**
       
   122 	    * Incoming session update. The new updated CMCEInSession is given to the
       
   123 		* application as a callback.
       
   124 	    * @param aOrigSession, the original session to be updated. This instance
       
   125 	    *        cannot be used anymore, all actions done using aUpdatedSession 
       
   126 	    *        instance.
       
   127 	    * @param aUpdatedSession, pointer to the new updated session. Ownership 
       
   128 	    *        is transferred.
       
   129 	    * @param aContainer, if present, holds details of update transaction.
       
   130 	    */
       
   131 		void IncomingUpdate(
       
   132 					CMceSession& aOrigSession, 
       
   133 					CMceInSession* aUpdatedSession,
       
   134     				TMceTransactionDataContainer* aContainer );
       
   135 
       
   136 
       
   137     protected: // from MMceStreamObserver, 
       
   138              // overrides the function in CMusEngMceSession
       
   139 
       
   140         /**
       
   141         * The state of the stream has changed.
       
   142         *
       
   143         * @since S60 v3.2
       
   144         * @param aStream, the stream that uses the source.
       
   145         */
       
   146         void StreamStateChanged( CMceMediaStream& aStream );
       
   147     
       
   148     protected: // from MMceRtpObserver
       
   149 
       
   150         void InactivityTimeout( CMceMediaStream& aStream,
       
   151                                 CMceRtpSource& aSource );
       
   152 
       
   153 
       
   154 
       
   155     protected: // CONSTRUCTORS
       
   156     
       
   157         CMusEngReceiveSession();
       
   158 
       
   159 		void ConstructL();
       
   160 		
       
   161     protected: // HELPERS
       
   162     
       
   163         CMceInSession* InSession();
       
   164         
       
   165         void PrepareToRequire100RelL( 
       
   166             TMceTransactionDataContainer* aContainer );
       
   167         
       
   168         virtual void CompleteSessionStructureL();
       
   169         
       
   170          /**
       
   171          * Parse P-Asserted-Identity header. 
       
   172          * Tries to fetch the telephone number from tel uri, 
       
   173          * if tel uri not found it suppose that telephone number
       
   174          * is in sip url. 
       
   175          */
       
   176         void ParseAssertedIdentity( TMceTransactionDataContainer* aContainer );
       
   177         /*
       
   178          * Checks for buffering event happened & receiving already not started
       
   179          *      If yes, start the RTP inactivity timer and indicate to observer
       
   180          *              about videoplayer state change.
       
   181          *      else will not do anything. Bascially ignores the event.
       
   182          */
       
   183         void ReceivingStarted();
       
   184         
       
   185         /**
       
   186         * Checks for receiving already started and display sink is enabled
       
   187         *        If yes ETrue else otherwise.
       
   188         */
       
   189         TBool IsDisplayActive();
       
   190         
       
   191     protected: // DATA
       
   192     
       
   193         // Set to ETrue if CMceInSession::RingL has already been called
       
   194         TBool iRingLCalled;
       
   195         
       
   196         // identity of originator parsed form P-Asserted-Identity field
       
   197         TBuf8<KMaxUriLength> iIdentity;
       
   198         
       
   199         HBufC8* iOriginator;
       
   200         
       
   201         HBufC* iRemoteDisplayName;
       
   202        
       
   203         /// The remote video player implementing MLcVideoPlayer
       
   204         CMusEngRemoteVideoPlayer* iRemoteVideoPlayer;
       
   205         
       
   206         TUint32 iReceivingInactivityTimeout;
       
   207         
       
   208         TUint8 iKeepaliveTimer;
       
   209         
       
   210     private:
       
   211         /* Flag for whether receiving started. It will go EFalse
       
   212          * when RTP inactivity timeout happen.
       
   213          */
       
   214         TBool iReceiving;               
       
   215         /* Flag to indicate buffering event happened. This flag is for
       
   216          * optimization purpose since buffering event is the only place 
       
   217          * we can be sure about some packets were received.
       
   218          */
       
   219         TBool iBuffered;
       
   220     };
       
   221 
       
   222 #endif
       
   223