MediaX v1.0.0rc7 [7e6cb74]
Video streaming for military vehicles
Loading...
Searching...
No Matches
rtp_uncompressed_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//
36
38
39#ifndef UNCOMPRESSED_RTP_UNCOMPRESSED_PAYLOADER_H_
40#define UNCOMPRESSED_RTP_UNCOMPRESSED_PAYLOADER_H_
41
42#include <limits.h>
43#include <stdio.h>
44#include <stdlib.h>
45#include <string.h>
46#include <unistd.h>
47
48#include <array>
49#include <chrono>
50#include <mutex>
51#include <string>
52#include <thread>
53#include <vector>
54#if _WIN32
55#include <winsock2.h>
56#else
57#include <netdb.h>
58#include <netinet/in.h>
59#include <sys/socket.h>
60#include <sys/types.h>
61#endif
62#include "rtp/rtp_payloader.h"
63#include "rtp/rtp_types.h"
64
66
72 public:
74
82
88
94 void SetStreamInfo(const ::mediax::rtp::StreamInformation &stream_information) final;
95
102 bool Open() final;
103
108 void Close() final;
109
117 int Transmit(uint8_t *rgbframe, bool blocking = true) final;
118
124 static void SendFrame(RtpUncompressedPayloader *stream);
125
131 std::mutex &GetMutex() { return mutex_; }
132
133 private:
135 static uint32_t sequence_number_;
139 struct addrinfo *server_out_;
141 struct sockaddr_in server_addr_out_;
145 static std::vector<uint8_t> buffer_in_;
147 std::thread tx_thread_;
149 std::mutex mutex_;
150
161 void UpdateHeader(rtp::RtpHeader *packet, int line, int bytes_per_pixel, int last, int32_t timestamp, int32_t source);
162
168 static void TransmitThread(RtpUncompressedPayloader *stream);
169
175 static int32_t GenerateTimestamp90kHz();
176};
177
178} // namespace mediax::rtp::uncompressed
179
180#endif // UNCOMPRESSED_RTP_UNCOMPRESSED_PAYLOADER_H_
Manage an RTP stream.
Definition rtp_payloader.h:30
Manage an RTP stream.
Definition rtp_uncompressed_payloader.h:71
static void SendFrame(RtpUncompressedPayloader *stream)
Send a frame.
Definition rtp_uncompressed_payloader.cc:132
std::mutex mutex_
The mutex for the transmit thread.
Definition rtp_uncompressed_payloader.h:149
void SetStreamInfo(const ::mediax::rtp::StreamInformation &stream_information) final
Configure an RTP output stream.
Definition rtp_uncompressed_payloader.cc:54
RtpUncompressedPayloader()
The supported colour spaces.
static uint32_t sequence_number_
The incremental sequence numer for transmitting RTP packets.
Definition rtp_uncompressed_payloader.h:135
socklen_t server_len_out_
The length of the server address.
Definition rtp_uncompressed_payloader.h:143
static int32_t GenerateTimestamp90kHz()
Get a 90Htz timestamp.
Definition rtp_uncompressed_payloader.cc:198
static void TransmitThread(RtpUncompressedPayloader *stream)
Transmit RTP data to the network using a separate thread.
Definition rtp_uncompressed_payloader.cc:169
int Transmit(uint8_t *rgbframe, bool blocking=true) final
Transmit an RGB buffer.
Definition rtp_uncompressed_payloader.cc:176
std::mutex & GetMutex()
Get the Mutex object.
Definition rtp_uncompressed_payloader.h:131
bool Open() final
Open the RTP stream.
Definition rtp_uncompressed_payloader.cc:66
std::thread tx_thread_
Arguments sent to thread.
Definition rtp_uncompressed_payloader.h:147
void Close() final
Close the RTP stream.
Definition rtp_uncompressed_payloader.cc:101
void UpdateHeader(rtp::RtpHeader *packet, int line, int bytes_per_pixel, int last, int32_t timestamp, int32_t source)
Populate the RTP header.
Definition rtp_uncompressed_payloader.cc:110
struct sockaddr_in server_addr_out_
The socket for the outgoing stream.
Definition rtp_uncompressed_payloader.h:141
struct addrinfo * server_out_
The server address information.
Definition rtp_uncompressed_payloader.h:139
~RtpUncompressedPayloader() final
Destroy the Rtp Stream object.
Definition rtp_uncompressed_payloader.cc:47
rtp::TxData arg_tx
Transmit arguments used by the thread.
Definition rtp_uncompressed_payloader.h:137
static std::vector< uint8_t > buffer_in_
The buffer for the incoming RTP data.
Definition rtp_uncompressed_payloader.h:145
The Astute Systems media streaming namespace.
Definition rtp_uncompressed_depayloader.cc:40
The Astute Systems (MediaX) library for video streaming.
Definition rtp_av1_depayloader.cc:34
RTP streaming video class for uncompressed DEF-STAN 00-82 video streams.
RTP streaming video types.
RTP packet structure.
Definition rtp_types.h:177
Struct capturing all stream information.
Definition rtp_types.h:223
Transmit data structure.
Definition rtp_types.h:211