mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2025-06-07 16:08:55 +00:00
Fix various clippy warnings
This commit is contained in:
parent
162311d2f1
commit
f2deb2264b
13 changed files with 61 additions and 61 deletions
|
@ -274,7 +274,7 @@ impl BaseTransformImpl<BaseTransform> for AudioEcho {
|
||||||
let buffer_size = size * (info.channels() as u64);
|
let buffer_size = size * (info.channels() as u64);
|
||||||
|
|
||||||
*self.state.lock().unwrap() = Some(State {
|
*self.state.lock().unwrap() = Some(State {
|
||||||
info: info,
|
info,
|
||||||
buffer: RingBuffer::new(buffer_size as usize),
|
buffer: RingBuffer::new(buffer_size as usize),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -353,10 +353,10 @@ impl<'a> RingBufferIter<'a> {
|
||||||
let buffer = &mut buffer.buffer;
|
let buffer = &mut buffer.buffer;
|
||||||
|
|
||||||
RingBufferIter {
|
RingBufferIter {
|
||||||
buffer: buffer,
|
buffer,
|
||||||
buffer_pos: buffer_pos,
|
buffer_pos,
|
||||||
read_pos: read_pos,
|
read_pos,
|
||||||
write_pos: write_pos,
|
write_pos,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,7 +102,7 @@ impl SinkImpl for FileSink {
|
||||||
gst_debug!(self.cat, obj: sink, "Opened file {:?}", file);
|
gst_debug!(self.cat, obj: sink, "Opened file {:?}", file);
|
||||||
|
|
||||||
self.streaming_state = StreamingState::Started {
|
self.streaming_state = StreamingState::Started {
|
||||||
file: file,
|
file,
|
||||||
position: 0,
|
position: 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -113,7 +113,7 @@ impl SourceImpl for FileSrc {
|
||||||
gst_debug!(self.cat, obj: src, "Opened file {:?}", file);
|
gst_debug!(self.cat, obj: src, "Opened file {:?}", file);
|
||||||
|
|
||||||
self.streaming_state = StreamingState::Started {
|
self.streaming_state = StreamingState::Started {
|
||||||
file: file,
|
file,
|
||||||
position: 0,
|
position: 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -129,14 +129,12 @@ impl AudioFormat {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn update_with_metadata(&mut self, metadata: &Metadata) -> bool {
|
fn update_with_metadata(&mut self, metadata: &Metadata) -> bool {
|
||||||
let mut changed = false;
|
|
||||||
|
|
||||||
if self.bitrate != metadata.audio_bitrate {
|
if self.bitrate != metadata.audio_bitrate {
|
||||||
self.bitrate = metadata.audio_bitrate;
|
self.bitrate = metadata.audio_bitrate;
|
||||||
changed = true;
|
true
|
||||||
|
} else {
|
||||||
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
changed
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn to_caps(&self) -> Option<gst::Caps> {
|
fn to_caps(&self) -> Option<gst::Caps> {
|
||||||
|
@ -233,18 +231,18 @@ impl AudioFormat {
|
||||||
};
|
};
|
||||||
|
|
||||||
if self.rate != 0 {
|
if self.rate != 0 {
|
||||||
caps.as_mut().map(|c| {
|
if let Some(ref mut caps) = caps.as_mut() {
|
||||||
c.get_mut()
|
caps.get_mut()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.set_simple(&[("rate", &(self.rate as i32))])
|
.set_simple(&[("rate", &(self.rate as i32))])
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
if self.channels != 0 {
|
if self.channels != 0 {
|
||||||
caps.as_mut().map(|c| {
|
if let Some(ref mut caps) = caps.as_mut() {
|
||||||
c.get_mut()
|
caps.get_mut()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.set_simple(&[("channels", &(self.channels as i32))])
|
.set_simple(&[("channels", &(self.channels as i32))])
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
caps
|
caps
|
||||||
|
@ -338,32 +336,32 @@ impl VideoFormat {
|
||||||
};
|
};
|
||||||
|
|
||||||
if let (Some(width), Some(height)) = (self.width, self.height) {
|
if let (Some(width), Some(height)) = (self.width, self.height) {
|
||||||
caps.as_mut().map(|c| {
|
if let Some(ref mut caps) = caps.as_mut() {
|
||||||
c.get_mut()
|
caps.get_mut()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.set_simple(&[("width", &(width as i32)), ("height", &(height as i32))])
|
.set_simple(&[("width", &(width as i32)), ("height", &(height as i32))])
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(par) = self.pixel_aspect_ratio {
|
if let Some(par) = self.pixel_aspect_ratio {
|
||||||
if *par.numer() != 0 && par.numer() != par.denom() {
|
if *par.numer() != 0 && par.numer() != par.denom() {
|
||||||
caps.as_mut().map(|c| {
|
if let Some(ref mut caps) = caps.as_mut() {
|
||||||
c.get_mut().unwrap().set_simple(&[(
|
caps.get_mut().unwrap().set_simple(&[(
|
||||||
"pixel-aspect-ratio",
|
"pixel-aspect-ratio",
|
||||||
&gst::Fraction::new(*par.numer(), *par.denom()),
|
&gst::Fraction::new(*par.numer(), *par.denom()),
|
||||||
)])
|
)])
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(fps) = self.framerate {
|
if let Some(fps) = self.framerate {
|
||||||
if *fps.numer() != 0 {
|
if *fps.numer() != 0 {
|
||||||
caps.as_mut().map(|c| {
|
if let Some(ref mut caps) = caps.as_mut() {
|
||||||
c.get_mut().unwrap().set_simple(&[(
|
caps.get_mut().unwrap().set_simple(&[(
|
||||||
"framerate",
|
"framerate",
|
||||||
&gst::Fraction::new(*fps.numer(), *fps.denom()),
|
&gst::Fraction::new(*fps.numer(), *fps.denom()),
|
||||||
)])
|
)])
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1091,7 +1089,7 @@ impl FlvDemux {
|
||||||
impl DemuxerImpl for FlvDemux {
|
impl DemuxerImpl for FlvDemux {
|
||||||
fn start(
|
fn start(
|
||||||
&mut self,
|
&mut self,
|
||||||
demuxer: &Element,
|
_demuxer: &Element,
|
||||||
_upstream_size: Option<u64>,
|
_upstream_size: Option<u64>,
|
||||||
_random_access: bool,
|
_random_access: bool,
|
||||||
) -> Result<(), gst::ErrorMessage> {
|
) -> Result<(), gst::ErrorMessage> {
|
||||||
|
@ -1100,7 +1098,7 @@ impl DemuxerImpl for FlvDemux {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn stop(&mut self, demuxer: &Element) -> Result<(), gst::ErrorMessage> {
|
fn stop(&mut self, _demuxer: &Element) -> Result<(), gst::ErrorMessage> {
|
||||||
self.state = State::Stopped;
|
self.state = State::Stopped;
|
||||||
self.adapter.clear();
|
self.adapter.clear();
|
||||||
self.streaming_state = None;
|
self.streaming_state = None;
|
||||||
|
@ -1110,9 +1108,9 @@ impl DemuxerImpl for FlvDemux {
|
||||||
|
|
||||||
fn seek(
|
fn seek(
|
||||||
&mut self,
|
&mut self,
|
||||||
demuxer: &Element,
|
_demuxer: &Element,
|
||||||
start: gst::ClockTime,
|
_start: gst::ClockTime,
|
||||||
stop: gst::ClockTime,
|
_stop: gst::ClockTime,
|
||||||
) -> Result<SeekResult, gst::ErrorMessage> {
|
) -> Result<SeekResult, gst::ErrorMessage> {
|
||||||
unimplemented!();
|
unimplemented!();
|
||||||
}
|
}
|
||||||
|
@ -1129,16 +1127,16 @@ impl DemuxerImpl for FlvDemux {
|
||||||
self.update_state(demuxer)
|
self.update_state(demuxer)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn end_of_stream(&mut self, demuxer: &Element) -> Result<(), gst::ErrorMessage> {
|
fn end_of_stream(&mut self, _demuxer: &Element) -> Result<(), gst::ErrorMessage> {
|
||||||
// nothing to do here, all data we have left is incomplete
|
// nothing to do here, all data we have left is incomplete
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_seekable(&self, demuxer: &Element) -> bool {
|
fn is_seekable(&self, _demuxer: &Element) -> bool {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_position(&self, demuxer: &Element) -> gst::ClockTime {
|
fn get_position(&self, _demuxer: &Element) -> gst::ClockTime {
|
||||||
if let Some(StreamingState { last_position, .. }) = self.streaming_state {
|
if let Some(StreamingState { last_position, .. }) = self.streaming_state {
|
||||||
return last_position;
|
return last_position;
|
||||||
}
|
}
|
||||||
|
@ -1146,7 +1144,7 @@ impl DemuxerImpl for FlvDemux {
|
||||||
gst::CLOCK_TIME_NONE
|
gst::CLOCK_TIME_NONE
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_duration(&self, demuxer: &Element) -> gst::ClockTime {
|
fn get_duration(&self, _demuxer: &Element) -> gst::ClockTime {
|
||||||
if let Some(StreamingState {
|
if let Some(StreamingState {
|
||||||
metadata: Some(Metadata { duration, .. }),
|
metadata: Some(Metadata { duration, .. }),
|
||||||
..
|
..
|
||||||
|
|
|
@ -131,13 +131,13 @@ impl HttpSrc {
|
||||||
gst_debug!(cat, obj: src, "Request successful: {:?}", response);
|
gst_debug!(cat, obj: src, "Request successful: {:?}", response);
|
||||||
|
|
||||||
Ok(StreamingState::Started {
|
Ok(StreamingState::Started {
|
||||||
uri: uri,
|
uri,
|
||||||
response: response,
|
response,
|
||||||
seekable: seekable,
|
seekable,
|
||||||
position: 0,
|
position: 0,
|
||||||
size: size,
|
size,
|
||||||
start: start,
|
start,
|
||||||
stop: stop,
|
stop,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,9 +82,9 @@ pub struct Stream {
|
||||||
impl Stream {
|
impl Stream {
|
||||||
pub fn new(index: StreamIndex, caps: gst::Caps, stream_id: String) -> Stream {
|
pub fn new(index: StreamIndex, caps: gst::Caps, stream_id: String) -> Stream {
|
||||||
Stream {
|
Stream {
|
||||||
index: index,
|
index,
|
||||||
caps: caps,
|
caps,
|
||||||
stream_id: stream_id,
|
stream_id,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -138,7 +138,7 @@ impl Demuxer {
|
||||||
gst::DebugColorFlags::empty(),
|
gst::DebugColorFlags::empty(),
|
||||||
"Rust demuxer base class",
|
"Rust demuxer base class",
|
||||||
),
|
),
|
||||||
sinkpad: sinkpad,
|
sinkpad,
|
||||||
flow_combiner: Mutex::new(Default::default()),
|
flow_combiner: Mutex::new(Default::default()),
|
||||||
group_id: Mutex::new(gst::util_group_id_next()),
|
group_id: Mutex::new(gst::util_group_id_next()),
|
||||||
srcpads: Mutex::new(BTreeMap::new()),
|
srcpads: Mutex::new(BTreeMap::new()),
|
||||||
|
@ -671,7 +671,7 @@ pub fn demuxer_register(plugin: &gst::Plugin, demuxer_info: DemuxerInfo) {
|
||||||
|
|
||||||
let demuxer_static = DemuxerStatic {
|
let demuxer_static = DemuxerStatic {
|
||||||
name: format!("Demuxer-{}", name),
|
name: format!("Demuxer-{}", name),
|
||||||
demuxer_info: demuxer_info,
|
demuxer_info,
|
||||||
};
|
};
|
||||||
|
|
||||||
let type_ = register_type(demuxer_static);
|
let type_ = register_type(demuxer_static);
|
||||||
|
|
|
@ -22,7 +22,7 @@ pub struct UriError {
|
||||||
impl UriError {
|
impl UriError {
|
||||||
pub fn new<T: Into<String>>(error: gst::URIError, message: T) -> UriError {
|
pub fn new<T: Into<String>>(error: gst::URIError, message: T) -> UriError {
|
||||||
UriError {
|
UriError {
|
||||||
error: error,
|
error,
|
||||||
message: message.into(),
|
message: message.into(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -294,7 +294,7 @@ pub fn sink_register(plugin: &gst::Plugin, sink_info: SinkInfo) {
|
||||||
|
|
||||||
let sink_static = SinkStatic {
|
let sink_static = SinkStatic {
|
||||||
name: format!("Sink-{}", name),
|
name: format!("Sink-{}", name),
|
||||||
sink_info: sink_info,
|
sink_info,
|
||||||
};
|
};
|
||||||
|
|
||||||
let type_ = register_type(sink_static);
|
let type_ = register_type(sink_static);
|
||||||
|
|
|
@ -378,7 +378,7 @@ pub fn source_register(plugin: &gst::Plugin, source_info: SourceInfo) {
|
||||||
|
|
||||||
let source_static = SourceStatic {
|
let source_static = SourceStatic {
|
||||||
name: format!("Source-{}", name),
|
name: format!("Source-{}", name),
|
||||||
source_info: source_info,
|
source_info,
|
||||||
};
|
};
|
||||||
|
|
||||||
let type_ = register_type(source_static);
|
let type_ = register_type(source_static);
|
||||||
|
|
|
@ -80,8 +80,8 @@ impl Eq for Stream {}
|
||||||
impl Stream {
|
impl Stream {
|
||||||
fn new(sinkpad: gst::Pad, srcpad: gst::Pad) -> Self {
|
fn new(sinkpad: gst::Pad, srcpad: gst::Pad) -> Self {
|
||||||
Self {
|
Self {
|
||||||
sinkpad: sinkpad,
|
sinkpad,
|
||||||
srcpad: srcpad,
|
srcpad,
|
||||||
state: Arc::new(Mutex::new(StreamState::default())),
|
state: Arc::new(Mutex::new(StreamState::default())),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -193,7 +193,7 @@ impl ToggleRecord {
|
||||||
),
|
),
|
||||||
settings: Mutex::new(Settings::default()),
|
settings: Mutex::new(Settings::default()),
|
||||||
state: Mutex::new(State::default()),
|
state: Mutex::new(State::default()),
|
||||||
main_stream: main_stream,
|
main_stream,
|
||||||
main_stream_cond: Condvar::new(),
|
main_stream_cond: Condvar::new(),
|
||||||
other_streams: Mutex::new((Vec::new(), 0)),
|
other_streams: Mutex::new((Vec::new(), 0)),
|
||||||
pads: Mutex::new(pads),
|
pads: Mutex::new(pads),
|
||||||
|
|
|
@ -354,8 +354,8 @@ impl BaseTransformImpl<BaseTransform> for Rgb2Gray {
|
||||||
);
|
);
|
||||||
|
|
||||||
*self.state.lock().unwrap() = Some(State {
|
*self.state.lock().unwrap() = Some(State {
|
||||||
in_info: in_info,
|
in_info,
|
||||||
out_info: out_info,
|
out_info,
|
||||||
});
|
});
|
||||||
|
|
||||||
true
|
true
|
||||||
|
|
|
@ -418,9 +418,9 @@ impl BaseSrcImpl<BaseSrc> for SineSrc {
|
||||||
|
|
||||||
*state = State {
|
*state = State {
|
||||||
info: Some(info),
|
info: Some(info),
|
||||||
sample_offset: sample_offset,
|
sample_offset,
|
||||||
sample_stop: sample_stop,
|
sample_stop,
|
||||||
accumulator: accumulator,
|
accumulator,
|
||||||
};
|
};
|
||||||
|
|
||||||
drop(state);
|
drop(state);
|
||||||
|
@ -720,9 +720,9 @@ impl BaseSrcImpl<BaseSrc> for SineSrc {
|
||||||
|
|
||||||
*state = State {
|
*state = State {
|
||||||
info: state.info.clone(),
|
info: state.info.clone(),
|
||||||
sample_offset: sample_offset,
|
sample_offset,
|
||||||
sample_stop: sample_stop,
|
sample_stop,
|
||||||
accumulator: accumulator,
|
accumulator,
|
||||||
};
|
};
|
||||||
|
|
||||||
true
|
true
|
||||||
|
|
|
@ -6,6 +6,8 @@
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
#![cfg_attr(feature = "cargo-clippy", allow(cast_ptr_alignment))]
|
||||||
|
|
||||||
extern crate byteorder;
|
extern crate byteorder;
|
||||||
|
|
||||||
pub extern crate glib_sys as glib_ffi;
|
pub extern crate glib_sys as glib_ffi;
|
||||||
|
|
Loading…
Reference in a new issue