mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-26 03:21:03 +00:00
base: Fix all clippy::use_self warnings
This commit is contained in:
parent
980304ce36
commit
a36fe2a3f5
3 changed files with 14 additions and 17 deletions
|
@ -256,8 +256,8 @@ unsafe impl Send for UniqueAdapter {}
|
||||||
unsafe impl Sync for UniqueAdapter {}
|
unsafe impl Sync for UniqueAdapter {}
|
||||||
|
|
||||||
impl UniqueAdapter {
|
impl UniqueAdapter {
|
||||||
pub fn new() -> UniqueAdapter {
|
pub fn new() -> Self {
|
||||||
UniqueAdapter(Adapter::new())
|
Self(Adapter::new())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn available(&self) -> usize {
|
pub fn available(&self) -> usize {
|
||||||
|
|
|
@ -30,21 +30,21 @@ impl IntoGlib for Overhead {
|
||||||
|
|
||||||
fn into_glib(self) -> i32 {
|
fn into_glib(self) -> i32 {
|
||||||
match self {
|
match self {
|
||||||
Overhead::None => 0,
|
Self::None => 0,
|
||||||
Overhead::Frame => -1,
|
Self::Frame => -1,
|
||||||
Overhead::Bytes(b) => i32::try_from(b).expect("overhead is higher than i32::MAX"),
|
Self::Bytes(b) => i32::try_from(b).expect("overhead is higher than i32::MAX"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl FromGlib<i32> for Overhead {
|
impl FromGlib<i32> for Overhead {
|
||||||
#[inline]
|
#[inline]
|
||||||
unsafe fn from_glib(val: i32) -> Overhead {
|
unsafe fn from_glib(val: i32) -> Self {
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
match val {
|
match val {
|
||||||
0 => Overhead::None,
|
0 => Self::None,
|
||||||
1 => Overhead::Frame,
|
1 => Self::Frame,
|
||||||
b if b > 0 => Overhead::Bytes(val as u32),
|
b if b > 0 => Self::Bytes(val as u32),
|
||||||
_ => panic!("overheader is lower than -1"),
|
_ => panic!("overheader is lower than -1"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -78,13 +78,10 @@ impl<'a> fmt::Debug for BaseParseFrame<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> BaseParseFrame<'a> {
|
impl<'a> BaseParseFrame<'a> {
|
||||||
pub(crate) unsafe fn new(
|
pub(crate) unsafe fn new(frame: *mut ffi::GstBaseParseFrame, _parse: &'a BaseParse) -> Self {
|
||||||
frame: *mut ffi::GstBaseParseFrame,
|
|
||||||
_parse: &'a BaseParse,
|
|
||||||
) -> BaseParseFrame<'a> {
|
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
assert!(!frame.is_null());
|
assert!(!frame.is_null());
|
||||||
BaseParseFrame(ptr::NonNull::new_unchecked(frame), PhantomData)
|
Self(ptr::NonNull::new_unchecked(frame), PhantomData)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn buffer(&self) -> Option<&gst::BufferRef> {
|
pub fn buffer(&self) -> Option<&gst::BufferRef> {
|
||||||
|
|
|
@ -31,7 +31,7 @@ glib::wrapper! {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl FlowCombiner {
|
impl FlowCombiner {
|
||||||
pub fn new() -> FlowCombiner {
|
pub fn new() -> Self {
|
||||||
assert_initialized_main_thread!();
|
assert_initialized_main_thread!();
|
||||||
unsafe { from_glib_full(ffi::gst_flow_combiner_new()) }
|
unsafe { from_glib_full(ffi::gst_flow_combiner_new()) }
|
||||||
}
|
}
|
||||||
|
@ -104,8 +104,8 @@ unsafe impl Sync for UniqueFlowCombiner {}
|
||||||
unsafe impl Send for UniqueFlowCombiner {}
|
unsafe impl Send for UniqueFlowCombiner {}
|
||||||
|
|
||||||
impl UniqueFlowCombiner {
|
impl UniqueFlowCombiner {
|
||||||
pub fn new() -> UniqueFlowCombiner {
|
pub fn new() -> Self {
|
||||||
UniqueFlowCombiner(FlowCombiner::new())
|
Self(FlowCombiner::new())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn add_pad<P: IsA<gst::Pad>>(&mut self, pad: &P) {
|
pub fn add_pad<P: IsA<gst::Pad>>(&mut self, pad: &P) {
|
||||||
|
|
Loading…
Reference in a new issue