6 #ifndef IFM3D_RTSP_RTSP_CLIENT_H
7 #define IFM3D_RTSP_RTSP_CLIENT_H
17 #include <ifm3d/common/err.h>
18 #include <ifm3d/device/device.h>
19 #include <ifm3d/device/o3r.h>
20 #include <ifm3d/fg/frame.h>
21 #include <ifm3d/rtsp/module_rtsp.h>
22 #include <ifm3d/rtsp/nal_unit.h>
45 using Ptr = std::shared_ptr<RtspClient>;
75 std::optional<std::string>
url;
78 std::uint16_t port = 8554;
81 std::string stream_path =
"port1";
93 using BufferIdList = std::vector<ifm3d::buffer_id>;
94 using NewFrameCallback = std::function<void(ifm3d::Frame::Ptr)>;
95 using NalUnitCallback = std::function<void(
const ifm3d::NalUnit&)>;
96 using ErrorCallback = std::function<void(
const ifm3d::Error&)>;
97 using StateChangeCallback = std::function<void(
State)>;
155 std::shared_future<
void> Start(const BufferIdList& buffers = {});
162 std::shared_future<void>
Stop();
179 void OnError(ErrorCallback callback =
nullptr);
186 std::unique_ptr<Impl> _impl;
Exception wrapper for library and system errors encountered by the library.
Definition: err.h:126
RTSP/1.0 client that streams H.264 video from an ifm device and, optionally, decodes it into ifm3d::F...
Definition: rtsp_client.h:43
void OnStateChange(StateChangeCallback callback=nullptr)
Registers a callback invoked on every session state transition.
void OnNalUnit(NalUnitCallback callback=nullptr)
Registers a callback invoked for each reassembled NAL unit.
State
Lifecycle state of the RTSP session.
Definition: rtsp_client.h:58
RtspClient(ifm3d::Device::Ptr device, const ifm3d::PortInfo &port, Config config)
Constructs a client for a specific port, deriving the RTSP port and stream path from the port's adver...
Transport
RTP transport used for the media stream.
Definition: rtsp_client.h:49
RtspClient(ifm3d::Device::Ptr device)
Constructs a client that streams from the given device using the default configuration.
void OnError(ErrorCallback callback=nullptr)
Registers a callback invoked on terminal errors.
void OnNewFrame(NewFrameCallback callback=nullptr)
Registers a callback invoked for each received frame.
std::shared_future< void > Stop()
Sends TEARDOWN, stops the worker thread and closes the socket.
RtspClient(ifm3d::Device::Ptr device, const ifm3d::PortInfo &port)
Constructs a client for a specific port, deriving the RTSP port and stream path from the port's adver...
RtspClient(ifm3d::Device::Ptr device, Config config)
Constructs a client that streams from the given device.
A single, fully reassembled H.264 NAL unit.
Definition: nal_unit.h:31
Configuration for an RtspClient instance.
Definition: rtsp_client.h:69
std::optional< std::string > decoder
Override the decoder name used for decoding h264 video into buffers.
Definition: rtsp_client.h:90
std::optional< std::string > url
Full RTSP URL override (e.g.
Definition: rtsp_client.h:75