2020-12-10 01:19:35 +08:00
|
|
|
#include "zm.h"
|
|
|
|
#if HAVE_RTSP_SERVER
|
|
|
|
|
|
|
|
#ifndef ZM_RTSP_SERVER_THREAD_H
|
|
|
|
#define ZM_RTSP_SERVER_THREAD_H
|
|
|
|
|
|
|
|
#include "zm_thread.h"
|
|
|
|
#include <signal.h>
|
|
|
|
|
|
|
|
#include "zm_monitor.h"
|
|
|
|
|
|
|
|
#include <BasicUsageEnvironment.hh>
|
|
|
|
#include <RTSPServer.hh>
|
2021-01-07 22:46:06 +08:00
|
|
|
#include <libavcodec/codec_id.h>
|
|
|
|
#include <libavformat/avformat.h>
|
2020-12-10 01:19:35 +08:00
|
|
|
|
|
|
|
class RTSPServerThread : public Thread {
|
|
|
|
private:
|
|
|
|
Monitor *monitor;
|
2021-01-07 00:24:52 +08:00
|
|
|
char terminate;
|
2020-12-10 01:19:35 +08:00
|
|
|
|
|
|
|
TaskScheduler* scheduler;
|
|
|
|
UsageEnvironment* env;
|
|
|
|
UserAuthenticationDatabase* authDB;
|
|
|
|
|
|
|
|
RTSPServer* rtspServer;
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit RTSPServerThread(Monitor *);
|
|
|
|
~RTSPServerThread();
|
2021-01-07 22:46:06 +08:00
|
|
|
void addStream(AVStream *);
|
2020-12-10 01:19:35 +08:00
|
|
|
int run();
|
2021-01-07 00:24:52 +08:00
|
|
|
void stop();
|
|
|
|
bool stopped() const;
|
|
|
|
private:
|
2021-01-07 22:46:06 +08:00
|
|
|
std::string getRtpFormat(AVCodecID codec, bool muxTS);
|
2021-01-07 00:24:52 +08:00
|
|
|
int addSession(
|
|
|
|
const std::string & sessionName,
|
|
|
|
const std::list<ServerMediaSubsession*> & subSession
|
|
|
|
);
|
2020-12-10 01:19:35 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
#endif
|