2021-02-28 01:26:19 +08: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.
|
|
|
|
**
|
|
|
|
**
|
|
|
|
** ZoneMinder Live555 source
|
|
|
|
**
|
|
|
|
** -------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
#include "zm_rtsp_server_fifo_video_source.h"
|
|
|
|
|
|
|
|
#if HAVE_RTSP_SERVER
|
|
|
|
ZoneMinderFifoVideoSource::ZoneMinderFifoVideoSource(
|
2021-03-11 00:01:04 +08:00
|
|
|
std::shared_ptr<xop::RtspServer>& rtspServer,
|
|
|
|
xop::MediaSessionId sessionId,
|
|
|
|
xop::MediaChannelId channelId,
|
2021-05-10 04:39:38 +08:00
|
|
|
const std::string &fifo
|
2021-03-11 00:01:04 +08:00
|
|
|
) :
|
2021-05-10 04:39:38 +08:00
|
|
|
ZoneMinderFifoSource(rtspServer, sessionId, channelId, fifo),
|
|
|
|
m_width(0),
|
|
|
|
m_height(0)
|
2021-02-28 01:26:19 +08:00
|
|
|
{
|
2021-03-11 00:01:04 +08:00
|
|
|
m_timeBase = {1, 90000};
|
|
|
|
}
|
|
|
|
|
|
|
|
void ZoneMinderFifoVideoSource::PushFrame(const uint8_t *data, size_t size, int64_t pts) {
|
2021-04-09 15:48:42 +08:00
|
|
|
xop::AVFrame frame(data, size);
|
2021-03-11 00:01:04 +08:00
|
|
|
frame.timestamp = av_rescale_q(pts, AV_TIME_BASE_Q, m_timeBase);
|
|
|
|
m_rtspServer->PushFrame(m_sessionId, m_channelId, frame);
|
2021-02-28 01:26:19 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif // HAVE_RTSP_SERVER
|