Replace ulong for the property notify watches with a custom NotifyWatchId type

This commit is contained in:
Sebastian Dröge 2017-10-27 17:55:48 +02:00
parent a1a841afc8
commit ec6dde855a
32 changed files with 111 additions and 56 deletions

View file

@ -1,4 +1,4 @@
// This file was generated by gir (0fe730d) from gir-files (???) // This file was generated by gir (12a28ac) from gir-files (???)
// DO NOT EDIT // DO NOT EDIT
#[allow(unused_imports)] #[allow(unused_imports)]

View file

@ -1,4 +1,4 @@
// This file was generated by gir (0fe730d) from gir-files (???) // This file was generated by gir (12a28ac) from gir-files (???)
// DO NOT EDIT // DO NOT EDIT
use ChildProxy; use ChildProxy;

View file

@ -1,4 +1,4 @@
// This file was generated by gir (0fe730d) from gir-files (???) // This file was generated by gir (12a28ac) from gir-files (???)
// DO NOT EDIT // DO NOT EDIT
use ClockTime; use ClockTime;

View file

@ -1,4 +1,4 @@
// This file was generated by gir (0fe730d) from gir-files (???) // This file was generated by gir (12a28ac) from gir-files (???)
// DO NOT EDIT // DO NOT EDIT
use ffi; use ffi;

View file

@ -1,4 +1,4 @@
// This file was generated by gir (0fe730d) from gir-files (???) // This file was generated by gir (12a28ac) from gir-files (???)
// DO NOT EDIT // DO NOT EDIT
use ClockTime; use ClockTime;

View file

@ -1,4 +1,4 @@
// This file was generated by gir (0fe730d) from gir-files (???) // This file was generated by gir (12a28ac) from gir-files (???)
// DO NOT EDIT // DO NOT EDIT
use ffi; use ffi;

View file

@ -1,4 +1,4 @@
// This file was generated by gir (0fe730d) from gir-files (???) // This file was generated by gir (12a28ac) from gir-files (???)
// DO NOT EDIT // DO NOT EDIT
use Caps; use Caps;

View file

@ -1,4 +1,4 @@
// This file was generated by gir (0fe730d) from gir-files (???) // This file was generated by gir (12a28ac) from gir-files (???)
// DO NOT EDIT // DO NOT EDIT
use Bus; use Bus;

View file

@ -1,4 +1,4 @@
// This file was generated by gir (0fe730d) from gir-files (???) // This file was generated by gir (12a28ac) from gir-files (???)
// DO NOT EDIT // DO NOT EDIT
use Bus; use Bus;

View file

@ -1,4 +1,4 @@
// This file was generated by gir (0fe730d) from gir-files (???) // This file was generated by gir (12a28ac) from gir-files (???)
// DO NOT EDIT // DO NOT EDIT
use DeviceProvider; use DeviceProvider;

View file

