mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-12-19 08:36:27 +00:00
Fix or silence various new 1.57 clippy warnings
This commit is contained in:
parent
f02322bd80
commit
c46901d150
19 changed files with 37 additions and 122 deletions
|
@ -154,9 +154,9 @@ impl AudioRNNoise {
|
|||
buffer.set_pts(pts);
|
||||
|
||||
let mut out_map = buffer.map_writable().map_err(|_| gst::FlowError::Error)?;
|
||||
let mut out_data = out_map.as_mut_slice_of::<f32>().unwrap();
|
||||
let out_data = out_map.as_mut_slice_of::<f32>().unwrap();
|
||||
|
||||
state.process(in_data, &mut out_data);
|
||||
state.process(in_data, out_data);
|
||||
}
|
||||
|
||||
let srcpad = element.static_pad("src").unwrap();
|
||||
|
@ -189,9 +189,9 @@ impl AudioRNNoise {
|
|||
buffer.set_pts(pts);
|
||||
|
||||
let mut out_map = buffer.map_writable().map_err(|_| gst::FlowError::Error)?;
|
||||
let mut out_data = out_map.as_mut_slice_of::<f32>().unwrap();
|
||||
let out_data = out_map.as_mut_slice_of::<f32>().unwrap();
|
||||
|
||||
state.process(in_data, &mut out_data);
|
||||
state.process(in_data, out_data);
|
||||
}
|
||||
|
||||
Ok(GenerateOutputSuccess::Buffer(buffer))
|
||||
|
|
|
@ -90,6 +90,7 @@ pub(crate) struct FragmentHeaderConfiguration<'a> {
|
|||
start_dts: Option<gst::ClockTime>,
|
||||
end_pts: gst::ClockTime,
|
||||
end_dts: Option<gst::ClockTime>,
|
||||
#[allow(dead_code)]
|
||||
dts_offset: Option<gst::ClockTime>,
|
||||
}
|
||||
|
||||
|
|
|
@ -189,7 +189,7 @@ fn test_pull_range() {
|
|||
|
||||
// get the seeking capabilities
|
||||
let (seekable, start, stop) = q.result();
|
||||
assert_eq!(seekable, true);
|
||||
assert!(seekable);
|
||||
assert_eq!(
|
||||
start,
|
||||
gst::GenericFormattedValue::Bytes(Some(gst::format::Bytes(0)))
|
||||
|
|
|
@ -350,21 +350,12 @@ impl Default for State {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
#[derive(Debug, Default)]
|
||||
struct Pads {
|
||||
pad_serial: u32,
|
||||
sink_pads: HashMap<gst::Pad, PadSink>,
|
||||
}
|
||||
|
||||
impl Default for Pads {
|
||||
fn default() -> Pads {
|
||||
Pads {
|
||||
pad_serial: 0,
|
||||
sink_pads: HashMap::new(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct InputSelector {
|
||||
src_pad: PadSrc,
|
||||
|
|
|
@ -967,23 +967,13 @@ impl PadSrcHandler for SrcHandler {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
#[derive(Debug, Default)]
|
||||
struct Stats {
|
||||
num_pushed: u64,
|
||||
num_lost: u64,
|
||||
num_late: u64,
|
||||
}
|
||||
|
||||
impl Default for Stats {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
num_pushed: 0,
|
||||
num_lost: 0,
|
||||
num_late: 0,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Shared state between element, sink and source pad
|
||||
struct State {
|
||||
jbuf: glib::SendUniqueCell<RTPJitterBuffer>,
|
||||
|
|
|
@ -131,7 +131,6 @@ enum State {
|
|||
seekable: bool,
|
||||
position: u64,
|
||||
size: Option<u64>,
|
||||
start: u64,
|
||||
stop: Option<u64>,
|
||||
caps: Option<gst::Caps>,
|
||||
tags: Option<gst::TagList>,
|
||||
|
@ -612,7 +611,6 @@ impl ReqwestHttpSrc {
|
|||
seekable,
|
||||
position,
|
||||
size,
|
||||
start,
|
||||
stop,
|
||||
caps,
|
||||
tags: if tags.n_tags() > 0 { Some(tags) } else { None },
|
||||
|
|
|
@ -56,6 +56,7 @@ pub struct TranscribeParse {
|
|||
#[derive(Deserialize, Debug)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
struct Alternative {
|
||||
#[allow(dead_code)]
|
||||
confidence: serde_json::Value,
|
||||
content: String,
|
||||
}
|
||||
|
@ -73,6 +74,7 @@ struct Item {
|
|||
#[derive(Deserialize, Debug)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
struct Results {
|
||||
#[allow(dead_code)]
|
||||
transcripts: serde_json::Value,
|
||||
items: Vec<Item>,
|
||||
}
|
||||
|
@ -80,7 +82,9 @@ struct Results {
|
|||
#[derive(Deserialize, Debug)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
struct Transcript {
|
||||
#[allow(dead_code)]
|
||||
job_name: String,
|
||||
#[allow(dead_code)]
|
||||
account_id: String,
|
||||
results: Results,
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ const CRC: crc::Crc<u32> = crc::Crc::<u32>::new(&crc::CRC_32_ISO_HDLC);
|
|||
struct Prelude {
|
||||
total_bytes: u32,
|
||||
header_bytes: u32,
|
||||
#[allow(dead_code)]
|
||||
prelude_crc: u32,
|
||||
}
|
||||
|
||||
|
@ -41,9 +42,11 @@ pub struct Header {
|
|||
|
||||
#[derive(Debug)]
|
||||
pub struct Packet<'a> {
|
||||
#[allow(dead_code)]
|
||||
prelude: Prelude,
|
||||
headers: Vec<Header>,
|
||||
pub payload: &'a [u8],
|
||||
#[allow(dead_code)]
|
||||
msg_crc: u32,
|
||||
}
|
||||
|
||||
|
|
|
@ -43,22 +43,13 @@ impl Default for StreamingState {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
struct Settings {
|
||||
url: Option<GstS3Url>,
|
||||
access_key: Option<String>,
|
||||
secret_access_key: Option<String>,
|
||||
}
|
||||
|
||||
impl Default for Settings {
|
||||
fn default() -> Self {
|
||||
Settings {
|
||||
url: None,
|
||||
access_key: None,
|
||||
secret_access_key: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct S3Src {
|
||||
settings: Mutex<Settings>,
|
||||
|
|
|
@ -47,25 +47,11 @@ static CAT: Lazy<gst::DebugCategory> = Lazy::new(|| {
|
|||
)
|
||||
});
|
||||
|
||||
#[derive(Debug)]
|
||||
#[derive(Debug, Default)]
|
||||
struct State {
|
||||
start_ts: Option<gst::ClockTime>,
|
||||
end_ts: Option<gst::ClockTime>,
|
||||
current_line: String,
|
||||
format: Option<String>,
|
||||
}
|
||||
|
||||
impl Default for State {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
start_ts: None,
|
||||
end_ts: None,
|
||||
current_line: "".to_string(),
|
||||
format: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct JsonGstEnc {
|
||||
srcpad: gst::Pad,
|
||||
sinkpad: gst::Pad,
|
||||
|
|
|
@ -44,16 +44,11 @@ struct Command {
|
|||
operation: Operation,
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
struct State {
|
||||
commands: Vec<Command>,
|
||||
}
|
||||
|
||||
impl Default for State {
|
||||
fn default() -> Self {
|
||||
Self { commands: vec![] }
|
||||
}
|
||||
}
|
||||
|
||||
pub struct RegEx {
|
||||
srcpad: gst::Pad,
|
||||
sinkpad: gst::Pad,
|
||||
|
|
|
@ -57,23 +57,13 @@ impl std::error::Error for PlaylistError {
|
|||
}
|
||||
|
||||
/// Number of different streams currently handled by the element
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
#[derive(Debug, Default, Clone, PartialEq)]
|
||||
struct StreamsTopology {
|
||||
audio: u32,
|
||||
video: u32,
|
||||
text: u32,
|
||||
}
|
||||
|
||||
impl Default for StreamsTopology {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
audio: 0,
|
||||
video: 0,
|
||||
text: 0,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl StreamsTopology {
|
||||
fn n_streams(&self) -> u32 {
|
||||
self.audio + self.video + self.text
|
||||
|
@ -246,7 +236,6 @@ enum ItemState {
|
|||
stream_selected_msg: Option<gst::Message>,
|
||||
concat_sink_pads: Vec<(gst::Element, gst::Pad)>,
|
||||
sender: crossbeam_channel::Sender<bool>,
|
||||
receiver: crossbeam_channel::Receiver<bool>,
|
||||
},
|
||||
/// Buffers are flowing
|
||||
Streaming {
|
||||
|
@ -544,7 +533,6 @@ impl Item {
|
|||
ItemState::WaitingForPads {
|
||||
uridecodebin,
|
||||
sender,
|
||||
receiver,
|
||||
stream_collection_msg,
|
||||
concat_sink_pads,
|
||||
..
|
||||
|
@ -552,7 +540,6 @@ impl Item {
|
|||
inner.state = ItemState::Blocked {
|
||||
uridecodebin: uridecodebin.clone(),
|
||||
sender: sender.clone(),
|
||||
receiver: receiver.clone(),
|
||||
concat_sink_pads: concat_sink_pads.clone(),
|
||||
stream_collection_msg: stream_collection_msg.copy(),
|
||||
stream_selected_msg: None,
|
||||
|
|
|
@ -78,8 +78,8 @@ pub fn register(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
|
|||
gst::Rank::None,
|
||||
Some("cdg"),
|
||||
Some(&Caps::builder("video/x-cdg").build()),
|
||||
|mut typefind| {
|
||||
let proba = compute_probability(&mut typefind);
|
||||
|typefind| {
|
||||
let proba = compute_probability(typefind);
|
||||
|
||||
if proba != gst::TypeFindProbability::None {
|
||||
typefind.suggest(proba, &Caps::builder("video/x-cdg").build());
|
||||
|
|
|
@ -52,21 +52,12 @@ impl Default for State {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
#[derive(Default, Debug, Clone)]
|
||||
struct Settings {
|
||||
uuid: Option<String>,
|
||||
creation_date: Option<glib::DateTime>,
|
||||
}
|
||||
|
||||
impl Default for Settings {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
uuid: None,
|
||||
creation_date: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct MccEnc {
|
||||
srcpad: gst::Pad,
|
||||
sinkpad: gst::Pad,
|
||||
|
|
|
@ -33,7 +33,7 @@ pub fn digits(s: &[u8]) -> IResult<&[u8], u32> {
|
|||
use nom::combinator::map_res;
|
||||
|
||||
map_res(
|
||||
map_res(take_while(is_digit), |s: &[u8]| std::str::from_utf8(s)),
|
||||
map_res(take_while(is_digit), std::str::from_utf8),
|
||||
|s: &str| s.parse::<u32>(),
|
||||
)(s)
|
||||
}
|
||||
|
|
|
@ -657,7 +657,7 @@ impl TtToCea608 {
|
|||
if j == 0 {
|
||||
prepend_space = self.open_line(
|
||||
element,
|
||||
&mut state,
|
||||
state,
|
||||
settings,
|
||||
chunk,
|
||||
mut_list,
|
||||
|
@ -665,7 +665,7 @@ impl TtToCea608 {
|
|||
row as i32,
|
||||
line.carriage_return,
|
||||
);
|
||||
} else if self.open_chunk(element, &mut state, chunk, mut_list, col) {
|
||||
} else if self.open_chunk(element, state, chunk, mut_list, col) {
|
||||
prepend_space = false;
|
||||
col += 1;
|
||||
}
|
||||
|
@ -754,7 +754,7 @@ impl TtToCea608 {
|
|||
|
||||
self.open_line(
|
||||
element,
|
||||
&mut state,
|
||||
state,
|
||||
settings,
|
||||
chunk,
|
||||
mut_list,
|
||||
|
|
|
@ -32,20 +32,12 @@ fn init() {
|
|||
});
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
struct NotifyState {
|
||||
cc608_count: u32,
|
||||
cc708_count: u32,
|
||||
}
|
||||
|
||||
impl Default for NotifyState {
|
||||
fn default() -> Self {
|
||||
NotifyState {
|
||||
cc608_count: 0,
|
||||
cc708_count: 0,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
macro_rules! assert_push_data {
|
||||
($h:expr, $state:expr, $data:expr, $ts:expr, $cc608_count:expr, $cc708_count:expr) => {
|
||||
let mut buf = gst::Buffer::from_mut_slice($data);
|
||||
|
@ -399,13 +391,10 @@ fn test_gap_events() {
|
|||
assert_push_data!(h, state, valid_cc608_data, ClockTime::ZERO, 1, 0);
|
||||
|
||||
/* pushing gap event within the window changes nothing */
|
||||
assert_eq!(
|
||||
h.push_event(gst::event::Gap::new(
|
||||
ClockTime::from_nseconds(100_000_000),
|
||||
ClockTime::from_nseconds(1)
|
||||
)),
|
||||
true
|
||||
);
|
||||
assert!(h.push_event(gst::event::Gap::new(
|
||||
ClockTime::from_nseconds(100_000_000),
|
||||
ClockTime::from_nseconds(1)
|
||||
)),);
|
||||
|
||||
{
|
||||
let state_guard = state.lock().unwrap();
|
||||
|
@ -414,13 +403,10 @@ fn test_gap_events() {
|
|||
}
|
||||
|
||||
/* pushing gap event outside the window moves cc608 property to false */
|
||||
assert_eq!(
|
||||
h.push_event(gst::event::Gap::new(
|
||||
ClockTime::from_nseconds(1_000_000_000),
|
||||
ClockTime::from_nseconds(1)
|
||||
)),
|
||||
true
|
||||
);
|
||||
assert!(h.push_event(gst::event::Gap::new(
|
||||
ClockTime::from_nseconds(1_000_000_000),
|
||||
ClockTime::from_nseconds(1)
|
||||
)),);
|
||||
|
||||
{
|
||||
let state_guard = state.lock().unwrap();
|
||||
|
|
|
@ -142,7 +142,7 @@ fn test_one_timed_buffer_and_eos() {
|
|||
}
|
||||
}
|
||||
|
||||
assert_eq!(h.events_in_queue() == 1, true);
|
||||
assert_eq!(h.events_in_queue(), 1);
|
||||
|
||||
let event = h.pull_event().unwrap();
|
||||
assert_eq!(event.type_(), gst::EventType::Eos);
|
||||
|
|
|
@ -35,20 +35,12 @@ static CAT: Lazy<gst::DebugCategory> = Lazy::new(|| {
|
|||
)
|
||||
});
|
||||
|
||||
#[derive(Default)]
|
||||
struct State {
|
||||
buffers: Vec<gst::Buffer>,
|
||||
total_size: usize,
|
||||
}
|
||||
|
||||
impl Default for State {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
buffers: vec![],
|
||||
total_size: 0,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct Decoder<'a> {
|
||||
decoder: *mut ffi::WebPAnimDecoder,
|
||||
phantom: PhantomData<&'a [u8]>,
|
||||
|
|
Loading…
Reference in a new issue