forked from mirrors/gstreamer-rs
Fix various new clippy warnings
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1203>
This commit is contained in:
parent
7efc22ebc9
commit
f24b38470b
93 changed files with 228 additions and 259 deletions
|
@ -21,7 +21,7 @@ use gst::{element_error, prelude::*};
|
|||
mod examples_common;
|
||||
|
||||
#[derive(Debug, Display, Error)]
|
||||
#[display(fmt = "Received error from {}: {} (debug: {:?})", src, error, debug)]
|
||||
#[display(fmt = "Received error from {src}: {error} (debug: {debug:?})")]
|
||||
struct ErrorMessage {
|
||||
src: glib::GString,
|
||||
error: glib::Error,
|
||||
|
@ -107,7 +107,7 @@ fn create_pipeline() -> Result<gst::Pipeline, Error> {
|
|||
})
|
||||
.sum();
|
||||
let rms = (sum / (samples.len() as f64)).sqrt();
|
||||
println!("rms: {}", rms);
|
||||
println!("rms: {rms}");
|
||||
|
||||
Ok(gst::FlowSuccess::Ok)
|
||||
})
|
||||
|
@ -153,7 +153,7 @@ fn main_loop(pipeline: gst::Pipeline) -> Result<(), Error> {
|
|||
fn example_main() {
|
||||
match create_pipeline().and_then(main_loop) {
|
||||
Ok(r) => r,
|
||||
Err(e) => eprintln!("Error! {}", e),
|
||||
Err(e) => eprintln!("Error! {e}"),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ use gst::prelude::*;
|
|||
mod examples_common;
|
||||
|
||||
#[derive(Debug, Display, Error)]
|
||||
#[display(fmt = "Received error from {}: {} (debug: {:?})", src, error, debug)]
|
||||
#[display(fmt = "Received error from {src}: {error} (debug: {debug:?})")]
|
||||
struct ErrorMessage {
|
||||
src: glib::GString,
|
||||
error: glib::Error,
|
||||
|
@ -75,7 +75,7 @@ fn create_pipeline() -> Result<gst::Pipeline, Error> {
|
|||
return;
|
||||
}
|
||||
|
||||
println!("Producing frame {}", i);
|
||||
println!("Producing frame {i}");
|
||||
|
||||
let r = if i % 2 == 0 { 0 } else { 255 };
|
||||
let g = if i % 3 == 0 { 0 } else { 255 };
|
||||
|
@ -169,7 +169,7 @@ fn main_loop(pipeline: gst::Pipeline) -> Result<(), Error> {
|
|||
fn example_main() {
|
||||
match create_pipeline().and_then(main_loop) {
|
||||
Ok(r) => r,
|
||||
Err(e) => eprintln!("Error! {}", e),
|
||||
Err(e) => eprintln!("Error! {e}"),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -117,10 +117,7 @@ fn example_main() {
|
|||
Some(pipeline) => pipeline,
|
||||
None => return glib::Continue(false),
|
||||
};
|
||||
println!(
|
||||
"Sending custom event to the pipeline with send_eos={}",
|
||||
send_eos
|
||||
);
|
||||
println!("Sending custom event to the pipeline with send_eos={send_eos}");
|
||||
let ev = ExampleCustomEvent::new(*send_eos);
|
||||
if !pipeline.send_event(ev) {
|
||||
println!("Warning: Failed to send custom event");
|
||||
|
|
|
@ -200,13 +200,13 @@ fn example_main() {
|
|||
return;
|
||||
}
|
||||
|
||||
println!("Producing buffer {}", i);
|
||||
println!("Producing buffer {i}");
|
||||
|
||||
// Add a custom meta with a label to this buffer.
|
||||
let mut buffer = gst::Buffer::new();
|
||||
{
|
||||
let buffer = buffer.get_mut().unwrap();
|
||||
custom_meta::CustomMeta::add(buffer, format!("This is buffer {}", i));
|
||||
custom_meta::CustomMeta::add(buffer, format!("This is buffer {i}"));
|
||||
}
|
||||
|
||||
i += 1;
|
||||
|
|
|
@ -33,7 +33,7 @@ fn example_main() {
|
|||
if let Some(gst::ParseError::NoSuchElement) = err.kind::<gst::ParseError>() {
|
||||
println!("Missing element(s): {:?}", context.missing_elements());
|
||||
} else {
|
||||
println!("Failed to parse pipeline: {}", err);
|
||||
println!("Failed to parse pipeline: {err}");
|
||||
}
|
||||
|
||||
process::exit(-1)
|
||||
|
@ -74,7 +74,7 @@ fn example_main() {
|
|||
|
||||
println!("Dumping debug logs\n");
|
||||
for s in gst::debug_ring_buffer_logger_get_logs().iter() {
|
||||
println!("{}\n------------------", s);
|
||||
println!("{s}\n------------------");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ use gst::{element_error, element_warning, prelude::*};
|
|||
mod examples_common;
|
||||
|
||||
#[derive(Debug, Display, Error)]
|
||||
#[display(fmt = "Received error from {}: {} (debug: {:?})", src, error, debug)]
|
||||
#[display(fmt = "Received error from {src}: {error} (debug: {debug:?})")]
|
||||
struct ErrorMessage {
|
||||
src: glib::GString,
|
||||
error: glib::Error,
|
||||
|
@ -264,6 +264,6 @@ fn main() {
|
|||
// (but not necessary in normal Cocoa applications where this is set up automatically)
|
||||
match examples_common::run(example_main) {
|
||||
Ok(r) => r,
|
||||
Err(e) => eprintln!("Error! {}", e),
|
||||
Err(e) => eprintln!("Error! {e}"),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ use gst_pbutils::{prelude::*, DiscovererInfo, DiscovererStreamInfo};
|
|||
mod examples_common;
|
||||
|
||||
#[derive(Debug, Display, Error)]
|
||||
#[display(fmt = "Discoverer error {}", _0)]
|
||||
#[display(fmt = "Discoverer error {_0}")]
|
||||
struct DiscovererError(#[error(not(source))] &'static str);
|
||||
|
||||
fn print_tags(info: &DiscovererInfo) {
|
||||
|
@ -27,7 +27,7 @@ fn print_tags(info: &DiscovererInfo) {
|
|||
let tags = info.tags();
|
||||
match tags {
|
||||
Some(taglist) => {
|
||||
println!(" {}", taglist); // FIXME use an iterator
|
||||
println!(" {taglist}"); // FIXME use an iterator
|
||||
}
|
||||
None => {
|
||||
println!(" no tags");
|
||||
|
@ -42,7 +42,7 @@ fn print_stream_info(stream: &DiscovererStreamInfo) {
|
|||
Some(caps) => caps.to_string(),
|
||||
None => String::from("--"),
|
||||
};
|
||||
println!(" Format: {}", caps_str);
|
||||
println!(" Format: {caps_str}");
|
||||
}
|
||||
|
||||
fn print_discoverer_info(info: &DiscovererInfo) -> Result<(), Error> {
|
||||
|
@ -85,7 +85,7 @@ fn run_discoverer() -> Result<(), Error> {
|
|||
fn example_main() {
|
||||
match run_discoverer() {
|
||||
Ok(_) => (),
|
||||
Err(e) => eprintln!("Error: {}", e),
|
||||
Err(e) => eprintln!("Error: {e}"),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ use gst_pbutils::prelude::*;
|
|||
mod examples_common;
|
||||
|
||||
#[derive(Debug, Display, Error)]
|
||||
#[display(fmt = "Received error from {}: {} (debug: {:?})", src, error, debug)]
|
||||
#[display(fmt = "Received error from {src}: {error} (debug: {debug:?})")]
|
||||
struct ErrorMessage {
|
||||
src: glib::GString,
|
||||
error: glib::Error,
|
||||
|
@ -281,6 +281,6 @@ fn main() {
|
|||
// (but not necessary in normal Cocoa applications where this is set up automatically)
|
||||
match examples_common::run(example_main) {
|
||||
Ok(r) => r,
|
||||
Err(e) => eprintln!("Error! {}", e),
|
||||
Err(e) => eprintln!("Error! {e}"),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -341,7 +341,7 @@ fn main() {
|
|||
// (but not necessary in normal Cocoa applications where this is set up automatically)
|
||||
match examples_common::run(example_main) {
|
||||
Ok(r) => r,
|
||||
Err(e) => eprintln!("Error! {}", e),
|
||||
Err(e) => eprintln!("Error! {e}"),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ fn configure_pipeline(pipeline: &ges::Pipeline, output_name: &str) {
|
|||
.build();
|
||||
|
||||
// Apply the EncodingProfile to the pipeline, and set it to render mode
|
||||
let output_uri = format!("{}.webm", output_name);
|
||||
let output_uri = format!("{output_name}.webm");
|
||||
pipeline
|
||||
.set_render_settings(&output_uri, &container_profile)
|
||||
.expect("Failed to set render settings");
|
||||
|
@ -168,7 +168,7 @@ fn example_main() {
|
|||
|
||||
match main_loop(input_uri, output) {
|
||||
Ok(r) => r,
|
||||
Err(e) => eprintln!("Error! {}", e),
|
||||
Err(e) => eprintln!("Error! {e}"),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -166,7 +166,7 @@ fn example_main() {
|
|||
let glfilter = mirror::GLMirrorFilter::new(Some("foo"));
|
||||
App::new(Some(glfilter.as_ref()))
|
||||
.and_then(main_loop)
|
||||
.unwrap_or_else(|e| eprintln!("Error! {}", e))
|
||||
.unwrap_or_else(|e| eprintln!("Error! {e}"))
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -10,7 +10,7 @@ pub mod examples_common;
|
|||
fn example_main() {
|
||||
App::new(None)
|
||||
.and_then(main_loop)
|
||||
.unwrap_or_else(|e| eprintln!("Error! {}", e))
|
||||
.unwrap_or_else(|e| eprintln!("Error! {e}"))
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -53,7 +53,7 @@ fn set_window_handle(video_overlay: &gst_video::VideoOverlay, gdk_window: &gdk::
|
|||
video_overlay.set_window_handle(xid as usize);
|
||||
}
|
||||
} else {
|
||||
println!("Add support for display type '{}'", display_type_name);
|
||||
println!("Add support for display type '{display_type_name}'");
|
||||
process::exit(-1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ fn example_main() {
|
|||
if let Some(gst::ParseError::NoSuchElement) = err.kind::<gst::ParseError>() {
|
||||
println!("Missing element(s): {:?}", context.missing_elements());
|
||||
} else {
|
||||
println!("Failed to parse pipeline: {}", err);
|
||||
println!("Failed to parse pipeline: {err}");
|
||||
}
|
||||
|
||||
process::exit(-1)
|
||||
|
|
|
@ -22,7 +22,7 @@ use pango::prelude::*;
|
|||
mod examples_common;
|
||||
|
||||
#[derive(Debug, Display, Error)]
|
||||
#[display(fmt = "Received error from {}: {} (debug: {:?})", src, error, debug)]
|
||||
#[display(fmt = "Received error from {src}: {error} (debug: {debug:?})")]
|
||||
struct ErrorMessage {
|
||||
src: glib::GString,
|
||||
error: glib::Error,
|
||||
|
@ -293,7 +293,7 @@ fn main_loop(pipeline: gst::Pipeline) -> Result<(), Error> {
|
|||
fn example_main() {
|
||||
match create_pipeline().and_then(main_loop) {
|
||||
Ok(r) => r,
|
||||
Err(e) => eprintln!("Error! {}", e),
|
||||
Err(e) => eprintln!("Error! {e}"),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ fn example_main() {
|
|||
})
|
||||
.sum();
|
||||
let rms = (sum / (samples.len() as f64)).sqrt();
|
||||
println!("rms: {}", rms);
|
||||
println!("rms: {rms}");
|
||||
}
|
||||
|
||||
gst::PadProbeReturn::Ok
|
||||
|
|
|
@ -25,7 +25,7 @@ use pango::prelude::*;
|
|||
mod examples_common;
|
||||
|
||||
#[derive(Debug, Display, Error)]
|
||||
#[display(fmt = "Received error from {}: {} (debug: {:?})", src, error, debug)]
|
||||
#[display(fmt = "Received error from {src}: {error} (debug: {debug:?})")]
|
||||
struct ErrorMessage {
|
||||
src: glib::GString,
|
||||
error: glib::Error,
|
||||
|
@ -237,7 +237,7 @@ fn main_loop(pipeline: gst::Pipeline) -> Result<(), Error> {
|
|||
fn example_main() {
|
||||
match create_pipeline().and_then(main_loop) {
|
||||
Ok(r) => r,
|
||||
Err(e) => eprintln!("Error! {}", e),
|
||||
Err(e) => eprintln!("Error! {e}"),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ fn example_main() {
|
|||
|
||||
match main_loop(uri) {
|
||||
Ok(r) => r,
|
||||
Err(e) => eprintln!("Error! {}", e),
|
||||
Err(e) => eprintln!("Error! {e}"),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ fn example_main() {
|
|||
.get::<i32>()
|
||||
.expect("playbin \"audio-tags-changed\" signal values[1]");
|
||||
|
||||
println!("audio tags of audio stream {} changed:", idx);
|
||||
println!("audio tags of audio stream {idx} changed:");
|
||||
|
||||
// HELP: is this correct?
|
||||
// We were only notified about the change of metadata. If we want to do
|
||||
|
|
|
@ -76,7 +76,7 @@ fn example_main() {
|
|||
|
||||
match main_loop(uri) {
|
||||
Ok(r) => r,
|
||||
Err(e) => eprintln!("Error! {}", e),
|
||||
Err(e) => eprintln!("Error! {e}"),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -9,19 +9,19 @@ use anyhow::Error;
|
|||
use derive_more::{Display, Error};
|
||||
|
||||
#[derive(Debug, Display, Error)]
|
||||
#[display(fmt = "No such pad {} in {}", _0, _1)]
|
||||
#[display(fmt = "No such pad {_0} in {_1}")]
|
||||
struct NoSuchPad(#[error(not(source))] &'static str, String);
|
||||
|
||||
#[derive(Debug, Display, Error)]
|
||||
#[display(fmt = "Unknown payload type {}", _0)]
|
||||
#[display(fmt = "Unknown payload type {_0}")]
|
||||
struct UnknownPT(#[error(not(source))] u32);
|
||||
|
||||
#[derive(Debug, Display, Error)]
|
||||
#[display(fmt = "Usage: {} (play | record) DROP_PROBABILITY", _0)]
|
||||
#[display(fmt = "Usage: {_0} (play | record) DROP_PROBABILITY")]
|
||||
struct UsageError(#[error(not(source))] String);
|
||||
|
||||
#[derive(Debug, Display, Error)]
|
||||
#[display(fmt = "Received error from {}: {} (debug: {:?})", src, error, debug)]
|
||||
#[display(fmt = "Received error from {src}: {error} (debug: {debug:?})")]
|
||||
struct ErrorMessage {
|
||||
src: glib::GString,
|
||||
error: glib::Error,
|
||||
|
@ -275,6 +275,6 @@ fn example_main() -> Result<(), Error> {
|
|||
fn main() {
|
||||
match examples_common::run(example_main) {
|
||||
Ok(r) => r,
|
||||
Err(e) => eprintln!("Error! {}", e),
|
||||
Err(e) => eprintln!("Error! {e}"),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,15 +9,15 @@ use anyhow::Error;
|
|||
use derive_more::{Display, Error};
|
||||
|
||||
#[derive(Debug, Display, Error)]
|
||||
#[display(fmt = "No such pad {} in {}", _0, _1)]
|
||||
#[display(fmt = "No such pad {_0} in {_1}")]
|
||||
struct NoSuchPad(&'static str, String);
|
||||
|
||||
#[derive(Debug, Display, Error)]
|
||||
#[display(fmt = "Usage: {} URI FEC_PERCENTAGE", _0)]
|
||||
#[display(fmt = "Usage: {_0} URI FEC_PERCENTAGE")]
|
||||
struct UsageError(#[error(not(source))] String);
|
||||
|
||||
#[derive(Debug, Display, Error)]
|
||||
#[display(fmt = "Received error from {}: {} (debug: {:?})", src, error, debug)]
|
||||
#[display(fmt = "Received error from {src}: {error} (debug: {debug:?})")]
|
||||
struct ErrorMessage {
|
||||
src: glib::GString,
|
||||
error: glib::Error,
|
||||
|
@ -201,6 +201,6 @@ fn example_main() -> Result<(), Error> {
|
|||
fn main() {
|
||||
match examples_common::run(example_main) {
|
||||
Ok(r) => r,
|
||||
Err(e) => eprintln!("Error! {}", e),
|
||||
Err(e) => eprintln!("Error! {e}"),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ mod examples_common;
|
|||
struct NoMountPoints;
|
||||
|
||||
#[derive(Debug, Display, Error)]
|
||||
#[display(fmt = "Usage: {} LAUNCH_LINE", _0)]
|
||||
#[display(fmt = "Usage: {_0} LAUNCH_LINE")]
|
||||
struct UsageError(#[error(not(source))] String);
|
||||
|
||||
fn main_loop() -> Result<(), Error> {
|
||||
|
@ -152,6 +152,6 @@ fn example_main() -> Result<(), Error> {
|
|||
fn main() {
|
||||
match examples_common::run(example_main) {
|
||||
Ok(r) => r,
|
||||
Err(e) => eprintln!("Error! {}", e),
|
||||
Err(e) => eprintln!("Error! {e}"),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ mod examples_common;
|
|||
struct NoMountPoints;
|
||||
|
||||
#[derive(Debug, Display, Error)]
|
||||
#[display(fmt = "Usage: {} LAUNCH_LINE", _0)]
|
||||
#[display(fmt = "Usage: {_0} LAUNCH_LINE")]
|
||||
struct UsageError(#[error(not(source))] String);
|
||||
|
||||
fn main_loop() -> Result<(), Error> {
|
||||
|
@ -252,7 +252,7 @@ mod server {
|
|||
|
||||
fn client_connected(&self, client: &gst_rtsp_server::RTSPClient) {
|
||||
self.parent_client_connected(client);
|
||||
println!("Client {:?} connected", client);
|
||||
println!("Client {client:?} connected");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -301,7 +301,7 @@ mod client {
|
|||
fn closed(&self) {
|
||||
let client = self.obj();
|
||||
self.parent_closed();
|
||||
println!("Client {:?} closed", client);
|
||||
println!("Client {client:?} closed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -346,7 +346,7 @@ mod mount_points {
|
|||
// Implementation of gst_rtsp_server::RTSPClient virtual methods
|
||||
impl RTSPMountPointsImpl for MountPoints {
|
||||
fn make_path(&self, url: &gst_rtsp::RTSPUrl) -> Option<glib::GString> {
|
||||
println!("Make path called for {:?} ", url);
|
||||
println!("Make path called for {url:?} ");
|
||||
self.parent_make_path(url)
|
||||
}
|
||||
}
|
||||
|
@ -372,6 +372,6 @@ fn example_main() -> Result<(), Error> {
|
|||
fn main() {
|
||||
match examples_common::run(example_main) {
|
||||
Ok(r) => r,
|
||||
Err(e) => eprintln!("Error! {}", e),
|
||||
Err(e) => eprintln!("Error! {e}"),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ mod examples_common;
|
|||
struct NoMountPoints;
|
||||
|
||||
#[derive(Debug, Display, Error)]
|
||||
#[display(fmt = "Usage: {} LAUNCH_LINE", _0)]
|
||||
#[display(fmt = "Usage: {_0} LAUNCH_LINE")]
|
||||
struct UsageError(#[error(not(source))] String);
|
||||
|
||||
fn main_loop() -> Result<(), Error> {
|
||||
|
@ -89,6 +89,6 @@ fn example_main() -> Result<(), Error> {
|
|||
fn main() {
|
||||
match examples_common::run(example_main) {
|
||||
Ok(r) => r,
|
||||
Err(e) => eprintln!("Error! {}", e),
|
||||
Err(e) => eprintln!("Error! {e}"),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -229,7 +229,7 @@ mod fir_filter {
|
|||
}
|
||||
|
||||
#[derive(Debug, Display, Error)]
|
||||
#[display(fmt = "Received error from {}: {} (debug: {:?})", src, error, debug)]
|
||||
#[display(fmt = "Received error from {src}: {error} (debug: {debug:?})")]
|
||||
struct ErrorMessage {
|
||||
src: glib::GString,
|
||||
error: glib::Error,
|
||||
|
@ -321,7 +321,7 @@ fn main_loop(pipeline: gst::Pipeline) -> Result<(), Error> {
|
|||
fn example_main() {
|
||||
match create_pipeline().and_then(main_loop) {
|
||||
Ok(r) => r,
|
||||
Err(e) => eprintln!("Error! {}", e),
|
||||
Err(e) => eprintln!("Error! {e}"),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -26,11 +26,11 @@ use gst::prelude::*;
|
|||
mod examples_common;
|
||||
|
||||
#[derive(Debug, Display, Error)]
|
||||
#[display(fmt = "Missing element {}", _0)]
|
||||
#[display(fmt = "Missing element {_0}")]
|
||||
struct MissingElement(#[error(not(source))] String);
|
||||
|
||||
#[derive(Debug, Display, Error)]
|
||||
#[display(fmt = "Received error from {}: {} (debug: {:?})", src, error, debug)]
|
||||
#[display(fmt = "Received error from {src}: {error} (debug: {debug:?})")]
|
||||
struct ErrorMessage {
|
||||
src: glib::GString,
|
||||
error: glib::Error,
|
||||
|
@ -112,6 +112,6 @@ fn main() {
|
|||
// (but not necessary in normal Cocoa applications where this is set up automatically)
|
||||
match examples_common::run(example_main) {
|
||||
Ok(r) => r,
|
||||
Err(e) => eprintln!("Error! {}", e),
|
||||
Err(e) => eprintln!("Error! {e}"),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ use gst::{element_error, prelude::*};
|
|||
mod examples_common;
|
||||
|
||||
#[derive(Debug, Display, Error)]
|
||||
#[display(fmt = "Received error from {}: {} (debug: {:?})", src, error, debug)]
|
||||
#[display(fmt = "Received error from {src}: {error} (debug: {debug:?})")]
|
||||
struct ErrorMessage {
|
||||
src: glib::GString,
|
||||
error: glib::Error,
|
||||
|
@ -27,8 +27,7 @@ fn create_pipeline(uri: String, out_path: std::path::PathBuf) -> Result<gst::Pip
|
|||
|
||||
// Create our pipeline from a pipeline description string.
|
||||
let pipeline = gst::parse_launch(&format!(
|
||||
"uridecodebin uri={} ! videoconvert ! appsink name=sink",
|
||||
uri
|
||||
"uridecodebin uri={uri} ! videoconvert ! appsink name=sink"
|
||||
))?
|
||||
.downcast::<gst::Pipeline>()
|
||||
.expect("Expected a gst::Pipeline");
|
||||
|
@ -174,7 +173,7 @@ fn main_loop(pipeline: gst::Pipeline, position: u64) -> Result<(), Error> {
|
|||
MessageView::AsyncDone(..) => {
|
||||
if !seeked {
|
||||
// AsyncDone means that the pipeline has started now and that we can seek
|
||||
println!("Got AsyncDone message, seeking to {}s", position);
|
||||
println!("Got AsyncDone message, seeking to {position}s");
|
||||
|
||||
if pipeline
|
||||
.seek_simple(gst::SeekFlags::FLUSH, position * gst::ClockTime::SECOND)
|
||||
|
@ -240,7 +239,7 @@ fn example_main() {
|
|||
|
||||
match create_pipeline(uri, out_path).and_then(|pipeline| main_loop(pipeline, position)) {
|
||||
Ok(r) => r,
|
||||
Err(e) => eprintln!("Error! {}", e),
|
||||
Err(e) => eprintln!("Error! {e}"),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -109,7 +109,7 @@ fn example_main() {
|
|||
println!("\nReceived toc: {:?} - updated: {}", toc.scope(), updated);
|
||||
// Get a list of tags that are ToC specific.
|
||||
if let Some(tags) = toc.tags() {
|
||||
println!("- tags: {}", tags);
|
||||
println!("- tags: {tags}");
|
||||
}
|
||||
// ToCs do not have a fixed structure. Depending on the format that
|
||||
// they were parsed from, they might have different tree-like structures,
|
||||
|
@ -124,11 +124,11 @@ fn example_main() {
|
|||
println!("\t{:?} - {}", toc_entry.entry_type(), toc_entry.uid());
|
||||
// Every ToC entry can have a set of timestamps (start, stop).
|
||||
if let Some((start, stop)) = toc_entry.start_stop_times() {
|
||||
println!("\t- start: {}, stop: {}", start, stop);
|
||||
println!("\t- start: {start}, stop: {stop}");
|
||||
}
|
||||
// Every ToC entry can have tags to it.
|
||||
if let Some(tags) = toc_entry.tags() {
|
||||
println!("\t- tags: {}", tags);
|
||||
println!("\t- tags: {tags}");
|
||||
}
|
||||
// Every ToC entry can have a set of child entries.
|
||||
// With this structure, you can create trees of arbitrary depth.
|
||||
|
@ -139,10 +139,10 @@ fn example_main() {
|
|||
toc_sub_entry.uid()
|
||||
);
|
||||
if let Some((start, stop)) = toc_sub_entry.start_stop_times() {
|
||||
println!("\t\t- start: {}, stop: {}", start, stop);
|
||||
println!("\t\t- start: {start}, stop: {stop}");
|
||||
}
|
||||
if let Some(tags) = toc_sub_entry.tags() {
|
||||
println!("\t\t- tags: {}", tags);
|
||||
println!("\t\t- tags: {tags}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ use gst::{element_error, prelude::*};
|
|||
mod examples_common;
|
||||
|
||||
#[derive(Debug, Display, Error)]
|
||||
#[display(fmt = "Received error from {}: {} (debug: {:?})", src, error, debug)]
|
||||
#[display(fmt = "Received error from {src}: {error} (debug: {debug:?})")]
|
||||
struct ErrorMessage {
|
||||
src: glib::GString,
|
||||
error: glib::Error,
|
||||
|
@ -212,6 +212,6 @@ fn main() {
|
|||
// (but not necessary in normal Cocoa applications where this is set up automatically)
|
||||
match examples_common::run(example_main) {
|
||||
Ok(r) => r,
|
||||
Err(e) => eprintln!("Error! {}", e),
|
||||
Err(e) => eprintln!("Error! {e}"),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ use gst::element_error;
|
|||
use gst_gl::prelude::*;
|
||||
|
||||
#[derive(Debug, Display, Error)]
|
||||
#[display(fmt = "Received error from {}: {} (debug: {:?})", src, error, debug)]
|
||||
#[display(fmt = "Received error from {src}: {error} (debug: {debug:?})")]
|
||||
struct ErrorMessage {
|
||||
src: glib::GString,
|
||||
error: glib::Error,
|
||||
|
@ -189,7 +189,7 @@ fn load(gl_context: &glutin::WindowedContext<glutin::PossiblyCurrent>) -> Gl {
|
|||
String::from_utf8(data).unwrap()
|
||||
};
|
||||
|
||||
println!("OpenGL version {}", version);
|
||||
println!("OpenGL version {version}");
|
||||
|
||||
let (program, attr_position, attr_texture, vao, vertex_buffer, vbo_indices) = unsafe {
|
||||
let vs = gl.CreateShader(gl::VERTEX_SHADER);
|
||||
|
@ -390,7 +390,7 @@ impl App {
|
|||
)
|
||||
}
|
||||
#[allow(unreachable_patterns)]
|
||||
handler => panic!("Unsupported platform: {:?}.", handler),
|
||||
handler => panic!("Unsupported platform: {handler:?}."),
|
||||
};
|
||||
|
||||
shared_context =
|
||||
|
@ -438,7 +438,7 @@ impl App {
|
|||
}
|
||||
|
||||
if let Err(e) = event_proxy.lock().unwrap().send_event(Message::BusEvent) {
|
||||
eprintln!("Failed to send BusEvent to event proxy: {}", e)
|
||||
eprintln!("Failed to send BusEvent to event proxy: {e}")
|
||||
}
|
||||
|
||||
gst::BusSyncReply::Pass
|
||||
|
|
|
@ -3,6 +3,6 @@
|
|||
#[test]
|
||||
fn check_gir_file() {
|
||||
let res = gir_format_check::check_gir_file("Gir.toml");
|
||||
println!("{}", res);
|
||||
println!("{res}");
|
||||
assert_eq!(res.nb_errors, 0);
|
||||
}
|
||||
|
|
|
@ -3,6 +3,6 @@
|
|||
#[test]
|
||||
fn check_gir_file() {
|
||||
let res = gir_format_check::check_gir_file("Gir.toml");
|
||||
println!("{}", res);
|
||||
println!("{res}");
|
||||
assert_eq!(res.nb_errors, 0);
|
||||
}
|
||||
|
|
|
@ -108,12 +108,12 @@ impl AudioFormatInfo {
|
|||
let unpack_width = unpack_format.width() as usize;
|
||||
|
||||
if unpack_width == 0 || self.0.unpack_func.is_none() {
|
||||
panic!("No unpack format for {:?}", self);
|
||||
panic!("No unpack format for {self:?}");
|
||||
}
|
||||
|
||||
let self_width = self.width() as usize;
|
||||
if self_width == 0 {
|
||||
panic!("No width for {:?}", self);
|
||||
panic!("No width for {self:?}");
|
||||
}
|
||||
|
||||
if src.len() % (self_width / 8) != 0 {
|
||||
|
@ -142,12 +142,12 @@ impl AudioFormatInfo {
|
|||
let unpack_width = unpack_format.width() as usize;
|
||||
|
||||
if unpack_width == 0 || self.0.pack_func.is_none() {
|
||||
panic!("No unpack format for {:?}", self);
|
||||
panic!("No unpack format for {self:?}");
|
||||
}
|
||||
|
||||
let self_width = self.width() as usize;
|
||||
if self_width == 0 {
|
||||
panic!("No width for {:?}", self);
|
||||
panic!("No width for {self:?}");
|
||||
}
|
||||
|
||||
if src.len() % (unpack_width / 8) != 0 {
|
||||
|
|
|
@ -141,7 +141,7 @@ impl<T> AudioCapsBuilder<T> {
|
|||
gst::Bitmask::new(crate::AudioChannelPosition::fallback_mask(channels as u32)),
|
||||
),
|
||||
},
|
||||
Err(e) => panic!("{:?}", e),
|
||||
Err(e) => panic!("{e:?}"),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,6 +3,6 @@
|
|||
#[test]
|
||||
fn check_gir_file() {
|
||||
let res = gir_format_check::check_gir_file("Gir.toml");
|
||||
println!("{}", res);
|
||||
println!("{res}");
|
||||
assert_eq!(res.nb_errors, 0);
|
||||
}
|
||||
|
|
|
@ -3,6 +3,6 @@
|
|||
#[test]
|
||||
fn check_gir_file() {
|
||||
let res = gir_format_check::check_gir_file("Gir.toml");
|
||||
println!("{}", res);
|
||||
println!("{res}");
|
||||
assert_eq!(res.nb_errors, 0);
|
||||
}
|
||||
|
|
|
@ -3,6 +3,6 @@
|
|||
#[test]
|
||||
fn check_gir_file() {
|
||||
let res = gir_format_check::check_gir_file("Gir.toml");
|
||||
println!("{}", res);
|
||||
println!("{res}");
|
||||
assert_eq!(res.nb_errors, 0);
|
||||
}
|
||||
|
|
|
@ -3,6 +3,6 @@
|
|||
#[test]
|
||||
fn check_gir_file() {
|
||||
let res = gir_format_check::check_gir_file("Gir.toml");
|
||||
println!("{}", res);
|
||||
println!("{res}");
|
||||
assert_eq!(res.nb_errors, 0);
|
||||
}
|
||||
|
|
|
@ -3,6 +3,6 @@
|
|||
#[test]
|
||||
fn check_gir_file() {
|
||||
let res = gir_format_check::check_gir_file("Gir.toml");
|
||||
println!("{}", res);
|
||||
println!("{res}");
|
||||
assert_eq!(res.nb_errors, 0);
|
||||
}
|
||||
|
|
|
@ -3,6 +3,6 @@
|
|||
#[test]
|
||||
fn check_gir_file() {
|
||||
let res = gir_format_check::check_gir_file("Gir.toml");
|
||||
println!("{}", res);
|
||||
println!("{res}");
|
||||
assert_eq!(res.nb_errors, 0);
|
||||
}
|
||||
|
|
|
@ -11,9 +11,9 @@ pub trait VideoFrameGLExt {
|
|||
info: &gst_video::VideoInfo,
|
||||
) -> Result<gst_video::VideoFrame<Readable>, gst::Buffer>;
|
||||
|
||||
fn from_buffer_ref_readable_gl<'a, 'b>(
|
||||
fn from_buffer_ref_readable_gl<'a>(
|
||||
buffer: &'a gst::BufferRef,
|
||||
info: &'b gst_video::VideoInfo,
|
||||
info: &gst_video::VideoInfo,
|
||||
) -> Result<gst_video::VideoFrameRef<&'a gst::BufferRef>, glib::error::BoolError>;
|
||||
|
||||
#[doc(alias = "get_texture_id")]
|
||||
|
@ -29,9 +29,9 @@ impl VideoFrameGLExt for gst_video::VideoFrame<Readable> {
|
|||
gst_video::VideoFrameRef::<&gst::BufferRef>::from_buffer_readable_gl(buffer, info)
|
||||
}
|
||||
|
||||
fn from_buffer_ref_readable_gl<'a, 'b>(
|
||||
fn from_buffer_ref_readable_gl<'a>(
|
||||
buffer: &'a gst::BufferRef,
|
||||
info: &'b gst_video::VideoInfo,
|
||||
info: &gst_video::VideoInfo,
|
||||
) -> Result<gst_video::VideoFrameRef<&'a gst::BufferRef>, glib::error::BoolError> {
|
||||
skip_assert_initialized!();
|
||||
gst_video::VideoFrameRef::<&gst::BufferRef>::from_buffer_ref_readable_gl(buffer, info)
|
||||
|
@ -87,9 +87,9 @@ impl<'a> VideoFrameGLExt for gst_video::VideoFrameRef<&'a gst::BufferRef> {
|
|||
}
|
||||
}
|
||||
|
||||
fn from_buffer_ref_readable_gl<'b, 'c>(
|
||||
fn from_buffer_ref_readable_gl<'b>(
|
||||
buffer: &'b gst::BufferRef,
|
||||
info: &'c gst_video::VideoInfo,
|
||||
info: &gst_video::VideoInfo,
|
||||
) -> Result<gst_video::VideoFrameRef<&'b gst::BufferRef>, glib::error::BoolError> {
|
||||
skip_assert_initialized!();
|
||||
|
||||
|
|
|
@ -3,6 +3,6 @@
|
|||
#[test]
|
||||
fn check_gir_file() {
|
||||
let res = gir_format_check::check_gir_file("Gir.toml");
|
||||
println!("{}", res);
|
||||
println!("{res}");
|
||||
assert_eq!(res.nb_errors, 0);
|
||||
}
|
||||
|
|
|
@ -3,6 +3,6 @@
|
|||
#[test]
|
||||
fn check_gir_file() {
|
||||
let res = gir_format_check::check_gir_file("Gir.toml");
|
||||
println!("{}", res);
|
||||
println!("{res}");
|
||||
assert_eq!(res.nb_errors, 0);
|
||||
}
|
||||
|
|
|
@ -3,6 +3,6 @@
|
|||
#[test]
|
||||
fn check_gir_file() {
|
||||
let res = gir_format_check::check_gir_file("Gir.toml");
|
||||
println!("{}", res);
|
||||
println!("{res}");
|
||||
assert_eq!(res.nb_errors, 0);
|
||||
}
|
||||
|
|
|
@ -3,6 +3,6 @@
|
|||
#[test]
|
||||
fn check_gir_file() {
|
||||
let res = gir_format_check::check_gir_file("Gir.toml");
|
||||
println!("{}", res);
|
||||
println!("{res}");
|
||||
assert_eq!(res.nb_errors, 0);
|
||||
}
|
||||
|
|
|
@ -3,6 +3,6 @@
|
|||
#[test]
|
||||
fn check_gir_file() {
|
||||
let res = gir_format_check::check_gir_file("Gir.toml");
|
||||
println!("{}", res);
|
||||
println!("{res}");
|
||||
assert_eq!(res.nb_errors, 0);
|
||||
}
|
||||
|
|
|
@ -3,6 +3,6 @@
|
|||
#[test]
|
||||
fn check_gir_file() {
|
||||
let res = gir_format_check::check_gir_file("Gir.toml");
|
||||
println!("{}", res);
|
||||
println!("{res}");
|
||||
assert_eq!(res.nb_errors, 0);
|
||||
}
|
||||
|
|
|
@ -3,6 +3,6 @@
|
|||
#[test]
|
||||
fn check_gir_file() {
|
||||
let res = gir_format_check::check_gir_file("Gir.toml");
|
||||
println!("{}", res);
|
||||
println!("{res}");
|
||||
assert_eq!(res.nb_errors, 0);
|
||||
}
|
||||
|
|
|
@ -3,6 +3,6 @@
|
|||
#[test]
|
||||
fn check_gir_file() {
|
||||
let res = gir_format_check::check_gir_file("Gir.toml");
|
||||
println!("{}", res);
|
||||
println!("{res}");
|
||||
assert_eq!(res.nb_errors, 0);
|
||||
}
|
||||
|
|
|
@ -3,6 +3,6 @@
|
|||
#[test]
|
||||
fn check_gir_file() {
|
||||
let res = gir_format_check::check_gir_file("Gir.toml");
|
||||
println!("{}", res);
|
||||
println!("{res}");
|
||||
assert_eq!(res.nb_errors, 0);
|
||||
}
|
||||
|
|
|
@ -3,6 +3,6 @@
|
|||
#[test]
|
||||
fn check_gir_file() {
|
||||
let res = gir_format_check::check_gir_file("Gir.toml");
|
||||
println!("{}", res);
|
||||
println!("{res}");
|
||||
assert_eq!(res.nb_errors, 0);
|
||||
}
|
||||
|
|
|
@ -3,6 +3,6 @@
|
|||
#[test]
|
||||
fn check_gir_file() {
|
||||
let res = gir_format_check::check_gir_file("Gir.toml");
|
||||
println!("{}", res);
|
||||
println!("{res}");
|
||||
assert_eq!(res.nb_errors, 0);
|
||||
}
|
||||
|
|
|
@ -782,6 +782,6 @@ mod tests {
|
|||
init();
|
||||
|
||||
let sdp = SDPMedia::new();
|
||||
assert!(!format!("{:?}", sdp).is_empty());
|
||||
assert!(!format!("{sdp:?}").is_empty());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1284,6 +1284,6 @@ mod tests {
|
|||
init();
|
||||
|
||||
let sdp = SDPMessage::new();
|
||||
assert!(!format!("{:?}", sdp).is_empty());
|
||||
assert!(!format!("{sdp:?}").is_empty());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,6 @@
|
|||
#[test]
|
||||
fn check_gir_file() {
|
||||
let res = gir_format_check::check_gir_file("Gir.toml");
|
||||
println!("{}", res);
|
||||
println!("{res}");
|
||||
assert_eq!(res.nb_errors, 0);
|
||||
}
|
||||
|
|
|
@ -3,6 +3,6 @@
|
|||
#[test]
|
||||
fn check_gir_file() {
|
||||
let res = gir_format_check::check_gir_file("Gir.toml");
|
||||
println!("{}", res);
|
||||
println!("{res}");
|
||||
assert_eq!(res.nb_errors, 0);
|
||||
}
|
||||
|
|
|
@ -583,7 +583,7 @@ mod tests {
|
|||
|
||||
impl Consumer {
|
||||
fn new(id: &str) -> Self {
|
||||
let pipeline = gst::parse_launch(&format!("appsrc name={} ! appsink name=sink", id))
|
||||
let pipeline = gst::parse_launch(&format!("appsrc name={id} ! appsink name=sink"))
|
||||
.unwrap()
|
||||
.downcast::<gst::Pipeline>()
|
||||
.unwrap();
|
||||
|
@ -676,7 +676,7 @@ mod tests {
|
|||
assert!(producer.last_sample().is_none());
|
||||
|
||||
for i in 0..10 {
|
||||
let caps = gst::Caps::from_str(&format!("test,n={}", i)).unwrap();
|
||||
let caps = gst::Caps::from_str(&format!("test,n={i}")).unwrap();
|
||||
producer_src.set_caps(Some(&caps));
|
||||
producer_src.push_buffer(gst::Buffer::new()).unwrap();
|
||||
|
||||
|
|
|
@ -194,7 +194,7 @@ impl VideoFormatInfo {
|
|||
let unpack_format = Self::from_format(self.unpack_format());
|
||||
|
||||
if unpack_format.pixel_stride()[0] == 0 || self.0.unpack_func.is_none() {
|
||||
panic!("No unpack format for {:?}", self);
|
||||
panic!("No unpack format for {self:?}");
|
||||
}
|
||||
|
||||
if src.len() != self.n_planes() as usize {
|
||||
|
@ -222,7 +222,7 @@ impl VideoFormatInfo {
|
|||
< self.scale_width(plane as u8, width as u32) as i32
|
||||
* self.pixel_stride()[plane as usize]
|
||||
{
|
||||
panic!("Too small source stride for plane {}", plane);
|
||||
panic!("Too small source stride for plane {plane}");
|
||||
}
|
||||
|
||||
let plane_size = y * stride[plane as usize]
|
||||
|
@ -230,7 +230,7 @@ impl VideoFormatInfo {
|
|||
* self.pixel_stride()[plane as usize];
|
||||
|
||||
if src[plane as usize].len() < plane_size as usize {
|
||||
panic!("Too small source plane size for plane {}", plane);
|
||||
panic!("Too small source plane size for plane {plane}");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -270,7 +270,7 @@ impl VideoFormatInfo {
|
|||
let unpack_format = Self::from_format(self.unpack_format());
|
||||
|
||||
if unpack_format.pixel_stride()[0] == 0 || self.0.unpack_func.is_none() {
|
||||
panic!("No unpack format for {:?}", self);
|
||||
panic!("No unpack format for {self:?}");
|
||||
}
|
||||
|
||||
if dest.len() != self.n_planes() as usize {
|
||||
|
@ -298,7 +298,7 @@ impl VideoFormatInfo {
|
|||
< self.scale_width(plane as u8, width as u32) as i32
|
||||
* self.pixel_stride()[plane as usize]
|
||||
{
|
||||
panic!("Too small destination stride for plane {}", plane);
|
||||
panic!("Too small destination stride for plane {plane}");
|
||||
}
|
||||
|
||||
let plane_size = y * dest_stride[plane as usize]
|
||||
|
@ -306,7 +306,7 @@ impl VideoFormatInfo {
|
|||
* self.pixel_stride()[plane as usize];
|
||||
|
||||
if dest[plane as usize].len() < plane_size as usize {
|
||||
panic!("Too small destination plane size for plane {}", plane);
|
||||
panic!("Too small destination plane size for plane {plane}");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -383,7 +383,7 @@ impl VideoRegionOfInterestMeta {
|
|||
|
||||
#[doc(alias = "get_param")]
|
||||
#[inline]
|
||||
pub fn param<'b>(&self, name: &'b str) -> Option<&gst::StructureRef> {
|
||||
pub fn param<'b>(&'b self, name: &str) -> Option<&'b gst::StructureRef> {
|
||||
self.params().find(|s| s.name() == name)
|
||||
}
|
||||
|
||||
|
|
|
@ -3,6 +3,6 @@
|
|||
#[test]
|
||||
fn check_gir_file() {
|
||||
let res = gir_format_check::check_gir_file("Gir.toml");
|
||||
println!("{}", res);
|
||||
println!("{res}");
|
||||
assert_eq!(res.nb_errors, 0);
|
||||
}
|
||||
|
|
|
@ -3,6 +3,6 @@
|
|||
#[test]
|
||||
fn check_gir_file() {
|
||||
let res = gir_format_check::check_gir_file("Gir.toml");
|
||||
println!("{}", res);
|
||||
println!("{res}");
|
||||
assert_eq!(res.nb_errors, 0);
|
||||
}
|
||||
|
|
|
@ -1243,7 +1243,7 @@ mod tests {
|
|||
crate::init().unwrap();
|
||||
|
||||
let caps = Caps::builder("foo/bar").build();
|
||||
format!("{}", caps);
|
||||
format!("{caps}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -1344,15 +1344,15 @@ mod tests {
|
|||
crate::init().unwrap();
|
||||
|
||||
let caps = Caps::new_any();
|
||||
assert_eq!(format!("{:?}", caps), "Caps(\"ANY\")");
|
||||
assert_eq!(format!("{caps:?}"), "Caps(\"ANY\")");
|
||||
|
||||
let caps = Caps::new_empty();
|
||||
assert_eq!(format!("{:?}", caps), "Caps(\"EMPTY\")");
|
||||
assert_eq!(format!("{caps:?}"), "Caps(\"EMPTY\")");
|
||||
|
||||
let caps = Caps::builder_full_with_any_features()
|
||||
.structure(Structure::builder("audio/x-raw").build())
|
||||
.build();
|
||||
assert_eq!(format!("{:?}", caps), "Caps(audio/x-raw(ANY))");
|
||||
assert_eq!(format!("{caps:?}"), "Caps(audio/x-raw(ANY))");
|
||||
|
||||
let caps = Caps::builder_full_with_features(CapsFeatures::new(["foo:bla"]))
|
||||
.structure(
|
||||
|
@ -1370,7 +1370,7 @@ mod tests {
|
|||
)
|
||||
.build();
|
||||
|
||||
assert_eq!(format!("{:?}", caps), "Caps(audio/x-raw(foo:bla) { struct: Structure(nested { badger: (gboolean) TRUE }) }, video/x-raw(foo:bla) { width: (guint) 800 })");
|
||||
assert_eq!(format!("{caps:?}"), "Caps(audio/x-raw(foo:bla) { struct: Structure(nested { badger: (gboolean) TRUE }) }, video/x-raw(foo:bla) { width: (guint) 800 })");
|
||||
|
||||
let caps = Caps::builder_full()
|
||||
.structure(
|
||||
|
@ -1381,6 +1381,6 @@ mod tests {
|
|||
)
|
||||
.build();
|
||||
|
||||
assert_eq!(format!("{:?}", caps), "Caps(video/x-raw(memory:SystemMemory) { array: Array([(gchararray) \"a\", (gchararray) \"b\", (gchararray) \"c\"]), list: List([(gchararray) \"d\", (gchararray) \"e\", (gchararray) \"f\"]) })");
|
||||
assert_eq!(format!("{caps:?}"), "Caps(video/x-raw(memory:SystemMemory) { array: Array([(gchararray) \"a\", (gchararray) \"b\", (gchararray) \"c\"]), list: List([(gchararray) \"d\", (gchararray) \"e\", (gchararray) \"f\"]) })");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -111,8 +111,7 @@ impl Serialize for DateTime {
|
|||
DateTimeVariants::Y(self.year())
|
||||
} else {
|
||||
return Err(ser::Error::custom(format!(
|
||||
"no parts could be found in `DateTime` {}",
|
||||
self,
|
||||
"no parts could be found in `DateTime` {self}",
|
||||
)));
|
||||
};
|
||||
|
||||
|
|
|
@ -192,7 +192,7 @@ mod tests {
|
|||
7,
|
||||
);
|
||||
assert_eq!(
|
||||
format!("{}", e),
|
||||
format!("{e}"),
|
||||
"Error Some(\"message\") (Some(\"debug\")) at filename:7"
|
||||
);
|
||||
}
|
||||
|
@ -202,9 +202,6 @@ mod tests {
|
|||
crate::init().unwrap();
|
||||
|
||||
let e: LoggableError = glib::BoolError::new("msg", "filename", "function", 7).into();
|
||||
assert_eq!(
|
||||
format!("{}", e),
|
||||
"Error \"GST_RUST\": \"msg\" at filename:7"
|
||||
);
|
||||
assert_eq!(format!("{e}"), "Error \"GST_RUST\": \"msg\" at filename:7");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -518,17 +518,17 @@ fn write_clocktime<W: io::Write>(
|
|||
let (h, m) = num_integer::div_rem(m, 60);
|
||||
|
||||
// Write HH:MM:SS
|
||||
write!(writer, "{}:{:02}:{:02}", h, m, s)?;
|
||||
write!(writer, "{h}:{m:02}:{s:02}")?;
|
||||
|
||||
if precision > 0 {
|
||||
// Format the nanoseconds into a stack-allocated string
|
||||
// The value is zero-padded so always 9 digits long
|
||||
let mut buf = [0u8; 9];
|
||||
write!(&mut buf[..], "{:09}", ns).unwrap();
|
||||
write!(&mut buf[..], "{ns:09}").unwrap();
|
||||
let buf_str = std::str::from_utf8(&buf[..]).unwrap();
|
||||
|
||||
// Write decimal point and a prefix of the nanoseconds for more precision
|
||||
write!(writer, ".{:.p$}", buf_str, p = precision)?;
|
||||
write!(writer, ".{buf_str:.precision$}")?;
|
||||
}
|
||||
} else {
|
||||
// Undefined time
|
||||
|
@ -1152,9 +1152,9 @@ mod tests {
|
|||
"12:43:54.908569837"
|
||||
);
|
||||
|
||||
assert_eq!(format!("{:.0}", lots), "5124095:34:33");
|
||||
assert_eq!(format!("{:.3}", lots), "5124095:34:33.709");
|
||||
assert_eq!(format!("{}", lots), "5124095:34:33.709551614");
|
||||
assert_eq!(format!("{lots:.0}"), "5124095:34:33");
|
||||
assert_eq!(format!("{lots:.3}"), "5124095:34:33.709");
|
||||
assert_eq!(format!("{lots}"), "5124095:34:33.709551614");
|
||||
|
||||
// Precision caps at 9
|
||||
assert_eq!(
|
||||
|
@ -1165,7 +1165,7 @@ mod tests {
|
|||
format!("{:.10}", DisplayableOptClockTime(some)),
|
||||
"12:43:54.908569837"
|
||||
);
|
||||
assert_eq!(format!("{:.10}", lots), "5124095:34:33.709551614");
|
||||
assert_eq!(format!("{lots:.10}"), "5124095:34:33.709551614");
|
||||
|
||||
// Short width
|
||||
|
||||
|
@ -1189,9 +1189,9 @@ mod tests {
|
|||
"12:43:54.908569837"
|
||||
);
|
||||
|
||||
assert_eq!(format!("{:4.0}", lots), "5124095:34:33");
|
||||
assert_eq!(format!("{:4.3}", lots), "5124095:34:33.709");
|
||||
assert_eq!(format!("{:4}", lots), "5124095:34:33.709551614");
|
||||
assert_eq!(format!("{lots:4.0}"), "5124095:34:33");
|
||||
assert_eq!(format!("{lots:4.3}"), "5124095:34:33.709");
|
||||
assert_eq!(format!("{lots:4}"), "5124095:34:33.709551614");
|
||||
|
||||
// Simple padding
|
||||
|
||||
|
@ -1269,15 +1269,15 @@ mod tests {
|
|||
" 12:43:54.908569837 "
|
||||
);
|
||||
|
||||
assert_eq!(format!("{:>14.0}", lots), " 5124095:34:33");
|
||||
assert_eq!(format!("{:<14.0}", lots), "5124095:34:33 ");
|
||||
assert_eq!(format!("{:^15.0}", lots), " 5124095:34:33 ");
|
||||
assert_eq!(format!("{:>18.3}", lots), " 5124095:34:33.709");
|
||||
assert_eq!(format!("{:<18.3}", lots), "5124095:34:33.709 ");
|
||||
assert_eq!(format!("{:^19.3}", lots), " 5124095:34:33.709 ");
|
||||
assert_eq!(format!("{:>24}", lots), " 5124095:34:33.709551614");
|
||||
assert_eq!(format!("{:<24}", lots), "5124095:34:33.709551614 ");
|
||||
assert_eq!(format!("{:^25}", lots), " 5124095:34:33.709551614 ");
|
||||
assert_eq!(format!("{lots:>14.0}"), " 5124095:34:33");
|
||||
assert_eq!(format!("{lots:<14.0}"), "5124095:34:33 ");
|
||||
assert_eq!(format!("{lots:^15.0}"), " 5124095:34:33 ");
|
||||
assert_eq!(format!("{lots:>18.3}"), " 5124095:34:33.709");
|
||||
assert_eq!(format!("{lots:<18.3}"), "5124095:34:33.709 ");
|
||||
assert_eq!(format!("{lots:^19.3}"), " 5124095:34:33.709 ");
|
||||
assert_eq!(format!("{lots:>24}"), " 5124095:34:33.709551614");
|
||||
assert_eq!(format!("{lots:<24}"), "5124095:34:33.709551614 ");
|
||||
assert_eq!(format!("{lots:^25}"), " 5124095:34:33.709551614 ");
|
||||
|
||||
// Padding with sign or zero-extension
|
||||
|
||||
|
@ -1355,15 +1355,15 @@ mod tests {
|
|||
"+0012:43:54.908569837"
|
||||
);
|
||||
|
||||
assert_eq!(format!("{:+16.0}", lots), " +5124095:34:33");
|
||||
assert_eq!(format!("{:016.0}", lots), "0005124095:34:33");
|
||||
assert_eq!(format!("{:+016.0}", lots), "+005124095:34:33");
|
||||
assert_eq!(format!("{:+20.3}", lots), " +5124095:34:33.709");
|
||||
assert_eq!(format!("{:020.3}", lots), "0005124095:34:33.709");
|
||||
assert_eq!(format!("{:+020.3}", lots), "+005124095:34:33.709");
|
||||
assert_eq!(format!("{:+26}", lots), " +5124095:34:33.709551614");
|
||||
assert_eq!(format!("{:026}", lots), "0005124095:34:33.709551614");
|
||||
assert_eq!(format!("{:+026}", lots), "+005124095:34:33.709551614");
|
||||
assert_eq!(format!("{lots:+16.0}"), " +5124095:34:33");
|
||||
assert_eq!(format!("{lots:016.0}"), "0005124095:34:33");
|
||||
assert_eq!(format!("{lots:+016.0}"), "+005124095:34:33");
|
||||
assert_eq!(format!("{lots:+20.3}"), " +5124095:34:33.709");
|
||||
assert_eq!(format!("{lots:020.3}"), "0005124095:34:33.709");
|
||||
assert_eq!(format!("{lots:+020.3}"), "+005124095:34:33.709");
|
||||
assert_eq!(format!("{lots:+26}"), " +5124095:34:33.709551614");
|
||||
assert_eq!(format!("{lots:026}"), "0005124095:34:33.709551614");
|
||||
assert_eq!(format!("{lots:+026}"), "+005124095:34:33.709551614");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -619,7 +619,7 @@ impl fmt::Display for Format {
|
|||
Self::Time => f.write_str("time"),
|
||||
Self::Buffers => f.write_str("buffers"),
|
||||
Self::Percent => f.write_str("%"),
|
||||
Self::__Unknown(format) => write!(f, "(format: {})", format),
|
||||
Self::__Unknown(format) => write!(f, "(format: {format})"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1121,7 +1121,7 @@ impl fmt::Display for LoggedObject {
|
|||
}
|
||||
};
|
||||
|
||||
write!(f, "{}:{}", parent_name, name)
|
||||
write!(f, "{parent_name}:{name}")
|
||||
} else if glib::gobject_ffi::g_type_is_a(type_, ffi::gst_object_get_type())
|
||||
!= glib::ffi::GFALSE
|
||||
{
|
||||
|
@ -1133,7 +1133,7 @@ impl fmt::Display for LoggedObject {
|
|||
.to_str()
|
||||
.unwrap_or("<invalid name>")
|
||||
};
|
||||
write!(f, "{}", name)
|
||||
write!(f, "{name}")
|
||||
} else {
|
||||
let type_name = CStr::from_ptr(glib::gobject_ffi::g_type_name(type_));
|
||||
write!(
|
||||
|
@ -1144,7 +1144,7 @@ impl fmt::Display for LoggedObject {
|
|||
)
|
||||
}
|
||||
} else {
|
||||
write!(f, "{:?}", ptr)
|
||||
write!(f, "{ptr:?}")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ impl<O: IsA<crate::Object>> GstObjectExtManual for O {
|
|||
f: F,
|
||||
) -> SignalHandlerId {
|
||||
let signal_name = if let Some(name) = name {
|
||||
format!("deep-notify::{}", name)
|
||||
format!("deep-notify::{name}")
|
||||
} else {
|
||||
"deep-notify".into()
|
||||
};
|
||||
|
@ -54,14 +54,12 @@ impl<O: IsA<crate::Object>> GstObjectExtManual for O {
|
|||
let obj: O = unsafe {
|
||||
values[0]
|
||||
.get::<crate::Object>()
|
||||
.unwrap_or_else(|err| {
|
||||
panic!("Object signal \"deep-notify\": values[0]: {}", err)
|
||||
})
|
||||
.unwrap_or_else(|err| panic!("Object signal \"deep-notify\": values[0]: {err}"))
|
||||
.unsafe_cast()
|
||||
};
|
||||
let prop_obj: crate::Object = values[1]
|
||||
.get()
|
||||
.unwrap_or_else(|err| panic!("Object signal \"deep-notify\": values[1]: {}", err));
|
||||
.unwrap_or_else(|err| panic!("Object signal \"deep-notify\": values[1]: {err}"));
|
||||
|
||||
let pspec = unsafe {
|
||||
let pspec = glib::gobject_ffi::g_value_get_param(values[2].to_glib_none().0);
|
||||
|
|
|
@ -1097,10 +1097,7 @@ unsafe fn update_probe_info(
|
|||
{
|
||||
// Buffer or Event consumed by probe
|
||||
}
|
||||
other => panic!(
|
||||
"Bad data for {:?} pad probe returning Handled: {:?}",
|
||||
data_type, other
|
||||
),
|
||||
other => panic!("Bad data for {data_type:?} pad probe returning Handled: {other:?}"),
|
||||
}
|
||||
} else {
|
||||
match probe_info.data {
|
||||
|
|
|
@ -169,7 +169,7 @@ impl StreamCollection {
|
|||
}
|
||||
unsafe {
|
||||
let f: Box_<F> = Box_::new(f);
|
||||
let detailed_signal_name = detail.map(|name| format!("stream-notify::{}\0", name));
|
||||
let detailed_signal_name = detail.map(|name| format!("stream-notify::{name}\0"));
|
||||
let signal_name: &[u8] = detailed_signal_name
|
||||
.as_ref()
|
||||
.map_or(&b"stream-notify\0"[..], |n| n.as_bytes());
|
||||
|
|
|
@ -1260,6 +1260,6 @@ mod tests {
|
|||
.field("f6", crate::List::new(["d", "e", "f"]))
|
||||
.build();
|
||||
|
||||
assert_eq!(format!("{:?}", s), "Structure(test { f1: (gchararray) \"abc\", f2: (gchararray) \"bcd\", f3: (gint) 123, f4: Structure(nested { badger: (gboolean) TRUE }), f5: Array([(gchararray) \"a\", (gchararray) \"b\", (gchararray) \"c\"]), f6: List([(gchararray) \"d\", (gchararray) \"e\", (gchararray) \"f\"]) })");
|
||||
assert_eq!(format!("{s:?}"), "Structure(test { f1: (gchararray) \"abc\", f2: (gchararray) \"bcd\", f3: (gint) 123, f4: Structure(nested { badger: (gboolean) TRUE }), f5: Array([(gchararray) \"a\", (gchararray) \"b\", (gchararray) \"c\"]), f6: List([(gchararray) \"d\", (gchararray) \"e\", (gchararray) \"f\"]) })");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ pub fn post_panic_error_message(
|
|||
});
|
||||
|
||||
let msg = if let Some(cause) = cause {
|
||||
crate::message::Error::builder(crate::LibraryError::Failed, &format!("Panicked: {}", cause))
|
||||
crate::message::Error::builder(crate::LibraryError::Failed, &format!("Panicked: {cause}"))
|
||||
.src(src)
|
||||
.build()
|
||||
} else {
|
||||
|
|
|
@ -1356,14 +1356,14 @@ mod tests {
|
|||
crate::init().unwrap();
|
||||
|
||||
let mut tags = TagList::new();
|
||||
assert_eq!(format!("{:?}", tags), "TagList");
|
||||
assert_eq!(format!("{tags:?}"), "TagList");
|
||||
{
|
||||
let tags = tags.get_mut().unwrap();
|
||||
tags.add::<Title>(&"some title", TagMergeMode::Append);
|
||||
tags.add::<Duration>(&(ClockTime::SECOND * 120), TagMergeMode::Append);
|
||||
}
|
||||
assert_eq!(
|
||||
format!("{:?}", tags),
|
||||
format!("{tags:?}"),
|
||||
"TagList { title: (gchararray) \"some title\", duration: (guint64) 120000000000 }"
|
||||
);
|
||||
}
|
||||
|
|
|
@ -82,8 +82,7 @@ impl<'a> Serialize for TagValuesSer<'a> {
|
|||
ser_opt_tag!(value, seq, Sample)
|
||||
} else {
|
||||
Err(ser::Error::custom(format!(
|
||||
"unimplemented `Tag` serialization for type {}",
|
||||
type_id,
|
||||
"unimplemented `Tag` serialization for type {type_id}",
|
||||
)))
|
||||
}
|
||||
}
|
||||
|
@ -240,7 +239,7 @@ impl<'de, 'a> Visitor<'de> for TagValuesTupleVisitor<'a> {
|
|||
fn visit_seq<A: SeqAccess<'de>>(self, mut seq: A) -> Result<(), A::Error> {
|
||||
let name = seq
|
||||
.next_element::<String>()
|
||||
.map_err(|err| de::Error::custom(format!("Error reading Tag name. {:?}", err)))?
|
||||
.map_err(|err| de::Error::custom(format!("Error reading Tag name. {err:?}")))?
|
||||
.ok_or_else(|| de::Error::custom("Expected a name for the `Tag` name"))?;
|
||||
seq.next_element_seed(TagValues(name.as_str(), self.0))?
|
||||
.ok_or_else(|| de::Error::custom("Expected a seq of values for the `Tag`"))
|
||||
|
|
|
@ -3,6 +3,6 @@
|
|||
#[test]
|
||||
fn check_gir_file() {
|
||||
let res = gir_format_check::check_gir_file("Gir.toml");
|
||||
println!("{}", res);
|
||||
println!("{res}");
|
||||
assert_eq!(res.nb_errors, 0);
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ fn tutorial_main() {
|
|||
// Build the pipeline
|
||||
let uri =
|
||||
"https://www.freedesktop.org/software/gstreamer-sdk/data/media/sintel_trailer-480p.webm";
|
||||
let pipeline = gst::parse_launch(&format!("playbin uri={}", uri)).unwrap();
|
||||
let pipeline = gst::parse_launch(&format!("playbin uri={uri}")).unwrap();
|
||||
|
||||
// Start playing
|
||||
pipeline
|
||||
|
|
|
@ -13,7 +13,7 @@ fn tutorial_main() -> Result<(), Error> {
|
|||
// Build the pipeline
|
||||
let uri =
|
||||
"https://www.freedesktop.org/software/gstreamer-sdk/data/media/sintel_trailer-480p.webm";
|
||||
let pipeline = gst::parse_launch(&format!("playbin uri={}", uri))?;
|
||||
let pipeline = gst::parse_launch(&format!("playbin uri={uri}"))?;
|
||||
|
||||
// Start playing
|
||||
let res = pipeline.set_state(gst::State::Playing)?;
|
||||
|
@ -52,10 +52,10 @@ fn tutorial_main() -> Result<(), Error> {
|
|||
}
|
||||
|
||||
let percent = buffering.percent();
|
||||
print!("Buffering ({}%)\r", percent);
|
||||
print!("Buffering ({percent}%)\r");
|
||||
match std::io::stdout().flush() {
|
||||
Ok(_) => {}
|
||||
Err(err) => eprintln!("Failed: {}", err),
|
||||
Err(err) => eprintln!("Failed: {err}"),
|
||||
};
|
||||
|
||||
// Wait until buffering is complete before start/resume playing
|
||||
|
@ -87,6 +87,6 @@ fn tutorial_main() -> Result<(), Error> {
|
|||
fn main() {
|
||||
match tutorials_common::run(tutorial_main) {
|
||||
Ok(_) => {}
|
||||
Err(err) => eprintln!("Failed: {}", err),
|
||||
Err(err) => eprintln!("Failed: {err}"),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ fn send_seek_event(pipeline: &Element, rate: f64) -> bool {
|
|||
|
||||
// If we have not done so, obtain the sink through which we will send the seek events
|
||||
if let Some(video_sink) = pipeline.property::<Option<Element>>("video-sink") {
|
||||
println!("Current rate: {}\r", rate);
|
||||
println!("Current rate: {rate}\r");
|
||||
// Send the event
|
||||
video_sink.send_event(seek_event)
|
||||
} else {
|
||||
|
@ -123,7 +123,7 @@ USAGE: Choose one of the following options, then press enter:
|
|||
// Build the pipeline.
|
||||
let uri =
|
||||
"https://www.freedesktop.org/software/gstreamer-sdk/data/media/sintel_trailer-480p.webm";
|
||||
let pipeline = gst::parse_launch(&format!("playbin uri={}", uri))?;
|
||||
let pipeline = gst::parse_launch(&format!("playbin uri={uri}"))?;
|
||||
|
||||
// Start playing.
|
||||
let _ = pipeline.set_state(State::Playing)?;
|
||||
|
@ -151,7 +151,7 @@ USAGE: Choose one of the following options, then press enter:
|
|||
"PLAYING"
|
||||
};
|
||||
playing = !playing;
|
||||
println!("Setting state to {}\r", status);
|
||||
println!("Setting state to {status}\r");
|
||||
}
|
||||
Command::DataRateUp => {
|
||||
if send_seek_event(&pipeline, rate * 2.) {
|
||||
|
@ -193,6 +193,6 @@ USAGE: Choose one of the following options, then press enter:
|
|||
fn main() {
|
||||
match tutorials_common::run(tutorial_main) {
|
||||
Ok(_) => {}
|
||||
Err(err) => eprintln!("Failed: {}", err),
|
||||
Err(err) => eprintln!("Failed: {err}"),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,18 +62,15 @@ fn tutorial_main() {
|
|||
|
||||
let is_audio = new_pad_type.starts_with("audio/x-raw");
|
||||
if !is_audio {
|
||||
println!(
|
||||
"It has type {} which is not raw audio. Ignoring.",
|
||||
new_pad_type
|
||||
);
|
||||
println!("It has type {new_pad_type} which is not raw audio. Ignoring.");
|
||||
return;
|
||||
}
|
||||
|
||||
let res = src_pad.link(&sink_pad);
|
||||
if res.is_err() {
|
||||
println!("Type is {} but link failed.", new_pad_type);
|
||||
println!("Type is {new_pad_type} but link failed.");
|
||||
} else {
|
||||
println!("Link succeeded (type {}).", new_pad_type);
|
||||
println!("Link succeeded (type {new_pad_type}).");
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -134,10 +134,7 @@ fn handle_message(custom_data: &mut CustomData, msg: &gst::Message) {
|
|||
let new_state = state_changed.current();
|
||||
let old_state = state_changed.old();
|
||||
|
||||
println!(
|
||||
"Pipeline state changed from {:?} to {:?}",
|
||||
old_state, new_state
|
||||
);
|
||||
println!("Pipeline state changed from {old_state:?} to {new_state:?}");
|
||||
|
||||
custom_data.playing = new_state == gst::State::Playing;
|
||||
if custom_data.playing {
|
||||
|
@ -146,7 +143,7 @@ fn handle_message(custom_data: &mut CustomData, msg: &gst::Message) {
|
|||
let (seekable, start, end) = seeking.result();
|
||||
custom_data.seek_enabled = seekable;
|
||||
if seekable {
|
||||
println!("Seeking is ENABLED from {} to {}", start, end)
|
||||
println!("Seeking is ENABLED from {start} to {end}")
|
||||
} else {
|
||||
println!("Seeking is DISABLED for this stream.")
|
||||
}
|
||||
|
|
|
@ -33,15 +33,15 @@ mod tutorial5 {
|
|||
|
||||
// Extract tags from streams of @stype and add the info in the UI.
|
||||
fn add_streams_info(playbin: &gst::Element, textbuf: >k::TextBuffer, stype: &str) {
|
||||
let propname: &str = &format!("n-{}", stype);
|
||||
let signame: &str = &format!("get-{}-tags", stype);
|
||||
let propname: &str = &format!("n-{stype}");
|
||||
let signame: &str = &format!("get-{stype}-tags");
|
||||
|
||||
let x = playbin.property::<i32>(propname);
|
||||
for i in 0..x {
|
||||
let tags = playbin.emit_by_name::<Option<gst::TagList>>(signame, &[&i]);
|
||||
|
||||
if let Some(tags) = tags {
|
||||
textbuf.insert_at_cursor(&format!("{} stream {}:\n ", stype, i));
|
||||
textbuf.insert_at_cursor(&format!("{stype} stream {i}:\n "));
|
||||
|
||||
if let Some(codec) = tags.get::<gst::tags::VideoCodec>() {
|
||||
textbuf.insert_at_cursor(&format!(" codec: {} \n", codec.get()));
|
||||
|
@ -123,7 +123,7 @@ mod tutorial5 {
|
|||
)
|
||||
.is_err()
|
||||
{
|
||||
eprintln!("Seeking to {} failed", value);
|
||||
eprintln!("Seeking to {value} failed");
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -187,7 +187,7 @@ mod tutorial5 {
|
|||
video_overlay.set_window_handle(xid as usize);
|
||||
}
|
||||
} else {
|
||||
println!("Add support for display type '{}'", display_type_name);
|
||||
println!("Add support for display type '{display_type_name}'");
|
||||
process::exit(-1);
|
||||
}
|
||||
}
|
||||
|
@ -285,13 +285,13 @@ mod tutorial5 {
|
|||
|
||||
// Initialize GTK
|
||||
if let Err(err) = gtk::init() {
|
||||
eprintln!("Failed to initialize GTK: {}", err);
|
||||
eprintln!("Failed to initialize GTK: {err}");
|
||||
return;
|
||||
}
|
||||
|
||||
// Initialize GStreamer
|
||||
if let Err(err) = gst::init() {
|
||||
eprintln!("Failed to initialize Gst: {}", err);
|
||||
eprintln!("Failed to initialize Gst: {err}");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -5,12 +5,12 @@ mod tutorials_common;
|
|||
|
||||
fn print_caps(caps: &gst::CapsRef, prefix: &str) {
|
||||
if caps.is_any() {
|
||||
println!("{}ANY", prefix);
|
||||
println!("{prefix}ANY");
|
||||
return;
|
||||
}
|
||||
|
||||
if caps.is_empty() {
|
||||
println!("{}EMPTY", prefix);
|
||||
println!("{prefix}EMPTY");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ fn print_pad_template_information(factory: &gst::ElementFactory) {
|
|||
let long_name = factory
|
||||
.metadata("long-name")
|
||||
.expect("Failed to get long-name of element factory.");
|
||||
println!("Pad Template for {}:", long_name);
|
||||
println!("Pad Template for {long_name}:");
|
||||
|
||||
if factory.num_pad_templates() == 0u32 {
|
||||
println!(" None");
|
||||
|
@ -69,7 +69,7 @@ fn print_pad_capabilities(element: &gst::Element, pad_name: &str) {
|
|||
.static_pad(pad_name)
|
||||
.expect("Could not retrieve pad");
|
||||
|
||||
println!("Caps for the {} pad:", pad_name);
|
||||
println!("Caps for the {pad_name} pad:");
|
||||
let caps = pad.current_caps().unwrap_or_else(|| pad.query_caps(None));
|
||||
print_caps(&caps, " ");
|
||||
}
|
||||
|
@ -145,10 +145,7 @@ fn tutorial_main() {
|
|||
let new_state = state_changed.current();
|
||||
let old_state = state_changed.old();
|
||||
|
||||
println!(
|
||||
"Pipeline state changed from {:?} to {:?}",
|
||||
old_state, new_state
|
||||
);
|
||||
println!("Pipeline state changed from {old_state:?} to {new_state:?}");
|
||||
print_pad_capabilities(&sink, "sink");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ mod tutorials_common;
|
|||
fn tutorial_main() {
|
||||
// Initialize GStreamer
|
||||
if let Err(err) = gst::init() {
|
||||
eprintln!("Failed to initialize Gst: {}", err);
|
||||
eprintln!("Failed to initialize Gst: {err}");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ impl CustomData {
|
|||
fn main() {
|
||||
// Initialize GStreamer
|
||||
if let Err(err) = gst::init() {
|
||||
eprintln!("Failed to initialize Gst: {}", err);
|
||||
eprintln!("Failed to initialize Gst: {err}");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ fn print_stream_info(info: &DiscovererStreamInfo, depth: usize) {
|
|||
}
|
||||
}
|
||||
|
||||
println!("{}", tags_str);
|
||||
println!("{tags_str}");
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -82,11 +82,11 @@ fn on_discovered(
|
|||
) {
|
||||
let uri = discoverer_info.uri();
|
||||
match discoverer_info.result() {
|
||||
DiscovererResult::Ok => println!("Discovered {}", uri),
|
||||
DiscovererResult::UriInvalid => println!("Invalid uri {}", uri),
|
||||
DiscovererResult::Ok => println!("Discovered {uri}"),
|
||||
DiscovererResult::UriInvalid => println!("Invalid uri {uri}"),
|
||||
DiscovererResult::Error => {
|
||||
if let Some(msg) = error {
|
||||
println!("{}", msg);
|
||||
println!("{msg}");
|
||||
} else {
|
||||
println!("Unknown error")
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ fn on_discovered(
|
|||
DiscovererResult::Busy => println!("Busy"),
|
||||
DiscovererResult::MissingPlugins => {
|
||||
if let Some(s) = discoverer_info.misc() {
|
||||
println!("{}", s);
|
||||
println!("{s}");
|
||||
}
|
||||
}
|
||||
_ => println!("Unknown result"),
|
||||
|
@ -110,10 +110,10 @@ fn on_discovered(
|
|||
if let Some(tags) = discoverer_info.tags() {
|
||||
println!("Tags:");
|
||||
for (tag, values) in tags.iter_generic() {
|
||||
print!(" {}: ", tag);
|
||||
print!(" {tag}: ");
|
||||
values.for_each(|v| {
|
||||
if let Some(s) = send_value_as_str(v) {
|
||||
println!("{}", s)
|
||||
println!("{s}")
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -145,7 +145,7 @@ fn run_discoverer() -> Result<(), Error> {
|
|||
"https://www.freedesktop.org/software/gstreamer-sdk/data/media/sintel_trailer-480p.webm"
|
||||
};
|
||||
|
||||
println!("Discovering {}", uri);
|
||||
println!("Discovering {uri}");
|
||||
|
||||
let loop_ = glib::MainLoop::new(None, false);
|
||||
let timeout = 5 * gst::ClockTime::SECOND;
|
||||
|
@ -169,7 +169,7 @@ fn run_discoverer() -> Result<(), Error> {
|
|||
fn tutorial_main() {
|
||||
match run_discoverer() {
|
||||
Ok(_) => {}
|
||||
Err(err) => eprintln!("Failed to run discovery: {}", err),
|
||||
Err(err) => eprintln!("Failed to run discovery: {err}"),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -12,16 +12,13 @@ fn analyze_streams(playbin: &gst::Element) {
|
|||
let n_video = playbin.property::<i32>("n-video");
|
||||
let n_audio = playbin.property::<i32>("n-audio");
|
||||
let n_text = playbin.property::<i32>("n-text");
|
||||
println!(
|
||||
"{} video stream(s), {} audio stream(s), {} text stream(s)",
|
||||
n_video, n_audio, n_text
|
||||
);
|
||||
println!("{n_video} video stream(s), {n_audio} audio stream(s), {n_text} text stream(s)");
|
||||
|
||||
for i in 0..n_video {
|
||||
let tags = playbin.emit_by_name::<Option<gst::TagList>>("get-video-tags", &[&i]);
|
||||
|
||||
if let Some(tags) = tags {
|
||||
println!("video stream {}:", i);
|
||||
println!("video stream {i}:");
|
||||
if let Some(codec) = tags.get::<gst::tags::VideoCodec>() {
|
||||
println!(" codec: {}", codec.get());
|
||||
}
|
||||
|
@ -32,7 +29,7 @@ fn analyze_streams(playbin: &gst::Element) {
|
|||
let tags = playbin.emit_by_name::<Option<gst::TagList>>("get-audio-tags", &[&i]);
|
||||
|
||||
if let Some(tags) = tags {
|
||||
println!("audio stream {}:", i);
|
||||
println!("audio stream {i}:");
|
||||
if let Some(codec) = tags.get::<gst::tags::AudioCodec>() {
|
||||
println!(" codec: {}", codec.get());
|
||||
}
|
||||
|
@ -49,7 +46,7 @@ fn analyze_streams(playbin: &gst::Element) {
|
|||
let tags = playbin.emit_by_name::<Option<gst::TagList>>("get-text-tags", &[&i]);
|
||||
|
||||
if let Some(tags) = tags {
|
||||
println!("subtitle stream {}:", i);
|
||||
println!("subtitle stream {i}:");
|
||||
if let Some(codec) = tags.get::<gst::tags::LanguageCode>() {
|
||||
println!(" language: {}", codec.get());
|
||||
}
|
||||
|
@ -60,8 +57,7 @@ fn analyze_streams(playbin: &gst::Element) {
|
|||
let current_audio = playbin.property::<i32>("current-audio");
|
||||
let current_text = playbin.property::<i32>("current-text");
|
||||
println!(
|
||||
"Currently playing video stream {}, audio stream {}, text stream {}",
|
||||
current_video, current_audio, current_text
|
||||
"Currently playing video stream {current_video}, audio stream {current_audio}, text stream {current_text}"
|
||||
);
|
||||
println!("Type any number and hit ENTER to select a different audio stream");
|
||||
}
|
||||
|
@ -79,7 +75,7 @@ fn handle_keyboard(playbin: &gst::Element, main_loop: &glib::MainLoop) {
|
|||
let n_audio = playbin.property::<i32>("n-audio");
|
||||
|
||||
if index < n_audio {
|
||||
println!("Setting current audio stream to {}", index);
|
||||
println!("Setting current audio stream to {index}");
|
||||
playbin.set_property("current-audio", index);
|
||||
} else {
|
||||
eprintln!("Index out of bounds");
|
||||
|
@ -189,6 +185,6 @@ fn main() {
|
|||
// (but not necessary in normal Cocoa applications where this is set up automatically)
|
||||
match tutorials_common::run(tutorial_main) {
|
||||
Ok(_) => {}
|
||||
Err(err) => eprintln!("Failed: {}", err),
|
||||
Err(err) => eprintln!("Failed: {err}"),
|
||||
};
|
||||
}
|
||||
|
|
|
@ -12,16 +12,13 @@ fn analyze_streams(playbin: &gst::Element) {
|
|||
let n_video = playbin.property::<i32>("n-video");
|
||||
let n_audio = playbin.property::<i32>("n-audio");
|
||||
let n_text = playbin.property::<i32>("n-text");
|
||||
println!(
|
||||
"{} video stream(s), {} audio stream(s), {} subtitle stream(s)",
|
||||
n_video, n_audio, n_text
|
||||
);
|
||||
println!("{n_video} video stream(s), {n_audio} audio stream(s), {n_text} subtitle stream(s)");
|
||||
|
||||
for i in 0..n_video {
|
||||
let tags = playbin.emit_by_name::<Option<gst::TagList>>("get-video-tags", &[&i]);
|
||||
|
||||
if let Some(tags) = tags {
|
||||
println!("video stream {}:", i);
|
||||
println!("video stream {i}:");
|
||||
if let Some(codec) = tags.get::<gst::tags::VideoCodec>() {
|
||||
println!(" codec: {}", codec.get());
|
||||
}
|
||||
|
@ -32,7 +29,7 @@ fn analyze_streams(playbin: &gst::Element) {
|
|||
let tags = playbin.emit_by_name::<Option<gst::TagList>>("get-audio-tags", &[&i]);
|
||||
|
||||
if let Some(tags) = tags {
|
||||
println!("audio stream {}:", i);
|
||||
println!("audio stream {i}:");
|
||||
if let Some(codec) = tags.get::<gst::tags::AudioCodec>() {
|
||||
println!(" codec: {}", codec.get());
|
||||
}
|
||||
|
@ -49,7 +46,7 @@ fn analyze_streams(playbin: &gst::Element) {
|
|||
let tags = playbin.emit_by_name::<Option<gst::TagList>>("get-text-tags", &[&i]);
|
||||
|
||||
if let Some(tags) = tags {
|
||||
println!("subtitle stream {}:", i);
|
||||
println!("subtitle stream {i}:");
|
||||
if let Some(codec) = tags.get::<gst::tags::LanguageCode>() {
|
||||
println!(" language: {}", codec.get());
|
||||
}
|
||||
|
@ -62,8 +59,7 @@ fn analyze_streams(playbin: &gst::Element) {
|
|||
let current_audio = playbin.property::<i32>("current-audio");
|
||||
let current_text = playbin.property::<i32>("current-text");
|
||||
println!(
|
||||
"Currently playing video stream {}, audio stream {}, subtitle stream {}",
|
||||
current_video, current_audio, current_text
|
||||
"Currently playing video stream {current_video}, audio stream {current_audio}, subtitle stream {current_text}"
|
||||
);
|
||||
println!("Type any number and hit ENTER to select a different subtitle stream");
|
||||
}
|
||||
|
@ -81,7 +77,7 @@ fn handle_keyboard(playbin: &gst::Element, main_loop: &glib::MainLoop) {
|
|||
let n_audio = playbin.property::<i32>("n-text");
|
||||
|
||||
if index < n_audio {
|
||||
println!("Setting current subtitle stream to {}", index);
|
||||
println!("Setting current subtitle stream to {index}");
|
||||
playbin.set_property("current-text", index);
|
||||
} else {
|
||||
eprintln!("Index out of bounds");
|
||||
|
@ -194,6 +190,6 @@ fn main() {
|
|||
// (but not necessary in normal Cocoa applications where this is set up automatically)
|
||||
match tutorials_common::run(tutorial_main) {
|
||||
Ok(_) => {}
|
||||
Err(err) => eprintln!("Failed: {}", err),
|
||||
Err(err) => eprintln!("Failed: {err}"),
|
||||
};
|
||||
}
|
||||
|
|
|
@ -184,6 +184,6 @@ fn main() {
|
|||
// (but not necessary in normal Cocoa applications where this is set up automatically)
|
||||
match tutorials_common::run(tutorial_main) {
|
||||
Ok(_) => {}
|
||||
Err(err) => eprintln!("Failed: {}", err),
|
||||
Err(err) => eprintln!("Failed: {err}"),
|
||||
};
|
||||
}
|
||||
|
|
|
@ -188,6 +188,6 @@ fn main() {
|
|||
// (but not necessary in normal Cocoa applications where this is set up automatically)
|
||||
match tutorials_common::run(tutorial_main) {
|
||||
Ok(_) => {}
|
||||
Err(err) => eprintln!("Failed: {}", err),
|
||||
Err(err) => eprintln!("Failed: {err}"),
|
||||
};
|
||||
}
|
||||
|
|
|
@ -192,6 +192,6 @@ fn main() {
|
|||
// (but not necessary in normal Cocoa applications where this is set up automatically)
|
||||
match tutorials_common::run(tutorial_main) {
|
||||
Ok(_) => {}
|
||||
Err(err) => eprintln!("Failed: {}", err),
|
||||
Err(err) => eprintln!("Failed: {err}"),
|
||||
};
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ fn tutorial_main() -> Result<(), Error> {
|
|||
for feature in list {
|
||||
let factory = feature.downcast::<gst::ElementFactory>().unwrap();
|
||||
let name = factory.longname();
|
||||
println!(" {}", name);
|
||||
println!(" {name}");
|
||||
|
||||
if selected_factory.is_none() && name.starts_with("GOOM") {
|
||||
selected_factory = Some(factory);
|
||||
|
@ -41,7 +41,7 @@ fn tutorial_main() -> Result<(), Error> {
|
|||
|
||||
// We have now selected a factory for the visualization element
|
||||
let name = vis_factory.longname();
|
||||
println!("Selected {}", name);
|
||||
println!("Selected {name}");
|
||||
let vis_plugin = vis_factory.create().build().unwrap();
|
||||
|
||||
// Build the pipeline
|
||||
|
@ -82,6 +82,6 @@ fn main() {
|
|||
// (but not necessary in normal Cocoa applications where this is set up automatically)
|
||||
match tutorials_common::run(tutorial_main) {
|
||||
Ok(_) => {}
|
||||
Err(err) => eprintln!("Failed: {}", err),
|
||||
Err(err) => eprintln!("Failed: {err}"),
|
||||
};
|
||||
}
|
||||
|
|
|
@ -65,6 +65,6 @@ fn main() {
|
|||
// (but not necessary in normal Cocoa applications where this is set up automatically)
|
||||
match tutorials_common::run(tutorial_main) {
|
||||
Ok(_) => {}
|
||||
Err(err) => eprintln!("Failed: {}", err),
|
||||
Err(err) => eprintln!("Failed: {err}"),
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue