mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-10-31 22:58:51 +00:00
Fix various needless-borrow clippy warnings and others
This commit is contained in:
parent
67f566dd28
commit
052365ba1a
36 changed files with 81 additions and 84 deletions
|
@ -1622,7 +1622,7 @@ impl AudioLoudNorm {
|
|||
let mut state = self.state.borrow_mut();
|
||||
let mut outbuf = None;
|
||||
if let Some(ref mut state) = &mut *state {
|
||||
outbuf = match state.drain(&element) {
|
||||
outbuf = match state.drain(element) {
|
||||
Ok(outbuf) => Some(outbuf),
|
||||
Err(gst::FlowError::Eos) => None,
|
||||
Err(_) => return false,
|
||||
|
@ -1644,7 +1644,7 @@ impl AudioLoudNorm {
|
|||
let mut state = self.state.borrow_mut();
|
||||
let mut outbuf = None;
|
||||
if let Some(ref mut state) = &mut *state {
|
||||
outbuf = match state.drain(&element) {
|
||||
outbuf = match state.drain(element) {
|
||||
Ok(outbuf) => Some(outbuf),
|
||||
Err(gst::FlowError::Eos) => None,
|
||||
Err(_) => return false,
|
||||
|
|
|
@ -436,7 +436,7 @@ impl BaseTransformImpl for EbuR128Level {
|
|||
let mut timestamp = buf.pts();
|
||||
let segment = element.segment().downcast::<gst::ClockTime>().ok();
|
||||
|
||||
let buf = gst_audio::AudioBufferRef::from_buffer_ref_readable(&buf, &state.info).map_err(
|
||||
let buf = gst_audio::AudioBufferRef::from_buffer_ref_readable(buf, &state.info).map_err(
|
||||
|_| {
|
||||
gst::element_error!(element, gst::ResourceError::Read, ["Failed to map buffer"]);
|
||||
gst::FlowError::Error
|
||||
|
|
|
@ -313,7 +313,7 @@ impl URIHandlerImpl for FileSink {
|
|||
|
||||
if uri != "file://" {
|
||||
let file_location = FileLocation::try_from_uri_str(uri)?;
|
||||
self.set_location(&element, Some(file_location))
|
||||
self.set_location(element, Some(file_location))
|
||||
} else {
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
@ -366,7 +366,7 @@ impl URIHandlerImpl for FileSrc {
|
|||
|
||||
if uri != "file://" {
|
||||
let file_location = FileLocation::try_from_uri_str(uri)?;
|
||||
self.set_location(&element, Some(file_location))
|
||||
self.set_location(element, Some(file_location))
|
||||
} else {
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ impl State {
|
|||
let sender_key = props
|
||||
.sender_key
|
||||
.as_ref()
|
||||
.and_then(|k| box_::PublicKey::from_slice(&k))
|
||||
.and_then(|k| box_::PublicKey::from_slice(k))
|
||||
.ok_or_else(|| {
|
||||
gst::error_msg!(
|
||||
gst::ResourceError::NotFound,
|
||||
|
@ -73,7 +73,7 @@ impl State {
|
|||
let receiver_key = props
|
||||
.receiver_key
|
||||
.as_ref()
|
||||
.and_then(|k| box_::SecretKey::from_slice(&k))
|
||||
.and_then(|k| box_::SecretKey::from_slice(k))
|
||||
.ok_or_else(|| {
|
||||
gst::error_msg!(
|
||||
gst::ResourceError::NotFound,
|
||||
|
@ -121,16 +121,15 @@ impl State {
|
|||
let block_size = self.block_size.expect("Block size wasn't set") as usize + box_::MACBYTES;
|
||||
|
||||
for subbuffer in map.chunks(block_size) {
|
||||
let plain = box_::open_precomputed(&subbuffer, &nonce, &self.precomputed_key).map_err(
|
||||
|_| {
|
||||
let plain =
|
||||
box_::open_precomputed(subbuffer, &nonce, &self.precomputed_key).map_err(|_| {
|
||||
gst::element_error!(
|
||||
element,
|
||||
gst::StreamError::Format,
|
||||
["Failed to decrypt buffer"]
|
||||
);
|
||||
gst::FlowError::Error
|
||||
},
|
||||
)?;
|
||||
})?;
|
||||
// assumes little endian
|
||||
nonce.increment_le_inplace();
|
||||
self.adapter.push(gst::Buffer::from_mut_slice(plain));
|
||||
|
|
|
@ -73,7 +73,7 @@ impl State {
|
|||
let sender_key = props
|
||||
.sender_key
|
||||
.as_ref()
|
||||
.and_then(|k| box_::SecretKey::from_slice(&k))
|
||||
.and_then(|k| box_::SecretKey::from_slice(k))
|
||||
.ok_or_else(|| {
|
||||
gst::error_msg!(
|
||||
gst::ResourceError::NotFound,
|
||||
|
@ -88,7 +88,7 @@ impl State {
|
|||
let receiver_key = props
|
||||
.receiver_key
|
||||
.as_ref()
|
||||
.and_then(|k| box_::PublicKey::from_slice(&k))
|
||||
.and_then(|k| box_::PublicKey::from_slice(k))
|
||||
.ok_or_else(|| {
|
||||
gst::error_msg!(
|
||||
gst::ResourceError::NotFound,
|
||||
|
|
|
@ -134,7 +134,7 @@ impl AppSrcPadHandler {
|
|||
pad.push_event(stream_start_evt).await;
|
||||
|
||||
if let Some(ref caps) = state.caps {
|
||||
pad.push_event(gst::event::Caps::new(&caps)).await;
|
||||
pad.push_event(gst::event::Caps::new(caps)).await;
|
||||
*self.0.configured_caps.lock().unwrap() = Some(caps.clone());
|
||||
}
|
||||
|
||||
|
|
|
@ -110,7 +110,7 @@ impl InputSelectorPadSinkHandler {
|
|||
if let Some(segment) = &inner.segment {
|
||||
if let Some(segment) = segment.downcast_ref::<gst::format::Time>() {
|
||||
let rtime = segment.to_running_time(buffer.pts());
|
||||
let (sync_fut, abort_handle) = abortable(self.sync(&element, rtime));
|
||||
let (sync_fut, abort_handle) = abortable(self.sync(element, rtime));
|
||||
inner.abort_handle = Some(abort_handle);
|
||||
sync_future = Some(sync_fut.map_err(|_| gst::FlowError::Flushing));
|
||||
}
|
||||
|
@ -479,7 +479,7 @@ impl ObjectImpl for InputSelector {
|
|||
let pads = self.pads.lock().unwrap();
|
||||
let mut old_pad = None;
|
||||
if let Some(ref pad) = pad {
|
||||
if pads.sink_pads.get(&pad).is_some() {
|
||||
if pads.sink_pads.get(pad).is_some() {
|
||||
old_pad = state.active_sinkpad.clone();
|
||||
state.active_sinkpad = Some(pad.clone());
|
||||
state.switched_pad = true;
|
||||
|
@ -607,7 +607,7 @@ impl ElementImpl for InputSelector {
|
|||
let mut state = self.state.lock().unwrap();
|
||||
let mut pads = self.pads.lock().unwrap();
|
||||
let sink_pad =
|
||||
gst::Pad::from_template(&templ, Some(format!("sink_{}", pads.pad_serial).as_str()));
|
||||
gst::Pad::from_template(templ, Some(format!("sink_{}", pads.pad_serial).as_str()));
|
||||
pads.pad_serial += 1;
|
||||
sink_pad.set_active(true).unwrap();
|
||||
element.add_pad(&sink_pad).unwrap();
|
||||
|
|
|
@ -525,7 +525,7 @@ impl SinkHandler {
|
|||
// Reschedule if needed
|
||||
let (_, next_wakeup) =
|
||||
jb.src_pad_handler
|
||||
.next_wakeup(&element, &state, latency, context_wait);
|
||||
.next_wakeup(element, &state, latency, context_wait);
|
||||
if let Some((next_wakeup, _)) = next_wakeup {
|
||||
if let Some((previous_next_wakeup, ref abort_handle)) = state.wait_handle {
|
||||
if previous_next_wakeup.is_none()
|
||||
|
|
|
@ -902,7 +902,7 @@ impl TaskImpl for ProxySrcTask {
|
|||
|
||||
let pad = self.src_pad.upgrade().expect("PadSrc no longer exists");
|
||||
let proxysrc = ProxySrc::from_instance(&self.element);
|
||||
let res = ProxySrcPadHandler::push_item(&pad, &proxysrc, item).await;
|
||||
let res = ProxySrcPadHandler::push_item(&pad, proxysrc, item).await;
|
||||
match res {
|
||||
Ok(()) => {
|
||||
gst_log!(SRC_CAT, obj: &self.element, "Successfully pushed item");
|
||||
|
|
|
@ -368,7 +368,7 @@ impl TaskImpl for QueueTask {
|
|||
|
||||
let pad = self.src_pad.upgrade().expect("PadSrc no longer exists");
|
||||
let queue = Queue::from_instance(&self.element);
|
||||
let res = QueuePadSrcHandler::push_item(&pad, &queue, item).await;
|
||||
let res = QueuePadSrcHandler::push_item(&pad, queue, item).await;
|
||||
match res {
|
||||
Ok(()) => {
|
||||
gst_log!(CAT, obj: &self.element, "Successfully pushed item");
|
||||
|
@ -558,7 +558,7 @@ impl Queue {
|
|||
|
||||
let mut pending_queue = self.pending_queue.lock().unwrap();
|
||||
|
||||
if let Err(item) = self.queue_until_full(&dataqueue, &mut pending_queue, item) {
|
||||
if let Err(item) = self.queue_until_full(dataqueue, &mut pending_queue, item) {
|
||||
if pending_queue
|
||||
.as_ref()
|
||||
.map(|pq| !pq.scheduled)
|
||||
|
|
|
@ -1027,7 +1027,7 @@ impl StateMachine {
|
|||
task_inner: &Arc<Mutex<TaskInner>>,
|
||||
context: &Context,
|
||||
) -> Self {
|
||||
let task_inner_clone = Arc::clone(&task_inner);
|
||||
let task_inner_clone = Arc::clone(task_inner);
|
||||
let loop_fut = async move {
|
||||
let mut res = self.task_impl.start().await;
|
||||
if res.is_ok() {
|
||||
|
|
|
@ -148,7 +148,7 @@ impl TcpClientSrcPadHandler {
|
|||
pad.push_event(stream_start_evt).await;
|
||||
|
||||
if let Some(ref caps) = state.caps {
|
||||
pad.push_event(gst::event::Caps::new(&caps)).await;
|
||||
pad.push_event(gst::event::Caps::new(caps)).await;
|
||||
*self.0.configured_caps.lock().unwrap() = Some(caps.clone());
|
||||
}
|
||||
|
||||
|
|
|
@ -441,7 +441,7 @@ impl UdpSinkPadHandler {
|
|||
|
||||
if !clients_to_configure.is_empty() {
|
||||
for client in &clients_to_configure {
|
||||
self.configure_client(&settings, &mut socket, &mut socket_v6, &client)
|
||||
self.configure_client(&settings, &mut socket, &mut socket_v6, client)
|
||||
.map_err(|err| {
|
||||
element_error!(
|
||||
element,
|
||||
|
@ -456,7 +456,7 @@ impl UdpSinkPadHandler {
|
|||
|
||||
if !clients_to_unconfigure.is_empty() {
|
||||
for client in &clients_to_unconfigure {
|
||||
self.unconfigure_client(&settings, &mut socket, &mut socket_v6, &client)
|
||||
self.unconfigure_client(&settings, &mut socket, &mut socket_v6, client)
|
||||
.map_err(|err| {
|
||||
element_error!(
|
||||
element,
|
||||
|
@ -470,7 +470,7 @@ impl UdpSinkPadHandler {
|
|||
}
|
||||
|
||||
if do_sync {
|
||||
self.sync(&element, rtime).await;
|
||||
self.sync(element, rtime).await;
|
||||
}
|
||||
|
||||
let data = buffer.map_readable().map_err(|_| {
|
||||
|
@ -876,7 +876,7 @@ impl UdpSink {
|
|||
self.prepare_socket(SocketFamily::Ipv6, &context, element)?;
|
||||
|
||||
self.task
|
||||
.prepare(UdpSinkTask::new(&element, &self.sink_pad_handler), context)
|
||||
.prepare(UdpSinkTask::new(element, &self.sink_pad_handler), context)
|
||||
.map_err(|err| {
|
||||
error_msg!(
|
||||
gst::ResourceError::OpenRead,
|
||||
|
@ -916,17 +916,17 @@ impl UdpSink {
|
|||
impl UdpSink {
|
||||
fn clear_clients(&self, clients_to_add: impl Iterator<Item = SocketAddr>) {
|
||||
self.sink_pad_handler
|
||||
.clear_clients(&self.sink_pad.gst_pad(), clients_to_add);
|
||||
.clear_clients(self.sink_pad.gst_pad(), clients_to_add);
|
||||
}
|
||||
|
||||
fn remove_client(&self, addr: SocketAddr) {
|
||||
self.sink_pad_handler
|
||||
.remove_client(&self.sink_pad.gst_pad(), addr);
|
||||
.remove_client(self.sink_pad.gst_pad(), addr);
|
||||
}
|
||||
|
||||
fn add_client(&self, addr: SocketAddr) {
|
||||
self.sink_pad_handler
|
||||
.add_client(&self.sink_pad.gst_pad(), addr);
|
||||
.add_client(self.sink_pad.gst_pad(), addr);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1249,7 +1249,7 @@ impl ObjectImpl for UdpSink {
|
|||
.map_err(|err| {
|
||||
gst_error!(CAT, obj: obj, "Invalid port {}: {}", rsplit[0], err);
|
||||
})
|
||||
.and_then(|port| try_into_socket_addr(&obj, rsplit[1], port))
|
||||
.and_then(|port| try_into_socket_addr(obj, rsplit[1], port))
|
||||
.ok()
|
||||
} else {
|
||||
None
|
||||
|
|
|
@ -165,7 +165,7 @@ impl UdpSrcPadHandler {
|
|||
pad.push_event(stream_start_evt).await;
|
||||
|
||||
if let Some(ref caps) = state.caps {
|
||||
pad.push_event(gst::event::Caps::new(&caps)).await;
|
||||
pad.push_event(gst::event::Caps::new(caps)).await;
|
||||
*self.0.configured_caps.lock().unwrap() = Some(caps.clone());
|
||||
}
|
||||
|
||||
|
|
|
@ -524,7 +524,7 @@ mod imp_sink {
|
|||
|
||||
match event.view() {
|
||||
EventView::FlushStart(..) => {
|
||||
elem_sink_test.stop(&element.downcast_ref::<super::ElementSinkTest>().unwrap());
|
||||
elem_sink_test.stop(element.downcast_ref::<super::ElementSinkTest>().unwrap());
|
||||
true
|
||||
}
|
||||
_ => false,
|
||||
|
@ -953,9 +953,9 @@ fn nominal_scenario(
|
|||
fn src_sink_nominal() {
|
||||
let name = "src_sink_nominal";
|
||||
|
||||
let (pipeline, src_element, _sink_element, receiver) = setup(&name, None, None);
|
||||
let (pipeline, src_element, _sink_element, receiver) = setup(name, None, None);
|
||||
|
||||
nominal_scenario(&name, pipeline, src_element, receiver);
|
||||
nominal_scenario(name, pipeline, src_element, receiver);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -974,7 +974,7 @@ fn src_tsqueue_sink_nominal() {
|
|||
|
||||
let (pipeline, src_element, _sink_element, receiver) = setup(name, Some(ts_queue), None);
|
||||
|
||||
nominal_scenario(&name, pipeline, src_element, receiver);
|
||||
nominal_scenario(name, pipeline, src_element, receiver);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -986,7 +986,7 @@ fn src_queue_sink_nominal() {
|
|||
let queue = gst::ElementFactory::make("queue", Some("queue")).unwrap();
|
||||
let (pipeline, src_element, _sink_element, receiver) = setup(name, Some(queue), None);
|
||||
|
||||
nominal_scenario(&name, pipeline, src_element, receiver);
|
||||
nominal_scenario(name, pipeline, src_element, receiver);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -1014,7 +1014,7 @@ fn src_tsproxy_sink_nominal() {
|
|||
let (pipeline, src_element, _sink_element, receiver) =
|
||||
setup(name, Some(ts_proxy_sink), Some(ts_proxy_src));
|
||||
|
||||
nominal_scenario(&name, pipeline, src_element, receiver);
|
||||
nominal_scenario(name, pipeline, src_element, receiver);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -1023,7 +1023,7 @@ fn start_pause_start() {
|
|||
|
||||
let scenario_name = "start_pause_start";
|
||||
|
||||
let (pipeline, src_element, _sink_element, mut receiver) = setup(&scenario_name, None, None);
|
||||
let (pipeline, src_element, _sink_element, mut receiver) = setup(scenario_name, None, None);
|
||||
|
||||
let elem_src_test = imp_src::ElementSrcTest::from_instance(&src_element);
|
||||
|
||||
|
@ -1101,7 +1101,7 @@ fn start_stop_start() {
|
|||
|
||||
let scenario_name = "start_stop_start";
|
||||
|
||||
let (pipeline, src_element, _sink_element, mut receiver) = setup(&scenario_name, None, None);
|
||||
let (pipeline, src_element, _sink_element, mut receiver) = setup(scenario_name, None, None);
|
||||
|
||||
let elem_src_test = imp_src::ElementSrcTest::from_instance(&src_element);
|
||||
|
||||
|
@ -1214,7 +1214,7 @@ fn start_flush() {
|
|||
|
||||
let scenario_name = "start_flush";
|
||||
|
||||
let (pipeline, src_element, sink_element, mut receiver) = setup(&scenario_name, None, None);
|
||||
let (pipeline, src_element, sink_element, mut receiver) = setup(scenario_name, None, None);
|
||||
|
||||
let elem_src_test = imp_src::ElementSrcTest::from_instance(&src_element);
|
||||
|
||||
|
|
|
@ -122,7 +122,7 @@ fn test_chain() {
|
|||
init();
|
||||
|
||||
let mut h = gst_check::Harness::new("ts-udpsink");
|
||||
h.set_src_caps_str(&"foo/bar");
|
||||
h.set_src_caps_str("foo/bar");
|
||||
{
|
||||
let udpsink = h.element().unwrap();
|
||||
udpsink.set_property("clients", &"127.0.0.1:5005").unwrap();
|
||||
|
|
|
@ -1274,7 +1274,7 @@ impl URIHandlerImpl for ReqwestHttpSrc {
|
|||
}
|
||||
|
||||
fn set_uri(&self, element: &Self::Type, uri: &str) -> Result<(), glib::Error> {
|
||||
self.set_location(&element, Some(uri))
|
||||
self.set_location(element, Some(uri))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -486,7 +486,7 @@ impl Transcriber {
|
|||
|
||||
if packet_is_exception(&pkt) {
|
||||
let message: ExceptionMessage =
|
||||
serde_json::from_str(&payload).map_err(|err| {
|
||||
serde_json::from_str(payload).map_err(|err| {
|
||||
gst_error!(
|
||||
CAT,
|
||||
obj: element,
|
||||
|
@ -512,7 +512,7 @@ impl Transcriber {
|
|||
));
|
||||
}
|
||||
|
||||
let transcript: Transcript = serde_json::from_str(&payload).map_err(|err| {
|
||||
let transcript: Transcript = serde_json::from_str(payload).map_err(|err| {
|
||||
error_msg!(
|
||||
gst::StreamError::Failed,
|
||||
["Unexpected binary message: {} ({})", payload, err]
|
||||
|
@ -802,7 +802,7 @@ impl Transcriber {
|
|||
|
||||
self.ensure_connection(element).map_err(|err| {
|
||||
element_error!(
|
||||
&element,
|
||||
element,
|
||||
gst::StreamError::Failed,
|
||||
["Streaming failed: {}", err]
|
||||
);
|
||||
|
|
|
@ -130,7 +130,7 @@ impl State {
|
|||
}
|
||||
};
|
||||
|
||||
let line: Line = serde_json::from_slice(&line).map_err(|err| (line, err))?;
|
||||
let line: Line = serde_json::from_slice(line).map_err(|err| (line, err))?;
|
||||
|
||||
Ok(Some(line))
|
||||
}
|
||||
|
@ -181,7 +181,7 @@ impl State {
|
|||
self.need_segment = false;
|
||||
}
|
||||
|
||||
events.extend(self.pending_events.drain(..));
|
||||
events.append(&mut self.pending_events);
|
||||
events
|
||||
}
|
||||
|
||||
|
@ -501,7 +501,7 @@ impl JsonGstParse {
|
|||
pts,
|
||||
duration,
|
||||
data: _data,
|
||||
}) = serde_json::from_slice(&line)
|
||||
}) = serde_json::from_slice(line)
|
||||
{
|
||||
last_pts = pts.zip(duration).map(|(pts, duration)| pts + duration);
|
||||
}
|
||||
|
|
|
@ -88,8 +88,8 @@ fn test_parse() {
|
|||
match ev.view() {
|
||||
EventView::Caps(ev) => {
|
||||
assert!(ev.caps().is_strictly_equal(&gst::Caps::new_simple(
|
||||
&"application/x-json",
|
||||
&[(&"format", &"test")]
|
||||
"application/x-json",
|
||||
&[("format", &"test")]
|
||||
)));
|
||||
}
|
||||
_ => (),
|
||||
|
|
|
@ -259,7 +259,7 @@ impl ObjectImpl for RegEx {
|
|||
Operation::ReplaceAll(ref replacement) => {
|
||||
commands.push(
|
||||
gst::Structure::new(
|
||||
&"replace-all",
|
||||
"replace-all",
|
||||
&[("pattern", &command.pattern), ("replacement", &replacement)],
|
||||
)
|
||||
.to_send_value(),
|
||||
|
|
|
@ -36,7 +36,7 @@ fn create_pipeline() -> (gst::Pipeline, gst::Pad, gst::Element, gtk::Widget) {
|
|||
let video_src = gst::parse_bin_from_description(MAIN_PIPELINE, true)
|
||||
.unwrap()
|
||||
.upcast();
|
||||
let fallback_video_src = gst::parse_bin_from_description(&FALLBACK_PIPELINE, true)
|
||||
let fallback_video_src = gst::parse_bin_from_description(FALLBACK_PIPELINE, true)
|
||||
.unwrap()
|
||||
.upcast();
|
||||
|
||||
|
|
|
@ -162,7 +162,7 @@ impl BinImpl for CustomSource {
|
|||
// TODO: Drop stream collection message for now, we only create a simple custom
|
||||
// one here so that fallbacksrc can know about our streams. It is never
|
||||
// forwarded.
|
||||
self.handle_source_no_more_pads(&bin);
|
||||
self.handle_source_no_more_pads(bin);
|
||||
}
|
||||
_ => self.parent_handle_message(bin, msg),
|
||||
}
|
||||
|
@ -198,14 +198,14 @@ impl CustomSource {
|
|||
|
||||
// Handle all source pads that already exist
|
||||
for pad in source.src_pads() {
|
||||
if let Err(msg) = self.handle_source_pad_added(&element, &pad) {
|
||||
if let Err(msg) = self.handle_source_pad_added(element, &pad) {
|
||||
element.post_error_message(msg);
|
||||
return Err(gst::StateChangeError);
|
||||
}
|
||||
}
|
||||
|
||||
if !has_sometimes_pads {
|
||||
self.handle_source_no_more_pads(&element);
|
||||
self.handle_source_no_more_pads(element);
|
||||
} else {
|
||||
gst_debug!(CAT, obj: element, "Found sometimes pads");
|
||||
|
||||
|
|
|
@ -361,7 +361,7 @@ impl FallbackSwitch {
|
|||
|
||||
// Drop all older buffers from the fallback sinkpad
|
||||
if let Some(backup_pad) = backup_pad {
|
||||
self.drain_pad_to_time(state, &backup_pad, state.last_output_time)?;
|
||||
self.drain_pad_to_time(state, backup_pad, state.last_output_time)?;
|
||||
}
|
||||
|
||||
Ok(Some((buffer, active_caps, pad_change)))
|
||||
|
@ -607,7 +607,7 @@ impl FallbackSwitch {
|
|||
"No primary buffer, but can't autoswitch - draining backup pad"
|
||||
);
|
||||
if let Some(backup_pad) = &backup_pad {
|
||||
if let Err(e) = self.drain_pad_to_time(&mut *state, &backup_pad, cur_running_time) {
|
||||
if let Err(e) = self.drain_pad_to_time(&mut *state, backup_pad, cur_running_time) {
|
||||
return (
|
||||
Err(e),
|
||||
state.check_health_changes(
|
||||
|
@ -917,11 +917,9 @@ impl ElementImpl for FallbackSwitch {
|
|||
return None;
|
||||
}
|
||||
|
||||
let sinkpad = gst::PadBuilder::<gst_base::AggregatorPad>::from_template(
|
||||
&templ,
|
||||
Some("fallback_sink"),
|
||||
)
|
||||
.build();
|
||||
let sinkpad =
|
||||
gst::PadBuilder::<gst_base::AggregatorPad>::from_template(templ, Some("fallback_sink"))
|
||||
.build();
|
||||
|
||||
*fallback_sinkpad = Some(sinkpad.clone());
|
||||
drop(fallback_sinkpad);
|
||||
|
|
|
@ -399,7 +399,7 @@ fn setup_pipeline(with_live_fallback: Option<bool>) -> Pipeline {
|
|||
let queue = gst::ElementFactory::make("queue", None).unwrap();
|
||||
|
||||
pipeline
|
||||
.add_many(&[src.upcast_ref(), &switch, &queue, &sink.upcast_ref()])
|
||||
.add_many(&[src.upcast_ref(), &switch, &queue, sink.upcast_ref()])
|
||||
.unwrap();
|
||||
src.link_pads(Some("src"), &switch, Some("sink")).unwrap();
|
||||
switch.link_pads(Some("src"), &queue, Some("sink")).unwrap();
|
||||
|
|
|
@ -135,7 +135,7 @@ impl VideoDecoderImpl for CdgDec {
|
|||
})?;
|
||||
let data = map.as_slice();
|
||||
|
||||
cdg::decode_subchannel_cmd(&data)
|
||||
cdg::decode_subchannel_cmd(data)
|
||||
};
|
||||
|
||||
let cmd = match cmd {
|
||||
|
|
|
@ -131,7 +131,7 @@ impl Cea608Overlay {
|
|||
context.set_base_dir(pango::Direction::Ltr);
|
||||
let layout = pango::Layout::new(&context);
|
||||
layout.set_alignment(pango::Alignment::Left);
|
||||
let mut font_desc = pango::FontDescription::from_string(&"monospace");
|
||||
let mut font_desc = pango::FontDescription::from_string("monospace");
|
||||
|
||||
let mut font_size = 1;
|
||||
let mut left_alignment = 0;
|
||||
|
@ -139,7 +139,7 @@ impl Cea608Overlay {
|
|||
font_desc.set_size(font_size * pango::SCALE);
|
||||
layout.set_font_description(Some(&font_desc));
|
||||
layout.set_text(
|
||||
&"12345678901234567890123456789012\n2\n3\n4\n5\n6\n7\n8\n9\n0\n1\n2\n3\n4\n5",
|
||||
"12345678901234567890123456789012\n2\n3\n4\n5\n6\n7\n8\n9\n0\n1\n2\n3\n4\n5",
|
||||
);
|
||||
let (_ink_rect, logical_rect) = layout.extents();
|
||||
if logical_rect.width > video_info.width() as i32 * pango::SCALE
|
||||
|
@ -222,7 +222,7 @@ impl Cea608Overlay {
|
|||
|
||||
cr.set_source_rgba(0.0, 0.0, 0.0, 1.0);
|
||||
|
||||
pangocairo::functions::layout_path(&cr, &layout);
|
||||
pangocairo::functions::layout_path(&cr, layout);
|
||||
cr.stroke().ok()?;
|
||||
cr.restore().ok()?;
|
||||
|
||||
|
@ -230,7 +230,7 @@ impl Cea608Overlay {
|
|||
cr.save().ok()?;
|
||||
cr.set_source_rgba(255.0, 255.0, 255.0, 1.0);
|
||||
|
||||
pangocairo::functions::show_layout(&cr, &layout);
|
||||
pangocairo::functions::show_layout(&cr, layout);
|
||||
|
||||
cr.restore().ok()?;
|
||||
drop(cr);
|
||||
|
@ -496,7 +496,7 @@ impl Cea608Overlay {
|
|||
if let Some(composition) = &state.composition {
|
||||
let buffer = buffer.make_mut();
|
||||
if state.attach {
|
||||
gst_video::VideoOverlayCompositionMeta::add(buffer, &composition);
|
||||
gst_video::VideoOverlayCompositionMeta::add(buffer, composition);
|
||||
} else {
|
||||
let mut frame = gst_video::VideoFrameRef::from_buffer_ref_writable(
|
||||
buffer,
|
||||
|
|
|
@ -262,9 +262,9 @@ impl State {
|
|||
framerate: gst::Fraction,
|
||||
) {
|
||||
let buffer = buffer.get_mut().unwrap();
|
||||
gst_video::VideoTimeCodeMeta::add(buffer, &timecode);
|
||||
gst_video::VideoTimeCodeMeta::add(buffer, timecode);
|
||||
|
||||
self.update_timestamp(element, &timecode);
|
||||
self.update_timestamp(element, timecode);
|
||||
|
||||
buffer.set_pts(self.last_position);
|
||||
|
||||
|
@ -336,7 +336,7 @@ impl State {
|
|||
self.need_segment = false;
|
||||
}
|
||||
|
||||
events.extend(self.pending_events.drain(..));
|
||||
events.append(&mut self.pending_events);
|
||||
events
|
||||
}
|
||||
}
|
||||
|
|
|
@ -159,7 +159,7 @@ impl State {
|
|||
framerate: gst::Fraction,
|
||||
element: &super::SccParse,
|
||||
) -> Result<gst_video::ValidVideoTimeCode, gst::FlowError> {
|
||||
match parse_timecode(framerate, &tc) {
|
||||
match parse_timecode(framerate, tc) {
|
||||
Ok(timecode) => Ok(timecode),
|
||||
Err(err) => {
|
||||
let last_timecode =
|
||||
|
@ -222,7 +222,7 @@ impl State {
|
|||
element: &super::SccParse,
|
||||
) {
|
||||
let buffer = buffer.get_mut().unwrap();
|
||||
gst_video::VideoTimeCodeMeta::add(buffer, &timecode);
|
||||
gst_video::VideoTimeCodeMeta::add(buffer, timecode);
|
||||
|
||||
self.update_timestamp(timecode, element);
|
||||
|
||||
|
@ -284,7 +284,7 @@ impl State {
|
|||
self.need_segment = false;
|
||||
}
|
||||
|
||||
events.extend(self.pending_events.drain(..));
|
||||
events.append(&mut self.pending_events);
|
||||
events
|
||||
}
|
||||
}
|
||||
|
|
|
@ -721,7 +721,7 @@ impl ObjectImpl for TranscriberBin {
|
|||
}
|
||||
"transcriber" => {
|
||||
let state = self.state.lock().unwrap();
|
||||
if let Some(ref state) = state.as_ref() {
|
||||
if let Some(state) = state.as_ref() {
|
||||
state.transcriber.to_value()
|
||||
} else {
|
||||
let ret: Option<gst::Element> = None;
|
||||
|
|
|
@ -253,14 +253,14 @@ impl Dav1dDec {
|
|||
pic: &dav1d::Picture,
|
||||
format: gst_video::VideoFormat,
|
||||
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||
self.handle_resolution_change(element, &pic, format)?;
|
||||
self.handle_resolution_change(element, pic, format)?;
|
||||
|
||||
let output_state = element
|
||||
.output_state()
|
||||
.expect("Output state not set. Shouldn't happen!");
|
||||
let offset = pic.offset() as i32;
|
||||
if let Some(mut frame) = element.frame(offset) {
|
||||
let output_buffer = self.decoded_picture_as_buffer(&pic, output_state)?;
|
||||
let output_buffer = self.decoded_picture_as_buffer(pic, output_state)?;
|
||||
frame.set_output_buffer(output_buffer);
|
||||
element.finish_frame(frame)?;
|
||||
} else {
|
||||
|
|
|
@ -661,7 +661,7 @@ impl FlvDemux {
|
|||
let full_stream_id = srcpad.create_stream_id(element, Some(name));
|
||||
// FIXME group id
|
||||
srcpad.push_event(gst::event::StreamStart::new(&full_stream_id));
|
||||
srcpad.push_event(gst::event::Caps::new(&caps));
|
||||
srcpad.push_event(gst::event::Caps::new(caps));
|
||||
|
||||
// FIXME proper segment handling
|
||||
let segment = gst::FormattedSegment::<gst::ClockTime>::default();
|
||||
|
@ -940,7 +940,7 @@ impl StreamingState {
|
|||
|
||||
// AAC special case
|
||||
if data_header.sound_format == flavors::SoundFormat::AAC
|
||||
&& self.handle_aac_audio_packet_header(element, &tag_header, adapter)?
|
||||
&& self.handle_aac_audio_packet_header(element, tag_header, adapter)?
|
||||
{
|
||||
return Ok(events);
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ fn test_encode(video_info: &gst_video::VideoInfo) {
|
|||
buffer.set_pts(gst::ClockTime::from_seconds(pts));
|
||||
}
|
||||
let mut vframe =
|
||||
gst_video::VideoFrame::from_buffer_writable(buffer, &video_info).unwrap();
|
||||
gst_video::VideoFrame::from_buffer_writable(buffer, video_info).unwrap();
|
||||
for v in vframe.plane_data_mut(0).unwrap() {
|
||||
*v = 128;
|
||||
}
|
||||
|
|
|
@ -128,7 +128,7 @@ fn test_encode(video_info: &gst_video::VideoInfo) {
|
|||
|
||||
let buffer = {
|
||||
let buffer = gst::Buffer::with_size(video_info.size()).unwrap();
|
||||
let mut vframe = gst_video::VideoFrame::from_buffer_writable(buffer, &video_info).unwrap();
|
||||
let mut vframe = gst_video::VideoFrame::from_buffer_writable(buffer, video_info).unwrap();
|
||||
|
||||
for v in vframe.plane_data_mut(0).unwrap() {
|
||||
*v = 0;
|
||||
|
|
|
@ -73,7 +73,7 @@ fn test_png_encode(video_info: &gst_video::VideoInfo) {
|
|||
buffer.set_pts(gst::ClockTime::from_seconds(pts));
|
||||
}
|
||||
let mut vframe =
|
||||
gst_video::VideoFrame::from_buffer_writable(buffer, &video_info).unwrap();
|
||||
gst_video::VideoFrame::from_buffer_writable(buffer, video_info).unwrap();
|
||||
for v in vframe.plane_data_mut(0).unwrap() {
|
||||
*v = 128;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue