2020-12-10 01:19:35 +08:00
|
|
|
#ifndef ZM_RTSP_SERVER_THREAD_H
|
|
|
|
#define ZM_RTSP_SERVER_THREAD_H
|
|
|
|
|
2021-02-04 11:47:28 +08:00
|
|
|
#include "zm_config.h"
|
|
|
|
#include "zm_ffmpeg.h"
|
2020-12-10 01:19:35 +08:00
|
|
|
#include "zm_thread.h"
|
2021-02-28 01:26:19 +08:00
|
|
|
#include "zm_rtsp_server_server_media_subsession.h"
|
|
|
|
#include "zm_rtsp_server_fifo_source.h"
|
2021-02-04 11:47:28 +08:00
|
|
|
#include <list>
|
2021-02-08 02:12:39 +08:00
|
|
|
#include <memory>
|
2020-12-10 01:19:35 +08:00
|
|
|
|
2021-02-04 11:47:28 +08:00
|
|
|
#if HAVE_RTSP_SERVER
|
2020-12-10 01:19:35 +08:00
|
|
|
#include <BasicUsageEnvironment.hh>
|
|
|
|
#include <RTSPServer.hh>
|
2021-02-04 11:47:28 +08:00
|
|
|
|
|
|
|
class Monitor;
|
2020-12-10 01:19:35 +08:00
|
|
|
|
|
|
|
class RTSPServerThread : public Thread {
|
|
|
|
private:
|
2021-02-09 21:50:07 +08:00
|
|
|
std::shared_ptr<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;
|
2021-01-21 23:26:46 +08:00
|
|
|
std::list<FramedSource *> sources;
|
2020-12-10 01:19:35 +08:00
|
|
|
|
|
|
|
public:
|
2021-02-08 02:12:39 +08:00
|
|
|
explicit RTSPServerThread(std::shared_ptr<Monitor> monitor);
|
2020-12-10 01:19:35 +08:00
|
|
|
~RTSPServerThread();
|
2021-02-28 01:26:19 +08:00
|
|
|
ServerMediaSession *addSession(std::string &streamname);
|
|
|
|
void addStream(std::string &streamname, AVStream *, AVStream *);
|
|
|
|
FramedSource *addFifo(ServerMediaSession *sms, std::string fifo);
|
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-20 02:43:25 +08:00
|
|
|
const 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
|
|
|
};
|
2021-02-04 11:59:03 +08:00
|
|
|
#endif // HAVE_RTSP_SERVER
|
2020-12-10 01:19:35 +08:00
|
|
|
|
2021-02-04 11:59:03 +08:00
|
|
|
#endif // ZM_RTSP_SERVER_THREAD_H
|