ifw-rtmstools 3.0.0
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
ifw::rtmstools::RtmsReceiver Class Reference

The RtmsReceiver class. More...

#include <rtmsReceiver.hpp>

Inheritance diagram for ifw::rtmstools::RtmsReceiver:
ifw::rtmstools::Rtms2DdtReceiver ifw::rtmstools::RtmsReceiverTool

Public Member Functions

 RtmsReceiver (std::string address, int port, std::string net_if, int width, int height, int bpp, const int rcv_buf_factor=3)
 
virtual ~RtmsReceiver ()
 
int GetSize () const
 Get image size in bytes.
 
int GetWidth () const
 
int GetHeight () const
 
void ReceivePacket (const boost::system::error_code &error, size_t bytes_transferred)
 Callback to process RTMS packets.
 
virtual void HandleLeaderPacket ()
 Invoked to handle a MUDPI/RTMS Leader Packet.
 
virtual void HandlePayloadPacket (mudpiif::mudpiPacketJumbo &packet)
 Invoked to handle a MUDPI/RTMS Payload Packet.
 
virtual void HandleTrailerPacket ()
 Invoked to handle a MUDPI/RTMS Trailer Packet.
 
virtual void HandleLostPackets ()
 Handle the case where packets are lost.
 
virtual void HandleWrongFrameId ()
 Handle the case where a wrong frame ID is received.
 
virtual void Wait ()
 Wait for incoming network data (for asynchroneous use)
 
void StartReceiver ()
 Network configuration.
 
void StopReceiver ()
 
int32_t GetCurrentSampleId () const
 

Public Attributes

std::string m_address
 
int m_port
 
std::string m_net_if
 
int m_width
 
int m_height
 
int m_bpp
 
long unsigned int m_prev_frames_expected
 
long unsigned int m_prev_frames_received
 
bool m_execute
 
int m_rcv_buf_factor {3}
 
double m_last_lost_packets_log {0.0}
 
double m_last_diff_sample_id_log {0.0}
 
int32_t m_current_sample_id {-1}
 
unsigned int m_sample {0}
 
bool m_io_service_running {false}
 
boost::asio::io_service m_io_service
 
boost::asio::ip::udp::socket m_socket {m_io_service}
 
boost::array< char, PACKET_SIZEm_recv_buffer
 
boost::asio::ip::udp::endpoint m_remote_endpoint
 
struct timeval m_start m_end
 
int m_num_frames = 0
 
log4cplus::Logger m_logger
 

Detailed Description

The RtmsReceiver class.

This structure is used to receive RTMS packages and assembly back the image when the last packet is received. If any packet is lost, the complete frame will be discarded. It uses BOOST asio library for handling the UDP networking.

By default the class has an asynchroneous behaviour.

Constructor & Destructor Documentation

◆ RtmsReceiver()

ifw::rtmstools::RtmsReceiver::RtmsReceiver ( std::string address,
int port,
std::string net_if,
int width,
int height,
int bpp,
const int rcv_buf_factor = 3 )

◆ ~RtmsReceiver()

ifw::rtmstools::RtmsReceiver::~RtmsReceiver ( )
virtual

Member Function Documentation

◆ GetCurrentSampleId()

int32_t ifw::rtmstools::RtmsReceiver::GetCurrentSampleId ( ) const

◆ GetHeight()

int ifw::rtmstools::RtmsReceiver::GetHeight ( ) const

◆ GetSize()

int ifw::rtmstools::RtmsReceiver::GetSize ( ) const

Get image size in bytes.

◆ GetWidth()

int ifw::rtmstools::RtmsReceiver::GetWidth ( ) const

◆ HandleLeaderPacket()

void ifw::rtmstools::RtmsReceiver::HandleLeaderPacket ( )
virtual

Invoked to handle a MUDPI/RTMS Leader Packet.

Reimplemented in ifw::rtmstools::Rtms2DdtReceiver, and ifw::rtmstools::RtmsReceiverTool.

◆ HandleLostPackets()

void ifw::rtmstools::RtmsReceiver::HandleLostPackets ( )
virtual

Handle the case where packets are lost.

Reimplemented in ifw::rtmstools::Rtms2DdtReceiver, and ifw::rtmstools::RtmsReceiverTool.

◆ HandlePayloadPacket()

