forked from mirrors/gstreamer-rs
Silence/fix various clippy warnings
This commit is contained in:
parent
8c39da4e5b
commit
86a31b4139
23 changed files with 117 additions and 99 deletions
|
@ -33,7 +33,7 @@
|
|||
extern crate gstreamer as gst;
|
||||
use gst::prelude::*;
|
||||
|
||||
#[macro_use]
|
||||
#[cfg_attr(feature = "v1_10", macro_use)]
|
||||
extern crate glib;
|
||||
|
||||
use std::env;
|
||||
|
|
|
@ -49,9 +49,8 @@ fn print_tags(info: &DiscovererInfo) {
|
|||
|
||||
fn print_stream_info(stream: &DiscovererStreamInfo) {
|
||||
println!("Stream: ");
|
||||
match stream.get_stream_id() {
|
||||
Some(id) => println!(" Stream id: {}", id),
|
||||
None => {}
|
||||
if let Some(id) = stream.get_stream_id() {
|
||||
println!(" Stream id: {}", id);
|
||||
}
|
||||
let caps_str = match stream.get_caps() {
|
||||
Some(caps) => caps.to_string(),
|
||||
|
|
|
@ -19,7 +19,7 @@ use gst::prelude::*;
|
|||
extern crate gstreamer_pbutils as gst_pbutils;
|
||||
use gst_pbutils::prelude::*;
|
||||
|
||||
#[macro_use]
|
||||
#[cfg_attr(feature = "v1_10", macro_use)]
|
||||
extern crate glib;
|
||||
|
||||
use std::env;
|
||||
|
|
|
@ -51,10 +51,6 @@ struct ErrorMessage {
|
|||
cause: glib::Error,
|
||||
}
|
||||
|
||||
#[derive(Debug, Fail)]
|
||||
#[fail(display = "Glutin error")]
|
||||
struct GlutinError();
|
||||
|
||||
#[rustfmt::skip]
|
||||
static VERTICES: [f32; 20] = [
|
||||
1.0, 1.0, 0.0, 1.0, 0.0,
|
||||
|
@ -73,7 +69,7 @@ static IDENTITY: [f32; 16] = [
|
|||
0.0, 0.0, 0.0, 1.0,
|
||||
];
|
||||
|
||||
const VS_SRC: &'static [u8] = b"
|
||||
const VS_SRC: &[u8] = b"
|
||||
uniform mat4 u_transformation;
|
||||
attribute vec4 a_position;
|
||||
attribute vec2 a_texcoord;
|
||||
|
@ -85,7 +81,7 @@ void main() {
|
|||
}
|
||||
\0";
|
||||
|
||||
const FS_SRC: &'static [u8] = b"
|
||||
const FS_SRC: &[u8] = b"
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
@ -97,6 +93,9 @@ void main() {
|
|||
}
|
||||
\0";
|
||||
|
||||
#[allow(clippy::unreadable_literal)]
|
||||
#[allow(clippy::unused_unit)]
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
mod gl {
|
||||
pub use self::Gles2 as Gl;
|
||||
include!(concat!(env!("OUT_DIR"), "/test_gl_bindings.rs"));
|
||||
|
@ -315,7 +314,7 @@ fn load(gl_context: &glutin::Context) -> Gl {
|
|||
};
|
||||
|
||||
Gl {
|
||||
gl: gl,
|
||||
gl,
|
||||
program,
|
||||
attr_position,
|
||||
attr_texture,
|
||||
|
@ -374,6 +373,7 @@ impl App {
|
|||
unsafe { gst_gl::GLContext::new_wrapped(&gl_display, egl_context, platform, api) }
|
||||
.unwrap();
|
||||
|
||||
#[allow(clippy::single_match)]
|
||||
bus.set_sync_handler(move |_, msg| {
|
||||
use gst::MessageView;
|
||||
|
||||
|
@ -417,7 +417,7 @@ impl App {
|
|||
appsink,
|
||||
bus,
|
||||
events_loop: Arc::new(events_loop),
|
||||
combined_context: combined_context,
|
||||
combined_context,
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -556,6 +556,7 @@ fn main_loop(mut app: App) -> Result<(), Error> {
|
|||
let events_loop = Arc::get_mut(&mut app.events_loop).unwrap();
|
||||
let combined_context = app.combined_context.clone();
|
||||
while running {
|
||||
#[allow(clippy::single_match)]
|
||||
events_loop.poll_events(|event| match event {
|
||||
glutin::Event::WindowEvent { event, .. } => match event {
|
||||
glutin::WindowEvent::CloseRequested => running = false,
|
||||
|
|
|
@ -170,7 +170,10 @@ fn create_pipeline() -> Result<gst::Pipeline, Error> {
|
|||
// Calling multiple transformation methods after each other will apply the
|
||||
// new transformation on top. If you repeat the cr.rotate(angle) line below
|
||||
// this a second time, everything in the canvas will rotate twice as fast.
|
||||
cr.translate(info.width() as f64 / 2.0, info.height() as f64 / 2.0);
|
||||
cr.translate(
|
||||
f64::from(info.width()) / 2.0,
|
||||
f64::from(info.height()) / 2.0,
|
||||
);
|
||||
cr.rotate(angle);
|
||||
|
||||
// This loop will render 10 times the string "GStreamer" in a circle
|
||||
|
@ -181,7 +184,7 @@ fn create_pipeline() -> Result<gst::Pipeline, Error> {
|
|||
// previous transformations.
|
||||
cr.save();
|
||||
|
||||
let angle = (360. * i as f64) / 10.0;
|
||||
let angle = (360. * f64::from(i)) / 10.0;
|
||||
let red = (1.0 + f64::cos((angle - 60.0) * PI / 180.0)) / 2.0;
|
||||
cr.set_source_rgb(red, 0.0, 1.0 - red);
|
||||
cr.rotate(angle * PI / 180.0);
|
||||
|
@ -194,8 +197,8 @@ fn create_pipeline() -> Result<gst::Pipeline, Error> {
|
|||
// Using width and height of the text, we can properly possition it within
|
||||
// our canvas.
|
||||
cr.move_to(
|
||||
-(width as f64 / pango::SCALE as f64) / 2.0,
|
||||
-(info.height() as f64) / 2.0,
|
||||
-(f64::from(width) / f64::from(pango::SCALE)) / 2.0,
|
||||
-(f64::from(info.height())) / 2.0,
|
||||
);
|
||||
// After telling the layout object where to draw itself, we actually tell
|
||||
// it to draw itself into our cairo context.
|
||||
|
|
|
@ -270,8 +270,8 @@ fn example_main() -> Result<(), Error> {
|
|||
}
|
||||
.into());
|
||||
}
|
||||
MessageView::StateChanged(s) => match msg.get_src() {
|
||||
Some(element) => {
|
||||
MessageView::StateChanged(s) => {
|
||||
if let Some(element) = msg.get_src() {
|
||||
if element == pipeline && s.get_current() == gst::State::Playing {
|
||||
eprintln!("PLAYING");
|
||||
gst::debug_bin_to_dot_file(
|
||||
|
@ -281,8 +281,7 @@ fn example_main() -> Result<(), Error> {
|
|||
);
|
||||
}
|
||||
}
|
||||
None => (),
|
||||
},
|
||||
}
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -201,8 +201,8 @@ fn example_main() -> Result<(), Error> {
|
|||
}
|
||||
.into());
|
||||
}
|
||||
MessageView::StateChanged(s) => match msg.get_src() {
|
||||
Some(element) => {
|
||||
MessageView::StateChanged(s) => {
|
||||
if let Some(element) = msg.get_src() {
|
||||
if element == pipeline && s.get_current() == gst::State::Playing {
|
||||
eprintln!("PLAYING");
|
||||
gst::debug_bin_to_dot_file(
|
||||
|
@ -212,8 +212,7 @@ fn example_main() -> Result<(), Error> {
|
|||
);
|
||||
}
|
||||
}
|
||||
None => (),
|
||||
},
|
||||
}
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,6 +36,7 @@ unsafe impl Send for AppSinkCallbacks {}
|
|||
unsafe impl Sync for AppSinkCallbacks {}
|
||||
|
||||
impl AppSinkCallbacks {
|
||||
#[allow(clippy::new_ret_no_self)]
|
||||
pub fn new() -> AppSinkCallbacksBuilder {
|
||||
skip_assert_initialized!();
|
||||
AppSinkCallbacksBuilder {
|
||||
|
|
|
@ -27,6 +27,7 @@ unsafe impl Send for AppSrcCallbacks {}
|
|||
unsafe impl Sync for AppSrcCallbacks {}
|
||||
|
||||
impl AppSrcCallbacks {
|
||||
#[allow(clippy::new_ret_no_self)]
|
||||
pub fn new() -> AppSrcCallbacksBuilder {
|
||||
skip_assert_initialized!();
|
||||
|
||||
|
|
|
@ -17,12 +17,8 @@ glib_wrapper! {
|
|||
pub struct FlowCombiner(Shared<ffi::GstFlowCombiner>);
|
||||
|
||||
match fn {
|
||||
ref => |ptr| {
|
||||
gobject_ffi::g_boxed_copy(ffi::gst_flow_combiner_get_type(), ptr as *mut _)
|
||||
},
|
||||
unref => |ptr| {
|
||||
gobject_ffi::g_boxed_free(ffi::gst_flow_combiner_get_type(), ptr as *mut _)
|
||||
},
|
||||
ref => |ptr| gobject_ffi::g_boxed_copy(ffi::gst_flow_combiner_get_type(), ptr as *mut _),
|
||||
unref => |ptr| gobject_ffi::g_boxed_free(ffi::gst_flow_combiner_get_type(), ptr as *mut _),
|
||||
get_type => || ffi::gst_flow_combiner_get_type(),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
extern crate glib_sys as glib_ffi;
|
||||
extern crate gobject_sys as gobject_ffi;
|
||||
#[macro_use]
|
||||
#[cfg_attr(feature = "subclassing", macro_use)]
|
||||
extern crate gstreamer as gst;
|
||||
extern crate gstreamer_base_sys as ffi;
|
||||
extern crate gstreamer_sys as gst_ffi;
|
||||
|
|
|
@ -298,6 +298,12 @@ pub trait EncodingProfileBuilder<'a>: Sized {
|
|||
|
||||
macro_rules! declare_encoding_profile_builder_common(
|
||||
($name:ident) => {
|
||||
impl<'a> Default for $name<'a> {
|
||||
fn default() -> Self {
|
||||
Self::new()
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> EncodingProfileBuilder<'a> for $name<'a> {
|
||||
fn name(mut self, name: &'a str) -> $name<'a> {
|
||||
self.base.name = Some(name);
|
||||
|
|
|
@ -42,6 +42,7 @@ impl VideoMeta {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn add_full<'a>(
|
||||
buffer: &'a mut gst::BufferRef,
|
||||
flags: ::VideoFrameFlags,
|
||||
|
|
|
@ -39,6 +39,7 @@ impl VideoTimeCode {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn new(
|
||||
fps: gst::Fraction,
|
||||
latest_daily_jam: Option<&glib::DateTime>,
|
||||
|
@ -153,6 +154,7 @@ impl VideoTimeCode {
|
|||
}
|
||||
|
||||
impl ValidVideoTimeCode {
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn new(
|
||||
fps: gst::Fraction,
|
||||
latest_daily_jam: Option<&glib::DateTime>,
|
||||
|
|
|
@ -111,7 +111,7 @@ impl<'de> Visitor<'de> for CapsFeaturesVariantKindsVisitor {
|
|||
CAPS_FEATURES_VARIANT_ANY_ID => Ok(CapsFeaturesVariantKinds::Any),
|
||||
CAPS_FEATURES_VARIANT_SOME_ID => Ok(CapsFeaturesVariantKinds::Some),
|
||||
_ => Err(de::Error::invalid_value(
|
||||
de::Unexpected::Unsigned(value as u64),
|
||||
de::Unexpected::Unsigned(u64::from(value)),
|
||||
&self,
|
||||
)),
|
||||
}
|
||||
|
|
|
@ -174,7 +174,7 @@ impl<'de> Visitor<'de> for CapsVariantKindsVisitor {
|
|||
CAPS_VARIANT_EMPTY_ID => Ok(CapsVariantKinds::Empty),
|
||||
CAPS_VARIANT_SOME_ID => Ok(CapsVariantKinds::Some),
|
||||
_ => Err(de::Error::invalid_value(
|
||||
de::Unexpected::Unsigned(value as u64),
|
||||
de::Unexpected::Unsigned(u64::from(value)),
|
||||
&self,
|
||||
)),
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ impl<'a> Serialize for DateTime {
|
|||
self.get_day(),
|
||||
self.get_hour(),
|
||||
self.get_minute(),
|
||||
(self.get_second() as f64) + (self.get_microsecond() as f64) / 1_000_000f64,
|
||||
f64::from(self.get_second()) + f64::from(self.get_microsecond()) / 1_000_000f64,
|
||||
self.get_time_zone_offset(),
|
||||
)
|
||||
} else if self.has_time() {
|
||||
|
@ -58,6 +58,7 @@ impl<'a> Serialize for DateTime {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(clippy::many_single_char_names)]
|
||||
impl From<DateTimeVariants> for DateTime {
|
||||
fn from(dt_variant: DateTimeVariants) -> Self {
|
||||
match dt_variant {
|
||||
|
|
|
@ -113,12 +113,12 @@ impl Error for ErrorMessage {
|
|||
macro_rules! gst_loggable_error(
|
||||
// Plain strings
|
||||
($cat:expr, $msg:expr) => {
|
||||
$crate::LoggableError::new(&$cat, glib_bool_error!($msg))
|
||||
$crate::LoggableError::new($cat.clone(), glib_bool_error!($msg))
|
||||
};
|
||||
|
||||
// Format strings
|
||||
($cat:expr, $($msg:tt)*) => { {
|
||||
$crate::LoggableError::new(&$cat, glib_bool_error!($($msg)*))
|
||||
$crate::LoggableError::new($cat.clone(), glib_bool_error!($($msg)*))
|
||||
}};
|
||||
);
|
||||
|
||||
|
@ -127,13 +127,13 @@ macro_rules! gst_result_from_gboolean(
|
|||
// Plain strings
|
||||
($ffi_bool:expr, $cat:expr, $msg:expr) => {
|
||||
glib_result_from_gboolean!($ffi_bool, $msg)
|
||||
.map_err(|bool_err| $crate::LoggableError::new(&$cat, bool_err))
|
||||
.map_err(|bool_err| $crate::LoggableError::new($cat.clone(), bool_err))
|
||||
};
|
||||
|
||||
// Format strings
|
||||
($ffi_bool:expr, $cat:expr, $($msg:tt)*) => { {
|
||||
glib_result_from_gboolean!($ffi_bool, $($msg)*)
|
||||
.map_err(|bool_err| $crate::LoggableError::new(&$cat, bool_err))
|
||||
.map_err(|bool_err| $crate::LoggableError::new($cat.clone(), bool_err))
|
||||
}};
|
||||
);
|
||||
|
||||
|
@ -144,9 +144,9 @@ pub struct LoggableError {
|
|||
}
|
||||
|
||||
impl LoggableError {
|
||||
pub fn new(category: &::DebugCategory, bool_error: glib::BoolError) -> LoggableError {
|
||||
pub fn new(category: ::DebugCategory, bool_error: glib::BoolError) -> LoggableError {
|
||||
LoggableError {
|
||||
category: *category,
|
||||
category,
|
||||
bool_error,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,6 +59,7 @@ impl<T> Iterator<T>
|
|||
where
|
||||
for<'a> T: FromValueOptional<'a> + 'static,
|
||||
{
|
||||
#[allow(clippy::should_implement_trait)]
|
||||
pub fn next(&mut self) -> Result<Option<T>, IteratorError> {
|
||||
unsafe {
|
||||
let mut value = Value::uninitialized();
|
||||
|
|
|
@ -20,7 +20,6 @@ use glib::IsA;
|
|||
#[derive(PartialEq, Eq, Clone, Copy)]
|
||||
pub struct DebugCategory(ptr::NonNull<ffi::GstDebugCategory>);
|
||||
|
||||
#[allow(clippy::trivially_copy_pass_by_ref)]
|
||||
impl DebugCategory {
|
||||
pub fn new<'a, P: Into<Option<&'a str>>>(
|
||||
name: &str,
|
||||
|
@ -64,23 +63,23 @@ impl DebugCategory {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn get_threshold(&self) -> ::DebugLevel {
|
||||
pub fn get_threshold(self) -> ::DebugLevel {
|
||||
from_glib(unsafe { ffi::gst_debug_category_get_threshold(self.0.as_ptr()) })
|
||||
}
|
||||
|
||||
pub fn set_threshold(&self, threshold: ::DebugLevel) {
|
||||
pub fn set_threshold(self, threshold: ::DebugLevel) {
|
||||
unsafe { ffi::gst_debug_category_set_threshold(self.0.as_ptr(), threshold.to_glib()) }
|
||||
}
|
||||
|
||||
pub fn reset_threshold(&self) {
|
||||
pub fn reset_threshold(self) {
|
||||
unsafe { ffi::gst_debug_category_reset_threshold(self.0.as_ptr()) }
|
||||
}
|
||||
|
||||
pub fn get_color(&self) -> ::DebugColorFlags {
|
||||
pub fn get_color(self) -> ::DebugColorFlags {
|
||||
unsafe { from_glib(ffi::gst_debug_category_get_color(self.0.as_ptr())) }
|
||||
}
|
||||
|
||||
pub fn get_name(&self) -> &str {
|
||||
pub fn get_name<'a>(self) -> &'a str {
|
||||
unsafe {
|
||||
CStr::from_ptr(ffi::gst_debug_category_get_name(self.0.as_ptr()))
|
||||
.to_str()
|
||||
|
@ -88,9 +87,9 @@ impl DebugCategory {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn get_description(&self) -> Option<&str> {
|
||||
pub fn get_description<'a>(self) -> Option<&'a str> {
|
||||
unsafe {
|
||||
let ptr = ffi::gst_debug_category_get_name(self.0.as_ptr());
|
||||
let ptr = ffi::gst_debug_category_get_description(self.0.as_ptr());
|
||||
|
||||
if ptr.is_null() {
|
||||
None
|
||||
|
@ -102,7 +101,7 @@ impl DebugCategory {
|
|||
|
||||
#[inline]
|
||||
pub fn log<O: IsA<::Object>>(
|
||||
&self,
|
||||
self,
|
||||
obj: Option<&O>,
|
||||
level: ::DebugLevel,
|
||||
file: &str,
|
||||
|
@ -199,91 +198,91 @@ declare_debug_category_from_name!(CAT_CONTEXT, "GST_CONTEXT");
|
|||
#[macro_export]
|
||||
macro_rules! gst_error(
|
||||
($cat:expr, obj: $obj:expr, $($args:tt)*) => { {
|
||||
gst_log_with_level!($cat, level: $crate::DebugLevel::Error, obj: $obj, $($args)*)
|
||||
gst_log_with_level!($cat.clone(), level: $crate::DebugLevel::Error, obj: $obj, $($args)*)
|
||||
}};
|
||||
($cat:expr, $($args:tt)*) => { {
|
||||
gst_log_with_level!($cat, level: $crate::DebugLevel::Error, $($args)*)
|
||||
gst_log_with_level!($cat.clone(), level: $crate::DebugLevel::Error, $($args)*)
|
||||
}};
|
||||
);
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! gst_warning(
|
||||
($cat:expr, obj: $obj:expr, $($args:tt)*) => { {
|
||||
gst_log_with_level!($cat, level: $crate::DebugLevel::Warning, obj: $obj, $($args)*)
|
||||
gst_log_with_level!($cat.clone(), level: $crate::DebugLevel::Warning, obj: $obj, $($args)*)
|
||||
}};
|
||||
($cat:expr, $($args:tt)*) => { {
|
||||
gst_log_with_level!($cat, level: $crate::DebugLevel::Warning, $($args)*)
|
||||
gst_log_with_level!($cat.clone(), level: $crate::DebugLevel::Warning, $($args)*)
|
||||
}};
|
||||
);
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! gst_fixme(
|
||||
($cat:expr, obj: $obj:expr, $($args:tt)*) => { {
|
||||
gst_log_with_level!($cat, level: $crate::DebugLevel::Fixme, obj: $obj, $($args)*)
|
||||
gst_log_with_level!($cat.clone(), level: $crate::DebugLevel::Fixme, obj: $obj, $($args)*)
|
||||
}};
|
||||
($cat:expr, $($args:tt)*) => { {
|
||||
gst_log_with_level!($cat, level: $crate::DebugLevel::Fixme, $($args)*)
|
||||
gst_log_with_level!($cat.clone(), level: $crate::DebugLevel::Fixme, $($args)*)
|
||||
}};
|
||||
);
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! gst_info(
|
||||
($cat:expr, obj: $obj:expr, $($args:tt)*) => { {
|
||||
gst_log_with_level!($cat, level: $crate::DebugLevel::Info, obj: $obj, $($args)*)
|
||||
gst_log_with_level!($cat.clone(), level: $crate::DebugLevel::Info, obj: $obj, $($args)*)
|
||||
}};
|
||||
($cat:expr, $($args:tt)*) => { {
|
||||
gst_log_with_level!($cat, level: $crate::DebugLevel::Info, $($args)*)
|
||||
gst_log_with_level!($cat.clone(), level: $crate::DebugLevel::Info, $($args)*)
|
||||
}};
|
||||
);
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! gst_debug(
|
||||
($cat:expr, obj: $obj:expr, $($args:tt)*) => { {
|
||||
gst_log_with_level!($cat, level: $crate::DebugLevel::Debug, obj: $obj, $($args)*)
|
||||
gst_log_with_level!($cat.clone(), level: $crate::DebugLevel::Debug, obj: $obj, $($args)*)
|
||||
}};
|
||||
($cat:expr, $($args:tt)*) => { {
|
||||
gst_log_with_level!($cat, level: $crate::DebugLevel::Debug, $($args)*)
|
||||
gst_log_with_level!($cat.clone(), level: $crate::DebugLevel::Debug, $($args)*)
|
||||
}};
|
||||
);
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! gst_log(
|
||||
($cat:expr, obj: $obj:expr, $($args:tt)*) => { {
|
||||
gst_log_with_level!($cat, level: $crate::DebugLevel::Log, obj: $obj, $($args)*)
|
||||
gst_log_with_level!($cat.clone(), level: $crate::DebugLevel::Log, obj: $obj, $($args)*)
|
||||
}};
|
||||
($cat:expr, $($args:tt)*) => { {
|
||||
gst_log_with_level!($cat, level: $crate::DebugLevel::Log, $($args)*)
|
||||
gst_log_with_level!($cat.clone(), level: $crate::DebugLevel::Log, $($args)*)
|
||||
}};
|
||||
);
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! gst_trace(
|
||||
($cat:expr, obj: $obj:expr, $($args:tt)*) => { {
|
||||
gst_log_with_level!($cat, level: $crate::DebugLevel::Trace, obj: $obj, $($args)*)
|
||||
gst_log_with_level!($cat.clone(), level: $crate::DebugLevel::Trace, obj: $obj, $($args)*)
|
||||
}};
|
||||
($cat:expr, $($args:tt)*) => { {
|
||||
gst_log_with_level!($cat, level: $crate::DebugLevel::Trace, $($args)*)
|
||||
gst_log_with_level!($cat.clone(), level: $crate::DebugLevel::Trace, $($args)*)
|
||||
}};
|
||||
);
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! gst_memdump(
|
||||
($cat:expr, obj: $obj:expr, $($args:tt)*) => { {
|
||||
gst_log_with_level!($cat, level: $crate::DebugLevel::Memdump, obj: $obj, $($args)*)
|
||||
gst_log_with_level!($cat.clone(), level: $crate::DebugLevel::Memdump, obj: $obj, $($args)*)
|
||||
}};
|
||||
($cat:expr, $($args:tt)*) => { {
|
||||
gst_log_with_level!($cat, level: $crate::DebugLevel::Memdump, $($args)*)
|
||||
gst_log_with_level!($cat.clone(), level: $crate::DebugLevel::Memdump, $($args)*)
|
||||
}};
|
||||
);
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! gst_log_with_level(
|
||||
($cat:expr, level: $level:expr, obj: $obj:expr, $($args:tt)*) => { {
|
||||
$crate::DebugCategory::log(&$cat, Some($obj), $level, file!(),
|
||||
$crate::DebugCategory::log($cat.clone(), Some($obj), $level, file!(),
|
||||
module_path!(), line!(), format_args!($($args)*))
|
||||
}};
|
||||
($cat:expr, level: $level:expr, $($args:tt)*) => { {
|
||||
$crate::DebugCategory::log(&$cat, None as Option<&$crate::Object>, $level, file!(),
|
||||
$crate::DebugCategory::log($cat.clone(), None as Option<&$crate::Object>, $level, file!(),
|
||||
module_path!(), line!(), format_args!($($args)*))
|
||||
}};
|
||||
);
|
||||
|
|
|
@ -80,9 +80,9 @@ impl<T: BinImpl + ObjectImpl> BinImplExt for T {
|
|||
unsafe {
|
||||
let data = self.get_type_data();
|
||||
let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstBinClass;
|
||||
(*parent_class)
|
||||
.handle_message
|
||||
.map(move |f| f(bin.to_glib_none().0, message.into_ptr()));
|
||||
if let Some(ref f) = (*parent_class).handle_message {
|
||||
f(bin.to_glib_none().0, message.into_ptr());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -158,10 +158,13 @@ mod tutorial5 {
|
|||
let slider_update_signal_id = slider.connect_value_changed(move |slider| {
|
||||
let pipeline = &pipeline;
|
||||
let value = slider.get_value() as u64;
|
||||
if let Err(_) = pipeline.seek_simple(
|
||||
if pipeline
|
||||
.seek_simple(
|
||||
gst::SeekFlags::FLUSH | gst::SeekFlags::KEY_UNIT,
|
||||
value * gst::SECOND,
|
||||
) {
|
||||
)
|
||||
.is_err()
|
||||
{
|
||||
eprintln!("Seeking to {} failed", value);
|
||||
}
|
||||
});
|
||||
|
@ -257,10 +260,10 @@ mod tutorial5 {
|
|||
streams_list.set_editable(false);
|
||||
let pipeline_weak = playbin.downgrade();
|
||||
let streams_list_weak = glib::SendWeakRef::from(streams_list.downgrade());
|
||||
playbin
|
||||
.get_bus()
|
||||
.unwrap()
|
||||
.connect_message(move |_, msg| match msg.view() {
|
||||
let bus = playbin.get_bus().unwrap();
|
||||
|
||||
#[allow(clippy::single_match)]
|
||||
bus.connect_message(move |_, msg| match msg.view() {
|
||||
gst::MessageView::Application(application) => {
|
||||
let pipeline = match pipeline_weak.upgrade() {
|
||||
Some(pipeline) => pipeline,
|
||||
|
@ -309,11 +312,16 @@ mod tutorial5 {
|
|||
|
||||
pub fn run() {
|
||||
// Make sure the right features were activated
|
||||
#[allow(clippy::eq_op)]
|
||||
{
|
||||
if !cfg!(feature = "tutorial5-x11") && !cfg!(feature = "tutorial5-quartz") {
|
||||
eprintln!("No Gdk backend selected, compile with --features tutorial5[-x11][-quartz].");
|
||||
eprintln!(
|
||||
"No Gdk backend selected, compile with --features tutorial5[-x11][-quartz]."
|
||||
);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize GTK
|
||||
if let Err(err) = gtk::init() {
|
||||
|
|
|
@ -243,6 +243,7 @@ fn main() {
|
|||
let main_loop = glib::MainLoop::new(None, false);
|
||||
let main_loop_clone = main_loop.clone();
|
||||
let bus = pipeline.get_bus().unwrap();
|
||||
#[allow(clippy::single_match)]
|
||||
bus.connect_message(move |_, msg| match msg.view() {
|
||||
gst::MessageView::Error(err) => {
|
||||
let main_loop = &main_loop_clone;
|
||||
|
|
Loading…
Reference in a new issue