mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-21 23:55:13 -05:00
Support compilation when QT_NO_NETWORKINTERFACE is defined (E.g. WebAssembly)
This commit is contained in:
parent
14063a80e9
commit
197ac366e2
@ -157,7 +157,9 @@ int RTPUDPTransmitter::Create(std::size_t maximumpacketsize, const RTPTransmissi
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_maxpacksize = maximumpacketsize;
|
m_maxpacksize = maximumpacketsize;
|
||||||
|
#ifndef QT_NO_NETWORKINTERFACE
|
||||||
m_multicastInterface = params->GetMulticastInterface();
|
m_multicastInterface = params->GetMulticastInterface();
|
||||||
|
#endif
|
||||||
m_receivemode = RTPTransmitter::AcceptAll;
|
m_receivemode = RTPTransmitter::AcceptAll;
|
||||||
|
|
||||||
m_waitingfordata = false;
|
m_waitingfordata = false;
|
||||||
@ -306,6 +308,7 @@ void RTPUDPTransmitter::ClearDestinations()
|
|||||||
|
|
||||||
bool RTPUDPTransmitter::SupportsMulticasting()
|
bool RTPUDPTransmitter::SupportsMulticasting()
|
||||||
{
|
{
|
||||||
|
#ifndef QT_NO_NETWORKINTERFACE
|
||||||
QNetworkInterface::InterfaceFlags flags = m_multicastInterface.flags();
|
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();
|
||||||
@ -315,10 +318,15 @@ 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)
|
||||||
{
|
{
|
||||||
|
#ifndef QT_NO_NETWORKINTERFACE
|
||||||
if (!m_init) {
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef QT_NO_NETWORKINTERFACE
|
||||||
/** Sets the multicast interface IP address. */
|
/** 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,7 +355,9 @@ 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
|
||||||
|
#ifndef QT_NO_NETWORKINTERFACE
|
||||||
QNetworkInterface m_multicastInterface; //!< from parameters multicast interface
|
QNetworkInterface m_multicastInterface; //!< from parameters multicast interface
|
||||||
|
#endif
|
||||||
uint16_t m_rtpPort, m_rtcpPort;
|
uint16_t m_rtpPort, m_rtcpPort;
|
||||||
RTPTransmitter::ReceiveMode m_receivemode;
|
RTPTransmitter::ReceiveMode m_receivemode;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user