mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-12-18 08:06:31 +00:00
Fix / silence various new Rust 1.83 clippy warnings
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1954>
This commit is contained in:
parent
9e59efd9d6
commit
6aeb3f2af2
26 changed files with 43 additions and 51 deletions
|
@ -77,7 +77,7 @@ impl<'a> Iterator for RingBufferIter<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> Drop for RingBufferIter<'a> {
|
||||
impl Drop for RingBufferIter<'_> {
|
||||
fn drop(&mut self) {
|
||||
*self.buffer_pos = self.write_pos;
|
||||
}
|
||||
|
|
|
@ -90,7 +90,7 @@ mod imp {
|
|||
pub(super) fn original_buffer_meta_api_get_type() -> glib::Type {
|
||||
static TYPE: LazyLock<glib::Type> = LazyLock::new(|| unsafe {
|
||||
let t = from_glib(gst::ffi::gst_meta_api_type_register(
|
||||
b"GstOriginalBufferMetaAPI\0".as_ptr() as *const _,
|
||||
c"GstOriginalBufferMetaAPI".as_ptr() as *const _,
|
||||
[ptr::null::<std::os::raw::c_char>()].as_ptr() as *mut *const _,
|
||||
));
|
||||
|
||||
|
@ -161,7 +161,7 @@ mod imp {
|
|||
MetaInfo(
|
||||
ptr::NonNull::new(gst::ffi::gst_meta_register(
|
||||
original_buffer_meta_api_get_type().into_glib(),
|
||||
b"OriginalBufferMeta\0".as_ptr() as *const _,
|
||||
c"OriginalBufferMeta".as_ptr() as *const _,
|
||||
mem::size_of::<OriginalBufferMeta>(),
|
||||
Some(original_buffer_meta_init),
|
||||
Some(original_buffer_meta_free),
|
||||
|
|
|
@ -303,7 +303,7 @@ impl Encrypter {
|
|||
};
|
||||
|
||||
// calculate the number of chunks that exist in the stream
|
||||
let total_chunks = (size + state.block_size as u64 - 1) / state.block_size as u64;
|
||||
let total_chunks = size.div_ceil(state.block_size as u64);
|
||||
// add the MAC of each block
|
||||
let size = size + total_chunks * box_::MACBYTES as u64;
|
||||
|
||||
|
|
|
@ -65,10 +65,8 @@ impl State {
|
|||
use std::collections::btree_map::Entry::{Occupied, Vacant};
|
||||
match self.streams_by_number.entry(number) {
|
||||
Occupied(_) => panic!("Stream {number} already exists!"),
|
||||
Vacant(entry) => {
|
||||
return entry.insert(stream);
|
||||
Vacant(entry) => entry.insert(stream),
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
fn remove_stream_or_panic(&mut self, number: usize) {
|
||||
|
|
|
@ -6,13 +6,11 @@
|
|||
//! A collection of GStreamer plugins which leverage the `threadshare` [`runtime`].
|
||||
//!
|
||||
//! [`runtime`]: runtime/index.html
|
||||
|
||||
/**
|
||||
* plugin-threadshare:
|
||||
*
|
||||
* Since: plugins-rs-0.4.0
|
||||
*/
|
||||
|
||||
#[macro_use]
|
||||
pub mod runtime;
|
||||
|
||||
|
|
|
@ -318,7 +318,7 @@ pub struct PadSrcRef<'a> {
|
|||
phantom: PhantomData<&'a Self>,
|
||||
}
|
||||
|
||||
impl<'a> PadSrcRef<'a> {
|
||||
impl PadSrcRef<'_> {
|
||||
fn new(inner_arc: Arc<PadSrcInner>) -> Self {
|
||||
PadSrcRef {
|
||||
strong: inner_arc,
|
||||
|
@ -331,7 +331,7 @@ impl<'a> PadSrcRef<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> Deref for PadSrcRef<'a> {
|
||||
impl Deref for PadSrcRef<'_> {
|
||||
type Target = PadSrcInner;
|
||||
|
||||
fn deref(&self) -> &Self::Target {
|
||||
|
@ -712,7 +712,7 @@ pub struct PadSinkRef<'a> {
|
|||
phantom: PhantomData<&'a Self>,
|
||||
}
|
||||
|
||||
impl<'a> PadSinkRef<'a> {
|
||||
impl PadSinkRef<'_> {
|
||||
fn new(inner_arc: Arc<PadSinkInner>) -> Self {
|
||||
PadSinkRef {
|
||||
strong: inner_arc,
|
||||
|
@ -725,7 +725,7 @@ impl<'a> PadSinkRef<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> Deref for PadSinkRef<'a> {
|
||||
impl Deref for PadSinkRef<'_> {
|
||||
type Target = PadSinkInner;
|
||||
|
||||
fn deref(&self) -> &Self::Target {
|
||||
|
|
|
@ -1324,10 +1324,10 @@ impl FMP4Mux {
|
|||
let fragment_end_pts = fragment_start_pts + settings.fragment_duration;
|
||||
|
||||
// If we have a manual fragment boundary set then use that
|
||||
return *manual_fragment_boundaries
|
||||
*manual_fragment_boundaries
|
||||
.range((Excluded(fragment_start_pts), Excluded(fragment_end_pts)))
|
||||
.next()
|
||||
.unwrap_or(&fragment_end_pts);
|
||||
.unwrap_or(&fragment_end_pts)
|
||||
}
|
||||
|
||||
/// Check if the stream is filled enough for the current chunk / fragment.
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
*
|
||||
* Since: plugins-rs-0.9
|
||||
*/
|
||||
|
||||
#[allow(dead_code)]
|
||||
mod ndi;
|
||||
#[allow(dead_code)]
|
||||
|
|
|
@ -23,7 +23,7 @@ pub struct FindBuilder<'a> {
|
|||
extra_ips: Option<&'a str>,
|
||||
}
|
||||
|
||||
impl<'a> Default for FindBuilder<'a> {
|
||||
impl Default for FindBuilder<'_> {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
show_local_sources: true,
|
||||
|
@ -129,10 +129,10 @@ pub enum Source<'a> {
|
|||
Owned(NDIlib_source_t, ffi::CString, ffi::CString),
|
||||
}
|
||||
|
||||
unsafe impl<'a> Send for Source<'a> {}
|
||||
unsafe impl<'a> Sync for Source<'a> {}
|
||||
unsafe impl Send for Source<'_> {}
|
||||
unsafe impl Sync for Source<'_> {}
|
||||
|
||||
impl<'a> Source<'a> {
|
||||
impl Source<'_> {
|
||||
pub fn ndi_name(&self) -> &str {
|
||||
unsafe {
|
||||
let ptr = match *self {
|
||||
|
@ -198,7 +198,7 @@ pub struct RecvBuilder<'a> {
|
|||
ndi_recv_name: &'a str,
|
||||
}
|
||||
|
||||
impl<'a> RecvBuilder<'a> {
|
||||
impl RecvBuilder<'_> {
|
||||
pub fn allow_video_fields(self, allow_video_fields: bool) -> Self {
|
||||
Self {
|
||||
allow_video_fields,
|
||||
|
@ -362,7 +362,7 @@ pub struct SendBuilder<'a> {
|
|||
clock_video: bool,
|
||||
}
|
||||
|
||||
impl<'a> SendBuilder<'a> {
|
||||
impl SendBuilder<'_> {
|
||||
pub fn clock_audio(self) -> Self {
|
||||
Self {
|
||||
clock_audio: true,
|
||||
|
|
|
@ -70,7 +70,7 @@ mod imp {
|
|||
pub(super) fn ndi_sink_audio_meta_api_get_type() -> glib::Type {
|
||||
static TYPE: LazyLock<glib::Type> = LazyLock::new(|| unsafe {
|
||||
let t = from_glib(gst::ffi::gst_meta_api_type_register(
|
||||
b"GstNdiSinkAudioMetaAPI\0".as_ptr() as *const _,
|
||||
c"GstNdiSinkAudioMetaAPI".as_ptr() as *const _,
|
||||
[ptr::null::<std::os::raw::c_char>()].as_ptr() as *mut *const _,
|
||||
));
|
||||
|
||||
|
@ -129,7 +129,7 @@ mod imp {
|
|||
MetaInfo(
|
||||
ptr::NonNull::new(gst::ffi::gst_meta_register(
|
||||
ndi_sink_audio_meta_api_get_type().into_glib(),
|
||||
b"GstNdiSinkAudioMeta\0".as_ptr() as *const _,
|
||||
c"GstNdiSinkAudioMeta".as_ptr() as *const _,
|
||||
mem::size_of::<NdiSinkAudioMeta>(),
|
||||
Some(ndi_sink_audio_meta_init),
|
||||
Some(ndi_sink_audio_meta_free),
|
||||
|
|
|
@ -95,7 +95,7 @@ mod imp {
|
|||
pub(super) fn ndi_src_meta_api_get_type() -> glib::Type {
|
||||
static TYPE: LazyLock<glib::Type> = LazyLock::new(|| unsafe {
|
||||
let t = from_glib(gst::ffi::gst_meta_api_type_register(
|
||||
b"GstNdiSrcMetaAPI\0".as_ptr() as *const _,
|
||||
c"GstNdiSrcMetaAPI".as_ptr() as *const _,
|
||||
[ptr::null::<std::os::raw::c_char>()].as_ptr() as *mut *const _,
|
||||
));
|
||||
|
||||
|
@ -150,7 +150,7 @@ mod imp {
|
|||
MetaInfo(
|
||||
ptr::NonNull::new(gst::ffi::gst_meta_register(
|
||||
ndi_src_meta_api_get_type().into_glib(),
|
||||
b"GstNdiSrcMeta\0".as_ptr() as *const _,
|
||||
c"GstNdiSrcMeta".as_ptr() as *const _,
|
||||
mem::size_of::<NdiSrcMeta>(),
|
||||
Some(ndi_src_meta_init),
|
||||
Some(ndi_src_meta_free),
|
||||
|
|
|
@ -81,7 +81,7 @@ mod imp {
|
|||
|
||||
*TYPE.get_or_init(|| unsafe {
|
||||
let t = glib::Type::from_glib(gst::ffi::gst_meta_api_type_register(
|
||||
b"QuinnQuicMetaAPI\0".as_ptr() as *const _,
|
||||
c"QuinnQuicMetaAPI".as_ptr() as *const _,
|
||||
[ptr::null::<std::os::raw::c_int>()].as_ptr() as *mut *const _,
|
||||
));
|
||||
|
||||
|
@ -147,7 +147,7 @@ mod imp {
|
|||
MetaInfo(
|
||||
ptr::NonNull::new(gst::ffi::gst_meta_register(
|
||||
custom_meta_api_get_type().into_glib(),
|
||||
b"QuinnQuicMeta\0".as_ptr() as *const _,
|
||||
c"QuinnQuicMeta".as_ptr() as *const _,
|
||||
mem::size_of::<QuinnQuicMeta>(),
|
||||
Some(custom_meta_init),
|
||||
Some(custom_meta_free),
|
||||
|
|
|
@ -576,7 +576,7 @@ impl RaptorqEnc {
|
|||
// it SHALL be the same for all repair packets in a block. This include
|
||||
// 1 byte of flow indication and 2 bytes of length indication as defined
|
||||
// in RFC6881, section 8.2.4.
|
||||
let symbols_per_packet = (mtu + 3 + symbol_size - 1) / symbol_size;
|
||||
let symbols_per_packet = (mtu + 3).div_ceil(symbol_size);
|
||||
let symbols_per_block = symbols_per_packet * protected_packets_num;
|
||||
|
||||
if symbol_size.rem_euclid(SYMBOL_ALIGNMENT) != 0 {
|
||||
|
|
|
@ -530,7 +530,7 @@ impl RtpAc3Pay {
|
|||
};
|
||||
|
||||
// The number fragments (and therefore packets) that make up the current frame
|
||||
let n = (first.header.frame_len + max_payload_size - 1) / max_payload_size;
|
||||
let n = first.header.frame_len.div_ceil(max_payload_size);
|
||||
|
||||
let ac3_specific_header = ((frame_type << 8) | (n as u16)).to_be_bytes();
|
||||
|
||||
|
|
|
@ -151,7 +151,7 @@ impl FromByteStream for RestartHeader {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> ToByteStreamWith<'a> for RestartHeader {
|
||||
impl ToByteStreamWith<'_> for RestartHeader {
|
||||
type Error = anyhow::Error;
|
||||
|
||||
type Context = MainHeader;
|
||||
|
@ -216,7 +216,7 @@ impl Default for QuantizationTableHeader {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> FromByteStreamWith<'a> for QuantizationTableHeader {
|
||||
impl FromByteStreamWith<'_> for QuantizationTableHeader {
|
||||
type Error = anyhow::Error;
|
||||
type Context = MainHeader;
|
||||
|
||||
|
@ -267,7 +267,7 @@ impl<'a> FromByteStreamWith<'a> for QuantizationTableHeader {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> ToByteStreamWith<'a> for QuantizationTableHeader {
|
||||
impl ToByteStreamWith<'_> for QuantizationTableHeader {
|
||||
type Error = anyhow::Error;
|
||||
|
||||
type Context = MainHeader;
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
*
|
||||
* Since: plugins-rs-0.9.0
|
||||
*/
|
||||
|
||||
#[macro_use]
|
||||
extern crate log;
|
||||
|
||||
|
|
|
@ -265,7 +265,7 @@ impl<'a> Subframes<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> Iterator for Subframes<'a> {
|
||||
impl Iterator for Subframes<'_> {
|
||||
type Item = Result<gst::Buffer, MPEG4AudioParserError>;
|
||||
|
||||
fn next(&mut self) -> Option<Self::Item> {
|
||||
|
|
|
@ -159,7 +159,7 @@ pub struct AccessUnitIter<'a> {
|
|||
cur: u32,
|
||||
}
|
||||
|
||||
impl<'a> Iterator for AccessUnitIter<'a> {
|
||||
impl Iterator for AccessUnitIter<'_> {
|
||||
type Item = anyhow::Result<AccessUnit>;
|
||||
|
||||
fn next(&mut self) -> Option<Self::Item> {
|
||||
|
@ -172,7 +172,7 @@ impl<'a> Iterator for AccessUnitIter<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> AccessUnitIter<'a> {
|
||||
impl AccessUnitIter<'_> {
|
||||
fn next_priv(&mut self) -> Option<anyhow::Result<AccessUnit>> {
|
||||
use Mpeg4GenericDepayError::*;
|
||||
|
||||
|
|
|
@ -240,7 +240,7 @@ fn generic_fragmented() {
|
|||
const BUFFER_SIZE: usize = 2000;
|
||||
const MTU: usize = 1400;
|
||||
// Enough overhead in the MTU to use this approximation:
|
||||
const FRAGMENTS_PER_BUFFER: usize = (BUFFER_SIZE + MTU - 1) / MTU;
|
||||
const FRAGMENTS_PER_BUFFER: usize = BUFFER_SIZE.div_ceil(MTU);
|
||||
const RTP_CLOCK_RATE: u64 = 90_000;
|
||||
const LAST_FRAGMENT: usize = FRAGMENTS_PER_BUFFER - 1;
|
||||
const FRAME_RATE: u64 = 30;
|
||||
|
@ -357,7 +357,7 @@ fn generic_variable_au_size() {
|
|||
const AU_NB: usize = 5;
|
||||
const SMALL_AU_SIZE: usize = 500;
|
||||
const LARGE_AU_SIZE: usize = 2000;
|
||||
const FRAGMENTS_PER_LARGE_BUFFER: usize = (LARGE_AU_SIZE + MTU - 1) / MTU;
|
||||
const FRAGMENTS_PER_LARGE_BUFFER: usize = LARGE_AU_SIZE.div_ceil(MTU);
|
||||
const LAST_FRAGMENT: usize = FRAGMENTS_PER_LARGE_BUFFER - 1;
|
||||
const RTP_CLOCK_RATE: u64 = 90_000;
|
||||
const FRAME_RATE: u64 = 30;
|
||||
|
|
|
@ -70,7 +70,7 @@ impl Rb {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> From<ReportBlock<'a>> for Rb {
|
||||
impl From<ReportBlock<'_>> for Rb {
|
||||
fn from(value: ReportBlock) -> Self {
|
||||
Self {
|
||||
ssrc: value.ssrc(),
|
||||
|
|
|
@ -117,7 +117,7 @@ trait BitReadExt: BitRead {
|
|||
|
||||
impl<T: BitRead + ?Sized> BitReadExt for T {}
|
||||
|
||||
impl<'a> FromBitStreamWith<'a> for FrameHeader {
|
||||
impl FromBitStreamWith<'_> for FrameHeader {
|
||||
type Error = anyhow::Error;
|
||||
/// Keyframe?
|
||||
type Context = bool;
|
||||
|
|
|
@ -98,7 +98,7 @@ pub struct KeyframeInfo {
|
|||
pub render_size: Option<(u32, u32)>,
|
||||
}
|
||||
|
||||
impl<'a> FromBitStreamWith<'a> for KeyframeInfo {
|
||||
impl FromBitStreamWith<'_> for KeyframeInfo {
|
||||
type Error = anyhow::Error;
|
||||
|
||||
/// Profile
|
||||
|
@ -173,7 +173,7 @@ pub struct ColorConfig {
|
|||
pub sub_sampling_y: u8,
|
||||
}
|
||||
|
||||
impl<'a> FromBitStreamWith<'a> for ColorConfig {
|
||||
impl FromBitStreamWith<'_> for ColorConfig {
|
||||
type Error = anyhow::Error;
|
||||
|
||||
/// Profile
|
||||
|
|
|
@ -310,7 +310,7 @@ pub struct LayerIndex {
|
|||
pub temporal_layer_zero_index: Option<u8>,
|
||||
}
|
||||
|
||||
impl<'a> FromByteStreamWith<'a> for LayerIndex {
|
||||
impl FromByteStreamWith<'_> for LayerIndex {
|
||||
type Error = anyhow::Error;
|
||||
/// Flexible mode?
|
||||
type Context = bool;
|
||||
|
@ -345,7 +345,7 @@ impl<'a> FromByteStreamWith<'a> for LayerIndex {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> ToByteStreamWith<'a> for LayerIndex {
|
||||
impl ToByteStreamWith<'_> for LayerIndex {
|
||||
type Error = anyhow::Error;
|
||||
|
||||
/// Flexible mode?
|
||||
|
|
|
@ -18,14 +18,12 @@ use crate::signaller::Signallable;
|
|||
* See the [documentation of the plugin](plugin-rswebrtc) for more information
|
||||
* on features and usage.
|
||||
*/
|
||||
|
||||
/**
|
||||
* GstBaseWebRTCSink:
|
||||
* @title: Base class for WebRTC producers
|
||||
*
|
||||
* Base class for WebRTC sinks to implement and provide their own protocol for.
|
||||
*/
|
||||
|
||||
/**
|
||||
* GstRSWebRTCSignallableIface:
|
||||
* @title: Interface for WebRTC signalling protocols
|
||||
|
|
|
@ -604,7 +604,7 @@ impl Dav1dDec {
|
|||
&'s self,
|
||||
mut state_guard: MutexGuard<'s, Option<State>>,
|
||||
drain: bool,
|
||||
) -> Result<MutexGuard<Option<State>>, gst::FlowError> {
|
||||
) -> Result<MutexGuard<'s, Option<State>>, gst::FlowError> {
|
||||
// dav1d wants to have get_picture() called a second time after it return EAGAIN to
|
||||
// actually drain all pending pictures.
|
||||
let mut call_twice = drain;
|
||||
|
|
|
@ -47,8 +47,8 @@ struct Info {
|
|||
frame_count: u32,
|
||||
}
|
||||
|
||||
impl<'a> Decoder<'_> {
|
||||
fn from_data(data: &'a [u8]) -> Option<Self> {
|
||||
impl Decoder<'_> {
|
||||
fn from_data(data: &[u8]) -> Option<Self> {
|
||||
unsafe {
|
||||
let mut options = std::mem::MaybeUninit::zeroed();
|
||||
if ffi::WebPAnimDecoderOptionsInit(options.as_mut_ptr()) == 0 {
|
||||
|
|
Loading…
Reference in a new issue