@ -1,4 +1,4 @@
// This file was generated by gir (0fe730d) from gir-files (???) // This file was generated by gir (12a28ac) from gir-files (???)
// DO NOT EDIT // DO NOT EDIT
use Bus; use Bus;
@ -89,12 +89,6 @@ pub trait ElementExt {
fn add_pad<P: IsA<Pad>>(&self, pad: &P) -> Result<(), glib::error::BoolError>; fn add_pad<P: IsA<Pad>>(&self, pad: &P) -> Result<(), glib::error::BoolError>;
#[cfg(any(feature = "v1_10", feature = "dox"))]
fn add_property_deep_notify_watch<'a, P: Into<Option<&'a str>>>(&self, property_name: P, include_value: bool) -> libc::c_ulong;
#[cfg(any(feature = "v1_10", feature = "dox"))]
fn add_property_notify_watch<'a, P: Into<Option<&'a str>>>(&self, property_name: P, include_value: bool) -> libc::c_ulong;
//#[cfg(any(feature = "v1_10", feature = "dox"))] //#[cfg(any(feature = "v1_10", feature = "dox"))]
//fn call_async<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, func: /*Unknown conversion*//*Unimplemented*/ElementCallAsyncFunc, user_data: P, destroy_notify: /*Unknown conversion*//*Unimplemented*/DestroyNotify); //fn call_async<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, func: /*Unknown conversion*//*Unimplemented*/ElementCallAsyncFunc, user_data: P, destroy_notify: /*Unknown conversion*//*Unimplemented*/DestroyNotify);
@ -222,24 +216,6 @@ impl<O: IsA<Element> + IsA<glib::object::Object>> ElementExt for O {
} }
} }
#[cfg(any(feature = "v1_10", feature = "dox"))]
fn add_property_deep_notify_watch<'a, P: Into<Option<&'a str>>>(&self, property_name: P, include_value: bool) -> libc::c_ulong {
let property_name = property_name.into();
let property_name = property_name.to_glib_none();
unsafe {
ffi::gst_element_add_property_deep_notify_watch(self.to_glib_none().0, property_name.0, include_value.to_glib())
}
}
#[cfg(any(feature = "v1_10", feature = "dox"))]
fn add_property_notify_watch<'a, P: Into<Option<&'a str>>>(&self, property_name: P, include_value: bool) -> libc::c_ulong {
let property_name = property_name.into();
let property_name = property_name.to_glib_none();
unsafe {
ffi::gst_element_add_property_notify_watch(self.to_glib_none().0, property_name.0, include_value.to_glib())
}
}
//#[cfg(any(feature = "v1_10", feature = "dox"))] //#[cfg(any(feature = "v1_10", feature = "dox"))]
//fn call_async<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, func: /*Unknown conversion*//*Unimplemented*/ElementCallAsyncFunc, user_data: P, destroy_notify: /*Unknown conversion*//*Unimplemented*/DestroyNotify) { //fn call_async<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, func: /*Unknown conversion*//*Unimplemented*/ElementCallAsyncFunc, user_data: P, destroy_notify: /*Unknown conversion*//*Unimplemented*/DestroyNotify) {
// unsafe { TODO: call ffi::gst_element_call_async() } // unsafe { TODO: call ffi::gst_element_call_async() }

View file

@ -1,4 +1,4 @@
// This file was generated by gir (0fe730d) from gir-files (???) // This file was generated by gir (12a28ac) from gir-files (???)
// DO NOT EDIT // DO NOT EDIT
use Caps; use Caps;

View file

@ -1,4 +1,4 @@
// This file was generated by gir (0fe730d) from gir-files (???) // This file was generated by gir (12a28ac) from gir-files (???)
// DO NOT EDIT // DO NOT EDIT
use ffi; use ffi;

View file

@ -1,4 +1,4 @@
// This file was generated by gir (0fe730d) from gir-files (???) // This file was generated by gir (12a28ac) from gir-files (???)
// DO NOT EDIT // DO NOT EDIT
use ffi; use ffi;

View file

@ -1,4 +1,4 @@
// This file was generated by gir (0fe730d) from gir-files (???) // This file was generated by gir (12a28ac) from gir-files (???)
// DO NOT EDIT // DO NOT EDIT
use Bin; use Bin;

View file

@ -1,4 +1,4 @@
// This file was generated by gir (0fe730d) from gir-files (???) // This file was generated by gir (12a28ac) from gir-files (???)
// DO NOT EDIT // DO NOT EDIT
use Object; use Object;

View file

@ -1,4 +1,4 @@
// This file was generated by gir (0fe730d) from gir-files (???) // This file was generated by gir (12a28ac) from gir-files (???)
// DO NOT EDIT // DO NOT EDIT
mod bin; mod bin;

View file

@ -1,4 +1,4 @@
// This file was generated by gir (0fe730d) from gir-files (???) // This file was generated by gir (12a28ac) from gir-files (???)
// DO NOT EDIT // DO NOT EDIT
use ClockTime; use ClockTime;

View file

