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