rtsptran.h

来自「symbian 下的helix player源代码」· C头文件 代码 · 共 440 行 · 第 1/2 页

H
440
字号
/* ***** BEGIN LICENSE BLOCK *****
 * Source last modified: $Id: rtsptran.h,v 1.16.2.1 2004/07/09 02:04:37 hubbe Exp $
 * 
 * Portions Copyright (c) 1995-2004 RealNetworks, Inc. All Rights Reserved.
 * 
 * The contents of this file, and the files included with this file,
 * are subject to the current version of the RealNetworks Public
 * Source License (the "RPSL") available at
 * http://www.helixcommunity.org/content/rpsl unless you have licensed
 * the file under the current version of the RealNetworks Community
 * Source License (the "RCSL") available at
 * http://www.helixcommunity.org/content/rcsl, in which case the RCSL
 * will apply. You may also obtain the license terms directly from
 * RealNetworks.  You may not use this file except in compliance with
 * the RPSL or, if you have a valid RCSL with RealNetworks applicable
 * to this file, the RCSL.  Please see the applicable RPSL or RCSL for
 * the rights, obligations and limitations governing use of the
 * contents of the file.
 * 
 * Alternatively, the contents of this file may be used under the
 * terms of the GNU General Public License Version 2 or later (the
 * "GPL") in which case the provisions of the GPL are applicable
 * instead of those above. If you wish to allow use of your version of
 * this file only under the terms of the GPL, and not to allow others
 * to use your version of this file under the terms of either the RPSL
 * or RCSL, indicate your decision by deleting the provisions above
 * and replace them with the notice and other provisions required by
 * the GPL. If you do not delete the provisions above, a recipient may
 * use your version of this file under the terms of any one of the
 * RPSL, the RCSL or the GPL.
 * 
 * This file is part of the Helix DNA Technology. RealNetworks is the
 * developer of the Original Code and owns the copyrights in the
 * portions it created.
 * 
 * This file, and the files included with this file, is distributed
 * and made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY
 * KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS
 * ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES
 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET
 * ENJOYMENT OR NON-INFRINGEMENT.
 * 
 * Technology Compatibility Kit Test Suite(s) Location:
 *    http://www.helixcommunity.org/content/tck
 * 
 * Contributor(s):
 * 
 * ***** END LICENSE BLOCK ***** */

#ifndef _RTSPTRAN_H_
#define _RTSPTRAN_H_

//#define RDT_MESSAGE_DEBUG

#include "hxengin.h"
#include "hxmon.h"
#include "transbuf.h"
#include "statinfo.h"
#include "hxsmbw.h"

// GCC won't let me forward declare CHXMapLongToObj::Iterator, 
// so I have to include this. -JR
#include "hxmap.h"

#include "packfilt.h"

struct IHXScheduler;
struct IHXUDPSocket;
struct IHXPacket;
struct IHXBuffer;
struct IHXCommonClassFactory;
struct IHXInternalReset;
struct IHXPlayerState;
struct IHXAccurateClock;
struct IHXSourceBufferingStats2;
class  RTSPResendBuffer;
class  CHXBitset;
class  HX_deque;
class  Timeval;
class  CHXTimestampConverter;
class  TNGLatencyReportPacket;
struct IHXSessionStats;

class TNGDataPacket;
class TNGReportPacket;
class TNGACKPacket;
class TNGRTTRequestPacket;
class TNGRTTResponsePacket;
class TNGCongestionPacket;
class TNGStreamEndPacket;

class RTCPBaseTransport;
class RTCPUDPTransport;
class RTCPTCPTransport;
class RTCPPacket;
class ReportHandler;

const UINT32 TRANSPORT_BUF_DURATION           = 2000; // 2 seconds
const UINT32 TRANSPORT_BUF_DURATION_UNDEF     = 0xffffffff;
const UINT32 MAX_TRANSPORT_BUF_DURATION       = 15000;

/* Note: Both port numbers MUST be even */
const UINT16 MIN_UDP_PORT = 6970;
const UINT16 MAX_UDP_PORT = 32000;

const UINT32 MAX_UDP_PACKET = 4096;	// XXXBAB - check this
const UINT32 MAX_PACKET_SIZE = 1000;	// XXXBAB - check this
const UINT32 DEFAULT_WRAP_SEQ_NO = 0x10000;
const UINT32 TNG_WRAP_SEQ_NO = 0xff00;
const UINT32 TNG_MAX_SEQ_GAP = 0x00C8;
const UINT16 MAX_DEQUE_SIZE = 0x8000;
const UINT16 INITIAL_DEQUE_SIZE = 0x400;
const UINT16 PREFETCH_START_SIZE = 0x200;
const UINT16 PREFETCH_CHUNK_SIZE = 0x100;