@ -1,4 +1,4 @@
// This file was generated by gir (0fe730d) from gir-files (???) // This file was generated by gir (12a28ac) from gir-files (???)
// DO NOT EDIT // DO NOT EDIT
use Caps; use Caps;

View file

@ -1,4 +1,4 @@
// This file was generated by gir (0fe730d) from gir-files (???) // This file was generated by gir (12a28ac) from gir-files (???)
// DO NOT EDIT // DO NOT EDIT
use Caps; use Caps;

View file

@ -1,4 +1,4 @@
// This file was generated by gir (0fe730d) from gir-files (???) // This file was generated by gir (12a28ac) from gir-files (???)
// DO NOT EDIT // DO NOT EDIT
use Bin; use Bin;

View file

@ -1,4 +1,4 @@
// This file was generated by gir (0fe730d) from gir-files (???) // This file was generated by gir (12a28ac) from gir-files (???)
// DO NOT EDIT // DO NOT EDIT
use Error; use Error;

View file

@ -1,4 +1,4 @@
// This file was generated by gir (0fe730d) from gir-files (???) // This file was generated by gir (12a28ac) from gir-files (???)
// DO NOT EDIT // DO NOT EDIT
use ffi; use ffi;

View file

@ -1,4 +1,4 @@
// This file was generated by gir (0fe730d) from gir-files (???) // This file was generated by gir (12a28ac) from gir-files (???)
// DO NOT EDIT // DO NOT EDIT
use Object; use Object;

View file

@ -1,4 +1,4 @@
// This file was generated by gir (0fe730d) from gir-files (???) // This file was generated by gir (12a28ac) from gir-files (???)
// DO NOT EDIT // DO NOT EDIT
use Caps; use Caps;

View file

@ -1,4 +1,4 @@
// This file was generated by gir (0fe730d) from gir-files (???) // This file was generated by gir (12a28ac) from gir-files (???)
// DO NOT EDIT // DO NOT EDIT
use Object; use Object;

View file

@ -1,4 +1,4 @@
// This file was generated by gir (0fe730d) from gir-files (???) // This file was generated by gir (12a28ac) from gir-files (???)
// DO NOT EDIT // DO NOT EDIT
use Clock; use Clock;

View file

@ -1,4 +1,4 @@
// This file was generated by gir (0fe730d) from gir-files (???) // This file was generated by gir (12a28ac) from gir-files (???)
// DO NOT EDIT // DO NOT EDIT
use Element; use Element;

View file

@ -1,4 +1,4 @@
// This file was generated by gir (0fe730d) from gir-files (???) // This file was generated by gir (12a28ac) from gir-files (???)
// DO NOT EDIT // DO NOT EDIT
use Element; use Element;

View file

@ -1,4 +1,4 @@
// This file was generated by gir (0fe730d) from gir-files (???) // This file was generated by gir (12a28ac) from gir-files (???)
// DO NOT EDIT // DO NOT EDIT
use Error; use Error;

View file

