forked from mirrors/gstreamer-rs
Fix/hide various clippy warnings in gstreamer-player
And let PlayerGMainContextSignalDispatcher::new() return the correct type
This commit is contained in:
parent
357d98bf3a
commit
e0e0f56b52
5 changed files with 36 additions and 11 deletions
|
@ -153,3 +153,8 @@ trait = false
|
||||||
name = "GstPlayer.PlayerGMainContextSignalDispatcher"
|
name = "GstPlayer.PlayerGMainContextSignalDispatcher"
|
||||||
status = "generate"
|
status = "generate"
|
||||||
trait = false
|
trait = false
|
||||||
|
|
||||||
|
[[object.function]]
|
||||||
|
name = "new"
|
||||||
|
# Wrong return value
|
||||||
|
ignore = true
|
||||||
|
|
|
@ -18,8 +18,11 @@ fn main_loop(uri: &str) -> Result<(), utils::ExampleError> {
|
||||||
|
|
||||||
let main_loop = glib::MainLoop::new(None, false);
|
let main_loop = glib::MainLoop::new(None, false);
|
||||||
|
|
||||||
let dispatcher = gst_player::PlayerGMainContextSignalDispatcher::new(None).unwrap();
|
let dispatcher = gst_player::PlayerGMainContextSignalDispatcher::new(None);
|
||||||
let player = gst_player::Player::new(None, Some(&dispatcher));
|
let player = gst_player::Player::new(
|
||||||
|
None,
|
||||||
|
Some(&dispatcher.upcast::<gst_player::PlayerSignalDispatcher>()),
|
||||||
|
);
|
||||||
player
|
player
|
||||||
.set_property("uri", &glib::Value::from(uri))
|
.set_property("uri", &glib::Value::from(uri))
|
||||||
.expect("Can't set uri property");
|
.expect("Can't set uri property");
|
||||||
|
|
|
@ -32,15 +32,6 @@ impl PlayerGMainContextSignalDispatcher {
|
||||||
value.get()
|
value.get()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new<'a, P: Into<Option<&'a glib::MainContext>>>(application_context: P) -> Option<PlayerSignalDispatcher> {
|
|
||||||
assert_initialized_main_thread!();
|
|
||||||
let application_context = application_context.into();
|
|
||||||
let application_context = application_context.to_glib_none();
|
|
||||||
unsafe {
|
|
||||||
from_glib_full(ffi::gst_player_g_main_context_signal_dispatcher_new(application_context.0))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn connect_property_application_context_notify<F: Fn(&PlayerGMainContextSignalDispatcher) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
|
pub fn connect_property_application_context_notify<F: Fn(&PlayerGMainContextSignalDispatcher) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
|
||||||
unsafe {
|
unsafe {
|
||||||
let f: Box_<Box_<Fn(&PlayerGMainContextSignalDispatcher) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
|
let f: Box_<Box_<Fn(&PlayerGMainContextSignalDispatcher) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
|
||||||
|
|
|
@ -38,6 +38,8 @@ pub use glib::{Cast, Continue, Error, IsA, StaticType, ToValue, Type, TypedValue
|
||||||
#[cfg_attr(feature = "cargo-clippy", allow(transmute_ptr_to_ref))]
|
#[cfg_attr(feature = "cargo-clippy", allow(transmute_ptr_to_ref))]
|
||||||
#[cfg_attr(feature = "cargo-clippy", allow(too_many_arguments))]
|
#[cfg_attr(feature = "cargo-clippy", allow(too_many_arguments))]
|
||||||
#[cfg_attr(feature = "cargo-clippy", allow(match_same_arms))]
|
#[cfg_attr(feature = "cargo-clippy", allow(match_same_arms))]
|
||||||
|
#[cfg_attr(feature = "cargo-clippy", allow(type_complexity))]
|
||||||
|
#[cfg_attr(feature = "cargo-clippy", allow(useless_transmute))]
|
||||||
mod auto;
|
mod auto;
|
||||||
pub use auto::*;
|
pub use auto::*;
|
||||||
|
|
||||||
|
@ -45,6 +47,7 @@ mod player;
|
||||||
|
|
||||||
mod player_video_overlay_video_renderer;
|
mod player_video_overlay_video_renderer;
|
||||||
pub use player_video_overlay_video_renderer::PlayerVideoOverlayVideoRendererExtManual;
|
pub use player_video_overlay_video_renderer::PlayerVideoOverlayVideoRendererExtManual;
|
||||||
|
mod player_g_main_context_signal_dispatcher;
|
||||||
|
|
||||||
// Re-export all the traits in a prelude module, so that applications
|
// Re-export all the traits in a prelude module, so that applications
|
||||||
// can always "use gst::prelude::*" without getting conflicts
|
// can always "use gst::prelude::*" without getting conflicts
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
// Copyright (C) 2017 Sebastian Dröge <sebastian@centricular.com>
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||||
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||||
|
// option. This file may not be copied, modified, or distributed
|
||||||
|
// except according to those terms.
|
||||||
|
|
||||||
|
use PlayerGMainContextSignalDispatcher;
|
||||||
|
use ffi;
|
||||||
|
use glib;
|
||||||
|
use glib::translate::*;
|
||||||
|
|
||||||
|
impl PlayerGMainContextSignalDispatcher {
|
||||||
|
pub fn new<'a, P: Into<Option<&'a glib::MainContext>>>(application_context: P) -> PlayerGMainContextSignalDispatcher {
|
||||||
|
assert_initialized_main_thread!();
|
||||||
|
let application_context = application_context.into();
|
||||||
|
let application_context = application_context.to_glib_none();
|
||||||
|
unsafe {
|
||||||
|
from_glib_full(ffi::gst_player_g_main_context_signal_dispatcher_new(application_context.0) as *mut ffi::GstPlayerGMainContextSignalDispatcher)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue