diff --git a/Cargo.toml b/Cargo.toml index d8c8b1533..5b751cbb8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,6 +16,7 @@ members = [ "gstreamer-check", "gstreamer-editing-services", "gstreamer-gl", + "gstreamer-rtp", "examples", "tutorials", ] diff --git a/Gir_GstRtp.toml b/Gir_GstRtp.toml new file mode 100644 index 000000000..0272ba08d --- /dev/null +++ b/Gir_GstRtp.toml @@ -0,0 +1,52 @@ +[options] +girs_dir = "gir-files" +library = "GstRtp" +version = "1.0" +min_cfg_version = "1.8" +target_path = "gstreamer-rtp" +work_mode = "normal" +concurrency = "send+sync" +generate_safety_asserts = true +single_version_file = true +doc_target_path = "docs/gstreamer-rtp/docs.md" +generate_display_trait = false + +external_libraries = [ + "GLib", + "GObject", + "Gst", +] + +generate = [ + "GstRtp.RTCPFBType", + "GstRtp.RTCPSDESType", + "GstRtp.RTCPType", + "GstRtp.RTCPXRType", + "GstRtp.RTPPayload", + "GstRtp.RTPProfile", + "GstRtp.RTPBufferFlags", + "GstRtp.RTPBufferMapFlags", +] + +[[object]] +name = "Gst.Buffer" +status = "manual" +ref_mode = "ref" + +[[object]] +name = "GstRtp.*" +status = "generate" + # expected enum `std::ffi::c_void`, found u8 + [[object.function]] + name = "rtp_hdrext_get_ntp_56" + ignore = true + + # expected enum `std::ffi::c_void`, found u8 + [[object.function]] + name = "rtp_hdrext_get_ntp_64" + ignore = true + + # manual bindings are needed for GstMeta + [[object.function]] + name = "rtp_source_meta_api_get_type" + ignore = true diff --git a/docs/gstreamer-rtp/docs.md b/docs/gstreamer-rtp/docs.md new file mode 100644 index 000000000..d4fffaed4 --- /dev/null +++ b/docs/gstreamer-rtp/docs.md @@ -0,0 +1 @@ + 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/Cargo.toml b/gstreamer-rtp/Cargo.toml new file mode 100644 index 000000000..bbad2366f --- /dev/null +++ b/gstreamer-rtp/Cargo.toml @@ -0,0 +1,39 @@ +[package] +name = "gstreamer-rtp" +version = "0.15.0" +authors = ["Mathieu Duponchelle ", "Sebastian Dröge "] +categories = ["api-bindings", "multimedia"] +description = "Rust bindings for GStreamer Rtp library" +repository = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" +license = "MIT/Apache-2.0" +readme = "README.md" +homepage = "https://gstreamer.freedesktop.org" +documentation = "https://slomo.pages.freedesktop.org/rustdocs/gstreamer/gstreamer_rtp" +keywords = ["gstreamer", "multimedia", "audio", "video", "gnome"] +build = "build.rs" + +[dependencies] +bitflags = "1.0" +lazy_static = "1.0" +glib-sys = { git = "https://github.com/gtk-rs/sys" } +gobject-sys = { git = "https://github.com/gtk-rs/sys" } +gstreamer-sys = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs-sys", features = ["v1_8"] } +gstreamer-rtp-sys = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs-sys", features = ["v1_8"] } +glib = { git = "https://github.com/gtk-rs/glib" } +gstreamer = { path = "../gstreamer" } + +[build-dependencies.rustdoc-stripper] +version = "0.1" +optional = true + +[features] +default = [] +v1_10 = ["gstreamer/v1_10", "gstreamer-rtp-sys/v1_10"] +v1_12 = ["gstreamer/v1_12", "gstreamer-rtp-sys/v1_12", "v1_10"] +v1_14 = ["gstreamer/v1_14", "gstreamer-rtp-sys/v1_14", "v1_12"] +v1_16 = ["gstreamer/v1_16", "gstreamer-rtp-sys/v1_16", "v1_14"] +embed-lgpl-docs = ["rustdoc-stripper"] +purge-lgpl-docs = ["rustdoc-stripper"] + +["package.metadata.docs.rs"] +dox = ["gstreamer-rtp-sys/dox", "glib/dox", "gstreamer/dox"] diff --git a/gstreamer-rtp/build.rs b/gstreamer-rtp/build.rs new file mode 100644 index 000000000..4e50aebdf --- /dev/null +++ b/gstreamer-rtp/build.rs @@ -0,0 +1,34 @@ +fn main() { + manage_docs(); +} + +#[cfg(any(feature = "embed-lgpl-docs", feature = "purge-lgpl-docs"))] +fn manage_docs() { + extern crate stripper_lib; + use std::io; + + let path = "src"; + let ignores: &[&str] = &[]; + + stripper_lib::loop_over_files( + path.as_ref(), + &mut |w, s| stripper_lib::strip_comments(w, s, &mut io::sink(), true), + &ignores, + false, + ); + + #[cfg(feature = "embed-lgpl-docs")] + { + let docs = include_str!("../docs/gstreamer-rtp/docs.md"); + let mut infos = stripper_lib::parse_cmts(docs.lines(), true); + stripper_lib::loop_over_files( + path.as_ref(), + &mut |w, s| stripper_lib::regenerate_comments(w, s, &mut infos, true, true), + &ignores, + false, + ); + } +} + +#[cfg(not(any(feature = "embed-lgpl-docs", feature = "purge-lgpl-docs")))] +fn manage_docs() {} diff --git a/gstreamer-rtp/src/auto/constants.rs b/gstreamer-rtp/src/auto/constants.rs new file mode 100644 index 000000000..bd3bf93a5 --- /dev/null +++ b/gstreamer-rtp/src/auto/constants.rs @@ -0,0 +1,245 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +use gst_rtp_sys; +use std::ffi::CStr; + +lazy_static! { + pub static ref RTP_HDREXT_BASE: &'static str = unsafe { + CStr::from_ptr(gst_rtp_sys::GST_RTP_HDREXT_BASE) + .to_str() + .unwrap() + }; +} +lazy_static! { + pub static ref RTP_HDREXT_NTP_56: &'static str = unsafe { + CStr::from_ptr(gst_rtp_sys::GST_RTP_HDREXT_NTP_56) + .to_str() + .unwrap() + }; +} +lazy_static! { + pub static ref RTP_HDREXT_NTP_64: &'static str = unsafe { + CStr::from_ptr(gst_rtp_sys::GST_RTP_HDREXT_NTP_64) + .to_str() + .unwrap() + }; +} +lazy_static! { + pub static ref RTP_PAYLOAD_1016_STRING: &'static str = unsafe { + CStr::from_ptr(gst_rtp_sys::GST_RTP_PAYLOAD_1016_STRING) + .to_str() + .unwrap() + }; +} +lazy_static! { + pub static ref RTP_PAYLOAD_CELLB_STRING: &'static str = unsafe { + CStr::from_ptr(gst_rtp_sys::GST_RTP_PAYLOAD_CELLB_STRING) + .to_str() + .unwrap() + }; +} +lazy_static! { + pub static ref RTP_PAYLOAD_CN_STRING: &'static str = unsafe { + CStr::from_ptr(gst_rtp_sys::GST_RTP_PAYLOAD_CN_STRING) + .to_str() + .unwrap() + }; +} +lazy_static! { + pub static ref RTP_PAYLOAD_DVI4_11025_STRING: &'static str = unsafe { + CStr::from_ptr(gst_rtp_sys::GST_RTP_PAYLOAD_DVI4_11025_STRING) + .to_str() + .unwrap() + }; +} +lazy_static! { + pub static ref RTP_PAYLOAD_DVI4_16000_STRING: &'static str = unsafe { + CStr::from_ptr(gst_rtp_sys::GST_RTP_PAYLOAD_DVI4_16000_STRING) + .to_str() + .unwrap() + }; +} +lazy_static! { + pub static ref RTP_PAYLOAD_DVI4_22050_STRING: &'static str = unsafe { + CStr::from_ptr(gst_rtp_sys::GST_RTP_PAYLOAD_DVI4_22050_STRING) + .to_str() + .unwrap() + }; +} +lazy_static! { + pub static ref RTP_PAYLOAD_DVI4_8000_STRING: &'static str = unsafe { + CStr::from_ptr(gst_rtp_sys::GST_RTP_PAYLOAD_DVI4_8000_STRING) + .to_str() + .unwrap() + }; +} +lazy_static! { + pub static ref RTP_PAYLOAD_DYNAMIC_STRING: &'static str = unsafe { + CStr::from_ptr(gst_rtp_sys::GST_RTP_PAYLOAD_DYNAMIC_STRING) + .to_str() + .unwrap() + }; +} +lazy_static! { + pub static ref RTP_PAYLOAD_G721_STRING: &'static str = unsafe { + CStr::from_ptr(gst_rtp_sys::GST_RTP_PAYLOAD_G721_STRING) + .to_str() + .unwrap() + }; +} +lazy_static! { + pub static ref RTP_PAYLOAD_G722_STRING: &'static str = unsafe { + CStr::from_ptr(gst_rtp_sys::GST_RTP_PAYLOAD_G722_STRING) + .to_str() + .unwrap() + }; +} +lazy_static! { + pub static ref RTP_PAYLOAD_G723_53_STRING: &'static str = unsafe { + CStr::from_ptr(gst_rtp_sys::GST_RTP_PAYLOAD_G723_53_STRING) + .to_str() + .unwrap() + }; +} +lazy_static! { + pub static ref RTP_PAYLOAD_G723_63_STRING: &'static str = unsafe { + CStr::from_ptr(gst_rtp_sys::GST_RTP_PAYLOAD_G723_63_STRING) + .to_str() + .unwrap() + }; +} +lazy_static! { + pub static ref RTP_PAYLOAD_G723_STRING: &'static str = unsafe { + CStr::from_ptr(gst_rtp_sys::GST_RTP_PAYLOAD_G723_STRING) + .to_str() + .unwrap() + }; +} +lazy_static! { + pub static ref RTP_PAYLOAD_G728_STRING: &'static str = unsafe { + CStr::from_ptr(gst_rtp_sys::GST_RTP_PAYLOAD_G728_STRING) + .to_str() + .unwrap() + }; +} +lazy_static! { + pub static ref RTP_PAYLOAD_G729_STRING: &'static str = unsafe { + CStr::from_ptr(gst_rtp_sys::GST_RTP_PAYLOAD_G729_STRING) + .to_str() + .unwrap() + }; +} +lazy_static! { + pub static ref RTP_PAYLOAD_GSM_STRING: &'static str = unsafe { + CStr::from_ptr(gst_rtp_sys::GST_RTP_PAYLOAD_GSM_STRING) + .to_str() + .unwrap() + }; +} +lazy_static! { + pub static ref RTP_PAYLOAD_H261_STRING: &'static str = unsafe { + CStr::from_ptr(gst_rtp_sys::GST_RTP_PAYLOAD_H261_STRING) + .to_str() + .unwrap() + }; +} +lazy_static! { + pub static ref RTP_PAYLOAD_H263_STRING: &'static str = unsafe { + CStr::from_ptr(gst_rtp_sys::GST_RTP_PAYLOAD_H263_STRING) + .to_str() + .unwrap() + }; +} +lazy_static! { + pub static ref RTP_PAYLOAD_JPEG_STRING: &'static str = unsafe { + CStr::from_ptr(gst_rtp_sys::GST_RTP_PAYLOAD_JPEG_STRING) + .to_str() + .unwrap() + }; +} +lazy_static! { + pub static ref RTP_PAYLOAD_L16_MONO_STRING: &'static str = unsafe { + CStr::from_ptr(gst_rtp_sys::GST_RTP_PAYLOAD_L16_MONO_STRING) + .to_str() + .unwrap() + }; +} +lazy_static! { + pub static ref RTP_PAYLOAD_L16_STEREO_STRING: &'static str = unsafe { + CStr::from_ptr(gst_rtp_sys::GST_RTP_PAYLOAD_L16_STEREO_STRING) + .to_str() + .unwrap() + }; +} +lazy_static! { + pub static ref RTP_PAYLOAD_LPC_STRING: &'static str = unsafe { + CStr::from_ptr(gst_rtp_sys::GST_RTP_PAYLOAD_LPC_STRING) + .to_str() + .unwrap() + }; +} +lazy_static! { + pub static ref RTP_PAYLOAD_MP2T_STRING: &'static str = unsafe { + CStr::from_ptr(gst_rtp_sys::GST_RTP_PAYLOAD_MP2T_STRING) + .to_str() + .unwrap() + }; +} +lazy_static! { + pub static ref RTP_PAYLOAD_MPA_STRING: &'static str = unsafe { + CStr::from_ptr(gst_rtp_sys::GST_RTP_PAYLOAD_MPA_STRING) + .to_str() + .unwrap() + }; +} +lazy_static! { + pub static ref RTP_PAYLOAD_MPV_STRING: &'static str = unsafe { + CStr::from_ptr(gst_rtp_sys::GST_RTP_PAYLOAD_MPV_STRING) + .to_str() + .unwrap() + }; +} +lazy_static! { + pub static ref RTP_PAYLOAD_NV_STRING: &'static str = unsafe { + CStr::from_ptr(gst_rtp_sys::GST_RTP_PAYLOAD_NV_STRING) + .to_str() + .unwrap() + }; +} +lazy_static! { + pub static ref RTP_PAYLOAD_PCMA_STRING: &'static str = unsafe { + CStr::from_ptr(gst_rtp_sys::GST_RTP_PAYLOAD_PCMA_STRING) + .to_str() + .unwrap() + }; +} +lazy_static! { + pub static ref RTP_PAYLOAD_PCMU_STRING: &'static str = unsafe { + CStr::from_ptr(gst_rtp_sys::GST_RTP_PAYLOAD_PCMU_STRING) + .to_str() + .unwrap() + }; +} +lazy_static! { + pub static ref RTP_PAYLOAD_QCELP_STRING: &'static str = unsafe { + CStr::from_ptr(gst_rtp_sys::GST_RTP_PAYLOAD_QCELP_STRING) + .to_str() + .unwrap() + }; +} +lazy_static! { + pub static ref RTP_PAYLOAD_TS41_STRING: &'static str = unsafe { + CStr::from_ptr(gst_rtp_sys::GST_RTP_PAYLOAD_TS41_STRING) + .to_str() + .unwrap() + }; +} +lazy_static! { + pub static ref RTP_PAYLOAD_TS48_STRING: &'static str = unsafe { + CStr::from_ptr(gst_rtp_sys::GST_RTP_PAYLOAD_TS48_STRING) + .to_str() + .unwrap() + }; +} diff --git a/gstreamer-rtp/src/auto/enums.rs b/gstreamer-rtp/src/auto/enums.rs new file mode 100644 index 000000000..f4202498f --- /dev/null +++ b/gstreamer-rtp/src/auto/enums.rs @@ -0,0 +1,527 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +use glib::translate::*; +use glib::value::FromValue; +use glib::value::FromValueOptional; +use glib::value::SetValue; +use glib::value::Value; +use glib::StaticType; +use glib::Type; +use gobject_sys; +use gst_rtp_sys; + +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] +pub enum RTCPFBType { + FbTypeInvalid, + RtpfbTypeNack, + RtpfbTypeTmmbr, + RtpfbTypeTmmbn, + RtpfbTypeRtcpSrReq, + PsfbTypeSli, + PsfbTypeAfb, + PsfbTypeTstn, + PsfbTypeVbcn, + #[doc(hidden)] + __Unknown(i32), +} + +#[doc(hidden)] +impl ToGlib for RTCPFBType { + type GlibType = gst_rtp_sys::GstRTCPFBType; + + fn to_glib(&self) -> gst_rtp_sys::GstRTCPFBType { + match *self { + RTCPFBType::FbTypeInvalid => gst_rtp_sys::GST_RTCP_FB_TYPE_INVALID, + RTCPFBType::RtpfbTypeNack => gst_rtp_sys::GST_RTCP_RTPFB_TYPE_NACK, + RTCPFBType::RtpfbTypeTmmbr => gst_rtp_sys::GST_RTCP_RTPFB_TYPE_TMMBR, + RTCPFBType::RtpfbTypeTmmbn => gst_rtp_sys::GST_RTCP_RTPFB_TYPE_TMMBN, + RTCPFBType::RtpfbTypeRtcpSrReq => gst_rtp_sys::GST_RTCP_RTPFB_TYPE_RTCP_SR_REQ, + RTCPFBType::PsfbTypeSli => gst_rtp_sys::GST_RTCP_PSFB_TYPE_SLI, + RTCPFBType::PsfbTypeAfb => gst_rtp_sys::GST_RTCP_PSFB_TYPE_AFB, + RTCPFBType::PsfbTypeTstn => gst_rtp_sys::GST_RTCP_PSFB_TYPE_TSTN, + RTCPFBType::PsfbTypeVbcn => gst_rtp_sys::GST_RTCP_PSFB_TYPE_VBCN, + RTCPFBType::__Unknown(value) => value, + } + } +} + +#[doc(hidden)] +impl FromGlib for RTCPFBType { + fn from_glib(value: gst_rtp_sys::GstRTCPFBType) -> Self { + skip_assert_initialized!(); + match value { + 0 => RTCPFBType::FbTypeInvalid, + 1 => RTCPFBType::RtpfbTypeNack, + 3 => RTCPFBType::RtpfbTypeTmmbr, + 4 => RTCPFBType::RtpfbTypeTmmbn, + 5 => RTCPFBType::RtpfbTypeRtcpSrReq, + 2 => RTCPFBType::PsfbTypeSli, + 15 => RTCPFBType::PsfbTypeAfb, + 6 => RTCPFBType::PsfbTypeTstn, + 7 => RTCPFBType::PsfbTypeVbcn, + value => RTCPFBType::__Unknown(value), + } + } +} + +impl StaticType for RTCPFBType { + fn static_type() -> Type { + unsafe { from_glib(gst_rtp_sys::gst_rtcpfb_type_get_type()) } + } +} + +impl<'a> FromValueOptional<'a> for RTCPFBType { + unsafe fn from_value_optional(value: &Value) -> Option { + Some(FromValue::from_value(value)) + } +} + +impl<'a> FromValue<'a> for RTCPFBType { + unsafe fn from_value(value: &Value) -> Self { + from_glib(gobject_sys::g_value_get_enum(value.to_glib_none().0)) + } +} + +impl SetValue for RTCPFBType { + unsafe fn set_value(value: &mut Value, this: &Self) { + gobject_sys::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib()) + } +} + +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] +pub enum RTCPSDESType { + Invalid, + End, + Cname, + Name, + Email, + Phone, + Loc, + Tool, + Note, + Priv, + #[doc(hidden)] + __Unknown(i32), +} + +#[doc(hidden)] +impl ToGlib for RTCPSDESType { + type GlibType = gst_rtp_sys::GstRTCPSDESType; + + fn to_glib(&self) -> gst_rtp_sys::GstRTCPSDESType { + match *self { + RTCPSDESType::Invalid => gst_rtp_sys::GST_RTCP_SDES_INVALID, + RTCPSDESType::End => gst_rtp_sys::GST_RTCP_SDES_END, + RTCPSDESType::Cname => gst_rtp_sys::GST_RTCP_SDES_CNAME, + RTCPSDESType::Name => gst_rtp_sys::GST_RTCP_SDES_NAME, + RTCPSDESType::Email => gst_rtp_sys::GST_RTCP_SDES_EMAIL, + RTCPSDESType::Phone => gst_rtp_sys::GST_RTCP_SDES_PHONE, + RTCPSDESType::Loc => gst_rtp_sys::GST_RTCP_SDES_LOC, + RTCPSDESType::Tool => gst_rtp_sys::GST_RTCP_SDES_TOOL, + RTCPSDESType::Note => gst_rtp_sys::GST_RTCP_SDES_NOTE, + RTCPSDESType::Priv => gst_rtp_sys::GST_RTCP_SDES_PRIV, + RTCPSDESType::__Unknown(value) => value, + } + } +} + +#[doc(hidden)] +impl FromGlib for RTCPSDESType { + fn from_glib(value: gst_rtp_sys::GstRTCPSDESType) -> Self { + skip_assert_initialized!(); + match value { + -1 => RTCPSDESType::Invalid, + 0 => RTCPSDESType::End, + 1 => RTCPSDESType::Cname, + 2 => RTCPSDESType::Name, + 3 => RTCPSDESType::Email, + 4 => RTCPSDESType::Phone, + 5 => RTCPSDESType::Loc, + 6 => RTCPSDESType::Tool, + 7 => RTCPSDESType::Note, + 8 => RTCPSDESType::Priv, + value => RTCPSDESType::__Unknown(value), + } + } +} + +impl StaticType for RTCPSDESType { + fn static_type() -> Type { + unsafe { from_glib(gst_rtp_sys::gst_rtcpsdes_type_get_type()) } + } +} + +impl<'a> FromValueOptional<'a> for RTCPSDESType { + unsafe fn from_value_optional(value: &Value) -> Option { + Some(FromValue::from_value(value)) + } +} + +impl<'a> FromValue<'a> for RTCPSDESType { + unsafe fn from_value(value: &Value) -> Self { + from_glib(gobject_sys::g_value_get_enum(value.to_glib_none().0)) + } +} + +impl SetValue for RTCPSDESType { + unsafe fn set_value(value: &mut Value, this: &Self) { + gobject_sys::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib()) + } +} + +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] +pub enum RTCPType { + Invalid, + Sr, + Rr, + Sdes, + Bye, + App, + Rtpfb, + Psfb, + Xr, + #[doc(hidden)] + __Unknown(i32), +} + +#[doc(hidden)] +impl ToGlib for RTCPType { + type GlibType = gst_rtp_sys::GstRTCPType; + + fn to_glib(&self) -> gst_rtp_sys::GstRTCPType { + match *self { + RTCPType::Invalid => gst_rtp_sys::GST_RTCP_TYPE_INVALID, + RTCPType::Sr => gst_rtp_sys::GST_RTCP_TYPE_SR, + RTCPType::Rr => gst_rtp_sys::GST_RTCP_TYPE_RR, + RTCPType::Sdes => gst_rtp_sys::GST_RTCP_TYPE_SDES, + RTCPType::Bye => gst_rtp_sys::GST_RTCP_TYPE_BYE, + RTCPType::App => gst_rtp_sys::GST_RTCP_TYPE_APP, + RTCPType::Rtpfb => gst_rtp_sys::GST_RTCP_TYPE_RTPFB, + RTCPType::Psfb => gst_rtp_sys::GST_RTCP_TYPE_PSFB, + RTCPType::Xr => gst_rtp_sys::GST_RTCP_TYPE_XR, + RTCPType::__Unknown(value) => value, + } + } +} + +#[doc(hidden)] +impl FromGlib for RTCPType { + fn from_glib(value: gst_rtp_sys::GstRTCPType) -> Self { + skip_assert_initialized!(); + match value { + 0 => RTCPType::Invalid, + 200 => RTCPType::Sr, + 201 => RTCPType::Rr, + 202 => RTCPType::Sdes, + 203 => RTCPType::Bye, + 204 => RTCPType::App, + 205 => RTCPType::Rtpfb, + 206 => RTCPType::Psfb, + 207 => RTCPType::Xr, + value => RTCPType::__Unknown(value), + } + } +} + +impl StaticType for RTCPType { + fn static_type() -> Type { + unsafe { from_glib(gst_rtp_sys::gst_rtcp_type_get_type()) } + } +} + +impl<'a> FromValueOptional<'a> for RTCPType { + unsafe fn from_value_optional(value: &Value) -> Option { + Some(FromValue::from_value(value)) + } +} + +impl<'a> FromValue<'a> for RTCPType { + unsafe fn from_value(value: &Value) -> Self { + from_glib(gobject_sys::g_value_get_enum(value.to_glib_none().0)) + } +} + +impl SetValue for RTCPType { + unsafe fn set_value(value: &mut Value, this: &Self) { + gobject_sys::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib()) + } +} + +#[cfg(any(feature = "v1_16", feature = "dox"))] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] +pub enum RTCPXRType { + Invalid, + Lrle, + Drle, + Prt, + Rrt, + Dlrr, + Ssumm, + VoipMetrics, + #[doc(hidden)] + __Unknown(i32), +} + +#[cfg(any(feature = "v1_16", feature = "dox"))] +#[doc(hidden)] +impl ToGlib for RTCPXRType { + type GlibType = gst_rtp_sys::GstRTCPXRType; + + fn to_glib(&self) -> gst_rtp_sys::GstRTCPXRType { + match *self { + RTCPXRType::Invalid => gst_rtp_sys::GST_RTCP_XR_TYPE_INVALID, + RTCPXRType::Lrle => gst_rtp_sys::GST_RTCP_XR_TYPE_LRLE, + RTCPXRType::Drle => gst_rtp_sys::GST_RTCP_XR_TYPE_DRLE, + RTCPXRType::Prt => gst_rtp_sys::GST_RTCP_XR_TYPE_PRT, + RTCPXRType::Rrt => gst_rtp_sys::GST_RTCP_XR_TYPE_RRT, + RTCPXRType::Dlrr => gst_rtp_sys::GST_RTCP_XR_TYPE_DLRR, + RTCPXRType::Ssumm => gst_rtp_sys::GST_RTCP_XR_TYPE_SSUMM, + RTCPXRType::VoipMetrics => gst_rtp_sys::GST_RTCP_XR_TYPE_VOIP_METRICS, + RTCPXRType::__Unknown(value) => value, + } + } +} + +#[cfg(any(feature = "v1_16", feature = "dox"))] +#[doc(hidden)] +impl FromGlib for RTCPXRType { + fn from_glib(value: gst_rtp_sys::GstRTCPXRType) -> Self { + skip_assert_initialized!(); + match value { + -1 => RTCPXRType::Invalid, + 1 => RTCPXRType::Lrle, + 2 => RTCPXRType::Drle, + 3 => RTCPXRType::Prt, + 4 => RTCPXRType::Rrt, + 5 => RTCPXRType::Dlrr, + 6 => RTCPXRType::Ssumm, + 7 => RTCPXRType::VoipMetrics, + value => RTCPXRType::__Unknown(value), + } + } +} + +#[cfg(any(feature = "v1_16", feature = "dox"))] +impl StaticType for RTCPXRType { + fn static_type() -> Type { + unsafe { from_glib(gst_rtp_sys::gst_rtcpxr_type_get_type()) } + } +} + +#[cfg(any(feature = "v1_16", feature = "dox"))] +impl<'a> FromValueOptional<'a> for RTCPXRType { + unsafe fn from_value_optional(value: &Value) -> Option { + Some(FromValue::from_value(value)) + } +} + +#[cfg(any(feature = "v1_16", feature = "dox"))] +impl<'a> FromValue<'a> for RTCPXRType { + unsafe fn from_value(value: &Value) -> Self { + from_glib(gobject_sys::g_value_get_enum(value.to_glib_none().0)) + } +} + +#[cfg(any(feature = "v1_16", feature = "dox"))] +impl SetValue for RTCPXRType { + unsafe fn set_value(value: &mut Value, this: &Self) { + gobject_sys::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib()) + } +} + +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] +pub enum RTPPayload { + Pcmu, + _1016, + G721, + Gsm, + G723, + Dvi48000, + Dvi416000, + Lpc, + Pcma, + G722, + L16Stereo, + L16Mono, + Qcelp, + Cn, + Mpa, + G728, + Dvi411025, + Dvi422050, + G729, + Cellb, + Jpeg, + Nv, + H261, + Mpv, + Mp2t, + H263, + #[doc(hidden)] + __Unknown(i32), +} + +#[doc(hidden)] +impl ToGlib for RTPPayload { + type GlibType = gst_rtp_sys::GstRTPPayload; + + fn to_glib(&self) -> gst_rtp_sys::GstRTPPayload { + match *self { + RTPPayload::Pcmu => gst_rtp_sys::GST_RTP_PAYLOAD_PCMU, + RTPPayload::_1016 => gst_rtp_sys::GST_RTP_PAYLOAD_1016, + RTPPayload::G721 => gst_rtp_sys::GST_RTP_PAYLOAD_G721, + RTPPayload::Gsm => gst_rtp_sys::GST_RTP_PAYLOAD_GSM, + RTPPayload::G723 => gst_rtp_sys::GST_RTP_PAYLOAD_G723, + RTPPayload::Dvi48000 => gst_rtp_sys::GST_RTP_PAYLOAD_DVI4_8000, + RTPPayload::Dvi416000 => gst_rtp_sys::GST_RTP_PAYLOAD_DVI4_16000, + RTPPayload::Lpc => gst_rtp_sys::GST_RTP_PAYLOAD_LPC, + RTPPayload::Pcma => gst_rtp_sys::GST_RTP_PAYLOAD_PCMA, + RTPPayload::G722 => gst_rtp_sys::GST_RTP_PAYLOAD_G722, + RTPPayload::L16Stereo => gst_rtp_sys::GST_RTP_PAYLOAD_L16_STEREO, + RTPPayload::L16Mono => gst_rtp_sys::GST_RTP_PAYLOAD_L16_MONO, + RTPPayload::Qcelp => gst_rtp_sys::GST_RTP_PAYLOAD_QCELP, + RTPPayload::Cn => gst_rtp_sys::GST_RTP_PAYLOAD_CN, + RTPPayload::Mpa => gst_rtp_sys::GST_RTP_PAYLOAD_MPA, + RTPPayload::G728 => gst_rtp_sys::GST_RTP_PAYLOAD_G728, + RTPPayload::Dvi411025 => gst_rtp_sys::GST_RTP_PAYLOAD_DVI4_11025, + RTPPayload::Dvi422050 => gst_rtp_sys::GST_RTP_PAYLOAD_DVI4_22050, + RTPPayload::G729 => gst_rtp_sys::GST_RTP_PAYLOAD_G729, + RTPPayload::Cellb => gst_rtp_sys::GST_RTP_PAYLOAD_CELLB, + RTPPayload::Jpeg => gst_rtp_sys::GST_RTP_PAYLOAD_JPEG, + RTPPayload::Nv => gst_rtp_sys::GST_RTP_PAYLOAD_NV, + RTPPayload::H261 => gst_rtp_sys::GST_RTP_PAYLOAD_H261, + RTPPayload::Mpv => gst_rtp_sys::GST_RTP_PAYLOAD_MPV, + RTPPayload::Mp2t => gst_rtp_sys::GST_RTP_PAYLOAD_MP2T, + RTPPayload::H263 => gst_rtp_sys::GST_RTP_PAYLOAD_H263, + RTPPayload::__Unknown(value) => value, + } + } +} + +#[doc(hidden)] +impl FromGlib for RTPPayload { + fn from_glib(value: gst_rtp_sys::GstRTPPayload) -> Self { + skip_assert_initialized!(); + match value { + 0 => RTPPayload::Pcmu, + 1 => RTPPayload::_1016, + 2 => RTPPayload::G721, + 3 => RTPPayload::Gsm, + 4 => RTPPayload::G723, + 5 => RTPPayload::Dvi48000, + 6 => RTPPayload::Dvi416000, + 7 => RTPPayload::Lpc, + 8 => RTPPayload::Pcma, + 9 => RTPPayload::G722, + 10 => RTPPayload::L16Stereo, + 11 => RTPPayload::L16Mono, + 12 => RTPPayload::Qcelp, + 13 => RTPPayload::Cn, + 14 => RTPPayload::Mpa, + 15 => RTPPayload::G728, + 16 => RTPPayload::Dvi411025, + 17 => RTPPayload::Dvi422050, + 18 => RTPPayload::G729, + 25 => RTPPayload::Cellb, + 26 => RTPPayload::Jpeg, + 28 => RTPPayload::Nv, + 31 => RTPPayload::H261, + 32 => RTPPayload::Mpv, + 33 => RTPPayload::Mp2t, + 34 => RTPPayload::H263, + value => RTPPayload::__Unknown(value), + } + } +} + +impl StaticType for RTPPayload { + fn static_type() -> Type { + unsafe { from_glib(gst_rtp_sys::gst_rtp_payload_get_type()) } + } +} + +impl<'a> FromValueOptional<'a> for RTPPayload { + unsafe fn from_value_optional(value: &Value) -> Option { + Some(FromValue::from_value(value)) + } +} + +impl<'a> FromValue<'a> for RTPPayload { + unsafe fn from_value(value: &Value) -> Self { + from_glib(gobject_sys::g_value_get_enum(value.to_glib_none().0)) + } +} + +impl SetValue for RTPPayload { + unsafe fn set_value(value: &mut Value, this: &Self) { + gobject_sys::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib()) + } +} + +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] +pub enum RTPProfile { + Unknown, + Avp, + Savp, + Avpf, + Savpf, + #[doc(hidden)] + __Unknown(i32), +} + +#[doc(hidden)] +impl ToGlib for RTPProfile { + type GlibType = gst_rtp_sys::GstRTPProfile; + + fn to_glib(&self) -> gst_rtp_sys::GstRTPProfile { + match *self { + RTPProfile::Unknown => gst_rtp_sys::GST_RTP_PROFILE_UNKNOWN, + RTPProfile::Avp => gst_rtp_sys::GST_RTP_PROFILE_AVP, + RTPProfile::Savp => gst_rtp_sys::GST_RTP_PROFILE_SAVP, + RTPProfile::Avpf => gst_rtp_sys::GST_RTP_PROFILE_AVPF, + RTPProfile::Savpf => gst_rtp_sys::GST_RTP_PROFILE_SAVPF, + RTPProfile::__Unknown(value) => value, + } + } +} + +#[doc(hidden)] +impl FromGlib for RTPProfile { + fn from_glib(value: gst_rtp_sys::GstRTPProfile) -> Self { + skip_assert_initialized!(); + match value { + 0 => RTPProfile::Unknown, + 1 => RTPProfile::Avp, + 2 => RTPProfile::Savp, + 3 => RTPProfile::Avpf, + 4 => RTPProfile::Savpf, + value => RTPProfile::__Unknown(value), + } + } +} + +impl StaticType for RTPProfile { + fn static_type() -> Type { + unsafe { from_glib(gst_rtp_sys::gst_rtp_profile_get_type()) } + } +} + +impl<'a> FromValueOptional<'a> for RTPProfile { + unsafe fn from_value_optional(value: &Value) -> Option { + Some(FromValue::from_value(value)) + } +} + +impl<'a> FromValue<'a> for RTPProfile { + unsafe fn from_value(value: &Value) -> Self { + from_glib(gobject_sys::g_value_get_enum(value.to_glib_none().0)) + } +} + +impl SetValue for RTPProfile { + unsafe fn set_value(value: &mut Value, this: &Self) { + gobject_sys::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib()) + } +} diff --git a/gstreamer-rtp/src/auto/flags.rs b/gstreamer-rtp/src/auto/flags.rs new file mode 100644 index 000000000..55f4f3b7a --- /dev/null +++ b/gstreamer-rtp/src/auto/flags.rs @@ -0,0 +1,117 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +use glib::translate::*; +use glib::value::FromValue; +use glib::value::FromValueOptional; +use glib::value::SetValue; +use glib::value::Value; +use glib::StaticType; +use glib::Type; +use gobject_sys; +use gst_rtp_sys; + +#[cfg(any(feature = "v1_10", feature = "dox"))] +bitflags! { + pub struct RTPBufferFlags: u32 { + const RETRANSMISSION = 1048576; + const REDUNDANT = 2097152; + const LAST = 268435456; + } +} + +#[cfg(any(feature = "v1_10", feature = "dox"))] +#[doc(hidden)] +impl ToGlib for RTPBufferFlags { + type GlibType = gst_rtp_sys::GstRTPBufferFlags; + + fn to_glib(&self) -> gst_rtp_sys::GstRTPBufferFlags { + self.bits() + } +} + +#[cfg(any(feature = "v1_10", feature = "dox"))] +#[doc(hidden)] +impl FromGlib for RTPBufferFlags { + fn from_glib(value: gst_rtp_sys::GstRTPBufferFlags) -> RTPBufferFlags { + skip_assert_initialized!(); + RTPBufferFlags::from_bits_truncate(value) + } +} + +#[cfg(any(feature = "v1_10", feature = "dox"))] +impl StaticType for RTPBufferFlags { + fn static_type() -> Type { + unsafe { from_glib(gst_rtp_sys::gst_rtp_buffer_flags_get_type()) } + } +} + +#[cfg(any(feature = "v1_10", feature = "dox"))] +impl<'a> FromValueOptional<'a> for RTPBufferFlags { + unsafe fn from_value_optional(value: &Value) -> Option { + Some(FromValue::from_value(value)) + } +} + +#[cfg(any(feature = "v1_10", feature = "dox"))] +impl<'a> FromValue<'a> for RTPBufferFlags { + unsafe fn from_value(value: &Value) -> Self { + from_glib(gobject_sys::g_value_get_flags(value.to_glib_none().0)) + } +} + +#[cfg(any(feature = "v1_10", feature = "dox"))] +impl SetValue for RTPBufferFlags { + unsafe fn set_value(value: &mut Value, this: &Self) { + gobject_sys::g_value_set_flags(value.to_glib_none_mut().0, this.to_glib()) + } +} + +bitflags! { + pub struct RTPBufferMapFlags: u32 { + const SKIP_PADDING = 65536; + const LAST = 16777216; + } +} + +#[doc(hidden)] +impl ToGlib for RTPBufferMapFlags { + type GlibType = gst_rtp_sys::GstRTPBufferMapFlags; + + fn to_glib(&self) -> gst_rtp_sys::GstRTPBufferMapFlags { + self.bits() + } +} + +#[doc(hidden)] +impl FromGlib for RTPBufferMapFlags { + fn from_glib(value: gst_rtp_sys::GstRTPBufferMapFlags) -> RTPBufferMapFlags { + skip_assert_initialized!(); + RTPBufferMapFlags::from_bits_truncate(value) + } +} + +impl StaticType for RTPBufferMapFlags { + fn static_type() -> Type { + unsafe { from_glib(gst_rtp_sys::gst_rtp_buffer_map_flags_get_type()) } + } +} + +impl<'a> FromValueOptional<'a> for RTPBufferMapFlags { + unsafe fn from_value_optional(value: &Value) -> Option { + Some(FromValue::from_value(value)) + } +} + +impl<'a> FromValue<'a> for RTPBufferMapFlags { + unsafe fn from_value(value: &Value) -> Self { + from_glib(gobject_sys::g_value_get_flags(value.to_glib_none().0)) + } +} + +impl SetValue for RTPBufferMapFlags { + unsafe fn set_value(value: &mut Value, this: &Self) { + gobject_sys::g_value_set_flags(value.to_glib_none_mut().0, this.to_glib()) + } +} diff --git a/gstreamer-rtp/src/auto/functions.rs b/gstreamer-rtp/src/auto/functions.rs new file mode 100644 index 000000000..dffb40790 --- /dev/null +++ b/gstreamer-rtp/src/auto/functions.rs @@ -0,0 +1,50 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +use glib::translate::*; +use glib::GString; +use gst_rtp_sys; +use RTCPSDESType; + +//#[cfg(any(feature = "v1_16", feature = "dox"))] +//pub fn buffer_add_rtp_source_meta(buffer: &gst::Buffer, ssrc: u32, csrc: u32, csrc_count: u32) -> /*Ignored*/Option { +// unsafe { TODO: call gst_rtp_sys:gst_buffer_add_rtp_source_meta() } +//} + +//#[cfg(any(feature = "v1_16", feature = "dox"))] +//pub fn buffer_get_rtp_source_meta(buffer: &gst::Buffer) -> /*Ignored*/Option { +// unsafe { TODO: call gst_rtp_sys:gst_buffer_get_rtp_source_meta() } +//} + +pub fn rtcp_ntp_to_unix(ntptime: u64) -> u64 { + assert_initialized_main_thread!(); + unsafe { gst_rtp_sys::gst_rtcp_ntp_to_unix(ntptime) } +} + +pub fn rtcp_sdes_name_to_type(name: &str) -> RTCPSDESType { + assert_initialized_main_thread!(); + unsafe { + from_glib(gst_rtp_sys::gst_rtcp_sdes_name_to_type( + name.to_glib_none().0, + )) + } +} + +pub fn rtcp_sdes_type_to_name(type_: RTCPSDESType) -> Option { + assert_initialized_main_thread!(); + unsafe { from_glib_none(gst_rtp_sys::gst_rtcp_sdes_type_to_name(type_.to_glib())) } +} + +pub fn rtcp_unix_to_ntp(unixtime: u64) -> u64 { + assert_initialized_main_thread!(); + unsafe { gst_rtp_sys::gst_rtcp_unix_to_ntp(unixtime) } +} + +//pub fn rtp_hdrext_set_ntp_56(data: /*Unimplemented*/Option, size: u32, ntptime: u64) -> bool { +// unsafe { TODO: call gst_rtp_sys:gst_rtp_hdrext_set_ntp_56() } +//} + +//pub fn rtp_hdrext_set_ntp_64(data: /*Unimplemented*/Option, size: u32, ntptime: u64) -> bool { +// unsafe { TODO: call gst_rtp_sys:gst_rtp_hdrext_set_ntp_64() } +//} diff --git a/gstreamer-rtp/src/auto/mod.rs b/gstreamer-rtp/src/auto/mod.rs new file mode 100644 index 000000000..1d24745b0 --- /dev/null +++ b/gstreamer-rtp/src/auto/mod.rs @@ -0,0 +1,58 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +mod enums; +pub use self::enums::RTCPFBType; +pub use self::enums::RTCPSDESType; +pub use self::enums::RTCPType; +#[cfg(any(feature = "v1_16", feature = "dox"))] +pub use self::enums::RTCPXRType; +pub use self::enums::RTPPayload; +pub use self::enums::RTPProfile; + +mod flags; +#[cfg(any(feature = "v1_10", feature = "dox"))] +pub use self::flags::RTPBufferFlags; +pub use self::flags::RTPBufferMapFlags; + +pub mod functions; + +mod constants; +pub use self::constants::RTP_HDREXT_BASE; +pub use self::constants::RTP_HDREXT_NTP_56; +pub use self::constants::RTP_HDREXT_NTP_64; +pub use self::constants::RTP_PAYLOAD_1016_STRING; +pub use self::constants::RTP_PAYLOAD_CELLB_STRING; +pub use self::constants::RTP_PAYLOAD_CN_STRING; +pub use self::constants::RTP_PAYLOAD_DVI4_11025_STRING; +pub use self::constants::RTP_PAYLOAD_DVI4_16000_STRING; +pub use self::constants::RTP_PAYLOAD_DVI4_22050_STRING; +pub use self::constants::RTP_PAYLOAD_DVI4_8000_STRING; +pub use self::constants::RTP_PAYLOAD_DYNAMIC_STRING; +pub use self::constants::RTP_PAYLOAD_G721_STRING; +pub use self::constants::RTP_PAYLOAD_G722_STRING; +pub use self::constants::RTP_PAYLOAD_G723_53_STRING; +pub use self::constants::RTP_PAYLOAD_G723_63_STRING; +pub use self::constants::RTP_PAYLOAD_G723_STRING; +pub use self::constants::RTP_PAYLOAD_G728_STRING; +pub use self::constants::RTP_PAYLOAD_G729_STRING; +pub use self::constants::RTP_PAYLOAD_GSM_STRING; +pub use self::constants::RTP_PAYLOAD_H261_STRING; +pub use self::constants::RTP_PAYLOAD_H263_STRING; +pub use self::constants::RTP_PAYLOAD_JPEG_STRING; +pub use self::constants::RTP_PAYLOAD_L16_MONO_STRING; +pub use self::constants::RTP_PAYLOAD_L16_STEREO_STRING; +pub use self::constants::RTP_PAYLOAD_LPC_STRING; +pub use self::constants::RTP_PAYLOAD_MP2T_STRING; +pub use self::constants::RTP_PAYLOAD_MPA_STRING; +pub use self::constants::RTP_PAYLOAD_MPV_STRING; +pub use self::constants::RTP_PAYLOAD_NV_STRING; +pub use self::constants::RTP_PAYLOAD_PCMA_STRING; +pub use self::constants::RTP_PAYLOAD_PCMU_STRING; +pub use self::constants::RTP_PAYLOAD_QCELP_STRING; +pub use self::constants::RTP_PAYLOAD_TS41_STRING; +pub use self::constants::RTP_PAYLOAD_TS48_STRING; + +#[doc(hidden)] +pub mod traits {} diff --git a/gstreamer-rtp/src/auto/versions.txt b/gstreamer-rtp/src/auto/versions.txt new file mode 100644 index 000000000..cd893e88b --- /dev/null +++ b/gstreamer-rtp/src/auto/versions.txt @@ -0,0 +1,2 @@ +Generated by gir (https://github.com/gtk-rs/gir @ 11e59a0) +from gir-files (https://github.com/gtk-rs/gir-files @ ???) diff --git a/gstreamer-rtp/src/lib.rs b/gstreamer-rtp/src/lib.rs new file mode 100644 index 000000000..a28daa077 --- /dev/null +++ b/gstreamer-rtp/src/lib.rs @@ -0,0 +1,51 @@ +// Copyright (C) 2018 Sebastian Dröge +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#[macro_use] +extern crate bitflags; +#[macro_use] +extern crate lazy_static; + +#[allow(unused_imports)] +#[macro_use] +extern crate glib; +extern crate glib_sys; +extern crate gobject_sys; +extern crate gstreamer as gst; +extern crate gstreamer_rtp_sys as gst_rtp_sys; +extern crate gstreamer_sys as gst_sys; + +macro_rules! assert_initialized_main_thread { + () => { + if unsafe { ::gst_sys::gst_is_initialized() } != ::glib_sys::GTRUE { + panic!("GStreamer has not been initialized. Call `gst::init` first."); + } + }; +} + +macro_rules! skip_assert_initialized { + () => {}; +} + +pub use glib::{Cast, Continue, Error, IsA, StaticType, ToValue, Type, TypedValue, Value}; + +#[allow(clippy::unreadable_literal)] +#[allow(clippy::too_many_arguments)] +#[allow(clippy::match_same_arms)] +#[allow(non_snake_case)] +mod auto; +pub use auto::*; + +// Re-export all the traits in a prelude module, so that applications +// can always "use gst::prelude::*" without getting conflicts +pub mod prelude { + pub use glib::prelude::*; + pub use gst::prelude::*; + + pub use auto::traits::*; +}