static const UINT32 RESEND_BUF_DURATION     = 15000;   // 15 seconds
static const UINT32 MAX_RESEND_BUF_DURATION = 90000;
static const UINT32 RESEND_BUF_GROWTH_RATE  = 2000;


//XXXGLENN...needs to be a range of ports for firewalls
//const UINT16 SPLITTER_RESEND_PORT = 10002;


class RTSPStreamData
{
public:
    RTSPStreamData(BOOL needReliable);
    virtual ~RTSPStreamData();

    UINT16	 		m_seqNo;
    UINT16			m_reliableSeqNo;
    UINT16			m_lastSeqNo;
    BOOL			m_bNeedReliable;
    BOOL			m_packetSent;
    UINT16			m_streamNumber;
    UINT32			m_lastTimestamp;
    RTSPTransportBuffer*	m_pTransportBuffer;
    RTSPResendBuffer*		m_pResendBuffer;
    STREAM_STATS*		m_pStreamStats;
    BOOL			m_bReceivedAllPackets;
    BOOL			m_bNeedToACK;
    BOOL			m_bFirstPacket;
    BOOL			m_bUsesRTPPackets;
    RTSPMediaType		m_eMediaType;
    CHXTimestampConverter*      m_pTSConverter;

    /* The core must receive packet ordered in RMA time stamp.
     * This structure is initialized and used when the stream is
     * is instructed to do so.  In such case RMA time stamps
     * are forced to be ordered (out-of-order time stamp is forced
     * to the value of the last in-order time stamp).
     * The use of this structue must be accompanied with the use
     * of RTP packets which preserve the original packet time stamp
     * in RTPTime packet field.
     */
    struct TSOrderHackInfo
    {
	TSOrderHackInfo()
	    : m_ulLastSentTS(0)
	    , m_ulLastRecvTS(0)
	{
	    ;
	}	    
	UINT32	m_ulLastSentTS;
	UINT32  m_ulLastRecvTS;
    };
    TSOrderHackInfo* m_pTSOrderHack;
};

class RTSPStreamHandler
{
public:
    RTSPStreamHandler(RTSPTransport* pOwner);
    ~RTSPStreamHandler();

    HX_RESULT 	      initStreamData(UINT16 streamNumber,
                                     BOOL needReliable,
                                     BOOL bIsSource,
				     INT16 rtpPayloadType,
				     BOOL bPushData,
				     UINT32 wrapSequenceNumber,
				     UINT32 ulBufferDepth,
				     BOOL bHasOutOfOrderTS = FALSE,
				     CHXTimestampConverter* pTSConverter = NULL,
				     RTSPMediaType eMediaType = RTSPMEDIA_TYPE_UNKNOWN);
    RTSPStreamData*   getStreamData(UINT16 streamNumber);
    HX_RESULT         createResendBuffer(UINT16 streamNumber,
					 UINT32 wrapSequenceNumber);
    RTSPResendBuffer* getResendBuffer(UINT16 streamNumber);
    RTSPStreamData*   firstStreamData();
    RTSPStreamData*   nextStreamData();
    BOOL              endStreamData();
    UINT16            streamCount() { return (m_pStreamDataMap) ? (UINT16)m_pStreamDataMap->GetCount() : 0;};
    void	      AddRef()  {   m_lRefCount++; }
    void	      Release() {
				    m_lRefCount--;
				    if (m_lRefCount == 0)
					delete this;
				}

private:
    INT32		m_lRefCount;
    RTSPTransport*	m_pOwner;
    CHXMapLongToObj*	m_pStreamDataMap;
    CHXMapLongToObj::Iterator streamIterator;
};

class RTSPTransport : public RawPacketFilter
{
public:
    RTSPTransport			(BOOL bIsSource);
    virtual ~RTSPTransport 		();
    STDMETHOD(QueryInterface)           (THIS_
                                        REFIID riid,
                                        void** ppvObj) PURE;
    STDMETHOD_(ULONG32,AddRef)      	(THIS) PURE;
    STDMETHOD_(ULONG32,Release)     	(THIS) PURE;


⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?