Fix/hide various clippy warnings in gstreamer-player

And let PlayerGMainContextSignalDispatcher::new() return the correct
type
This commit is contained in:
Sebastian Dröge 2017-09-10 14:20:35 +03:00
parent 357d98bf3a
commit e0e0f56b52
5 changed files with 36 additions and 11 deletions

View file

@ -153,3 +153,8 @@ trait = false
name = "GstPlayer.PlayerGMainContextSignalDispatcher"
status = "generate"
trait = false
[[object.function]]
name = "new"
# Wrong return value
ignore = true

View file

@ -18,8 +18,11 @@ fn main_loop(uri: &str) -> Result<(), utils::ExampleError> {
let main_loop = glib::MainLoop::new(None, false);
let dispatcher = gst_player::PlayerGMainContextSignalDispatcher::new(None).unwrap();
let player = gst_player::Player::new(None, Some(&dispatcher));
let dispatcher = gst_player::PlayerGMainContextSignalDispatcher::new(None);
let player = gst_player::Player::new(
None,
Some(&dispatcher.upcast::<gst_player::PlayerSignalDispatcher>()),
);
player
.set_property("uri", &glib::Value::from(uri))
.expect("Can't set uri property");

View file

@ -32,15 +32,6 @@ impl PlayerGMainContextSignalDispatcher {
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 {
unsafe {
let f: Box_<Box_<Fn(&PlayerGMainContextSignalDispatcher) + Send + Sync + 'static>> = Box_::new(Box_::new(f));

View file

@ -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(too_many_arguments))]
#[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;
pub use auto::*;
@ -45,6 +47,7 @@ mod player;
mod player_video_overlay_video_renderer;
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
// can always "use gst::prelude::*" without getting conflicts

View file

@ -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)
}
}
}