mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-25 01:18:38 -05:00
Support compilation when QT_NO_NETWORKINTERFACE is defined (E.g. WebAssembly)
This commit is contained in:
parent
14063a80e9
commit
197ac366e2
@ -157,8 +157,10 @@ int RTPUDPTransmitter::Create(std::size_t maximumpacketsize, const RTPTransmissi
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_maxpacksize = maximumpacketsize;
|
m_maxpacksize = maximumpacketsize;
|
||||||
m_multicastInterface = params->GetMulticastInterface();
|
#ifndef QT_NO_NETWORKINTERFACE
|
||||||
m_receivemode = RTPTransmitter::AcceptAll;
|
m_multicastInterface = params->GetMulticastInterface();
|
||||||
|
#endif
|
||||||
|
m_receivemode = RTPTransmitter::AcceptAll;
|
||||||
|
|
||||||
m_waitingfordata = false;
|
m_waitingfordata = false;
|
||||||
m_created = true;
|
m_created = true;
|
||||||
@ -306,7 +308,8 @@ void RTPUDPTransmitter::ClearDestinations()
|
|||||||
|
|
||||||
bool RTPUDPTransmitter::SupportsMulticasting()
|
bool RTPUDPTransmitter::SupportsMulticasting()
|
||||||
{
|
{
|
||||||
QNetworkInterface::InterfaceFlags flags = m_multicastInterface.flags();
|
#ifndef QT_NO_NETWORKINTERFACE
|
||||||
|
QNetworkInterface::InterfaceFlags flags = m_multicastInterface.flags();
|
||||||
QAbstractSocket::SocketState rtpSocketState = m_rtpsock->state();
|
QAbstractSocket::SocketState rtpSocketState = m_rtpsock->state();
|
||||||
QAbstractSocket::SocketState rtcpSocketState = m_rtcpsock->state();
|
QAbstractSocket::SocketState rtcpSocketState = m_rtcpsock->state();
|
||||||
return m_multicastInterface.isValid()
|
return m_multicastInterface.isValid()
|
||||||
@ -315,11 +318,16 @@ bool RTPUDPTransmitter::SupportsMulticasting()
|
|||||||
&& (flags & QNetworkInterface::CanMulticast)
|
&& (flags & QNetworkInterface::CanMulticast)
|
||||||
&& (flags & QNetworkInterface::IsRunning)
|
&& (flags & QNetworkInterface::IsRunning)
|
||||||
&& !(flags & QNetworkInterface::IsLoopBack);
|
&& !(flags & QNetworkInterface::IsLoopBack);
|
||||||
|
|
||||||
|
#else
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int RTPUDPTransmitter::JoinMulticastGroup(const RTPAddress &addr)
|
int RTPUDPTransmitter::JoinMulticastGroup(const RTPAddress &addr)
|
||||||
{
|
{
|
||||||
if (!m_init) {
|
#ifndef QT_NO_NETWORKINTERFACE
|
||||||
|
if (!m_init) {
|
||||||
return ERR_RTP_UDPV4TRANS_NOTINIT;
|
return ERR_RTP_UDPV4TRANS_NOTINIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -346,10 +354,14 @@ int RTPUDPTransmitter::JoinMulticastGroup(const RTPAddress &addr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
#else
|
||||||
|
return ERR_RTP_UDPV6TRANS_NOMULTICASTSUPPORT;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int RTPUDPTransmitter::LeaveMulticastGroup(const RTPAddress &addr)
|
int RTPUDPTransmitter::LeaveMulticastGroup(const RTPAddress &addr)
|
||||||
{
|
{
|
||||||
|
#ifndef QT_NO_NETWORKINTERFACE
|
||||||
if (!m_init) {
|
if (!m_init) {
|
||||||
return ERR_RTP_UDPV4TRANS_NOTINIT;
|
return ERR_RTP_UDPV4TRANS_NOTINIT;
|
||||||
}
|
}
|
||||||
@ -370,6 +382,9 @@ int RTPUDPTransmitter::LeaveMulticastGroup(const RTPAddress &addr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
#else
|
||||||
|
return ERR_RTP_UDPV6TRANS_NOMULTICASTSUPPORT;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int RTPUDPTransmitter::SetReceiveMode(RTPTransmitter::ReceiveMode m)
|
int RTPUDPTransmitter::SetReceiveMode(RTPTransmitter::ReceiveMode m)
|
||||||
|
@ -68,10 +68,12 @@ public:
|
|||||||
m_bindAddress = bindAddress;
|
m_bindAddress = bindAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Sets the multicast interface IP address. */
|
#ifndef QT_NO_NETWORKINTERFACE
|
||||||
|
/** Sets the multicast interface IP address. */
|
||||||
void SetMulticastInterface(const QNetworkInterface& mcastInterface) {
|
void SetMulticastInterface(const QNetworkInterface& mcastInterface) {
|
||||||
m_mcastInterface = mcastInterface;
|
m_mcastInterface = mcastInterface;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/** Sets the RTP portbase to \c pbase, which has to be an even number
|
/** Sets the RTP portbase to \c pbase, which has to be an even number
|
||||||
* unless RTPUDPv4TransmissionParams::SetAllowOddPortbase was called;
|
* unless RTPUDPv4TransmissionParams::SetAllowOddPortbase was called;
|
||||||
@ -87,11 +89,13 @@ public:
|
|||||||
return m_bindAddress;
|
return m_bindAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef QT_NO_NETWORKINTERFACE
|
||||||
/** Returns the multicast interface IP address. */
|
/** Returns the multicast interface IP address. */
|
||||||
QNetworkInterface GetMulticastInterface() const
|
QNetworkInterface GetMulticastInterface() const
|
||||||
{
|
{
|
||||||
return m_mcastInterface;
|
return m_mcastInterface;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/** Returns the RTP portbase which will be used (default is 5000). */
|
/** Returns the RTP portbase which will be used (default is 5000). */
|
||||||
uint16_t GetPortbase() const
|
uint16_t GetPortbase() const
|
||||||
@ -210,7 +214,9 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
QHostAddress m_bindAddress;
|
QHostAddress m_bindAddress;
|
||||||
|
#ifndef QT_NO_NETWORKINTERFACE
|
||||||
QNetworkInterface m_mcastInterface;
|
QNetworkInterface m_mcastInterface;
|
||||||
|
#endif
|
||||||
uint16_t m_portbase;
|
uint16_t m_portbase;
|
||||||
int m_rtpsendbufsz, m_rtprecvbufsz;
|
int m_rtpsendbufsz, m_rtprecvbufsz;
|
||||||
int m_rtcpsendbufsz, m_rtcprecvbufsz;
|
int m_rtcpsendbufsz, m_rtcprecvbufsz;
|
||||||
@ -349,8 +355,10 @@ private:
|
|||||||
QUdpSocket *m_rtpsock, *m_rtcpsock;
|
QUdpSocket *m_rtpsock, *m_rtcpsock;
|
||||||
bool m_deletesocketswhendone;
|
bool m_deletesocketswhendone;
|
||||||
QHostAddress m_localIP; //!< from parameters bind IP
|
QHostAddress m_localIP; //!< from parameters bind IP
|
||||||
QNetworkInterface m_multicastInterface; //!< from parameters multicast interface
|
#ifndef QT_NO_NETWORKINTERFACE
|
||||||
uint16_t m_rtpPort, m_rtcpPort;
|
QNetworkInterface m_multicastInterface; //!< from parameters multicast interface
|
||||||
|
#endif
|
||||||
|
uint16_t m_rtpPort, m_rtcpPort;
|
||||||
RTPTransmitter::ReceiveMode m_receivemode;
|
RTPTransmitter::ReceiveMode m_receivemode;
|
||||||
|
|
||||||
std::size_t m_maxpacksize;
|
std::size_t m_maxpacksize;
|
||||||
|
Loading…
Reference in New Issue
Block a user