@ -10,7 +10,8 @@ use Element;
use glib; use glib;
use glib::IsA; use glib::IsA;
use glib::translate::{from_glib, from_glib_full, from_glib_none, FromGlibPtrContainer, ToGlibPtr}; use glib::translate::{from_glib, from_glib_full, from_glib_none, FromGlib, FromGlibPtrContainer,
ToGlib, ToGlibPtr};
use QueryRef; use QueryRef;
use Event; use Event;
use Pad; use Pad;
@ -19,6 +20,8 @@ use miniobject::MiniObject;
use std::ffi::CStr; use std::ffi::CStr;
use libc;
use ffi; use ffi;
use gobject_ffi; use gobject_ffi;
@ -56,6 +59,24 @@ pub enum ElementMessageType {
Info, Info,
} }
#[derive(Debug, Default, PartialEq, Eq)]
pub struct NotifyWatchId(libc::c_ulong);
impl ToGlib for NotifyWatchId {
type GlibType = libc::c_ulong;
fn to_glib(&self) -> libc::c_ulong {
self.0
}
}
impl FromGlib<libc::c_ulong> for NotifyWatchId {
fn from_glib(val: libc::c_ulong) -> NotifyWatchId {
skip_assert_initialized!();
NotifyWatchId(val)
}
}
pub trait ElementExtManual { pub trait ElementExtManual {
fn query(&self, query: &mut QueryRef) -> bool; fn query(&self, query: &mut QueryRef) -> bool;
@ -96,6 +117,23 @@ pub trait ElementExtManual {
fn get_pads(&self) -> Vec<Pad>; fn get_pads(&self) -> Vec<Pad>;
fn get_sink_pads(&self) -> Vec<Pad>; fn get_sink_pads(&self) -> Vec<Pad>;
fn get_src_pads(&self) -> Vec<Pad>; 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>>>(
&self,
property_name: P,
include_value: bool,
) -> NotifyWatchId;
#[cfg(any(feature = "v1_10", feature = "dox"))]
fn add_property_notify_watch<'a, P: Into<Option<&'a str>>>(
&self,
property_name: P,
include_value: bool,
) -> NotifyWatchId;
#[cfg(any(feature = "v1_10", feature = "dox"))]
fn remove_property_notify_watch(&self, watch_id: NotifyWatchId);
} }
impl<O: IsA<Element>> ElementExtManual for O { impl<O: IsA<Element>> ElementExtManual for O {
@ -258,6 +296,47 @@ impl<O: IsA<Element>> ElementExtManual for O {
FromGlibPtrContainer::from_glib_none(elt.srcpads) FromGlibPtrContainer::from_glib_none(elt.srcpads)
} }
} }
#[cfg(any(feature = "v1_10", feature = "dox"))]
fn add_property_deep_notify_watch<'a, P: Into<Option<&'a str>>>(
&self,
property_name: P,
include_value: bool,
) -> NotifyWatchId {
let property_name = property_name.into();
let property_name = property_name.to_glib_none();
unsafe {
from_glib(ffi::gst_element_add_property_deep_notify_watch(
self.to_glib_none().0,
property_name.0,
include_value.to_glib(),
))
}
}
#[cfg(any(feature = "v1_10", feature = "dox"))]
fn add_property_notify_watch<'a, P: Into<Option<&'a str>>>(
&self,
property_name: P,
include_value: bool,
) -> NotifyWatchId {
let property_name = property_name.into();
let property_name = property_name.to_glib_none();
unsafe {
from_glib(ffi::gst_element_add_property_notify_watch(
self.to_glib_none().0,
property_name.0,
include_value.to_glib(),
))
}
}
#[cfg(any(feature = "v1_10", feature = "dox"))]
fn remove_property_notify_watch(&self, watch_id: NotifyWatchId) {
unsafe {
ffi::gst_element_remove_property_notify_watch(self.to_glib_none().0, watch_id.0);
}
}
} }
lazy_static!{ lazy_static!{

View file

@ -100,7 +100,7 @@ mod tag_setter;
mod iterator; mod iterator;
mod device_provider; mod device_provider;
mod parse_context; mod parse_context;
pub use element::{ElementExtManual, ElementMessageType}; pub use element::{ElementExtManual, ElementMessageType, NotifyWatchId};
pub use element::{ELEMENT_METADATA_AUTHOR, ELEMENT_METADATA_DESCRIPTION, ELEMENT_METADATA_DOC_URI, pub use element::{ELEMENT_METADATA_AUTHOR, ELEMENT_METADATA_DESCRIPTION, ELEMENT_METADATA_DOC_URI,
ELEMENT_METADATA_ICON_NAME, ELEMENT_METADATA_KLASS, ELEMENT_METADATA_LONGNAME}; ELEMENT_METADATA_ICON_NAME, ELEMENT_METADATA_KLASS, ELEMENT_METADATA_LONGNAME};
pub use bin::BinExtManual; pub use bin::BinExtManual;