📄 rtspif.h
字号:
/* ***** BEGIN LICENSE BLOCK *****
* Version: RCSL 1.0/RPSL 1.0
*
* Portions Copyright (c) 1995-2002 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
* Version 1.0 (the "RPSL") available at
* http://www.helixcommunity.org/content/rpsl unless you have licensed
* the file under the RealNetworks Community Source License Version 1.0
* (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.
*
* 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 _RTSPIF_H_
#define _RTSPIF_H_
//XXX...the following 2 includes should go away
#include "hxpends.h"
#include "hxcomm.h"
// Don't remove this include!
#include "hxstring.h"
#include "basepkt.h"
#include "servrsnd.h"
struct IHXTCPSocket;
class RTSPServerState;
class RTSPClientState;
class RawPacketFilter;
struct IHXBuffer;
class CHXSimpleList;
class RTSPTransport;
class RTSPStreamHandler;
struct IHXPacket;
struct IHXValues;
struct IHXPacketResend;
class BasePacket;
_INTERFACE IHXFileFormatHeaderAdvise;
/* client initialization flags */
#define RTSP_INIT_NO_AUTHORIZATION 0
#define RTSP_INIT_HXPRIVATE_AUTHORIZATION 1
#define RTSP_INIT_WWW_AUTHORIZATION 2
typedef enum _RTSPTransportSubTypeEnum
{
RTSP_SUBTR_NONE = 0, /* unknown */
RTSP_SUBTR_UDP = 1, /* udp */
RTSP_SUBTR_TCP = 2, /* tcp */
RTSP_SUBTR_MCAST = 3, /* multicast */
RTSP_SUBTR_NULLSET = 4 /* null setup */
} RTSPTransportSubTypeEnum;
typedef enum _RTSPTransportTypeEnum
{
RTSP_TR_NONE = 0, /* No transport */
RTSP_TR_RDT_MCAST, /* x-real-rdt/mcast */
RTSP_TR_RDT_UDP, /* x-real-rdt/udp */
RTSP_TR_RDT_TCP, /* x-real-rdt/tcp */
RTSP_TR_TNG_UDP, /* x-pn-tng/udp, Supported, Deprecated */
RTSP_TR_TNG_TCP, /* x-pn-tng/tcp, Supported, Deprecated */
RTSP_TR_TNG_MCAST, /* x-pn-tng/mcast, Not Supported / Deprecated */
RTSP_TR_RTP_UDP, /* rtp/avp/udp;unicast */
RTSP_TR_RTP_MCAST, /* rtp/avp/udp;multicast */
RTSP_TR_RTP_TCP, /* rtp/avp/tcp;unicast */
RTSP_TR_RTCP, /* Not valid in SETUP */
RTSP_TR_NULLSET, /* x-real-nullsetup, for RealProxy */
RTSP_TR_BCNG_UDP,
RTSP_TR_BCNG_MCAST,
RTSP_TR_BCNG_TCP,
RTSP_TR_LAST
} RTSPTransportTypeEnum;
typedef enum _RTSPTransportModeEnum
{
RTSP_TRMODE_NONE = 0, /* No mode, uninitialized */
RTSP_TRMODE_PLAY, /* mode=play, default per 2326 */
RTSP_TRMODE_RECORD, /* mode=record */
RTSP_TRMODE_OTHER /* unrecognized */
} RTSPTransportModeEnum;
typedef enum _RTSPPrerollTypeEnum
{
RTSP_PREROLL_NONE = 0, /* unknown */
RTSP_PREROLL_PREDECBUFPERIOD = 1, /* x-initpredecbufperiod */
} RTSPPrerollTypeEnum;
/*
* Various macros for determining the type of transport:
*
* IS_CLIENT_TRANSPORT: a player transport (eg. not server-to-server)
* IS_RDT_TRANSPORT : an RDT or TNG transport
* IS_RTP_TRANSPORT : an RTP (rfc1889) transport
* IS_TCP_TRANSPORT : any TCP transport (client or not)
* IS_MCAST_TRANSPORT : any multicast transport (client or not)
*
* Note that nullsetup does not fall into any of these categories.
*/
#define IS_CLIENT_TRANSPORT(t) \
((t) >= RTSP_TR_RDT_MCAST && (t) <= RTSP_TR_RTCP)
#define IS_RDT_TRANSPORT(t) \
((t) >= RTSP_TR_RDT_MCAST && (t) <= RTSP_TR_TNG_MCAST)
#define IS_RTP_TRANSPORT(t) \
((t) >= RTSP_TR_RTP_UDP && (t) <= RTSP_TR_RTCP)
#define IS_TCP_TRANSPORT(t) \
((t) == RTSP_TR_RDT_TCP || (t) == RTSP_TR_TNG_TCP || \
(t) == RTSP_TR_RTP_TCP || (t) == RTSP_TR_BCNG_TCP)
#define IS_MCAST_TRANSPORT(t) \
((t) == RTSP_TR_RDT_MCAST || (t) == RTSP_TR_TNG_MCAST || \
(t) == RTSP_TR_RTP_MCAST || (t) == RTSP_TR_BCNG_MCAST)
enum /* parameter types */
{
RTSP_PARAM_STRING = 0,
RTSP_PARAM_LONG = 1,
RTSP_PARAM_BINARY = 2
};
enum RTPInfoEnum
{
RTPINFO_ERROR, /* error */
RTPINFO_SEQ, /* only Seq found */
RTPINFO_RTPTIME, /* only rtptime found */
RTPINFO_SEQ_RTPTIME, /* both seq & rtptime found */
RTPINFO_EMPTY /* neither seq nor rtptime found */
};
typedef enum
{
RTSPMEDIA_TYPE_UNKNOWN,
RTSPMEDIA_TYPE_AUDIO,
RTSPMEDIA_TYPE_VIDEO,
RTSPMEDIA_TYPE_APP
} RTSPMediaType;
typedef struct _RTSPASMRule
{
UINT16 m_ruleNumber;
UINT16 m_streamNumber;
} RTSPASMRule;
typedef struct _RTSPSubscription
{
UINT16 m_ruleNumber;
UINT16 m_streamNumber;
BOOL m_bIsSubscribe; // Only used in RuleChanges()
} RTSPSubscription;
typedef struct _RTSPStreamInfo
{
_RTSPStreamInfo()
: m_rtpPayloadType(101)
, m_bHasMarkerRule(0)
, m_markerRule(1)
, m_bHasRTCPRule(0)
, m_ulPayloadWirePacket(0)
, m_RTCPRule(1)
, m_sampleRate(1)
, m_sampleSize(1)
, m_RTPFactor(1)
, m_HXFactor(1)
, m_bIsLive(0)
, m_bExtensionSupport(0)
, m_bActive(TRUE)
, m_bForceRTP(FALSE)
, m_bHasOutOfOrderTS(FALSE)
, m_ulAvgBitRate(0)
, m_ulRtpRRBitRate((UINT32)-1)
, m_ulRtpRSBitRate((UINT32)-1)
, m_bRealMedia(FALSE)
{}
UINT16 m_streamNumber;
BOOL m_bNeedReliablePackets;
CHXString m_streamControl;
UINT16 m_sPort;
BOOL m_bForceRTP;
BOOL m_bHasOutOfOrderTS;
RTSPMediaType m_eMediaType;
// rest of them are only for RTP
INT16 m_rtpPayloadType;
BOOL m_bHasMarkerRule;
UINT16 m_markerRule;
BOOL m_bHasRTCPRule;
UINT32 m_ulPayloadWirePacket;
BOOL m_bIsSyncMaster;
UINT16 m_RTCPRule;
UINT32 m_sampleRate;
UINT32 m_sampleSize;
UINT32 m_RTPFactor;
UINT32 m_HXFactor;
BOOL m_bIsLive;
BOOL m_bExtensionSupport;
BOOL m_bActive;
UINT32 m_ulAvgBitRate;
UINT32 m_ulRtpRRBitRate;
UINT32 m_ulRtpRSBitRate;
BOOL m_bRealMedia;
} RTSPStreamInfo;
typedef struct _RTSPSocketInfo
{
IHXTCPSocket* m_pSocket;
UINT32 m_ulForeignAddr;
} RTSPSocketInfo;
/*
* XXXBAB - compatibility struct until I change the interface
* to SendSetupRequest
*/
class RTSPTransportType
{
public:
RTSPTransportType() :
m_lTransportType(RTSP_TR_NONE),
m_Mode(RTSP_TRMODE_NONE),
m_sPort(0),
m_streamNumber(0),
m_ulBufferDepth(0),
m_RTSPDestinationAddress(NULL)
{
// Empty
}
RTSPTransportType(const RTSPTransportType& other)
{
*this = other;
}
~RTSPTransportType()
{
delete[] m_RTSPDestinationAddress;
}
RTSPTransportType& operator=(const RTSPTransportType& other)
{
m_lTransportType = other.m_lTransportType;
m_Mode = other.m_Mode;
m_sPort = other.m_sPort;
m_streamNumber = other.m_streamNumber;
m_ulBufferDepth = other.m_ulBufferDepth;
m_RTSPDestinationAddress = other.m_RTSPDestinationAddress ?
new_string(other.m_RTSPDestinationAddress) : NULL;
return *this;
}
RTSPTransportTypeEnum m_lTransportType;
RTSPTransportModeEnum m_Mode;
UINT16 m_sPort;
UINT16 m_streamNumber;
UINT32 m_ulBufferDepth;
char* m_RTSPDestinationAddress;
};
DECLARE_INTERFACE_(IHXRTSPServerProtocolResponse, IUnknown)
{
/*
* IUnknown methods
*/
STDMETHOD(QueryInterface) (THIS_
REFIID riid,
void** ppvObj) PURE;
STDMETHOD_(ULONG32,AddRef) (THIS) PURE;
STDMETHOD_(ULONG32,Release) (THIS) PURE;
/************************************************************************
* Method:
* IHXRTSPServerProtocolResponse::HandleAuthentication
*
* Purpose:
* Called to indicate success/failure of authentication
*/
/*XXXkshoop Removed, it was deadweight
STDMETHOD(HandleAuthentication) (THIS_
HX_RESULT status
) PURE;
*/
/*************************************************************************
* Method:
* IHXRTSPServerProtocolResponse::HandleWWWAuthentication
*
* Purpose:
* Called when a WWW-Authenticate header is received.
*/
/*XXXkshoop Removed, it was deadweight
STDMETHOD(HandleWWWAuthentication) (THIS_
IHXValues* pAuthValues
) PURE;
*/
/************************************************************************
* Method:
* IHXRTSPServerProtocolResponse::HandleStreamDescriptionRequest
* Purpose:
* Called to get stream description for an URL
*/
STDMETHOD(HandleStreamDescriptionRequest)
(THIS_
const char* pURL,
IHXValues* pRequestHeaders,
const char* pSessionID,
BOOL bUseRTP
) PURE;
STDMETHOD(HandleStreamRecordDescriptionRequest)
(THIS_
const char* pURL,
const char* pSessionID,
IHXValues* pFileHeader,
CHXSimpleList* pHeaders,
IHXValues* pRequestHeaders
) PURE;
/************************************************************************
* Method:
* IHXRTSPServerProtocolResponse::HandleSetupRequest
* Purpose:
* Called to indicate success/failure of setting up a transport
*/
STDMETHOD(HandleSetupRequest) (THIS_
HX_RESULT status
) PURE;
/************************************************************************
* Method:
* IHXRTSPServerProtocolResponse::HandleSetParameterRequest
* Purpose:
* Called to tell the client to set a parameter
*/
STDMETHOD(HandleSetParameterRequest) (THIS_
UINT32 lParamType,
const char* pParamName,
IHXBuffer* pParamValue
) PURE;
STDMETHOD(HandleSetParameterRequest) (THIS_
const char* pSessionID,
const char* pParamName,
const char* pParamValue,
const char* pContent) PURE;
STDMETHOD(HandleSetParameterResponse) (THIS_
HX_RESULT status
) PURE;
/************************************************************************
* Method:
* IHXRTSPServerProtocolResponse::HandleGetParameterRequest
* Purpose:
* Called to tell the client to get a parameter
*/
STDMETHOD(HandleGetParameterRequest) (THIS_
UINT32 lParamType,
const char* pParamName,
IHXBuffer** pParamValue
) PURE;
STDMETHOD(HandleGetParameterResponse) (THIS_
HX_RESULT status,
IHXBuffer* pParamValue
) PURE;
/************************************************************************
* Method:
* IHXRTSPServerProtocolResponse::HandlePlayRequest
* Purpose:
* Called to start packet delivery - lFrom is start time in msecs,
* lTo is end time in msecs.
*/
STDMETHOD(HandlePlayRequest) (THIS_
UINT32 lFrom,
UINT32 lTo,
CHXSimpleList* pSubscriptions,
/*RTSPSubscription*/
const char* pSessionID
) PURE;
STDMETHOD(HandleRecordRequest) (THIS_
const char* pSessionID) PURE;
/************************************************************************
* Method:
* IHXRTSPServerProtocolResponse::HandlePauseRequest
* Purpose:
* Called to pause packet delivery
*/
STDMETHOD(HandlePauseRequest) (THIS_
const char* pSessionID) PURE;
/************************************************************************
* Method:
* IHXRTSPServerProtocolResponse::HandleResumeRequest
* Purpose:
* Called to resume packet delivery
*/
STDMETHOD(HandleResumeRequest) (THIS_
const char* pSessionID) PURE;
/************************************************************************
* Method:
* IHXRTSPServerProtocolResponse::HandleTeardownResponse
* Purpose:
* Called to confirm release of connection resources
*/
STDMETHOD(HandleTeardownResponse) (THIS_
HX_RESULT status
) PURE;
STDMETHOD(HandleTeardownRequest) (THIS_
const char* pSessionID) PURE;
/************************************************************************
* Method:
* IHXRTSPServerProtocolResponse::HandlePacket
* Purpose:
* Called when transport layer has received a data packet
*/
STDMETHOD(HandlePacket) (THIS_
HX_RESULT status,
const char* pSessionID,
IHXPacket* pPacket
) PURE;
STDMETHOD(HandleSubscribe) (THIS_
CHXSimpleList* pSubscriptions,
/*RTSPSubscription*/
const char* pSessionID
) PURE;
STDMETHOD(HandleUnsubscribe) (THIS_
CHXSimpleList* pUnsubscriptions,
/*RTSPSubscription*/
const char* pSessionID
) PURE;
STDMETHOD(HandleSubscriptionDone) (THIS_
REF(UINT32) ulAddress,
REF(UINT32) ulSourcePort,
REF(UINT32) ulPort,
const char* pSessionID,
REF(RTSPStreamHandler*) pHandler)
{ return HXR_NOTIMPL; }
STDMETHOD(HandleBackChannel) (THIS_
IHXPacket* pPacket,
const char* pSessionID
) PURE;
STDMETHOD(HandleBWReport) (THIS_
HX_RESULT status,
const char* pSessionID,
INT32 aveBandwidth,
INT32 packetLoss,
INT32 bandwidthWanted
) PURE;
STDMETHOD(HandlePlayerStats) (THIS_
const char* pStats,
const char* pSessionID
) PURE;
STDMETHOD(HandleSessionHeaders) (THIS_
IHXValues* pSessionHeaders
) PURE;
STDMETHOD(HandleSpeedParam) (THIS_
const char* pSessionID,
FIXED32 fSpeed
) PURE;
STDMETHOD(HandleScaleParam) (THIS_
const char* pSessionID,
FIXED32 fScale
) PURE;
/************************************************************************
* Method:
* IHXRTSPServerProtocolResponse::HandleProtocolError
* Purpose:
* Called to notify client of protocol error conditions
*/
STDMETHOD(HandleProtocolError) (THIS_
HX_RESULT status
) PURE;
STDMETHOD(AddSession) (THIS_
const char* pURLText,
UINT32 ulSeqNo,
REF(CHXString) sessionID,
BOOL bRetainEntityForSetup) PURE;
STDMETHOD(AddSessionWithID) (THIS_
const char* pURLText,
UINT32 ulSeqNo,
REF(CHXString) sessionID,
BOOL bRetainEntityForSetup) PURE;
STDMETHOD(AddTransport) (THIS_
RTSPTransport* pTransport,
const char* pSessionID,
UINT16 streamNumber,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -