realtimenetprots/rtp/shimrtp/inc/rtp.h
changeset 0 307788aac0a8
equal deleted inserted replaced
-1:000000000000 0:307788aac0a8
       
     1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #ifndef RTP_H
       
    17 #define RTP_H
       
    18 
       
    19 #include <es_sock.h>
       
    20  
       
    21 class TRtpEvent;
       
    22 class RRtpSession;
       
    23 class RRtpSendPacket;
       
    24 class RRtpReceivePacket;
       
    25 class RRtpReceiveSource;
       
    26 class RRtpSendSource;
       
    27 class RRtpHeaderExtension;
       
    28 class RRtpCSRCs;
       
    29 class CRtpSession;
       
    30 class CRtpReceiveSource;
       
    31 class CRtpSendSource;
       
    32 class TRtpPacket;
       
    33 class TRtpSendPacket;
       
    34 
       
    35 class RRtcpRRPart;
       
    36 class RRtcpSRPart;
       
    37 class TRtcpStatistics;
       
    38 class MPrePostProcessingCallback;
       
    39 
       
    40 /**
       
    41 @publishedAll
       
    42 @released
       
    43 
       
    44 A set of values that defines the event types that may be handled.
       
    45 
       
    46 See all variants of the RegisterEventCallbackL() function. 
       
    47 
       
    48 @see TRtpEvent
       
    49 */
       
    50 enum TRtpEventType
       
    51 	{
       
    52 	/** 
       
    53 	A special event type that is interpreted by all of
       
    54 	the RegisterEventCallbackL() set of functions to mean that the registered
       
    55 	callback function is to be called for any event except failure events.
       
    56     */
       
    57 	ERtpAnyEvent = 0,
       
    58 	
       
    59 	
       
    60     /**
       
    61     Defines a base value for session events.
       
    62    
       
    63     All session event types have values that are greater than this.
       
    64     */
       
    65 	ERtpSessionEventBase = 0x100,
       
    66 	
       
    67 	
       
    68 	/**
       
    69 	An event type that indicates that a session-level error has occurred.
       
    70 	
       
    71 	The event status is a standard Symbian OS error code.
       
    72 	The callback parameter is used to register interest in only one 
       
    73 	type of error.
       
    74 	*/
       
    75 	ERtpSessionFail      = 0x101, 
       
    76 	
       
    77 	
       
    78 	/**
       
    79     An event type that indicates that a new stream has been received.
       
    80 	
       
    81 	The event status is the	SSRC of the stream.
       
    82 	*/
       
    83 	ERtpNewSource        = 0x102,
       
    84 	
       
    85 	
       
    86 	/**
       
    87 	An event type that indicates that an RTCP RR (Receiver Report) has been
       
    88 	received.
       
    89 	
       
    90 	The event status is the SSRC of the sender.
       
    91 
       
    92 	Note - This event type has not been implemented yet.
       
    93 	*/
       
    94 	ERtpNewRR            = 0x103,
       
    95 	
       
    96 	
       
    97 	/**
       
    98 	An event type that indicates that a packet bigger than the expected maximum
       
    99 	has been received.
       
   100 	
       
   101 	When this event occurs, the packet is deleted.
       
   102 	*/
       
   103 	ERtpBufferOverflow   = 0x104,
       
   104 	
       
   105 	
       
   106 	/**
       
   107 	An event type that indicates that a packet has been recived that
       
   108 	is smaller than its header.
       
   109 	
       
   110 	When this event occurs, the packet is deleted.
       
   111 	*/
       
   112 	ERtpUndersizedPacket = 0x105,
       
   113 	
       
   114 	/* An event type that indicates that an non RTP packet has been received */
       
   115 	ENonRtpDataReceived = 0x106,
       
   116 	
       
   117 	/* An event type that indicates that an non RTCP packet has been received */
       
   118 	ENonRtcpDataReceived = 0x107,
       
   119 	/**
       
   120 	Not an event type, but defines the upper limit for session event
       
   121 	type values.
       
   122     */
       
   123 	ERtpSessionEventEnd  = 0x1ff,
       
   124 
       
   125 
       
   126     /**
       
   127     Not an event type but defines a base value for send stream events.
       
   128    
       
   129     All send stream event types have values that are greater than this.
       
   130     */
       
   131 	ERtpSendEventBase    = 0x200,
       
   132 
       
   133 
       
   134 	/**
       
   135 	An event type that indicates that an error has occurred while sending
       
   136 	a packet.
       
   137 	
       
   138 	The event status is a standard Symbian OS error code. The callback parameter
       
   139 	is used only to register interest in one type of error.
       
   140 	*/
       
   141 	ERtpSendFail         = 0x201, 
       
   142 	
       
   143 	
       
   144 	/**
       
   145 	An event type that indicates that a send packet operation has succeeded.
       
   146 	*/
       
   147 	ERtpSendSucceeded    = 0x202,
       
   148 	
       
   149 	
       
   150 	/**
       
   151 	Not an event type, but defines the upper limit for send stream event 
       
   152 	type values.
       
   153 	*/
       
   154 	ERtpSendEventEnd     = 0x2ff,
       
   155 
       
   156 
       
   157     /**
       
   158     Not an event type but defines a base value for receive stream events.
       
   159    
       
   160     All receive stream event types have values that are greater than this.
       
   161     */
       
   162 	ERtpSourceEventBase  = 0x300,
       
   163 	
       
   164 	
       
   165 	/**
       
   166 	An event type that indicates that an error has occurred.
       
   167 	
       
   168     The event status is a standard Symbian OS error code. The callback parameter
       
   169     is used only to register interest in one type of error.
       
   170     */
       
   171 	ERtpSourceFail       = 0x301,
       
   172 	
       
   173 	
       
   174 	/**
       
   175 	An event type that indicates that an in-sequence packet has been received.
       
   176 	*/
       
   177 	ERtpPacketReceived   = 0x302,
       
   178 	
       
   179 	
       
   180 	/**
       
   181 	An event type that indicates that the  codec has changed.
       
   182 	
       
   183 	The event status is the new payload type.
       
   184 	*/
       
   185 	ERtpCodecChange      = 0x303,
       
   186 	
       
   187 	
       
   188 	/**
       
   189 	An event type that indicates that a marker packet has arrived.
       
   190 	*/
       
   191 	ERtpMarker           = 0x304,
       
   192 	
       
   193 	
       
   194 	/**
       
   195 	An event type that indicates that a misordered packet has arrived.
       
   196 	*/
       
   197 	ERtpMisorder         = 0x305,
       
   198 	
       
   199 	
       
   200 	/**
       
   201 	An event type that indicates that a dropout has been detected.
       
   202 	*/
       
   203 	ERtpDropout          = 0x306,
       
   204 	
       
   205 	
       
   206 	/**
       
   207 	An event type that indicates that a SDES (Source Description) RTCP packet
       
   208 	has been received.
       
   209 	
       
   210 	For SDES events, the callback parameter is used to specify the type of 
       
   211 	SDES. Use a value from TRtpSendPacketType
       
   212 	
       
   213 	The event status is the SSRC of the sender.
       
   214 
       
   215 	@see RRtpSession::TRtpSendPacketType
       
   216 	*/
       
   217 	ERtpSDES             = 0x307, 
       
   218 
       
   219 
       
   220 	/**
       
   221 	An event type that indicates that a APP (Application Defined) RTCP packet
       
   222 	has been received.
       
   223 	
       
   224 	The event status is the SSRC of the sender.
       
   225 
       
   226 	*/
       
   227 	ERtpAPP              = 0x308,
       
   228 	
       
   229 	
       
   230 	/**
       
   231 	An event type that indicates that a SR (Sender Report) RTCP packet
       
   232 	has been received.
       
   233 
       
   234 	The event status is the SSRC of the sender.
       
   235 	
       
   236 	*/
       
   237 	ERtpSR               = 0x309,
       
   238 	
       
   239 	
       
   240 	/**
       
   241 	An event type that indicates that a RR (Receiver Report) RTCP packet
       
   242 	has been received.
       
   243 
       
   244 	The event status is the SSRC of the sender.
       
   245 	*/
       
   246 	ERtpRR               = 0x30a,
       
   247 
       
   248 
       
   249 	/**
       
   250 	An event type that indicates that a BYE (Goodbye) RTCP packet
       
   251 	has been received.
       
   252 
       
   253 	The event status is the SSRC of the sender.
       
   254 	*/
       
   255 	ERtpBYE              = 0x30b,
       
   256 
       
   257 	
       
   258 	/**
       
   259 	Not an event type, but defines the upper limit for receive stream event 
       
   260 	type values.
       
   261 	*/
       
   262 	ERtpSourceEventEnd   = 0x3ff
       
   263 	};
       
   264 
       
   265 
       
   266 /**
       
   267 @publishedAll
       
   268 @released
       
   269 
       
   270 Indicates whether a callback function can be called once, or more than once.
       
   271 
       
   272 The appropriate enum value is passed as an argument to the
       
   273 RegisterEventCallbackL() functions of RRtpSession, RRtpSendSource,
       
   274 and RRtpReceiveSource, or to the equivalent static functions.
       
   275 
       
   276 @see RRtpSession
       
   277 @see RRtpSendSource
       
   278 @see RRtpReceiveSource
       
   279 */
       
   280 enum TRtpOneShotness 
       
   281 	{
       
   282 	/**
       
   283 	Indicates that the call back function can be called more than once.
       
   284 	*/
       
   285 	ERtpNotOneShot = 0,
       
   286 
       
   287 	
       
   288 	/**
       
   289 	Indicates that the call back function is only called once.
       
   290 	*/
       
   291 	ERtpOneShot = 0x40000000
       
   292 	};
       
   293 
       
   294 
       
   295 
       
   296 
       
   297 /**
       
   298 @publishedAll
       
   299 @released
       
   300 */
       
   301 typedef void (*TRtpCallbackFunction)(TAny* aPtr, const TRtpEvent& aEvent);
       
   302 
       
   303 
       
   304 
       
   305 /**
       
   306 @publishedAll
       
   307 */
       
   308 const TInt KRtpNoParameter = KRequestPending;
       
   309 
       
   310 
       
   311 //Needed for recv-only option for RTP or RTCP
       
   312 //This must map to TRtpType
       
   313 enum TPacketType
       
   314 	{	
       
   315 	EPacketRtp,	
       
   316 	EPacketRtcp
       
   317 	};
       
   318 
       
   319 
       
   320 
       
   321 
       
   322 /**
       
   323 @publishedAll
       
   324 @released
       
   325 
       
   326 A value that can be passed as the second parameter in a call to either
       
   327 RRtpSendSource::NewSendPacketL() or RRtpSendSource::NewSendPacketLC()
       
   328 to indicate that no exension is required for the RTP send packet.
       
   329 */
       
   330 const TInt KRtpNoExtension = -1;
       
   331 
       
   332 /**
       
   333 @publishedAll
       
   334 @released
       
   335 
       
   336 A handle to an RTP session.
       
   337 
       
   338 This is the interface to the socket-level RTP service, and provides additional
       
   339 facilities such as header parsing, re-ordering out-of-order packets,
       
   340 demultiplexing multiple sources etc.
       
   341 
       
   342 The class abstracts all RTP information going to/from a RTP socket, and its
       
   343 corresponding RTCP data.
       
   344 
       
   345 Each RTP endpoint on a device needs its own RTP session.
       
   346 
       
   347 Multiple hosts streaming to a port on this device correspond
       
   348 to different RRtpReceiveSource objects associated with the session.
       
   349 
       
   350 The class behaviour assumes that an active scheduler has already been created
       
   351 and started; the class does not function correctly if not.
       
   352 */
       
   353 class RRtpSession
       
   354 	{
       
   355  public:
       
   356     /**
       
   357     A set of bit values passed as a parameter to RRtpSession::SendRTCPPacketL()
       
   358     to specify the SDES (Source Description) items that are to be sent with
       
   359     the packet. One or more of these may be set.
       
   360     
       
   361     @see RRtpSession::SendRTCPPacketL()
       
   362 	*/
       
   363 	enum TRtpSendPacketType
       
   364 		{
       
   365         /**
       
   366         Canonical End-Point Identifier SDES Item.
       
   367         */
       
   368 		ERtcpPacketCNAME = 1, 
       
   369 		
       
   370 		/**
       
   371         User Name SDES Item.
       
   372 	    */
       
   373 		ERtcpPacketNAME  = 2, 
       
   374 		
       
   375 	    /**
       
   376         Electronic Mail Address SDES Item.
       
   377 	    */
       
   378 		ERtcpPacketEMAIL = 4, 
       
   379 		
       
   380         /**
       
   381 	    Phone Number SDES Item.
       
   382 	    */		
       
   383 		ERtcpPacketPHONE = 8, 
       
   384 		
       
   385 		/**
       
   386 	    Geographic User Location SDES Item.
       
   387 	    */
       
   388 		ERtcpPacketLOC   = 16,
       
   389 		
       
   390 		/**
       
   391         Application or Tool Name SDES Item 
       
   392 	    */
       
   393 		ERtcpPacketTOOL  = 32,
       
   394 		
       
   395 		/**
       
   396 	    Notice/Status SDES Item 
       
   397 	    */
       
   398 		ERtcpPacketNOTE  = 64,
       
   399 		
       
   400 		/**
       
   401 	    Private Extensions SDES Item 
       
   402 	    */
       
   403 		ERtcpPacketPRIV  = 128
       
   404 		};
       
   405 
       
   406 	inline RRtpSession();
       
   407 	inline TBool IsOpen() const;
       
   408 
       
   409 	IMPORT_C void OpenL(RSocketServ& aServer, TSockAddr& aLocalAddr,
       
   410 						TSockAddr& aRemoteAddr,
       
   411 						TInt aMaxRXSize, RConnection& aConnection, TInt aPriority = EPriorityNormal, 
       
   412 						const TDesC8& aCNAME = KNullDesC8);
       
   413 
       
   414 	
       
   415 	IMPORT_C void OpenL(RSocketServ& aServer, TSockAddr& aLocalAddr,
       
   416 						TSockAddr& aRemoteAddr,
       
   417 						TInt aMaxRXSize, TInt aPriority = EPriorityNormal, 
       
   418 						const TDesC8& aCNAME = KNullDesC8);
       
   419 
       
   420     /**
       
   421 	@publishedAll
       
   422 	@released
       
   423    	
       
   424     Opens the session and initialises it.
       
   425 
       
   426     No events will be generated until after control returns to the
       
   427     active scheduler. The client has this time to initialise the
       
   428     object by adding event callbacks.
       
   429 
       
   430     @param aSocket     The connected socket.
       
   431     @param aMaxRXSize  The maximum size of a received packet.
       
   432     @param aRtcpSocket The RTCP socket.
       
   433     @param aPriority   The priority to be used for internal active objects
       
   434     @param aCNAME      The CNAME. A sensible default is supplied if none is
       
   435                        provided.
       
   436     */
       
   437 	IMPORT_C void OpenL(RSocket& aSocket, TInt aMaxRXSize, 
       
   438 						RSocket& aRtcpSocket,
       
   439 						TInt aPriority = EPriorityNormal, 
       
   440 						const TDesC8& aCNAME = KNullDesC8);
       
   441 
       
   442 	IMPORT_C void OpenL(RSocket& aSocket, TInt aMaxRXSize,
       
   443 						TInt aPriority = EPriorityNormal);
       
   444 
       
   445    
       
   446     /** 
       
   447 	@internalComponent
       
   448     
       
   449 	Opens the session and initialises it.
       
   450 
       
   451     No events will be generated until after control returns to the
       
   452     active scheduler. The client has this time to initialise the
       
   453     object by adding event callbacks.
       
   454 
       
   455 	This API uses the RTP Stack implemented as a CF Prorotocol. The SubConnection
       
   456 	which is passed to the API should be initialised with the RTP Params. 
       
   457 
       
   458     @param aServer         Socket Server. 
       
   459     @param aLocalAddr      The maximum size of a received packet.
       
   460     @param aRemoteAddr     The RTCP socket.
       
   461     @param aMaxRXSize      The maximum size of a received packet.
       
   462     @param aSubConnection  The subconnection with RTP Parametrs set on it.
       
   463     @param aCName          The CNAME. It needs to be same as the one set using the API:
       
   464     					   CSubConRTPGenericParamSet::SetCNAMEL(const TDesC8& aCName).
       
   465     					   If the descriptor is KNullDesC8,the RTCP session is not created.
       
   466                            
       
   467     */
       
   468     
       
   469     #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
       
   470     IMPORT_C void OpenL(RSocketServ& aServer, TSockAddr& aLocalAddr,
       
   471 						TSockAddr& aRemoteAddr,
       
   472 						TInt aMaxRXSize, RSubConnection& aSubConnection, TInt aPriority = EPriorityNormal, 
       
   473 						const TDesC8& aCNAME = KNullDesC8);
       
   474 	#endif
       
   475 
       
   476 	
       
   477 
       
   478 	IMPORT_C void Close();
       
   479 
       
   480 	IMPORT_C void SetMaxRXSize(TInt aMaxRXSize);
       
   481 
       
   482 	IMPORT_C TInt MaxRXSize();
       
   483     
       
   484     
       
   485     /** 
       
   486 	@publishedAll
       
   487 	@released
       
   488 	
       
   489     Sets the estimated bandwidth used by the session.
       
   490     
       
   491     This is used to decide when to send RTCP status packets.
       
   492     The default	value is read from a resource file and should be a reasonably
       
   493 	sensible default based on the maximum bandwidth of the handset.
       
   494 	
       
   495 	@param aBandwidth The bandwidth in bps.
       
   496     */
       
   497 	IMPORT_C void SetBandwidth(TUint aBandwidth);
       
   498 
       
   499 
       
   500     /**
       
   501 	@publishedAll
       
   502 	@released
       
   503    	
       
   504    	Supplies information about the profile-specific RTP
       
   505     timestamps. 
       
   506     
       
   507     This is used to generate the RTP timestamps in RTCP packets.
       
   508     It is not used to generate timestamps in RTP packets as they must
       
   509     accurately relate to the time of the sample.
       
   510    	
       
   511    	@param aNow        The time now in RTP format
       
   512 	@param aConversion The number of nanoseconds per RTP timer tick.
       
   513     */
       
   514 	IMPORT_C void SetRTPTimeConversion(TUint aNow, TUint aConversion);
       
   515 	IMPORT_C RRtpReceiveSource NewReceiveSourceL();
       
   516 	IMPORT_C RRtpReceiveSource NewReceiveSourceLC();
       
   517 
       
   518     /**
       
   519     Registers a callback for the specified event.
       
   520 
       
   521 	Some compilers may not support templated member functions. A static version
       
   522 	of this function is available that offers the same behaviour:
       
   523     RegisterEventCallbackL(RRtpSession,TRtpEventType,void (*aCallback)(T*, const TRtpEvent&),T*,TRtpOneShotness,TInt)
       
   524 
       
   525     @param aType      The type of event.
       
   526     @param aCallback  The callback function. The function is templated, and is
       
   527                       prototyped to take a pointer to an object of the template
       
   528                       type and a const reference to a TRtpEvent. The function
       
   529                       returns void.
       
   530 	@param aPtr       A pointer that is passed to the callback function when
       
   531 	                  that function is called.
       
   532 	@param aOneShot   Indicates whether the callback function is only
       
   533 	                  called once, or can be called more than once.
       
   534 	@param aParameter A parameter to be passed to the registration function.
       
   535 	                  The meaning of this depends entirely on the event type.
       
   536 	                  The parameter is optional - the other overload of this
       
   537 	                  function is available for registrations that don't need
       
   538                       to pass a parameter.                      
       
   539 	*/
       
   540 	template <class T> inline void 
       
   541 		RegisterEventCallbackL(TRtpEventType aType, 
       
   542 							   void (*aCallback)(T*, const TRtpEvent&), 
       
   543 							   T* aPtr, 
       
   544 							   TRtpOneShotness aOneShot,
       
   545 							   TInt aParameter)
       
   546 			{
       
   547 			PrivRegisterEventCallbackL(
       
   548 				aType|aOneShot, 
       
   549 				reinterpret_cast<TRtpCallbackFunction>(aCallback),
       
   550 				static_cast<TAny*>(aPtr), aParameter);
       
   551 			}
       
   552 
       
   553     /**
       
   554     Registers a callback for the specified event.
       
   555 
       
   556 	Some compilers may not support templated member functions. A static version
       
   557 	of this function is available that offers the same behaviour:
       
   558 	RegisterEventCallbackL(RRtpSession,TRtpEventType,void (*aCallback)(T*, const TRtpEvent&),T*,TRtpOneShotness)
       
   559 
       
   560     @param aType      The type of event.
       
   561     @param aCallback  The callback function. The function is templated, and is
       
   562                       prototyped to take a pointer to an object of the template
       
   563                       type and a const reference to a TRtpEvent. The function
       
   564                       returns void.
       
   565 	@param aPtr       A pointer that is passed to the callback function when
       
   566 	                  that function is called.
       
   567 	@param aOneShot   Indicates whether the callback function is only
       
   568 	                  called once, or can be called more than once. If not
       
   569 	                  specified, the default is to allow the callback function
       
   570 	                  to be called more than once.
       
   571 	*/
       
   572 	template <class T> inline void 
       
   573 		RegisterEventCallbackL(TRtpEventType aType, 
       
   574 							   void (*aCallback)(T*, const TRtpEvent&), 
       
   575 							   T* aPtr, 
       
   576 							   TRtpOneShotness aOneShot = ERtpNotOneShot)
       
   577 			{
       
   578 			PrivRegisterEventCallbackL(
       
   579 				aType|aOneShot, 
       
   580 				reinterpret_cast<TRtpCallbackFunction>(aCallback),
       
   581 				static_cast<TAny*>(aPtr));
       
   582 			}
       
   583 
       
   584 
       
   585 	/**
       
   586 	@publishedAll
       
   587 	@released
       
   588 	
       
   589 	Gets an array contining the most recent RR (Receiver Report) from
       
   590 	all hosts who are reporting on our send stream.
       
   591 	
       
   592 	@return The array of RRs.
       
   593 	*/
       
   594 	IMPORT_C RRtcpRRPart GetRRs();
       
   595 
       
   596 
       
   597 	/**
       
   598 	@publishedAll
       
   599 	@released
       
   600 	
       
   601 	Gets the data associated with the specified RTCP SDES (Source Description)
       
   602 	item.
       
   603 
       
   604 	Note a that the PRIV (Private Extensions) SDES item is not supported
       
   605 	by this mechanism.
       
   606 	
       
   607 	@param aType  The value identifying the RTCP SDES item.
       
   608 	
       
   609 	@param aValue A descriptor reference to the SDES item data. 
       
   610 	
       
   611 	@return KErrNotFound if the item type was not found in the most recent RTCP packet
       
   612 			KErrNone if the operation is successful
       
   613 	*/
       
   614 	IMPORT_C TInt GetSDES(const TInt aType, TDes8& aValue);
       
   615 
       
   616 	
       
   617 	/**
       
   618 	@publishedAll
       
   619 	@released
       
   620 	
       
   621 	Sets the data associated with the specified RTCP SDES (Source Description)
       
   622 	item for sending in the next SDES packet only.
       
   623 
       
   624 	The function Leaves if duplicate values are set for the same CNAME.
       
   625 
       
   626     The SDES Items set by this API is valid only till the stack sends the
       
   627     next RTCP Packet. The list of items(except CNAME and NONE) is flushed 
       
   628 	after every RTCP report is sent
       
   629 
       
   630 	Note a that the PRIV (Private Extensions) SDES item is not supported
       
   631 	by this mechanism.
       
   632 	
       
   633 	NOTE - This call cannot be used to set a different CNAME for this session.
       
   634 	The default CNAME is send with every SDES packets.
       
   635 	
       
   636 	@param aType  The value identfying the RTCP SDES item.
       
   637 	@param aValue The SDES item data.
       
   638 
       
   639 	@return KErrTooBig if the length of the aValue is more than KMaxSdesItemLength(=255)
       
   640 			KErrNone if the operation is successful
       
   641 	*/
       
   642 	IMPORT_C TInt SetSDESL(TInt aType, const TDesC8& aValue);
       
   643 
       
   644 	/**
       
   645 	@publishedAll
       
   646 	@released
       
   647 	
       
   648 	Sets the data associated with the PRIV (Private Extensions) SDES item.
       
   649 	
       
   650 	@param aPrefix The value identfying the RTCP SDES item.
       
   651 	@param aValue The SDES item data.
       
   652 
       
   653   	@return KErrTooBig if the length of the aValue and aPrefix combined is more 
       
   654 	                   than KMaxSdesItemLength(=255)
       
   655 			KErrNone if the operation is successful
       
   656 	*/
       
   657 	IMPORT_C TInt SetPRIVL(const TDesC8& aPrefix, const TDesC8& aValue);
       
   658 
       
   659     
       
   660 	/**
       
   661 	@publishedAll
       
   662 	@released
       
   663 	Sends an APP (Application Defined) RTCP Packet.
       
   664 	
       
   665 	The packet is sent immediately.
       
   666 	
       
   667 	If used with RTCP auto-send, the function disrupts the auto-send
       
   668 	intervals. Note however that Symbian reserves the right to fix this.
       
   669 	
       
   670 	@param aApp A handle to a RTCP APP (Application Defined) packet,
       
   671 	            for experimental extensions to RTCP.
       
   672 	*/
       
   673 	IMPORT_C void SendAPPL(const TDesC8& aName, const TDesC8& aAppData = KNullDesC8, TUint8 aSubType = 0);
       
   674 
       
   675 
       
   676 	/**
       
   677 	@publishedAll
       
   678 	@released
       
   679 	
       
   680 	Enables or disables the automatic sending of RTCP SR (Sender Report),
       
   681 	RR (Receiver Report), and SDES (Source Description) packets.
       
   682 	
       
   683 	Note that if automatic sending is not enabled and RTCP sending is required,
       
   684 	then explicit calls to SendRTCPPacketL() will be required.
       
   685 	
       
   686 	@param aAutoSend ETrue, if RTCP packets need to be send automatically
       
   687 	                 EFalse otherwise.
       
   688 	
       
   689 	@see RRtpSession::SendRTCPPacketL()
       
   690 	*/
       
   691 	IMPORT_C void SetRTCPAutoSend(TBool aAutoSend);
       
   692 
       
   693 
       
   694 	/** 
       
   695 	@publishedAll
       
   696 	@released
       
   697 	
       
   698 	Gets the RTCP Auto Send status. 
       
   699 
       
   700 	@return True, if RTCP SR, RR and SDES packets are automatically sent,
       
   701 	        false otherwise
       
   702 	
       
   703 	@see RRtpSession::SetRTCPAutoSend()
       
   704 	*/
       
   705 	IMPORT_C TBool RTCPAutoSend() const;
       
   706 
       
   707 	/** 
       
   708 	@publishedAll
       
   709 	@released
       
   710 	
       
   711 	Sets the RTCP Auto Send interval.
       
   712 	This disables the RFC based calculation of RTCP intervals.
       
   713 	To re-enable auto calculation, set the interval to zero.
       
   714 
       
   715   	@param aInterval Time interval after which an RTCP auto-send will take place
       
   716 	*/
       
   717 	IMPORT_C void SetRtcpInterval(TTimeIntervalMicroSeconds32& aInterval);
       
   718 	
       
   719 	/** 
       
   720 	@publishedAll
       
   721 	@released	
       
   722 	Enables Receive only option for rtp or rtcp
       
   723 
       
   724 	@param aRtpOrRtcp Takes the values from the enum TPacketType
       
   725 
       
   726 	*/
       
   727 	IMPORT_C void DontReceive(TInt aRtpOrRtcp);
       
   728 	
       
   729 	/** 
       
   730 	@publishedAll
       
   731 	@released
       
   732     Sends an RTCP packet now. 
       
   733 
       
   734 	Calling this function doesn't make much sense if auto-send is
       
   735 	on, as it will result in packets being sent at rather
       
   736 	incoherent intervals.
       
   737 
       
   738 	@param aPacketType  Zero or more of the bit values defined by
       
   739 	                    the TRtpSendPacketType enum. The packet sent will
       
   740 	                    contain a SR (Sender Report) or RR (Receiver Report),
       
   741 	                    depending on whether any packets have actually been
       
   742 	                    sent, together with all SDES (Source Description) items
       
   743 	                    specified by this parameter.
       
   744 	                    
       
   745 	                    Example:
       
   746 	                    
       
   747 	                    If every report has go with CNAME,LOC and PRIV...
       
   748 	                    then set flags as fallows..
       
   749 	                    
       
   750 	                    SDES Flags:
       
   751 	                    1  2  3  4  5  6  7 8 
       
   752 	                    1  0  0  0  1  0  0 1
       
   753 	                   
       
   754 
       
   755     @see TRtpSendPacketType
       
   756 	*/
       
   757 	IMPORT_C void SendRTCPPacketL(TDesC8& aPacket);
       
   758 
       
   759 	
       
   760 	/**
       
   761 	@publishedAll
       
   762 	@released
       
   763 	Creates a new send stream, and returns the send stream handle.
       
   764 
       
   765 	Only one send stream per session is permitted, which means that you must not
       
   766 	call this function if the send stream has already been created.
       
   767 
       
   768 	As the send stream is an active object, it cannot handle request
       
   769 	completion events until control returns to the active scheduler.
       
   770 	Typically, clients will want to add event registrations before that.
       
   771 
       
   772 	The Code panics if the SendSource has alredy been opened.
       
   773 
       
   774 	@return The send stream handle.
       
   775 
       
   776 	This function may leave if memory is not enough.
       
   777 	*/
       
   778 	IMPORT_C RRtpSendSource NewSendSourceL(); 
       
   779 
       
   780 
       
   781 	/**
       
   782 	@publishedAll
       
   783 	@released
       
   784 	
       
   785 	Gets the handle to the send stream object associated with this session.
       
   786 
       
   787 	The send stream object is the one created in a previous call
       
   788 	to NewSendSourceL(). If the send stream object has not been created, then
       
   789 	the returned handle will refer to a closed send stream.
       
   790 
       
   791     @return The handle to the send stream object.
       
   792     
       
   793     @see RRtpSendSource NewSendSourceL()
       
   794     */
       
   795 	IMPORT_C RRtpSendSource SendSource(); 
       
   796 
       
   797 
       
   798     /**
       
   799 	@publishedAll
       
   800 	@released
       
   801     
       
   802     Sets the number of sequential packets that must be received
       
   803 	before a stream is considered good.
       
   804 	
       
   805 	Sets the maximum number of dropped packets to be considered a
       
   806 	dropout, as opposed to an ended and restarted stream.
       
   807 	
       
   808 	Sets the maximum number of packets by which a packet can be delayed 
       
   809 	before it is considered dropped.
       
   810 			
       
   811 	@param aMaxMisorder The maximum number of packets.
       
   812 		
       
   813 	@param aMaxDropout The number of sequential packets.
       
   814 		
       
   815 	@param aMinSequential The number of sequential packets.
       
   816 	@post The session will be 'restarted', 
       
   817 			i.e. it resets the sequence number sequence and resets all RTCP statistics.
       
   818 	*/
       
   819 	IMPORT_C void SetRtpStreamParameters(TInt aMinSequential, TInt aMaxMisorder, TInt aMaxDropout);
       
   820 
       
   821 	inline TBool operator == (RRtpSession aThat) const;
       
   822 	inline TBool operator != (RRtpSession aThat) const;
       
   823 
       
   824 	/**
       
   825 	@publishedAll
       
   826 	@released
       
   827 
       
   828     The event manager contains a number of callback registrations, each of which 
       
   829 	binds a function and pointer (normally an object) to a particular kind of
       
   830     event. Registrations can be bound to all events on a stream.
       
   831 
       
   832 	If a function is registered for a particular event, it will be called when 
       
   833 	that event occurs. One callback function can be associated with more than 1
       
   834 	callback registration. Callback functions take a pointer argument
       
   835 	which was supplied as part of the registration
       
   836 
       
   837     @param aType Event type
       
   838 		
       
   839 	@param aCallback Callback object
       
   840 		
       
   841 	@param aPtr Pointer to data that needs to be passed to the callback function
       
   842 
       
   843   	@param aParameter Parameter to be passed to internal callback subsystem
       
   844 	*/
       
   845 	IMPORT_C void PrivRegisterEventCallbackL(TUint aType, 
       
   846 										  TRtpCallbackFunction aCallback, 
       
   847 										  TAny* aPtr, 
       
   848 										  TInt aParameter);
       
   849 
       
   850 	/**
       
   851 	@publishedAll
       
   852 	@released
       
   853 
       
   854     The event manager contains a number of callback registrations, each of which 
       
   855 	binds a function and pointer (normally an object) to a particular kind of
       
   856     event. Registrations can be bound to all events on a stream.
       
   857 
       
   858 	If a function is registered for a particular event, it will be called when 
       
   859 	that event occurs. One callback function can be associated with more than 1
       
   860 	callback registration. Callback functions take a pointer argument
       
   861 	which was supplied as part of the registration
       
   862 
       
   863     @param aType Event type
       
   864 		
       
   865 	@param aCallback Callback object
       
   866 		
       
   867 	@param aPtr Pointer to data that needs to be passed to the callback function
       
   868 	*/
       
   869 	IMPORT_C void PrivRegisterEventCallbackL(TUint aType, 
       
   870 										  TRtpCallbackFunction aCallback, 
       
   871 										  TAny* aPtr);
       
   872 	
       
   873 	/**
       
   874 	@publishedAll
       
   875 	@released
       
   876  
       
   877 	Sets the sampling rate for a Particular Payloadtype
       
   878 	@param aPayloadType  PayloadType ( Should be between 96-127 ) see RFC 3551
       
   879 	@param asamplingrate Sampling rate is in rtp ticks per msecs. ( eg for AMR-NB give 8000).
       
   880 	*/	
       
   881 	IMPORT_C TInt SetSamplingRate(TInt aPayloadType, TUint aSamplingRate);
       
   882 	/**
       
   883 	@publishedAll
       
   884 	@released
       
   885 
       
   886     Gets a handle to the RTP socket; 
       
   887 	it provides a direct access to the functionality of RTP socket.
       
   888 
       
   889 	@return The RTP socket for the current session
       
   890 		
       
   891 	*/									  
       
   892     IMPORT_C RSocket* RtpSocket();
       
   893     
       
   894     /**
       
   895 	@publishedAll
       
   896 	@released
       
   897 
       
   898     Gets a handle to the RTCP socket; 
       
   899 	it provides a direct access to the functionality of RTCP socket.
       
   900 
       
   901 	@return The RTCP socket for the current session
       
   902 		
       
   903 	*/
       
   904 	IMPORT_C RSocket* RtcpSocket();
       
   905 	
       
   906 	/**
       
   907 	@publishedAll
       
   908 	@released
       
   909 
       
   910     Send a non-RTP (control) data packet asynchronously
       
   911     
       
   912     @param aSocketType SocketType that tells whether non RTP data has to go through RTP or RTCP socket
       
   913     
       
   914     @param aData Non RTP data that has to be sent
       
   915     
       
   916 	@param aStatus Tells whether the data has been sent successfully
       
   917 
       
   918 	*/
       
   919  	IMPORT_C void SendDataL(TBool aSocketType, const TDesC8& aData, TRequestStatus&  aStatus);
       
   920  	
       
   921  	/**
       
   922 	@publishedAll
       
   923 	@released
       
   924 
       
   925     Sets the remote RTP address for the current RTP session
       
   926     
       
   927     @param aRemoteAddr Remote RTP address to be set
       
   928     
       
   929     */
       
   930 	
       
   931 	IMPORT_C void SetRemoteAddress(const TSockAddr &aRemoteAddr);
       
   932 
       
   933 	/**
       
   934 	@publishedAll
       
   935 	@released
       
   936 
       
   937     Gets the last received non RTP data, If no data found function leaves
       
   938     
       
   939     @return Returns the last received non RTP data
       
   940 	*/
       
   941 	IMPORT_C const TDesC8& NonRtpDataL();
       
   942 	
       
   943 	/**
       
   944 	@publishedAll
       
   945 	@released
       
   946 
       
   947     Gets the last received non RTCP data, If no data found function leaves
       
   948     
       
   949     @return Returns the last received non RTCP data
       
   950 	*/
       
   951 	IMPORT_C TPtr8 NonRtcpDataL();
       
   952 	
       
   953 	/**
       
   954 	@publishedAll
       
   955 	@released
       
   956 
       
   957     Disables the receipt of non RTP data
       
   958     
       
   959     */
       
   960 	
       
   961 	IMPORT_C void DisableNonRtpData();
       
   962 	
       
   963 	/**
       
   964 	@publishedAll
       
   965 	@released
       
   966 
       
   967     Sets the remote RTCP port for the current active RTP session
       
   968     
       
   969     @param Remote RTCP port value to be set
       
   970 	*/
       
   971 	
       
   972 	IMPORT_C void SetRemoteRtcpPort(TUint aPort);
       
   973 	
       
   974 	/**
       
   975 	@internalComponent
       
   976 
       
   977     Gets the remote RTCP Statistics for the current RTP session
       
   978     
       
   979     @param SSRC of the sender
       
   980     @param RTCP Statistics class that stores the RTCP statistics for the 
       
   981     current RTP session
       
   982 	*/
       
   983 	#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
       
   984     IMPORT_C TInt RtcpStatistics(TUint32 aSsrc, TRtcpStatistics &aRtcpStatistics);
       
   985     #endif
       
   986 	
       
   987 	/**
       
   988 	@internalComponent
       
   989 
       
   990     Pre and Post processing function for RTP and RTCP packets
       
   991 
       
   992 	If a function is registered for a particular event, it will be called when 
       
   993 	that event occurs. One callback function can be associated with more than 1
       
   994 	callback registration. Callback functions take a pointer argument
       
   995 	which was supplied as part of the registration
       
   996 
       
   997     @param aType Event type
       
   998 		
       
   999 	@param aCallback Callback object
       
  1000 		
       
  1001 	@param aPtr Pointer to data that needs to be passed to the callback function
       
  1002 	*/
       
  1003 	#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
       
  1004 	IMPORT_C void SetPrePostProcessingRegisterCallback(MPrePostProcessingCallback* aPrePostProcessingCallback);
       
  1005 	#endif
       
  1006 
       
  1007  private:
       
  1008 	friend class TRtpEvent;
       
  1009 	#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
       
  1010 		friend class RRtpSession_Internal;
       
  1011 	#endif
       
  1012 	CRtpSession* iPtr;
       
  1013 	
       
  1014 	// Note: Comments that start with //\ are pseudo-variables used to get
       
  1015 	// Doxygen collaboration diagrams to look right. Ignore them.
       
  1016 	//\ RRtpSendSource sndSource_1_01;
       
  1017 	//\ RRtpReceiveSource rcvSource_1_n;
       
  1018 	//\ TRtpCallback callbacks_1_n;
       
  1019 	//\ TRtpEvent events_1_n;
       
  1020 	};
       
  1021 
       
  1022 
       
  1023 
       
  1024 
       
  1025 /**
       
  1026 @publishedAll
       
  1027 @released
       
  1028 
       
  1029 A handle to a send stream.
       
  1030 
       
  1031 Use this class to manage the creation and sending of packets. 
       
  1032 A session can have only one send stream.
       
  1033 
       
  1034 Only one packet can be sent at any one time.
       
  1035 Once a packet has been sent, the packet cannot be closed and no further packets
       
  1036 can be sent until an event signalling the completion of the send operation has
       
  1037 occurred. This will be one of the events defined by the enum values:
       
  1038 ERtpSendSucceeded and ERtpSendFail.
       
  1039 
       
  1040 A client must monitor these events so that it can schedule the sending of
       
  1041 subsequent packets.
       
  1042 It does this by implementing and registering callback functions that 
       
  1043 handle these events.
       
  1044 
       
  1045 @see TRtpEventType
       
  1046 */
       
  1047 class RRtpSendSource
       
  1048 	{
       
  1049  public:
       
  1050 	inline RRtpSendSource();
       
  1051 	inline TBool IsOpen() const;
       
  1052 	IMPORT_C void Close();
       
  1053 
       
  1054 	IMPORT_C void Cancel();
       
  1055     
       
  1056 	template <class T> inline void 
       
  1057 		RegisterEventCallbackL(TRtpEventType aType, 
       
  1058 							   void (*aCallback)(T*, const TRtpEvent&), 
       
  1059 							   T* aPtr, 
       
  1060 							   TRtpOneShotness aOneShot,
       
  1061 							   TInt aParameter)
       
  1062 	{
       
  1063 	PrivRegisterEventCallbackL(aType|aOneShot,
       
  1064 				reinterpret_cast<TRtpCallbackFunction>(aCallback),
       
  1065 				static_cast<TAny*>(aPtr), aParameter);
       
  1066 	}
       
  1067 
       
  1068 
       
  1069 	template <class T> inline void 
       
  1070 		RegisterEventCallbackL(TRtpEventType aType, 
       
  1071 							   void (*aCallback)(T*, const TRtpEvent&), 
       
  1072 							   T* aPtr, 
       
  1073 							   TRtpOneShotness aOneShot = ERtpNotOneShot)
       
  1074 	{
       
  1075 	PrivRegisterEventCallbackL(aType|aOneShot,
       
  1076 				reinterpret_cast<TRtpCallbackFunction>(aCallback),
       
  1077 				static_cast<TAny*>(aPtr));
       
  1078 	}
       
  1079 
       
  1080 
       
  1081 	
       
  1082 	IMPORT_C RRtpSendPacket NewSendPacketL(TInt aPayloadSize = 0, 
       
  1083 										   TInt aHeaderExtensionSize = 
       
  1084 										   KRtpNoExtension);
       
  1085 	
       
  1086 	IMPORT_C RRtpSendPacket NewSendPacketLC(TInt aPayloadSize = 0, 
       
  1087 											TInt aHeaderExtensionSize = 
       
  1088 											KRtpNoExtension);
       
  1089 
       
  1090 	IMPORT_C TBool IsSending();
       
  1091 	IMPORT_C void SetPayloadType(TUint aPayloadType);
       
  1092 	IMPORT_C void SetDefaultPayloadSize(TInt aPayloadSize);
       
  1093 	/**
       
  1094 	@publishedAll
       
  1095 	@released
       
  1096 	
       
  1097 	Sends a Bye RTCP packet.
       
  1098 	
       
  1099 	@param aReason The reason for sending the Bye RTCP packet.
       
  1100 	*/
       
  1101 	IMPORT_C void ByeL(TDesC8& aReason);
       
  1102 	IMPORT_C TUint32 GetLocalSSRC();
       
  1103 
       
  1104 	IMPORT_C void SetAlignment(TInt aAlignment);
       
  1105 	IMPORT_C TInt Alignment() const;
       
  1106 
       
  1107 	inline TBool operator == (RRtpSendSource aThat) const;
       
  1108 	inline TBool operator != (RRtpSendSource aThat) const;
       
  1109 	
       
  1110 	/**
       
  1111 	@publishedAll
       
  1112 	@released
       
  1113 
       
  1114     The event manager contains a number of callback registrations, each of which 
       
  1115 	binds a function and pointer (normally an object) to a particular kind of
       
  1116     event. Registrations can be bound to all events on a stream.
       
  1117 
       
  1118 	If a function is registered for a particular event, it will be called when 
       
  1119 	that event occurs. One callback function can be associated with more than 1
       
  1120 	callback registration. Callback functions take a pointer argument
       
  1121 	which was supplied as part of the registration
       
  1122 
       
  1123     @param aType Event type
       
  1124 		
       
  1125 	@param aCallback Callback object
       
  1126 		
       
  1127 	@param aPtr Pointer to data that needs to be passed to the callback function
       
  1128 
       
  1129   	@param aParameter Parameter to be passed to internal callback subsystem
       
  1130 	*/
       
  1131 	IMPORT_C void PrivRegisterEventCallbackL(TUint aType, 
       
  1132 										  TRtpCallbackFunction aCallback, 
       
  1133 										  TAny* aPtr, 
       
  1134 										  TInt aParameter);
       
  1135 
       
  1136 	/**
       
  1137 	@publishedAll
       
  1138 	@released
       
  1139 
       
  1140     The event manager contains a number of callback registrations, each of which 
       
  1141 	binds a function and pointer (normally an object) to a particular kind of
       
  1142     event. Registrations can be bound to all events on a stream.
       
  1143 
       
  1144 	If a function is registered for a particular event, it will be called when 
       
  1145 	that event occurs. One callback function can be associated with more than 1
       
  1146 	callback registration. Callback functions take a pointer argument
       
  1147 	which was supplied as part of the registration
       
  1148 
       
  1149     @param aType Event type
       
  1150 		
       
  1151 	@param aCallback Callback object
       
  1152 		
       
  1153 	@param aPtr Pointer to data that needs to be passed to the callback function
       
  1154 	*/
       
  1155 	IMPORT_C void PrivRegisterEventCallbackL(TUint aType, 
       
  1156 										  TRtpCallbackFunction aCallback, 
       
  1157 										  TAny* aPtr);
       
  1158 										  
       
  1159  private:
       
  1160 	friend class RRtpSession;
       
  1161 	friend class TRtpEvent;
       
  1162 	CRtpSendSource* iPtr;
       
  1163 	// Note: Comments that start with //\ are pseudo-variables used to get
       
  1164 	// Doxygen collaboration diagrams to look right. Ignore them.
       
  1165 	//\ TRtpCallback callbacks_1_n;
       
  1166 	//\ TRtpEvent events_1_n;
       
  1167 	//\ TRtpSendPacket packets_1_n;
       
  1168 	};
       
  1169 
       
  1170 
       
  1171 
       
  1172 
       
  1173 /**
       
  1174 @publishedAll
       
  1175 @released
       
  1176 
       
  1177 A handle to a receive stream.
       
  1178 
       
  1179 An object of this type represents the stream of data on a single SSRC and
       
  1180 delivers the RTP packets and RTCP information in the order they
       
  1181 arrive.
       
  1182 
       
  1183 Note that RTP does not guarantee the order of delivery, which means that the 
       
  1184 client may want to buffer the data.
       
  1185 */
       
  1186 class RRtpReceiveSource 
       
  1187 	{
       
  1188  public:
       
  1189 	RRtpReceiveSource();
       
  1190 	inline TBool IsOpen() const;
       
  1191 
       
  1192 	IMPORT_C void Close();
       
  1193 
       
  1194 	
       
  1195 	template <class T> inline void 
       
  1196 		RegisterEventCallbackL(TRtpEventType aType, 
       
  1197 							   void (*aCallback)(T*, const TRtpEvent&), 
       
  1198 							   T* aPtr, 
       
  1199 							   TRtpOneShotness aOneShot,
       
  1200 							   TInt aParameter)
       
  1201 	{
       
  1202 	PrivRegisterEventCallbackL(aType|aOneShot, 
       
  1203 			reinterpret_cast<TRtpCallbackFunction>(aCallback),
       
  1204 			static_cast<TAny*>(aPtr), aParameter);
       
  1205 	}
       
  1206 
       
  1207 
       
  1208 	template <class T> inline void 
       
  1209 		RegisterEventCallbackL(TRtpEventType aType, 
       
  1210 							   void (*aCallback)(T*, const TRtpEvent&), 
       
  1211 							   T* aPtr, 
       
  1212 							   TRtpOneShotness aOneShot = ERtpNotOneShot)	
       
  1213 	{
       
  1214 	PrivRegisterEventCallbackL(aType|aOneShot, 
       
  1215 				reinterpret_cast<TRtpCallbackFunction>(aCallback),
       
  1216 				static_cast<TAny*>(aPtr));
       
  1217 	}
       
  1218 
       
  1219 	/**
       
  1220 	@publishedAll
       
  1221 	@released
       
  1222 	
       
  1223 	Gets the data associated with the specified RTCP SDES (Source Description)
       
  1224 	item.
       
  1225 
       
  1226 	Note a that the PRIV (Private Extensions) SDES item is not supported
       
  1227 	by this mechanism.
       
  1228 
       
  1229 	@param aType  The value identifying the RTCP SDES item.
       
  1230 	
       
  1231 	@return A descriptor reference to the SDES item data. 
       
  1232 	*/
       
  1233 	IMPORT_C TInt GetSDES(const TInt aType, TDes8& aValue);
       
  1234 
       
  1235 
       
  1236 	/**
       
  1237 	@publishedAll
       
  1238 	@released
       
  1239 	
       
  1240 	Gets the most recent SR ((Sender Report) from this SSRC.
       
  1241  
       
  1242     @return A handle to the SR.
       
  1243     */
       
  1244 	IMPORT_C RRtcpSRPart GetSR();
       
  1245 
       
  1246 
       
  1247 	/**
       
  1248 	@publishedAll
       
  1249 	@released
       
  1250 	
       
  1251 	Gets the reason for a BYE packet.
       
  1252 	
       
  1253 	@return A descriptor contaning the BYE message. This is
       
  1254 	        KNullDesC if the source has not sent a BYE packet.
       
  1255     */
       
  1256 	IMPORT_C TDesC8& GetByeReason();
       
  1257 
       
  1258 
       
  1259 	/**
       
  1260 	@publishedAll
       
  1261 	@released
       
  1262 	
       
  1263 	Parameters from the last APP (Application Defined) packet.
       
  1264 
       
  1265   	@param aName  Four-bytes application name
       
  1266 	@param aAppData  Applciation specific data
       
  1267 	@param aSubType  Application defined sub-type of the APP packet
       
  1268 	*/
       
  1269 	IMPORT_C void GetLastApp(TPtrC8& aName, TPtrC8& aAppData, TUint& aSubType);
       
  1270 
       
  1271 	IMPORT_C RRtpReceivePacket Packet();
       
  1272 
       
  1273 	/**
       
  1274 	@publishedAll
       
  1275 	@released
       
  1276 	
       
  1277 	Gets the SSRC of the remote end
       
  1278 
       
  1279 	@return The SSRC of the remote end
       
  1280 	*/
       
  1281 	IMPORT_C TUint SSRC() const;
       
  1282 
       
  1283 	inline TBool operator == (RRtpReceiveSource aThat) const;
       
  1284 	inline TBool operator != (RRtpReceiveSource aThat) const;
       
  1285 
       
  1286 	/**
       
  1287 	@publishedAll
       
  1288 	@released
       
  1289 
       
  1290     The event manager contains a number of callback registrations, each of which 
       
  1291 	binds a function and pointer (normally an object) to a particular kind of
       
  1292     event. Registrations can be bound to all events on a stream.
       
  1293 
       
  1294 	If a function is registered for a particular event, it will be called when 
       
  1295 	that event occurs. One callback function can be associated with more than 1
       
  1296 	callback registration. Callback functions take a pointer argument
       
  1297 	which was supplied as part of the registration
       
  1298 
       
  1299     @param aType Event type
       
  1300 		
       
  1301 	@param aCallback Callback object
       
  1302 		
       
  1303 	@param aPtr Pointer to data that needs to be passed to the callback function
       
  1304 
       
  1305   	@param aParameter Parameter to be passed to internal callback subsystem
       
  1306 	*/
       
  1307 	IMPORT_C void PrivRegisterEventCallbackL(TUint aType, 
       
  1308 										  TRtpCallbackFunction aCallback, 
       
  1309 										  TAny* aPtr, TInt aParameter);
       
  1310 
       
  1311 	/**
       
  1312 	@publishedAll
       
  1313 	@released
       
  1314 
       
  1315     The event manager contains a number of callback registrations, each of which 
       
  1316 	binds a function and pointer (normally an object) to a particular kind of
       
  1317     event. Registrations can be bound to all events on a stream.
       
  1318 
       
  1319 	If a function is registered for a particular event, it will be called when 
       
  1320 	that event occurs. One callback function can be associated with more than 1
       
  1321 	callback registration. Callback functions take a pointer argument
       
  1322 	which was supplied as part of the registration
       
  1323 
       
  1324     @param aType Event type
       
  1325 		
       
  1326 	@param aCallback Callback object
       
  1327 		
       
  1328 	@param aPtr Pointer to data that needs to be passed to the callback function
       
  1329 	*/
       
  1330 
       
  1331 	IMPORT_C void PrivRegisterEventCallbackL(TUint aType, 
       
  1332 										  TRtpCallbackFunction aCallback, 
       
  1333 										  TAny* aPtr);
       
  1334 	/**
       
  1335 	@publishedAll
       
  1336 	@released
       
  1337     
       
  1338     Returns the payloadtype of the newly arrived packet. Should be called before 
       
  1339     the packet() function.
       
  1340     If an open Packet is not present the function will leave with KErrNotFound.
       
  1341  	*/
       
  1342 	IMPORT_C TUint PayLoadTypeL();
       
  1343  private:
       
  1344 	friend class RRtpSession;
       
  1345 	friend class TRtpEvent;
       
  1346 	CRtpReceiveSource* iPtr;
       
  1347 	// Note: Comments that start with //\ are pseudo-variables used to get
       
  1348 	// Doxygen collaboration diagrams to look right. Ignore them.
       
  1349 	//\ TRtpCallback callbacks_1_n;
       
  1350 	//\ TRtpEvent events_1_n;
       
  1351 	//\ TRtpReceivePacket packets_1_n;
       
  1352 	};
       
  1353 
       
  1354 
       
  1355 
       
  1356 
       
  1357 /**
       
  1358 @publishedAll
       
  1359 @released
       
  1360 
       
  1361 A handle to an RTP packet.
       
  1362 
       
  1363 The packet is accessed through the interface provided by this handle.
       
  1364 */
       
  1365 class RRtpPacket
       
  1366 	{
       
  1367  public:
       
  1368 	inline RRtpPacket();
       
  1369 	inline TBool IsOpen() const;
       
  1370 
       
  1371 	IMPORT_C void Close();
       
  1372 	IMPORT_C TPtrC8 Payload() const;
       
  1373 	IMPORT_C TUint SequenceNumber() const;
       
  1374 	IMPORT_C TUint Timestamp() const;
       
  1375 	IMPORT_C TUint SSRC() const;
       
  1376 	IMPORT_C RRtpCSRCs CSRCs() const;
       
  1377 	IMPORT_C TBool ExtensionPresent() const;
       
  1378 	IMPORT_C RRtpHeaderExtension Extension() const; 
       
  1379 	IMPORT_C TBool Marker() const;
       
  1380 	IMPORT_C TUint PayloadType() const;
       
  1381 	IMPORT_C TUint Flags() const;
       
  1382 
       
  1383 	inline TBool operator == (RRtpPacket aThat) const;
       
  1384 	inline TBool operator != (RRtpPacket aThat) const;
       
  1385 
       
  1386  protected:
       
  1387 	TRtpPacket* iPtr;
       
  1388 	// Note: Comments that start with //\ are pseudo-variables used to get
       
  1389 	// Doxygen collaboration diagrams to look right. Ignore them.
       
  1390 	//\ RRtpHeaderExtension extension_1_01;
       
  1391 	//\ RRtpCSRCs csrcs_1_01;
       
  1392 	};
       
  1393 
       
  1394 
       
  1395 
       
  1396 
       
  1397 /**
       
  1398 @publishedAll
       
  1399 @released
       
  1400 
       
  1401 A handle to an RTP packet to be sent (an RTP send packet).
       
  1402 
       
  1403 @see RRtpSendSource
       
  1404 */
       
  1405 class RRtpSendPacket : public RRtpPacket
       
  1406 	{
       
  1407  public:
       
  1408 	IMPORT_C void Send();
       
  1409 	IMPORT_C void Close();
       
  1410 	IMPORT_C TInt SendSync();
       
  1411 	IMPORT_C TDes8& WritePayload();
       
  1412 	IMPORT_C void SetTimestamp(TUint aTimestamp);
       
  1413 	IMPORT_C void SetMarker(TBool aMark);
       
  1414 	IMPORT_C void SetPayloadType(TUint aPayloadType);
       
  1415 	IMPORT_C void SetFlags(TUint aFlags);
       
  1416 
       
  1417 	friend class RRtpSendSource;
       
  1418  private:
       
  1419 	 void InitRtpPacket(TRtpSendPacket* ptr);
       
  1420 	};
       
  1421 
       
  1422 
       
  1423 
       
  1424 
       
  1425 /**
       
  1426 @publishedAll
       
  1427 @released
       
  1428 
       
  1429 A handle to an RTP packet received from another source.
       
  1430 */
       
  1431 class RRtpReceivePacket : public RRtpPacket
       
  1432 	{
       
  1433 	friend class RRtpReceiveSource;
       
  1434 	friend class TRtpReceivePacket;
       
  1435 	};
       
  1436 
       
  1437 
       
  1438 
       
  1439 
       
  1440 /**
       
  1441 @publishedAll
       
  1442 @released
       
  1443 
       
  1444 An RTP event.
       
  1445 
       
  1446 An event is generated when anything happens that a client might want
       
  1447 to know about. The class encapulates two pieces of information:
       
  1448 1. An event type as defined by a TRtpEventType value.
       
  1449 2. Additional information whose meaning is dependent on the event type.
       
  1450 
       
  1451 Additional information may be implicitly associated with the event, but still
       
  1452 needs to be fetched from another object, for example, when processing
       
  1453 an ERtpPacketReceived event, the packet (represented by a RRtpReceivePacket
       
  1454 handle) must be obtained from the receive stream (represented by a
       
  1455 RRtpReceiveStream handle).
       
  1456 
       
  1457 Events are always associated with either an RTP session, a send stream or
       
  1458 a receive stream, and this class has functions for getting the corresponding
       
  1459 handle.
       
  1460 
       
  1461 @see RRtpSession
       
  1462 @see RRtpSendSource
       
  1463 @see RRtpReceiveSource
       
  1464 */
       
  1465 class TRtpEvent
       
  1466 	{
       
  1467  public:
       
  1468 	IMPORT_C TRtpEvent(TRtpEventType aType, TInt aStatus, TAny* aData);
       
  1469 	IMPORT_C RRtpSession Session() const;
       
  1470 	IMPORT_C RRtpSendSource SendSource() const;
       
  1471 	IMPORT_C RRtpReceiveSource ReceiveSource() const;
       
  1472 	IMPORT_C TBool IsSessionEvent() const;
       
  1473 	IMPORT_C TBool IsSendSourceEvent() const;
       
  1474 	IMPORT_C TBool IsReceiveSourceEvent() const;
       
  1475         
       
  1476 	inline TRtpEventType Type() const;
       
  1477 	inline TInt Status() const;
       
  1478  private:
       
  1479 	TRtpEventType iType;
       
  1480 	TInt iStatus;
       
  1481 	TAny* iData;
       
  1482 	};
       
  1483 
       
  1484 
       
  1485 
       
  1486 
       
  1487 /**
       
  1488 @publishedAll
       
  1489 @released
       
  1490 
       
  1491 Reresents an RTP packet's header extension.
       
  1492 
       
  1493 The format of a header extension is profile-defined.
       
  1494 */
       
  1495 class RRtpHeaderExtension
       
  1496 	{
       
  1497  public:
       
  1498 	IMPORT_C TUint16 Type() const;
       
  1499 	IMPORT_C void SetType(TUint16 aType);
       
  1500 	IMPORT_C TPtrC8 Data();
       
  1501  private:
       
  1502 	friend class RRtpPacket;
       
  1503 	TRtpPacket* iPtr;
       
  1504 	};
       
  1505 
       
  1506 
       
  1507 
       
  1508 
       
  1509 /**
       
  1510 @publishedAll
       
  1511 @released
       
  1512 
       
  1513 A handle representing the list of CSRCs in an RTP packet.
       
  1514 */
       
  1515 class RRtpCSRCs
       
  1516 	{
       
  1517  public:
       
  1518 	IMPORT_C TInt Count() const;
       
  1519 	IMPORT_C TUint operator [](TUint aIndex) const;
       
  1520  private:
       
  1521 	friend class RRtpPacket;
       
  1522 	
       
  1523 	TRtpPacket* iPtr;
       
  1524 	};
       
  1525 
       
  1526 
       
  1527 /**
       
  1528 @publishedAll
       
  1529 @released
       
  1530 
       
  1531 A set of panic codes.
       
  1532 
       
  1533 in release mode, different panic codes, such as
       
  1534 KERN-EXEC 3 may be generated instead.
       
  1535 */
       
  1536 enum TRtpPanicCode
       
  1537 	{
       
  1538 	ERtpPacketIsClosed = 1, 
       
  1539 	ERtpPayloadTypeOutOfRange = 2,
       
  1540 	ERtpSessionIsClosed = 3,
       
  1541 	ERtpSourceIsClosed = 4,
       
  1542 	ERtpNoExtension = 5,
       
  1543 	ERtpLeaveInResponseToError = 6,
       
  1544 	ERtpCantSend2PacketsAtOnce = 7,
       
  1545 	ERtpWrongEventType = 8,
       
  1546 	ERtpWrongParameter = 9,
       
  1547 	ERtpSendSourceAlreadyOpen = 10,
       
  1548 	ERtpSessionAlreadyOpen = 11,
       
  1549 	//
       
  1550 	ERtpCoreController = 100,
       
  1551 	};
       
  1552 
       
  1553 
       
  1554 GLREF_C void Panic(TRtpPanicCode aPanicCode);
       
  1555 
       
  1556 #include "rtp.inl"
       
  1557 
       
  1558 #endif // RTP_H
       
  1559