📄 jrtplib.tex
字号:
component will be created for thread-safe usage or not. \item {\tt int Create(size\_t maxpacksize, const RTPTransmissionParams *transparams)}\\ Prepares the component to be used. The parameter {\tt maxpacksize} specifies the maximum size a packet can have: if the packet is larger it will not be transmitted. The {\tt transparams} parameter specifies a pointer to an {\tt RTPTransmissionParams} instance. This is also an abstract class and each actual component will define its own parameters by inheriting a a class from {\tt RTPTransmissionParams}. If {\tt transparams} is NULL, the default transmission parameters for the component will be used. \item {\tt int Destroy()}\\ By calling this function, buffers are cleared and the component cannot be used anymore. Only when the {\tt Create} function is called again can the component be used again. \item {\tt RTPTransmissionInfo *GetTransmissionInfo()}\\ This function returns an instance of a subclass of {\tt RTPTransmissionInfo} which will give some additional information about the transmitter (a list of local IP addresses for example). Currently, either an instance of {\tt RTP\-UDPv4\-Trans\-mission\-Info} or {\tt RTP\-UDPv6\-Trans\-mission\-Info} is returned, depending on the type of the transmitter. The user has to delete the returned instance when it is no longer needed. \item {\tt int GetLocalHostName(u\_int8\_t *buffer, size\_t *bufferlength)}\\ Looks up the local host name based upon internal information about the local host's addresses. This function might take some time since a DNS query might be done. {\tt bufferlength} should initially contain the number of bytes that may be stored in {\tt buffer}. If the function succeeds, {\tt bufferlength} is set to the number of bytes stored in {\tt buffer}. Note that the data in {\tt buffer} is not NULL-terminated. If the function fails because the buffer isn't large enough, it returns {\tt ERR\_RTP\_TRANS\_BUFFERLENGTHTOOSMALL} and stores the number of bytes needed in {\tt bufferlength}. \item {\tt bool ComesFromThisTransmitter(const RTPAddress *addr)}\\ Returns {\tt true} if the address specified by {\tt addr} is one of the addresses of the transmitter. \item {\tt size\_t GetHeaderOverhead()}\\ Returns the amount of bytes that will be added to the RTP packet by the underlying layers (excluding the link layer). \item {\tt int Poll()}\\ Checks for incoming data and stores it. \item {\tt bool NewDataAvailable()} Returns {\tt true} if packets can be obtained using the {\tt GetNextPacket} member function. \item {\tt RTPRawPacket *GetNextPacket()}\\ Returns the raw data of a received RTP packet (received during the {\tt Poll} function) in an {\tt RTPRawPacket} instance. \item {\tt int WaitForIncomingData(const RTPTime \&delay)}\\ Waits at most a time {\tt delay} until incoming data has been detected. \item {\tt int AbortWait()}\\ If the previous function has been called, this one aborts the waiting. \item {\tt int SendRTPData(const void *data, size\_t len)}\\ Send a packet with length {\tt len} containing {\tt data} to all RTP addresses of the current destination list. \item {\tt int SendRTCPData(const void *data, size\_t len)}\\ Send a packet with length {\tt len} containing {\tt data} to all RTCP addresses of the current destination list. \item {\tt void ResetPacketCount()}\\ The transmitter keeps track of the amount of RTP and RTCP packets that were sent. This functions resets those counts. \item {\tt u\_int32\_t GetNumRTPPacketsSent()}\\ Returns the number of RTP packets sent. \item {\tt u\_int32\_t GetNumRTCPPacketsSent()}\\ Returns the number of RTCP packets sent. \item {\tt int AddDestination(const RTPAddress \&addr)}\\ Adds the address specified by {\tt addr} to the list of destinations. \item {\tt int DeleteDestination(const RTPAddress \&addr)}\\ Deletes the address specified by {\tt addr} from the list of destinations. \item {\tt void ClearDestinations()}\\ Clears the list of destinations. \item {\tt bool SupportsMulticasting()}\\ Returns {\tt true} if the transmission component supports multicasting. \item {\tt int JoinMulticastGroup(const RTPAddress \&addr)}\\ Joins the multicast group specified by {\tt addr}. \item {\tt int LeaveMulticastGroup(const RTPAddress \&addr)}\\ Leaves the multicast group specified by {\tt addr}. \item {\tt void LeaveAllMulticastGroups()}\\ Leaves all the multicast groups that have been joined. \item {\tt int SetReceiveMode(RTPTransmitter::ReceiveMode m)}\\ Sets the receive mode to m, which is one of the following: {\tt RTPTrans\-mitter::\-Accept\-All}, {\tt RTPTrans\-mitter::\-Accept\-Some}, {\tt RTPTrans\-mitter::\-Ignore\-Some}. Note that if the receive mode is changed, all information about the addresses to ignore or to accept is lost. \item {\tt int AddToIgnoreList(const RTPAddress \&addr)}\\ Adds {\tt addr} to the list of addresses to ignore. \item {\tt int DeleteFromIgnoreList(const RTPAddress \&addr)}\\ Deletes {\tt addr} from the list of addresses to ignore. \item {\tt void ClearIgnoreList()}\\ Clears the list of addresses to ignore. \item {\tt int AddToAcceptList(const RTPAddress \&addr)}\\ Adds {\tt addr} to the list of addresses to accept. \item {\tt int DeleteFromAcceptList(const RTPAddress \&addr)}\\ Deletes {\tt addr} from the list of addresses to accept. \item {\tt void ClearAcceptList()}\\ Clears the list of addresses to accept. \item {\tt int SetMaximumPacketSize(size\_t s)}\\ Sets the maximum packet size which the transmitter should allow to {\tt s}. \end{itemize} \Paragraph{UDP over IPv4 transmitter}\headerfile{rtpudpv4transmitter.h}\inherits{RTPTransmitter} The class {\tt RTPUDPv4Transmitter} inherits the {\tt RTPTransmitter} interface and implements a transmission component which user UDP over IPv4 to send and receive RTP and RTCP data. The component's parameters are described by the class {\tt RTPUDPv4Trans\-mission\-Params} and is described in section \ref{rtpudpv4transmissionparams}. The functions which have an {\tt RTPAddress} argument require an argument of type {\tt RTPIPv4Address} which is described in section \ref{rtpipv4address}. The {\tt Get\-Trans\-mission\-Info} member function of the {\tt RTP\-UDPv4\-Trans\-mitter} class returns an instance of type {\tt RTP\-UDPv4\-Trans\-mission\-Info} which is described in section \ref{rtpudpv4transmissioninfo}. \Paragraph{UDP over IPv6 transmitter}\headerfile{rtpudpv6transmitter.h}\inherits{RTPTransmitter} The class {\tt RTPUDPv6Transmitter} inherits the {\tt RTPTransmitter} interface and implements a transmission component which user UDP over IPv6 to send and receive RTP and RTCP data. The component's parameters are described by the class {\tt RTPUDPv6Trans\-mission\-Params} and is described in section \ref{rtpudpv6transmissionparams}. The functions which have an {\tt RTPAddress} argument require an argument of type {\tt RTPIPv6Address} which is described in section \ref{rtpipv6address}. The {\tt Get\-Trans\-mission\-Info} member function of the {\tt RTP\-UDPv6\-Trans\-mitter} class returns an instance of type {\tt RTP\-UDPv6\-Trans\-mission\-Info} which is described in section \ref{rtpudpv6transmissioninfo}. \subsubsection{\tt RTPTransmissionParams}\headerfile{rtptransmitter.h} The {\tt RTPTransmissionParams} class is an abstract class which will have a specific implementation for a specific kind of transmission component. All actual implementations inherit the following function which identify the component type for which these parameters are valid: \begin{verbatim} RTPTransmitter::TransmissionProtocol GetTransmissionProtocol() \end{verbatim} \Paragraph{Parameters for the UDP over IPv4 transmitter}\headerfile{rtpudpv4transmitter.h}\inherits{RTPTransmissionParams} \label{rtpudpv4transmissionparams} The {\tt RTPUDPv4TransmissionParams} class represents the parameters used by the UDP over IPv4 transmission component. By default, the multicast TTL is set to $1$ and the portbase is set to $5000$. The interface of this class is the following: \begin{itemize} \item {\tt void SetBindIP(u\_int32\_t ip)}\\ Sets the IP address which is used to bind the sockets to {\tt ip}. \item {\tt void SetPortbase(u\_int16\_t pbase)}\\ Sets the RTP portbase to {\tt pbase}. This has to be an even number. \item {\tt void SetMulticastTTL(u\_int8\_t mcastTTL)}\\ Sets the multicast TTL to be used to {\tt mcastTTL}. \item {\tt void SetLocalIPList(std::list<u\_int32\_t> \&iplist)}\\ Passes a list of IP addresses which will be used as the local IP addresses. \item {\tt void ClearLocalIPList()}\\ Clears the list of local IP addresses. An empty list will make the transmission component itself determine the local IP addresses. \item {\tt u\_int32\_t GetBindIP() const}\\ Returns the IP address which will be used to bind the sockets. \item {\tt u\_int16\_t GetPortbase() const}\\ Returns the RTP portbase which will be used. \item {\tt u\_int8\_t GetMulticastTTL() const}\\ Returns the multicast TTL which will be used. \item {\tt const std::list<u\_int32\_t> \&GetLocalIPList() const}\\ Returns the list of local IP addresses. \end{itemize} \Paragraph{Parameters for the UDP over IPv6 transmitter}\headerfile{rtpudpv6transmitter.h}\inherits{RTPTransmissionParams} \label{rtpudpv6transmissionparams} The {\tt RTPUDPv6TransmissionParams} class represents the parameters used by the UDP over IPv6 transmission component. By default, the multicast TTL is set to $1$ and the portbase is set to $5000$. The interface of this class is the following: \begin{itemize} \item {\tt void SetBindIP(in6\_addr ip)}\\ Sets the IP address which is used to bind the sockets to {\tt ip}. \item {\tt void SetPortbase(u\_int16\_t pbase)}\\ Sets the RTP portbase to {\tt pbase}. This has to be an even number. \item {\tt void SetMulticastTTL(u\_int8\_t mcastTTL)}\\ Sets the multicast TTL to be used to {\tt mcastTTL}. \item {\tt void SetLocalIPList(std::list<in6\_addr> \&iplist)}\\ Passes a list of IP addresses which will be used as the local IP addresses. \item {\tt void ClearLocalIPList()}\\ Clears the list of local IP addresses. An empty list will make the transmission component itself determine the local IP addresses. \item {\tt in6\_addr GetBindIP() const}\\ Returns the IP address which will be used to bind the sockets. \item {\tt u\_int16\_t GetPortbase() const}\\ Returns the RTP portbase which will be used. \item {\tt u\_int8\_t GetMulticastTTL() const}\\ Returns the multicast TTL which will be used. \item {\tt const std::list<in6\_addr> \&GetLocalIPList() const}\\ Returns the list of local IP addresses. \end{itemize} \subsubsection{\tt RTPTransmissionInfo}\headerfile{rtptransmitter.h} The {\tt RTPTransmissionInfo} class is an abstract class which will have a specific implementation for a specific kind of transmission component. All actual implementations inherit the following function which identify the component type for which these parameters are valid: \begin{verbatim} RTPTransmitter::TransmissionProtocol GetTransmissionProtocol() \end{verbatim} \Paragraph{Info about the UDP over IPv4 transmitter}\headerfile{rtpudpv4transmitter.h} \label{rtpudpv4transmissioninfo} The class {\tt RTPUDPv4TransmissionInfo} gives some additional information about the UDP over IPv4 transmission component. The following member functions are available: \begin{itemize} \item {\tt std::list<u\_int32\_t> GetLocalIPList() const}\\ Returns the list of IPv4 addresses the transmitter considers to be the local IP addresses. \item {\tt int GetRTPSocket() const}\\ Returns the socket descriptor used for receiving and transmitting RTP packets. \item {\tt int GetRTCPSocket() const}\\ Returns the socket descriptor used for receiving and transmitting RTCP packets. \end{itemize} \Paragraph{Info about the UDP over IPv6 transmitter}\headerfile{rtpudpv6transmitter.h} \label{rtpudpv6transmissioninfo} The class {\tt RTPUDPv6TransmissionInfo} gives some additional information about the UDP over IPv6 transmission component. The following member functions are available: \begin{itemize} \item {\tt std::list<in6\_addr> GetLocalIPList() const}\\ Returns the list of IPv4 addresses the transmitter considers to be the local IP addresses. \item {\tt int GetRTPSocket() const}\\ Returns the socket descriptor used for receiving and transmitting RTP packets. \item {\tt int GetRTCPSocket() const}\\ Returns the socket descriptor used for receiving and transmitting RTCP packets. \end{itemize} \subsubsection{\tt RTPAddress}\headerfile{rtpaddress.h} The class {\tt RTPAddress} is an abstract class which is used to specify destinations, multicast groups etc. To check which actual implementation is used, the class defines the following type: \begin{verbatim} enum AddressType { IPv4Address, IPv6Address }; \end{verbatim}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -