#ifndef LIVESTREAMMEDIASUBSESSION_H
#define LIVESTREAMMEDIASUBSESSION_H

#include <OnDemandServerMediaSubsession.hh>
#include <FramedSource.hh>
#include <RTPSink.hh>
#include "ImageHandler.h"
#include "CFramedLiveSource.h"
#include <H264VideoStreamFramer.hh>
#include <H264VideoRTPSink.hh>
#include <StreamReplicator.hh>
#include <StreamReplicator.hh>
#include <SimpleRTPSink.hh>
#include "NULLSink.h"
#include <H265VideoRTPSink.hh>
#include <H265VideoStreamFramer.hh>

class CLiveStreamMediaSubSession : public OnDemandServerMediaSubsession
{
public:
    static CLiveStreamMediaSubSession*
        createNew(UsageEnvironment& env,CImageIO *piImgIO);
public:
    CLiveStreamMediaSubSession(UsageEnvironment& env,
                               CImageIO *piImgIO);

     virtual ~CLiveStreamMediaSubSession();

    void CreateNullStream();
private:
    // redefined virtual functions
    virtual FramedSource* createNewStreamSource(unsigned clientSessionId,
        unsigned& estBitrate);
    virtual RTPSink* createNewRTPSink(Groupsock* rtpGroupsock,
        unsigned char rtpPayloadTypeIfDynamic,
        FramedSource* inputSource);
protected:
    virtual char const* sdpLines();

    CImageIO *m_piImgIO;
    StreamReplicator *m_pReplicator;
    MediaSink *m_pNullSink;
};

#endif // LIVESTREAMMEDIASUBSESSION_H
