Remove various Into<Option<_>> trait bounds from functions

In autogenerated code these were already replaced but some manual code
still kept them.
This commit is contained in:
Sebastian Dröge 2019-05-23 21:19:24 +03:00 committed by Sebastian Dröge
parent 6cef32a4dd
commit 86e969d964
31 changed files with 143 additions and 336 deletions

View file

@ -45,9 +45,9 @@ struct ErrorMessage {
cause: glib::Error, cause: glib::Error,
} }
fn make_element<'a, P: Into<Option<&'a str>>>( fn make_element(
factory_name: &'static str, factory_name: &'static str,
element_name: P, element_name: Option<&str>,
) -> Result<gst::Element, Error> { ) -> Result<gst::Element, Error> {
match gst::ElementFactory::make(factory_name, element_name.into()) { match gst::ElementFactory::make(factory_name, element_name.into()) {
Some(elem) => Ok(elem), Some(elem) => Ok(elem),

View file

@ -42,9 +42,9 @@ struct ErrorMessage {
cause: glib::Error, cause: glib::Error,
} }
fn make_element<'a, P: Into<Option<&'a str>>>( fn make_element(
factory_name: &'static str, factory_name: &'static str,
element_name: P, element_name: Option<&str>,
) -> Result<gst::Element, Error> { ) -> Result<gst::Element, Error> {
match gst::ElementFactory::make(factory_name, element_name.into()) { match gst::ElementFactory::make(factory_name, element_name.into()) {
Some(elem) => Ok(elem), Some(elem) => Ok(elem),

View file

@ -12,17 +12,11 @@ use gst;
use gst_base_sys; use gst_base_sys;
use std::mem; use std::mem;
pub fn type_find_helper_for_data< pub fn type_find_helper_for_data<P: IsA<gst::Object>, R: AsRef<[u8]>>(
'a, obj: Option<&P>,
P: IsA<gst::Object> + 'a,
Q: Into<Option<&'a P>>,
R: AsRef<[u8]>,
>(
obj: Q,
data: R, data: R,
) -> (Option<gst::Caps>, gst::TypeFindProbability) { ) -> (Option<gst::Caps>, gst::TypeFindProbability) {
assert_initialized_main_thread!(); assert_initialized_main_thread!();
let obj = obj.into();
unsafe { unsafe {
let mut prob = mem::uninitialized(); let mut prob = mem::uninitialized();
let data = data.as_ref(); let data = data.as_ref();

View file

@ -38,29 +38,15 @@ impl Drop for Harness {
unsafe impl Send for Harness {} unsafe impl Send for Harness {}
impl Harness { impl Harness {
pub fn add_element_full< pub fn add_element_full<P: IsA<gst::Element>>(
'a,
'b,
'c,
'd,
P: IsA<gst::Element>,
Q: Into<Option<&'a gst::StaticPadTemplate>>,
R: Into<Option<&'b str>>,
S: Into<Option<&'c gst::StaticPadTemplate>>,
T: Into<Option<&'d str>>,
>(
&mut self, &mut self,
element: &P, element: &P,
hsrc: Q, hsrc: Option<&gst::StaticPadTemplate>,
element_sinkpad_name: R, element_sinkpad_name: Option<&str>,
hsink: S, hsink: Option<&gst::StaticPadTemplate>,
element_srcpad_name: T, element_srcpad_name: Option<&str>,
) { ) {
let hsrc = hsrc.into();
let element_sinkpad_name = element_sinkpad_name.into();
let element_sinkpad_name = element_sinkpad_name.to_glib_none(); let element_sinkpad_name = element_sinkpad_name.to_glib_none();
let hsink = hsink.into();
let element_srcpad_name = element_srcpad_name.into();
let element_srcpad_name = element_srcpad_name.to_glib_none(); let element_srcpad_name = element_srcpad_name.to_glib_none();
unsafe { unsafe {
gst_check_sys::gst_harness_add_element_full( gst_check_sys::gst_harness_add_element_full(
@ -115,10 +101,10 @@ impl Harness {
} }
#[cfg(any(feature = "v1_16", feature = "dox"))] #[cfg(any(feature = "v1_16", feature = "dox"))]
pub fn add_propose_allocation_meta<'a, P: Into<Option<&'a gst::StructureRef>>>( pub fn add_propose_allocation_meta(
&mut self, &mut self,
api: glib::types::Type, api: glib::types::Type,
params: P, params: Option<&gst::StructureRef>,
) { ) {
let params = params.into(); let params = params.into();
unsafe { unsafe {
@ -390,7 +376,7 @@ impl Harness {
} }
} }
//pub fn set_propose_allocator<'a, 'b, P: Into<Option<&'a /*Ignored*/gst::Allocator>>, Q: Into<Option<&'b /*Ignored*/gst::AllocationParams>>>(&mut self, allocator: P, params: Q) { //pub fn set_propose_allocator<P: IsA<gst::Allocator>>(&mut self, allocator: Option<&P>, params: Option<&gst::AllocationParams>) {
// unsafe { TODO: call gst_check_sys::gst_harness_set_propose_allocator() } // unsafe { TODO: call gst_check_sys::gst_harness_set_propose_allocator() }
//} //}
@ -589,29 +575,15 @@ impl Harness {
unsafe { Self::from_glib_full(gst_check_sys::gst_harness_new_empty()) } unsafe { Self::from_glib_full(gst_check_sys::gst_harness_new_empty()) }
} }
pub fn new_full< pub fn new_full<P: IsA<gst::Element>>(
'a,
'b,
'c,
'd,
P: IsA<gst::Element>,
Q: Into<Option<&'a gst::StaticPadTemplate>>,
R: Into<Option<&'b str>>,
S: Into<Option<&'c gst::StaticPadTemplate>>,
T: Into<Option<&'d str>>,
>(
element: &P, element: &P,
hsrc: Q, hsrc: Option<&gst::StaticPadTemplate>,
element_sinkpad_name: R, element_sinkpad_name: Option<&str>,
hsink: S, hsink: Option<&gst::StaticPadTemplate>,
element_srcpad_name: T, element_srcpad_name: Option<&str>,
) -> Harness { ) -> Harness {
assert_initialized_main_thread!(); assert_initialized_main_thread!();
let hsrc = hsrc.into();
let element_sinkpad_name = element_sinkpad_name.into();
let element_sinkpad_name = element_sinkpad_name.to_glib_none(); let element_sinkpad_name = element_sinkpad_name.to_glib_none();
let hsink = hsink.into();
let element_srcpad_name = element_srcpad_name.into();
let element_srcpad_name = element_srcpad_name.to_glib_none(); let element_srcpad_name = element_srcpad_name.to_glib_none();
unsafe { unsafe {
Self::from_glib_full(gst_check_sys::gst_harness_new_full( Self::from_glib_full(gst_check_sys::gst_harness_new_full(
@ -633,21 +605,13 @@ impl Harness {
} }
} }
pub fn new_with_element< pub fn new_with_element<P: IsA<gst::Element>>(
'a,
'b,
P: IsA<gst::Element>,
Q: Into<Option<&'a str>>,
R: Into<Option<&'b str>>,
>(
element: &P, element: &P,
element_sinkpad_name: Q, element_sinkpad_name: Option<&str>,
element_srcpad_name: R, element_srcpad_name: Option<&str>,
) -> Harness { ) -> Harness {
assert_initialized_main_thread!(); assert_initialized_main_thread!();
let element_sinkpad_name = element_sinkpad_name.into();
let element_sinkpad_name = element_sinkpad_name.to_glib_none(); let element_sinkpad_name = element_sinkpad_name.to_glib_none();
let element_srcpad_name = element_srcpad_name.into();
let element_srcpad_name = element_srcpad_name.to_glib_none(); let element_srcpad_name = element_srcpad_name.to_glib_none();
unsafe { unsafe {
Self::from_glib_full(gst_check_sys::gst_harness_new_with_element( Self::from_glib_full(gst_check_sys::gst_harness_new_with_element(
@ -658,15 +622,13 @@ impl Harness {
} }
} }
pub fn new_with_padnames<'a, 'b, P: Into<Option<&'a str>>, Q: Into<Option<&'b str>>>( pub fn new_with_padnames(
element_name: &str, element_name: &str,
element_sinkpad_name: P, element_sinkpad_name: Option<&str>,
element_srcpad_name: Q, element_srcpad_name: Option<&str>,
) -> Harness { ) -> Harness {
assert_initialized_main_thread!(); assert_initialized_main_thread!();
let element_sinkpad_name = element_sinkpad_name.into();
let element_sinkpad_name = element_sinkpad_name.to_glib_none(); let element_sinkpad_name = element_sinkpad_name.to_glib_none();
let element_srcpad_name = element_srcpad_name.into();
let element_srcpad_name = element_srcpad_name.to_glib_none(); let element_srcpad_name = element_srcpad_name.to_glib_none();
unsafe { unsafe {
Self::from_glib_full(gst_check_sys::gst_harness_new_with_padnames( Self::from_glib_full(gst_check_sys::gst_harness_new_with_padnames(
@ -677,19 +639,12 @@ impl Harness {
} }
} }
pub fn new_with_templates< pub fn new_with_templates(
'a,
'b,
P: Into<Option<&'a gst::StaticPadTemplate>>,
Q: Into<Option<&'b gst::StaticPadTemplate>>,
>(
element_name: &str, element_name: &str,
hsrc: P, hsrc: Option<&gst::StaticPadTemplate>,
hsink: Q, hsink: Option<&gst::StaticPadTemplate>,
) -> Harness { ) -> Harness {
assert_initialized_main_thread!(); assert_initialized_main_thread!();
let hsrc = hsrc.into();
let hsink = hsink.into();
unsafe { unsafe {
Self::from_glib_full(gst_check_sys::gst_harness_new_with_templates( Self::from_glib_full(gst_check_sys::gst_harness_new_with_templates(
element_name.to_glib_none().0, element_name.to_glib_none().0,

View file

@ -14,14 +14,13 @@ use glib::translate::*;
use gst; use gst;
impl NetClientClock { impl NetClientClock {
pub fn new<'a, P: Into<Option<&'a str>>>( pub fn new(
name: P, name: Option<&str>,
remote_address: &str, remote_address: &str,
remote_port: i32, remote_port: i32,
base_time: gst::ClockTime, base_time: gst::ClockTime,
) -> NetClientClock { ) -> NetClientClock {
assert_initialized_main_thread!(); assert_initialized_main_thread!();
let name = name.into();
let name = name.to_glib_none(); let name = name.to_glib_none();
let (major, minor, _, _) = gst::version(); let (major, minor, _, _) = gst::version();
if (major, minor) > (1, 12) { if (major, minor) > (1, 12) {

View file

@ -14,13 +14,8 @@ use glib::IsA;
use gst; use gst;
impl NetTimeProvider { impl NetTimeProvider {
pub fn new<'a, P: IsA<gst::Clock>, Q: Into<Option<&'a str>>>( pub fn new<P: IsA<gst::Clock>>(clock: &P, address: Option<&str>, port: i32) -> NetTimeProvider {
clock: &P,
address: Q,
port: i32,
) -> NetTimeProvider {
assert_initialized_main_thread!(); assert_initialized_main_thread!();
let address = address.into();
let address = address.to_glib_none(); let address = address.to_glib_none();
let (major, minor, _, _) = gst::version(); let (major, minor, _, _) = gst::version();

View file

@ -14,14 +14,13 @@ use glib::translate::*;
use gst; use gst;
impl NtpClock { impl NtpClock {
pub fn new<'a, P: Into<Option<&'a str>>>( pub fn new(
name: P, name: Option<&str>,
remote_address: &str, remote_address: &str,
remote_port: i32, remote_port: i32,
base_time: gst::ClockTime, base_time: gst::ClockTime,
) -> NtpClock { ) -> NtpClock {
assert_initialized_main_thread!(); assert_initialized_main_thread!();
let name = name.into();
let name = name.to_glib_none(); let name = name.to_glib_none();
let (major, minor, _, _) = gst::version(); let (major, minor, _, _) = gst::version();
if (major, minor) > (1, 12) { if (major, minor) > (1, 12) {

View file

@ -14,9 +14,8 @@ use glib::translate::*;
use gst; use gst;
impl PtpClock { impl PtpClock {
pub fn new<'a, P: Into<Option<&'a str>>>(name: P, domain: u32) -> PtpClock { pub fn new(name: Option<&str>, domain: u32) -> PtpClock {
assert_initialized_main_thread!(); assert_initialized_main_thread!();
let name = name.into();
let name = name.to_glib_none(); let name = name.to_glib_none();
let (major, minor, _, _) = gst::version(); let (major, minor, _, _) = gst::version();
if (major, minor) > (1, 12) { if (major, minor) > (1, 12) {

View file

@ -26,21 +26,21 @@ use auto::EncodingVideoProfile;
trait EncodingProfileBuilderCommon { trait EncodingProfileBuilderCommon {
fn set_allow_dynamic_output(&self, allow_dynamic_output: bool); fn set_allow_dynamic_output(&self, allow_dynamic_output: bool);
fn set_description<'a, P: Into<Option<&'a str>>>(&self, description: P); fn set_description(&self, description: Option<&str>);
fn set_enabled(&self, enabled: bool); fn set_enabled(&self, enabled: bool);
fn set_format(&self, format: &gst::Caps); fn set_format(&self, format: &gst::Caps);
fn set_name<'a, P: Into<Option<&'a str>>>(&self, name: P); fn set_name(&self, name: Option<&str>);
fn set_presence(&self, presence: u32); fn set_presence(&self, presence: u32);
fn set_preset<'a, P: Into<Option<&'a str>>>(&self, preset: P); fn set_preset(&self, preset: Option<&str>);
fn set_preset_name<'a, P: Into<Option<&'a str>>>(&self, preset_name: P); fn set_preset_name(&self, preset_name: Option<&str>);
fn set_restriction<'a, P: Into<Option<&'a gst::Caps>>>(&self, restriction: P); fn set_restriction(&self, restriction: Option<&gst::Caps>);
} }
impl<O: IsA<EncodingProfile>> EncodingProfileBuilderCommon for O { impl<O: IsA<EncodingProfile>> EncodingProfileBuilderCommon for O {
@ -53,8 +53,7 @@ impl<O: IsA<EncodingProfile>> EncodingProfileBuilderCommon for O {
} }
} }
fn set_description<'a, P: Into<Option<&'a str>>>(&self, description: P) { fn set_description(&self, description: Option<&str>) {
let description = description.into();
let description = description.to_glib_none(); let description = description.to_glib_none();
unsafe { unsafe {
gst_pbutils_sys::gst_encoding_profile_set_description( gst_pbutils_sys::gst_encoding_profile_set_description(
@ -82,8 +81,7 @@ impl<O: IsA<EncodingProfile>> EncodingProfileBuilderCommon for O {
} }
} }
fn set_name<'a, P: Into<Option<&'a str>>>(&self, name: P) { fn set_name(&self, name: Option<&str>) {
let name = name.into();
let name = name.to_glib_none(); let name = name.to_glib_none();
unsafe { unsafe {
gst_pbutils_sys::gst_encoding_profile_set_name(self.as_ref().to_glib_none().0, name.0); gst_pbutils_sys::gst_encoding_profile_set_name(self.as_ref().to_glib_none().0, name.0);
@ -99,8 +97,7 @@ impl<O: IsA<EncodingProfile>> EncodingProfileBuilderCommon for O {
} }
} }
fn set_preset<'a, P: Into<Option<&'a str>>>(&self, preset: P) { fn set_preset(&self, preset: Option<&str>) {
let preset = preset.into();
let preset = preset.to_glib_none(); let preset = preset.to_glib_none();
unsafe { unsafe {
gst_pbutils_sys::gst_encoding_profile_set_preset( gst_pbutils_sys::gst_encoding_profile_set_preset(
@ -110,8 +107,7 @@ impl<O: IsA<EncodingProfile>> EncodingProfileBuilderCommon for O {
} }
} }
fn set_preset_name<'a, P: Into<Option<&'a str>>>(&self, preset_name: P) { fn set_preset_name(&self, preset_name: Option<&str>) {
let preset_name = preset_name.into();
let preset_name = preset_name.to_glib_none(); let preset_name = preset_name.to_glib_none();
unsafe { unsafe {
gst_pbutils_sys::gst_encoding_profile_set_preset_name( gst_pbutils_sys::gst_encoding_profile_set_preset_name(
@ -121,8 +117,7 @@ impl<O: IsA<EncodingProfile>> EncodingProfileBuilderCommon for O {
} }
} }
fn set_restriction<'a, P: Into<Option<&'a gst::Caps>>>(&self, restriction: P) { fn set_restriction(&self, restriction: Option<&gst::Caps>) {
let restriction = restriction.into();
unsafe { unsafe {
let restriction = match restriction { let restriction = match restriction {
Some(restriction) => restriction.to_glib_full(), Some(restriction) => restriction.to_glib_full(),
@ -138,16 +133,14 @@ impl<O: IsA<EncodingProfile>> EncodingProfileBuilderCommon for O {
} }
impl EncodingAudioProfile { impl EncodingAudioProfile {
fn new<'a, 'b, P: Into<Option<&'a str>>, Q: Into<Option<&'b gst::Caps>>>( fn new(
format: &gst::Caps, format: &gst::Caps,
preset: P, preset: Option<&str>,
restriction: Q, restriction: Option<&gst::Caps>,
presence: u32, presence: u32,
) -> EncodingAudioProfile { ) -> EncodingAudioProfile {
assert_initialized_main_thread!(); assert_initialized_main_thread!();
let preset = preset.into();
let preset = preset.to_glib_none(); let preset = preset.to_glib_none();
let restriction = restriction.into();
let restriction = restriction.to_glib_none(); let restriction = restriction.to_glib_none();
unsafe { unsafe {
from_glib_full(gst_pbutils_sys::gst_encoding_audio_profile_new( from_glib_full(gst_pbutils_sys::gst_encoding_audio_profile_new(
@ -161,16 +154,14 @@ impl EncodingAudioProfile {
} }
impl EncodingVideoProfile { impl EncodingVideoProfile {
fn new<'a, 'b, P: Into<Option<&'a str>>, Q: Into<Option<&'b gst::Caps>>>( fn new(
format: &gst::Caps, format: &gst::Caps,
preset: P, preset: Option<&str>,
restriction: Q, restriction: Option<&gst::Caps>,
presence: u32, presence: u32,
) -> EncodingVideoProfile { ) -> EncodingVideoProfile {
assert_initialized_main_thread!(); assert_initialized_main_thread!();
let preset = preset.into();
let preset = preset.to_glib_none(); let preset = preset.to_glib_none();
let restriction = restriction.into();
let restriction = restriction.to_glib_none(); let restriction = restriction.to_glib_none();
unsafe { unsafe {
from_glib_full(gst_pbutils_sys::gst_encoding_video_profile_new( from_glib_full(gst_pbutils_sys::gst_encoding_video_profile_new(
@ -199,25 +190,15 @@ impl EncodingVideoProfile {
} }
impl EncodingContainerProfile { impl EncodingContainerProfile {
fn new< fn new(
'a, name: Option<&str>,
'b, description: Option<&str>,
'c,
P: Into<Option<&'a str>>,
Q: Into<Option<&'b str>>,
R: Into<Option<&'c str>>,
>(
name: P,
description: Q,
format: &gst::Caps, format: &gst::Caps,
preset: R, preset: Option<&str>,
) -> EncodingContainerProfile { ) -> EncodingContainerProfile {
assert_initialized_main_thread!(); assert_initialized_main_thread!();
let name = name.into();
let name = name.to_glib_none(); let name = name.to_glib_none();
let description = description.into();
let description = description.to_glib_none(); let description = description.to_glib_none();
let preset = preset.into();
let preset = preset.to_glib_none(); let preset = preset.to_glib_none();
unsafe { unsafe {
from_glib_full(gst_pbutils_sys::gst_encoding_container_profile_new( from_glib_full(gst_pbutils_sys::gst_encoding_container_profile_new(

View file

@ -12,11 +12,10 @@ use gst_player_sys;
use PlayerGMainContextSignalDispatcher; use PlayerGMainContextSignalDispatcher;
impl PlayerGMainContextSignalDispatcher { impl PlayerGMainContextSignalDispatcher {
pub fn new<'a, P: Into<Option<&'a glib::MainContext>>>( pub fn new(
application_context: P, application_context: Option<&glib::MainContext>,
) -> PlayerGMainContextSignalDispatcher { ) -> PlayerGMainContextSignalDispatcher {
assert_initialized_main_thread!(); assert_initialized_main_thread!();
let application_context = application_context.into();
let application_context = application_context.to_glib_none(); let application_context = application_context.to_glib_none();
unsafe { unsafe {
from_glib_full( from_glib_full(

View file

@ -12,7 +12,7 @@ use RTSPAuth;
use RTSPToken; use RTSPToken;
pub trait RTSPAuthExtManual: 'static { pub trait RTSPAuthExtManual: 'static {
fn set_default_token<'a, P: Into<Option<&'a mut RTSPToken>>>(&self, token: P); fn set_default_token(&self, token: Option<&mut RTSPToken>);
fn connect_accept_certificate< fn connect_accept_certificate<
F: Fn( F: Fn(
@ -31,8 +31,7 @@ pub trait RTSPAuthExtManual: 'static {
} }
impl<O: IsA<RTSPAuth>> RTSPAuthExtManual for O { impl<O: IsA<RTSPAuth>> RTSPAuthExtManual for O {
fn set_default_token<'a, P: Into<Option<&'a mut RTSPToken>>>(&self, token: P) { fn set_default_token(&self, mut token: Option<&mut RTSPToken>) {
let mut token = token.into();
unsafe { unsafe {
gst_rtsp_server_sys::gst_rtsp_auth_set_default_token( gst_rtsp_server_sys::gst_rtsp_auth_set_default_token(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,

View file

@ -6,12 +6,11 @@ use gst_rtsp_server_sys;
use RTSPClient; use RTSPClient;
pub trait RTSPClientExtManual: 'static { pub trait RTSPClientExtManual: 'static {
fn attach<'a, P: Into<Option<&'a glib::MainContext>>>(&self, context: P) -> SourceId; fn attach(&self, context: Option<&glib::MainContext>) -> SourceId;
} }
impl<O: IsA<RTSPClient>> RTSPClientExtManual for O { impl<O: IsA<RTSPClient>> RTSPClientExtManual for O {
fn attach<'a, P: Into<Option<&'a glib::MainContext>>>(&self, context: P) -> SourceId { fn attach(&self, context: Option<&glib::MainContext>) -> SourceId {
let context = context.into();
unsafe { unsafe {
from_glib(gst_rtsp_server_sys::gst_rtsp_client_attach( from_glib(gst_rtsp_server_sys::gst_rtsp_client_attach(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,

View file

@ -6,12 +6,11 @@ use gst_rtsp_server_sys;
use RTSPServer; use RTSPServer;
pub trait RTSPServerExtManual: 'static { pub trait RTSPServerExtManual: 'static {
fn attach<'a, P: Into<Option<&'a glib::MainContext>>>(&self, context: P) -> SourceId; fn attach(&self, context: Option<&glib::MainContext>) -> SourceId;
} }
impl<O: IsA<RTSPServer>> RTSPServerExtManual for O { impl<O: IsA<RTSPServer>> RTSPServerExtManual for O {
fn attach<'a, P: Into<Option<&'a glib::MainContext>>>(&self, context: P) -> SourceId { fn attach(&self, context: Option<&glib::MainContext>) -> SourceId {
let context = context.into();
unsafe { unsafe {
from_glib(gst_rtsp_server_sys::gst_rtsp_server_attach( from_glib(gst_rtsp_server_sys::gst_rtsp_server_attach(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,

View file

@ -32,23 +32,13 @@ fn into_raw_watch<F: FnMut(&RTSPSessionPool) -> Continue + Send + 'static>(func:
} }
pub trait RTSPSessionPoolExtManual: 'static { pub trait RTSPSessionPoolExtManual: 'static {
fn create_watch<'a, N: Into<Option<&'a str>>, F>( fn create_watch<F>(&self, name: Option<&str>, priority: Priority, func: F) -> glib::Source
&self,
name: N,
priority: Priority,
func: F,
) -> glib::Source
where where
F: FnMut(&RTSPSessionPool) -> Continue + Send + 'static; F: FnMut(&RTSPSessionPool) -> Continue + Send + 'static;
} }
impl<O: IsA<RTSPSessionPool>> RTSPSessionPoolExtManual for O { impl<O: IsA<RTSPSessionPool>> RTSPSessionPoolExtManual for O {
fn create_watch<'a, N: Into<Option<&'a str>>, F>( fn create_watch<F>(&self, name: Option<&str>, priority: Priority, func: F) -> glib::Source
&self,
name: N,
priority: Priority,
func: F,
) -> glib::Source
where where
F: FnMut(&RTSPSessionPool) -> Continue + Send + 'static, F: FnMut(&RTSPSessionPool) -> Continue + Send + 'static,
{ {
@ -65,7 +55,6 @@ impl<O: IsA<RTSPSessionPool>> RTSPSessionPoolExtManual for O {
); );
glib_sys::g_source_set_priority(source, priority.to_glib()); glib_sys::g_source_set_priority(source, priority.to_glib());
let name = name.into();
if let Some(name) = name { if let Some(name) = name {
glib_sys::g_source_set_name(source, name.to_glib_none().0); glib_sys::g_source_set_name(source, name.to_glib_none().0);
} }

View file

@ -130,8 +130,7 @@ unsafe impl Send for SDPMediaRef {}
unsafe impl Sync for SDPMediaRef {} unsafe impl Sync for SDPMediaRef {}
impl SDPMediaRef { impl SDPMediaRef {
pub fn add_attribute<'a, P: Into<Option<&'a str>>>(&mut self, key: &str, value: P) { pub fn add_attribute(&mut self, key: &str, value: Option<&str>) {
let value = value.into();
let value = value.to_glib_none(); let value = value.to_glib_none();
unsafe { unsafe {
gst_sdp_sys::gst_sdp_media_add_attribute(&mut self.0, key.to_glib_none().0, value.0) gst_sdp_sys::gst_sdp_media_add_attribute(&mut self.0, key.to_glib_none().0, value.0)

View file

@ -169,12 +169,12 @@ unsafe impl Send for SDPMessageRef {}
unsafe impl Sync for SDPMessageRef {} unsafe impl Sync for SDPMessageRef {}
impl SDPMessageRef { impl SDPMessageRef {
pub fn add_attribute<'a, P: Into<Option<&'a str>>>(&mut self, key: &str, value: P) { pub fn add_attribute(&mut self, key: &str, value: Option<&str>) {
unsafe { unsafe {
gst_sdp_sys::gst_sdp_message_add_attribute( gst_sdp_sys::gst_sdp_message_add_attribute(
&mut self.0, &mut self.0,
key.to_glib_none().0, key.to_glib_none().0,
value.into().to_glib_none().0, value.to_glib_none().0,
); );
} }
} }

View file

@ -83,15 +83,13 @@ impl BufferPoolConfig {
} }
} }
pub fn set_params<'a, T: Into<Option<&'a ::Caps>>>( pub fn set_params(
&mut self, &mut self,
caps: T, caps: Option<&::Caps>,
size: u32, size: u32,
min_buffers: u32, min_buffers: u32,
max_buffers: u32, max_buffers: u32,
) { ) {
let caps = caps.into();
unsafe { unsafe {
gst_sys::gst_buffer_pool_config_set_params( gst_sys::gst_buffer_pool_config_set_params(
self.0.to_glib_none_mut().0, self.0.to_glib_none_mut().0,
@ -125,15 +123,13 @@ impl BufferPoolConfig {
} }
} }
pub fn validate_params<'a, T: Into<Option<&'a ::Caps>>>( pub fn validate_params(
&self, &self,
caps: T, caps: Option<&::Caps>,
size: u32, size: u32,
min_buffers: u32, min_buffers: u32,
max_buffers: u32, max_buffers: u32,
) -> Result<(), glib::BoolError> { ) -> Result<(), glib::BoolError> {
let caps = caps.into();
unsafe { unsafe {
glib_result_from_gboolean!( glib_result_from_gboolean!(
gst_sys::gst_buffer_pool_config_validate_params( gst_sys::gst_buffer_pool_config_validate_params(
@ -256,9 +252,9 @@ pub trait BufferPoolExtManual: 'static {
fn is_flushing(&self) -> bool; fn is_flushing(&self) -> bool;
fn acquire_buffer<'a, P: Into<Option<&'a BufferPoolAcquireParams>>>( fn acquire_buffer(
&self, &self,
params: P, params: Option<&BufferPoolAcquireParams>,
) -> Result<::Buffer, ::FlowError>; ) -> Result<::Buffer, ::FlowError>;
fn release_buffer(&self, buffer: ::Buffer); fn release_buffer(&self, buffer: ::Buffer);
} }
@ -292,11 +288,11 @@ impl<O: IsA<BufferPool>> BufferPoolExtManual for O {
} }
} }
fn acquire_buffer<'a, P: Into<Option<&'a BufferPoolAcquireParams>>>( fn acquire_buffer(
&self, &self,
params: P, params: Option<&BufferPoolAcquireParams>,
) -> Result<::Buffer, ::FlowError> { ) -> Result<::Buffer, ::FlowError> {
let params_ptr = params.into().to_glib_none().0 as *mut _; let params_ptr = params.to_glib_none().0 as *mut _;
unsafe { unsafe {
let mut buffer = ptr::null_mut(); let mut buffer = ptr::null_mut();
@ -338,13 +334,13 @@ mod tests {
let params = ::BufferPoolAcquireParams::with_flags(::BufferPoolAcquireFlags::DONTWAIT); let params = ::BufferPoolAcquireParams::with_flags(::BufferPoolAcquireFlags::DONTWAIT);
let _buf1 = pool.acquire_buffer(&params).unwrap(); let _buf1 = pool.acquire_buffer(Some(&params)).unwrap();
let buf2 = pool.acquire_buffer(&params).unwrap(); let buf2 = pool.acquire_buffer(Some(&params)).unwrap();
assert!(pool.acquire_buffer(&params).is_err()); assert!(pool.acquire_buffer(Some(&params)).is_err());
drop(buf2); drop(buf2);
let _buf2 = pool.acquire_buffer(&params).unwrap(); let _buf2 = pool.acquire_buffer(Some(&params)).unwrap();
pool.set_active(false).unwrap(); pool.set_active(false).unwrap();
} }

View file

@ -81,12 +81,7 @@ impl Bus {
} }
} }
pub fn create_watch<'a, N: Into<Option<&'a str>>, F>( pub fn create_watch<F>(&self, name: Option<&str>, priority: Priority, func: F) -> glib::Source
&self,
name: N,
priority: Priority,
func: F,
) -> glib::Source
where where
F: FnMut(&Bus, &Message) -> Continue + Send + 'static, F: FnMut(&Bus, &Message) -> Continue + Send + 'static,
{ {
@ -101,7 +96,6 @@ impl Bus {
); );
glib_sys::g_source_set_priority(source, priority.to_glib()); glib_sys::g_source_set_priority(source, priority.to_glib());
let name = name.into();
if let Some(name) = name { if let Some(name) = name {
glib_sys::g_source_set_name(source, name.to_glib_none().0); glib_sys::g_source_set_name(source, name.to_glib_none().0);
} }

View file

@ -54,10 +54,10 @@ impl FromGlib<libc::c_uint> for DeviceMonitorFilterId {
} }
pub trait DeviceMonitorExtManual: 'static { pub trait DeviceMonitorExtManual: 'static {
fn add_filter<'a, 'b, P: Into<Option<&'a str>>, Q: Into<Option<&'b Caps>>>( fn add_filter(
&self, &self,
classes: P, classes: Option<&str>,
caps: Q, caps: Option<&Caps>,
) -> Option<DeviceMonitorFilterId>; ) -> Option<DeviceMonitorFilterId>;
fn remove_filter(&self, filter_id: DeviceMonitorFilterId) fn remove_filter(&self, filter_id: DeviceMonitorFilterId)
@ -65,13 +65,11 @@ pub trait DeviceMonitorExtManual: 'static {
} }
impl<O: IsA<DeviceMonitor>> DeviceMonitorExtManual for O { impl<O: IsA<DeviceMonitor>> DeviceMonitorExtManual for O {
fn add_filter<'a, 'b, P: Into<Option<&'a str>>, Q: Into<Option<&'b Caps>>>( fn add_filter(
&self, &self,
classes: P, classes: Option<&str>,
caps: Q, caps: Option<&Caps>,
) -> Option<DeviceMonitorFilterId> { ) -> Option<DeviceMonitorFilterId> {
let classes = classes.into();
let caps = caps.into();
let id = unsafe { let id = unsafe {
gst_sys::gst_device_monitor_add_filter( gst_sys::gst_device_monitor_add_filter(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,

View file

@ -170,16 +170,16 @@ pub trait ElementExtManual: 'static {
fn get_src_pads(&self) -> Vec<Pad>; fn get_src_pads(&self) -> Vec<Pad>;
#[cfg(any(feature = "v1_10", feature = "dox"))] #[cfg(any(feature = "v1_10", feature = "dox"))]
fn add_property_deep_notify_watch<'a, P: Into<Option<&'a str>>>( fn add_property_deep_notify_watch(
&self, &self,
property_name: P, property_name: Option<&str>,
include_value: bool, include_value: bool,
) -> NotifyWatchId; ) -> NotifyWatchId;
#[cfg(any(feature = "v1_10", feature = "dox"))] #[cfg(any(feature = "v1_10", feature = "dox"))]
fn add_property_notify_watch<'a, P: Into<Option<&'a str>>>( fn add_property_notify_watch(
&self, &self,
property_name: P, property_name: Option<&str>,
include_value: bool, include_value: bool,
) -> NotifyWatchId; ) -> NotifyWatchId;
@ -479,12 +479,11 @@ impl<O: IsA<Element>> ElementExtManual for O {
} }
#[cfg(any(feature = "v1_10", feature = "dox"))] #[cfg(any(feature = "v1_10", feature = "dox"))]
fn add_property_deep_notify_watch<'a, P: Into<Option<&'a str>>>( fn add_property_deep_notify_watch(
&self, &self,
property_name: P, property_name: Option<&str>,
include_value: bool, include_value: bool,
) -> NotifyWatchId { ) -> NotifyWatchId {
let property_name = property_name.into();
let property_name = property_name.to_glib_none(); let property_name = property_name.to_glib_none();
unsafe { unsafe {
from_glib(gst_sys::gst_element_add_property_deep_notify_watch( from_glib(gst_sys::gst_element_add_property_deep_notify_watch(
@ -496,12 +495,11 @@ impl<O: IsA<Element>> ElementExtManual for O {
} }
#[cfg(any(feature = "v1_10", feature = "dox"))] #[cfg(any(feature = "v1_10", feature = "dox"))]
fn add_property_notify_watch<'a, P: Into<Option<&'a str>>>( fn add_property_notify_watch(
&self, &self,
property_name: P, property_name: Option<&str>,
include_value: bool, include_value: bool,
) -> NotifyWatchId { ) -> NotifyWatchId {
let property_name = property_name.into();
let property_name = property_name.to_glib_none(); let property_name = property_name.to_glib_none();
unsafe { unsafe {
from_glib(gst_sys::gst_element_add_property_notify_watch( from_glib(gst_sys::gst_element_add_property_notify_watch(

View file

@ -62,24 +62,16 @@ pub struct ErrorMessage {
} }
impl ErrorMessage { impl ErrorMessage {
pub fn new< pub fn new<T: ::MessageErrorDomain>(
'a,
'b,
T: ::MessageErrorDomain,
U: Into<Option<&'a str>>,
V: Into<Option<&'b str>>,
>(
error: &T, error: &T,
message: U, message: Option<&str>,
debug: V, debug: Option<&str>,
filename: &'static str, filename: &'static str,
function: &'static str, function: &'static str,
line: u32, line: u32,
) -> ErrorMessage { ) -> ErrorMessage {
let error_domain = T::domain(); let error_domain = T::domain();
let error_code = error.code(); let error_code = error.code();
let message = message.into();
let debug = debug.into();
ErrorMessage { ErrorMessage {
error_domain, error_domain,

View file

@ -15,14 +15,13 @@ use Error;
use ParseContext; use ParseContext;
use ParseFlags; use ParseFlags;
pub fn parse_bin_from_description_full<'a, P: Into<Option<&'a mut ParseContext>>>( pub fn parse_bin_from_description_full(
bin_description: &str, bin_description: &str,
ghost_unlinked_pads: bool, ghost_unlinked_pads: bool,
context: P, mut context: Option<&mut ParseContext>,
flags: ParseFlags, flags: ParseFlags,
) -> Result<Element, Error> { ) -> Result<Element, Error> {
assert_initialized_main_thread!(); assert_initialized_main_thread!();
let mut context = context.into();
unsafe { unsafe {
let mut error = ptr::null_mut(); let mut error = ptr::null_mut();
let ret = gst_sys::gst_parse_bin_from_description_full( let ret = gst_sys::gst_parse_bin_from_description_full(
@ -40,13 +39,12 @@ pub fn parse_bin_from_description_full<'a, P: Into<Option<&'a mut ParseContext>>
} }
} }
pub fn parse_launch_full<'a, P: Into<Option<&'a mut ParseContext>>>( pub fn parse_launch_full(
pipeline_description: &str, pipeline_description: &str,
context: P, mut context: Option<&mut ParseContext>,
flags: ParseFlags, flags: ParseFlags,
) -> Result<Element, Error> { ) -> Result<Element, Error> {
assert_initialized_main_thread!(); assert_initialized_main_thread!();
let mut context = context.into();
unsafe { unsafe {
let mut error = ptr::null_mut(); let mut error = ptr::null_mut();
let ret = gst_sys::gst_parse_launch_full( let ret = gst_sys::gst_parse_launch_full(
@ -63,13 +61,12 @@ pub fn parse_launch_full<'a, P: Into<Option<&'a mut ParseContext>>>(
} }
} }
pub fn parse_launchv_full<'a, P: Into<Option<&'a mut ParseContext>>>( pub fn parse_launchv_full(
argv: &[&str], argv: &[&str],
context: P, mut context: Option<&mut ParseContext>,
flags: ParseFlags, flags: ParseFlags,
) -> Result<Element, Error> { ) -> Result<Element, Error> {
assert_initialized_main_thread!(); assert_initialized_main_thread!();
let mut context = context.into();
unsafe { unsafe {
let mut error = ptr::null_mut(); let mut error = ptr::null_mut();
let ret = gst_sys::gst_parse_launchv_full( let ret = gst_sys::gst_parse_launchv_full(

View file

@ -17,9 +17,8 @@ use PadMode;
use PadTemplate; use PadTemplate;
impl GhostPad { impl GhostPad {
pub fn new<'a, P: Into<Option<&'a str>>, Q: IsA<Pad>>(name: P, target: &Q) -> Option<GhostPad> { pub fn new<Q: IsA<Pad>>(name: Option<&str>, target: &Q) -> Option<GhostPad> {
skip_assert_initialized!(); skip_assert_initialized!();
let name = name.into();
let name = name.to_glib_none(); let name = name.to_glib_none();
unsafe { unsafe {
Option::<Pad>::from_glib_none(gst_sys::gst_ghost_pad_new( Option::<Pad>::from_glib_none(gst_sys::gst_ghost_pad_new(
@ -30,13 +29,12 @@ impl GhostPad {
} }
} }
pub fn new_from_template<'a, P: Into<Option<&'a str>>, Q: IsA<Pad>>( pub fn new_from_template<Q: IsA<Pad>>(
name: P, name: Option<&str>,
target: &Q, target: &Q,
templ: &PadTemplate, templ: &PadTemplate,
) -> Option<GhostPad> { ) -> Option<GhostPad> {
skip_assert_initialized!(); skip_assert_initialized!();
let name = name.into();
let name = name.to_glib_none(); let name = name.to_glib_none();
unsafe { unsafe {
Option::<Pad>::from_glib_none(gst_sys::gst_ghost_pad_new_from_template( Option::<Pad>::from_glib_none(gst_sys::gst_ghost_pad_new_from_template(
@ -48,19 +46,13 @@ impl GhostPad {
} }
} }
pub fn activate_mode_default< pub fn activate_mode_default<P: IsA<GhostPad>, Q: IsA<Object>>(
'a,
P: IsA<GhostPad>,
Q: IsA<Object> + 'a,
R: Into<Option<&'a Q>>,
>(
pad: &P, pad: &P,
parent: R, parent: Option<&Q>,
mode: PadMode, mode: PadMode,
active: bool, active: bool,
) -> Result<(), glib::BoolError> { ) -> Result<(), glib::BoolError> {
skip_assert_initialized!(); skip_assert_initialized!();
let parent = parent.into();
unsafe { unsafe {
glib_result_from_gboolean!( glib_result_from_gboolean!(
gst_sys::gst_ghost_pad_activate_mode_default( gst_sys::gst_ghost_pad_activate_mode_default(
@ -74,19 +66,13 @@ impl GhostPad {
} }
} }
pub fn internal_activate_mode_default< pub fn internal_activate_mode_default<P: IsA<GhostPad>, Q: IsA<Object>>(
'a,
P: IsA<GhostPad>,
Q: IsA<Object> + 'a,
R: Into<Option<&'a Q>>,
>(
pad: &P, pad: &P,
parent: R, parent: Option<&Q>,
mode: PadMode, mode: PadMode,
active: bool, active: bool,
) -> Result<(), glib::BoolError> { ) -> Result<(), glib::BoolError> {
skip_assert_initialized!(); skip_assert_initialized!();
let parent = parent.into();
unsafe { unsafe {
glib_result_from_gboolean!( glib_result_from_gboolean!(
gst_sys::gst_ghost_pad_internal_activate_mode_default( gst_sys::gst_ghost_pad_internal_activate_mode_default(

View file

@ -21,11 +21,7 @@ use glib::IsA;
pub struct DebugCategory(ptr::NonNull<gst_sys::GstDebugCategory>); pub struct DebugCategory(ptr::NonNull<gst_sys::GstDebugCategory>);
impl DebugCategory { impl DebugCategory {
pub fn new<'a, P: Into<Option<&'a str>>>( pub fn new(name: &str, color: ::DebugColorFlags, description: Option<&str>) -> DebugCategory {
name: &str,
color: ::DebugColorFlags,
description: P,
) -> DebugCategory {
extern "C" { extern "C" {
fn _gst_debug_category_new( fn _gst_debug_category_new(
name: *const c_char, name: *const c_char,
@ -33,7 +29,6 @@ impl DebugCategory {
description: *const c_char, description: *const c_char,
) -> *mut gst_sys::GstDebugCategory; ) -> *mut gst_sys::GstDebugCategory;
} }
let description = description.into();
// Gets the category if it exists already // Gets the category if it exists already
unsafe { unsafe {
@ -149,7 +144,7 @@ lazy_static! {
pub static ref CAT_RUST: DebugCategory = DebugCategory::new( pub static ref CAT_RUST: DebugCategory = DebugCategory::new(
"GST_RUST", "GST_RUST",
::DebugColorFlags::UNDERLINE, ::DebugColorFlags::UNDERLINE,
"GStreamer's Rust binding core", Some("GStreamer's Rust binding core"),
); );
} }
@ -307,7 +302,7 @@ mod tests {
let cat = DebugCategory::new( let cat = DebugCategory::new(
"test-cat", "test-cat",
::DebugColorFlags::empty(), ::DebugColorFlags::empty(),
"some debug category", Some("some debug category"),
); );
gst_error!(cat, "meh"); gst_error!(cat, "meh");

View file

@ -17,13 +17,9 @@ use gobject_sys;
use ObjectFlags; use ObjectFlags;
pub trait GstObjectExtManual: 'static { pub trait GstObjectExtManual: 'static {
fn connect_deep_notify< fn connect_deep_notify<F: Fn(&Self, &::Object, &glib::ParamSpec) + Send + Sync + 'static>(
'a,
P: Into<Option<&'a str>>,
F: Fn(&Self, &::Object, &glib::ParamSpec) + Send + Sync + 'static,
>(
&self, &self,
name: P, name: Option<&str>,
f: F, f: F,
) -> SignalHandlerId; ) -> SignalHandlerId;
@ -35,16 +31,11 @@ pub trait GstObjectExtManual: 'static {
} }
impl<O: IsA<::Object>> GstObjectExtManual for O { impl<O: IsA<::Object>> GstObjectExtManual for O {
fn connect_deep_notify< fn connect_deep_notify<F: Fn(&Self, &::Object, &glib::ParamSpec) + Send + Sync + 'static>(
'a,
P: Into<Option<&'a str>>,
F: Fn(&Self, &::Object, &glib::ParamSpec) + Send + Sync + 'static,
>(
&self, &self,
name: P, name: Option<&str>,
f: F, f: F,
) -> SignalHandlerId { ) -> SignalHandlerId {
let name = name.into();
let signal_name = if let Some(name) = name { let signal_name = if let Some(name) = name {
format!("deep-notify::{}", name) format!("deep-notify::{}", name)
} else { } else {

View file

@ -49,12 +49,8 @@ use libc;
use gst_sys; use gst_sys;
impl Pad { impl Pad {
pub fn new_from_static_template<'a, P: Into<Option<&'a str>>>( pub fn new_from_static_template(templ: &StaticPadTemplate, name: Option<&str>) -> Pad {
templ: &StaticPadTemplate,
name: P,
) -> Pad {
assert_initialized_main_thread!(); assert_initialized_main_thread!();
let name = name.into();
unsafe { unsafe {
from_glib_none(gst_sys::gst_pad_new_from_static_template( from_glib_none(gst_sys::gst_pad_new_from_static_template(
mut_override(templ.to_glib_none().0), mut_override(templ.to_glib_none().0),
@ -131,28 +127,20 @@ pub trait PadExtManual: 'static {
fn peer_query(&self, query: &mut QueryRef) -> bool; fn peer_query(&self, query: &mut QueryRef) -> bool;
fn query(&self, query: &mut QueryRef) -> bool; fn query(&self, query: &mut QueryRef) -> bool;
fn query_default<'a, P: IsA<::Object> + 'a, Q: Into<Option<&'a P>>>( fn query_default<P: IsA<::Object>>(&self, parent: Option<&P>, query: &mut QueryRef) -> bool;
&self,
parent: Q,
query: &mut QueryRef,
) -> bool;
fn proxy_query_caps(&self, query: &mut QueryRef) -> bool; fn proxy_query_caps(&self, query: &mut QueryRef) -> bool;
fn proxy_query_accept_caps(&self, query: &mut QueryRef) -> bool; fn proxy_query_accept_caps(&self, query: &mut QueryRef) -> bool;
fn event_default<'a, P: IsA<::Object> + 'a, Q: Into<Option<&'a P>>>( fn event_default<P: IsA<::Object>>(&self, parent: Option<&P>, event: Event) -> bool;
&self,
parent: Q,
event: Event,
) -> bool;
fn push_event(&self, event: Event) -> bool; fn push_event(&self, event: Event) -> bool;
fn send_event(&self, event: Event) -> bool; fn send_event(&self, event: Event) -> bool;
fn get_last_flow_return(&self) -> Result<FlowSuccess, FlowError>; fn get_last_flow_return(&self) -> Result<FlowSuccess, FlowError>;
fn iterate_internal_links(&self) -> ::Iterator<Pad>; fn iterate_internal_links(&self) -> ::Iterator<Pad>;
fn iterate_internal_links_default<'a, P: IsA<::Object> + 'a, Q: Into<Option<&'a P>>>( fn iterate_internal_links_default<P: IsA<::Object>>(
&self, &self,
parent: Q, parent: Option<&P>,
) -> ::Iterator<Pad>; ) -> ::Iterator<Pad>;
fn link<P: IsA<Pad>>(&self, sinkpad: &P) -> Result<PadLinkSuccess, PadLinkError>; fn link<P: IsA<Pad>>(&self, sinkpad: &P) -> Result<PadLinkSuccess, PadLinkError>;
@ -389,13 +377,8 @@ impl<O: IsA<Pad>> PadExtManual for O {
} }
} }
fn query_default<'a, P: IsA<::Object> + 'a, Q: Into<Option<&'a P>>>( fn query_default<P: IsA<::Object>>(&self, parent: Option<&P>, query: &mut QueryRef) -> bool {
&self,
parent: Q,
query: &mut QueryRef,
) -> bool {
skip_assert_initialized!(); skip_assert_initialized!();
let parent = parent.into();
unsafe { unsafe {
from_glib(gst_sys::gst_pad_query_default( from_glib(gst_sys::gst_pad_query_default(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
@ -423,13 +406,8 @@ impl<O: IsA<Pad>> PadExtManual for O {
} }
} }
fn event_default<'a, P: IsA<::Object> + 'a, Q: Into<Option<&'a P>>>( fn event_default<P: IsA<::Object>>(&self, parent: Option<&P>, event: Event) -> bool {
&self,
parent: Q,
event: Event,
) -> bool {
skip_assert_initialized!(); skip_assert_initialized!();
let parent = parent.into();
unsafe { unsafe {
from_glib(gst_sys::gst_pad_event_default( from_glib(gst_sys::gst_pad_event_default(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
@ -474,11 +452,10 @@ impl<O: IsA<Pad>> PadExtManual for O {
} }
} }
fn iterate_internal_links_default<'a, P: IsA<::Object> + 'a, Q: Into<Option<&'a P>>>( fn iterate_internal_links_default<P: IsA<::Object>>(
&self, &self,
parent: Q, parent: Option<&P>,
) -> ::Iterator<Pad> { ) -> ::Iterator<Pad> {
let parent = parent.into();
unsafe { unsafe {
from_glib_full(gst_sys::gst_pad_iterate_internal_links_default( from_glib_full(gst_sys::gst_pad_iterate_internal_links_default(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,

View file

@ -22,13 +22,12 @@ use glib::translate::{from_glib, from_glib_full, ToGlibPtr};
use gst_sys; use gst_sys;
impl ProxyPad { impl ProxyPad {
pub fn chain_default<'a, P: IsA<ProxyPad>, Q: IsA<Object> + 'a, R: Into<Option<&'a Q>>>( pub fn chain_default<P: IsA<ProxyPad>, Q: IsA<Object>>(
pad: &P, pad: &P,
parent: R, parent: Option<&Q>,
buffer: Buffer, buffer: Buffer,
) -> Result<FlowSuccess, FlowError> { ) -> Result<FlowSuccess, FlowError> {
skip_assert_initialized!(); skip_assert_initialized!();
let parent = parent.into();
let ret: FlowReturn = unsafe { let ret: FlowReturn = unsafe {
from_glib(gst_sys::gst_proxy_pad_chain_default( from_glib(gst_sys::gst_proxy_pad_chain_default(
pad.as_ptr() as *mut gst_sys::GstPad, pad.as_ptr() as *mut gst_sys::GstPad,
@ -39,13 +38,12 @@ impl ProxyPad {
ret.into_result() ret.into_result()
} }
pub fn chain_list_default<'a, P: IsA<ProxyPad>, Q: IsA<Object> + 'a, R: Into<Option<&'a Q>>>( pub fn chain_list_default<P: IsA<ProxyPad>, Q: IsA<Object>>(
pad: &P, pad: &P,
parent: R, parent: Option<&Q>,
list: BufferList, list: BufferList,
) -> Result<FlowSuccess, FlowError> { ) -> Result<FlowSuccess, FlowError> {
skip_assert_initialized!(); skip_assert_initialized!();
let parent = parent.into();
let ret: FlowReturn = unsafe { let ret: FlowReturn = unsafe {
from_glib(gst_sys::gst_proxy_pad_chain_list_default( from_glib(gst_sys::gst_proxy_pad_chain_list_default(
pad.as_ptr() as *mut gst_sys::GstPad, pad.as_ptr() as *mut gst_sys::GstPad,
@ -76,17 +74,11 @@ impl ProxyPad {
} }
} }
pub fn iterate_internal_links_default< pub fn iterate_internal_links_default<P: IsA<ProxyPad>, Q: IsA<Object>>(
'a,
P: IsA<ProxyPad>,
Q: IsA<Object> + 'a,
R: Into<Option<&'a Q>>,
>(
pad: &P, pad: &P,
parent: R, parent: Option<&Q>,
) -> Option<::Iterator<Pad>> { ) -> Option<::Iterator<Pad>> {
skip_assert_initialized!(); skip_assert_initialized!();
let parent = parent.into();
unsafe { unsafe {
from_glib_full(gst_sys::gst_proxy_pad_iterate_internal_links_default( from_glib_full(gst_sys::gst_proxy_pad_iterate_internal_links_default(
pad.as_ptr() as *mut gst_sys::GstPad, pad.as_ptr() as *mut gst_sys::GstPad,

View file

@ -135,9 +135,8 @@ impl Query {
} }
} }
pub fn new_caps<'a, P: Into<Option<&'a ::Caps>>>(filter: P) -> Caps<Self> { pub fn new_caps(filter: Option<&::Caps>) -> Caps<Self> {
assert_initialized_main_thread!(); assert_initialized_main_thread!();
let filter = filter.into();
unsafe { unsafe {
Caps::<Self>(from_glib_full(gst_sys::gst_query_new_caps( Caps::<Self>(from_glib_full(gst_sys::gst_query_new_caps(
filter.to_glib_none().0, filter.to_glib_none().0,

View file

@ -15,16 +15,14 @@ use StreamType;
impl Stream { impl Stream {
#[cfg(any(feature = "v1_10", feature = "dox"))] #[cfg(any(feature = "v1_10", feature = "dox"))]
pub fn new<'a, 'b, P: Into<Option<&'a str>>, Q: Into<Option<&'b Caps>>>( pub fn new(
stream_id: P, stream_id: Option<&str>,
caps: Q, caps: Option<&Caps>,
type_: StreamType, type_: StreamType,
flags: StreamFlags, flags: StreamFlags,
) -> Stream { ) -> Stream {
assert_initialized_main_thread!(); assert_initialized_main_thread!();
let stream_id = stream_id.into();
let stream_id = stream_id.to_glib_none(); let stream_id = stream_id.to_glib_none();
let caps = caps.into();
let caps = caps.to_glib_none(); let caps = caps.to_glib_none();
let (major, minor, _, _) = ::version(); let (major, minor, _, _) = ::version();

View file

@ -69,9 +69,8 @@ impl<'a> DoubleEndedIterator for Iter<'a> {
impl<'a> ExactSizeIterator for Iter<'a> {} impl<'a> ExactSizeIterator for Iter<'a> {}
impl StreamCollection { impl StreamCollection {
pub fn new<'a, P: Into<Option<&'a str>>>(upstream_id: P) -> StreamCollection { pub fn new(upstream_id: Option<&str>) -> StreamCollection {
assert_initialized_main_thread!(); assert_initialized_main_thread!();
let upstream_id = upstream_id.into();
let upstream_id = upstream_id.to_glib_none(); let upstream_id = upstream_id.to_glib_none();
let (major, minor, _, _) = ::version(); let (major, minor, _, _) = ::version();
if (major, minor) > (1, 12) { if (major, minor) > (1, 12) {

View file

@ -32,28 +32,17 @@ pub trait TypeFindImpl {
} }
impl<'a> TypeFind<'a> { impl<'a> TypeFind<'a> {
pub fn register< pub fn register<F>(
'b, plugin: Option<&Plugin>,
'c,
'd,
P: Into<Option<&'b Plugin>>,
R: Into<Option<&'c str>>,
S: Into<Option<&'d Caps>>,
F,
>(
plugin: P,
name: &str, name: &str,
rank: u32, rank: u32,
extensions: R, extensions: Option<&str>,
possible_caps: S, possible_caps: Option<&Caps>,
func: F, func: F,
) -> Result<(), glib::error::BoolError> ) -> Result<(), glib::error::BoolError>
where where
F: Fn(&mut TypeFind) + Send + Sync + 'static, F: Fn(&mut TypeFind) + Send + Sync + 'static,
{ {
let plugin = plugin.into();
let extensions = extensions.into();
let possible_caps = possible_caps.into();
unsafe { unsafe {
let func: Box<F> = Box::new(func); let func: Box<F> = Box::new(func);
let func = Box::into_raw(func); let func = Box::into_raw(func);
@ -278,7 +267,7 @@ mod tests {
"test_typefind", "test_typefind",
::Rank::Primary.to_glib() as u32, ::Rank::Primary.to_glib() as u32,
None, None,
&Caps::new_simple("test/test", &[]), Some(&Caps::new_simple("test/test", &[])),
|typefind| { |typefind| {
let mut found = false; let mut found = false;
if let Some(data) = typefind.peek(0, 8) { if let Some(data) = typefind.peek(0, 8) {