MediaX v1.0.0rc7 [7e6cb74]
Video streaming for military vehicles
Loading...
Searching...
No Matches
rtp_payloader.h
Go to the documentation of this file.
1//
2// Copyright (c) 2025, Astute Systems PTY LTD
3//
4// This file is part of the VivoeX project developed by Astute Systems.
5//
6// Licensed under the Attribution-NonCommercial 4.0 International (CC BY-NC 4.0)
7// License. See the LICENSE file in the project root for full license details.
8//
13
14#ifndef RTP_RTP_PAYLOADER_H_
15#define RTP_RTP_PAYLOADER_H_
16
17#include <iostream>
18#include <string>
19#include <string_view>
20#include <vector>
21
22#include "rtp/rtp_types.h"
23
24namespace mediax::rtp {
25
31 public:
36 RtpPayloader() = default;
37
42 virtual ~RtpPayloader() = default;
43
48 RtpPayloader(RtpPayloader const &) = delete;
49
56
62 virtual void SetStreamInfo(const ::mediax::rtp::StreamInformation &stream_information) = 0;
63
70 virtual bool Open() = 0;
71
76 virtual void Close() = 0;
77
82 virtual void Stop();
83
88 virtual void Start();
89
97 virtual int Transmit(uint8_t *rgbframe, bool blocking = true) = 0;
98
106
113
120 uint32_t GetHeight() const;
121
127 void SetHeight(uint32_t height);
128
135 uint32_t GetWidth() const;
136
142 void SetWidth(uint32_t width);
143
150 uint32_t GetFrameRate() const;
151
157 void SetFrameRate(uint32_t framerate);
158
165 std::string GetIpAddress() const;
166
172 void SetIpAddress(std::string_view ip_address);
173
180 uint32_t GetPort() const;
181
187 void SetPort(uint32_t port);
188
194 std::vector<uint8_t> &GetBuffer() { return frame_; }
195
201 uint32_t GetBufferSize() const { return static_cast<uint32_t>(frame_.size()); }
202
208 void SetBufferSize(uint32_t size) { frame_.resize(size); }
209
210 protected:
217
218 private:
222 std::vector<uint8_t> frame_;
223};
224
225} // namespace mediax::rtp
226
227#endif // RTP_RTP_PAYLOADER_H_
Manage an RTP stream.
Definition rtp_payloader.h:30
void SetWidth(uint32_t width)
Set the Width object.
Definition rtp_payloader.cc:30
uint32_t GetFrameRate() const
Get the Frame Rate of the incoming stream.
Definition rtp_payloader.cc:32
virtual void SetStreamInfo(const ::mediax::rtp::StreamInformation &stream_information)=0
Configure an RTP output stream.
void SetBufferSize(uint32_t size)
Set the Buffer Size object.
Definition rtp_payloader.h:208
RtpPayloader(RtpPayloader const &)=delete
Construct a new Rtp Payloader object.
virtual void Start()
Restart a stopped stream.
Definition rtp_payloader.cc:44
void SetHeight(uint32_t height)
Set the Height object.
Definition rtp_payloader.cc:26
virtual void Close()=0
Close the RTP stream.
RtpPayloader & operator=(RtpPayloader const &)=delete
Construct a new Rtp Payloader object.
RtpPayloader()=default
Construct a new Rtp Payloader object.
std::string GetIpAddress() const
Get the Ip Address of the incoming stream.
Definition rtp_payloader.cc:36
void SetPort(uint32_t port)
Set the Port object.
Definition rtp_payloader.cc:42
void SetIpAddress(std::string_view ip_address)
Set the Ip Address object.
Definition rtp_payloader.cc:38
virtual int Transmit(uint8_t *rgbframe, bool blocking=true)=0
Transmit an RGB buffer.
std::vector< uint8_t > & GetBuffer()
Get the Buffer object.
Definition rtp_payloader.h:194
virtual void Stop()
Stop a stream so it can be quickly restarted. Do not close.
Definition rtp_payloader.cc:48
mediax::rtp::ColourspaceType GetColourSpace() const
Get the Colour Space object of the incoming stream.
Definition rtp_payloader.cc:20
void SetColourSpace(mediax::rtp::ColourspaceType colourspace)
Set the Colour Space object.
Definition rtp_payloader.cc:22
uint32_t GetBufferSize() const
Get the Buffer Size object.
Definition rtp_payloader.h:201
::mediax::rtp::RtpPortType egress_
Egress port.
Definition rtp_payloader.h:220
std::vector< uint8_t > frame_
Data buffer.
Definition rtp_payloader.h:222
uint32_t GetPort() const
Get the Port of the incoming stream.
Definition rtp_payloader.cc:40
virtual bool Open()=0
Open the RTP stream.
uint32_t GetWidth() const
Get the Width object of the incoming stream.
Definition rtp_payloader.cc:28
::mediax::rtp::RtpPortType & GetEgressPort()
Get the Egress Port object.
Definition rtp_payloader.cc:52
void SetFrameRate(uint32_t framerate)
Set the Frame Rate object.
Definition rtp_payloader.cc:34
virtual ~RtpPayloader()=default
Destroy the Rtp Payloader object.
uint32_t GetHeight() const
Get the Height object of the incoming stream.
Definition rtp_payloader.cc:24
The Real Time Protocol (RTP) namespace.
Definition rtp_av1_depayloader.cc:34
ColourspaceType
Supported colour spaces.
Definition rtp_types.h:102
RTP streaming video types.
Store common port information for ingress and egress ports.
Definition rtp_types.h:145