void ifw::rtmstools::RtmsReceiver::HandlePayloadPacket ( mudpiif::mudpiPacketJumbo & packet)
virtual

Invoked to handle a MUDPI/RTMS Payload Packet.

Reimplemented in ifw::rtmstools::Rtms2DdtReceiver, and ifw::rtmstools::RtmsReceiverTool.

◆ HandleTrailerPacket()

void ifw::rtmstools::RtmsReceiver::HandleTrailerPacket ( )
virtual

Invoked to handle a MUDPI/RTMS Trailer Packet.

Reimplemented in ifw::rtmstools::Rtms2DdtReceiver, and ifw::rtmstools::RtmsReceiverTool.

◆ HandleWrongFrameId()

void ifw::rtmstools::RtmsReceiver::HandleWrongFrameId ( )
virtual

Handle the case where a wrong frame ID is received.

◆ ReceivePacket()

void ifw::rtmstools::RtmsReceiver::ReceivePacket ( const boost::system::error_code & error,
size_t bytes_transferred )

Callback to process RTMS packets.

This methods process the incoming data and retrieves the information for the RTMS packets. When the trailer packet is received succesfully, this method will create a new image object and push it to the queue. It triggers the notification by updating the new_image flag.

◆ StartReceiver()

void ifw::rtmstools::RtmsReceiver::StartReceiver ( )

Network configuration.

This method configures boost asio to listen for incoming packets. At the end, it calls the Wait method.

See also
Wait

◆ StopReceiver()

void ifw::rtmstools::RtmsReceiver::StopReceiver ( )

◆ Wait()

void ifw::rtmstools::RtmsReceiver::Wait ( )
virtual

Wait for incoming network data (for asynchroneous use)

It can be used to receive data asynchronosly from boost asio. The method invokes the ReceivePacket callback function when data is available.

Member Data Documentation

◆ m_address

std::string ifw::rtmstools::RtmsReceiver::m_address

◆ m_bpp

int ifw::rtmstools::RtmsReceiver::m_bpp

◆ m_current_sample_id

int32_t ifw::rtmstools::RtmsReceiver::m_current_sample_id {-1}

◆ m_end

struct timeval m_start ifw::rtmstools::RtmsReceiver::m_end

◆ m_execute

bool ifw::rtmstools::RtmsReceiver::m_execute

◆ m_height

int ifw::rtmstools::RtmsReceiver::m_height

◆ m_io_service

boost::asio::io_service ifw::rtmstools::RtmsReceiver::m_io_service

◆ m_io_service_running

bool ifw::rtmstools::RtmsReceiver::m_io_service_running {false}

◆ m_last_diff_sample_id_log

double ifw::rtmstools::RtmsReceiver::m_last_diff_sample_id_log {0.0}

◆ m_last_lost_packets_log

double ifw::rtmstools::RtmsReceiver::m_last_lost_packets_log {0.0}

◆ m_logger

log4cplus::Logger ifw::rtmstools::RtmsReceiver::m_logger

◆ m_net_if

std::string ifw::rtmstools::RtmsReceiver::m_net_if

◆ m_num_frames

int ifw::rtmstools::RtmsReceiver::m_num_frames = 0

◆ m_port

int ifw::rtmstools::RtmsReceiver::m_port

◆ m_prev_frames_expected

long unsigned int ifw::rtmstools::RtmsReceiver::m_prev_frames_expected

◆ m_prev_frames_received

long unsigned int ifw::rtmstools::RtmsReceiver::m_prev_frames_received

◆ m_rcv_buf_factor

int ifw::rtmstools::RtmsReceiver::m_rcv_buf_factor {3}

◆ m_recv_buffer

boost::array<char, PACKET_SIZE> ifw::rtmstools::RtmsReceiver::m_recv_buffer

◆ m_remote_endpoint

boost::asio::ip::udp::endpoint ifw::rtmstools::RtmsReceiver::m_remote_endpoint

◆ m_sample

unsigned int ifw::rtmstools::RtmsReceiver::m_sample {0}

◆ m_socket

boost::asio::ip::udp::socket ifw::rtmstools::RtmsReceiver::m_socket {m_io_service}

◆ m_width

int ifw::rtmstools::RtmsReceiver::m_width

The documentation for this class was generated from the following files: