mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2025-02-21 15:16:18 +00:00
Fix/silence a couple new clippy warnings
This commit is contained in:
parent
a45f944edd
commit
51c7d0652e
15 changed files with 73 additions and 61 deletions
|
@ -602,7 +602,7 @@ fn language_code(lang: impl std::borrow::Borrow<[u8; 3]>) -> u16 {
|
|||
let lang = lang.borrow();
|
||||
|
||||
// TODO: Need to relax this once we get the language code from tags
|
||||
assert!(lang.iter().all(|c| (b'a'..b'z').contains(c)));
|
||||
assert!(lang.iter().all(u8::is_ascii_lowercase));
|
||||
|
||||
(((lang[0] as u16 - 0x60) & 0x1F) << 10)
|
||||
+ (((lang[1] as u16 - 0x60) & 0x1F) << 5)
|
||||
|
|
|
@ -38,7 +38,8 @@ fn main() {
|
|||
loop {
|
||||
let now = time::Instant::now();
|
||||
|
||||
for mut socket in sockets.lock().unwrap().iter() {
|
||||
let sockets = sockets.lock().unwrap();
|
||||
for mut socket in sockets.iter() {
|
||||
let _ = socket.write(&buffer);
|
||||
}
|
||||
|
||||
|
|
|
@ -398,10 +398,8 @@ impl AppSrc {
|
|||
}
|
||||
}
|
||||
|
||||
match self
|
||||
.sender
|
||||
.lock()
|
||||
.unwrap()
|
||||
let mut sender = self.sender.lock().unwrap();
|
||||
match sender
|
||||
.as_mut()
|
||||
.unwrap()
|
||||
.try_send(StreamItem::Buffer(buffer))
|
||||
|
|
|
@ -253,7 +253,8 @@ impl TaskQueue {
|
|||
where
|
||||
T: Future<Output = SubTaskOutput> + Send + 'static,
|
||||
{
|
||||
match self.tasks.lock().unwrap().get_mut(task_id.0) {
|
||||
let mut state = self.tasks.lock().unwrap();
|
||||
match state.get_mut(task_id.0) {
|
||||
Some(task) => {
|
||||
gst::trace!(
|
||||
RUNTIME_CAT,
|
||||
|
|
|
@ -235,7 +235,8 @@ mod imp_src {
|
|||
return Err(item);
|
||||
}
|
||||
|
||||
match self.sender.lock().unwrap().as_mut() {
|
||||
let mut sender = self.sender.lock().unwrap();
|
||||
match sender.as_mut() {
|
||||
Some(sender) => sender
|
||||
.try_send(item)
|
||||
.map_err(mpsc::TrySendError::into_inner),
|
||||
|
|
|
@ -372,9 +372,12 @@ impl S3Sink {
|
|||
&self,
|
||||
started_state: &Started,
|
||||
) -> Result<(), gst::ErrorMessage> {
|
||||
let s3url = match *self.url.lock().unwrap() {
|
||||
Some(ref url) => url.clone(),
|
||||
None => unreachable!("Element should be started"),
|
||||
let s3url = {
|
||||
let url = self.url.lock().unwrap();
|
||||
match *url {
|
||||
Some(ref url) => url.clone(),
|
||||
None => unreachable!("Element should be started"),
|
||||
}
|
||||
};
|
||||
|
||||
let client = &started_state.client;
|
||||
|
@ -449,13 +452,16 @@ impl S3Sink {
|
|||
unreachable!("Element should be started");
|
||||
}
|
||||
|
||||
let s3url = match *self.url.lock().unwrap() {
|
||||
Some(ref url) => url.clone(),
|
||||
None => {
|
||||
return Err(gst::error_msg!(
|
||||
gst::ResourceError::Settings,
|
||||
["Cannot start without a URL being set"]
|
||||
));
|
||||
let s3url = {
|
||||
let url = self.url.lock().unwrap();
|
||||
match *url {
|
||||
Some(ref url) => url.clone(),
|
||||
None => {
|
||||
return Err(gst::error_msg!(
|
||||
gst::ResourceError::Settings,
|
||||
["Cannot start without a URL being set"]
|
||||
));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -876,7 +882,8 @@ impl ObjectImpl for S3Sink {
|
|||
"region" => settings.region.to_string().to_value(),
|
||||
"part-size" => settings.buffer_size.to_value(),
|
||||
"uri" => {
|
||||
let url = match *self.url.lock().unwrap() {
|
||||
let url = self.url.lock().unwrap();
|
||||
let url = match *url {
|
||||
Some(ref url) => url.to_string(),
|
||||
None => "".to_string(),
|
||||
};
|
||||
|
|
|
@ -474,7 +474,8 @@ impl BaseSrcImpl for S3Src {
|
|||
}
|
||||
|
||||
fn size(&self, _: &Self::Type) -> Option<u64> {
|
||||
match *self.state.lock().unwrap() {
|
||||
let state = self.state.lock().unwrap();
|
||||
match *state {
|
||||
StreamingState::Stopped => None,
|
||||
StreamingState::Started { size, .. } => Some(size),
|
||||
}
|
||||
|
|
|
@ -142,7 +142,7 @@ impl Playlist {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Copy, Clone, PartialEq)]
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
|
||||
pub enum PlaylistRenderState {
|
||||
Init,
|
||||
Started,
|
||||
|
|
|
@ -73,17 +73,20 @@ pub struct OnvifOverlay {
|
|||
|
||||
impl OnvifOverlay {
|
||||
fn negotiate(&self, element: &super::OnvifOverlay) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||
let video_info = match self.state.lock().unwrap().video_info.as_ref() {
|
||||
Some(video_info) => Ok(video_info.clone()),
|
||||
None => {
|
||||
gst::element_error!(
|
||||
element,
|
||||
gst::CoreError::Negotiation,
|
||||
["Element hasn't received valid video caps at negotiation time"]
|
||||
);
|
||||
Err(gst::FlowError::NotNegotiated)
|
||||
}
|
||||
}?;
|
||||
let video_info = {
|
||||
let state = self.state.lock().unwrap();
|
||||
match state.video_info.as_ref() {
|
||||
Some(video_info) => Ok(video_info.clone()),
|
||||
None => {
|
||||
gst::element_error!(
|
||||
element,
|
||||
gst::CoreError::Negotiation,
|
||||
["Element hasn't received valid video caps at negotiation time"]
|
||||
);
|
||||
Err(gst::FlowError::NotNegotiated)
|
||||
}
|
||||
}?
|
||||
};
|
||||
|
||||
let mut caps = video_info.to_caps().unwrap();
|
||||
let mut downstream_accepts_meta = false;
|
||||
|
|
|
@ -1020,14 +1020,16 @@ impl ElementImpl for ReqwestHttpSrc {
|
|||
|
||||
impl BaseSrcImpl for ReqwestHttpSrc {
|
||||
fn is_seekable(&self, _src: &Self::Type) -> bool {
|
||||
match *self.state.lock().unwrap() {
|
||||
let state = self.state.lock().unwrap();
|
||||
match *state {
|
||||
State::Started { seekable, .. } => seekable,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
||||
fn size(&self, _src: &Self::Type) -> Option<u64> {
|
||||
match *self.state.lock().unwrap() {
|
||||
let state = self.state.lock().unwrap();
|
||||
match *state {
|
||||
State::Started { size, .. } => size,
|
||||
_ => None,
|
||||
}
|
||||
|
|
|
@ -205,7 +205,7 @@ impl TextWrap {
|
|||
.as_ref()
|
||||
.expect("We should have a wrapper by now");
|
||||
|
||||
let lines = textwrap::wrap(¤t_text, &*options);
|
||||
let lines = textwrap::wrap(¤t_text, options);
|
||||
let mut chunks = lines.chunks(n_lines as usize).peekable();
|
||||
let mut trailing = "".to_string();
|
||||
|
||||
|
@ -268,7 +268,7 @@ impl TextWrap {
|
|||
.options
|
||||
.as_ref()
|
||||
.expect("We should have a wrapper by now");
|
||||
textwrap::fill(data, &*options)
|
||||
textwrap::fill(data, options)
|
||||
};
|
||||
|
||||
// If the lines property was set, we want to split the result into buffers
|
||||
|
|
|
@ -22,7 +22,7 @@ pub enum Cea608Mode {
|
|||
RollUp4,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Serialize, Deserialize, Debug, PartialEq)]
|
||||
#[derive(Clone, Copy, Serialize, Deserialize, Debug, PartialEq, Eq)]
|
||||
pub enum TextStyle {
|
||||
White,
|
||||
Green,
|
||||
|
|
|
@ -220,13 +220,13 @@ impl Dav1dDec {
|
|||
Err(err) => {
|
||||
gst::error!(CAT, "Sending data failed (error code: {})", err);
|
||||
element.release_frame(frame);
|
||||
return gst_video::video_decoder_error!(
|
||||
gst_video::video_decoder_error!(
|
||||
element,
|
||||
1,
|
||||
gst::StreamError::Decode,
|
||||
["Sending data failed (error code {})", err]
|
||||
)
|
||||
.map(|_| std::ops::ControlFlow::Break(()));
|
||||
.map(|_| std::ops::ControlFlow::Break(()))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -251,13 +251,13 @@ impl Dav1dDec {
|
|||
}
|
||||
Err(err) => {
|
||||
gst::error!(CAT, "Sending data failed (error code: {})", err);
|
||||
return gst_video::video_decoder_error!(
|
||||
gst_video::video_decoder_error!(
|
||||
element,
|
||||
1,
|
||||
gst::StreamError::Decode,
|
||||
["Sending data failed (error code {})", err]
|
||||
)
|
||||
.map(|_| std::ops::ControlFlow::Break(()));
|
||||
.map(|_| std::ops::ControlFlow::Break(()))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -330,18 +330,16 @@ impl VideoEncoderImpl for GifEnc {
|
|||
let input_buffer = frame.input_buffer().expect("frame without input buffer");
|
||||
|
||||
{
|
||||
let in_frame = gst_video::VideoFrameRef::from_buffer_ref_readable(
|
||||
&*input_buffer,
|
||||
&state.video_info,
|
||||
)
|
||||
.map_err(|_| {
|
||||
gst::element_error!(
|
||||
element,
|
||||
gst::CoreError::Failed,
|
||||
["Failed to map output buffer readable"]
|
||||
);
|
||||
gst::FlowError::Error
|
||||
})?;
|
||||
let in_frame =
|
||||
gst_video::VideoFrameRef::from_buffer_ref_readable(input_buffer, &state.video_info)
|
||||
.map_err(|_| {
|
||||
gst::element_error!(
|
||||
element,
|
||||
gst::CoreError::Failed,
|
||||
["Failed to map output buffer readable"]
|
||||
);
|
||||
gst::FlowError::Error
|
||||
})?;
|
||||
|
||||
let frame_width = in_frame.info().width();
|
||||
let frame_height = in_frame.info().height();
|
||||
|
|
|
@ -928,15 +928,15 @@ impl VideoEncoderImpl for Rav1Enc {
|
|||
let input_buffer = frame.input_buffer().expect("frame without input buffer");
|
||||
|
||||
let in_frame =
|
||||
gst_video::VideoFrameRef::from_buffer_ref_readable(&*input_buffer, &state.video_info)
|
||||
gst_video::VideoFrameRef::from_buffer_ref_readable(input_buffer, &state.video_info)
|
||||
.map_err(|_| {
|
||||
gst::element_error!(
|
||||
element,
|
||||
gst::CoreError::Failed,
|
||||
["Failed to map output buffer readable"]
|
||||
);
|
||||
gst::FlowError::Error
|
||||
})?;
|
||||
gst::element_error!(
|
||||
element,
|
||||
gst::CoreError::Failed,
|
||||
["Failed to map output buffer readable"]
|
||||
);
|
||||
gst::FlowError::Error
|
||||
})?;
|
||||
|
||||
match state.context.send_frame(
|
||||
frame.system_frame_number(),
|
||||
|
|
Loading…
Reference in a new issue