mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2025-06-08 00:18:56 +00:00
Clippy pass
This commit is contained in:
parent
ff470e9799
commit
bdadf25f5c
11 changed files with 56 additions and 73 deletions
|
@ -195,7 +195,10 @@ impl VideoDecoderImpl for CdgDec {
|
||||||
query: &mut gst::QueryRef,
|
query: &mut gst::QueryRef,
|
||||||
) -> Result<(), gst::ErrorMessage> {
|
) -> Result<(), gst::ErrorMessage> {
|
||||||
if let gst::query::QueryView::Allocation(allocation) = query.view() {
|
if let gst::query::QueryView::Allocation(allocation) = query.view() {
|
||||||
if let Some(_) = allocation.find_allocation_meta::<gst_video::VideoMeta>() {
|
if allocation
|
||||||
|
.find_allocation_meta::<gst_video::VideoMeta>()
|
||||||
|
.is_some()
|
||||||
|
{
|
||||||
let pools = allocation.get_allocation_pools();
|
let pools = allocation.get_allocation_pools();
|
||||||
if let Some((ref pool, _, _, _)) = pools.first() {
|
if let Some((ref pool, _, _, _)) = pools.first() {
|
||||||
if let Some(pool) = pool {
|
if let Some(pool) = pool {
|
||||||
|
|
|
@ -673,7 +673,7 @@ impl MccParse {
|
||||||
fn start_task(&self, element: &gst::Element) -> Result<(), gst::LoggableError> {
|
fn start_task(&self, element: &gst::Element) -> Result<(), gst::LoggableError> {
|
||||||
let element_weak = element.downgrade();
|
let element_weak = element.downgrade();
|
||||||
let pad_weak = self.sinkpad.downgrade();
|
let pad_weak = self.sinkpad.downgrade();
|
||||||
if let Err(_) = self.sinkpad.start_task(move || {
|
let res = self.sinkpad.start_task(move || {
|
||||||
let element = match element_weak.upgrade() {
|
let element = match element_weak.upgrade() {
|
||||||
Some(element) => element,
|
Some(element) => element,
|
||||||
None => {
|
None => {
|
||||||
|
@ -686,7 +686,8 @@ impl MccParse {
|
||||||
|
|
||||||
let parse = Self::from_instance(&element);
|
let parse = Self::from_instance(&element);
|
||||||
parse.loop_fn(&element);
|
parse.loop_fn(&element);
|
||||||
}) {
|
});
|
||||||
|
if res.is_err() {
|
||||||
return Err(gst_loggable_error!(CAT, "Failed to start pad task"));
|
return Err(gst_loggable_error!(CAT, "Failed to start pad task"));
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@ -771,13 +772,12 @@ impl MccParse {
|
||||||
}
|
}
|
||||||
|
|
||||||
while let Some(line) = reader.get_line_with_drain(true) {
|
while let Some(line) = reader.get_line_with_drain(true) {
|
||||||
match parser.parse_line(line, false).map_err(|err| (line, err)) {
|
if let Ok(MccLine::Caption(tc, None)) =
|
||||||
Ok(MccLine::Caption(tc, None)) => {
|
parser.parse_line(line, false).map_err(|err| (line, err))
|
||||||
|
{
|
||||||
let state = self.state.lock().unwrap();
|
let state = self.state.lock().unwrap();
|
||||||
let (framerate, drop_frame) = parse_timecode_rate(state.timecode_rate)
|
let (framerate, drop_frame) = parse_timecode_rate(state.timecode_rate)
|
||||||
.map_err(|_| {
|
.map_err(|_| gst_loggable_error!(CAT, "Failed to parse timecode rate"))?;
|
||||||
gst_loggable_error!(CAT, "Failed to parse timecode rate")
|
|
||||||
})?;
|
|
||||||
last_tc = match parse_timecode(framerate, drop_frame, tc) {
|
last_tc = match parse_timecode(framerate, drop_frame, tc) {
|
||||||
Ok(mut timecode) => {
|
Ok(mut timecode) => {
|
||||||
/* We're looking for the total duration */
|
/* We're looking for the total duration */
|
||||||
|
@ -787,8 +787,7 @@ impl MccParse {
|
||||||
Err(_) => None,
|
Err(_) => None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => { /* We ignore everything else including errors */ }
|
/* We ignore everything else including errors */
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if last_tc.is_some() || offset == 0 {
|
if last_tc.is_some() || offset == 0 {
|
||||||
|
|
|
@ -610,7 +610,7 @@ impl AggregatorImpl for FallbackSwitch {
|
||||||
// Otherwise if we have a fallback sinkpad and it has a buffer, then the timeout is going
|
// Otherwise if we have a fallback sinkpad and it has a buffer, then the timeout is going
|
||||||
// to be its running time. We will then either output the buffer or drop it, depending on
|
// to be its running time. We will then either output the buffer or drop it, depending on
|
||||||
// its distance from the last sinkpad time
|
// its distance from the last sinkpad time
|
||||||
if let Some(_) = self.sinkpad.peek_buffer() {
|
if self.sinkpad.peek_buffer().is_some() {
|
||||||
gst_debug!(CAT, obj: agg, "Have buffer on sinkpad, immediate timeout");
|
gst_debug!(CAT, obj: agg, "Have buffer on sinkpad, immediate timeout");
|
||||||
0.into()
|
0.into()
|
||||||
} else if self.sinkpad.is_eos() {
|
} else if self.sinkpad.is_eos() {
|
||||||
|
@ -731,7 +731,7 @@ impl AggregatorImpl for FallbackSwitch {
|
||||||
audio_info.rate(),
|
audio_info.rate(),
|
||||||
audio_info.bpf(),
|
audio_info.bpf(),
|
||||||
)
|
)
|
||||||
} else if let Some(_) = pad_state.video_info {
|
} else if pad_state.video_info.is_some() {
|
||||||
segment.clip(pts, pts + duration).map(|(start, stop)| {
|
segment.clip(pts, pts + duration).map(|(start, stop)| {
|
||||||
{
|
{
|
||||||
let buffer = buffer.make_mut();
|
let buffer = buffer.make_mut();
|
||||||
|
|
|
@ -339,7 +339,7 @@ impl LewtonDec {
|
||||||
audio_info = audio_info.positions(to);
|
audio_info = audio_info.positions(to);
|
||||||
|
|
||||||
let mut map = [0; 8];
|
let mut map = [0; 8];
|
||||||
if let Err(_) = gst_audio::get_channel_reorder_map(from, to, &mut map[..channels]) {
|
if gst_audio::get_channel_reorder_map(from, to, &mut map[..channels]).is_err() {
|
||||||
gst_error!(
|
gst_error!(
|
||||||
CAT,
|
CAT,
|
||||||
obj: element,
|
obj: element,
|
||||||
|
|
|
@ -619,7 +619,7 @@ impl VideoEncoderImpl for Rav1Enc {
|
||||||
gst_loggable_error!(CAT, "Failed to create context: {:?}", err)
|
gst_loggable_error!(CAT, "Failed to create context: {:?}", err)
|
||||||
})?)
|
})?)
|
||||||
},
|
},
|
||||||
video_info: video_info.clone(),
|
video_info,
|
||||||
});
|
});
|
||||||
|
|
||||||
let output_state = element
|
let output_state = element
|
||||||
|
@ -638,14 +638,9 @@ impl VideoEncoderImpl for Rav1Enc {
|
||||||
let mut state_guard = self.state.borrow_mut();
|
let mut state_guard = self.state.borrow_mut();
|
||||||
if let Some(ref mut state) = *state_guard {
|
if let Some(ref mut state) = *state_guard {
|
||||||
state.context.flush();
|
state.context.flush();
|
||||||
loop {
|
while let Ok(_) | Err(data::EncoderStatus::Encoded) = state.context.receive_packet() {
|
||||||
match state.context.receive_packet() {
|
|
||||||
Ok(_) | Err(data::EncoderStatus::Encoded) => {
|
|
||||||
gst_debug!(CAT, obj: element, "Dropping packet on flush",);
|
gst_debug!(CAT, obj: element, "Dropping packet on flush",);
|
||||||
}
|
}
|
||||||
_ => break,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
true
|
true
|
||||||
|
|
|
@ -857,12 +857,9 @@ impl ElementImpl for ReqwestHttpSrc {
|
||||||
element: &gst::Element,
|
element: &gst::Element,
|
||||||
transition: gst::StateChange,
|
transition: gst::StateChange,
|
||||||
) -> Result<gst::StateChangeSuccess, gst::StateChangeError> {
|
) -> Result<gst::StateChangeSuccess, gst::StateChangeError> {
|
||||||
match transition {
|
if let gst::StateChange::ReadyToNull = transition {
|
||||||
gst::StateChange::ReadyToNull => {
|
|
||||||
*self.client.lock().unwrap() = None;
|
*self.client.lock().unwrap() = None;
|
||||||
}
|
}
|
||||||
_ => (),
|
|
||||||
}
|
|
||||||
|
|
||||||
self.parent_change_state(element, transition)
|
self.parent_change_state(element, transition)
|
||||||
}
|
}
|
||||||
|
|
|
@ -191,7 +191,7 @@ impl S3Sink {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
state.completed_parts.push(CompletedPart {
|
state.completed_parts.push(CompletedPart {
|
||||||
e_tag: output.e_tag.clone(),
|
e_tag: output.e_tag,
|
||||||
part_number: Some(part_number),
|
part_number: Some(part_number),
|
||||||
});
|
});
|
||||||
gst_info!(CAT, obj: element, "Uploaded part {}", part_number);
|
gst_info!(CAT, obj: element, "Uploaded part {}", part_number);
|
||||||
|
@ -374,7 +374,7 @@ impl S3Sink {
|
||||||
fn cancel(&self) {
|
fn cancel(&self) {
|
||||||
let mut canceller = self.canceller.lock().unwrap();
|
let mut canceller = self.canceller.lock().unwrap();
|
||||||
|
|
||||||
if let Some(_) = canceller.take() {
|
if canceller.take().is_some() {
|
||||||
/* We don't do anything, the Sender will be dropped, and that will cause the
|
/* We don't do anything, the Sender will be dropped, and that will cause the
|
||||||
* Receiver to be cancelled */
|
* Receiver to be cancelled */
|
||||||
}
|
}
|
||||||
|
@ -540,8 +540,7 @@ impl BaseSinkImpl for S3Sink {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn event(&self, element: &gst_base::BaseSink, event: gst::Event) -> bool {
|
fn event(&self, element: &gst_base::BaseSink, event: gst::Event) -> bool {
|
||||||
match event.view() {
|
if let gst::EventView::Eos(_) = event.view() {
|
||||||
gst::EventView::Eos(_) => {
|
|
||||||
if let Err(error_message) = self.finalize_upload(element) {
|
if let Err(error_message) = self.finalize_upload(element) {
|
||||||
gst_error!(
|
gst_error!(
|
||||||
CAT,
|
CAT,
|
||||||
|
@ -552,8 +551,6 @@ impl BaseSinkImpl for S3Sink {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => (),
|
|
||||||
}
|
|
||||||
|
|
||||||
BaseSinkImplExt::parent_event(self, element, event)
|
BaseSinkImplExt::parent_event(self, element, event)
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,7 +67,7 @@ impl S3Src {
|
||||||
fn cancel(&self) {
|
fn cancel(&self) {
|
||||||
let mut canceller = self.canceller.lock().unwrap();
|
let mut canceller = self.canceller.lock().unwrap();
|
||||||
|
|
||||||
if let Some(_) = canceller.take() {
|
if canceller.take().is_some() {
|
||||||
/* We don't do anything, the Sender will be dropped, and that will cause the
|
/* We don't do anything, the Sender will be dropped, and that will cause the
|
||||||
* Receiver to be cancelled */
|
* Receiver to be cancelled */
|
||||||
}
|
}
|
||||||
|
@ -394,8 +394,7 @@ impl BaseSrcImpl for S3Src {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn query(&self, src: &gst_base::BaseSrc, query: &mut gst::QueryRef) -> bool {
|
fn query(&self, src: &gst_base::BaseSrc, query: &mut gst::QueryRef) -> bool {
|
||||||
match query.view_mut() {
|
if let gst::QueryView::Scheduling(ref mut q) = query.view_mut() {
|
||||||
gst::QueryView::Scheduling(ref mut q) => {
|
|
||||||
q.set(
|
q.set(
|
||||||
gst::SchedulingFlags::SEQUENTIAL | gst::SchedulingFlags::BANDWIDTH_LIMITED,
|
gst::SchedulingFlags::SEQUENTIAL | gst::SchedulingFlags::BANDWIDTH_LIMITED,
|
||||||
1,
|
1,
|
||||||
|
@ -405,8 +404,6 @@ impl BaseSrcImpl for S3Src {
|
||||||
q.add_scheduling_modes(&[gst::PadMode::Push, gst::PadMode::Pull]);
|
q.add_scheduling_modes(&[gst::PadMode::Push, gst::PadMode::Pull]);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
_ => (),
|
|
||||||
}
|
|
||||||
|
|
||||||
BaseSrcImplExt::parent_query(self, src, query)
|
BaseSrcImplExt::parent_query(self, src, query)
|
||||||
}
|
}
|
||||||
|
|
|
@ -326,7 +326,7 @@ impl HandleData for gst::Buffer {
|
||||||
audio_info.rate(),
|
audio_info.rate(),
|
||||||
audio_info.bpf(),
|
audio_info.bpf(),
|
||||||
)
|
)
|
||||||
} else if let Some(_) = state.video_info {
|
} else if state.video_info.is_some() {
|
||||||
segment.clip(pts, stop).map(move |(start, stop)| {
|
segment.clip(pts, stop).map(move |(start, stop)| {
|
||||||
{
|
{
|
||||||
let buffer = self.make_mut();
|
let buffer = self.make_mut();
|
||||||
|
@ -1472,9 +1472,9 @@ impl ToggleRecord {
|
||||||
};
|
};
|
||||||
|
|
||||||
if pad == &stream.srcpad {
|
if pad == &stream.srcpad {
|
||||||
gst::Iterator::from_vec(vec![stream.sinkpad.clone()])
|
gst::Iterator::from_vec(vec![stream.sinkpad])
|
||||||
} else {
|
} else {
|
||||||
gst::Iterator::from_vec(vec![stream.srcpad.clone()])
|
gst::Iterator::from_vec(vec![stream.srcpad])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -416,12 +416,9 @@ impl ElementImpl for SineSrc {
|
||||||
let basesrc = element.downcast_ref::<gst_base::BaseSrc>().unwrap();
|
let basesrc = element.downcast_ref::<gst_base::BaseSrc>().unwrap();
|
||||||
|
|
||||||
// Configure live'ness once here just before starting the source
|
// Configure live'ness once here just before starting the source
|
||||||
match transition {
|
if let gst::StateChange::ReadyToPaused = transition {
|
||||||
gst::StateChange::ReadyToPaused => {
|
|
||||||
basesrc.set_live(self.settings.lock().unwrap().is_live);
|
basesrc.set_live(self.settings.lock().unwrap().is_live);
|
||||||
}
|
}
|
||||||
_ => (),
|
|
||||||
}
|
|
||||||
|
|
||||||
// Call the parent class' implementation of ::change_state()
|
// Call the parent class' implementation of ::change_state()
|
||||||
self.parent_change_state(element, transition)
|
self.parent_change_state(element, transition)
|
||||||
|
|
|
@ -13,9 +13,7 @@
|
||||||
//! ```rust,ignore
|
//! ```rust,ignore
|
||||||
//! extern crate gst_plugin_version_helper;
|
//! extern crate gst_plugin_version_helper;
|
||||||
//!
|
//!
|
||||||
//! fn main() {
|
//! gst_plugin_version_helper::get_info();
|
||||||
//! gst_plugin_version_helper::get_info()
|
|
||||||
//! }
|
|
||||||
//! ```
|
//! ```
|
||||||
//!
|
//!
|
||||||
//! Inside `lib.rs` of the plugin, the information provided by `get_info` are usable as follows:
|
//! Inside `lib.rs` of the plugin, the information provided by `get_info` are usable as follows:
|
||||||
|
@ -101,7 +99,7 @@ pub fn get_info() {
|
||||||
let dt = chrono::Utc.timestamp(timestamp, 0);
|
let dt = chrono::Utc.timestamp(timestamp, 0);
|
||||||
commit_date = dt.format("%Y-%m-%d").to_string()
|
commit_date = dt.format("%Y-%m-%d").to_string()
|
||||||
} else if let Ok(release_file) = fs::File::open(release_file) {
|
} else if let Ok(release_file) = fs::File::open(release_file) {
|
||||||
let mut cargo_toml = crate_dir.clone();
|
let mut cargo_toml = crate_dir;
|
||||||
cargo_toml.push("Cargo.toml");
|
cargo_toml.push("Cargo.toml");
|
||||||
|
|
||||||
let cargo_toml = fs::File::open(cargo_toml).expect("Can't open Cargo.toml");
|
let cargo_toml = fs::File::open(cargo_toml).expect("Can't open Cargo.toml");
|
||||||
|
|
Loading…
Reference in a new issue