⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 servermediasubsession.h

📁 rtsp协议的主要实现代码.对开发流媒体
💻 H
字号:
// ServerMediaSubsession.h: interface for the ServerMediaSubsession class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_SERVERMEDIASUBSESSION_H__5D60D257_54F8_43B4_B8D1_8403C77EB194__INCLUDED_)
#define AFX_SERVERMEDIASUBSESSION_H__5D60D257_54F8_43B4_B8D1_8403C77EB194__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include <map>
using namespace std;

#include "Type.h"
#include "FramedSource.h"
#include "RTPSink.h"

class Destinations {
public:
	//##ModelId=432A2DD20222
	Destinations(struct in_addr const& destAddr,
	       Port const& rtpDestPort,
		   Port const& rtcpDestPort)
		   : isTCP(False), addr(destAddr), rtpPort(rtpDestPort), rtcpPort(rtcpDestPort) {
	}
	//##ModelId=432A2DD20232
	Destinations(int tcpSockNum, unsigned char rtpChanId, unsigned char rtcpChanId)
		: isTCP(True), rtpPort(0) /*dummy*/, rtcpPort(0) /*dummy*/,
		tcpSocketNum(tcpSockNum), rtpChannelId(rtpChanId), rtcpChannelId(rtcpChanId) {
	}
	
public:
	//##ModelId=432A2DD2021A
	Boolean isTCP;
	//##ModelId=432A2DD20215
	struct in_addr addr;
	//##ModelId=432A2DD20208
	Port rtpPort;
	//##ModelId=432A2DD20203
	Port rtcpPort;
	//##ModelId=432A2DD201F5
	int tcpSocketNum;
	unsigned char rtpChannelId, rtcpChannelId;
};

typedef map<unsigned,Destinations *> MAPDestinations;

class ServerMediaSubsession  
{
public:
	ServerMediaSubsession(const char * SDPMediaTypeString,const char * FileName);
	virtual ~ServerMediaSubsession();
	char const* rangeSDPLine() const;
	// returns a string to be delete[]d
    // returns 0 for an unbounded session (the default)
    // returns > 0 for a bounded session
	virtual void startStream(unsigned clientSessionId, void* streamToken,
		unsigned short& rtpSeqNum,
		unsigned& rtpTimestamp);
	unsigned trackNumber() const { return fTrackNumber; }
	char const* trackId();
	virtual char const* sdpLines();
	virtual void getStreamParameters(unsigned clientSessionId, // in
		netAddressBits clientAddress, // in
		Port const& clientRTPPort, // in
		Port const& clientRTCPPort, // in
		int tcpSocketNum, // in (-1 means use UDP, not TCP)
		unsigned char rtpChannelId, // in (used if TCP)
		unsigned char rtcpChannelId, // in (used if TCP)
		netAddressBits& destinationAddress, // in out
		u_int8_t& destinationTTL, // in out
		Boolean& isMulticast, // out
		Port& serverRTPPort, // out
		Port& serverRTCPPort, // out
		void*& streamToken // out
		);

	virtual RTPSink* createNewRTPSink(unsigned char rtpPayloadTypeIfDynamic,
				    FramedSource* inputSource) = 0;
	virtual FramedSource* createNewStreamSource(unsigned clientSessionId,
		unsigned& estBitrate) = 0;
	virtual float duration() = 0;
	virtual unsigned GetEstBitrate() = 0;
	virtual void testScaleFactor(float& scale); // sets "scale" to the actual supported scale

	virtual void deleteStream(unsigned clientSessionId, void*& streamToken);
public:
	unsigned fTrackNumber; // within an enclosing ServerMediaSession
	char const* fTrackId;
protected:
	FramedSource* fMediaSource;
	RTPSink * fRTPSink;
	const char * fSDPMediaTypeString;
	portNumBits fPortNumForSDP;
	char* fSDPLines;
	const char * fFileName;
	MAPDestinations fDestinationsHashTable;
	char fCNAME[100]; // for RTCP
};

#endif // !defined(AFX_SERVERMEDIASUBSESSION_H__5D60D257_54F8_43B4_B8D1_8403C77EB194__INCLUDED_)

⌨️ 快捷键说明

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