mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-25 19:11:06 +00:00
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:
parent
6cef32a4dd
commit
86e969d964
31 changed files with 143 additions and 336 deletions
|
@ -45,9 +45,9 @@ struct ErrorMessage {
|
|||
cause: glib::Error,
|
||||
}
|
||||
|
||||
fn make_element<'a, P: Into<Option<&'a str>>>(
|
||||
fn make_element(
|
||||
factory_name: &'static str,
|
||||
element_name: P,
|
||||
element_name: Option<&str>,
|
||||
) -> Result<gst::Element, Error> {
|
||||
match gst::ElementFactory::make(factory_name, element_name.into()) {
|
||||
Some(elem) => Ok(elem),
|
||||
|
|
|
@ -42,9 +42,9 @@ struct ErrorMessage {
|
|||
cause: glib::Error,
|
||||
}
|
||||
|
||||
fn make_element<'a, P: Into<Option<&'a str>>>(
|
||||
fn make_element(
|
||||
factory_name: &'static str,
|
||||
element_name: P,
|
||||
element_name: Option<&str>,
|
||||
) -> Result<gst::Element, Error> {
|
||||
match gst::ElementFactory::make(factory_name, element_name.into()) {
|
||||
Some(elem) => Ok(elem),
|
||||
|
|
|
@ -12,17 +12,11 @@ use gst;
|
|||
use gst_base_sys;
|
||||
use std::mem;
|
||||
|
||||
pub fn type_find_helper_for_data<
|
||||
'a,
|
||||
P: IsA<gst::Object> + 'a,
|
||||
Q: Into<Option<&'a P>>,
|
||||
R: AsRef<[u8]>,
|
||||
>(
|
||||
obj: Q,
|
||||
pub fn type_find_helper_for_data<P: IsA<gst::Object>, R: AsRef<[u8]>>(
|
||||
obj: Option<&P>,
|
||||
data: R,
|
||||
) -> (Option<gst::Caps>, gst::TypeFindProbability) {
|
||||
assert_initialized_main_thread!();
|
||||
let obj = obj.into();
|
||||
unsafe {
|
||||
let mut prob = mem::uninitialized();
|
||||
let data = data.as_ref();
|
||||
|
|
|
@ -38,29 +38,15 @@ impl Drop for Harness {
|
|||
unsafe impl Send for Harness {}
|
||||
|
||||
impl Harness {
|
||||
pub fn add_element_full<
|
||||
'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>>,
|
||||
>(
|
||||
pub fn add_element_full<P: IsA<gst::Element>>(
|
||||
&mut self,
|
||||
element: &P,
|
||||
hsrc: Q,
|
||||
element_sinkpad_name: R,
|
||||
hsink: S,
|
||||
element_srcpad_name: T,
|
||||
hsrc: Option<&gst::StaticPadTemplate>,
|
||||
element_sinkpad_name: Option<&str>,
|
||||
hsink: Option<&gst::StaticPadTemplate>,
|
||||
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 hsink = hsink.into();
|
||||
let element_srcpad_name = element_srcpad_name.into();
|
||||
let element_srcpad_name = element_srcpad_name.to_glib_none();
|
||||
unsafe {
|
||||
gst_check_sys::gst_harness_add_element_full(
|
||||
|
@ -115,10 +101,10 @@ impl Harness {
|
|||
}
|
||||
|
||||
#[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,
|
||||
api: glib::types::Type,
|
||||
params: P,
|
||||
params: Option<&gst::StructureRef>,
|
||||
) {
|
||||
let params = params.into();
|
||||
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() }
|
||||
//}
|
||||
|
||||
|
@ -589,29 +575,15 @@ impl Harness {
|
|||
unsafe { Self::from_glib_full(gst_check_sys::gst_harness_new_empty()) }
|
||||
}
|
||||
|
||||
pub fn new_full<
|
||||
'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>>,
|
||||
>(
|
||||
pub fn new_full<P: IsA<gst::Element>>(
|
||||
element: &P,
|
||||
hsrc: Q,
|
||||
element_sinkpad_name: R,
|
||||
hsink: S,
|
||||
element_srcpad_name: T,
|
||||
hsrc: Option<&gst::StaticPadTemplate>,
|
||||
element_sinkpad_name: Option<&str>,
|
||||
hsink: Option<&gst::StaticPadTemplate>,
|
||||
element_srcpad_name: Option<&str>,
|
||||
) -> Harness {
|
||||
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 hsink = hsink.into();
|
||||
let element_srcpad_name = element_srcpad_name.into();
|
||||
let element_srcpad_name = element_srcpad_name.to_glib_none();
|
||||
unsafe {
|
||||
Self::from_glib_full(gst_check_sys::gst_harness_new_full(
|
||||
|
@ -633,21 +605,13 @@ impl Harness {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn new_with_element<
|
||||
'a,
|
||||
'b,
|
||||
P: IsA<gst::Element>,
|
||||
Q: Into<Option<&'a str>>,
|
||||
R: Into<Option<&'b str>>,
|
||||
>(
|
||||
pub fn new_with_element<P: IsA<gst::Element>>(
|
||||
element: &P,
|
||||
element_sinkpad_name: Q,
|
||||
element_srcpad_name: R,
|
||||
element_sinkpad_name: Option<&str>,
|
||||
element_srcpad_name: Option<&str>,
|
||||
) -> Harness {
|
||||
assert_initialized_main_thread!();
|
||||
let element_sinkpad_name = element_sinkpad_name.into();
|
||||
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();
|
||||
unsafe {
|
||||
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_sinkpad_name: P,
|
||||
element_srcpad_name: Q,
|
||||
element_sinkpad_name: Option<&str>,
|
||||
element_srcpad_name: Option<&str>,
|
||||
) -> Harness {
|
||||
assert_initialized_main_thread!();
|
||||
let element_sinkpad_name = element_sinkpad_name.into();
|
||||
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();
|
||||
unsafe {
|
||||
Self::from_glib_full(gst_check_sys::gst_harness_new_with_padnames(
|
||||
|
@ -677,19 +639,12 @@ impl Harness {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn new_with_templates<
|
||||
'a,
|
||||
'b,
|
||||
P: Into<Option<&'a gst::StaticPadTemplate>>,
|
||||
Q: Into<Option<&'b gst::StaticPadTemplate>>,
|
||||
>(
|
||||
pub fn new_with_templates(
|
||||
element_name: &str,
|
||||
hsrc: P,
|
||||
hsink: Q,
|
||||
hsrc: Option<&gst::StaticPadTemplate>,
|
||||
hsink: Option<&gst::StaticPadTemplate>,
|
||||
) -> Harness {
|
||||
assert_initialized_main_thread!();
|
||||
let hsrc = hsrc.into();
|
||||
let hsink = hsink.into();
|
||||
unsafe {
|
||||
Self::from_glib_full(gst_check_sys::gst_harness_new_with_templates(
|
||||
element_name.to_glib_none().0,
|
||||
|
|
|
@ -14,14 +14,13 @@ use glib::translate::*;
|
|||
use gst;
|
||||
|
||||
impl NetClientClock {
|
||||
pub fn new<'a, P: Into<Option<&'a str>>>(
|
||||
name: P,
|
||||
pub fn new(
|
||||
name: Option<&str>,
|
||||
remote_address: &str,
|
||||
remote_port: i32,
|
||||
base_time: gst::ClockTime,
|
||||
) -> NetClientClock {
|
||||
assert_initialized_main_thread!();
|
||||
let name = name.into();
|
||||
let name = name.to_glib_none();
|
||||
let (major, minor, _, _) = gst::version();
|
||||
if (major, minor) > (1, 12) {
|
||||
|
|
|
@ -14,13 +14,8 @@ use glib::IsA;
|
|||
use gst;
|
||||
|
||||
impl NetTimeProvider {
|
||||
pub fn new<'a, P: IsA<gst::Clock>, Q: Into<Option<&'a str>>>(
|
||||
clock: &P,
|
||||
address: Q,
|
||||
port: i32,
|
||||
) -> NetTimeProvider {
|
||||
pub fn new<P: IsA<gst::Clock>>(clock: &P, address: Option<&str>, port: i32) -> NetTimeProvider {
|
||||
assert_initialized_main_thread!();
|
||||
let address = address.into();
|
||||
let address = address.to_glib_none();
|
||||
|
||||
let (major, minor, _, _) = gst::version();
|
||||
|
|
|
@ -14,14 +14,13 @@ use glib::translate::*;
|
|||
use gst;
|
||||
|
||||
impl NtpClock {
|
||||
pub fn new<'a, P: Into<Option<&'a str>>>(
|
||||
name: P,
|
||||
pub fn new(
|
||||
name: Option<&str>,
|
||||
remote_address: &str,
|
||||
remote_port: i32,
|
||||
base_time: gst::ClockTime,
|
||||
) -> NtpClock {
|
||||
assert_initialized_main_thread!();
|
||||
let name = name.into();
|
||||
let name = name.to_glib_none();
|
||||
let (major, minor, _, _) = gst::version();
|
||||
if (major, minor) > (1, 12) {
|
||||
|
|
|
@ -14,9 +14,8 @@ use glib::translate::*;
|
|||
use gst;
|
||||
|
||||
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!();
|
||||
let name = name.into();
|
||||
let name = name.to_glib_none();
|
||||
let (major, minor, _, _) = gst::version();
|
||||
if (major, minor) > (1, 12) {
|
||||
|
|
|
@ -26,21 +26,21 @@ use auto::EncodingVideoProfile;
|
|||
trait EncodingProfileBuilderCommon {
|
||||
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_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_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 {
|
||||
|
@ -53,8 +53,7 @@ impl<O: IsA<EncodingProfile>> EncodingProfileBuilderCommon for O {
|
|||
}
|
||||
}
|
||||
|
||||
fn set_description<'a, P: Into<Option<&'a str>>>(&self, description: P) {
|
||||
let description = description.into();
|
||||
fn set_description(&self, description: Option<&str>) {
|
||||
let description = description.to_glib_none();
|
||||
unsafe {
|
||||
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) {
|
||||
let name = name.into();
|
||||
fn set_name(&self, name: Option<&str>) {
|
||||
let name = name.to_glib_none();
|
||||
unsafe {
|
||||
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) {
|
||||
let preset = preset.into();
|
||||
fn set_preset(&self, preset: Option<&str>) {
|
||||
let preset = preset.to_glib_none();
|
||||
unsafe {
|
||||
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) {
|
||||
let preset_name = preset_name.into();
|
||||
fn set_preset_name(&self, preset_name: Option<&str>) {
|
||||
let preset_name = preset_name.to_glib_none();
|
||||
unsafe {
|
||||
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) {
|
||||
let restriction = restriction.into();
|
||||
fn set_restriction(&self, restriction: Option<&gst::Caps>) {
|
||||
unsafe {
|
||||
let restriction = match restriction {
|
||||
Some(restriction) => restriction.to_glib_full(),
|
||||
|
@ -138,16 +133,14 @@ impl<O: IsA<EncodingProfile>> EncodingProfileBuilderCommon for O {
|
|||
}
|
||||
|
||||
impl EncodingAudioProfile {
|
||||
fn new<'a, 'b, P: Into<Option<&'a str>>, Q: Into<Option<&'b gst::Caps>>>(
|
||||
fn new(
|
||||
format: &gst::Caps,
|
||||
preset: P,
|
||||
restriction: Q,
|
||||
preset: Option<&str>,
|
||||
restriction: Option<&gst::Caps>,
|
||||
presence: u32,
|
||||
) -> EncodingAudioProfile {
|
||||
assert_initialized_main_thread!();
|
||||
let preset = preset.into();
|
||||
let preset = preset.to_glib_none();
|
||||
let restriction = restriction.into();
|
||||
let restriction = restriction.to_glib_none();
|
||||
unsafe {
|
||||
from_glib_full(gst_pbutils_sys::gst_encoding_audio_profile_new(
|
||||
|
@ -161,16 +154,14 @@ impl EncodingAudioProfile {
|
|||
}
|
||||
|
||||
impl EncodingVideoProfile {
|
||||
fn new<'a, 'b, P: Into<Option<&'a str>>, Q: Into<Option<&'b gst::Caps>>>(
|
||||
fn new(
|
||||
format: &gst::Caps,
|
||||
preset: P,
|
||||
restriction: Q,
|
||||
preset: Option<&str>,
|
||||
restriction: Option<&gst::Caps>,
|
||||
presence: u32,
|
||||
) -> EncodingVideoProfile {
|
||||
assert_initialized_main_thread!();
|
||||
let preset = preset.into();
|
||||
let preset = preset.to_glib_none();
|
||||
let restriction = restriction.into();
|
||||
let restriction = restriction.to_glib_none();
|
||||
unsafe {
|
||||
from_glib_full(gst_pbutils_sys::gst_encoding_video_profile_new(
|
||||
|
@ -199,25 +190,15 @@ impl EncodingVideoProfile {
|
|||
}
|
||||
|
||||
impl EncodingContainerProfile {
|
||||
fn new<
|
||||
'a,
|
||||
'b,
|
||||
'c,
|
||||
P: Into<Option<&'a str>>,
|
||||
Q: Into<Option<&'b str>>,
|
||||
R: Into<Option<&'c str>>,
|
||||
>(
|
||||
name: P,
|
||||
description: Q,
|
||||
fn new(
|
||||
name: Option<&str>,
|
||||
description: Option<&str>,
|
||||
format: &gst::Caps,
|
||||
preset: R,
|
||||
preset: Option<&str>,
|
||||
) -> EncodingContainerProfile {
|
||||
assert_initialized_main_thread!();
|
||||
let name = name.into();
|
||||
let name = name.to_glib_none();
|
||||
let description = description.into();
|
||||
let description = description.to_glib_none();
|
||||
let preset = preset.into();
|
||||
let preset = preset.to_glib_none();
|
||||
unsafe {
|
||||
from_glib_full(gst_pbutils_sys::gst_encoding_container_profile_new(
|
||||
|
|
|
@ -12,11 +12,10 @@ use gst_player_sys;
|
|||
use PlayerGMainContextSignalDispatcher;
|
||||
|
||||
impl PlayerGMainContextSignalDispatcher {
|
||||
pub fn new<'a, P: Into<Option<&'a glib::MainContext>>>(
|
||||
application_context: P,
|
||||
pub fn new(
|
||||
application_context: Option<&glib::MainContext>,
|
||||
) -> PlayerGMainContextSignalDispatcher {
|
||||
assert_initialized_main_thread!();
|
||||
let application_context = application_context.into();
|
||||
let application_context = application_context.to_glib_none();
|
||||
unsafe {
|
||||
from_glib_full(
|
||||
|
|
|
@ -12,7 +12,7 @@ use RTSPAuth;
|
|||
use RTSPToken;
|
||||
|
||||
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<
|
||||
F: Fn(
|
||||
|
@ -31,8 +31,7 @@ pub trait RTSPAuthExtManual: 'static {
|
|||
}
|
||||
|
||||
impl<O: IsA<RTSPAuth>> RTSPAuthExtManual for O {
|
||||
fn set_default_token<'a, P: Into<Option<&'a mut RTSPToken>>>(&self, token: P) {
|
||||
let mut token = token.into();
|
||||
fn set_default_token(&self, mut token: Option<&mut RTSPToken>) {
|
||||
unsafe {
|
||||
gst_rtsp_server_sys::gst_rtsp_auth_set_default_token(
|
||||
self.as_ref().to_glib_none().0,
|
||||
|
|
|
@ -6,12 +6,11 @@ use gst_rtsp_server_sys;
|
|||
use RTSPClient;
|
||||
|
||||
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 {
|
||||
fn attach<'a, P: Into<Option<&'a glib::MainContext>>>(&self, context: P) -> SourceId {
|
||||
let context = context.into();
|
||||
fn attach(&self, context: Option<&glib::MainContext>) -> SourceId {
|
||||
unsafe {
|
||||
from_glib(gst_rtsp_server_sys::gst_rtsp_client_attach(
|
||||
self.as_ref().to_glib_none().0,
|
||||
|
|
|
@ -6,12 +6,11 @@ use gst_rtsp_server_sys;
|
|||
use RTSPServer;
|
||||
|
||||
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 {
|
||||
fn attach<'a, P: Into<Option<&'a glib::MainContext>>>(&self, context: P) -> SourceId {
|
||||
let context = context.into();
|
||||
fn attach(&self, context: Option<&glib::MainContext>) -> SourceId {
|
||||
unsafe {
|
||||
from_glib(gst_rtsp_server_sys::gst_rtsp_server_attach(
|
||||
self.as_ref().to_glib_none().0,
|
||||
|
|
|
@ -32,23 +32,13 @@ fn into_raw_watch<F: FnMut(&RTSPSessionPool) -> Continue + Send + 'static>(func:
|
|||
}
|
||||
|
||||
pub trait RTSPSessionPoolExtManual: 'static {
|
||||
fn create_watch<'a, N: Into<Option<&'a str>>, F>(
|
||||
&self,
|
||||
name: N,
|
||||
priority: Priority,
|
||||
func: F,
|
||||
) -> glib::Source
|
||||
fn create_watch<F>(&self, name: Option<&str>, priority: Priority, func: F) -> glib::Source
|
||||
where
|
||||
F: FnMut(&RTSPSessionPool) -> Continue + Send + 'static;
|
||||
}
|
||||
|
||||
impl<O: IsA<RTSPSessionPool>> RTSPSessionPoolExtManual for O {
|
||||
fn create_watch<'a, N: Into<Option<&'a str>>, F>(
|
||||
&self,
|
||||
name: N,
|
||||
priority: Priority,
|
||||
func: F,
|
||||
) -> glib::Source
|
||||
fn create_watch<F>(&self, name: Option<&str>, priority: Priority, func: F) -> glib::Source
|
||||
where
|
||||
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());
|
||||
|
||||
let name = name.into();
|
||||
if let Some(name) = name {
|
||||
glib_sys::g_source_set_name(source, name.to_glib_none().0);
|
||||
}
|
||||
|
|
|
@ -130,8 +130,7 @@ unsafe impl Send for SDPMediaRef {}
|
|||
unsafe impl Sync for SDPMediaRef {}
|
||||
|
||||
impl SDPMediaRef {
|
||||
pub fn add_attribute<'a, P: Into<Option<&'a str>>>(&mut self, key: &str, value: P) {
|
||||
let value = value.into();
|
||||
pub fn add_attribute(&mut self, key: &str, value: Option<&str>) {
|
||||
let value = value.to_glib_none();
|
||||
unsafe {
|
||||
gst_sdp_sys::gst_sdp_media_add_attribute(&mut self.0, key.to_glib_none().0, value.0)
|
||||
|
|
|
@ -169,12 +169,12 @@ unsafe impl Send for SDPMessageRef {}
|
|||
unsafe impl Sync for 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 {
|
||||
gst_sdp_sys::gst_sdp_message_add_attribute(
|
||||
&mut self.0,
|
||||
key.to_glib_none().0,
|
||||
value.into().to_glib_none().0,
|
||||
value.to_glib_none().0,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -83,15 +83,13 @@ impl BufferPoolConfig {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn set_params<'a, T: Into<Option<&'a ::Caps>>>(
|
||||
pub fn set_params(
|
||||
&mut self,
|
||||
caps: T,
|
||||
caps: Option<&::Caps>,
|
||||
size: u32,
|
||||
min_buffers: u32,
|
||||
max_buffers: u32,
|
||||
) {
|
||||
let caps = caps.into();
|
||||
|
||||
unsafe {
|
||||
gst_sys::gst_buffer_pool_config_set_params(
|
||||
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,
|
||||
caps: T,
|
||||
caps: Option<&::Caps>,
|
||||
size: u32,
|
||||
min_buffers: u32,
|
||||
max_buffers: u32,
|
||||
) -> Result<(), glib::BoolError> {
|
||||
let caps = caps.into();
|
||||
|
||||
unsafe {
|
||||
glib_result_from_gboolean!(
|
||||
gst_sys::gst_buffer_pool_config_validate_params(
|
||||
|
@ -256,9 +252,9 @@ pub trait BufferPoolExtManual: 'static {
|
|||
|
||||
fn is_flushing(&self) -> bool;
|
||||
|
||||
fn acquire_buffer<'a, P: Into<Option<&'a BufferPoolAcquireParams>>>(
|
||||
fn acquire_buffer(
|
||||
&self,
|
||||
params: P,
|
||||
params: Option<&BufferPoolAcquireParams>,
|
||||
) -> Result<::Buffer, ::FlowError>;
|
||||
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,
|
||||
params: P,
|
||||
params: Option<&BufferPoolAcquireParams>,
|
||||
) -> 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 {
|
||||
let mut buffer = ptr::null_mut();
|
||||
|
@ -338,13 +334,13 @@ mod tests {
|
|||
|
||||
let params = ::BufferPoolAcquireParams::with_flags(::BufferPoolAcquireFlags::DONTWAIT);
|
||||
|
||||
let _buf1 = pool.acquire_buffer(¶ms).unwrap();
|
||||
let buf2 = pool.acquire_buffer(¶ms).unwrap();
|
||||
let _buf1 = pool.acquire_buffer(Some(¶ms)).unwrap();
|
||||
let buf2 = pool.acquire_buffer(Some(¶ms)).unwrap();
|
||||
|
||||
assert!(pool.acquire_buffer(¶ms).is_err());
|
||||
assert!(pool.acquire_buffer(Some(¶ms)).is_err());
|
||||
|
||||
drop(buf2);
|
||||
let _buf2 = pool.acquire_buffer(¶ms).unwrap();
|
||||
let _buf2 = pool.acquire_buffer(Some(¶ms)).unwrap();
|
||||
|
||||
pool.set_active(false).unwrap();
|
||||
}
|
||||
|
|
|
@ -81,12 +81,7 @@ impl Bus {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn create_watch<'a, N: Into<Option<&'a str>>, F>(
|
||||
&self,
|
||||
name: N,
|
||||
priority: Priority,
|
||||
func: F,
|
||||
) -> glib::Source
|
||||
pub fn create_watch<F>(&self, name: Option<&str>, priority: Priority, func: F) -> glib::Source
|
||||
where
|
||||
F: FnMut(&Bus, &Message) -> Continue + Send + 'static,
|
||||
{
|
||||
|
@ -101,7 +96,6 @@ impl Bus {
|
|||
);
|
||||
glib_sys::g_source_set_priority(source, priority.to_glib());
|
||||
|
||||
let name = name.into();
|
||||
if let Some(name) = name {
|
||||
glib_sys::g_source_set_name(source, name.to_glib_none().0);
|
||||
}
|
||||
|
|
|
@ -54,10 +54,10 @@ impl FromGlib<libc::c_uint> for DeviceMonitorFilterId {
|
|||
}
|
||||
|
||||
pub trait DeviceMonitorExtManual: 'static {
|
||||
fn add_filter<'a, 'b, P: Into<Option<&'a str>>, Q: Into<Option<&'b Caps>>>(
|
||||
fn add_filter(
|
||||
&self,
|
||||
classes: P,
|
||||
caps: Q,
|
||||
classes: Option<&str>,
|
||||
caps: Option<&Caps>,
|
||||
) -> Option<DeviceMonitorFilterId>;
|
||||
|
||||
fn remove_filter(&self, filter_id: DeviceMonitorFilterId)
|
||||
|
@ -65,13 +65,11 @@ pub trait DeviceMonitorExtManual: 'static {
|
|||
}
|
||||
|
||||
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,
|
||||
classes: P,
|
||||
caps: Q,
|
||||
classes: Option<&str>,
|
||||
caps: Option<&Caps>,
|
||||
) -> Option<DeviceMonitorFilterId> {
|
||||
let classes = classes.into();
|
||||
let caps = caps.into();
|
||||
let id = unsafe {
|
||||
gst_sys::gst_device_monitor_add_filter(
|
||||
self.as_ref().to_glib_none().0,
|
||||
|
|
|
@ -170,16 +170,16 @@ pub trait ElementExtManual: 'static {
|
|||
fn get_src_pads(&self) -> Vec<Pad>;
|
||||
|
||||
#[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,
|
||||
property_name: P,
|
||||
property_name: Option<&str>,
|
||||
include_value: bool,
|
||||
) -> NotifyWatchId;
|
||||
|
||||
#[cfg(any(feature = "v1_10", feature = "dox"))]
|
||||
fn add_property_notify_watch<'a, P: Into<Option<&'a str>>>(
|
||||
fn add_property_notify_watch(
|
||||
&self,
|
||||
property_name: P,
|
||||
property_name: Option<&str>,
|
||||
include_value: bool,
|
||||
) -> NotifyWatchId;
|
||||
|
||||
|
@ -479,12 +479,11 @@ impl<O: IsA<Element>> ElementExtManual for O {
|
|||
}
|
||||
|
||||
#[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,
|
||||
property_name: P,
|
||||
property_name: Option<&str>,
|
||||
include_value: bool,
|
||||
) -> NotifyWatchId {
|
||||
let property_name = property_name.into();
|
||||
let property_name = property_name.to_glib_none();
|
||||
unsafe {
|
||||
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"))]
|
||||
fn add_property_notify_watch<'a, P: Into<Option<&'a str>>>(
|
||||
fn add_property_notify_watch(
|
||||
&self,
|
||||
property_name: P,
|
||||
property_name: Option<&str>,
|
||||
include_value: bool,
|
||||
) -> NotifyWatchId {
|
||||
let property_name = property_name.into();
|
||||
let property_name = property_name.to_glib_none();
|
||||
unsafe {
|
||||
from_glib(gst_sys::gst_element_add_property_notify_watch(
|
||||
|
|
|
@ -62,24 +62,16 @@ pub struct ErrorMessage {
|
|||
}
|
||||
|
||||
impl ErrorMessage {
|
||||
pub fn new<
|
||||
'a,
|
||||
'b,
|
||||
T: ::MessageErrorDomain,
|
||||
U: Into<Option<&'a str>>,
|
||||
V: Into<Option<&'b str>>,
|
||||
>(
|
||||
pub fn new<T: ::MessageErrorDomain>(
|
||||
error: &T,
|
||||
message: U,
|
||||
debug: V,
|
||||
message: Option<&str>,
|
||||
debug: Option<&str>,
|
||||
filename: &'static str,
|
||||
function: &'static str,
|
||||
line: u32,
|
||||
) -> ErrorMessage {
|
||||
let error_domain = T::domain();
|
||||
let error_code = error.code();
|
||||
let message = message.into();
|
||||
let debug = debug.into();
|
||||
|
||||
ErrorMessage {
|
||||
error_domain,
|
||||
|
|
|
@ -15,14 +15,13 @@ use Error;
|
|||
use ParseContext;
|
||||
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,
|
||||
ghost_unlinked_pads: bool,
|
||||
context: P,
|
||||
mut context: Option<&mut ParseContext>,
|
||||
flags: ParseFlags,
|
||||
) -> Result<Element, Error> {
|
||||
assert_initialized_main_thread!();
|
||||
let mut context = context.into();
|
||||
unsafe {
|
||||
let mut error = ptr::null_mut();
|
||||
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,
|
||||
context: P,
|
||||
mut context: Option<&mut ParseContext>,
|
||||
flags: ParseFlags,
|
||||
) -> Result<Element, Error> {
|
||||
assert_initialized_main_thread!();
|
||||
let mut context = context.into();
|
||||
unsafe {
|
||||
let mut error = ptr::null_mut();
|
||||
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],
|
||||
context: P,
|
||||
mut context: Option<&mut ParseContext>,
|
||||
flags: ParseFlags,
|
||||
) -> Result<Element, Error> {
|
||||
assert_initialized_main_thread!();
|
||||
let mut context = context.into();
|
||||
unsafe {
|
||||
let mut error = ptr::null_mut();
|
||||
let ret = gst_sys::gst_parse_launchv_full(
|
||||
|
|
|
@ -17,9 +17,8 @@ use PadMode;
|
|||
use PadTemplate;
|
||||
|
||||
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!();
|
||||
let name = name.into();
|
||||
let name = name.to_glib_none();
|
||||
unsafe {
|
||||
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>>(
|
||||
name: P,
|
||||
pub fn new_from_template<Q: IsA<Pad>>(
|
||||
name: Option<&str>,
|
||||
target: &Q,
|
||||
templ: &PadTemplate,
|
||||
) -> Option<GhostPad> {
|
||||
skip_assert_initialized!();
|
||||
let name = name.into();
|
||||
let name = name.to_glib_none();
|
||||
unsafe {
|
||||
Option::<Pad>::from_glib_none(gst_sys::gst_ghost_pad_new_from_template(
|
||||
|
@ -48,19 +46,13 @@ impl GhostPad {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn activate_mode_default<
|
||||
'a,
|
||||
P: IsA<GhostPad>,
|
||||
Q: IsA<Object> + 'a,
|
||||
R: Into<Option<&'a Q>>,
|
||||
>(
|
||||
pub fn activate_mode_default<P: IsA<GhostPad>, Q: IsA<Object>>(
|
||||
pad: &P,
|
||||
parent: R,
|
||||
parent: Option<&Q>,
|
||||
mode: PadMode,
|
||||
active: bool,
|
||||
) -> Result<(), glib::BoolError> {
|
||||
skip_assert_initialized!();
|
||||
let parent = parent.into();
|
||||
unsafe {
|
||||
glib_result_from_gboolean!(
|
||||
gst_sys::gst_ghost_pad_activate_mode_default(
|
||||
|
@ -74,19 +66,13 @@ impl GhostPad {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn internal_activate_mode_default<
|
||||
'a,
|
||||
P: IsA<GhostPad>,
|
||||
Q: IsA<Object> + 'a,
|
||||
R: Into<Option<&'a Q>>,
|
||||
>(
|
||||
pub fn internal_activate_mode_default<P: IsA<GhostPad>, Q: IsA<Object>>(
|
||||
pad: &P,
|
||||
parent: R,
|
||||
parent: Option<&Q>,
|
||||
mode: PadMode,
|
||||
active: bool,
|
||||
) -> Result<(), glib::BoolError> {
|
||||
skip_assert_initialized!();
|
||||
let parent = parent.into();
|
||||
unsafe {
|
||||
glib_result_from_gboolean!(
|
||||
gst_sys::gst_ghost_pad_internal_activate_mode_default(
|
||||
|
|
|
@ -21,11 +21,7 @@ use glib::IsA;
|
|||
pub struct DebugCategory(ptr::NonNull<gst_sys::GstDebugCategory>);
|
||||
|
||||
impl DebugCategory {
|
||||
pub fn new<'a, P: Into<Option<&'a str>>>(
|
||||
name: &str,
|
||||
color: ::DebugColorFlags,
|
||||
description: P,
|
||||
) -> DebugCategory {
|
||||
pub fn new(name: &str, color: ::DebugColorFlags, description: Option<&str>) -> DebugCategory {
|
||||
extern "C" {
|
||||
fn _gst_debug_category_new(
|
||||
name: *const c_char,
|
||||
|
@ -33,7 +29,6 @@ impl DebugCategory {
|
|||
description: *const c_char,
|
||||
) -> *mut gst_sys::GstDebugCategory;
|
||||
}
|
||||
let description = description.into();
|
||||
|
||||
// Gets the category if it exists already
|
||||
unsafe {
|
||||
|
@ -149,7 +144,7 @@ lazy_static! {
|
|||
pub static ref CAT_RUST: DebugCategory = DebugCategory::new(
|
||||
"GST_RUST",
|
||||
::DebugColorFlags::UNDERLINE,
|
||||
"GStreamer's Rust binding core",
|
||||
Some("GStreamer's Rust binding core"),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -307,7 +302,7 @@ mod tests {
|
|||
let cat = DebugCategory::new(
|
||||
"test-cat",
|
||||
::DebugColorFlags::empty(),
|
||||
"some debug category",
|
||||
Some("some debug category"),
|
||||
);
|
||||
|
||||
gst_error!(cat, "meh");
|
||||
|
|
|
@ -17,13 +17,9 @@ use gobject_sys;
|
|||
use ObjectFlags;
|
||||
|
||||
pub trait GstObjectExtManual: 'static {
|
||||
fn connect_deep_notify<
|
||||
'a,
|
||||
P: Into<Option<&'a str>>,
|
||||
F: Fn(&Self, &::Object, &glib::ParamSpec) + Send + Sync + 'static,
|
||||
>(
|
||||
fn connect_deep_notify<F: Fn(&Self, &::Object, &glib::ParamSpec) + Send + Sync + 'static>(
|
||||
&self,
|
||||
name: P,
|
||||
name: Option<&str>,
|
||||
f: F,
|
||||
) -> SignalHandlerId;
|
||||
|
||||
|
@ -35,16 +31,11 @@ pub trait GstObjectExtManual: 'static {
|
|||
}
|
||||
|
||||
impl<O: IsA<::Object>> GstObjectExtManual for O {
|
||||
fn connect_deep_notify<
|
||||
'a,
|
||||
P: Into<Option<&'a str>>,
|
||||
F: Fn(&Self, &::Object, &glib::ParamSpec) + Send + Sync + 'static,
|
||||
>(
|
||||
fn connect_deep_notify<F: Fn(&Self, &::Object, &glib::ParamSpec) + Send + Sync + 'static>(
|
||||
&self,
|
||||
name: P,
|
||||
name: Option<&str>,
|
||||
f: F,
|
||||
) -> SignalHandlerId {
|
||||
let name = name.into();
|
||||
let signal_name = if let Some(name) = name {
|
||||
format!("deep-notify::{}", name)
|
||||
} else {
|
||||
|
|
|
@ -49,12 +49,8 @@ use libc;
|
|||
use gst_sys;
|
||||
|
||||
impl Pad {
|
||||
pub fn new_from_static_template<'a, P: Into<Option<&'a str>>>(
|
||||
templ: &StaticPadTemplate,
|
||||
name: P,
|
||||
) -> Pad {
|
||||
pub fn new_from_static_template(templ: &StaticPadTemplate, name: Option<&str>) -> Pad {
|
||||
assert_initialized_main_thread!();
|
||||
let name = name.into();
|
||||
unsafe {
|
||||
from_glib_none(gst_sys::gst_pad_new_from_static_template(
|
||||
mut_override(templ.to_glib_none().0),
|
||||
|
@ -131,28 +127,20 @@ pub trait PadExtManual: 'static {
|
|||
|
||||
fn peer_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>>>(
|
||||
&self,
|
||||
parent: Q,
|
||||
query: &mut QueryRef,
|
||||
) -> bool;
|
||||
fn query_default<P: IsA<::Object>>(&self, parent: Option<&P>, query: &mut QueryRef) -> bool;
|
||||
fn proxy_query_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>>>(
|
||||
&self,
|
||||
parent: Q,
|
||||
event: Event,
|
||||
) -> bool;
|
||||
fn event_default<P: IsA<::Object>>(&self, parent: Option<&P>, event: Event) -> bool;
|
||||
fn push_event(&self, event: Event) -> bool;
|
||||
fn send_event(&self, event: Event) -> bool;
|
||||
|
||||
fn get_last_flow_return(&self) -> Result<FlowSuccess, FlowError>;
|
||||
|
||||
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,
|
||||
parent: Q,
|
||||
parent: Option<&P>,
|
||||
) -> ::Iterator<Pad>;
|
||||
|
||||
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>>>(
|
||||
&self,
|
||||
parent: Q,
|
||||
query: &mut QueryRef,
|
||||
) -> bool {
|
||||
fn query_default<P: IsA<::Object>>(&self, parent: Option<&P>, query: &mut QueryRef) -> bool {
|
||||
skip_assert_initialized!();
|
||||
let parent = parent.into();
|
||||
unsafe {
|
||||
from_glib(gst_sys::gst_pad_query_default(
|
||||
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>>>(
|
||||
&self,
|
||||
parent: Q,
|
||||
event: Event,
|
||||
) -> bool {
|
||||
fn event_default<P: IsA<::Object>>(&self, parent: Option<&P>, event: Event) -> bool {
|
||||
skip_assert_initialized!();
|
||||
let parent = parent.into();
|
||||
unsafe {
|
||||
from_glib(gst_sys::gst_pad_event_default(
|
||||
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,
|
||||
parent: Q,
|
||||
parent: Option<&P>,
|
||||
) -> ::Iterator<Pad> {
|
||||
let parent = parent.into();
|
||||
unsafe {
|
||||
from_glib_full(gst_sys::gst_pad_iterate_internal_links_default(
|
||||
self.as_ref().to_glib_none().0,
|
||||
|
|
|
@ -22,13 +22,12 @@ use glib::translate::{from_glib, from_glib_full, ToGlibPtr};
|
|||
use gst_sys;
|
||||
|
||||
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,
|
||||
parent: R,
|
||||
parent: Option<&Q>,
|
||||
buffer: Buffer,
|
||||
) -> Result<FlowSuccess, FlowError> {
|
||||
skip_assert_initialized!();
|
||||
let parent = parent.into();
|
||||
let ret: FlowReturn = unsafe {
|
||||
from_glib(gst_sys::gst_proxy_pad_chain_default(
|
||||
pad.as_ptr() as *mut gst_sys::GstPad,
|
||||
|
@ -39,13 +38,12 @@ impl ProxyPad {
|
|||
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,
|
||||
parent: R,
|
||||
parent: Option<&Q>,
|
||||
list: BufferList,
|
||||
) -> Result<FlowSuccess, FlowError> {
|
||||
skip_assert_initialized!();
|
||||
let parent = parent.into();
|
||||
let ret: FlowReturn = unsafe {
|
||||
from_glib(gst_sys::gst_proxy_pad_chain_list_default(
|
||||
pad.as_ptr() as *mut gst_sys::GstPad,
|
||||
|
@ -76,17 +74,11 @@ impl ProxyPad {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn iterate_internal_links_default<
|
||||
'a,
|
||||
P: IsA<ProxyPad>,
|
||||
Q: IsA<Object> + 'a,
|
||||
R: Into<Option<&'a Q>>,
|
||||
>(
|
||||
pub fn iterate_internal_links_default<P: IsA<ProxyPad>, Q: IsA<Object>>(
|
||||
pad: &P,
|
||||
parent: R,
|
||||
parent: Option<&Q>,
|
||||
) -> Option<::Iterator<Pad>> {
|
||||
skip_assert_initialized!();
|
||||
let parent = parent.into();
|
||||
unsafe {
|
||||
from_glib_full(gst_sys::gst_proxy_pad_iterate_internal_links_default(
|
||||
pad.as_ptr() as *mut gst_sys::GstPad,
|
||||
|
|
|
@ -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!();
|
||||
let filter = filter.into();
|
||||
unsafe {
|
||||
Caps::<Self>(from_glib_full(gst_sys::gst_query_new_caps(
|
||||
filter.to_glib_none().0,
|
||||
|
|
|
@ -15,16 +15,14 @@ use StreamType;
|
|||
|
||||
impl Stream {
|
||||
#[cfg(any(feature = "v1_10", feature = "dox"))]
|
||||
pub fn new<'a, 'b, P: Into<Option<&'a str>>, Q: Into<Option<&'b Caps>>>(
|
||||
stream_id: P,
|
||||
caps: Q,
|
||||
pub fn new(
|
||||
stream_id: Option<&str>,
|
||||
caps: Option<&Caps>,
|
||||
type_: StreamType,
|
||||
flags: StreamFlags,
|
||||
) -> Stream {
|
||||
assert_initialized_main_thread!();
|
||||
let stream_id = stream_id.into();
|
||||
let stream_id = stream_id.to_glib_none();
|
||||
let caps = caps.into();
|
||||
let caps = caps.to_glib_none();
|
||||
|
||||
let (major, minor, _, _) = ::version();
|
||||
|
|
|
@ -69,9 +69,8 @@ impl<'a> DoubleEndedIterator for Iter<'a> {
|
|||
impl<'a> ExactSizeIterator for Iter<'a> {}
|
||||
|
||||
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!();
|
||||
let upstream_id = upstream_id.into();
|
||||
let upstream_id = upstream_id.to_glib_none();
|
||||
let (major, minor, _, _) = ::version();
|
||||
if (major, minor) > (1, 12) {
|
||||
|
|
|
@ -32,28 +32,17 @@ pub trait TypeFindImpl {
|
|||
}
|
||||
|
||||
impl<'a> TypeFind<'a> {
|
||||
pub fn register<
|
||||
'b,
|
||||
'c,
|
||||
'd,
|
||||
P: Into<Option<&'b Plugin>>,
|
||||
R: Into<Option<&'c str>>,
|
||||
S: Into<Option<&'d Caps>>,
|
||||
F,
|
||||
>(
|
||||
plugin: P,
|
||||
pub fn register<F>(
|
||||
plugin: Option<&Plugin>,
|
||||
name: &str,
|
||||
rank: u32,
|
||||
extensions: R,
|
||||
possible_caps: S,
|
||||
extensions: Option<&str>,
|
||||
possible_caps: Option<&Caps>,
|
||||
func: F,
|
||||
) -> Result<(), glib::error::BoolError>
|
||||
where
|
||||
F: Fn(&mut TypeFind) + Send + Sync + 'static,
|
||||
{
|
||||
let plugin = plugin.into();
|
||||
let extensions = extensions.into();
|
||||
let possible_caps = possible_caps.into();
|
||||
unsafe {
|
||||
let func: Box<F> = Box::new(func);
|
||||
let func = Box::into_raw(func);
|
||||
|
@ -278,7 +267,7 @@ mod tests {
|
|||
"test_typefind",
|
||||
::Rank::Primary.to_glib() as u32,
|
||||
None,
|
||||
&Caps::new_simple("test/test", &[]),
|
||||
Some(&Caps::new_simple("test/test", &[])),
|
||||
|typefind| {
|
||||
let mut found = false;
|
||||
if let Some(data) = typefind.peek(0, 8) {
|
||||
|
|
Loading…
Reference in a new issue