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