mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-11-26 21:41:03 +00:00
Update jitterbuffer.rs + clippy pass
This commit is contained in:
parent
dfbc0d3975
commit
688357a474
2 changed files with 13 additions and 1 deletions
|
@ -45,7 +45,7 @@ use std::time::Duration;
|
||||||
use crate::runtime::prelude::*;
|
use crate::runtime::prelude::*;
|
||||||
use crate::runtime::{Context, PadContext, PadContextWeak, PadSink, PadSinkRef, PadSrc, PadSrcRef};
|
use crate::runtime::{Context, PadContext, PadContextWeak, PadSink, PadSinkRef, PadSrc, PadSrcRef};
|
||||||
|
|
||||||
use crate::{RTPJitterBuffer, RTPJitterBufferItem, RTPPacketRateCtx};
|
use super::{RTPJitterBuffer, RTPJitterBufferItem, RTPPacketRateCtx};
|
||||||
|
|
||||||
const DEFAULT_LATENCY_MS: u32 = 200;
|
const DEFAULT_LATENCY_MS: u32 = 200;
|
||||||
const DEFAULT_DO_LOST: bool = false;
|
const DEFAULT_DO_LOST: bool = false;
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
use glib_sys as glib_ffi;
|
use glib_sys as glib_ffi;
|
||||||
use gstreamer_sys as gst_ffi;
|
use gstreamer_sys as gst_ffi;
|
||||||
|
|
||||||
|
#[allow(clippy::module_inception)]
|
||||||
pub mod jitterbuffer;
|
pub mod jitterbuffer;
|
||||||
|
|
||||||
pub mod ffi {
|
pub mod ffi {
|
||||||
|
@ -64,11 +65,15 @@ pub mod ffi {
|
||||||
extern "C" {
|
extern "C" {
|
||||||
pub fn rtp_jitter_buffer_new() -> *mut RTPJitterBuffer;
|
pub fn rtp_jitter_buffer_new() -> *mut RTPJitterBuffer;
|
||||||
pub fn rtp_jitter_buffer_get_type() -> GType;
|
pub fn rtp_jitter_buffer_get_type() -> GType;
|
||||||
|
#[allow(dead_code)]
|
||||||
pub fn rtp_jitter_buffer_get_mode(jbuf: *mut RTPJitterBuffer) -> RTPJitterBufferMode;
|
pub fn rtp_jitter_buffer_get_mode(jbuf: *mut RTPJitterBuffer) -> RTPJitterBufferMode;
|
||||||
|
#[allow(dead_code)]
|
||||||
pub fn rtp_jitter_buffer_set_mode(jbuf: *mut RTPJitterBuffer, mode: RTPJitterBufferMode);
|
pub fn rtp_jitter_buffer_set_mode(jbuf: *mut RTPJitterBuffer, mode: RTPJitterBufferMode);
|
||||||
|
#[allow(dead_code)]
|
||||||
pub fn rtp_jitter_buffer_get_delay(jbuf: *mut RTPJitterBuffer) -> GstClockTime;
|
pub fn rtp_jitter_buffer_get_delay(jbuf: *mut RTPJitterBuffer) -> GstClockTime;
|
||||||
pub fn rtp_jitter_buffer_set_delay(jbuf: *mut RTPJitterBuffer, delay: GstClockTime);
|
pub fn rtp_jitter_buffer_set_delay(jbuf: *mut RTPJitterBuffer, delay: GstClockTime);
|
||||||
pub fn rtp_jitter_buffer_set_clock_rate(jbuf: *mut RTPJitterBuffer, clock_rate: c_uint);
|
pub fn rtp_jitter_buffer_set_clock_rate(jbuf: *mut RTPJitterBuffer, clock_rate: c_uint);
|
||||||
|
#[allow(dead_code)]
|
||||||
pub fn rtp_jitter_buffer_get_clock_rate(jbuf: *mut RTPJitterBuffer) -> c_uint;
|
pub fn rtp_jitter_buffer_get_clock_rate(jbuf: *mut RTPJitterBuffer) -> c_uint;
|
||||||
pub fn rtp_jitter_buffer_reset_skew(jbuf: *mut RTPJitterBuffer);
|
pub fn rtp_jitter_buffer_reset_skew(jbuf: *mut RTPJitterBuffer);
|
||||||
|
|
||||||
|
@ -109,6 +114,7 @@ pub mod ffi {
|
||||||
ctx: *mut RTPPacketRateCtx,
|
ctx: *mut RTPPacketRateCtx,
|
||||||
time_ms: c_int,
|
time_ms: c_int,
|
||||||
) -> c_uint;
|
) -> c_uint;
|
||||||
|
#[allow(dead_code)]
|
||||||
pub fn gst_rtp_packet_rate_ctx_get_max_disorder(
|
pub fn gst_rtp_packet_rate_ctx_get_max_disorder(
|
||||||
ctx: *mut RTPPacketRateCtx,
|
ctx: *mut RTPPacketRateCtx,
|
||||||
time_ms: c_int,
|
time_ms: c_int,
|
||||||
|
@ -221,6 +227,7 @@ impl RTPJitterBufferItem {
|
||||||
item.seqnum
|
item.seqnum
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(dead_code)]
|
||||||
pub fn get_rtptime(&self) -> u32 {
|
pub fn get_rtptime(&self) -> u32 {
|
||||||
let item = self.0.as_ref().expect("Invalid wrapper");
|
let item = self.0.as_ref().expect("Invalid wrapper");
|
||||||
item.rtptime
|
item.rtptime
|
||||||
|
@ -262,6 +269,7 @@ impl RTPPacketRateCtx {
|
||||||
unsafe { ffi::gst_rtp_packet_rate_ctx_get_max_dropout(&mut *self.0, time_ms) }
|
unsafe { ffi::gst_rtp_packet_rate_ctx_get_max_dropout(&mut *self.0, time_ms) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(dead_code)]
|
||||||
pub fn get_max_disorder(&mut self, time_ms: i32) -> u32 {
|
pub fn get_max_disorder(&mut self, time_ms: i32) -> u32 {
|
||||||
unsafe { ffi::gst_rtp_packet_rate_ctx_get_max_disorder(&mut *self.0, time_ms) }
|
unsafe { ffi::gst_rtp_packet_rate_ctx_get_max_disorder(&mut *self.0, time_ms) }
|
||||||
}
|
}
|
||||||
|
@ -287,14 +295,17 @@ impl RTPJitterBuffer {
|
||||||
unsafe { from_glib_full(ffi::rtp_jitter_buffer_new()) }
|
unsafe { from_glib_full(ffi::rtp_jitter_buffer_new()) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(dead_code)]
|
||||||
pub fn get_mode(&self) -> RTPJitterBufferMode {
|
pub fn get_mode(&self) -> RTPJitterBufferMode {
|
||||||
unsafe { from_glib(ffi::rtp_jitter_buffer_get_mode(self.to_glib_none().0)) }
|
unsafe { from_glib(ffi::rtp_jitter_buffer_get_mode(self.to_glib_none().0)) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(dead_code)]
|
||||||
pub fn set_mode(&self, mode: RTPJitterBufferMode) {
|
pub fn set_mode(&self, mode: RTPJitterBufferMode) {
|
||||||
unsafe { ffi::rtp_jitter_buffer_set_mode(self.to_glib_none().0, mode.to_glib()) }
|
unsafe { ffi::rtp_jitter_buffer_set_mode(self.to_glib_none().0, mode.to_glib()) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(dead_code)]
|
||||||
pub fn get_delay(&self) -> gst::ClockTime {
|
pub fn get_delay(&self) -> gst::ClockTime {
|
||||||
unsafe { from_glib(ffi::rtp_jitter_buffer_get_delay(self.to_glib_none().0)) }
|
unsafe { from_glib(ffi::rtp_jitter_buffer_get_delay(self.to_glib_none().0)) }
|
||||||
}
|
}
|
||||||
|
@ -307,6 +318,7 @@ impl RTPJitterBuffer {
|
||||||
unsafe { ffi::rtp_jitter_buffer_set_clock_rate(self.to_glib_none().0, clock_rate) }
|
unsafe { ffi::rtp_jitter_buffer_set_clock_rate(self.to_glib_none().0, clock_rate) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(dead_code)]
|
||||||
pub fn get_clock_rate(&self) -> u32 {
|
pub fn get_clock_rate(&self) -> u32 {
|
||||||
unsafe { ffi::rtp_jitter_buffer_get_clock_rate(self.to_glib_none().0) }
|
unsafe { ffi::rtp_jitter_buffer_get_clock_rate(self.to_glib_none().0) }
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue