v4l2rtspserver/inc/ServerMediaSubsession.h

84 lines
3.0 KiB
C
Raw Normal View History

2014-07-20 14:02:14 +00:00
/* ---------------------------------------------------------------------------
** This software is in the public domain, furnished "as is", without technical
** support, and with no warranty, express or implied, as to its usefulness for
** any purpose.
**
** ServerMediaSubsession.h
**
** -------------------------------------------------------------------------*/
#ifndef SERVER_MEDIA_SUBSESSION
#define SERVER_MEDIA_SUBSESSION
#include <string>
// live555
#include <liveMedia.hh>
2014-08-17 15:29:08 +00:00
//forward declarations
class V4L2DeviceSource;
2014-07-20 14:02:14 +00:00
// ---------------------------------
// BaseServerMediaSubsession
// ---------------------------------
class BaseServerMediaSubsession
{
public:
BaseServerMediaSubsession(StreamReplicator* replicator): m_replicator(replicator) {};
public:
2014-08-17 15:29:08 +00:00
static FramedSource* createSource(UsageEnvironment& env, FramedSource * videoES, int format);
static RTPSink* createSink(UsageEnvironment& env, Groupsock * rtpGroupsock, unsigned char rtpPayloadTypeIfDynamic, int format);
char const* getAuxLine(V4L2DeviceSource* source,unsigned char rtpPayloadType);
2014-07-20 14:02:14 +00:00
protected:
StreamReplicator* m_replicator;
};
// -----------------------------------------
// ServerMediaSubsession for Multicast
// -----------------------------------------
class MulticastServerMediaSubsession : public PassiveServerMediaSubsession , public BaseServerMediaSubsession
{
public:
static MulticastServerMediaSubsession* createNew(UsageEnvironment& env
, struct in_addr destinationAddress
, Port rtpPortNum, Port rtcpPortNum
, int ttl
, unsigned char rtpPayloadType
, StreamReplicator* replicator
, int format);
protected:
MulticastServerMediaSubsession(StreamReplicator* replicator, RTPSink* rtpSink, RTCPInstance* rtcpInstance)
: PassiveServerMediaSubsession(*rtpSink, rtcpInstance), BaseServerMediaSubsession(replicator), m_rtpSink(rtpSink) {};
virtual char const* sdpLines() ;
virtual char const* getAuxSDPLine(RTPSink* rtpSink,FramedSource* inputSource);
protected:
RTPSink* m_rtpSink;
std::string m_SDPLines;
};
// -----------------------------------------
// ServerMediaSubsession for Unicast
// -----------------------------------------
class UnicastServerMediaSubsession : public OnDemandServerMediaSubsession , public BaseServerMediaSubsession
{
public:
static UnicastServerMediaSubsession* createNew(UsageEnvironment& env, StreamReplicator* replicator, int format);
protected:
UnicastServerMediaSubsession(UsageEnvironment& env, StreamReplicator* replicator, int format)
: OnDemandServerMediaSubsession(env, False), BaseServerMediaSubsession(replicator), m_format(format) {};
virtual FramedSource* createNewStreamSource(unsigned clientSessionId, unsigned& estBitrate);
virtual RTPSink* createNewRTPSink(Groupsock* rtpGroupsock, unsigned char rtpPayloadTypeIfDynamic, FramedSource* inputSource);
virtual char const* getAuxSDPLine(RTPSink* rtpSink,FramedSource* inputSource);
protected:
int m_format;
};
#endif