tsrc/mceclientstub/inc/mcertpsource.h
changeset 0 f0cf47e981f9
equal deleted inserted replaced
-1:000000000000 0:f0cf47e981f9
       
     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 CMCERTPSOURCE_H
       
    20 #define CMCERTPSOURCE_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <e32std.h>
       
    24 #include <mcemediasource.h>
       
    25 
       
    26 // CONSTANTS
       
    27 const TMceSourceType KMceRTPSource = 1;
       
    28 const TInt KMceJitterBufferLength = 10;
       
    29 const TInt KMceJitterBufferTreshold = 5;
       
    30 
       
    31 //FORWARD DECLARATIONS
       
    32 class TMceIds;
       
    33 
       
    34 // CLASS DECLARATION
       
    35 
       
    36 /**
       
    37 * Class representing incoming RTP stream in MCE.
       
    38 *
       
    39 * CMceRtpSource can be used to receive media data from network.
       
    40 * It can be configured with stream specific values to avoid
       
    41 * jitter generated by network. It may also be configured to
       
    42 * recognize separate media bursts instead of just receiving
       
    43 * continuous flow of data. 
       
    44 *
       
    45 * Events from this class can be received through class MMceRtpObserver.
       
    46 *
       
    47 * Enable and Disable operations to it are considered to be local, 
       
    48 * so they are not signalled to remote terminal.
       
    49 *
       
    50 * One CMceRTPSource may contain several RTP streams which are identified with
       
    51 * synchronization source (SSRC) values. Disabling or enabling CMceRtpSource
       
    52 * will affect to all SSRCs but streaming from specific SSRC can be also
       
    53 * controlled with EnableSSRCL and Disable SSRCL methods. These are also
       
    54 * local operations, thus not signalled to remote terminal.
       
    55 * 
       
    56 *  @lib mceclient.lib
       
    57 */
       
    58 class CMceRtpSource: public CMceMediaSource
       
    59 	{
       
    60 
       
    61 	public: // Constructors and destructor
       
    62 
       
    63 	    /**
       
    64 	    * Two-phased constructor.
       
    65 	    * @param aBufferLength, length in packets of jitter buffer
       
    66 	    * @param aBufferTreshold, treshold in packets of jitter buffer
       
    67 	    * @param aInactivityTimer, timer (ms) to detect network inactivity.
       
    68 	    *		 If 0, no activity detection, otherwise source is set to support
       
    69 	    *        talk bursts and report inactivity.
       
    70 	    * @param aIdentity, identity of user placed in RTCP, ownership not transferred.
       
    71 	    */
       
    72 		IMPORT_C static CMceRtpSource* NewL(
       
    73 									  TUint aBufferLength = KMceJitterBufferLength,
       
    74 									  TUint aBufferTreshold = KMceJitterBufferTreshold,
       
    75 									  TUint32 aInactivityTimer = 0,
       
    76 									  HBufC8* aIdentity = 0 );
       
    77 
       
    78 	    /**
       
    79 	    * Two-phased constructor.
       
    80 	    * @param aBufferLength, length in packets of jitter buffer
       
    81 	    * @param aBufferTreshold, treshold in packets of jitter buffer
       
    82 	    * @param aInactivityTimer, timer (ms) to detect network inactivity.
       
    83 	    *		 If 0, no activity detection, otherwise source is set to support
       
    84 	    *        talk bursts and report inactivity.
       
    85 	    * @param aIdentity, identity of user placed in RTCP, ownership not transferred.
       
    86 	    */
       
    87 		IMPORT_C static CMceRtpSource* NewLC(
       
    88 									  TUint aBufferLength = KMceJitterBufferLength,
       
    89 									  TUint aBufferTreshold = KMceJitterBufferTreshold,
       
    90 									  TUint32 aInactivityTimer = 0,
       
    91 									  HBufC8* aIdentity = 0 );
       
    92 									 
       
    93 	    /**
       
    94 	    * Destructor.
       
    95 	    */
       
    96 		IMPORT_C ~CMceRtpSource();
       
    97 
       
    98 	public: // From base class
       
    99 
       
   100 	    /**
       
   101 	    * Enables streaming explicitly.
       
   102 	    */
       
   103 		IMPORT_C void EnableL(); 
       
   104 
       
   105 	    /**
       
   106 	    * Disables streaming explicitly.
       
   107 	    */
       
   108 		IMPORT_C void DisableL(); 
       
   109 
       
   110 	public: // Functions
       
   111 
       
   112 	    /**
       
   113 	    * Enables RTP inactivity timer.
       
   114 	    * @param aInactivityTimer, timer value (ms) that after inactivity
       
   115 		*		 of media from network is reported to client.
       
   116 	    */
       
   117 		IMPORT_C void EnableInactivityTimerL( TUint32 aInactivityTimer ); 
       
   118 
       
   119 	    /**
       
   120 	    * Disables RTP inactivity timer.
       
   121 	    */
       
   122 		IMPORT_C void DisableInactivityTimerL(); 
       
   123 
       
   124 	    /**
       
   125 	    * Updates settings for incoming session.
       
   126 	    * @pre CMceSession::State() == CMceSession::EIncoming 
       
   127 	    * @param aBufferLength, length in packets of jitter buffer
       
   128 	    * @param aBufferTreshold, treshold in packets of jitter buffer
       
   129 	    * @param aInactivityTimer, timer (ms) to detect network inactivity.
       
   130 	    *		 If 0, no activity detection, otherwise source is set to support
       
   131 	    *        talk bursts and report inactivity.
       
   132 	    * @param aIdentity, identity of user placed in RTCP, ownership not transferred.
       
   133 	    */
       
   134 		IMPORT_C void UpdateL ( TUint aBufferLength = KMceJitterBufferLength,
       
   135 								TUint aBufferTreshold = KMceJitterBufferTreshold,
       
   136 								TUint32 aInactivityTimer = 0,
       
   137 								HBufC8* aIdentity = 0 );
       
   138 		
       
   139 		/**
       
   140 	    * Sends RTCP receiver report to recipient.
       
   141 	    */
       
   142 		IMPORT_C void SendRRL(); 
       
   143 
       
   144         /**
       
   145         * Returns the last RTP stream source identifier 
       
   146         * used in network (SSRC). 
       
   147         * @pre CMceSession::State() == CMceSession::EEstablished 
       
   148         * @return last source identifier used in network (SSRC).
       
   149         */
       
   150         IMPORT_C TUint32 Ssrc() const;
       
   151 
       
   152         /**
       
   153         * Gets an array of RTP synchronization source (SSRC) identifiers. 
       
   154         * Array includes all SSRC values this RtpSource has received RTP from.
       
   155         * Changes in array are notified using MMceRtpObserver interface.
       
   156         * @return array of synchronization source identifiers
       
   157         */ 
       
   158         IMPORT_C const RArray<TUint>& Ssrcs() const;			
       
   159 
       
   160         /**
       
   161         * Enables streaming from specified synchronization source (SSRC).
       
   162         * @param aSsrc synchronization source to be enabled
       
   163         */			
       
   164         IMPORT_C void EnableSsrcL( TUint aSsrc );
       
   165 
       
   166         /**
       
   167         * Disables streaming from specified synchronization source (SSRC).
       
   168         * @param aSsrc synchronization source to be disabled
       
   169         */			
       
   170         IMPORT_C void DisableSsrcL( TUint aSsrc );
       
   171 
       
   172         /**
       
   173         * Determines whether specific SSRC is enabled or not.
       
   174         * @param aSsrc the SSRC identifier
       
   175         * @return ETrue if specified SSRC is enabled; otherwise EFalse
       
   176         */			
       
   177         IMPORT_C TBool IsSsrcEnabledL( TUint aSsrc );
       
   178 
       
   179 	private:
       
   180 
       
   181 	    /**
       
   182 	    * C++ default constructor.
       
   183 	    */
       
   184 		CMceRtpSource();
       
   185 
       
   186 	    /**
       
   187 	    * second-phase constructor
       
   188 	    * @param aBufferLength, length in packets of jitter buffer
       
   189 	    * @param aBufferTreshold, treshold in packets of jitter buffer
       
   190 	    * @param aInactivityTimer, timer (ms) to detect network inactivity.
       
   191 	    *		 If 0, no activity detection, otherwise source is set to support
       
   192 	    *        talk burts and report inactivity.
       
   193 	    * @param aMediaBurstIndicator, indicator sound to be played before
       
   194 	    *        every new burst of media, if source in media burst mode.
       
   195 	    */
       
   196 		void ConstructL( TUint aBufferLength,
       
   197                          TUint aBufferTreshold,
       
   198                          TUint32 aInactivityTimer,
       
   199                          HBufC8* iMediaBurstIndicator );
       
   200 
       
   201 
       
   202 	public: // Stub data
       
   203 	
       
   204          RArray<TUint> iSsrcs;
       
   205 	
       
   206 	     TUint iBufferLength;
       
   207          TUint iBufferTreshold;
       
   208          TUint32 iInactivityTimer;
       
   209          TUint32 iSilenceTimer;
       
   210          TUint iToneFrequency;
       
   211          TUint iToneLength;
       
   212          HBufC8* iMediaBurstIndicator; 
       
   213          
       
   214 	};
       
   215 
       
   216 
       
   217 #endif