Trait gstreamer_rtp::prelude::RTPBasePayloadExt
source · pub trait RTPBasePayloadExt: IsA<RTPBasePayload> + Sealed + 'static {
Show 58 methods
// Provided methods
fn allocate_output_buffer(
&self,
payload_len: u32,
pad_len: u8,
csrc_count: u8,
) -> Buffer { ... }
fn source_count(&self, buffer: &Buffer) -> u32 { ... }
fn is_filled(
&self,
size: u32,
duration: impl Into<Option<ClockTime>>,
) -> bool { ... }
fn is_source_info_enabled(&self) -> bool { ... }
fn push(&self, buffer: Buffer) -> Result<FlowSuccess, FlowError> { ... }
fn push_list(&self, list: BufferList) -> Result<FlowSuccess, FlowError> { ... }
fn set_options(
&self,
media: &str,
dynamic: bool,
encoding_name: &str,
clock_rate: u32,
) { ... }
fn set_source_info_enabled(&self, enable: bool) { ... }
fn is_auto_header_extension(&self) -> bool { ... }
fn set_auto_header_extension(&self, auto_header_extension: bool) { ... }
fn max_ptime(&self) -> i64 { ... }
fn set_max_ptime(&self, max_ptime: i64) { ... }
fn min_ptime(&self) -> i64 { ... }
fn set_min_ptime(&self, min_ptime: i64) { ... }
fn mtu(&self) -> u32 { ... }
fn set_mtu(&self, mtu: u32) { ... }
fn is_onvif_no_rate_control(&self) -> bool { ... }
fn set_onvif_no_rate_control(&self, onvif_no_rate_control: bool) { ... }
fn is_perfect_rtptime(&self) -> bool { ... }
fn set_perfect_rtptime(&self, perfect_rtptime: bool) { ... }
fn pt(&self) -> u32 { ... }
fn set_pt(&self, pt: u32) { ... }
fn ptime_multiple(&self) -> i64 { ... }
fn set_ptime_multiple(&self, ptime_multiple: i64) { ... }
fn is_scale_rtptime(&self) -> bool { ... }
fn set_scale_rtptime(&self, scale_rtptime: bool) { ... }
fn seqnum(&self) -> u32 { ... }
fn seqnum_offset(&self) -> i32 { ... }
fn set_seqnum_offset(&self, seqnum_offset: i32) { ... }
fn is_source_info(&self) -> bool { ... }
fn set_source_info(&self, source_info: bool) { ... }
fn ssrc(&self) -> u32 { ... }
fn set_ssrc(&self, ssrc: u32) { ... }
fn stats(&self) -> Option<Structure> { ... }
fn timestamp(&self) -> u32 { ... }
fn timestamp_offset(&self) -> u32 { ... }
fn set_timestamp_offset(&self, timestamp_offset: u32) { ... }
fn connect_add_extension<F: Fn(&Self, &RTPHeaderExtension) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn emit_add_extension(&self, ext: &RTPHeaderExtension) { ... }
fn connect_clear_extensions<F: Fn(&Self) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn emit_clear_extensions(&self) { ... }
fn connect_request_extension<F: Fn(&Self, u32, &str) -> Option<RTPHeaderExtension> + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_auto_header_extension_notify<F: Fn(&Self) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_max_ptime_notify<F: Fn(&Self) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_min_ptime_notify<F: Fn(&Self) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_mtu_notify<F: Fn(&Self) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_onvif_no_rate_control_notify<F: Fn(&Self) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_perfect_rtptime_notify<F: Fn(&Self) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_pt_notify<F: Fn(&Self) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_ptime_multiple_notify<F: Fn(&Self) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_scale_rtptime_notify<F: Fn(&Self) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_seqnum_notify<F: Fn(&Self) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_seqnum_offset_notify<F: Fn(&Self) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_source_info_notify<F: Fn(&Self) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_ssrc_notify<F: Fn(&Self) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_stats_notify<F: Fn(&Self) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_timestamp_notify<F: Fn(&Self) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_timestamp_offset_notify<F: Fn(&Self) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
}
Expand description
Provided Methods§
sourcefn allocate_output_buffer(
&self,
payload_len: u32,
pad_len: u8,
csrc_count: u8,
) -> Buffer
fn allocate_output_buffer( &self, payload_len: u32, pad_len: u8, csrc_count: u8, ) -> Buffer
Allocate a new gst::Buffer
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 self
has source-info
true
additional
CSRCs may be allocated and filled with RTP source information.
§payload_len
the length of the payload
§pad_len
the amount of padding
§csrc_count
the minimum number of CSRC entries
§Returns
A newly allocated buffer that can hold an RTP packet with given parameters.
sourcefn source_count(&self, buffer: &Buffer) -> u32
fn source_count(&self, buffer: &Buffer) -> u32
Count the total number of RTP sources found in the meta of buffer
, which
will be automically added by allocate_output_buffer()
.
If source-info
is false
the count will be 0.
§buffer
a gst::Buffer
, typically the buffer to payload
§Returns
The number of sources.
sourcefn is_source_info_enabled(&self) -> bool
fn is_source_info_enabled(&self) -> bool
sourcefn push(&self, buffer: Buffer) -> Result<FlowSuccess, FlowError>
fn push(&self, buffer: Buffer) -> Result<FlowSuccess, FlowError>
sourcefn push_list(&self, list: BufferList) -> Result<FlowSuccess, FlowError>
fn push_list(&self, list: BufferList) -> Result<FlowSuccess, FlowError>
sourcefn set_options(
&self,
media: &str,
dynamic: bool,
encoding_name: &str,
clock_rate: u32,
)
fn set_options( &self, media: &str, dynamic: bool, encoding_name: &str, clock_rate: u32, )
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
push()
or gst_rtp_base_payload_set_outcaps()
.
§media
the media type (typically “audio” or “video”)
§dynamic
if the payload type is dynamic
§encoding_name
the encoding name
§clock_rate
the clock rate of the media
sourcefn set_source_info_enabled(&self, enable: bool)
fn set_source_info_enabled(&self, enable: bool)
Enable or disable adding contributing sources to RTP packets from
GstRTPSourceMeta
.
§enable
whether to add contributing sources to RTP packets
sourcefn is_auto_header_extension(&self) -> bool
fn is_auto_header_extension(&self) -> bool
If enabled, the payloader will automatically try to enable all the RTP header extensions provided in the src caps, saving the application the need to handle these extensions manually using the GstRTPBasePayload::request-extension: signal.
sourcefn set_auto_header_extension(&self, auto_header_extension: bool)
fn set_auto_header_extension(&self, auto_header_extension: bool)
If enabled, the payloader will automatically try to enable all the RTP header extensions provided in the src caps, saving the application the need to handle these extensions manually using the GstRTPBasePayload::request-extension: signal.
fn max_ptime(&self) -> i64
fn set_max_ptime(&self, max_ptime: i64)
sourcefn set_min_ptime(&self, min_ptime: i64)
fn set_min_ptime(&self, min_ptime: i64)
Minimum duration of the packet data in ns (can’t go above MTU)
fn mtu(&self) -> u32
fn set_mtu(&self, mtu: u32)
sourcefn is_onvif_no_rate_control(&self) -> bool
fn is_onvif_no_rate_control(&self) -> bool
Make the payloader timestamp packets according to the Rate-Control=no behaviour specified in the ONVIF replay spec.
sourcefn set_onvif_no_rate_control(&self, onvif_no_rate_control: bool)
fn set_onvif_no_rate_control(&self, onvif_no_rate_control: bool)
Make the payloader timestamp packets according to the Rate-Control=no behaviour specified in the ONVIF replay spec.
sourcefn is_perfect_rtptime(&self) -> bool
fn is_perfect_rtptime(&self) -> bool
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.
sourcefn set_perfect_rtptime(&self, perfect_rtptime: bool)
fn set_perfect_rtptime(&self, perfect_rtptime: bool)
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.
fn pt(&self) -> u32
fn set_pt(&self, pt: u32)
sourcefn ptime_multiple(&self) -> i64
fn ptime_multiple(&self) -> i64
Force buffers to be multiples of this duration in ns (0 disables)
sourcefn set_ptime_multiple(&self, ptime_multiple: i64)
fn set_ptime_multiple(&self, ptime_multiple: i64)
Force buffers to be multiples of this duration in ns (0 disables)
sourcefn is_scale_rtptime(&self) -> bool
fn is_scale_rtptime(&self) -> bool
Make the RTP packets’ timestamps be scaled with the segment’s rate (corresponding to RTSP speed parameter). Disabling this property means the timestamps will not be affected by the set delivery speed (RTSP speed).
Example: A server wants to allow streaming a recorded video in double speed but still have the timestamps correspond to the position in the video. This is achieved by the client setting RTSP Speed to 2 while the server has this property disabled.
sourcefn set_scale_rtptime(&self, scale_rtptime: bool)
fn set_scale_rtptime(&self, scale_rtptime: bool)
Make the RTP packets’ timestamps be scaled with the segment’s rate (corresponding to RTSP speed parameter). Disabling this property means the timestamps will not be affected by the set delivery speed (RTSP speed).
Example: A server wants to allow streaming a recorded video in double speed but still have the timestamps correspond to the position in the video. This is achieved by the client setting RTSP Speed to 2 while the server has this property disabled.
fn seqnum(&self) -> u32
fn seqnum_offset(&self) -> i32
fn set_seqnum_offset(&self, seqnum_offset: i32)
sourcefn is_source_info(&self) -> bool
fn is_source_info(&self) -> bool
Enable writing the CSRC field in allocated RTP header based on RTP source
information found in the input buffer’s GstRTPSourceMeta
.
sourcefn set_source_info(&self, source_info: bool)
fn set_source_info(&self, source_info: bool)
Enable writing the CSRC field in allocated RTP header based on RTP source
information found in the input buffer’s GstRTPSourceMeta
.
fn ssrc(&self) -> u32
fn set_ssrc(&self, ssrc: u32)
sourcefn stats(&self) -> Option<Structure>
fn stats(&self) -> Option<Structure>
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 streamrunning-time
:G_TYPE_UINT64
, running timeseqnum
:G_TYPE_UINT
, sequence number, same asseqnum
timestamp
:G_TYPE_UINT
, RTP timestamp, same astimestamp
ssrc
:G_TYPE_UINT
, The SSRC in usept
:G_TYPE_UINT
, The Payload type in use, same aspt
seqnum-offset
:G_TYPE_UINT
, The current offset added to the seqnumtimestamp-offset
:G_TYPE_UINT
, The current offset added to the timestamp
fn timestamp(&self) -> u32
fn timestamp_offset(&self) -> u32
fn set_timestamp_offset(&self, timestamp_offset: u32)
sourcefn connect_add_extension<F: Fn(&Self, &RTPHeaderExtension) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId
fn connect_add_extension<F: Fn(&Self, &RTPHeaderExtension) + Send + Sync + 'static>( &self, f: F, ) -> SignalHandlerId
Add ext
as an extension for writing part of an RTP header extension onto
outgoing RTP packets.
§ext
fn emit_add_extension(&self, ext: &RTPHeaderExtension)
sourcefn connect_clear_extensions<F: Fn(&Self) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId
fn connect_clear_extensions<F: Fn(&Self) + Send + Sync + 'static>( &self, f: F, ) -> SignalHandlerId
Clear all RTP header extensions used by this payloader.
fn emit_clear_extensions(&self)
sourcefn connect_request_extension<F: Fn(&Self, u32, &str) -> Option<RTPHeaderExtension> + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId
fn connect_request_extension<F: Fn(&Self, u32, &str) -> Option<RTPHeaderExtension> + Send + Sync + 'static>( &self, f: F, ) -> SignalHandlerId
The returned ext
must be configured with the correct ext_id
and with the
necessary attributes as required by the extension implementation.
§ext_id
the extension id being requested
§ext_uri
the extension URI being requested
§Returns
the RTPHeaderExtension
for ext_id
, or None