From f8cebe8aa9412d4f05bc8288a1bb855f4fec6652 Mon Sep 17 00:00:00 2001 From: Mathieu Duponchelle Date: Mon, 12 Aug 2019 22:52:59 +0200 Subject: [PATCH] Generate bindings for gstreamer-rtp --- Cargo.toml | 1 + Gir_GstRtp.toml | 16 + gir-files/GstRtp-1.0.gir | 7843 ++++++++++++++++++++++++++++ gstreamer-rtp-sys/Cargo.toml | 54 + gstreamer-rtp-sys/README.md | 33 + gstreamer-rtp-sys/build.rs | 102 + gstreamer-rtp-sys/src/lib.rs | 1106 ++++ gstreamer-rtp-sys/tests/abi.rs | 510 ++ gstreamer-rtp-sys/tests/constant.c | 27 + gstreamer-rtp-sys/tests/layout.c | 12 + gstreamer-rtp-sys/tests/manual.h | 3 + 11 files changed, 9707 insertions(+) create mode 100644 Gir_GstRtp.toml create mode 100644 gir-files/GstRtp-1.0.gir create mode 100644 gstreamer-rtp-sys/Cargo.toml create mode 100644 gstreamer-rtp-sys/README.md create mode 100644 gstreamer-rtp-sys/build.rs create mode 100644 gstreamer-rtp-sys/src/lib.rs create mode 100644 gstreamer-rtp-sys/tests/abi.rs create mode 100644 gstreamer-rtp-sys/tests/constant.c create mode 100644 gstreamer-rtp-sys/tests/layout.c create mode 100644 gstreamer-rtp-sys/tests/manual.h diff --git a/Cargo.toml b/Cargo.toml index 75f03e52c..e846c9918 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,4 +18,5 @@ members = [ "gstreamer-gl-sys", "gstreamer-editing-services-sys", "gstreamer-check-sys", + "gstreamer-rtp-sys", ] diff --git a/Gir_GstRtp.toml b/Gir_GstRtp.toml new file mode 100644 index 000000000..a86a2c16c --- /dev/null +++ b/Gir_GstRtp.toml @@ -0,0 +1,16 @@ +[options] +girs_dir = "gir-files" +library = "GstRtp" +version = "1.0" +min_cfg_version = "1.0" +target_path = "gstreamer-rtp-sys" +work_mode = "sys" + +external_libraries = [ + "GLib", + "GObject" +] + +[external_libraries] +gstreamer="Gst" +gstreamer_base="GstBase" diff --git a/gir-files/GstRtp-1.0.gir b/gir-files/GstRtp-1.0.gir new file mode 100644 index 000000000..a16270a05 --- /dev/null +++ b/gir-files/GstRtp-1.0.gir @@ -0,0 +1,7843 @@ + + + + + + + + + + Note: The API in this module is not yet declared stable. + +The GstRTPCBuffer helper functions makes it easy to parse and create regular +#GstBuffer objects that contain compound RTCP packets. These buffers are typically +of 'application/x-rtcp' #GstCaps. + +An RTCP buffer consists of 1 or more #GstRTCPPacket structures that you can +retrieve with gst_rtcp_buffer_get_first_packet(). #GstRTCPPacket acts as a pointer +into the RTCP buffer; you can move to the next packet with +gst_rtcp_packet_move_to_next(). + + + + + + + + + Add a new packet of @type to @rtcp. @packet will point to the newly created +packet. + + + %TRUE if the packet could be created. This function returns %FALSE +if the max mtu is exceeded for the buffer. + + + + + a valid RTCP buffer + + + + the #GstRTCPType of the new packet + + + + pointer to new packet + + + + + + Initialize a new #GstRTCPPacket pointer that points to the first packet in +@rtcp. + + + TRUE if the packet existed in @rtcp. + + + + + a valid RTCP buffer + + + + a #GstRTCPPacket + + + + + + Get the number of RTCP packets in @rtcp. + + + the number of RTCP packets in @rtcp. + + + + + a valid RTCP buffer + + + + + + Finish @rtcp after being constructed. This function is usually called +after gst_rtcp_buffer_map() and after adding the RTCP items to the new buffer. + +The function adjusts the size of @rtcp with the total length of all the +added packets. + + + + + + + a buffer with an RTCP packet + + + + + + Open @buffer for reading or writing, depending on @flags. The resulting RTCP +buffer state is stored in @rtcp. + + + + + + + a buffer with an RTCP packet + + + + flags for the mapping + + + + resulting #GstRTCPBuffer + + + + + + Create a new buffer for constructing RTCP packets. The packet will have a +maximum size of @mtu. + + + A newly allocated buffer. + + + + + the maximum mtu size. + + + + + + Create a new buffer and set the data to a copy of @len +bytes of @data and the size to @len. The data will be freed when the buffer +is freed. + + + A newly allocated buffer with a copy of @data and of size @len. + + + + + data for the new buffer + + + + + + the length of data + + + + + + Create a new buffer and set the data and size of the buffer to @data and @len +respectively. @data will be freed when the buffer is unreffed, so this +function transfers ownership of @data to the new buffer. + + + A newly allocated buffer with @data and of size @len. + + + + + data for the new buffer + + + + + + the length of data + + + + + + Check if the data pointed to by @buffer is a valid RTCP packet using +gst_rtcp_buffer_validate_data(). + + + TRUE if @buffer is a valid RTCP packet. + + + + + the buffer to validate + + + + + + Check if the @data and @size point to the data of a valid compound, +non-reduced size RTCP packet. +Use this function to validate a packet before using the other functions in +this module. + + + TRUE if the data points to a valid RTCP packet. + + + + + the data to validate + + + + + + the length of @data to validate + + + + + + Check if the @data and @size point to the data of a valid RTCP packet. +Use this function to validate a packet before using the other functions in +this module. + +This function is updated to support reduced size rtcp packets according to +RFC 5506 and will validate full compound RTCP packets as well as reduced +size RTCP packets. + + + TRUE if the data points to a valid RTCP packet. + + + + + the data to validate + + + + + + the length of @data to validate + + + + + + Check if the data pointed to by @buffer is a valid RTCP packet using +gst_rtcp_buffer_validate_reduced(). + + + TRUE if @buffer is a valid RTCP packet. + + + + + the buffer to validate + + + + + + + Different types of feedback messages. + + Invalid type + + + Generic NACK + + + Temporary Maximum Media Stream Bit Rate Request + + + Temporary Maximum Media Stream Bit Rate + Notification + + + Request an SR packet for early + synchronization + + + Picture Loss Indication + + + Slice Loss Indication + + + Reference Picture Selection Indication + + + Application layer Feedback + + + Full Intra Request Command + + + Temporal-Spatial Trade-off Request + + + Temporal-Spatial Trade-off Notification + + + Video Back Channel Message + + + + Data structure that points to a packet at @offset in @buffer. +The size of the structure is made public to allow stack allocations. + + + pointer to RTCP buffer + + + + offset of packet in buffer data + + + + + + + + + + + + + + + + + + + + + + + + + Add profile-specific extension @data to @packet. If @packet already +contains profile-specific extension @data will be appended to the existing +extension. + + + %TRUE if the profile specific extension data was added. + + + + + a valid SR or RR #GstRTCPPacket + + + + profile-specific data + + + + + + length of the profile-specific data in bytes + + + + + + Add a new report block to @packet with the given values. + + + %TRUE if the packet was created. This function can return %FALSE if +the max MTU is exceeded or the number of report blocks is greater than +#GST_RTCP_MAX_RB_COUNT. + + + + + a valid SR or RR #GstRTCPPacket + + + + data source being reported + + + + fraction lost since last SR/RR + + + + the cumululative number of packets lost + + + + the extended last sequence number received + + + + the interarrival jitter + + + + the last SR packet from this source + + + + the delay since last SR packet + + + + + + Get the application-dependent data attached to a RTPFB or PSFB @packet. + + + A pointer to the data + + + + + a valid APP #GstRTCPPacket + + + + + + Get the length of the application-dependent data attached to an APP +@packet. + + + The length of data in 32-bit words. + + + + + a valid APP #GstRTCPPacket + + + + + + Get the name field of the APP @packet. + + + The 4-byte name field, not zero-terminated. + + + + + a valid APP #GstRTCPPacket + + + + + + Get the SSRC/CSRC field of the APP @packet. + + + The SSRC/CSRC. + + + + + a valid APP #GstRTCPPacket + + + + + + Get the subtype field of the APP @packet. + + + The subtype. + + + + + a valid APP #GstRTCPPacket + + + + + + Set the length of the application-dependent data attached to an APP +@packet. + + + %TRUE if there was enough space in the packet to add this much +data. + + + + + a valid APP #GstRTCPPacket + + + + Length of the data in 32-bit words + + + + + + Set the name field of the APP @packet. + + + + + + + a valid APP #GstRTCPPacket + + + + 4-byte ASCII name + + + + + + Set the SSRC/CSRC field of the APP @packet. + + + + + + + a valid APP #GstRTCPPacket + + + + SSRC/CSRC of the packet + + + + + + Set the subtype field of the APP @packet. + + + + + + + a valid APP #GstRTCPPacket + + + + subtype of the packet + + + + + + Add @ssrc to the BYE @packet. + + + %TRUE if the ssrc was added. This function can return %FALSE if +the max MTU is exceeded or the number of sources blocks is greater than +#GST_RTCP_MAX_BYE_SSRC_COUNT. + + + + + a valid BYE #GstRTCPPacket + + + + an SSRC to add + + + + + + Adds @len SSRCs in @ssrc to BYE @packet. + + + %TRUE if the all the SSRCs were added. This function can return %FALSE if +the max MTU is exceeded or the number of sources blocks is greater than +#GST_RTCP_MAX_BYE_SSRC_COUNT. + + + + + a valid BYE #GstRTCPPacket + + + + an array of SSRCs to add + + + + + + number of elements in @ssrc + + + + + + Get the @nth SSRC of the BYE @packet. + + + The @nth SSRC of @packet. + + + + + a valid BYE #GstRTCPPacket + + + + the nth SSRC to get + + + + + + Get the reason in @packet. + + + The reason for the BYE @packet or NULL if the packet did not contain +a reason string. The string must be freed with g_free() after usage. + + + + + a valid BYE #GstRTCPPacket + + + + + + Get the length of the reason string. + + + The length of the reason string or 0 when there is no reason string +present. + + + + + a valid BYE #GstRTCPPacket + + + + + + Get the number of SSRC fields in @packet. + + + The number of SSRC fields in @packet. + + + + + a valid BYE #GstRTCPPacket + + + + + + Set the reason string to @reason in @packet. + + + TRUE if the string could be set. + + + + + a valid BYE #GstRTCPPacket + + + + a reason string + + + + + + The profile-specific extension data is copied into a new allocated +memory area @data. This must be freed with g_free() after usage. + + + %TRUE if there was valid data. + + + + + a valid SR or RR #GstRTCPPacket + + + + result profile-specific data + + + + + + length of the profile-specific extension data + + + + + + Get the Feedback Control Information attached to a RTPFB or PSFB @packet. + + + a pointer to the FCI + + + + + a valid RTPFB or PSFB #GstRTCPPacket + + + + + + Get the length of the Feedback Control Information attached to a +RTPFB or PSFB @packet. + + + The length of the FCI in 32-bit words. + + + + + a valid RTPFB or PSFB #GstRTCPPacket + + + + + + Get the media SSRC field of the RTPFB or PSFB @packet. + + + the media SSRC. + + + + + a valid RTPFB or PSFB #GstRTCPPacket + + + + + + Get the sender SSRC field of the RTPFB or PSFB @packet. + + + the sender SSRC. + + + + + a valid RTPFB or PSFB #GstRTCPPacket + + + + + + Get the feedback message type of the FB @packet. + + + The feedback message type. + + + + + a valid RTPFB or PSFB #GstRTCPPacket + + + + + + Set the length of the Feedback Control Information attached to a +RTPFB or PSFB @packet. + + + %TRUE if there was enough space in the packet to add this much FCI + + + + + a valid RTPFB or PSFB #GstRTCPPacket + + + + Length of the FCI in 32-bit words + + + + + + Set the media SSRC field of the RTPFB or PSFB @packet. + + + + + + + a valid RTPFB or PSFB #GstRTCPPacket + + + + a media SSRC + + + + + + Set the sender SSRC field of the RTPFB or PSFB @packet. + + + + + + + a valid RTPFB or PSFB #GstRTCPPacket + + + + a sender SSRC + + + + + + Set the feedback message type of the FB @packet. + + + + + + + a valid RTPFB or PSFB #GstRTCPPacket + + + + the #GstRTCPFBType to set + + + + + + Get the count field in @packet. + + + The count field in @packet or -1 if @packet does not point to a +valid packet. + + + + + a valid #GstRTCPPacket + + + + + + Get the length field of @packet. This is the length of the packet in +32-bit words minus one. + + + The length field of @packet. + + + + + a valid #GstRTCPPacket + + + + + + Get the packet padding of the packet pointed to by @packet. + + + If the packet has the padding bit set. + + + + + a valid #GstRTCPPacket + + + + + + + + %TRUE if there was valid data. + + + + + a valid SR or RR #GstRTCPPacket + + + + result profile-specific data + + + + + + result length of the profile-specific data + + + + + + + + The number of 32-bit words containing profile-specific extension + data from @packet. + + + + + a valid SR or RR #GstRTCPPacket + + + + + + Parse the values of the @nth report block in @packet and store the result in +the values. + + + + + + + a valid SR or RR #GstRTCPPacket + + + + the nth report block in @packet + + + + result for data source being reported + + + + result for fraction lost since last SR/RR + + + + result for the cumululative number of packets lost + + + + result for the extended last sequence number received + + + + result for the interarrival jitter + + + + result for the last SR packet from this source + + + + result for the delay since last SR packet + + + + + + Get the number of report blocks in @packet. + + + The number of report blocks in @packet. + + + + + a valid SR or RR #GstRTCPPacket + + + + + + Get the packet type of the packet pointed to by @packet. + + + The packet type or GST_RTCP_TYPE_INVALID when @packet is not +pointing to a valid packet. + + + + + a valid #GstRTCPPacket + + + + + + Move the packet pointer @packet to the next packet in the payload. +Use gst_rtcp_buffer_get_first_packet() to initialize @packet. + + + TRUE if @packet is pointing to a valid packet after calling this +function. + + + + + a #GstRTCPPacket + + + + + + Removes the packet pointed to by @packet and moves pointer to the next one + + + TRUE if @packet is pointing to a valid packet after calling this +function. + + + + + a #GstRTCPPacket + + + + + + Get the ssrc field of the RR @packet. + + + the ssrc. + + + + + a valid RR #GstRTCPPacket + + + + + + Set the ssrc field of the RR @packet. + + + + + + + a valid RR #GstRTCPPacket + + + + the SSRC to set + + + + + + Add a new SDES entry to the current item in @packet. + + + %TRUE if the item could be added, %FALSE if the MTU has been +reached. + + + + + a valid SDES #GstRTCPPacket + + + + the #GstRTCPSDESType of the SDES entry + + + + the data length + + + + the data + + + + + + + + Add a new SDES item for @ssrc to @packet. + + + %TRUE if the item could be added, %FALSE if the maximum amount of +items has been exceeded for the SDES packet or the MTU has been reached. + + + + + a valid SDES #GstRTCPPacket + + + + the SSRC of the new item to add + + + + + + This function is like gst_rtcp_packet_sdes_get_entry() but it returns a +null-terminated copy of the data instead. use g_free() after usage. + + + %TRUE if there was valid data. + + + + + a valid SDES #GstRTCPPacket + + + + result of the entry type + + + + result length of the entry data + + + + result entry data + + + + + + + + Move to the first SDES entry in the current item. + + + %TRUE if there was a first entry. + + + + + a valid SDES #GstRTCPPacket + + + + + + Move to the first SDES item in @packet. + + + TRUE if there was a first item. + + + + + a valid SDES #GstRTCPPacket + + + + + + Get the data of the current SDES item entry. @type (when not NULL) will +contain the type of the entry. @data (when not NULL) will point to @len +bytes. + +When @type refers to a text item, @data will point to a UTF8 string. Note +that this UTF8 string is NOT null-terminated. Use +gst_rtcp_packet_sdes_copy_entry() to get a null-terminated copy of the entry. + + + %TRUE if there was valid data. + + + + + a valid SDES #GstRTCPPacket + + + + result of the entry type + + + + result length of the entry data + + + + result entry data + + + + + + + + Get the number of items in the SDES packet @packet. + + + The number of items in @packet. + + + + + a valid SDES #GstRTCPPacket + + + + + + Get the SSRC of the current SDES item. + + + the SSRC of the current item. + + + + + a valid SDES #GstRTCPPacket + + + + + + Move to the next SDES entry in the current item. + + + %TRUE if there was a next entry. + + + + + a valid SDES #GstRTCPPacket + + + + + + Move to the next SDES item in @packet. + + + TRUE if there was a next item. + + + + + a valid SDES #GstRTCPPacket + + + + + + Set the @nth new report block in @packet with the given values. + +Note: Not implemented. + + + + + + + a valid SR or RR #GstRTCPPacket + + + + the nth report block to set + + + + data source being reported + + + + fraction lost since last SR/RR + + + + the cumululative number of packets lost + + + + the extended last sequence number received + + + + the interarrival jitter + + + + the last SR packet from this source + + + + the delay since last SR packet + + + + + + Parse the SR sender info and store the values. + + + + + + + a valid SR #GstRTCPPacket + + + + result SSRC + + + + result NTP time + + + + result RTP time + + + + result packet count + + + + result octet count + + + + + + Set the given values in the SR packet @packet. + + + + + + + a valid SR #GstRTCPPacket + + + + the SSRC + + + + the NTP time + + + + the RTP time + + + + the packet count + + + + the octet count + + + + + + Move to the first extended report block in XR @packet. + + + TRUE if there was a first extended report block. + + + + + a valid XR #GstRTCPPacket + + + + + + + + The number of 32-bit words containing type-specific block + data from @packet. + + + + + a valid XR #GstRTCPPacket + + + + + + Get the extended report block type of the XR @packet. + + + The extended report block type. + + + + + a valid XR #GstRTCPPacket + + + + + + Parse the extended report block for DLRR report block type. + + + %TRUE if the report block is correctly parsed. + + + + + a valid XR #GstRTCPPacket which has DLRR Report Block. + + + + the index of sub-block to retrieve. + + + + the SSRC of the receiver. + + + + the last receiver reference timestamp of @ssrc. + + + + the delay since @last_rr. + + + + + + Retrieve the packet receipt time of @seq which ranges in [begin_seq, end_seq). + + + %TRUE if the report block returns the receipt time correctly. + + + + + a valid XR #GstRTCPPacket which has the Packet Recept Times Report Block. + + + + the sequence to retrieve the time. + + + + the packet receipt time of @seq. + + + + + + Parse the Packet Recept Times Report Block from a XR @packet + + + %TRUE if the report block is correctly parsed. + + + + + a valid XR #GstRTCPPacket which has a Packet Receipt Times Report Block + + + + the SSRC of the RTP data packet source being reported upon by this report block. + + + + the amount of thinning performed on the sequence number space. + + + + the first sequence number that this block reports on. + + + + the last sequence number that this block reports on plus one. + + + + + + Parse the extended report block for Loss RLE and Duplicated LRE block type. + + + %TRUE if the report block is correctly parsed. + + + + + a valid XR #GstRTCPPacket which is Loss RLE or Duplicate RLE report. + + + + the SSRC of the RTP data packet source being reported upon by this report block. + + + + the amount of thinning performed on the sequence number space. + + + + the first sequence number that this block reports on. + + + + the last sequence number that this block reports on plus one. + + + + the number of chunks calculated by block length. + + + + + + Retrieve actual chunk data. + + + %TRUE if the report block returns chunk correctly. + + + + + a valid XR #GstRTCPPacket which is Loss RLE or Duplicate RLE report. + + + + the index of chunk to retrieve. + + + + the @nth chunk. + + + + + + + + %TRUE if the report block returns the reference time correctly. + + + + + a valid XR #GstRTCPPacket which has the Receiver Reference Time. + + + + NTP timestamp + + + + + + Get the ssrc field of the XR @packet. + + + the ssrc. + + + + + a valid XR #GstRTCPPacket + + + + + + Extract a basic information from static summary report block of XR @packet. + + + %TRUE if the report block is correctly parsed. + + + + + a valid XR #GstRTCPPacket which has Statics Summary Report Block. + + + + the SSRC of the source. + + + + the first sequence number that this block reports on. + + + + the last sequence number that this block reports on plus one. + + + + + + Extract jitter information from the statistics summary. If the jitter flag in +a block header is set as zero, all of jitters will be zero. + + + %TRUE if the report block is correctly parsed. + + + + + a valid XR #GstRTCPPacket which has Statics Summary Report Block. + + + + the minimum relative transit time between two sequences. + + + + the maximum relative transit time between two sequences. + + + + the mean relative transit time between two sequences. + + + + the standard deviation of the relative transit time between two sequences. + + + + + + Get the number of lost or duplicate packets. If the flag in a block header +is set as zero, @lost_packets or @dup_packets will be zero. + + + %TRUE if the report block is correctly parsed. + + + + + a valid XR #GstRTCPPacket which has Statics Summary Report Block. + + + + the number of lost packets between begin_seq and end_seq. + + + + the number of duplicate packets between begin_seq and end_seq. + + + + + + Extract the value of ttl for ipv4, or hop limit for ipv6. + + + %TRUE if the report block is correctly parsed. + + + + + a valid XR #GstRTCPPacket which has Statics Summary Report Block. + + + + the flag to indicate that the return values are ipv4 ttl or ipv6 hop limits. + + + + the minimum TTL or Hop Limit value of data packets between two sequences. + + + + the maximum TTL or Hop Limit value of data packets between two sequences. + + + + the mean TTL or Hop Limit value of data packets between two sequences. + + + + the standard deviation of the TTL or Hop Limit value of data packets between two sequences. + + + + + + + + %TRUE if the report block is correctly parsed. + + + + + a valid XR #GstRTCPPacket which has VoIP Metrics Report Block. + + + + the fraction of RTP data packets within burst periods. + + + + the fraction of RTP data packets within inter-burst gaps. + + + + the mean duration(ms) of the burst periods. + + + + the mean duration(ms) of the gap periods. + + + + + + + + %TRUE if the report block is correctly parsed. + + + + + a valid XR #GstRTCPPacket which has VoIP Metrics Report Block. + + + + the gap threshold. + + + + the receiver configuration byte. + + + + + + + + %TRUE if the report block is correctly parsed. + + + + + a valid XR #GstRTCPPacket which has VoIP Metrics Report Block. + + + + the most recently calculated round trip time between RTP interfaces(ms) + + + + the most recently estimated end system delay(ms) + + + + + + + + %TRUE if the report block is correctly parsed. + + + + + a valid XR #GstRTCPPacket which has VoIP Metrics Report Block. + + + + the current nominal jitter buffer delay(ms) + + + + the current maximum jitter buffer delay(ms) + + + + the absolute maximum delay(ms) + + + + + + + + %TRUE if the report block is correctly parsed. + + + + + a valid XR #GstRTCPPacket which has VoIP Metrics Report Block. + + + + the SSRC of source + + + + + + + + %TRUE if the report block is correctly parsed. + + + + + a valid XR #GstRTCPPacket which has VoIP Metrics Report Block. + + + + the fraction of RTP data packets from the source lost. + + + + the fraction of RTP data packets from the source that have been discarded. + + + + + + + + %TRUE if the report block is correctly parsed. + + + + + a valid XR #GstRTCPPacket which has VoIP Metrics Report Block. + + + + the R factor is a voice quality metric describing the segment of the call. + + + + the external R factor is a voice quality metric. + + + + the estimated mean opinion score for listening quality. + + + + the estimated mean opinion score for conversational quality. + + + + + + + + %TRUE if the report block is correctly parsed. + + + + + a valid XR #GstRTCPPacket which has VoIP Metrics Report Block. + + + + the ratio of the signal level to a 0 dBm reference. + + + + the ratio of the silent period background noise level to a 0 dBm reference. + + + + the residual echo return loss value. + + + + the gap threshold. + + + + + + Move to the next extended report block in XR @packet. + + + TRUE if there was a next extended report block. + + + + + a valid XR #GstRTCPPacket + + + + + + + Different types of SDES content. + + Invalid SDES entry + + + End of SDES list + + + Canonical name + + + User name + + + User's electronic mail address + + + User's phone number + + + Geographic user location + + + Name of application or tool + + + Notice about the source + + + Private extensions + + + + Different RTCP packet types. + + Invalid type + + + Sender report + + + Receiver report + + + Source description + + + Goodbye + + + Application defined + + + Transport layer feedback. + + + Payload-specific feedback. + + + Extended report. + + + + Types of RTCP Extended Reports, those are defined in RFC 3611 and other RFCs +according to the [IANA registry](https://www.iana.org/assignments/rtcp-xr-block-types/rtcp-xr-block-types.xhtml). + + Invalid XR Report Block + + + Loss RLE Report Block + + + Duplicate RLE Report Block + + + Packet Receipt Times Report Block + + + Receiver Reference Time Report Block + + + Delay since the last Receiver Report + + + Statistics Summary Report Block + + + VoIP Metrics Report Block + + + + The maximum amount of SSRCs in a BYE packet. + + + + + The maximum amount of Receiver report blocks in RR and SR messages. + + + + + The maximum text length for an SDES item. + + + + + The maximum amount of SDES items. + + + + + Mask for version, padding bit and packet type pair allowing reduced size +packets, basically it accepts other types than RR and SR + + + + + Mask for version, padding bit and packet type pair + + + + + Valid value for the first two bytes of an RTCP packet after applying +#GST_RTCP_VALID_MASK to them. + + + + + The supported RTCP version 2. + + + + + Provides a base class for audio RTP payloaders for frame or sample based +audio codecs (constant bitrate) + +This class derives from GstRTPBasePayload. It can be used for payloading +audio codecs. It will only work with constant bitrate codecs. It supports +both frame based and sample based codecs. It takes care of packing up the +audio data into RTP packets and filling up the headers accordingly. The +payloading is done based on the maximum MTU (mtu) and the maximum time per +packet (max-ptime). The general idea is to divide large data buffers into +smaller RTP packets. The RTP packet size is the minimum of either the MTU, +max-ptime (if set) or available data. The RTP packet size is always larger or +equal to min-ptime (if set). If min-ptime is not set, any residual data is +sent in a last RTP packet. In the case of frame based codecs, the resulting +RTP packets always contain full frames. + +## Usage + +To use this base class, your child element needs to call either +gst_rtp_base_audio_payload_set_frame_based() or +gst_rtp_base_audio_payload_set_sample_based(). This is usually done in the +element's _init() function. Then, the child element must call either +gst_rtp_base_audio_payload_set_frame_options(), +gst_rtp_base_audio_payload_set_sample_options() or +gst_rtp_base_audio_payload_set_samplebits_options. Since +GstRTPBaseAudioPayload derives from GstRTPBasePayload, the child element +must set any variables or call/override any functions required by that base +class. The child element does not need to override any other functions +specific to GstRTPBaseAudioPayload. + + + Create an RTP buffer and store @payload_len bytes of the adapter as the +payload. Set the timestamp on the new buffer to @timestamp before pushing +the buffer downstream. + +If @payload_len is -1, all pending bytes will be flushed. If @timestamp is +-1, the timestamp will be calculated automatically. + + + a #GstFlowReturn + + + + + a #GstRTPBasePayload + + + + length of payload + + + + a #GstClockTime + + + + + + Gets the internal adapter used by the depayloader. + + + a #GstAdapter. + + + + + a #GstRTPBaseAudioPayload + + + + + + Create an RTP buffer and store @payload_len bytes of @data as the +payload. Set the timestamp on the new buffer to @timestamp before pushing +the buffer downstream. + + + a #GstFlowReturn + + + + + a #GstRTPBasePayload + + + + data to set as payload + + + + + + length of payload + + + + a #GstClockTime + + + + + + Tells #GstRTPBaseAudioPayload that the child element is for a frame based +audio codec + + + + + + + a pointer to the element. + + + + + + Sets the options for frame based audio codecs. + + + + + + + a pointer to the element. + + + + The duraction of an audio frame in milliseconds. + + + + The size of an audio frame in bytes. + + + + + + Tells #GstRTPBaseAudioPayload that the child element is for a sample based +audio codec + + + + + + + a pointer to the element. + + + + + + Sets the options for sample based audio codecs. + + + + + + + a pointer to the element. + + + + Size per sample in bytes. + + + + + + Sets the options for sample based audio codecs. + + + + + + + a pointer to the element. + + + + Size per sample in bits. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Base class for audio RTP payloader. + + + the parent class + + + + + + + + + + + + + Provides a base class for RTP depayloaders + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Queries whether #GstRTPSourceMeta will be added to depayloaded buffers. + + + %TRUE if source-info is enabled. + + + + + a #GstRTPBaseDepayload + + + + + + Push @out_buf to the peer of @filter. This function takes ownership of +@out_buf. + +This function will by default apply the last incomming timestamp on +the outgoing buffer when it didn't have a timestamp already. + + + a #GstFlowReturn. + + + + + a #GstRTPBaseDepayload + + + + a #GstBuffer + + + + + + Push @out_list to the peer of @filter. This function takes ownership of +@out_list. + + + a #GstFlowReturn. + + + + + a #GstRTPBaseDepayload + + + + a #GstBufferList + + + + + + Enable or disable adding #GstRTPSourceMeta to depayloaded buffers. + + + + + + + a #GstRTPBaseDepayload + + + + whether to add meta about RTP sources to buffer + + + + + + Add RTP source information found in RTP header as meta to output buffer. + + + + Various depayloader statistics retrieved atomically (and are therefore +synchroized with each other). This property return a GstStructure named +application/x-rtp-depayload-stats containing the following fields relating to +the last processed buffer and current state of the stream being depayloaded: + + * `clock-rate`: #G_TYPE_UINT, clock-rate of the stream + * `npt-start`: #G_TYPE_UINT64, time of playback start + * `npt-stop`: #G_TYPE_UINT64, time of playback stop + * `play-speed`: #G_TYPE_DOUBLE, the playback speed + * `play-scale`: #G_TYPE_DOUBLE, the playback scale + * `running-time-dts`: #G_TYPE_UINT64, the last running-time of the + last DTS + * `running-time-pts`: #G_TYPE_UINT64, the last running-time of the + last PTS + * `seqnum`: #G_TYPE_UINT, the last seen seqnum + * `timestamp`: #G_TYPE_UINT, the last seen RTP timestamp + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Base class for RTP depayloaders. + + + the parent class + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Provides a base class for RTP payloaders + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Allocate a new #GstBuffer with enough data to hold an RTP packet with +minimum @csrc_count CSRCs, a payload length of @payload_len and padding of +@pad_len. If @payload has #GstRTPBasePayload:source-info %TRUE additional +CSRCs may be allocated and filled with RTP source information. + + + A newly allocated buffer that can hold an RTP packet with given +parameters. + + + + + a #GstRTPBasePayload + + + + the length of the payload + + + + the amount of padding + + + + the minimum number of CSRC entries + + + + + + Count the total number of RTP sources found in the meta of @buffer, which +will be automically added by gst_rtp_base_payload_allocate_output_buffer(). +If #GstRTPBasePayload:source-info is %FALSE the count will be 0. + + + The number of sources. + + + + + a #GstRTPBasePayload + + + + a #GstBuffer, typically the buffer to payload + + + + + + Check if the packet with @size and @duration would exceed the configured +maximum size. + + + %TRUE if the packet of @size and @duration would exceed the +configured MTU or max_ptime. + + + + + a #GstRTPBasePayload + + + + the size of the packet + + + + the duration of the packet + + + + + + Queries whether the payloader will add contributing sources (CSRCs) to the +RTP header from #GstRTPSourceMeta. + + + %TRUE if source-info is enabled. + + + + + a #GstRTPBasePayload + + + + + + Push @buffer to the peer element of the payloader. The SSRC, payload type, +seqnum and timestamp of the RTP buffer will be updated first. + +This function takes ownership of @buffer. + + + a #GstFlowReturn. + + + + + a #GstRTPBasePayload + + + + a #GstBuffer + + + + + + Push @list to the peer element of the payloader. The SSRC, payload type, +seqnum and timestamp of the RTP buffer will be updated first. + +This function takes ownership of @list. + + + a #GstFlowReturn. + + + + + a #GstRTPBasePayload + + + + a #GstBufferList + + + + + + Set the rtp options of the payloader. These options will be set in the caps +of the payloader. Subclasses must call this method before calling +gst_rtp_base_payload_push() or gst_rtp_base_payload_set_outcaps(). + + + + + + + a #GstRTPBasePayload + + + + the media type (typically "audio" or "video") + + + + if the payload type is dynamic + + + + the encoding name + + + + the clock rate of the media + + + + + + Configure the output caps with the optional parameters. + +Variable arguments should be in the form field name, field type +(as a GType), value(s). The last variable argument should be NULL. + + + %TRUE if the caps could be set. + + + + + a #GstRTPBasePayload + + + + the first field name or %NULL + + + + field values + + + + + + Enable or disable adding contributing sources to RTP packets from +#GstRTPSourceMeta. + + + + + + + a #GstRTPBasePayload + + + + whether to add contributing sources to RTP packets + + + + + + + + + Minimum duration of the packet data in ns (can't go above MTU) + + + + + + + Make the payloader timestamp packets according to the Rate-Control=no +behaviour specified in the ONVIF replay spec. + + + + Try to use the offset fields to generate perfect RTP timestamps. When this +option is disabled, RTP timestamps are generated from GST_BUFFER_PTS of +each payloaded buffer. The PTSes of buffers may not necessarily increment +with the amount of data in each input buffer, consider e.g. the case where +the buffer arrives from a network which means that the PTS is unrelated to +the amount of data. Because the RTP timestamps are generated from +GST_BUFFER_PTS this can result in RTP timestamps that also don't increment +with the amount of data in the payloaded packet. To circumvent this it is +possible to set the perfect rtptime option enabled. When this option is +enabled the payloader will increment the RTP timestamps based on +GST_BUFFER_OFFSET which relates to the amount of data in each packet +rather than the GST_BUFFER_PTS of each buffer and therefore the RTP +timestamps will more closely correlate with the amount of data in each +buffer. Currently GstRTPBasePayload is limited to handling perfect RTP +timestamps for audio streams. + + + + + + + Force buffers to be multiples of this duration in ns (0 disables) + + + + + + + + + + Enable writing the CSRC field in allocated RTP header based on RTP source +information found in the input buffer's #GstRTPSourceMeta. + + + + + + + Various payloader statistics retrieved atomically (and are therefore +synchroized with each other), these can be used e.g. to generate an +RTP-Info header. This property return a GstStructure named +application/x-rtp-payload-stats containing the following fields relating to +the last processed buffer and current state of the stream being payloaded: + + * `clock-rate` :#G_TYPE_UINT, clock-rate of the stream + * `running-time` :#G_TYPE_UINT64, running time + * `seqnum` :#G_TYPE_UINT, sequence number, same as #GstRTPBasePayload:seqnum + * `timestamp` :#G_TYPE_UINT, RTP timestamp, same as #GstRTPBasePayload:timestamp + * `ssrc` :#G_TYPE_UINT, The SSRC in use + * `pt` :#G_TYPE_UINT, The Payload type in use, same as #GstRTPBasePayload:pt + * `seqnum-offset` :#G_TYPE_UINT, The current offset added to the seqnum + * `timestamp-offset` :#G_TYPE_UINT, The current offset added to the timestamp + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Base class for audio RTP payloader. + + + the parent class + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The GstRTPBuffer helper functions makes it easy to parse and create regular +#GstBuffer objects that contain RTP payloads. These buffers are typically of +'application/x-rtp' #GstCaps. + + + pointer to RTP buffer + + + + internal state + + + + array of data + + + + + + array of size + + + + + + array of #GstMapInfo + + + + + + Adds a RFC 5285 header extension with a one byte header to the end of the +RTP header. If there is already a RFC 5285 header extension with a one byte +header, the new extension will be appended. +It will not work if there is already a header extension that does not follow +the mecanism described in RFC 5285 or if there is a header extension with +a two bytes header as described in RFC 5285. In that case, use +gst_rtp_buffer_add_extension_twobytes_header() + + + %TRUE if header extension could be added + + + + + the RTP packet + + + + The ID of the header extension (between 1 and 14). + + + + location for data + + + + + + the size of the data in bytes + + + + + + Adds a RFC 5285 header extension with a two bytes header to the end of the +RTP header. If there is already a RFC 5285 header extension with a two bytes +header, the new extension will be appended. +It will not work if there is already a header extension that does not follow +the mecanism described in RFC 5285 or if there is a header extension with +a one byte header as described in RFC 5285. In that case, use +gst_rtp_buffer_add_extension_onebyte_header() + + + %TRUE if header extension could be added + + + + + the RTP packet + + + + Application specific bits + + + + The ID of the header extension + + + + location for data + + + + + + the size of the data in bytes + + + + + + Get the CSRC at index @idx in @buffer. + + + the CSRC at index @idx in host order. + + + + + the RTP packet + + + + the index of the CSRC to get + + + + + + Get the CSRC count of the RTP packet in @buffer. + + + the CSRC count of @buffer. + + + + + the RTP packet + + + + + + Check if the extension bit is set on the RTP packet in @buffer. + + + TRUE if @buffer has the extension bit set. + + + + + the RTP packet + + + + + + Similar to gst_rtp_buffer_get_extension_data, but more suitable for language +bindings usage. @bits will contain the extension 16 bits of custom data and +the extension data (not including the extension header) is placed in a new +#GBytes structure. + +If @rtp did not contain an extension, this function will return %NULL, with +@bits unchanged. If there is an extension header but no extension data then +an empty #GBytes will be returned. + + + A new #GBytes if an extension header was present +and %NULL otherwise. + + + + + the RTP packet + + + + location for header bits + + + + + + Get the extension data. @bits will contain the extension 16 bits of custom +data. @data will point to the data in the extension and @wordlen will contain +the length of @data in 32 bits words. + +If @buffer did not contain an extension, this function will return %FALSE +with @bits, @data and @wordlen unchanged. + + + TRUE if @buffer had the extension bit set. + + + + + the RTP packet + + + + location for result bits + + + + location for data + + + + + + location for length of @data in 32 bits words + + + + + + Parses RFC 5285 style header extensions with a one byte header. It will +return the nth extension with the requested id. + + + TRUE if @buffer had the requested header extension + + + + + the RTP packet + + + + The ID of the header extension to be read (between 1 and 14). + + + + Read the nth extension packet with the requested ID + + + + + location for data + + + + + + the size of the data in bytes + + + + + + Parses RFC 5285 style header extensions with a two bytes header. It will +return the nth extension with the requested id. + + + TRUE if @buffer had the requested header extension + + + + + the RTP packet + + + + Application specific bits + + + + The ID of the header extension to be read (between 1 and 14). + + + + Read the nth extension packet with the requested ID + + + + + location for data + + + + + + the size of the data in bytes + + + + + + Return the total length of the header in @buffer. This include the length of +the fixed header, the CSRC list and the extension header. + + + The total length of the header in @buffer. + + + + + the RTP packet + + + + + + Check if the marker bit is set on the RTP packet in @buffer. + + + TRUE if @buffer has the marker bit set. + + + + + the RTP packet + + + + + + Return the total length of the packet in @buffer. + + + The total length of the packet in @buffer. + + + + + the RTP packet + + + + + + Check if the padding bit is set on the RTP packet in @buffer. + + + TRUE if @buffer has the padding bit set. + + + + + the RTP packet + + + + + + Get a pointer to the payload data in @buffer. This pointer is valid as long +as a reference to @buffer is held. + + + A pointer +to the payload data in @buffer. + + + + + + + the RTP packet + + + + + + Create a buffer of the payload of the RTP packet in @buffer. This function +will internally create a subbuffer of @buffer so that a memcpy can be +avoided. + + + A new buffer with the data of the payload. + + + + + the RTP packet + + + + + + Similar to gst_rtp_buffer_get_payload, but more suitable for language +bindings usage. The return value is a pointer to a #GBytes structure +containing the payload data in @rtp. + + + A new #GBytes containing the payload data in @rtp. + + + + + the RTP packet + + + + + + Get the length of the payload of the RTP packet in @buffer. + + + The length of the payload in @buffer. + + + + + the RTP packet + + + + + + Create a subbuffer of the payload of the RTP packet in @buffer. @offset bytes +are skipped in the payload and the subbuffer will be of size @len. +If @len is -1 the total payload starting from @offset is subbuffered. + + + A new buffer with the specified data of the payload. + + + + + the RTP packet + + + + the offset in the payload + + + + the length in the payload + + + + + + Get the payload type of the RTP packet in @buffer. + + + The payload type. + + + + + the RTP packet + + + + + + Get the sequence number of the RTP packet in @buffer. + + + The sequence number in host order. + + + + + the RTP packet + + + + + + Get the SSRC of the RTP packet in @buffer. + + + the SSRC of @buffer in host order. + + + + + the RTP packet + + + + + + Get the timestamp of the RTP packet in @buffer. + + + The timestamp in host order. + + + + + the RTP packet + + + + + + Get the version number of the RTP packet in @buffer. + + + The version of @buffer. + + + + + the RTP packet + + + + + + Set the amount of padding in the RTP packet in @buffer to +@len. If @len is 0, the padding is removed. + +NOTE: This function does not work correctly. + + + + + + + the RTP packet + + + + the new amount of padding + + + + + + Modify the CSRC at index @idx in @buffer to @csrc. + + + + + + + the RTP packet + + + + the CSRC index to set + + + + the CSRC in host order to set at @idx + + + + + + Set the extension bit on the RTP packet in @buffer to @extension. + + + + + + + the RTP packet + + + + the new extension + + + + + + Set the extension bit of the rtp buffer and fill in the @bits and @length of the +extension header. If the existing extension data is not large enough, it will +be made larger. + + + True if done. + + + + + the RTP packet + + + + the bits specific for the extension + + + + the length that counts the number of 32-bit words in +the extension, excluding the extension header ( therefore zero is a valid length) + + + + + + Set the marker bit on the RTP packet in @buffer to @marker. + + + + + + + the RTP packet + + + + the new marker + + + + + + Set the total @rtp size to @len. The data in the buffer will be made +larger if needed. Any padding will be removed from the packet. + + + + + + + the RTP packet + + + + the new packet length + + + + + + Set the padding bit on the RTP packet in @buffer to @padding. + + + + + + + the buffer + + + + the new padding + + + + + + Set the payload type of the RTP packet in @buffer to @payload_type. + + + + + + + the RTP packet + + + + the new type + + + + + + Set the sequence number of the RTP packet in @buffer to @seq. + + + + + + + the RTP packet + + + + the new sequence number + + + + + + Set the SSRC on the RTP packet in @buffer to @ssrc. + + + + + + + the RTP packet + + + + the new SSRC + + + + + + Set the timestamp of the RTP packet in @buffer to @timestamp. + + + + + + + the RTP packet + + + + the new timestamp + + + + + + Set the version of the RTP packet in @buffer to @version. + + + + + + + the RTP packet + + + + the new version + + + + + + Unmap @rtp previously mapped with gst_rtp_buffer_map(). + + + + + + + a #GstRTPBuffer + + + + + + Allocate enough data in @buffer to hold an RTP packet with @csrc_count CSRCs, +a payload length of @payload_len and padding of @pad_len. +@buffer must be writable and all previous memory in @buffer will be freed. +If @pad_len is >0, the padding bit will be set. All other RTP header fields +will be set to 0/FALSE. + + + + + + + a #GstBuffer + + + + the length of the payload + + + + the amount of padding + + + + the number of CSRC entries + + + + + + Calculate the header length of an RTP packet with @csrc_count CSRC entries. +An RTP packet can have at most 15 CSRC entries. + + + The length of an RTP header with @csrc_count CSRC entries. + + + + + the number of CSRC entries + + + + + + Calculate the total length of an RTP packet with a payload size of @payload_len, +a padding of @pad_len and a @csrc_count CSRC entries. + + + The total length of an RTP header with given parameters. + + + + + the length of the payload + + + + the amount of padding + + + + the number of CSRC entries + + + + + + Calculate the length of the payload of an RTP packet with size @packet_len, +a padding of @pad_len and a @csrc_count CSRC entries. + + + The length of the payload of an RTP packet with given parameters. + + + + + the length of the total RTP packet + + + + the amount of padding + + + + the number of CSRC entries + + + + + + Compare two sequence numbers, taking care of wraparounds. This function +returns the difference between @seqnum1 and @seqnum2. + + + a negative value if @seqnum1 is bigger than @seqnum2, 0 if they +are equal or a positive value if @seqnum1 is smaller than @segnum2. + + + + + a sequence number + + + + a sequence number + + + + + + Get the default clock-rate for the static payload type @payload_type. + + + the default clock rate or -1 if the payload type is not static or +the clock-rate is undefined. + + + + + the static payload type + + + + + + Update the @exttimestamp field with the extended timestamp of @timestamp +For the first call of the method, @exttimestamp should point to a location +with a value of -1. + +This function is able to handle both forward and backward timestamps taking +into account: + - timestamp wraparound making sure that the returned value is properly increased. + - timestamp unwraparound making sure that the returned value is properly decreased. + + + The extended timestamp of @timestamp or 0 if the result can't go anywhere backwards. + + + + + a previous extended timestamp + + + + a new timestamp + + + + + + Map the contents of @buffer into @rtp. + + + %TRUE if @buffer could be mapped. + + + + + a #GstBuffer + + + + #GstMapFlags + + + + a #GstRTPBuffer + + + + + + Allocate a new #GstBuffer with enough data to hold an RTP packet with +@csrc_count CSRCs, a payload length of @payload_len and padding of @pad_len. +All other RTP header fields will be set to 0/FALSE. + + + A newly allocated buffer that can hold an RTP packet with given +parameters. + + + + + the length of the payload + + + + the amount of padding + + + + the number of CSRC entries + + + + + + Create a new #GstBuffer that can hold an RTP packet that is exactly +@packet_len long. The length of the payload depends on @pad_len and +@csrc_count and can be calculated with gst_rtp_buffer_calc_payload_len(). +All RTP header fields will be set to 0/FALSE. + + + A newly allocated buffer that can hold an RTP packet of @packet_len. + + + + + the total length of the packet + + + + the amount of padding + + + + the number of CSRC entries + + + + + + Create a new buffer and set the data to a copy of @len +bytes of @data and the size to @len. The data will be freed when the buffer +is freed. + + + A newly allocated buffer with a copy of @data and of size @len. + + + + + data for the new + buffer + + + + + + the length of data + + + + + + Create a new buffer and set the data and size of the buffer to @data and @len +respectively. @data will be freed when the buffer is unreffed, so this +function transfers ownership of @data to the new buffer. + + + A newly allocated buffer with @data and of size @len. + + + + + + data for the new buffer + + + + + + the length of data + + + + + + + Additional RTP buffer flags. These flags can potentially be used on any +buffers carrying RTP packets. + +Note that these are only valid for #GstCaps of type: application/x-rtp (x-rtcp). +They can conflict with other extended buffer flags. + + The #GstBuffer was once wrapped + in a retransmitted packet as specified by RFC 4588. + + + The packet represents redundant RTP packet. + The flag is used in gstrtpstorage to be able to hold the packetback + and use it only for recovery from packet loss. + Since: 1.14 + + + Offset to define more flags. + + + + Additional mapping flags for gst_rtp_buffer_map(). + + Skip mapping and validation of RTP + padding and RTP pad count when present. Useful for buffers where + the padding may be encrypted. + + + Offset to define more flags + + + + Standard predefined fixed payload types. + +The official list is at: +http://www.iana.org/assignments/rtp-parameters + +Audio: +reserved: 19 +unassigned: 20-23, + +Video: +unassigned: 24, 27, 29, 30, 35-71, 77-95 +Reserved for RTCP conflict avoidance: 72-76 + + ITU-T G.711. mu-law audio (RFC 3551) + + + RFC 3551 says reserved + + + RFC 3551 says reserved + + + GSM audio + + + ITU G.723.1 audio + + + IMA ADPCM wave type (RFC 3551) + + + IMA ADPCM wave type (RFC 3551) + + + experimental linear predictive encoding + + + ITU-T G.711 A-law audio (RFC 3551) + + + ITU-T G.722 (RFC 3551) + + + stereo PCM + + + mono PCM + + + EIA & TIA standard IS-733 + + + Comfort Noise (RFC 3389) + + + Audio MPEG 1-3. + + + ITU-T G.728 Speech coder (RFC 3551) + + + IMA ADPCM wave type (RFC 3551) + + + IMA ADPCM wave type (RFC 3551) + + + ITU-T G.729 Speech coder (RFC 3551) + + + See RFC 2029 + + + ISO Standards 10918-1 and 10918-2 (RFC 2435) + + + nv encoding by Ron Frederick + + + ITU-T Recommendation H.261 (RFC 2032) + + + Video MPEG 1 & 2 (RFC 2250) + + + MPEG-2 transport stream (RFC 2250) + + + Video H263 (RFC 2190) + + + + Structure holding default payload type information. + + + payload type, -1 means dynamic + + + + the media type(s), usually "audio", "video", "application", "text", +"message". + + + + the encoding name of @pt + + + + default clock rate, 0 = unknown/variable + + + + encoding parameters. For audio this is the number of +channels. NULL = not applicable. + + + + the bitrate of the media. 0 = unknown/variable. + + + + + + + + + Get the #GstRTPPayloadInfo for @media and @encoding_name. This function is +mostly used to get the default clock-rate and bandwidth for dynamic payload +types specified with @media and @encoding name. + +The search for @encoding_name will be performed in a case insensitve way. + + + a #GstRTPPayloadInfo or NULL when no info could be found. + + + + + the media to find + + + + the encoding name to find + + + + + + Get the #GstRTPPayloadInfo for @payload_type. This function is +mostly used to get the default clock-rate and bandwidth for static payload +types specified with @payload_type. + + + a #GstRTPPayloadInfo or NULL when no info could be found. + + + + + the payload_type to find + + + + + + + The transfer profile to use. + + invalid profile + + + the Audio/Visual profile (RFC 3551) + + + the secure Audio/Visual profile (RFC 3711) + + + the Audio/Visual profile with feedback (RFC 4585) + + + the secure Audio/Visual profile with feedback (RFC 5124) + + + + Meta describing the source(s) of the buffer. + + + parent #GstMeta + + + + the SSRC + + + + whether @ssrc is set and valid + + + + pointer to the CSRCs + + + + + + number of elements in @csrc + + + + Appends @csrc to the list of contributing sources in @meta. + + + %TRUE if all elements in @csrc was added, %FALSE otherwise. + + + + + a #GstRTPSourceMeta + + + + the csrcs to append + + + + number of elements in @csrc + + + + + + Count the total number of RTP sources found in @meta, both SSRC and CSRC. + + + The number of RTP sources + + + + + a #GstRTPSourceMeta + + + + + + Sets @ssrc in @meta. If @ssrc is %NULL the ssrc of @meta will be unset. + + + %TRUE on success, %FALSE otherwise. + + + + + a #GstRTPSourceMeta + + + + pointer to the SSRC + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The supported RTP version 2. + + + + + Attaches RTP source information to @buffer. + + + the #GstRTPSourceMeta on @buffer. + + + + + a #GstBuffer + + + + pointer to the SSRC + + + + pointer to the CSRCs + + + + number of elements in @csrc + + + + + + Find the #GstRTPSourceMeta on @buffer. + + + the #GstRTPSourceMeta or %NULL when there +is no such metadata on @buffer. + + + + + a #GstBuffer + + + + + + Open @buffer for reading or writing, depending on @flags. The resulting RTCP +buffer state is stored in @rtcp. + + + + + + + a buffer with an RTCP packet + + + + flags for the mapping + + + + resulting #GstRTCPBuffer + + + + + + Create a new buffer for constructing RTCP packets. The packet will have a +maximum size of @mtu. + + + A newly allocated buffer. + + + + + the maximum mtu size. + + + + + + Create a new buffer and set the data to a copy of @len +bytes of @data and the size to @len. The data will be freed when the buffer +is freed. + + + A newly allocated buffer with a copy of @data and of size @len. + + + + + data for the new buffer + + + + + + the length of data + + + + + + Create a new buffer and set the data and size of the buffer to @data and @len +respectively. @data will be freed when the buffer is unreffed, so this +function transfers ownership of @data to the new buffer. + + + A newly allocated buffer with @data and of size @len. + + + + + data for the new buffer + + + + + + the length of data + + + + + + Check if the data pointed to by @buffer is a valid RTCP packet using +gst_rtcp_buffer_validate_data(). + + + TRUE if @buffer is a valid RTCP packet. + + + + + the buffer to validate + + + + + + Check if the @data and @size point to the data of a valid compound, +non-reduced size RTCP packet. +Use this function to validate a packet before using the other functions in +this module. + + + TRUE if the data points to a valid RTCP packet. + + + + + the data to validate + + + + + + the length of @data to validate + + + + + + Check if the @data and @size point to the data of a valid RTCP packet. +Use this function to validate a packet before using the other functions in +this module. + +This function is updated to support reduced size rtcp packets according to +RFC 5506 and will validate full compound RTCP packets as well as reduced +size RTCP packets. + + + TRUE if the data points to a valid RTCP packet. + + + + + the data to validate + + + + + + the length of @data to validate + + + + + + Check if the data pointed to by @buffer is a valid RTCP packet using +gst_rtcp_buffer_validate_reduced(). + + + TRUE if @buffer is a valid RTCP packet. + + + + + the buffer to validate + + + + + + Converts an NTP time to UNIX nanoseconds. @ntptime can typically be +the NTP time of an SR RTCP message and contains, in the upper 32 bits, the +number of seconds since 1900 and, in the lower 32 bits, the fractional +seconds. The resulting value will be the number of nanoseconds since 1970. + + + the UNIX time for @ntptime in nanoseconds. + + + + + an NTP timestamp + + + + + + Convert @name into a @GstRTCPSDESType. @name is typically a key in a +#GstStructure containing SDES items. + + + the #GstRTCPSDESType for @name or #GST_RTCP_SDES_PRIV when @name +is a private sdes item. + + + + + a SDES name + + + + + + Converts @type to the string equivalent. The string is typically used as a +key in a #GstStructure containing SDES items. + + + the string equivalent of @type + + + + + a #GstRTCPSDESType + + + + + + Converts a UNIX timestamp in nanoseconds to an NTP time. The caller should +pass a value with nanoseconds since 1970. The NTP time will, in the upper +32 bits, contain the number of seconds since 1900 and, in the lower 32 +bits, the fractional seconds. The resulting value can be used as an ntptime +for constructing SR RTCP packets. + + + the NTP time for @unixtime. + + + + + an UNIX timestamp in nanoseconds + + + + + + Allocate enough data in @buffer to hold an RTP packet with @csrc_count CSRCs, +a payload length of @payload_len and padding of @pad_len. +@buffer must be writable and all previous memory in @buffer will be freed. +If @pad_len is >0, the padding bit will be set. All other RTP header fields +will be set to 0/FALSE. + + + + + + + a #GstBuffer + + + + the length of the payload + + + + the amount of padding + + + + the number of CSRC entries + + + + + + Calculate the header length of an RTP packet with @csrc_count CSRC entries. +An RTP packet can have at most 15 CSRC entries. + + + The length of an RTP header with @csrc_count CSRC entries. + + + + + the number of CSRC entries + + + + + + Calculate the total length of an RTP packet with a payload size of @payload_len, +a padding of @pad_len and a @csrc_count CSRC entries. + + + The total length of an RTP header with given parameters. + + + + + the length of the payload + + + + the amount of padding + + + + the number of CSRC entries + + + + + + Calculate the length of the payload of an RTP packet with size @packet_len, +a padding of @pad_len and a @csrc_count CSRC entries. + + + The length of the payload of an RTP packet with given parameters. + + + + + the length of the total RTP packet + + + + the amount of padding + + + + the number of CSRC entries + + + + + + Compare two sequence numbers, taking care of wraparounds. This function +returns the difference between @seqnum1 and @seqnum2. + + + a negative value if @seqnum1 is bigger than @seqnum2, 0 if they +are equal or a positive value if @seqnum1 is smaller than @segnum2. + + + + + a sequence number + + + + a sequence number + + + + + + Get the default clock-rate for the static payload type @payload_type. + + + the default clock rate or -1 if the payload type is not static or +the clock-rate is undefined. + + + + + the static payload type + + + + + + Update the @exttimestamp field with the extended timestamp of @timestamp +For the first call of the method, @exttimestamp should point to a location +with a value of -1. + +This function is able to handle both forward and backward timestamps taking +into account: + - timestamp wraparound making sure that the returned value is properly increased. + - timestamp unwraparound making sure that the returned value is properly decreased. + + + The extended timestamp of @timestamp or 0 if the result can't go anywhere backwards. + + + + + a previous extended timestamp + + + + a new timestamp + + + + + + Map the contents of @buffer into @rtp. + + + %TRUE if @buffer could be mapped. + + + + + a #GstBuffer + + + + #GstMapFlags + + + + a #GstRTPBuffer + + + + + + Allocate a new #GstBuffer with enough data to hold an RTP packet with +@csrc_count CSRCs, a payload length of @payload_len and padding of @pad_len. +All other RTP header fields will be set to 0/FALSE. + + + A newly allocated buffer that can hold an RTP packet with given +parameters. + + + + + the length of the payload + + + + the amount of padding + + + + the number of CSRC entries + + + + + + Create a new #GstBuffer that can hold an RTP packet that is exactly +@packet_len long. The length of the payload depends on @pad_len and +@csrc_count and can be calculated with gst_rtp_buffer_calc_payload_len(). +All RTP header fields will be set to 0/FALSE. + + + A newly allocated buffer that can hold an RTP packet of @packet_len. + + + + + the total length of the packet + + + + the amount of padding + + + + the number of CSRC entries + + + + + + Create a new buffer and set the data to a copy of @len +bytes of @data and the size to @len. The data will be freed when the buffer +is freed. + + + A newly allocated buffer with a copy of @data and of size @len. + + + + + data for the new + buffer + + + + + + the length of data + + + + + + Create a new buffer and set the data and size of the buffer to @data and @len +respectively. @data will be freed when the buffer is unreffed, so this +function transfers ownership of @data to the new buffer. + + + A newly allocated buffer with @data and of size @len. + + + + + + data for the new buffer + + + + + + the length of data + + + + + + Reads the NTP time from the @size NTP-56 extension bytes in @data and store the +result in @ntptime. + + + %TRUE on success. + + + + + the data to read from + + + + + + the size of @data + + + + the result NTP time + + + + + + Reads the NTP time from the @size NTP-64 extension bytes in @data and store the +result in @ntptime. + + + %TRUE on success. + + + + + the data to read from + + + + + + the size of @data + + + + the result NTP time + + + + + + Writes the NTP time in @ntptime to the format required for the NTP-56 header +extension. @data must hold at least #GST_RTP_HDREXT_NTP_56_SIZE bytes. + + + %TRUE on success. + + + + + the data to write to + + + + the size of @data + + + + the NTP time + + + + + + Writes the NTP time in @ntptime to the format required for the NTP-64 header +extension. @data must hold at least #GST_RTP_HDREXT_NTP_64_SIZE bytes. + + + %TRUE on success. + + + + + the data to write to + + + + the size of @data + + + + the NTP time + + + + + + Get the #GstRTPPayloadInfo for @media and @encoding_name. This function is +mostly used to get the default clock-rate and bandwidth for dynamic payload +types specified with @media and @encoding name. + +The search for @encoding_name will be performed in a case insensitve way. + + + a #GstRTPPayloadInfo or NULL when no info could be found. + + + + + the media to find + + + + the encoding name to find + + + + + + Get the #GstRTPPayloadInfo for @payload_type. This function is +mostly used to get the default clock-rate and bandwidth for static payload +types specified with @payload_type. + + + a #GstRTPPayloadInfo or NULL when no info could be found. + + + + + the payload_type to find + + + + + + + + + + + + + + + + + + diff --git a/gstreamer-rtp-sys/Cargo.toml b/gstreamer-rtp-sys/Cargo.toml new file mode 100644 index 000000000..9dc2b707c --- /dev/null +++ b/gstreamer-rtp-sys/Cargo.toml @@ -0,0 +1,54 @@ +[build-dependencies] +pkg-config = "0.3.7" + +[dependencies] +libc = "0.2" + +[dependencies.glib-sys] +git = "https://github.com/gtk-rs/sys" + +[dependencies.gobject-sys] +git = "https://github.com/gtk-rs/sys" + +[dependencies.gstreamer-base-sys] +path = "../gstreamer-base-sys" + +[dependencies.gstreamer-sys] +path = "../gstreamer-sys" + +[dev-dependencies] +shell-words = "0.1.0" +tempdir = "0.3" + +[features] +v1_4 = ["v1_2"] +v1_8 = ["v1_4"] +v1_8_1 = ["v1_8"] +v1_12 = ["v1_10"] +v1_14 = ["v1_12"] +v1_2 = [] +v1_6 = ["v1_2"] +v1_6_1 = ["v1_6"] +v1_10 = ["v1_6_1"] +v1_16 = ["v1_10"] +dox = [] + +[lib] +name = "gstreamer_rtp_sys" + +[package] +authors = ["Mathieu Duponchelle ", "Sebastian Dröge "] +build = "build.rs" +description = "FFI bindings to libgstrtp-1.0" +documentation = "https://slomo.pages.freedesktop.org/rustdocs/gstreamer-sys/gstreamer_rtp_sys/" +homepage = "https://gstreamer.freedesktop.org" +keywords = ["ffi", "gstreamer", "gnome", "multimedia"] +license = "MIT" +links = "gstrtp-1.0" +name = "gstreamer-rtp-sys" +readme = "README.md" +repository = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs-sys" +version = "0.9.0" + +["package.metadata.docs.rs"] +features = ["dox", "v1_16"] diff --git a/gstreamer-rtp-sys/README.md b/gstreamer-rtp-sys/README.md new file mode 100644 index 000000000..0f3273498 --- /dev/null +++ b/gstreamer-rtp-sys/README.md @@ -0,0 +1,33 @@ +# NOTE: The canonical repository for gstreamer-sys has moved to [freedesktop.org GitLab](https://gitlab.freedesktop.org/gstreamer/gstreamer-rs-sys)! + +# gstreamer-rtp-sys [![crates.io](https://img.shields.io/crates/v/gstreamer-rtp-sys.svg)](https://crates.io/crates/gstreamer-rtp-sys) [![pipeline status](https://gitlab.freedesktop.org/gstreamer/gstreamer-rs-sys/badges/master/pipeline.svg)](https://gitlab.freedesktop.org/gstreamer/gstreamer-rs-sys/commits/master) + +[GStreamer](https://gstreamer.freedesktop.org/) (RTP library) FFI bindings for Rust. + +These bindings are providing unsafe FFI API that can be used to interface with +GStreamer. Generally they are meant to be used as the building block for +higher-level abstractions like: + + * Bindings for GStreamer applications and plugins: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs + * Various GStreamer plugins written in Rust: https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs + +The bindings are autogenerated with [gir](https://github.com/gtk-rs/gir/) +based on the [GObject-Introspection](https://wiki.gnome.org/Projects/GObjectIntrospection/) +API metadata provided by the GStreamer project. + +## LICENSE + +gstreamer-sys and all crates contained here are licensed under the MIT +license ([LICENSE](LICENSE) or http://opensource.org/licenses/MIT). + +GStreamer itself is licensed under the Lesser General Public License version +2.1 or (at your option) any later version: +https://www.gnu.org/licenses/lgpl-2.1.html + +## Contribution + +Any kinds of contributions are welcome as a pull request. + +Unless you explicitly state otherwise, any contribution intentionally submitted +for inclusion in gstreamer-rs by you shall be licensed under the MIT license as above, +without any additional terms or conditions. diff --git a/gstreamer-rtp-sys/build.rs b/gstreamer-rtp-sys/build.rs new file mode 100644 index 000000000..4eeeb90d9 --- /dev/null +++ b/gstreamer-rtp-sys/build.rs @@ -0,0 +1,102 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir @ 8f15e55) +// from gir-files (https://github.com/gtk-rs/gir-files @ ???) +// DO NOT EDIT + +#[cfg(not(feature = "dox"))] +extern crate pkg_config; + +#[cfg(not(feature = "dox"))] +use pkg_config::{Config, Error}; +#[cfg(not(feature = "dox"))] +use std::env; +#[cfg(not(feature = "dox"))] +use std::io; +#[cfg(not(feature = "dox"))] +use std::io::prelude::*; +#[cfg(not(feature = "dox"))] +use std::process; + +#[cfg(feature = "dox")] +fn main() {} // prevent linking libraries to avoid documentation failure + +#[cfg(not(feature = "dox"))] +fn main() { + if let Err(s) = find() { + let _ = writeln!(io::stderr(), "{}", s); + process::exit(1); + } +} + +#[cfg(not(feature = "dox"))] +fn find() -> Result<(), Error> { + let package_name = "gstreamer-rtp-1.0"; + let shared_libs = ["gstrtp-1.0"]; + let version = if cfg!(feature = "v1_16") { + "1.16" + } else if cfg!(feature = "v1_14") { + "1.14" + } else if cfg!(feature = "v1_12") { + "1.12" + } else if cfg!(feature = "v1_10") { + "1.10" + } else if cfg!(feature = "v1_8") { + "1.8" + } else if cfg!(feature = "v1_6_1") { + "1.6.1" + } else if cfg!(feature = "v1_6") { + "1.6" + } else if cfg!(feature = "v1_4") { + "1.4" + } else if cfg!(feature = "v1_2") { + "1.2" + } else { + "1.0" + }; + + if let Ok(inc_dir) = env::var("GTK_INCLUDE_DIR") { + println!("cargo:include={}", inc_dir); + } + if let Ok(lib_dir) = env::var("GTK_LIB_DIR") { + for lib_ in shared_libs.iter() { + println!("cargo:rustc-link-lib=dylib={}", lib_); + } + println!("cargo:rustc-link-search=native={}", lib_dir); + return Ok(()); + } + + let target = env::var("TARGET").expect("TARGET environment variable doesn't exist"); + let hardcode_shared_libs = target.contains("windows"); + + let mut config = Config::new(); + config.atleast_version(version); + config.print_system_libs(false); + if hardcode_shared_libs { + config.cargo_metadata(false); + } + match config.probe(package_name) { + Ok(library) => { + if let Ok(paths) = std::env::join_paths(library.include_paths) { + println!("cargo:include={}", paths.to_string_lossy()); + } + if hardcode_shared_libs { + for lib_ in shared_libs.iter() { + println!("cargo:rustc-link-lib=dylib={}", lib_); + } + for path in library.link_paths.iter() { + println!( + "cargo:rustc-link-search=native={}", + path.to_str().expect("library path doesn't exist") + ); + } + } + Ok(()) + } + Err(Error::EnvNoPkgConfig(_)) | Err(Error::Command { .. }) => { + for lib_ in shared_libs.iter() { + println!("cargo:rustc-link-lib=dylib={}", lib_); + } + Ok(()) + } + Err(err) => Err(err), + } +} diff --git a/gstreamer-rtp-sys/src/lib.rs b/gstreamer-rtp-sys/src/lib.rs new file mode 100644 index 000000000..726b2b409 --- /dev/null +++ b/gstreamer-rtp-sys/src/lib.rs @@ -0,0 +1,1106 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir @ 8f15e55) +// from gir-files (https://github.com/gtk-rs/gir-files @ ???) +// DO NOT EDIT + +#![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)] +#![allow( + clippy::approx_constant, + clippy::type_complexity, + clippy::unreadable_literal +)] + +extern crate glib_sys as glib; +extern crate gobject_sys as gobject; +extern crate gstreamer_base_sys as gst_base; +extern crate gstreamer_sys as gst; +extern crate libc; + +#[allow(unused_imports)] +use libc::{ + c_char, c_double, c_float, c_int, c_long, c_short, c_uchar, c_uint, c_ulong, c_ushort, c_void, + intptr_t, size_t, ssize_t, time_t, uintptr_t, FILE, +}; + +#[allow(unused_imports)] +use glib::{gboolean, gconstpointer, gpointer, GType}; + +// Enums +pub type GstRTCPFBType = c_int; +pub const GST_RTCP_FB_TYPE_INVALID: GstRTCPFBType = 0; +pub const GST_RTCP_RTPFB_TYPE_NACK: GstRTCPFBType = 1; +pub const GST_RTCP_RTPFB_TYPE_TMMBR: GstRTCPFBType = 3; +pub const GST_RTCP_RTPFB_TYPE_TMMBN: GstRTCPFBType = 4; +pub const GST_RTCP_RTPFB_TYPE_RTCP_SR_REQ: GstRTCPFBType = 5; +pub const GST_RTCP_PSFB_TYPE_SLI: GstRTCPFBType = 2; +pub const GST_RTCP_PSFB_TYPE_AFB: GstRTCPFBType = 15; +pub const GST_RTCP_PSFB_TYPE_TSTN: GstRTCPFBType = 6; +pub const GST_RTCP_PSFB_TYPE_VBCN: GstRTCPFBType = 7; + +pub type GstRTCPSDESType = c_int; +pub const GST_RTCP_SDES_INVALID: GstRTCPSDESType = -1; +pub const GST_RTCP_SDES_END: GstRTCPSDESType = 0; +pub const GST_RTCP_SDES_CNAME: GstRTCPSDESType = 1; +pub const GST_RTCP_SDES_NAME: GstRTCPSDESType = 2; +pub const GST_RTCP_SDES_EMAIL: GstRTCPSDESType = 3; +pub const GST_RTCP_SDES_PHONE: GstRTCPSDESType = 4; +pub const GST_RTCP_SDES_LOC: GstRTCPSDESType = 5; +pub const GST_RTCP_SDES_TOOL: GstRTCPSDESType = 6; +pub const GST_RTCP_SDES_NOTE: GstRTCPSDESType = 7; +pub const GST_RTCP_SDES_PRIV: GstRTCPSDESType = 8; + +pub type GstRTCPType = c_int; +pub const GST_RTCP_TYPE_INVALID: GstRTCPType = 0; +pub const GST_RTCP_TYPE_SR: GstRTCPType = 200; +pub const GST_RTCP_TYPE_RR: GstRTCPType = 201; +pub const GST_RTCP_TYPE_SDES: GstRTCPType = 202; +pub const GST_RTCP_TYPE_BYE: GstRTCPType = 203; +pub const GST_RTCP_TYPE_APP: GstRTCPType = 204; +pub const GST_RTCP_TYPE_RTPFB: GstRTCPType = 205; +pub const GST_RTCP_TYPE_PSFB: GstRTCPType = 206; +pub const GST_RTCP_TYPE_XR: GstRTCPType = 207; + +pub type GstRTCPXRType = c_int; +pub const GST_RTCP_XR_TYPE_INVALID: GstRTCPXRType = -1; +pub const GST_RTCP_XR_TYPE_LRLE: GstRTCPXRType = 1; +pub const GST_RTCP_XR_TYPE_DRLE: GstRTCPXRType = 2; +pub const GST_RTCP_XR_TYPE_PRT: GstRTCPXRType = 3; +pub const GST_RTCP_XR_TYPE_RRT: GstRTCPXRType = 4; +pub const GST_RTCP_XR_TYPE_DLRR: GstRTCPXRType = 5; +pub const GST_RTCP_XR_TYPE_SSUMM: GstRTCPXRType = 6; +pub const GST_RTCP_XR_TYPE_VOIP_METRICS: GstRTCPXRType = 7; + +pub type GstRTPPayload = c_int; +pub const GST_RTP_PAYLOAD_PCMU: GstRTPPayload = 0; +pub const GST_RTP_PAYLOAD_1016: GstRTPPayload = 1; +pub const GST_RTP_PAYLOAD_G721: GstRTPPayload = 2; +pub const GST_RTP_PAYLOAD_GSM: GstRTPPayload = 3; +pub const GST_RTP_PAYLOAD_G723: GstRTPPayload = 4; +pub const GST_RTP_PAYLOAD_DVI4_8000: GstRTPPayload = 5; +pub const GST_RTP_PAYLOAD_DVI4_16000: GstRTPPayload = 6; +pub const GST_RTP_PAYLOAD_LPC: GstRTPPayload = 7; +pub const GST_RTP_PAYLOAD_PCMA: GstRTPPayload = 8; +pub const GST_RTP_PAYLOAD_G722: GstRTPPayload = 9; +pub const GST_RTP_PAYLOAD_L16_STEREO: GstRTPPayload = 10; +pub const GST_RTP_PAYLOAD_L16_MONO: GstRTPPayload = 11; +pub const GST_RTP_PAYLOAD_QCELP: GstRTPPayload = 12; +pub const GST_RTP_PAYLOAD_CN: GstRTPPayload = 13; +pub const GST_RTP_PAYLOAD_MPA: GstRTPPayload = 14; +pub const GST_RTP_PAYLOAD_G728: GstRTPPayload = 15; +pub const GST_RTP_PAYLOAD_DVI4_11025: GstRTPPayload = 16; +pub const GST_RTP_PAYLOAD_DVI4_22050: GstRTPPayload = 17; +pub const GST_RTP_PAYLOAD_G729: GstRTPPayload = 18; +pub const GST_RTP_PAYLOAD_CELLB: GstRTPPayload = 25; +pub const GST_RTP_PAYLOAD_JPEG: GstRTPPayload = 26; +pub const GST_RTP_PAYLOAD_NV: GstRTPPayload = 28; +pub const GST_RTP_PAYLOAD_H261: GstRTPPayload = 31; +pub const GST_RTP_PAYLOAD_MPV: GstRTPPayload = 32; +pub const GST_RTP_PAYLOAD_MP2T: GstRTPPayload = 33; +pub const GST_RTP_PAYLOAD_H263: GstRTPPayload = 34; + +pub type GstRTPProfile = c_int; +pub const GST_RTP_PROFILE_UNKNOWN: GstRTPProfile = 0; +pub const GST_RTP_PROFILE_AVP: GstRTPProfile = 1; +pub const GST_RTP_PROFILE_SAVP: GstRTPProfile = 2; +pub const GST_RTP_PROFILE_AVPF: GstRTPProfile = 3; +pub const GST_RTP_PROFILE_SAVPF: GstRTPProfile = 4; + +// Constants +pub const GST_RTCP_MAX_BYE_SSRC_COUNT: c_int = 31; +pub const GST_RTCP_MAX_RB_COUNT: c_int = 31; +pub const GST_RTCP_MAX_SDES: c_int = 255; +pub const GST_RTCP_MAX_SDES_ITEM_COUNT: c_int = 31; +pub const GST_RTCP_REDUCED_SIZE_VALID_MASK: c_int = 57592; +pub const GST_RTCP_VALID_MASK: c_int = 57598; +pub const GST_RTCP_VALID_VALUE: c_int = 200; +pub const GST_RTCP_VERSION: c_int = 2; +pub const GST_RTP_HDREXT_BASE: *const c_char = + b"urn:ietf:params:rtp-hdrext:\0" as *const u8 as *const c_char; +pub const GST_RTP_HDREXT_NTP_56: *const c_char = b"ntp-56\0" as *const u8 as *const c_char; +pub const GST_RTP_HDREXT_NTP_56_SIZE: c_int = 7; +pub const GST_RTP_HDREXT_NTP_64: *const c_char = b"ntp-64\0" as *const u8 as *const c_char; +pub const GST_RTP_HDREXT_NTP_64_SIZE: c_int = 8; +pub const GST_RTP_PAYLOAD_1016_STRING: *const c_char = b"1\0" as *const u8 as *const c_char; +pub const GST_RTP_PAYLOAD_CELLB_STRING: *const c_char = b"25\0" as *const u8 as *const c_char; +pub const GST_RTP_PAYLOAD_CN_STRING: *const c_char = b"13\0" as *const u8 as *const c_char; +pub const GST_RTP_PAYLOAD_DVI4_11025_STRING: *const c_char = b"16\0" as *const u8 as *const c_char; +pub const GST_RTP_PAYLOAD_DVI4_16000_STRING: *const c_char = b"6\0" as *const u8 as *const c_char; +pub const GST_RTP_PAYLOAD_DVI4_22050_STRING: *const c_char = b"17\0" as *const u8 as *const c_char; +pub const GST_RTP_PAYLOAD_DVI4_8000_STRING: *const c_char = b"5\0" as *const u8 as *const c_char; +pub const GST_RTP_PAYLOAD_DYNAMIC_STRING: *const c_char = + b"[96, 127]\0" as *const u8 as *const c_char; +pub const GST_RTP_PAYLOAD_G721_STRING: *const c_char = b"2\0" as *const u8 as *const c_char; +pub const GST_RTP_PAYLOAD_G722_STRING: *const c_char = b"9\0" as *const u8 as *const c_char; +pub const GST_RTP_PAYLOAD_G723_53: c_int = 17; +pub const GST_RTP_PAYLOAD_G723_53_STRING: *const c_char = b"17\0" as *const u8 as *const c_char; +pub const GST_RTP_PAYLOAD_G723_63: c_int = 16; +pub const GST_RTP_PAYLOAD_G723_63_STRING: *const c_char = b"16\0" as *const u8 as *const c_char; +pub const GST_RTP_PAYLOAD_G723_STRING: *const c_char = b"4\0" as *const u8 as *const c_char; +pub const GST_RTP_PAYLOAD_G728_STRING: *const c_char = b"15\0" as *const u8 as *const c_char; +pub const GST_RTP_PAYLOAD_G729_STRING: *const c_char = b"18\0" as *const u8 as *const c_char; +pub const GST_RTP_PAYLOAD_GSM_STRING: *const c_char = b"3\0" as *const u8 as *const c_char; +pub const GST_RTP_PAYLOAD_H261_STRING: *const c_char = b"31\0" as *const u8 as *const c_char; +pub const GST_RTP_PAYLOAD_H263_STRING: *const c_char = b"34\0" as *const u8 as *const c_char; +pub const GST_RTP_PAYLOAD_JPEG_STRING: *const c_char = b"26\0" as *const u8 as *const c_char; +pub const GST_RTP_PAYLOAD_L16_MONO_STRING: *const c_char = b"11\0" as *const u8 as *const c_char; +pub const GST_RTP_PAYLOAD_L16_STEREO_STRING: *const c_char = b"10\0" as *const u8 as *const c_char; +pub const GST_RTP_PAYLOAD_LPC_STRING: *const c_char = b"7\0" as *const u8 as *const c_char; +pub const GST_RTP_PAYLOAD_MP2T_STRING: *const c_char = b"33\0" as *const u8 as *const c_char; +pub const GST_RTP_PAYLOAD_MPA_STRING: *const c_char = b"14\0" as *const u8 as *const c_char; +pub const GST_RTP_PAYLOAD_MPV_STRING: *const c_char = b"32\0" as *const u8 as *const c_char; +pub const GST_RTP_PAYLOAD_NV_STRING: *const c_char = b"28\0" as *const u8 as *const c_char; +pub const GST_RTP_PAYLOAD_PCMA_STRING: *const c_char = b"8\0" as *const u8 as *const c_char; +pub const GST_RTP_PAYLOAD_PCMU_STRING: *const c_char = b"0\0" as *const u8 as *const c_char; +pub const GST_RTP_PAYLOAD_QCELP_STRING: *const c_char = b"12\0" as *const u8 as *const c_char; +pub const GST_RTP_PAYLOAD_TS41: c_int = 19; +pub const GST_RTP_PAYLOAD_TS41_STRING: *const c_char = b"19\0" as *const u8 as *const c_char; +pub const GST_RTP_PAYLOAD_TS48: c_int = 18; +pub const GST_RTP_PAYLOAD_TS48_STRING: *const c_char = b"18\0" as *const u8 as *const c_char; +pub const GST_RTP_SOURCE_META_MAX_CSRC_COUNT: c_int = 15; +pub const GST_RTP_VERSION: c_int = 2; + +// Flags +pub type GstRTPBufferFlags = c_uint; +pub const GST_RTP_BUFFER_FLAG_RETRANSMISSION: GstRTPBufferFlags = 1048576; +pub const GST_RTP_BUFFER_FLAG_REDUNDANT: GstRTPBufferFlags = 2097152; +pub const GST_RTP_BUFFER_FLAG_LAST: GstRTPBufferFlags = 268435456; + +pub type GstRTPBufferMapFlags = c_uint; +pub const GST_RTP_BUFFER_MAP_FLAG_SKIP_PADDING: GstRTPBufferMapFlags = 65536; +pub const GST_RTP_BUFFER_MAP_FLAG_LAST: GstRTPBufferMapFlags = 16777216; + +// Records +#[repr(C)] +#[derive(Copy, Clone)] +pub struct GstRTCPBuffer { + pub buffer: *mut gst::GstBuffer, + pub map: gst::GstMapInfo, +} + +impl ::std::fmt::Debug for GstRTCPBuffer { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("GstRTCPBuffer @ {:?}", self as *const _)) + .field("buffer", &self.buffer) + .field("map", &self.map) + .finish() + } +} + +#[repr(C)] +#[derive(Copy, Clone)] +pub struct GstRTCPPacket { + pub rtcp: *mut GstRTCPBuffer, + pub offset: c_uint, + pub padding: gboolean, + pub count: u8, + pub type_: GstRTCPType, + pub length: u16, + pub item_offset: c_uint, + pub item_count: c_uint, + pub entry_offset: c_uint, +} + +impl ::std::fmt::Debug for GstRTCPPacket { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("GstRTCPPacket @ {:?}", self as *const _)) + .field("rtcp", &self.rtcp) + .field("offset", &self.offset) + .finish() + } +} + +#[repr(C)] +#[derive(Copy, Clone)] +pub struct GstRTPBaseAudioPayloadClass { + pub parent_class: GstRTPBasePayloadClass, + pub _gst_reserved: [gpointer; 4], +} + +impl ::std::fmt::Debug for GstRTPBaseAudioPayloadClass { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!( + "GstRTPBaseAudioPayloadClass @ {:?}", + self as *const _ + )) + .field("parent_class", &self.parent_class) + .finish() + } +} + +#[repr(C)] +pub struct _GstRTPBaseAudioPayloadPrivate(c_void); + +pub type GstRTPBaseAudioPayloadPrivate = *mut _GstRTPBaseAudioPayloadPrivate; + +#[repr(C)] +#[derive(Copy, Clone)] +pub struct GstRTPBaseDepayloadClass { + pub parent_class: gst::GstElementClass, + pub set_caps: + Option gboolean>, + pub process: Option< + unsafe extern "C" fn(*mut GstRTPBaseDepayload, *mut gst::GstBuffer) -> *mut gst::GstBuffer, + >, + pub packet_lost: + Option gboolean>, + pub handle_event: + Option gboolean>, + pub process_rtp_packet: Option< + unsafe extern "C" fn(*mut GstRTPBaseDepayload, *mut GstRTPBuffer) -> *mut gst::GstBuffer, + >, + pub _gst_reserved: [gpointer; 3], +} + +impl ::std::fmt::Debug for GstRTPBaseDepayloadClass { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!( + "GstRTPBaseDepayloadClass @ {:?}", + self as *const _ + )) + .field("parent_class", &self.parent_class) + .field("set_caps", &self.set_caps) + .field("process", &self.process) + .field("packet_lost", &self.packet_lost) + .field("handle_event", &self.handle_event) + .field("process_rtp_packet", &self.process_rtp_packet) + .finish() + } +} + +#[repr(C)] +pub struct _GstRTPBaseDepayloadPrivate(c_void); + +pub type GstRTPBaseDepayloadPrivate = *mut _GstRTPBaseDepayloadPrivate; + +#[repr(C)] +#[derive(Copy, Clone)] +pub struct GstRTPBasePayloadClass { + pub parent_class: gst::GstElementClass, + pub get_caps: Option< + unsafe extern "C" fn( + *mut GstRTPBasePayload, + *mut gst::GstPad, + *mut gst::GstCaps, + ) -> *mut gst::GstCaps, + >, + pub set_caps: + Option gboolean>, + pub handle_buffer: Option< + unsafe extern "C" fn(*mut GstRTPBasePayload, *mut gst::GstBuffer) -> gst::GstFlowReturn, + >, + pub sink_event: + Option gboolean>, + pub src_event: + Option gboolean>, + pub query: Option< + unsafe extern "C" fn( + *mut GstRTPBasePayload, + *mut gst::GstPad, + *mut gst::GstQuery, + ) -> gboolean, + >, + pub _gst_reserved: [gpointer; 4], +} + +impl ::std::fmt::Debug for GstRTPBasePayloadClass { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("GstRTPBasePayloadClass @ {:?}", self as *const _)) + .field("parent_class", &self.parent_class) + .field("get_caps", &self.get_caps) + .field("set_caps", &self.set_caps) + .field("handle_buffer", &self.handle_buffer) + .field("sink_event", &self.sink_event) + .field("src_event", &self.src_event) + .field("query", &self.query) + .finish() + } +} + +#[repr(C)] +pub struct _GstRTPBasePayloadPrivate(c_void); + +pub type GstRTPBasePayloadPrivate = *mut _GstRTPBasePayloadPrivate; + +#[repr(C)] +#[derive(Copy, Clone)] +pub struct GstRTPBuffer { + pub buffer: *mut gst::GstBuffer, + pub state: c_uint, + pub data: [gpointer; 4], + pub size: [size_t; 4], + pub map: [gst::GstMapInfo; 4], +} + +impl ::std::fmt::Debug for GstRTPBuffer { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("GstRTPBuffer @ {:?}", self as *const _)) + .field("buffer", &self.buffer) + .field("state", &self.state) + .field("data", &self.data) + .field("size", &self.size) + .field("map", &self.map) + .finish() + } +} + +#[repr(C)] +#[derive(Copy, Clone)] +pub struct GstRTPPayloadInfo { + pub payload_type: u8, + pub media: *const c_char, + pub encoding_name: *const c_char, + pub clock_rate: c_uint, + pub encoding_parameters: *const c_char, + pub bitrate: c_uint, + pub _gst_reserved: [gpointer; 4], +} + +impl ::std::fmt::Debug for GstRTPPayloadInfo { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("GstRTPPayloadInfo @ {:?}", self as *const _)) + .field("payload_type", &self.payload_type) + .field("media", &self.media) + .field("encoding_name", &self.encoding_name) + .field("clock_rate", &self.clock_rate) + .field("encoding_parameters", &self.encoding_parameters) + .field("bitrate", &self.bitrate) + .finish() + } +} + +#[repr(C)] +#[derive(Copy, Clone)] +pub struct GstRTPSourceMeta { + pub meta: gst::GstMeta, + pub ssrc: u32, + pub ssrc_valid: gboolean, + pub csrc: [u32; 15], + pub csrc_count: c_uint, +} + +impl ::std::fmt::Debug for GstRTPSourceMeta { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("GstRTPSourceMeta @ {:?}", self as *const _)) + .field("meta", &self.meta) + .field("ssrc", &self.ssrc) + .field("ssrc_valid", &self.ssrc_valid) + .field("csrc", &self.csrc) + .field("csrc_count", &self.csrc_count) + .finish() + } +} + +// Classes +#[repr(C)] +#[derive(Copy, Clone)] +pub struct GstRTPBaseAudioPayload { + pub payload: GstRTPBasePayload, + pub priv_: *mut GstRTPBaseAudioPayloadPrivate, + pub base_ts: gst::GstClockTime, + pub frame_size: c_int, + pub frame_duration: c_int, + pub sample_size: c_int, + pub _gst_reserved: [gpointer; 4], +} + +impl ::std::fmt::Debug for GstRTPBaseAudioPayload { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("GstRTPBaseAudioPayload @ {:?}", self as *const _)) + .field("payload", &self.payload) + .field("priv_", &self.priv_) + .field("base_ts", &self.base_ts) + .field("frame_size", &self.frame_size) + .field("frame_duration", &self.frame_duration) + .field("sample_size", &self.sample_size) + .finish() + } +} + +#[repr(C)] +#[derive(Copy, Clone)] +pub struct GstRTPBaseDepayload { + pub parent: gst::GstElement, + pub sinkpad: *mut gst::GstPad, + pub srcpad: *mut gst::GstPad, + pub clock_rate: c_uint, + pub segment: gst::GstSegment, + pub need_newsegment: gboolean, + pub priv_: *mut GstRTPBaseDepayloadPrivate, + pub _gst_reserved: [gpointer; 4], +} + +impl ::std::fmt::Debug for GstRTPBaseDepayload { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("GstRTPBaseDepayload @ {:?}", self as *const _)) + .field("parent", &self.parent) + .field("sinkpad", &self.sinkpad) + .field("srcpad", &self.srcpad) + .field("clock_rate", &self.clock_rate) + .field("segment", &self.segment) + .field("need_newsegment", &self.need_newsegment) + .finish() + } +} + +#[repr(C)] +#[derive(Copy, Clone)] +pub struct GstRTPBasePayload { + pub element: gst::GstElement, + pub sinkpad: *mut gst::GstPad, + pub srcpad: *mut gst::GstPad, + pub ts_base: u32, + pub seqnum_base: u16, + pub media: *mut c_char, + pub encoding_name: *mut c_char, + pub dynamic: gboolean, + pub clock_rate: u32, + pub ts_offset: i32, + pub timestamp: u32, + pub seqnum_offset: i16, + pub seqnum: u16, + pub max_ptime: i64, + pub pt: c_uint, + pub ssrc: c_uint, + pub current_ssrc: c_uint, + pub mtu: c_uint, + pub segment: gst::GstSegment, + pub min_ptime: u64, + pub ptime: u64, + pub ptime_multiple: u64, + pub priv_: *mut GstRTPBasePayloadPrivate, + pub _gst_reserved: [gpointer; 4], +} + +impl ::std::fmt::Debug for GstRTPBasePayload { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("GstRTPBasePayload @ {:?}", self as *const _)) + .field("element", &self.element) + .finish() + } +} + +extern "C" { + + //========================================================================= + // GstRTCPFBType + //========================================================================= + pub fn gst_rtcpfb_type_get_type() -> GType; + + //========================================================================= + // GstRTCPSDESType + //========================================================================= + pub fn gst_rtcpsdes_type_get_type() -> GType; + + //========================================================================= + // GstRTCPType + //========================================================================= + pub fn gst_rtcp_type_get_type() -> GType; + + //========================================================================= + // GstRTCPXRType + //========================================================================= + pub fn gst_rtcpxr_type_get_type() -> GType; + + //========================================================================= + // GstRTPPayload + //========================================================================= + pub fn gst_rtp_payload_get_type() -> GType; + + //========================================================================= + // GstRTPProfile + //========================================================================= + pub fn gst_rtp_profile_get_type() -> GType; + + //========================================================================= + // GstRTPBufferFlags + //========================================================================= + pub fn gst_rtp_buffer_flags_get_type() -> GType; + + //========================================================================= + // GstRTPBufferMapFlags + //========================================================================= + pub fn gst_rtp_buffer_map_flags_get_type() -> GType; + + //========================================================================= + // GstRTCPBuffer + //========================================================================= + pub fn gst_rtcp_buffer_add_packet( + rtcp: *mut GstRTCPBuffer, + type_: GstRTCPType, + packet: *mut GstRTCPPacket, + ) -> gboolean; + pub fn gst_rtcp_buffer_get_first_packet( + rtcp: *mut GstRTCPBuffer, + packet: *mut GstRTCPPacket, + ) -> gboolean; + pub fn gst_rtcp_buffer_get_packet_count(rtcp: *mut GstRTCPBuffer) -> c_uint; + pub fn gst_rtcp_buffer_unmap(rtcp: *mut GstRTCPBuffer) -> gboolean; + pub fn gst_rtcp_buffer_map( + buffer: *mut gst::GstBuffer, + flags: gst::GstMapFlags, + rtcp: *mut GstRTCPBuffer, + ) -> gboolean; + pub fn gst_rtcp_buffer_new(mtu: c_uint) -> *mut gst::GstBuffer; + pub fn gst_rtcp_buffer_new_copy_data(data: gconstpointer, len: c_uint) -> *mut gst::GstBuffer; + pub fn gst_rtcp_buffer_new_take_data(data: gpointer, len: c_uint) -> *mut gst::GstBuffer; + pub fn gst_rtcp_buffer_validate(buffer: *mut gst::GstBuffer) -> gboolean; + pub fn gst_rtcp_buffer_validate_data(data: *mut u8, len: c_uint) -> gboolean; + #[cfg(any(feature = "v1_6", feature = "dox"))] + pub fn gst_rtcp_buffer_validate_data_reduced(data: *mut u8, len: c_uint) -> gboolean; + #[cfg(any(feature = "v1_6", feature = "dox"))] + pub fn gst_rtcp_buffer_validate_reduced(buffer: *mut gst::GstBuffer) -> gboolean; + + //========================================================================= + // GstRTCPPacket + //========================================================================= + pub fn gst_rtcp_packet_add_profile_specific_ext( + packet: *mut GstRTCPPacket, + data: *const u8, + len: c_uint, + ) -> gboolean; + pub fn gst_rtcp_packet_add_rb( + packet: *mut GstRTCPPacket, + ssrc: u32, + fractionlost: u8, + packetslost: i32, + exthighestseq: u32, + jitter: u32, + lsr: u32, + dlsr: u32, + ) -> gboolean; + #[cfg(any(feature = "v1_10", feature = "dox"))] + pub fn gst_rtcp_packet_app_get_data(packet: *mut GstRTCPPacket) -> *mut u8; + #[cfg(any(feature = "v1_10", feature = "dox"))] + pub fn gst_rtcp_packet_app_get_data_length(packet: *mut GstRTCPPacket) -> u16; + #[cfg(any(feature = "v1_10", feature = "dox"))] + pub fn gst_rtcp_packet_app_get_name(packet: *mut GstRTCPPacket) -> *const c_char; + #[cfg(any(feature = "v1_10", feature = "dox"))] + pub fn gst_rtcp_packet_app_get_ssrc(packet: *mut GstRTCPPacket) -> u32; + #[cfg(any(feature = "v1_10", feature = "dox"))] + pub fn gst_rtcp_packet_app_get_subtype(packet: *mut GstRTCPPacket) -> u8; + #[cfg(any(feature = "v1_10", feature = "dox"))] + pub fn gst_rtcp_packet_app_set_data_length( + packet: *mut GstRTCPPacket, + wordlen: u16, + ) -> gboolean; + #[cfg(any(feature = "v1_10", feature = "dox"))] + pub fn gst_rtcp_packet_app_set_name(packet: *mut GstRTCPPacket, name: *const c_char); + #[cfg(any(feature = "v1_10", feature = "dox"))] + pub fn gst_rtcp_packet_app_set_ssrc(packet: *mut GstRTCPPacket, ssrc: u32); + #[cfg(any(feature = "v1_10", feature = "dox"))] + pub fn gst_rtcp_packet_app_set_subtype(packet: *mut GstRTCPPacket, subtype: u8); + pub fn gst_rtcp_packet_bye_add_ssrc(packet: *mut GstRTCPPacket, ssrc: u32) -> gboolean; + pub fn gst_rtcp_packet_bye_add_ssrcs( + packet: *mut GstRTCPPacket, + ssrc: *mut u32, + len: c_uint, + ) -> gboolean; + pub fn gst_rtcp_packet_bye_get_nth_ssrc(packet: *mut GstRTCPPacket, nth: c_uint) -> u32; + pub fn gst_rtcp_packet_bye_get_reason(packet: *mut GstRTCPPacket) -> *mut c_char; + pub fn gst_rtcp_packet_bye_get_reason_len(packet: *mut GstRTCPPacket) -> u8; + pub fn gst_rtcp_packet_bye_get_ssrc_count(packet: *mut GstRTCPPacket) -> c_uint; + pub fn gst_rtcp_packet_bye_set_reason( + packet: *mut GstRTCPPacket, + reason: *const c_char, + ) -> gboolean; + pub fn gst_rtcp_packet_copy_profile_specific_ext( + packet: *mut GstRTCPPacket, + data: *mut *mut u8, + len: *mut c_uint, + ) -> gboolean; + pub fn gst_rtcp_packet_fb_get_fci(packet: *mut GstRTCPPacket) -> *mut u8; + pub fn gst_rtcp_packet_fb_get_fci_length(packet: *mut GstRTCPPacket) -> u16; + pub fn gst_rtcp_packet_fb_get_media_ssrc(packet: *mut GstRTCPPacket) -> u32; + pub fn gst_rtcp_packet_fb_get_sender_ssrc(packet: *mut GstRTCPPacket) -> u32; + pub fn gst_rtcp_packet_fb_get_type(packet: *mut GstRTCPPacket) -> GstRTCPFBType; + pub fn gst_rtcp_packet_fb_set_fci_length(packet: *mut GstRTCPPacket, wordlen: u16) -> gboolean; + pub fn gst_rtcp_packet_fb_set_media_ssrc(packet: *mut GstRTCPPacket, ssrc: u32); + pub fn gst_rtcp_packet_fb_set_sender_ssrc(packet: *mut GstRTCPPacket, ssrc: u32); + pub fn gst_rtcp_packet_fb_set_type(packet: *mut GstRTCPPacket, type_: GstRTCPFBType); + pub fn gst_rtcp_packet_get_count(packet: *mut GstRTCPPacket) -> u8; + pub fn gst_rtcp_packet_get_length(packet: *mut GstRTCPPacket) -> u16; + pub fn gst_rtcp_packet_get_padding(packet: *mut GstRTCPPacket) -> gboolean; + pub fn gst_rtcp_packet_get_profile_specific_ext( + packet: *mut GstRTCPPacket, + data: *mut *mut u8, + len: *mut c_uint, + ) -> gboolean; + pub fn gst_rtcp_packet_get_profile_specific_ext_length(packet: *mut GstRTCPPacket) -> u16; + pub fn gst_rtcp_packet_get_rb( + packet: *mut GstRTCPPacket, + nth: c_uint, + ssrc: *mut u32, + fractionlost: *mut u8, + packetslost: *mut i32, + exthighestseq: *mut u32, + jitter: *mut u32, + lsr: *mut u32, + dlsr: *mut u32, + ); + pub fn gst_rtcp_packet_get_rb_count(packet: *mut GstRTCPPacket) -> c_uint; + pub fn gst_rtcp_packet_get_type(packet: *mut GstRTCPPacket) -> GstRTCPType; + pub fn gst_rtcp_packet_move_to_next(packet: *mut GstRTCPPacket) -> gboolean; + pub fn gst_rtcp_packet_remove(packet: *mut GstRTCPPacket) -> gboolean; + pub fn gst_rtcp_packet_rr_get_ssrc(packet: *mut GstRTCPPacket) -> u32; + pub fn gst_rtcp_packet_rr_set_ssrc(packet: *mut GstRTCPPacket, ssrc: u32); + pub fn gst_rtcp_packet_sdes_add_entry( + packet: *mut GstRTCPPacket, + type_: GstRTCPSDESType, + len: u8, + data: *const u8, + ) -> gboolean; + pub fn gst_rtcp_packet_sdes_add_item(packet: *mut GstRTCPPacket, ssrc: u32) -> gboolean; + pub fn gst_rtcp_packet_sdes_copy_entry( + packet: *mut GstRTCPPacket, + type_: *mut GstRTCPSDESType, + len: *mut u8, + data: *mut *mut u8, + ) -> gboolean; + pub fn gst_rtcp_packet_sdes_first_entry(packet: *mut GstRTCPPacket) -> gboolean; + pub fn gst_rtcp_packet_sdes_first_item(packet: *mut GstRTCPPacket) -> gboolean; + pub fn gst_rtcp_packet_sdes_get_entry( + packet: *mut GstRTCPPacket, + type_: *mut GstRTCPSDESType, + len: *mut u8, + data: *mut *mut u8, + ) -> gboolean; + pub fn gst_rtcp_packet_sdes_get_item_count(packet: *mut GstRTCPPacket) -> c_uint; + pub fn gst_rtcp_packet_sdes_get_ssrc(packet: *mut GstRTCPPacket) -> u32; + pub fn gst_rtcp_packet_sdes_next_entry(packet: *mut GstRTCPPacket) -> gboolean; + pub fn gst_rtcp_packet_sdes_next_item(packet: *mut GstRTCPPacket) -> gboolean; + pub fn gst_rtcp_packet_set_rb( + packet: *mut GstRTCPPacket, + nth: c_uint, + ssrc: u32, + fractionlost: u8, + packetslost: i32, + exthighestseq: u32, + jitter: u32, + lsr: u32, + dlsr: u32, + ); + pub fn gst_rtcp_packet_sr_get_sender_info( + packet: *mut GstRTCPPacket, + ssrc: *mut u32, + ntptime: *mut u64, + rtptime: *mut u32, + packet_count: *mut u32, + octet_count: *mut u32, + ); + pub fn gst_rtcp_packet_sr_set_sender_info( + packet: *mut GstRTCPPacket, + ssrc: u32, + ntptime: u64, + rtptime: u32, + packet_count: u32, + octet_count: u32, + ); + #[cfg(any(feature = "v1_16", feature = "dox"))] + pub fn gst_rtcp_packet_xr_first_rb(packet: *mut GstRTCPPacket) -> gboolean; + #[cfg(any(feature = "v1_16", feature = "dox"))] + pub fn gst_rtcp_packet_xr_get_block_length(packet: *mut GstRTCPPacket) -> u16; + #[cfg(any(feature = "v1_16", feature = "dox"))] + pub fn gst_rtcp_packet_xr_get_block_type(packet: *mut GstRTCPPacket) -> GstRTCPXRType; + #[cfg(any(feature = "v1_16", feature = "dox"))] + pub fn gst_rtcp_packet_xr_get_dlrr_block( + packet: *mut GstRTCPPacket, + nth: c_uint, + ssrc: *mut u32, + last_rr: *mut u32, + delay: *mut u32, + ) -> gboolean; + #[cfg(any(feature = "v1_16", feature = "dox"))] + pub fn gst_rtcp_packet_xr_get_prt_by_seq( + packet: *mut GstRTCPPacket, + seq: u16, + receipt_time: *mut u32, + ) -> gboolean; + #[cfg(any(feature = "v1_16", feature = "dox"))] + pub fn gst_rtcp_packet_xr_get_prt_info( + packet: *mut GstRTCPPacket, + ssrc: *mut u32, + thinning: *mut u8, + begin_seq: *mut u16, + end_seq: *mut u16, + ) -> gboolean; + #[cfg(any(feature = "v1_16", feature = "dox"))] + pub fn gst_rtcp_packet_xr_get_rle_info( + packet: *mut GstRTCPPacket, + ssrc: *mut u32, + thinning: *mut u8, + begin_seq: *mut u16, + end_seq: *mut u16, + chunk_count: *mut u32, + ) -> gboolean; + #[cfg(any(feature = "v1_16", feature = "dox"))] + pub fn gst_rtcp_packet_xr_get_rle_nth_chunk( + packet: *mut GstRTCPPacket, + nth: c_uint, + chunk: *mut u16, + ) -> gboolean; + #[cfg(any(feature = "v1_16", feature = "dox"))] + pub fn gst_rtcp_packet_xr_get_rrt(packet: *mut GstRTCPPacket, timestamp: *mut u64) -> gboolean; + #[cfg(any(feature = "v1_16", feature = "dox"))] + pub fn gst_rtcp_packet_xr_get_ssrc(packet: *mut GstRTCPPacket) -> u32; + #[cfg(any(feature = "v1_16", feature = "dox"))] + pub fn gst_rtcp_packet_xr_get_summary_info( + packet: *mut GstRTCPPacket, + ssrc: *mut u32, + begin_seq: *mut u16, + end_seq: *mut u16, + ) -> gboolean; + #[cfg(any(feature = "v1_16", feature = "dox"))] + pub fn gst_rtcp_packet_xr_get_summary_jitter( + packet: *mut GstRTCPPacket, + min_jitter: *mut u32, + max_jitter: *mut u32, + mean_jitter: *mut u32, + dev_jitter: *mut u32, + ) -> gboolean; + #[cfg(any(feature = "v1_16", feature = "dox"))] + pub fn gst_rtcp_packet_xr_get_summary_pkt( + packet: *mut GstRTCPPacket, + lost_packets: *mut u32, + dup_packets: *mut u32, + ) -> gboolean; + #[cfg(any(feature = "v1_16", feature = "dox"))] + pub fn gst_rtcp_packet_xr_get_summary_ttl( + packet: *mut GstRTCPPacket, + is_ipv4: *mut gboolean, + min_ttl: *mut u8, + max_ttl: *mut u8, + mean_ttl: *mut u8, + dev_ttl: *mut u8, + ) -> gboolean; + #[cfg(any(feature = "v1_16", feature = "dox"))] + pub fn gst_rtcp_packet_xr_get_voip_burst_metrics( + packet: *mut GstRTCPPacket, + burst_density: *mut u8, + gap_density: *mut u8, + burst_duration: *mut u16, + gap_duration: *mut u16, + ) -> gboolean; + #[cfg(any(feature = "v1_16", feature = "dox"))] + pub fn gst_rtcp_packet_xr_get_voip_configuration_params( + packet: *mut GstRTCPPacket, + gmin: *mut u8, + rx_config: *mut u8, + ) -> gboolean; + #[cfg(any(feature = "v1_16", feature = "dox"))] + pub fn gst_rtcp_packet_xr_get_voip_delay_metrics( + packet: *mut GstRTCPPacket, + roundtrip_delay: *mut u16, + end_system_delay: *mut u16, + ) -> gboolean; + #[cfg(any(feature = "v1_16", feature = "dox"))] + pub fn gst_rtcp_packet_xr_get_voip_jitter_buffer_params( + packet: *mut GstRTCPPacket, + jb_nominal: *mut u16, + jb_maximum: *mut u16, + jb_abs_max: *mut u16, + ) -> gboolean; + #[cfg(any(feature = "v1_16", feature = "dox"))] + pub fn gst_rtcp_packet_xr_get_voip_metrics_ssrc( + packet: *mut GstRTCPPacket, + ssrc: *mut u32, + ) -> gboolean; + #[cfg(any(feature = "v1_16", feature = "dox"))] + pub fn gst_rtcp_packet_xr_get_voip_packet_metrics( + packet: *mut GstRTCPPacket, + loss_rate: *mut u8, + discard_rate: *mut u8, + ) -> gboolean; + #[cfg(any(feature = "v1_16", feature = "dox"))] + pub fn gst_rtcp_packet_xr_get_voip_quality_metrics( + packet: *mut GstRTCPPacket, + r_factor: *mut u8, + ext_r_factor: *mut u8, + mos_lq: *mut u8, + mos_cq: *mut u8, + ) -> gboolean; + #[cfg(any(feature = "v1_16", feature = "dox"))] + pub fn gst_rtcp_packet_xr_get_voip_signal_metrics( + packet: *mut GstRTCPPacket, + signal_level: *mut u8, + noise_level: *mut u8, + rerl: *mut u8, + gmin: *mut u8, + ) -> gboolean; + #[cfg(any(feature = "v1_16", feature = "dox"))] + pub fn gst_rtcp_packet_xr_next_rb(packet: *mut GstRTCPPacket) -> gboolean; + + //========================================================================= + // GstRTPBuffer + //========================================================================= + pub fn gst_rtp_buffer_add_extension_onebyte_header( + rtp: *mut GstRTPBuffer, + id: u8, + data: gconstpointer, + size: c_uint, + ) -> gboolean; + pub fn gst_rtp_buffer_add_extension_twobytes_header( + rtp: *mut GstRTPBuffer, + appbits: u8, + id: u8, + data: gconstpointer, + size: c_uint, + ) -> gboolean; + pub fn gst_rtp_buffer_get_csrc(rtp: *mut GstRTPBuffer, idx: u8) -> u32; + pub fn gst_rtp_buffer_get_csrc_count(rtp: *mut GstRTPBuffer) -> u8; + pub fn gst_rtp_buffer_get_extension(rtp: *mut GstRTPBuffer) -> gboolean; + #[cfg(any(feature = "v1_2", feature = "dox"))] + pub fn gst_rtp_buffer_get_extension_bytes( + rtp: *mut GstRTPBuffer, + bits: *mut u16, + ) -> *mut glib::GBytes; + pub fn gst_rtp_buffer_get_extension_data( + rtp: *mut GstRTPBuffer, + bits: *mut u16, + data: *mut u8, + wordlen: *mut c_uint, + ) -> gboolean; + pub fn gst_rtp_buffer_get_extension_onebyte_header( + rtp: *mut GstRTPBuffer, + id: u8, + nth: c_uint, + data: *mut u8, + size: *mut c_uint, + ) -> gboolean; + pub fn gst_rtp_buffer_get_extension_twobytes_header( + rtp: *mut GstRTPBuffer, + appbits: *mut u8, + id: u8, + nth: c_uint, + data: *mut u8, + size: *mut c_uint, + ) -> gboolean; + pub fn gst_rtp_buffer_get_header_len(rtp: *mut GstRTPBuffer) -> c_uint; + pub fn gst_rtp_buffer_get_marker(rtp: *mut GstRTPBuffer) -> gboolean; + pub fn gst_rtp_buffer_get_packet_len(rtp: *mut GstRTPBuffer) -> c_uint; + pub fn gst_rtp_buffer_get_padding(rtp: *mut GstRTPBuffer) -> gboolean; + pub fn gst_rtp_buffer_get_payload(rtp: *mut GstRTPBuffer) -> gpointer; + pub fn gst_rtp_buffer_get_payload_buffer(rtp: *mut GstRTPBuffer) -> *mut gst::GstBuffer; + #[cfg(any(feature = "v1_2", feature = "dox"))] + pub fn gst_rtp_buffer_get_payload_bytes(rtp: *mut GstRTPBuffer) -> *mut glib::GBytes; + pub fn gst_rtp_buffer_get_payload_len(rtp: *mut GstRTPBuffer) -> c_uint; + pub fn gst_rtp_buffer_get_payload_subbuffer( + rtp: *mut GstRTPBuffer, + offset: c_uint, + len: c_uint, + ) -> *mut gst::GstBuffer; + pub fn gst_rtp_buffer_get_payload_type(rtp: *mut GstRTPBuffer) -> u8; + pub fn gst_rtp_buffer_get_seq(rtp: *mut GstRTPBuffer) -> u16; + pub fn gst_rtp_buffer_get_ssrc(rtp: *mut GstRTPBuffer) -> u32; + pub fn gst_rtp_buffer_get_timestamp(rtp: *mut GstRTPBuffer) -> u32; + pub fn gst_rtp_buffer_get_version(rtp: *mut GstRTPBuffer) -> u8; + pub fn gst_rtp_buffer_pad_to(rtp: *mut GstRTPBuffer, len: c_uint); + pub fn gst_rtp_buffer_set_csrc(rtp: *mut GstRTPBuffer, idx: u8, csrc: u32); + pub fn gst_rtp_buffer_set_extension(rtp: *mut GstRTPBuffer, extension: gboolean); + pub fn gst_rtp_buffer_set_extension_data( + rtp: *mut GstRTPBuffer, + bits: u16, + length: u16, + ) -> gboolean; + pub fn gst_rtp_buffer_set_marker(rtp: *mut GstRTPBuffer, marker: gboolean); + pub fn gst_rtp_buffer_set_packet_len(rtp: *mut GstRTPBuffer, len: c_uint); + pub fn gst_rtp_buffer_set_padding(rtp: *mut GstRTPBuffer, padding: gboolean); + pub fn gst_rtp_buffer_set_payload_type(rtp: *mut GstRTPBuffer, payload_type: u8); + pub fn gst_rtp_buffer_set_seq(rtp: *mut GstRTPBuffer, seq: u16); + pub fn gst_rtp_buffer_set_ssrc(rtp: *mut GstRTPBuffer, ssrc: u32); + pub fn gst_rtp_buffer_set_timestamp(rtp: *mut GstRTPBuffer, timestamp: u32); + pub fn gst_rtp_buffer_set_version(rtp: *mut GstRTPBuffer, version: u8); + pub fn gst_rtp_buffer_unmap(rtp: *mut GstRTPBuffer); + pub fn gst_rtp_buffer_allocate_data( + buffer: *mut gst::GstBuffer, + payload_len: c_uint, + pad_len: u8, + csrc_count: u8, + ); + pub fn gst_rtp_buffer_calc_header_len(csrc_count: u8) -> c_uint; + pub fn gst_rtp_buffer_calc_packet_len( + payload_len: c_uint, + pad_len: u8, + csrc_count: u8, + ) -> c_uint; + pub fn gst_rtp_buffer_calc_payload_len( + packet_len: c_uint, + pad_len: u8, + csrc_count: u8, + ) -> c_uint; + pub fn gst_rtp_buffer_compare_seqnum(seqnum1: u16, seqnum2: u16) -> c_int; + pub fn gst_rtp_buffer_default_clock_rate(payload_type: u8) -> u32; + pub fn gst_rtp_buffer_ext_timestamp(exttimestamp: *mut u64, timestamp: u32) -> u64; + pub fn gst_rtp_buffer_map( + buffer: *mut gst::GstBuffer, + flags: gst::GstMapFlags, + rtp: *mut GstRTPBuffer, + ) -> gboolean; + pub fn gst_rtp_buffer_new_allocate( + payload_len: c_uint, + pad_len: u8, + csrc_count: u8, + ) -> *mut gst::GstBuffer; + pub fn gst_rtp_buffer_new_allocate_len( + packet_len: c_uint, + pad_len: u8, + csrc_count: u8, + ) -> *mut gst::GstBuffer; + pub fn gst_rtp_buffer_new_copy_data(data: gconstpointer, len: size_t) -> *mut gst::GstBuffer; + pub fn gst_rtp_buffer_new_take_data(data: gpointer, len: size_t) -> *mut gst::GstBuffer; + + //========================================================================= + // GstRTPPayloadInfo + //========================================================================= + pub fn gst_rtp_payload_info_for_name( + media: *const c_char, + encoding_name: *const c_char, + ) -> *const GstRTPPayloadInfo; + pub fn gst_rtp_payload_info_for_pt(payload_type: u8) -> *const GstRTPPayloadInfo; + + //========================================================================= + // GstRTPSourceMeta + //========================================================================= + #[cfg(any(feature = "v1_16", feature = "dox"))] + pub fn gst_rtp_source_meta_append_csrc( + meta: *mut GstRTPSourceMeta, + csrc: *const u32, + csrc_count: c_uint, + ) -> gboolean; + #[cfg(any(feature = "v1_16", feature = "dox"))] + pub fn gst_rtp_source_meta_get_source_count(meta: *const GstRTPSourceMeta) -> c_uint; + #[cfg(any(feature = "v1_16", feature = "dox"))] + pub fn gst_rtp_source_meta_set_ssrc(meta: *mut GstRTPSourceMeta, ssrc: *mut u32) -> gboolean; + pub fn gst_rtp_source_meta_get_info() -> *const gst::GstMetaInfo; + + //========================================================================= + // GstRTPBaseAudioPayload + //========================================================================= + pub fn gst_rtp_base_audio_payload_get_type() -> GType; + pub fn gst_rtp_base_audio_payload_flush( + baseaudiopayload: *mut GstRTPBaseAudioPayload, + payload_len: c_uint, + timestamp: gst::GstClockTime, + ) -> gst::GstFlowReturn; + pub fn gst_rtp_base_audio_payload_get_adapter( + rtpbaseaudiopayload: *mut GstRTPBaseAudioPayload, + ) -> *mut gst_base::GstAdapter; + pub fn gst_rtp_base_audio_payload_push( + baseaudiopayload: *mut GstRTPBaseAudioPayload, + data: *const u8, + payload_len: c_uint, + timestamp: gst::GstClockTime, + ) -> gst::GstFlowReturn; + pub fn gst_rtp_base_audio_payload_set_frame_based( + rtpbaseaudiopayload: *mut GstRTPBaseAudioPayload, + ); + pub fn gst_rtp_base_audio_payload_set_frame_options( + rtpbaseaudiopayload: *mut GstRTPBaseAudioPayload, + frame_duration: c_int, + frame_size: c_int, + ); + pub fn gst_rtp_base_audio_payload_set_sample_based( + rtpbaseaudiopayload: *mut GstRTPBaseAudioPayload, + ); + pub fn gst_rtp_base_audio_payload_set_sample_options( + rtpbaseaudiopayload: *mut GstRTPBaseAudioPayload, + sample_size: c_int, + ); + pub fn gst_rtp_base_audio_payload_set_samplebits_options( + rtpbaseaudiopayload: *mut GstRTPBaseAudioPayload, + sample_size: c_int, + ); + + //========================================================================= + // GstRTPBaseDepayload + //========================================================================= + pub fn gst_rtp_base_depayload_get_type() -> GType; + #[cfg(any(feature = "v1_16", feature = "dox"))] + pub fn gst_rtp_base_depayload_is_source_info_enabled( + depayload: *mut GstRTPBaseDepayload, + ) -> gboolean; + pub fn gst_rtp_base_depayload_push( + filter: *mut GstRTPBaseDepayload, + out_buf: *mut gst::GstBuffer, + ) -> gst::GstFlowReturn; + pub fn gst_rtp_base_depayload_push_list( + filter: *mut GstRTPBaseDepayload, + out_list: *mut gst::GstBufferList, + ) -> gst::GstFlowReturn; + #[cfg(any(feature = "v1_16", feature = "dox"))] + pub fn gst_rtp_base_depayload_set_source_info_enabled( + depayload: *mut GstRTPBaseDepayload, + enable: gboolean, + ); + + //========================================================================= + // GstRTPBasePayload + //========================================================================= + pub fn gst_rtp_base_payload_get_type() -> GType; + #[cfg(any(feature = "v1_16", feature = "dox"))] + pub fn gst_rtp_base_payload_allocate_output_buffer( + payload: *mut GstRTPBasePayload, + payload_len: c_uint, + pad_len: u8, + csrc_count: u8, + ) -> *mut gst::GstBuffer; + #[cfg(any(feature = "v1_16", feature = "dox"))] + pub fn gst_rtp_base_payload_get_source_count( + payload: *mut GstRTPBasePayload, + buffer: *mut gst::GstBuffer, + ) -> c_uint; + pub fn gst_rtp_base_payload_is_filled( + payload: *mut GstRTPBasePayload, + size: c_uint, + duration: gst::GstClockTime, + ) -> gboolean; + #[cfg(any(feature = "v1_16", feature = "dox"))] + pub fn gst_rtp_base_payload_is_source_info_enabled(payload: *mut GstRTPBasePayload) + -> gboolean; + pub fn gst_rtp_base_payload_push( + payload: *mut GstRTPBasePayload, + buffer: *mut gst::GstBuffer, + ) -> gst::GstFlowReturn; + pub fn gst_rtp_base_payload_push_list( + payload: *mut GstRTPBasePayload, + list: *mut gst::GstBufferList, + ) -> gst::GstFlowReturn; + pub fn gst_rtp_base_payload_set_options( + payload: *mut GstRTPBasePayload, + media: *const c_char, + dynamic: gboolean, + encoding_name: *const c_char, + clock_rate: u32, + ); + pub fn gst_rtp_base_payload_set_outcaps( + payload: *mut GstRTPBasePayload, + fieldname: *const c_char, + ... + ) -> gboolean; + #[cfg(any(feature = "v1_16", feature = "dox"))] + pub fn gst_rtp_base_payload_set_source_info_enabled( + payload: *mut GstRTPBasePayload, + enable: gboolean, + ); + + //========================================================================= + // Other functions + //========================================================================= + #[cfg(any(feature = "v1_16", feature = "dox"))] + pub fn gst_buffer_add_rtp_source_meta( + buffer: *mut gst::GstBuffer, + ssrc: *const u32, + csrc: *const u32, + csrc_count: c_uint, + ) -> *mut GstRTPSourceMeta; + #[cfg(any(feature = "v1_16", feature = "dox"))] + pub fn gst_buffer_get_rtp_source_meta(buffer: *mut gst::GstBuffer) -> *mut GstRTPSourceMeta; + pub fn gst_rtcp_ntp_to_unix(ntptime: u64) -> u64; + pub fn gst_rtcp_sdes_name_to_type(name: *const c_char) -> GstRTCPSDESType; + pub fn gst_rtcp_sdes_type_to_name(type_: GstRTCPSDESType) -> *const c_char; + pub fn gst_rtcp_unix_to_ntp(unixtime: u64) -> u64; + pub fn gst_rtp_hdrext_get_ntp_56(data: gpointer, size: c_uint, ntptime: *mut u64) -> gboolean; + pub fn gst_rtp_hdrext_get_ntp_64(data: gpointer, size: c_uint, ntptime: *mut u64) -> gboolean; + pub fn gst_rtp_hdrext_set_ntp_56(data: gpointer, size: c_uint, ntptime: u64) -> gboolean; + pub fn gst_rtp_hdrext_set_ntp_64(data: gpointer, size: c_uint, ntptime: u64) -> gboolean; + pub fn gst_rtp_source_meta_api_get_type() -> GType; + +} diff --git a/gstreamer-rtp-sys/tests/abi.rs b/gstreamer-rtp-sys/tests/abi.rs new file mode 100644 index 000000000..89d3fbc82 --- /dev/null +++ b/gstreamer-rtp-sys/tests/abi.rs @@ -0,0 +1,510 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir @ 8f15e55) +// from gir-files (https://github.com/gtk-rs/gir-files @ ???) +// DO NOT EDIT + +extern crate gstreamer_rtp_sys; +extern crate shell_words; +extern crate tempdir; +use gstreamer_rtp_sys::*; +use std::env; +use std::error::Error; +use std::mem::{align_of, size_of}; +use std::path::Path; +use std::process::Command; +use std::str; + +static PACKAGES: &[&str] = &["gstreamer-rtp-1.0"]; + +#[derive(Clone, Debug)] +struct Compiler { + pub args: Vec, +} + +impl Compiler { + pub fn new() -> Result> { + let mut args = get_var("CC", "cc")?; + args.push("-Wno-deprecated-declarations".to_owned()); + // For %z support in printf when using MinGW. + args.push("-D__USE_MINGW_ANSI_STDIO".to_owned()); + args.extend(get_var("CFLAGS", "")?); + args.extend(get_var("CPPFLAGS", "")?); + args.extend(pkg_config_cflags(PACKAGES)?); + Ok(Compiler { args }) + } + + pub fn define<'a, V: Into>>(&mut self, var: &str, val: V) { + let arg = match val.into() { + None => format!("-D{}", var), + Some(val) => format!("-D{}={}", var, val), + }; + self.args.push(arg); + } + + pub fn compile(&self, src: &Path, out: &Path) -> Result<(), Box> { + let mut cmd = self.to_command(); + cmd.arg(src); + cmd.arg("-o"); + cmd.arg(out); + let status = cmd.spawn()?.wait()?; + if !status.success() { + return Err(format!("compilation command {:?} failed, {}", &cmd, status).into()); + } + Ok(()) + } + + fn to_command(&self) -> Command { + let mut cmd = Command::new(&self.args[0]); + cmd.args(&self.args[1..]); + cmd + } +} + +fn get_var(name: &str, default: &str) -> Result, Box> { + match env::var(name) { + Ok(value) => Ok(shell_words::split(&value)?), + Err(env::VarError::NotPresent) => Ok(shell_words::split(default)?), + Err(err) => Err(format!("{} {}", name, err).into()), + } +} + +fn pkg_config_cflags(packages: &[&str]) -> Result, Box> { + if packages.is_empty() { + return Ok(Vec::new()); + } + let mut cmd = Command::new("pkg-config"); + cmd.arg("--cflags"); + cmd.args(packages); + let out = cmd.output()?; + if !out.status.success() { + return Err(format!("command {:?} returned {}", &cmd, out.status).into()); + } + let stdout = str::from_utf8(&out.stdout)?; + Ok(shell_words::split(stdout.trim())?) +} + +#[derive(Copy, Clone, Debug, Eq, PartialEq)] +struct Layout { + size: usize, + alignment: usize, +} + +#[derive(Copy, Clone, Debug, Default, Eq, PartialEq)] +struct Results { + /// Number of successfully completed tests. + passed: usize, + /// Total number of failed tests (including those that failed to compile). + failed: usize, + /// Number of tests that failed to compile. + failed_to_compile: usize, +} + +impl Results { + fn record_passed(&mut self) { + self.passed += 1; + } + fn record_failed(&mut self) { + self.failed += 1; + } + fn record_failed_to_compile(&mut self) { + self.failed += 1; + self.failed_to_compile += 1; + } + fn summary(&self) -> String { + format!( + "{} passed; {} failed (compilation errors: {})", + self.passed, self.failed, self.failed_to_compile + ) + } + fn expect_total_success(&self) { + if self.failed == 0 { + println!("OK: {}", self.summary()); + } else { + panic!("FAILED: {}", self.summary()); + }; + } +} + +#[test] +fn cross_validate_constants_with_c() { + let tmpdir = tempdir::TempDir::new("abi").expect("temporary directory"); + let cc = Compiler::new().expect("configured compiler"); + + assert_eq!( + "1", + get_c_value(tmpdir.path(), &cc, "1").expect("C constant"), + "failed to obtain correct constant value for 1" + ); + + let mut results: Results = Default::default(); + for (i, &(name, rust_value)) in RUST_CONSTANTS.iter().enumerate() { + match get_c_value(tmpdir.path(), &cc, name) { + Err(e) => { + results.record_failed_to_compile(); + eprintln!("{}", e); + } + Ok(ref c_value) => { + if rust_value == c_value { + results.record_passed(); + } else { + results.record_failed(); + eprintln!( + "Constant value mismatch for {}\nRust: {:?}\nC: {:?}", + name, rust_value, c_value + ); + } + } + }; + if (i + 1) % 25 == 0 { + println!("constants ... {}", results.summary()); + } + } + results.expect_total_success(); +} + +#[test] +fn cross_validate_layout_with_c() { + let tmpdir = tempdir::TempDir::new("abi").expect("temporary directory"); + let cc = Compiler::new().expect("configured compiler"); + + assert_eq!( + Layout { + size: 1, + alignment: 1 + }, + get_c_layout(tmpdir.path(), &cc, "char").expect("C layout"), + "failed to obtain correct layout for char type" + ); + + let mut results: Results = Default::default(); + for (i, &(name, rust_layout)) in RUST_LAYOUTS.iter().enumerate() { + match get_c_layout(tmpdir.path(), &cc, name) { + Err(e) => { + results.record_failed_to_compile(); + eprintln!("{}", e); + } + Ok(c_layout) => { + if rust_layout == c_layout { + results.record_passed(); + } else { + results.record_failed(); + eprintln!( + "Layout mismatch for {}\nRust: {:?}\nC: {:?}", + name, rust_layout, &c_layout + ); + } + } + }; + if (i + 1) % 25 == 0 { + println!("layout ... {}", results.summary()); + } + } + results.expect_total_success(); +} + +fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result> { + let exe = dir.join("layout"); + let mut cc = cc.clone(); + cc.define("ABI_TYPE_NAME", name); + cc.compile(Path::new("tests/layout.c"), &exe)?; + + let mut abi_cmd = Command::new(exe); + let output = abi_cmd.output()?; + if !output.status.success() { + return Err(format!("command {:?} failed, {:?}", &abi_cmd, &output).into()); + } + + let stdout = str::from_utf8(&output.stdout)?; + let mut words = stdout.trim().split_whitespace(); + let size = words.next().unwrap().parse().unwrap(); + let alignment = words.next().unwrap().parse().unwrap(); + Ok(Layout { size, alignment }) +} + +fn get_c_value(dir: &Path, cc: &Compiler, name: &str) -> Result> { + let exe = dir.join("constant"); + let mut cc = cc.clone(); + cc.define("ABI_CONSTANT_NAME", name); + cc.compile(Path::new("tests/constant.c"), &exe)?; + + let mut abi_cmd = Command::new(exe); + let output = abi_cmd.output()?; + if !output.status.success() { + return Err(format!("command {:?} failed, {:?}", &abi_cmd, &output).into()); + } + + let output = str::from_utf8(&output.stdout)?.trim(); + if !output.starts_with("###gir test###") || !output.ends_with("###gir test###") { + return Err(format!( + "command {:?} return invalid output, {:?}", + &abi_cmd, &output + ) + .into()); + } + + Ok(String::from(&output[14..(output.len() - 14)])) +} + +const RUST_LAYOUTS: &[(&str, Layout)] = &[ + ( + "GstRTCPBuffer", + Layout { + size: size_of::(), + alignment: align_of::(), + }, + ), + ( + "GstRTCPFBType", + Layout { + size: size_of::(), + alignment: align_of::(), + }, + ), + ( + "GstRTCPPacket", + Layout { + size: size_of::(), + alignment: align_of::(), + }, + ), + ( + "GstRTCPSDESType", + Layout { + size: size_of::(), + alignment: align_of::(), + }, + ), + ( + "GstRTCPType", + Layout { + size: size_of::(), + alignment: align_of::(), + }, + ), + ( + "GstRTCPXRType", + Layout { + size: size_of::(), + alignment: align_of::(), + }, + ), + ( + "GstRTPBaseAudioPayload", + Layout { + size: size_of::(), + alignment: align_of::(), + }, + ), + ( + "GstRTPBaseAudioPayloadClass", + Layout { + size: size_of::(), + alignment: align_of::(), + }, + ), + ( + "GstRTPBaseDepayload", + Layout { + size: size_of::(), + alignment: align_of::(), + }, + ), + ( + "GstRTPBaseDepayloadClass", + Layout { + size: size_of::(), + alignment: align_of::(), + }, + ), + ( + "GstRTPBasePayload", + Layout { + size: size_of::(), + alignment: align_of::(), + }, + ), + ( + "GstRTPBasePayloadClass", + Layout { + size: size_of::(), + alignment: align_of::(), + }, + ), + ( + "GstRTPBuffer", + Layout { + size: size_of::(), + alignment: align_of::(), + }, + ), + ( + "GstRTPBufferFlags", + Layout { + size: size_of::(), + alignment: align_of::(), + }, + ), + ( + "GstRTPBufferMapFlags", + Layout { + size: size_of::(), + alignment: align_of::(), + }, + ), + ( + "GstRTPPayload", + Layout { + size: size_of::(), + alignment: align_of::(), + }, + ), + ( + "GstRTPPayloadInfo", + Layout { + size: size_of::(), + alignment: align_of::(), + }, + ), + ( + "GstRTPProfile", + Layout { + size: size_of::(), + alignment: align_of::(), + }, + ), + ( + "GstRTPSourceMeta", + Layout { + size: size_of::(), + alignment: align_of::(), + }, + ), +]; + +const RUST_CONSTANTS: &[(&str, &str)] = &[ + ("(gint) GST_RTCP_FB_TYPE_INVALID", "0"), + ("GST_RTCP_MAX_BYE_SSRC_COUNT", "31"), + ("GST_RTCP_MAX_RB_COUNT", "31"), + ("GST_RTCP_MAX_SDES", "255"), + ("GST_RTCP_MAX_SDES_ITEM_COUNT", "31"), + ("(gint) GST_RTCP_PSFB_TYPE_AFB", "15"), + ("(gint) GST_RTCP_PSFB_TYPE_FIR", "4"), + ("(gint) GST_RTCP_PSFB_TYPE_PLI", "1"), + ("(gint) GST_RTCP_PSFB_TYPE_RPSI", "3"), + ("(gint) GST_RTCP_PSFB_TYPE_SLI", "2"), + ("(gint) GST_RTCP_PSFB_TYPE_TSTN", "6"), + ("(gint) GST_RTCP_PSFB_TYPE_TSTR", "5"), + ("(gint) GST_RTCP_PSFB_TYPE_VBCN", "7"), + ("GST_RTCP_REDUCED_SIZE_VALID_MASK", "57592"), + ("(gint) GST_RTCP_RTPFB_TYPE_NACK", "1"), + ("(gint) GST_RTCP_RTPFB_TYPE_RTCP_SR_REQ", "5"), + ("(gint) GST_RTCP_RTPFB_TYPE_TMMBN", "4"), + ("(gint) GST_RTCP_RTPFB_TYPE_TMMBR", "3"), + ("(gint) GST_RTCP_SDES_CNAME", "1"), + ("(gint) GST_RTCP_SDES_EMAIL", "3"), + ("(gint) GST_RTCP_SDES_END", "0"), + ("(gint) GST_RTCP_SDES_INVALID", "-1"), + ("(gint) GST_RTCP_SDES_LOC", "5"), + ("(gint) GST_RTCP_SDES_NAME", "2"), + ("(gint) GST_RTCP_SDES_NOTE", "7"), + ("(gint) GST_RTCP_SDES_PHONE", "4"), + ("(gint) GST_RTCP_SDES_PRIV", "8"), + ("(gint) GST_RTCP_SDES_TOOL", "6"), + ("(gint) GST_RTCP_TYPE_APP", "204"), + ("(gint) GST_RTCP_TYPE_BYE", "203"), + ("(gint) GST_RTCP_TYPE_INVALID", "0"), + ("(gint) GST_RTCP_TYPE_PSFB", "206"), + ("(gint) GST_RTCP_TYPE_RR", "201"), + ("(gint) GST_RTCP_TYPE_RTPFB", "205"), + ("(gint) GST_RTCP_TYPE_SDES", "202"), + ("(gint) GST_RTCP_TYPE_SR", "200"), + ("(gint) GST_RTCP_TYPE_XR", "207"), + ("GST_RTCP_VALID_MASK", "57598"), + ("GST_RTCP_VALID_VALUE", "200"), + ("GST_RTCP_VERSION", "2"), + ("(gint) GST_RTCP_XR_TYPE_DLRR", "5"), + ("(gint) GST_RTCP_XR_TYPE_DRLE", "2"), + ("(gint) GST_RTCP_XR_TYPE_INVALID", "-1"), + ("(gint) GST_RTCP_XR_TYPE_LRLE", "1"), + ("(gint) GST_RTCP_XR_TYPE_PRT", "3"), + ("(gint) GST_RTCP_XR_TYPE_RRT", "4"), + ("(gint) GST_RTCP_XR_TYPE_SSUMM", "6"), + ("(gint) GST_RTCP_XR_TYPE_VOIP_METRICS", "7"), + ("(guint) GST_RTP_BUFFER_FLAG_LAST", "268435456"), + ("(guint) GST_RTP_BUFFER_FLAG_REDUNDANT", "2097152"), + ("(guint) GST_RTP_BUFFER_FLAG_RETRANSMISSION", "1048576"), + ("(guint) GST_RTP_BUFFER_MAP_FLAG_LAST", "16777216"), + ("(guint) GST_RTP_BUFFER_MAP_FLAG_SKIP_PADDING", "65536"), + ("GST_RTP_HDREXT_BASE", "urn:ietf:params:rtp-hdrext:"), + ("GST_RTP_HDREXT_NTP_56", "ntp-56"), + ("GST_RTP_HDREXT_NTP_56_SIZE", "7"), + ("GST_RTP_HDREXT_NTP_64", "ntp-64"), + ("GST_RTP_HDREXT_NTP_64_SIZE", "8"), + ("(gint) GST_RTP_PAYLOAD_1016", "1"), + ("GST_RTP_PAYLOAD_1016_STRING", "1"), + ("(gint) GST_RTP_PAYLOAD_CELLB", "25"), + ("GST_RTP_PAYLOAD_CELLB_STRING", "25"), + ("(gint) GST_RTP_PAYLOAD_CN", "13"), + ("GST_RTP_PAYLOAD_CN_STRING", "13"), + ("(gint) GST_RTP_PAYLOAD_DVI4_11025", "16"), + ("GST_RTP_PAYLOAD_DVI4_11025_STRING", "16"), + ("(gint) GST_RTP_PAYLOAD_DVI4_16000", "6"), + ("GST_RTP_PAYLOAD_DVI4_16000_STRING", "6"), + ("(gint) GST_RTP_PAYLOAD_DVI4_22050", "17"), + ("GST_RTP_PAYLOAD_DVI4_22050_STRING", "17"), + ("(gint) GST_RTP_PAYLOAD_DVI4_8000", "5"), + ("GST_RTP_PAYLOAD_DVI4_8000_STRING", "5"), + ("GST_RTP_PAYLOAD_DYNAMIC_STRING", "[96, 127]"), + ("(gint) GST_RTP_PAYLOAD_G721", "2"), + ("GST_RTP_PAYLOAD_G721_STRING", "2"), + ("(gint) GST_RTP_PAYLOAD_G722", "9"), + ("GST_RTP_PAYLOAD_G722_STRING", "9"), + ("(gint) GST_RTP_PAYLOAD_G723", "4"), + ("GST_RTP_PAYLOAD_G723_53", "17"), + ("GST_RTP_PAYLOAD_G723_53_STRING", "17"), + ("GST_RTP_PAYLOAD_G723_63", "16"), + ("GST_RTP_PAYLOAD_G723_63_STRING", "16"), + ("GST_RTP_PAYLOAD_G723_STRING", "4"), + ("(gint) GST_RTP_PAYLOAD_G728", "15"), + ("GST_RTP_PAYLOAD_G728_STRING", "15"), + ("(gint) GST_RTP_PAYLOAD_G729", "18"), + ("GST_RTP_PAYLOAD_G729_STRING", "18"), + ("(gint) GST_RTP_PAYLOAD_GSM", "3"), + ("GST_RTP_PAYLOAD_GSM_STRING", "3"), + ("(gint) GST_RTP_PAYLOAD_H261", "31"), + ("GST_RTP_PAYLOAD_H261_STRING", "31"), + ("(gint) GST_RTP_PAYLOAD_H263", "34"), + ("GST_RTP_PAYLOAD_H263_STRING", "34"), + ("(gint) GST_RTP_PAYLOAD_JPEG", "26"), + ("GST_RTP_PAYLOAD_JPEG_STRING", "26"), + ("(gint) GST_RTP_PAYLOAD_L16_MONO", "11"), + ("GST_RTP_PAYLOAD_L16_MONO_STRING", "11"), + ("(gint) GST_RTP_PAYLOAD_L16_STEREO", "10"), + ("GST_RTP_PAYLOAD_L16_STEREO_STRING", "10"), + ("(gint) GST_RTP_PAYLOAD_LPC", "7"), + ("GST_RTP_PAYLOAD_LPC_STRING", "7"), + ("(gint) GST_RTP_PAYLOAD_MP2T", "33"), + ("GST_RTP_PAYLOAD_MP2T_STRING", "33"), + ("(gint) GST_RTP_PAYLOAD_MPA", "14"), + ("GST_RTP_PAYLOAD_MPA_STRING", "14"), + ("(gint) GST_RTP_PAYLOAD_MPV", "32"), + ("GST_RTP_PAYLOAD_MPV_STRING", "32"), + ("(gint) GST_RTP_PAYLOAD_NV", "28"), + ("GST_RTP_PAYLOAD_NV_STRING", "28"), + ("(gint) GST_RTP_PAYLOAD_PCMA", "8"), + ("GST_RTP_PAYLOAD_PCMA_STRING", "8"), + ("(gint) GST_RTP_PAYLOAD_PCMU", "0"), + ("GST_RTP_PAYLOAD_PCMU_STRING", "0"), + ("(gint) GST_RTP_PAYLOAD_QCELP", "12"), + ("GST_RTP_PAYLOAD_QCELP_STRING", "12"), + ("GST_RTP_PAYLOAD_TS41", "19"), + ("GST_RTP_PAYLOAD_TS41_STRING", "19"), + ("GST_RTP_PAYLOAD_TS48", "18"), + ("GST_RTP_PAYLOAD_TS48_STRING", "18"), + ("(gint) GST_RTP_PROFILE_AVP", "1"), + ("(gint) GST_RTP_PROFILE_AVPF", "3"), + ("(gint) GST_RTP_PROFILE_SAVP", "2"), + ("(gint) GST_RTP_PROFILE_SAVPF", "4"), + ("(gint) GST_RTP_PROFILE_UNKNOWN", "0"), + ("GST_RTP_SOURCE_META_MAX_CSRC_COUNT", "15"), + ("GST_RTP_VERSION", "2"), +]; diff --git a/gstreamer-rtp-sys/tests/constant.c b/gstreamer-rtp-sys/tests/constant.c new file mode 100644 index 000000000..7653cf846 --- /dev/null +++ b/gstreamer-rtp-sys/tests/constant.c @@ -0,0 +1,27 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir @ 8f15e55) +// from gir-files (https://github.com/gtk-rs/gir-files @ ???) +// DO NOT EDIT + +#include "manual.h" +#include + +int main() { + printf(_Generic((ABI_CONSTANT_NAME), + char *: "###gir test###%s###gir test###\n", + const char *: "###gir test###%s###gir test###\n", + char: "###gir test###%c###gir test###\n", + signed char: "###gir test###%hhd###gir test###\n", + unsigned char: "###gir test###%hhu###gir test###\n", + short int: "###gir test###%hd###gir test###\n", + unsigned short int: "###gir test###%hu###gir test###\n", + int: "###gir test###%d###gir test###\n", + unsigned int: "###gir test###%u###gir test###\n", + long: "###gir test###%ld###gir test###\n", + unsigned long: "###gir test###%lu###gir test###\n", + long long: "###gir test###%lld###gir test###\n", + unsigned long long: "###gir test###%llu###gir test###\n", + double: "###gir test###%f###gir test###\n", + long double: "###gir test###%ld###gir test###\n"), + ABI_CONSTANT_NAME); + return 0; +} diff --git a/gstreamer-rtp-sys/tests/layout.c b/gstreamer-rtp-sys/tests/layout.c new file mode 100644 index 000000000..2a73e8346 --- /dev/null +++ b/gstreamer-rtp-sys/tests/layout.c @@ -0,0 +1,12 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir @ 8f15e55) +// from gir-files (https://github.com/gtk-rs/gir-files @ ???) +// DO NOT EDIT + +#include "manual.h" +#include +#include + +int main() { + printf("%zu\n%zu", sizeof(ABI_TYPE_NAME), alignof(ABI_TYPE_NAME)); + return 0; +} diff --git a/gstreamer-rtp-sys/tests/manual.h b/gstreamer-rtp-sys/tests/manual.h new file mode 100644 index 000000000..f7c519d66 --- /dev/null +++ b/gstreamer-rtp-sys/tests/manual.h @@ -0,0 +1,3 @@ +// Feel free to edit this file, it won't be regenerated by gir generator unless removed. + +#include