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

Class definition of the SAPListener. More...

#include <sap_listener.h>

Collaboration diagram for mediax::sap::SapListener:
Collaboration graph

Public Member Functions

 SapListener ()
 Construct a new SAPListener::SAPListener object.
 
 ~SapListener ()
 Destroy the SAPListener::SAPListener object.
 
const std::map< std::string, ::mediax::sap::SdpMessage, std::less<> > & GetSapAnnouncements () const
 Get a list of SAP/SDP streams seen on the network.
 
bool GetSapAnnouncement (std::string_view session_name, SdpMessage **sdp_message)
 Get the Sap Announcement object.
 
void RegisterSapListener (std::string_view session_name, const ::mediax::sap::SapCallback &callback, void *data)
 Register a callback for our session_name.
 
bool GetStreamInformation (std::string_view session_name, ::mediax::rtp::StreamInformation *stream_information) const
 Get the stream information for a given session name.
 
void Start ()
 Start the SAP/SDP announcements thread.
 
void Stop ()
 Stop the SAP/SDP announcement thread.
 

Static Public Member Functions

static SapListenerGetInstance ()
 A Singleton get method.
 

Private Member Functions

SdpTypeEnum GetType (const std::string_view &line) const
 Get the SDP attribute type doe a single SDP line of text.
 
std::map< std::string, std::string, std::less<> > ParseAttributes1 (const std::string_view &line) const
 Parse any attributes.
 
std::map< std::string, std::string, std::less<> > ParseAttributes (const std::string_view &line) const
 Parse any attributes.
 
std::map< std::string, std::string, std::less<> > ParseAttributesEqual (const std::string &line) const
 Parse attributes with equals.
 
bool SapStore (std::array< uint8_t, mediax::rtp::kMaxUdpData > *udpdata, uint32_t size)
 Store or update the SAP data.
 

Static Private Member Functions

static void SapListenerThread (SapListener *sap)
 Function to broadcast SAP announcements for a list of streams.
 

Private Attributes

std::map< std::string, SapCallback, std::less<> > callbacks_
 The list of SAP/SDP announcement callbacks.
 
std::map< std::string, SdpMessage, std::less<> > announcements_
 The list of SAP/SDP announcements.
 
std::array< uint8_t, mediax::rtp::kMaxUdpDataudpdata_
 The buffer for the UDP data.
 
std::thread thread_
 The thread for the SAP/SDP announcements.
 
int sockfd_
 The socket for the SAP/SDP announcements.
 
struct sockaddr_in multicast_addr_
 The multicast address for the SAP/SDP announcements.
 
void * data_
 Callback data.
 

Static Private Attributes

static std::unique_ptr< SapListenersingleton_
 The pointer to the SAPListener singleton.
 
static bool running_ = false
 The SAP/SDP announcements thread running flag.
 

Detailed Description

Class definition of the SAPListener.

Member Function Documentation

◆ GetSapAnnouncement()

bool mediax::sap::SapListener::GetSapAnnouncement ( std::string_view  session_name,
SdpMessage **  sdp_message 
)

Get the Sap Announcement object.

Parameters
session_nameThe session name we want
sdp_messageThe pointer to the SDP message data
Returns
true If found, i.e. SAP message recieved
false If not yet seen, not in list

◆ GetSapAnnouncements()

const std::map< std::string, SdpMessage, std::less<> > & mediax::sap::SapListener::GetSapAnnouncements ( ) const

Get a list of SAP/SDP streams seen on the network.

Returns
The vectored list of SAP/SDP streams seen on the network

◆ GetStreamInformation()

bool mediax::sap::SapListener::GetStreamInformation ( std::string_view  session_name,
::mediax::rtp::StreamInformation stream_information 
) const

Get the stream information for a given session name.

Parameters
session_nameThe SAP/SDP session name
stream_informationThe stream information being updated
Returns
bool, true if the stream information was updated

◆ GetType()

SdpTypeEnum mediax::sap::SapListener::GetType ( const std::string_view &  line) const
private

Get the SDP attribute type doe a single SDP line of text.

Returns
SdpTypeEnum attribute enum

◆ ParseAttributes()

std::map< std::string, std::string, std::less<> > mediax::sap::SapListener::ParseAttributes ( const std::string_view &  line) const
private

Parse any attributes.

Parameters
line
Returns
std::map<std::string, std::string, std::less<>>

◆ ParseAttributes1()

std::map< std::string, std::string, std::less<> > mediax::sap::SapListener::ParseAttributes1 ( const std::string_view &  line) const
private

Parse any attributes.

Parameters
line
Returns
std::map<std::string, std::string>

◆ ParseAttributesEqual()

std::map< std::string, std::string, std::less<> > mediax::sap::SapListener::ParseAttributesEqual ( const std::string &  line) const
private

Parse attributes with equals.

Parameters
line
Returns
std::map<std::string, std::string>

◆ RegisterSapListener()

void mediax::sap::SapListener::RegisterSapListener ( std::string_view  session_name,
const ::mediax::sap::SapCallback callback,
void *  data 
)

Register a callback for our session_name.

Parameters
session_nameAdvertised session name
callbackThe callback to notify when SAP/SDP message received
dataThe data to pass to the callback

◆ SapListenerThread()

void mediax::sap::SapListener::SapListenerThread ( SapListener sap)
staticprivate

Function to broadcast SAP announcements for a list of streams.

Only needs to be called once to start the broadcast thread

Parameters
sapSAPListener object

◆ SapStore()

bool mediax::sap::SapListener::SapStore ( std::array< uint8_t, mediax::rtp::kMaxUdpData > *  udpdata,
uint32_t  size 
)
private

Store or update the SAP data.

Returns
true
false

Remove the first two characters now we know the type


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