MediaX v1.0.0rc7 [7e6cb74]
Video streaming for military vehicles
Loading...
Searching...
No Matches
mediax::sap::SapAnnouncer Class Reference

Class to announce the stream details using the SAP protocol. More...

#include <sap_announcer.h>

Collaboration diagram for mediax::sap::SapAnnouncer:
Collaboration graph

Public Member Functions

 SapAnnouncer (SapAnnouncer const &)=delete
 Construct a new SapAnnouncer object, not used so deleted.
 
void AddSapAnnouncement (const ::mediax::rtp::StreamInformation &stream_information)
 Add Sap stream announcement information.
 
::mediax::rtp::StreamInformationGetSapAnnouncment (std::string_view session_name, std::string_view multicast_address="")
 Get the Sap Announcment object.
 
void DeleteSapAnnouncement (std::string_view session_name, std::string_view multicast_address="")
 Delete a specific session announcement.
 
void UndeleteSapAnnouncement (std::string_view session_name)
 Undelete a specific session announcement.
 
void DeleteAllSapAnnouncements ()
 Deletes all announcements, thread is still running. Call Stop() method to terminate the thread.
 
void Start ()
 Start the SAP/SDP announcements thread. Ensure you have set the source interface using SetSourceInterface() prior to starting the announcments.
 
void Stop ()
 Stop the SAP/SDP announcement thread.
 
void Restart ()
 Restart any deleted SAP/SDP announcements.
 
bool Active () const
 Returns tru if running, Start() has beed called.
 
void SetSourceInterface (uint32_t select=0)
 Set the Source Interface object.
 
std::map< uint32_t, std::string > GetInterfaces () const
 Get the Interfaces as a map of strings.
 
std::vector<::mediax::rtp::StreamInformation > & GetStreams ()
 Get the Streams object.
 
uint32_t GetActiveStreamCount () const
 Get the number of active streams.
 

Static Public Member Functions

static SapAnnouncerGetInstance ()
 A Singleton get method.
 

Private Member Functions

 SapAnnouncer ()
 Construct a new SapAnnouncer::SapAnnouncer object.
 
 ~SapAnnouncer ()
 Destroy the SapAnnouncer::SapAnnouncer object.
 
void SendSapAnnouncement (const ::mediax::rtp::StreamInformation &stream_information) const
 Function to send a SAP announcement.
 
void SendSapDeletion (const ::mediax::rtp::StreamInformation &stream_information) const
 Function to send a SAP deletion.
 
int SendSapPacket (const ::mediax::rtp::StreamInformation &stream_information, bool deletion) const
 Send a SAP packet.
 
void DeleteAllStreams () const
 Delete all the SAP/SDP streams.
 
uint32_t GetIpv4Address (std::string_view interface_name) const
 Get the Ipv4 Address as a number.
 
std::string GetIpv4AddressString (std::string_view interface_name) const
 Get the Ipv 4 Address as a string.
 

Static Private Member Functions

static void SapAnnouncementThread (SapAnnouncer *stream_information)
 Function to broadcast SAP announcements for a list of streams.
 

Private Attributes

std::vector<::mediax::rtp::StreamInformationstreams_
 A list of active SAP streams.
 
std::thread thread_
 The SAP/SDP transmission thread.
 
uint32_t source_ipaddress_
 The IPV4 source address.
 
int sockfd_
 The open socket file descriptor.
 
struct sockaddr_in multicast_addr_
 The multicast address.
 
bool running_ = false
 The flag indicating the SAP thread is active.
 

Static Private Attributes

static SapAnnouncer singleton_
 The singleton.
 

Detailed Description

Class to announce the stream details using the SAP protocol.

Member Function Documentation

◆ Active()

bool mediax::sap::SapAnnouncer::Active ( ) const

Returns tru if running, Start() has beed called.

Returns
true
false

◆ AddSapAnnouncement()

void mediax::sap::SapAnnouncer::AddSapAnnouncement ( const ::mediax::rtp::StreamInformation stream_information)

Add Sap stream announcement information.

Parameters
stream_informationThe stream details

◆ DeleteSapAnnouncement()

void mediax::sap::SapAnnouncer::DeleteSapAnnouncement ( std::string_view  session_name,
std::string_view  multicast_address = "" 
)

Delete a specific session announcement.

Parameters
session_nameThe session name
multicast_addressThe (optional) multicast address, used to differentiate between streams

◆ GetActiveStreamCount()

uint32_t mediax::sap::SapAnnouncer::GetActiveStreamCount ( ) const

Get the number of active streams.

Returns
uint32_t

◆ GetInterfaces()

std::map< uint32_t, std::string > mediax::sap::SapAnnouncer::GetInterfaces ( ) const

Get the Interfaces as a map of strings.

Returns
std::map<uit32_t, std::string>

◆ GetIpv4Address()

uint32_t mediax::sap::SapAnnouncer::GetIpv4Address ( std::string_view  interface_name) const
private

Get the Ipv4 Address as a number.

Parameters
interface_namethe interface name
Returns
uint32_t

◆ GetIpv4AddressString()

std::string mediax::sap::SapAnnouncer::GetIpv4AddressString ( std::string_view  interface_name) const
private

Get the Ipv 4 Address as a string.

Parameters
interface_namethe interface name
Returns
std::string

◆ GetSapAnnouncment()

mediax::rtp::StreamInformation & mediax::sap::SapAnnouncer::GetSapAnnouncment ( std::string_view  session_name,
std::string_view  multicast_address = "" 
)

Get the Sap Announcment object.

Parameters
session_nameThe session name (will get first if no multicast is defined)
multicast_addressThe (optional) multicast address, used to differentiate between streams
Returns
mediax::rtp::StreamInformation&

◆ GetStreams()

std::vector<::mediax::rtp::StreamInformation > & mediax::sap::SapAnnouncer::GetStreams ( )

Get the Streams object.

Returns
std::vector<SAPMessage>&

◆ SapAnnouncementThread()

void mediax::sap::SapAnnouncer::SapAnnouncementThread ( SapAnnouncer stream_information)
staticprivate

Function to broadcast SAP announcements for a list of streams.

Only needs to be called once to start the broadcast thread

Parameters
stream_informationThe SapAnnouncer object

◆ SendSapAnnouncement()

void mediax::sap::SapAnnouncer::SendSapAnnouncement ( const ::mediax::rtp::StreamInformation stream_information) const
private

Function to send a SAP announcement.

Parameters
stream_informationThe stream details

◆ SendSapDeletion()

void mediax::sap::SapAnnouncer::SendSapDeletion ( const ::mediax::rtp::StreamInformation stream_information) const
private

Function to send a SAP deletion.

Parameters
stream_informationThe stream details, needed to form the deletion packet

◆ SendSapPacket()

int mediax::sap::SapAnnouncer::SendSapPacket ( const ::mediax::rtp::StreamInformation stream_information,
bool  deletion 
) const
private

Send a SAP packet.

Parameters
stream_informationthe SAP packet details
deletionflag indicating SAP deletion
Returns
int returns 0 if no errors

◆ SetSourceInterface()

void mediax::sap::SapAnnouncer::SetSourceInterface ( uint32_t  select = 0)

Set the Source Interface object.

Parameters
selectThe interface to select as the source

◆ UndeleteSapAnnouncement()

void mediax::sap::SapAnnouncer::UndeleteSapAnnouncement ( std::string_view  session_name)

Undelete a specific session announcement.

Parameters
session_name

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