Implement all message parsing API

This commit is contained in:
Sebastian Dröge 2017-07-05 01:47:33 +03:00
parent cb26c0aaed
commit 9b91024221
19 changed files with 1474 additions and 83 deletions

View file

@ -2,7 +2,7 @@
girs_dir = "gir-files"
library = "Gst"
version = "1.0"
min_cfg_version = "1.0"
min_cfg_version = "1.8"
target_path = "gstreamer"
work_mode = "normal"
concurrency = "send+sync"
@ -35,6 +35,16 @@ generate = [
"Gst.PluginError",
"Gst.ParseError",
"Gst.URIError",
"Gst.StructureChangeType",
"Gst.StreamStatusType",
"Gst.Device",
"Gst.DeviceMonitor",
"Gst.DeviceProvider",
"Gst.DeviceProviderFactory",
"Gst.Stream",
"Gst.StreamCollection",
"Gst.StreamType",
"Gst.StreamFlags",
]
manual = [
@ -220,3 +230,9 @@ status = "generate"
[[object.function]]
name = "util_dump_mem"
ignore = true
[[object.function]]
name = "protection_select_system"
# unsupported array type
ignore = true

View file

@ -8,5 +8,5 @@ bitflags = "0.9"
libc = "0.2"
glib-sys = { version = "0.3.4", git = "https://github.com/gtk-rs/sys" }
gobject-sys = { version = "0.3.4", git = "https://github.com/gtk-rs/sys" }
gstreamer-sys = { version = "0.1.1", git = "https://github.com/sdroege/gstreamer-sys" }
gstreamer-sys = { version = "0.1.1", git = "https://github.com/sdroege/gstreamer-sys", features = ["v1_12"] }
glib = { version = "0.1.3", git = "https://github.com/gtk-rs/glib" }

View file

@ -75,7 +75,6 @@ pub trait BinExt {
//#[cfg(feature = "v1_10")]
//fn set_suppressed_flags(&self, flags: /*Ignored*/ElementFlags);
#[cfg(feature = "v1_6")]
fn sync_children_states(&self) -> Result<(), glib::error::BoolError>;
fn get_property_async_handling(&self) -> bool;
@ -184,7 +183,6 @@ impl<O: IsA<Bin> + IsA<glib::object::Object>> BinExt for O {
// unsafe { TODO: call ffi::gst_bin_set_suppressed_flags() }
//}
#[cfg(feature = "v1_6")]
fn sync_children_states(&self) -> Result<(), glib::error::BoolError> {
unsafe {
glib::error::BoolError::from_glib(ffi::gst_bin_sync_children_states(self.to_glib_none().0), "Failed to sync children states")

View file

@ -6,19 +6,14 @@ use Object;
use ffi;
use glib;
use glib::Value;
#[cfg(feature = "v1_6")]
use glib::object::Downcast;
use glib::object::IsA;
#[cfg(feature = "v1_6")]
use glib::signal::connect;
use glib::translate::*;
#[cfg(feature = "v1_6")]
use glib_ffi;
use gobject_ffi;
#[cfg(feature = "v1_6")]
use std::boxed::Box as Box_;
use std::mem;
#[cfg(feature = "v1_6")]
use std::mem::transmute;
use std::ptr;
@ -66,12 +61,10 @@ unsafe impl Sync for Clock {}
pub trait ClockExt {
fn add_observation(&self, slave: ClockTime, master: ClockTime) -> Option<f64>;
#[cfg(feature = "v1_6")]
fn add_observation_unapplied(&self, slave: ClockTime, master: ClockTime) -> Option<(f64, ClockTime, ClockTime, ClockTime, ClockTime)>;
fn adjust_unlocked(&self, internal: ClockTime) -> ClockTime;
#[cfg(feature = "v1_6")]
fn adjust_with_calibration(&self, internal_target: ClockTime, cinternal: ClockTime, cexternal: ClockTime, cnum: ClockTime, cdenom: ClockTime) -> ClockTime;
fn get_calibration(&self) -> (ClockTime, ClockTime, ClockTime, ClockTime);
@ -86,7 +79,6 @@ pub trait ClockExt {
fn get_timeout(&self) -> ClockTime;
#[cfg(feature = "v1_6")]
fn is_synced(&self) -> bool;
//fn new_periodic_id(&self, start_time: ClockTime, interval: ClockTime) -> /*Unimplemented*/Option<ClockID>;
@ -101,7 +93,6 @@ pub trait ClockExt {
fn set_resolution(&self, resolution: ClockTime) -> ClockTime;
#[cfg(feature = "v1_6")]
fn set_synced(&self, synced: bool);
fn set_timeout(&self, timeout: ClockTime);
@ -110,10 +101,8 @@ pub trait ClockExt {
fn unadjust_unlocked(&self, external: ClockTime) -> ClockTime;
#[cfg(feature = "v1_8")]
fn unadjust_with_calibration(&self, external_target: ClockTime, cinternal: ClockTime, cexternal: ClockTime, cnum: ClockTime, cdenom: ClockTime) -> ClockTime;
#[cfg(feature = "v1_6")]
fn wait_for_sync(&self, timeout: ClockTime) -> Result<(), glib::error::BoolError>;
fn get_property_window_size(&self) -> i32;
@ -124,7 +113,6 @@ pub trait ClockExt {
fn set_property_window_threshold(&self, window_threshold: i32);
#[cfg(feature = "v1_6")]
fn connect_synced<F: Fn(&Self, bool) + Send + Sync + 'static>(&self, f: F) -> u64;
}
@ -137,7 +125,6 @@ impl<O: IsA<Clock> + IsA<glib::object::Object>> ClockExt for O {
}
}
#[cfg(feature = "v1_6")]
fn add_observation_unapplied(&self, slave: ClockTime, master: ClockTime) -> Option<(f64, ClockTime, ClockTime, ClockTime, ClockTime)> {
unsafe {
let mut r_squared = mem::uninitialized();
@ -156,7 +143,6 @@ impl<O: IsA<Clock> + IsA<glib::object::Object>> ClockExt for O {
}
}
#[cfg(feature = "v1_6")]
fn adjust_with_calibration(&self, internal_target: ClockTime, cinternal: ClockTime, cexternal: ClockTime, cnum: ClockTime, cdenom: ClockTime) -> ClockTime {
unsafe {
ffi::gst_clock_adjust_with_calibration(self.to_glib_none().0, internal_target, cinternal, cexternal, cnum, cdenom)
@ -204,7 +190,6 @@ impl<O: IsA<Clock> + IsA<glib::object::Object>> ClockExt for O {
}
}
#[cfg(feature = "v1_6")]
fn is_synced(&self) -> bool {
unsafe {
from_glib(ffi::gst_clock_is_synced(self.to_glib_none().0))
@ -243,7 +228,6 @@ impl<O: IsA<Clock> + IsA<glib::object::Object>> ClockExt for O {
}
}
#[cfg(feature = "v1_6")]
fn set_synced(&self, synced: bool) {
unsafe {
ffi::gst_clock_set_synced(self.to_glib_none().0, synced.to_glib());
@ -266,14 +250,12 @@ impl<O: IsA<Clock> + IsA<glib::object::Object>> ClockExt for O {
}
}
#[cfg(feature = "v1_8")]
fn unadjust_with_calibration(&self, external_target: ClockTime, cinternal: ClockTime, cexternal: ClockTime, cnum: ClockTime, cdenom: ClockTime) -> ClockTime {
unsafe {
ffi::gst_clock_unadjust_with_calibration(self.to_glib_none().0, external_target, cinternal, cexternal, cnum, cdenom)
}
}
#[cfg(feature = "v1_6")]
fn wait_for_sync(&self, timeout: ClockTime) -> Result<(), glib::error::BoolError> {
unsafe {
glib::error::BoolError::from_glib(ffi::gst_clock_wait_for_sync(self.to_glib_none().0, timeout), "Timed out waiting for sync")
@ -308,7 +290,6 @@ impl<O: IsA<Clock> + IsA<glib::object::Object>> ClockExt for O {
}
}
#[cfg(feature = "v1_6")]
fn connect_synced<F: Fn(&Self, bool) + Send + Sync + 'static>(&self, f: F) -> u64 {
unsafe {
let f: Box_<Box_<Fn(&Self, bool) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
@ -318,7 +299,6 @@ impl<O: IsA<Clock> + IsA<glib::object::Object>> ClockExt for O {
}
}
#[cfg(feature = "v1_6")]
unsafe extern "C" fn synced_trampoline<P>(this: *mut ffi::GstClock, synced: glib_ffi::gboolean, f: glib_ffi::gpointer)
where P: IsA<Clock> {
callback_guard!();

View file

@ -0,0 +1,150 @@
// This file was generated by gir (33e9567) from gir-files (???)
// DO NOT EDIT
use Element;
use Object;
use ffi;
use glib;
use glib::Value;
use glib::object::Downcast;
use glib::object::IsA;
use glib::signal::connect;
use glib::translate::*;
use glib_ffi;
use gobject_ffi;
use std::boxed::Box as Box_;
use std::mem::transmute;
glib_wrapper! {
pub struct Device(Object<ffi::GstDevice>): Object;
match fn {
get_type => || ffi::gst_device_get_type(),
}
}
unsafe impl Send for Device {}
unsafe impl Sync for Device {}
pub trait DeviceExt {
fn create_element<'a, P: Into<Option<&'a str>>>(&self, name: P) -> Option<Element>;
//fn get_caps(&self) -> /*Ignored*/Option<Caps>;
fn get_device_class(&self) -> Option<String>;
fn get_display_name(&self) -> Option<String>;
//fn get_properties(&self) -> /*Ignored*/Option<Structure>;
fn has_classes(&self, classes: &str) -> bool;
fn has_classesv(&self, classes: &[&str]) -> bool;
fn reconfigure_element<P: IsA<Element>>(&self, element: &P) -> bool;
//fn get_property_caps(&self) -> /*Ignored*/Option<Caps>;
fn get_property_device_class(&self) -> Option<String>;
fn get_property_display_name(&self) -> Option<String>;
//fn get_property_properties(&self) -> /*Ignored*/Option<Structure>;
fn connect_removed<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> u64;
}
impl<O: IsA<Device> + IsA<glib::object::Object>> DeviceExt for O {
fn create_element<'a, P: Into<Option<&'a str>>>(&self, name: P) -> Option<Element> {
let name = name.into();
let name = name.to_glib_none();
unsafe {
from_glib_full(ffi::gst_device_create_element(self.to_glib_none().0, name.0))
}
}
//fn get_caps(&self) -> /*Ignored*/Option<Caps> {
// unsafe { TODO: call ffi::gst_device_get_caps() }
//}
fn get_device_class(&self) -> Option<String> {
unsafe {
from_glib_full(ffi::gst_device_get_device_class(self.to_glib_none().0))
}
}
fn get_display_name(&self) -> Option<String> {
unsafe {
from_glib_full(ffi::gst_device_get_display_name(self.to_glib_none().0))
}
}
//fn get_properties(&self) -> /*Ignored*/Option<Structure> {
// unsafe { TODO: call ffi::gst_device_get_properties() }
//}
fn has_classes(&self, classes: &str) -> bool {
unsafe {
from_glib(ffi::gst_device_has_classes(self.to_glib_none().0, classes.to_glib_none().0))
}
}
fn has_classesv(&self, classes: &[&str]) -> bool {
unsafe {
from_glib(ffi::gst_device_has_classesv(self.to_glib_none().0, classes.to_glib_none().0))
}
}
fn reconfigure_element<P: IsA<Element>>(&self, element: &P) -> bool {
unsafe {
from_glib(ffi::gst_device_reconfigure_element(self.to_glib_none().0, element.to_glib_none().0))
}
}
//fn get_property_caps(&self) -> /*Ignored*/Option<Caps> {
// let mut value = Value::from(None::<&/*Ignored*/Caps>);
// unsafe {
// gobject_ffi::g_object_get_property(self.to_glib_none().0, "caps".to_glib_none().0, value.to_glib_none_mut().0);
// }
// value.get()
//}
fn get_property_device_class(&self) -> Option<String> {
let mut value = Value::from(None::<&str>);
unsafe {
gobject_ffi::g_object_get_property(self.to_glib_none().0, "device-class".to_glib_none().0, value.to_glib_none_mut().0);
}
value.get()
}
fn get_property_display_name(&self) -> Option<String> {
let mut value = Value::from(None::<&str>);
unsafe {
gobject_ffi::g_object_get_property(self.to_glib_none().0, "display-name".to_glib_none().0, value.to_glib_none_mut().0);
}
value.get()
}
//fn get_property_properties(&self) -> /*Ignored*/Option<Structure> {
// let mut value = Value::from(None::<&/*Ignored*/Structure>);
// unsafe {
// gobject_ffi::g_object_get_property(self.to_glib_none().0, "properties".to_glib_none().0, value.to_glib_none_mut().0);
// }
// value.get()
//}
fn connect_removed<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> u64 {
unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "removed",
transmute(removed_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
}
unsafe extern "C" fn removed_trampoline<P>(this: *mut ffi::GstDevice, f: glib_ffi::gpointer)
where P: IsA<Device> {
callback_guard!();
let f: &Box_<Fn(&P) + Send + Sync + 'static> = transmute(f);
f(&Device::from_glib_none(this).downcast_unchecked())
}

View file

@ -0,0 +1,123 @@
// This file was generated by gir (33e9567) from gir-files (???)
// DO NOT EDIT
use Bus;
use Device;
use Object;
use ffi;
use glib;
use glib::Value;
use glib::object::IsA;
use glib::translate::*;
use gobject_ffi;
glib_wrapper! {
pub struct DeviceMonitor(Object<ffi::GstDeviceMonitor>): Object;
match fn {
get_type => || ffi::gst_device_monitor_get_type(),
}
}
impl DeviceMonitor {
pub fn new() -> DeviceMonitor {
unsafe {
from_glib_full(ffi::gst_device_monitor_new())
}
}
}
unsafe impl Send for DeviceMonitor {}
unsafe impl Sync for DeviceMonitor {}
pub trait DeviceMonitorExt {
//fn add_filter<'a, 'b, P: Into<Option<&'a str>>, Q: Into<Option<&'b /*Ignored*/Caps>>>(&self, classes: P, caps: Q) -> u32;
fn get_bus(&self) -> Option<Bus>;
fn get_devices(&self) -> Vec<Device>;
fn get_providers(&self) -> Vec<String>;
fn get_show_all_devices(&self) -> bool;
fn remove_filter(&self, filter_id: u32) -> bool;
fn set_show_all_devices(&self, show_all: bool);
fn start(&self) -> bool;
fn stop(&self);
fn get_property_show_all(&self) -> bool;
fn set_property_show_all(&self, show_all: bool);
}
impl<O: IsA<DeviceMonitor> + IsA<glib::object::Object>> DeviceMonitorExt for O {
//fn add_filter<'a, 'b, P: Into<Option<&'a str>>, Q: Into<Option<&'b /*Ignored*/Caps>>>(&self, classes: P, caps: Q) -> u32 {
// unsafe { TODO: call ffi::gst_device_monitor_add_filter() }
//}
fn get_bus(&self) -> Option<Bus> {
unsafe {
from_glib_full(ffi::gst_device_monitor_get_bus(self.to_glib_none().0))
}
}
fn get_devices(&self) -> Vec<Device> {
unsafe {
FromGlibPtrContainer::from_glib_full(ffi::gst_device_monitor_get_devices(self.to_glib_none().0))
}
}
fn get_providers(&self) -> Vec<String> {
unsafe {
FromGlibPtrContainer::from_glib_full(ffi::gst_device_monitor_get_providers(self.to_glib_none().0))
}
}
fn get_show_all_devices(&self) -> bool {
unsafe {
from_glib(ffi::gst_device_monitor_get_show_all_devices(self.to_glib_none().0))
}
}
fn remove_filter(&self, filter_id: u32) -> bool {
unsafe {
from_glib(ffi::gst_device_monitor_remove_filter(self.to_glib_none().0, filter_id))
}
}
fn set_show_all_devices(&self, show_all: bool) {
unsafe {
ffi::gst_device_monitor_set_show_all_devices(self.to_glib_none().0, show_all.to_glib());
}
}
fn start(&self) -> bool {
unsafe {
from_glib(ffi::gst_device_monitor_start(self.to_glib_none().0))
}
}
fn stop(&self) {
unsafe {
ffi::gst_device_monitor_stop(self.to_glib_none().0);
}
}
fn get_property_show_all(&self) -> bool {
let mut value = Value::from(&false);
unsafe {
gobject_ffi::g_object_get_property(self.to_glib_none().0, "show-all".to_glib_none().0, value.to_glib_none_mut().0);
}
value.get().unwrap()
}
fn set_property_show_all(&self, show_all: bool) {
unsafe {
gobject_ffi::g_object_set_property(self.to_glib_none().0, "show-all".to_glib_none().0, Value::from(&show_all).to_glib_none().0);
}
}
}

View file

@ -0,0 +1,165 @@
// This file was generated by gir (33e9567) from gir-files (???)
// DO NOT EDIT
use Bus;
use Device;
use DeviceProviderFactory;
use Object;
use Plugin;
use ffi;
use glib;
use glib::object::Downcast;
use glib::object::IsA;
use glib::signal::connect;
use glib::translate::*;
use glib_ffi;
use libc;
use std::boxed::Box as Box_;
use std::mem::transmute;
glib_wrapper! {
pub struct DeviceProvider(Object<ffi::GstDeviceProvider>): Object;
match fn {
get_type => || ffi::gst_device_provider_get_type(),
}
}
impl DeviceProvider {
pub fn register<'a, P: Into<Option<&'a Plugin>>>(plugin: P, name: &str, rank: u32, type_: glib::types::Type) -> bool {
let plugin = plugin.into();
let plugin = plugin.to_glib_none();
unsafe {
from_glib(ffi::gst_device_provider_register(plugin.0, name.to_glib_none().0, rank, type_.to_glib()))
}
}
}
unsafe impl Send for DeviceProvider {}
unsafe impl Sync for DeviceProvider {}
pub trait DeviceProviderExt {
fn can_monitor(&self) -> bool;
fn device_add(&self, device: &Device);
fn device_remove(&self, device: &Device);
fn get_bus(&self) -> Option<Bus>;
fn get_devices(&self) -> Vec<Device>;
fn get_factory(&self) -> Option<DeviceProviderFactory>;
fn get_hidden_providers(&self) -> Vec<String>;
fn hide_provider(&self, name: &str);
fn start(&self) -> bool;
fn stop(&self);
fn unhide_provider(&self, name: &str);
fn connect_provider_hidden<F: Fn(&Self, &str) + Send + Sync + 'static>(&self, f: F) -> u64;
fn connect_provider_unhidden<F: Fn(&Self, &str) + Send + Sync + 'static>(&self, f: F) -> u64;
}
impl<O: IsA<DeviceProvider> + IsA<glib::object::Object>> DeviceProviderExt for O {
fn can_monitor(&self) -> bool {
unsafe {
from_glib(ffi::gst_device_provider_can_monitor(self.to_glib_none().0))
}
}
fn device_add(&self, device: &Device) {
unsafe {
ffi::gst_device_provider_device_add(self.to_glib_none().0, device.to_glib_none().0);
}
}
fn device_remove(&self, device: &Device) {
unsafe {
ffi::gst_device_provider_device_remove(self.to_glib_none().0, device.to_glib_none().0);
}
}
fn get_bus(&self) -> Option<Bus> {
unsafe {
from_glib_full(ffi::gst_device_provider_get_bus(self.to_glib_none().0))
}
}
fn get_devices(&self) -> Vec<Device> {
unsafe {
FromGlibPtrContainer::from_glib_full(ffi::gst_device_provider_get_devices(self.to_glib_none().0))
}
}
fn get_factory(&self) -> Option<DeviceProviderFactory> {
unsafe {
from_glib_none(ffi::gst_device_provider_get_factory(self.to_glib_none().0))
}
}
fn get_hidden_providers(&self) -> Vec<String> {
unsafe {
FromGlibPtrContainer::from_glib_full(ffi::gst_device_provider_get_hidden_providers(self.to_glib_none().0))
}
}
fn hide_provider(&self, name: &str) {
unsafe {
ffi::gst_device_provider_hide_provider(self.to_glib_none().0, name.to_glib_none().0);
}
}
fn start(&self) -> bool {
unsafe {
from_glib(ffi::gst_device_provider_start(self.to_glib_none().0))
}
}
fn stop(&self) {
unsafe {
ffi::gst_device_provider_stop(self.to_glib_none().0);
}
}
fn unhide_provider(&self, name: &str) {
unsafe {
ffi::gst_device_provider_unhide_provider(self.to_glib_none().0, name.to_glib_none().0);
}
}
fn connect_provider_hidden<F: Fn(&Self, &str) + Send + Sync + 'static>(&self, f: F) -> u64 {
unsafe {
let f: Box_<Box_<Fn(&Self, &str) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "provider-hidden",
transmute(provider_hidden_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_provider_unhidden<F: Fn(&Self, &str) + Send + Sync + 'static>(&self, f: F) -> u64 {
unsafe {
let f: Box_<Box_<Fn(&Self, &str) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "provider-unhidden",
transmute(provider_unhidden_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
}
unsafe extern "C" fn provider_hidden_trampoline<P>(this: *mut ffi::GstDeviceProvider, object: *mut libc::c_char, f: glib_ffi::gpointer)
where P: IsA<DeviceProvider> {
callback_guard!();
let f: &Box_<Fn(&P, &str) + Send + Sync + 'static> = transmute(f);
f(&DeviceProvider::from_glib_none(this).downcast_unchecked(), &String::from_glib_none(object))
}
unsafe extern "C" fn provider_unhidden_trampoline<P>(this: *mut ffi::GstDeviceProvider, object: *mut libc::c_char, f: glib_ffi::gpointer)
where P: IsA<DeviceProvider> {
callback_guard!();
let f: &Box_<Fn(&P, &str) + Send + Sync + 'static> = transmute(f);
f(&DeviceProvider::from_glib_none(this).downcast_unchecked(), &String::from_glib_none(object))
}

View file

@ -0,0 +1,92 @@
// This file was generated by gir (33e9567) from gir-files (???)
// DO NOT EDIT
use DeviceProvider;
use Object;
use ffi;
use glib;
use glib::object::IsA;
use glib::translate::*;
glib_wrapper! {
pub struct DeviceProviderFactory(Object<ffi::GstDeviceProviderFactory>): Object;
match fn {
get_type => || ffi::gst_device_provider_factory_get_type(),
}
}
impl DeviceProviderFactory {
pub fn find(name: &str) -> Option<DeviceProviderFactory> {
unsafe {
from_glib_full(ffi::gst_device_provider_factory_find(name.to_glib_none().0))
}
}
pub fn get_by_name(factoryname: &str) -> Option<DeviceProvider> {
unsafe {
from_glib_full(ffi::gst_device_provider_factory_get_by_name(factoryname.to_glib_none().0))
}
}
//pub fn list_get_device_providers(minrank: /*Ignored*/Rank) -> Vec<DeviceProviderFactory> {
// unsafe { TODO: call ffi::gst_device_provider_factory_list_get_device_providers() }
//}
}
unsafe impl Send for DeviceProviderFactory {}
unsafe impl Sync for DeviceProviderFactory {}
pub trait DeviceProviderFactoryExt {
fn get(&self) -> Option<DeviceProvider>;
fn get_device_provider_type(&self) -> glib::types::Type;
fn get_metadata(&self, key: &str) -> Option<String>;
fn get_metadata_keys(&self) -> Vec<String>;
fn has_classes<'a, P: Into<Option<&'a str>>>(&self, classes: P) -> bool;
fn has_classesv(&self, classes: &[&str]) -> bool;
}
impl<O: IsA<DeviceProviderFactory>> DeviceProviderFactoryExt for O {
fn get(&self) -> Option<DeviceProvider> {
unsafe {
from_glib_full(ffi::gst_device_provider_factory_get(self.to_glib_none().0))
}
}
fn get_device_provider_type(&self) -> glib::types::Type {
unsafe {
from_glib(ffi::gst_device_provider_factory_get_device_provider_type(self.to_glib_none().0))
}
}
fn get_metadata(&self, key: &str) -> Option<String> {
unsafe {
from_glib_none(ffi::gst_device_provider_factory_get_metadata(self.to_glib_none().0, key.to_glib_none().0))
}
}
fn get_metadata_keys(&self) -> Vec<String> {
unsafe {
FromGlibPtrContainer::from_glib_full(ffi::gst_device_provider_factory_get_metadata_keys(self.to_glib_none().0))
}
}
fn has_classes<'a, P: Into<Option<&'a str>>>(&self, classes: P) -> bool {
let classes = classes.into();
let classes = classes.to_glib_none();
unsafe {
from_glib(ffi::gst_device_provider_factory_has_classes(self.to_glib_none().0, classes.0))
}
}
fn has_classesv(&self, classes: &[&str]) -> bool {
unsafe {
from_glib(ffi::gst_device_provider_factory_has_classesv(self.to_glib_none().0, classes.to_glib_none().0))
}
}
}

View file

@ -105,13 +105,10 @@ pub trait ElementExt {
fn get_compatible_pad_template(&self, compattempl: &PadTemplate) -> Option<PadTemplate>;
//#[cfg(feature = "v1_8")]
//fn get_context(&self, context_type: &str) -> /*Ignored*/Option<Context>;
//#[cfg(feature = "v1_8")]
//fn get_context_unlocked(&self, context_type: &str) -> /*Ignored*/Option<Context>;
//#[cfg(feature = "v1_8")]
//fn get_contexts(&self) -> /*Ignored*/Vec<Context>;
fn get_factory(&self) -> Option<ElementFactory>;
@ -291,17 +288,14 @@ impl<O: IsA<Element> + IsA<glib::object::Object>> ElementExt for O {
}
}
//#[cfg(feature = "v1_8")]
//fn get_context(&self, context_type: &str) -> /*Ignored*/Option<Context> {
// unsafe { TODO: call ffi::gst_element_get_context() }
//}
//#[cfg(feature = "v1_8")]
//fn get_context_unlocked(&self, context_type: &str) -> /*Ignored*/Option<Context> {
// unsafe { TODO: call ffi::gst_element_get_context_unlocked() }
//}
//#[cfg(feature = "v1_8")]
//fn get_contexts(&self) -> /*Ignored*/Vec<Context> {
// unsafe { TODO: call ffi::gst_element_get_contexts() }
//}

View file

@ -851,6 +851,85 @@ impl ErrorDomain for StreamError {
}
}
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]
pub enum StreamStatusType {
Create,
Enter,
Leave,
Destroy,
Start,
Pause,
Stop,
#[doc(hidden)]
__Unknown(i32),
}
#[doc(hidden)]
impl ToGlib for StreamStatusType {
type GlibType = ffi::GstStreamStatusType;
fn to_glib(&self) -> ffi::GstStreamStatusType {
match *self {
StreamStatusType::Create => ffi::GST_STREAM_STATUS_TYPE_CREATE,
StreamStatusType::Enter => ffi::GST_STREAM_STATUS_TYPE_ENTER,
StreamStatusType::Leave => ffi::GST_STREAM_STATUS_TYPE_LEAVE,
StreamStatusType::Destroy => ffi::GST_STREAM_STATUS_TYPE_DESTROY,
StreamStatusType::Start => ffi::GST_STREAM_STATUS_TYPE_START,
StreamStatusType::Pause => ffi::GST_STREAM_STATUS_TYPE_PAUSE,
StreamStatusType::Stop => ffi::GST_STREAM_STATUS_TYPE_STOP,
StreamStatusType::__Unknown(value) => unsafe{std::mem::transmute(value)}
}
}
}
#[doc(hidden)]
impl FromGlib<ffi::GstStreamStatusType> for StreamStatusType {
fn from_glib(value: ffi::GstStreamStatusType) -> Self {
match value as i32 {
0 => StreamStatusType::Create,
1 => StreamStatusType::Enter,
2 => StreamStatusType::Leave,
3 => StreamStatusType::Destroy,
8 => StreamStatusType::Start,
9 => StreamStatusType::Pause,
10 => StreamStatusType::Stop,
value => StreamStatusType::__Unknown(value),
}
}
}
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]
pub enum StructureChangeType {
Link,
Unlink,
#[doc(hidden)]
__Unknown(i32),
}
#[doc(hidden)]
impl ToGlib for StructureChangeType {
type GlibType = ffi::GstStructureChangeType;
fn to_glib(&self) -> ffi::GstStructureChangeType {
match *self {
StructureChangeType::Link => ffi::GST_STRUCTURE_CHANGE_TYPE_PAD_LINK,
StructureChangeType::Unlink => ffi::GST_STRUCTURE_CHANGE_TYPE_PAD_UNLINK,
StructureChangeType::__Unknown(value) => unsafe{std::mem::transmute(value)}
}
}
}
#[doc(hidden)]
impl FromGlib<ffi::GstStructureChangeType> for StructureChangeType {
fn from_glib(value: ffi::GstStructureChangeType) -> Self {
match value as i32 {
0 => StructureChangeType::Link,
1 => StructureChangeType::Unlink,
value => StructureChangeType::__Unknown(value),
}
}
}
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]
pub enum URIError {
UnsupportedProtocol,

View file

@ -37,3 +37,54 @@ impl FromGlib<ffi::GstSeekFlags> for SeekFlags {
}
}
bitflags! {
pub struct StreamFlags: u32 {
const STREAM_FLAG_NONE = 0;
const STREAM_FLAG_SPARSE = 1;
const STREAM_FLAG_SELECT = 2;
const STREAM_FLAG_UNSELECT = 4;
}
}
#[doc(hidden)]
impl ToGlib for StreamFlags {
type GlibType = ffi::GstStreamFlags;
fn to_glib(&self) -> ffi::GstStreamFlags {
ffi::GstStreamFlags::from_bits_truncate(self.bits())
}
}
#[doc(hidden)]
impl FromGlib<ffi::GstStreamFlags> for StreamFlags {
fn from_glib(value: ffi::GstStreamFlags) -> StreamFlags {
StreamFlags::from_bits_truncate(value.bits())
}
}
bitflags! {
pub struct StreamType: u32 {
const STREAM_TYPE_UNKNOWN = 1;
const STREAM_TYPE_AUDIO = 2;
const STREAM_TYPE_VIDEO = 4;
const STREAM_TYPE_CONTAINER = 8;
const STREAM_TYPE_TEXT = 16;
}
}
#[doc(hidden)]
impl ToGlib for StreamType {
type GlibType = ffi::GstStreamType;
fn to_glib(&self) -> ffi::GstStreamType {
ffi::GstStreamType::from_bits_truncate(self.bits())
}
}
#[doc(hidden)]
impl FromGlib<ffi::GstStreamType> for StreamType {
fn from_glib(value: ffi::GstStreamType) -> StreamType {
StreamType::from_bits_truncate(value.bits())
}
}

View file

@ -59,7 +59,6 @@ pub fn debug_construct_win_color(colorinfo: u32) -> i32 {
// unsafe { TODO: call ffi::gst_debug_get_all_categories() }
//}
//#[cfg(feature = "v1_2")]
//pub fn debug_get_color_mode() -> /*Ignored*/DebugColorMode {
// unsafe { TODO: call ffi::gst_debug_get_color_mode() }
//}
@ -117,12 +116,10 @@ pub fn debug_set_active(active: bool) {
}
}
//#[cfg(feature = "v1_2")]
//pub fn debug_set_color_mode(mode: /*Ignored*/DebugColorMode) {
// unsafe { TODO: call ffi::gst_debug_set_color_mode() }
//}
#[cfg(feature = "v1_2")]
pub fn debug_set_color_mode_from_string(mode: &str) {
unsafe {
ffi::gst_debug_set_color_mode_from_string(mode.to_glib_none().0);
@ -143,7 +140,6 @@ pub fn debug_set_colored(colored: bool) {
// unsafe { TODO: call ffi::gst_debug_set_threshold_for_name() }
//}
#[cfg(feature = "v1_2")]
pub fn debug_set_threshold_from_string(list: &str, reset: bool) {
unsafe {
ffi::gst_debug_set_threshold_from_string(list.to_glib_none().0, reset.to_glib());
@ -194,17 +190,14 @@ pub fn flow_get_name(ret: FlowReturn) -> Option<String> {
// unsafe { TODO: call ffi::gst_formats_contains() }
//}
//#[cfg(feature = "v1_8")]
//pub fn info_strdup_printf(format: &str, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) -> Option<String> {
// unsafe { TODO: call ffi::gst_info_strdup_printf() }
//}
//#[cfg(feature = "v1_8")]
//pub fn info_strdup_vprintf(format: &str, args: /*Unknown conversion*//*Unimplemented*/Unsupported) -> Option<String> {
// unsafe { TODO: call ffi::gst_info_strdup_vprintf() }
//}
//#[cfg(feature = "v1_8")]
//pub fn info_vasprintf(format: &str, args: /*Unknown conversion*//*Unimplemented*/Unsupported) -> (i32, String) {
// unsafe { TODO: call ffi::gst_info_vasprintf() }
//}
@ -311,13 +304,6 @@ pub fn protection_meta_api_get_type() -> glib::types::Type {
}
}
#[cfg(feature = "v1_6")]
pub fn protection_select_system(system_identifiers: &str) -> Option<String> {
unsafe {
from_glib_none(ffi::gst_protection_select_system(system_identifiers.to_glib_none().0))
}
}
pub fn segtrap_is_enabled() -> bool {
unsafe {
from_glib(ffi::gst_segtrap_is_enabled())
@ -607,12 +593,10 @@ pub fn util_uint64_scale_round(val: u64, num: u64, denom: u64) -> u64 {
// unsafe { TODO: call ffi::gst_value_get_double_range_min() }
//}
//#[cfg(feature = "v1_6")]
//pub fn value_get_flagset_flags(value: /*Ignored*/&glib::Value) -> u32 {
// unsafe { TODO: call ffi::gst_value_get_flagset_flags() }
//}
//#[cfg(feature = "v1_6")]
//pub fn value_get_flagset_mask(value: /*Ignored*/&glib::Value) -> u32 {
// unsafe { TODO: call ffi::gst_value_get_flagset_mask() }
//}
@ -701,7 +685,6 @@ pub fn util_uint64_scale_round(val: u64, num: u64, denom: u64) -> u64 {
// unsafe { TODO: call ffi::gst_value_set_double_range() }
//}
//#[cfg(feature = "v1_6")]
//pub fn value_set_flagset(value: /*Ignored*/&mut glib::Value, flags: u32, mask: u32) {
// unsafe { TODO: call ffi::gst_value_set_flagset() }
//}

View file

@ -12,6 +12,22 @@ mod clock;
pub use self::clock::Clock;
pub use self::clock::ClockExt;
mod device;
pub use self::device::Device;
pub use self::device::DeviceExt;
mod device_monitor;
pub use self::device_monitor::DeviceMonitor;
pub use self::device_monitor::DeviceMonitorExt;
mod device_provider;
pub use self::device_provider::DeviceProvider;
pub use self::device_provider::DeviceProviderExt;
mod device_provider_factory;
pub use self::device_provider_factory::DeviceProviderFactory;
pub use self::device_provider_factory::DeviceProviderFactoryExt;
mod element;
pub use self::element::Element;
pub use self::element::ElementExt;
@ -38,6 +54,20 @@ pub use self::pipeline::PipelineExt;
mod plugin;
pub use self::plugin::Plugin;
#[cfg(feature = "v1_10")]
mod stream;
#[cfg(feature = "v1_10")]
pub use self::stream::Stream;
#[cfg(feature = "v1_10")]
pub use self::stream::StreamExt;
#[cfg(feature = "v1_10")]
mod stream_collection;
#[cfg(feature = "v1_10")]
pub use self::stream_collection::StreamCollection;
#[cfg(feature = "v1_10")]
pub use self::stream_collection::StreamCollectionExt;
mod u_r_i_handler;
pub use self::u_r_i_handler::URIHandler;
pub use self::u_r_i_handler::URIHandlerExt;
@ -57,6 +87,8 @@ pub use self::enums::State;
pub use self::enums::StateChange;
pub use self::enums::StateChangeReturn;
pub use self::enums::StreamError;
pub use self::enums::StreamStatusType;
pub use self::enums::StructureChangeType;
pub use self::enums::URIError;
pub use self::enums::URIType;
@ -74,6 +106,17 @@ pub use self::flags::SEEK_FLAG_SNAP_AFTER;
pub use self::flags::SEEK_FLAG_SNAP_NEAREST;
pub use self::flags::SEEK_FLAG_TRICKMODE_KEY_UNITS;
pub use self::flags::SEEK_FLAG_TRICKMODE_NO_AUDIO;
pub use self::flags::StreamFlags;
pub use self::flags::STREAM_FLAG_NONE;
pub use self::flags::STREAM_FLAG_SPARSE;
pub use self::flags::STREAM_FLAG_SELECT;
pub use self::flags::STREAM_FLAG_UNSELECT;
pub use self::flags::StreamType;
pub use self::flags::STREAM_TYPE_UNKNOWN;
pub use self::flags::STREAM_TYPE_AUDIO;
pub use self::flags::STREAM_TYPE_VIDEO;
pub use self::flags::STREAM_TYPE_CONTAINER;
pub use self::flags::STREAM_TYPE_TEXT;
mod alias;
pub use self::alias::ClockTime;
@ -85,10 +128,18 @@ pub mod functions;
pub mod traits {
pub use super::BinExt;
pub use super::ClockExt;
pub use super::DeviceExt;
pub use super::DeviceMonitorExt;
pub use super::DeviceProviderExt;
pub use super::DeviceProviderFactoryExt;
pub use super::ElementExt;
pub use super::ObjectExt;
pub use super::PadExt;
pub use super::PadTemplateExt;
pub use super::PipelineExt;
#[cfg(feature = "v1_10")]
pub use super::StreamExt;
#[cfg(feature = "v1_10")]
pub use super::StreamCollectionExt;
pub use super::URIHandlerExt;
}

View file

@ -66,7 +66,6 @@ pub trait ObjectExt {
fn has_as_ancestor<P: IsA<Object>>(&self, ancestor: &P) -> bool;
#[cfg(feature = "v1_6")]
fn has_as_parent<P: IsA<Object>>(&self, parent: &P) -> bool;
//fn remove_control_binding(&self, binding: /*Ignored*/&ControlBinding) -> bool;
@ -161,7 +160,6 @@ impl<O: IsA<Object>> ObjectExt for O {
}
}
#[cfg(feature = "v1_6")]
fn has_as_parent<P: IsA<Object>>(&self, parent: &P) -> bool {
unsafe {
from_glib(ffi::gst_object_has_as_parent(self.to_glib_none().0, parent.to_glib_none().0))

View file

@ -2,12 +2,13 @@
// DO NOT EDIT
use Element;
#[cfg(feature = "v1_4")]
use FlowReturn;
use Format;
use Object;
use PadDirection;
use PadTemplate;
#[cfg(feature = "v1_10")]
use Stream;
use ffi;
use glib;
use glib::Value;
@ -51,7 +52,6 @@ impl Pad {
}
}
//#[cfg(feature = "v1_4")]
//pub fn link_get_name(ret: /*Ignored*/PadLinkReturn) -> Option<String> {
// unsafe { TODO: call ffi::gst_pad_link_get_name() }
//}
@ -91,7 +91,6 @@ pub trait PadExt {
//fn get_element_private(&self) -> /*Unimplemented*/Option<Fundamental: Pointer>;
#[cfg(feature = "v1_4")]
fn get_last_flow_return(&self) -> FlowReturn;
fn get_offset(&self) -> i64;
@ -108,10 +107,9 @@ pub trait PadExt {
//fn get_sticky_event(&self, event_type: /*Ignored*/EventType, idx: u32) -> /*Ignored*/Option<Event>;
//#[cfg(feature = "v1_10")]
//fn get_stream(&self) -> /*Ignored*/Option<Stream>;
#[cfg(feature = "v1_10")]
fn get_stream(&self) -> Option<Stream>;
#[cfg(feature = "v1_2")]
fn get_stream_id(&self) -> Option<String>;
//#[cfg(feature = "v1_12")]
@ -201,7 +199,6 @@ pub trait PadExt {
//fn set_element_private<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, priv_: P);
//#[cfg(feature = "v1_8")]
//fn set_event_full_function_full<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, event: /*Unknown conversion*//*Unimplemented*/PadEventFullFunction, user_data: P, notify: /*Unknown conversion*//*Unimplemented*/DestroyNotify);
//fn set_event_function_full<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, event: /*Unknown conversion*//*Unimplemented*/PadEventFunction, user_data: P, notify: /*Unknown conversion*//*Unimplemented*/DestroyNotify);
@ -224,7 +221,6 @@ pub trait PadExt {
fn stop_task(&self) -> Result<(), glib::error::BoolError>;
//#[cfg(feature = "v1_2")]
//fn store_sticky_event(&self, event: /*Ignored*/&mut Event) -> FlowReturn;
fn unlink<P: IsA<Pad>>(&self, sinkpad: &P) -> Result<(), glib::error::BoolError>;
@ -313,7 +309,6 @@ impl<O: IsA<Pad> + IsA<glib::object::Object>> PadExt for O {
// unsafe { TODO: call ffi::gst_pad_get_element_private() }
//}
#[cfg(feature = "v1_4")]
fn get_last_flow_return(&self) -> FlowReturn {
unsafe {
from_glib(ffi::gst_pad_get_last_flow_return(self.to_glib_none().0))
@ -356,12 +351,13 @@ impl<O: IsA<Pad> + IsA<glib::object::Object>> PadExt for O {
// unsafe { TODO: call ffi::gst_pad_get_sticky_event() }
//}
//#[cfg(feature = "v1_10")]
//fn get_stream(&self) -> /*Ignored*/Option<Stream> {
// unsafe { TODO: call ffi::gst_pad_get_stream() }
//}
#[cfg(feature = "v1_10")]
fn get_stream(&self) -> Option<Stream> {
unsafe {
from_glib_full(ffi::gst_pad_get_stream(self.to_glib_none().0))
}
}
#[cfg(feature = "v1_2")]
fn get_stream_id(&self) -> Option<String> {
unsafe {
from_glib_full(ffi::gst_pad_get_stream_id(self.to_glib_none().0))
@ -585,7 +581,6 @@ impl<O: IsA<Pad> + IsA<glib::object::Object>> PadExt for O {
// unsafe { TODO: call ffi::gst_pad_set_element_private() }
//}
//#[cfg(feature = "v1_8")]
//fn set_event_full_function_full<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, event: /*Unknown conversion*//*Unimplemented*/PadEventFullFunction, user_data: P, notify: /*Unknown conversion*//*Unimplemented*/DestroyNotify) {
// unsafe { TODO: call ffi::gst_pad_set_event_full_function_full() }
//}
@ -634,7 +629,6 @@ impl<O: IsA<Pad> + IsA<glib::object::Object>> PadExt for O {
}
}
//#[cfg(feature = "v1_2")]
//fn store_sticky_event(&self, event: /*Ignored*/&mut Event) -> FlowReturn {
// unsafe { TODO: call ffi::gst_pad_store_sticky_event() }
//}

View file

@ -39,17 +39,14 @@ pub trait PipelineExt {
fn get_delay(&self) -> ClockTime;
#[cfg(feature = "v1_6")]
fn get_latency(&self) -> ClockTime;
#[cfg(feature = "v1_6")]
fn get_pipeline_clock(&self) -> Option<Clock>;
fn set_auto_flush_bus(&self, auto_flush: bool);
fn set_delay(&self, delay: ClockTime);
#[cfg(feature = "v1_6")]
fn set_latency(&self, latency: ClockTime);
fn use_clock<'a, P: IsA<Clock> + 'a, Q: Into<Option<&'a P>>>(&self, clock: Q);
@ -74,14 +71,12 @@ impl<O: IsA<Pipeline>> PipelineExt for O {
}
}
#[cfg(feature = "v1_6")]
fn get_latency(&self) -> ClockTime {
unsafe {
ffi::gst_pipeline_get_latency(self.to_glib_none().0)
}
}
#[cfg(feature = "v1_6")]
fn get_pipeline_clock(&self) -> Option<Clock> {
unsafe {
from_glib_full(ffi::gst_pipeline_get_pipeline_clock(self.to_glib_none().0))
@ -100,7 +95,6 @@ impl<O: IsA<Pipeline>> PipelineExt for O {
}
}
#[cfg(feature = "v1_6")]
fn set_latency(&self, latency: ClockTime) {
unsafe {
ffi::gst_pipeline_set_latency(self.to_glib_none().0, latency);

View file

@ -0,0 +1,201 @@
// This file was generated by gir (33e9567) from gir-files (???)
// DO NOT EDIT
use Object;
use StreamFlags;
use StreamType;
use ffi;
use glib;
use glib::Value;
use glib::object::IsA;
use glib::translate::*;
use gobject_ffi;
use std::mem::transmute;
glib_wrapper! {
pub struct Stream(Object<ffi::GstStream>): Object;
match fn {
get_type => || ffi::gst_stream_get_type(),
}
}
impl Stream {
//#[cfg(feature = "v1_10")]
//pub fn new<'a, 'b, P: Into<Option<&'a str>>, Q: Into<Option<&'b /*Ignored*/Caps>>>(stream_id: P, caps: Q, type_: StreamType, flags: StreamFlags) -> Stream {
// unsafe { TODO: call ffi::gst_stream_new() }
//}
}
unsafe impl Send for Stream {}
unsafe impl Sync for Stream {}
pub trait StreamExt {
//#[cfg(feature = "v1_10")]
//fn get_caps(&self) -> /*Ignored*/Option<Caps>;
#[cfg(feature = "v1_10")]
fn get_stream_flags(&self) -> StreamFlags;
#[cfg(feature = "v1_10")]
fn get_stream_id(&self) -> Option<String>;
#[cfg(feature = "v1_10")]
fn get_stream_type(&self) -> StreamType;
//#[cfg(feature = "v1_10")]
//fn get_tags(&self) -> /*Ignored*/Option<TagList>;
//#[cfg(feature = "v1_10")]
//fn set_caps<'a, P: Into<Option<&'a /*Ignored*/Caps>>>(&self, caps: P);
#[cfg(feature = "v1_10")]
fn set_stream_flags(&self, flags: StreamFlags);
#[cfg(feature = "v1_10")]
fn set_stream_type(&self, stream_type: StreamType);
//#[cfg(feature = "v1_10")]
//fn set_tags<'a, P: Into<Option<&'a /*Ignored*/TagList>>>(&self, tags: P);
//fn get_property_caps(&self) -> /*Ignored*/Option<Caps>;
//fn set_property_caps(&self, caps: /*Ignored*/Option<&Caps>);
fn get_property_stream_flags(&self) -> StreamFlags;
fn set_property_stream_flags(&self, stream_flags: StreamFlags);
fn get_property_stream_id(&self) -> Option<String>;
fn get_property_stream_type(&self) -> StreamType;
fn set_property_stream_type(&self, stream_type: StreamType);
//fn get_property_tags(&self) -> /*Ignored*/Option<TagList>;
//fn set_property_tags(&self, tags: /*Ignored*/Option<&TagList>);
}
impl<O: IsA<Stream> + IsA<glib::object::Object>> StreamExt for O {
//#[cfg(feature = "v1_10")]
//fn get_caps(&self) -> /*Ignored*/Option<Caps> {
// unsafe { TODO: call ffi::gst_stream_get_caps() }
//}
#[cfg(feature = "v1_10")]
fn get_stream_flags(&self) -> StreamFlags {
unsafe {
from_glib(ffi::gst_stream_get_stream_flags(self.to_glib_none().0))
}
}
#[cfg(feature = "v1_10")]
fn get_stream_id(&self) -> Option<String> {
unsafe {
from_glib_none(ffi::gst_stream_get_stream_id(self.to_glib_none().0))
}
}
#[cfg(feature = "v1_10")]
fn get_stream_type(&self) -> StreamType {
unsafe {
from_glib(ffi::gst_stream_get_stream_type(self.to_glib_none().0))
}
}
//#[cfg(feature = "v1_10")]
//fn get_tags(&self) -> /*Ignored*/Option<TagList> {
// unsafe { TODO: call ffi::gst_stream_get_tags() }
//}
//#[cfg(feature = "v1_10")]
//fn set_caps<'a, P: Into<Option<&'a /*Ignored*/Caps>>>(&self, caps: P) {
// unsafe { TODO: call ffi::gst_stream_set_caps() }
//}
#[cfg(feature = "v1_10")]
fn set_stream_flags(&self, flags: StreamFlags) {
unsafe {
ffi::gst_stream_set_stream_flags(self.to_glib_none().0, flags.to_glib());
}
}
#[cfg(feature = "v1_10")]
fn set_stream_type(&self, stream_type: StreamType) {
unsafe {
ffi::gst_stream_set_stream_type(self.to_glib_none().0, stream_type.to_glib());
}
}
//#[cfg(feature = "v1_10")]
//fn set_tags<'a, P: Into<Option<&'a /*Ignored*/TagList>>>(&self, tags: P) {
// unsafe { TODO: call ffi::gst_stream_set_tags() }
//}
//fn get_property_caps(&self) -> /*Ignored*/Option<Caps> {
// let mut value = Value::from(None::<&/*Ignored*/Caps>);
// unsafe {
// gobject_ffi::g_object_get_property(self.to_glib_none().0, "caps".to_glib_none().0, value.to_glib_none_mut().0);
// }
// value.get()
//}
//fn set_property_caps(&self, caps: /*Ignored*/Option<&Caps>) {
// unsafe {
// gobject_ffi::g_object_set_property(self.to_glib_none().0, "caps".to_glib_none().0, Value::from(caps).to_glib_none().0);
// }
//}
fn get_property_stream_flags(&self) -> StreamFlags {
let mut value = Value::from(&0u32);
unsafe {
gobject_ffi::g_object_get_property(self.to_glib_none().0, "stream-flags".to_glib_none().0, value.to_glib_none_mut().0);
from_glib(transmute(value.get::<u32>().unwrap()))
}
}
fn set_property_stream_flags(&self, stream_flags: StreamFlags) {
let stream_flags = stream_flags.to_glib().bits() as u32;
unsafe {
gobject_ffi::g_object_set_property(self.to_glib_none().0, "stream-flags".to_glib_none().0, Value::from(&stream_flags).to_glib_none().0);
}
}
fn get_property_stream_id(&self) -> Option<String> {
let mut value = Value::from(None::<&str>);
unsafe {
gobject_ffi::g_object_get_property(self.to_glib_none().0, "stream-id".to_glib_none().0, value.to_glib_none_mut().0);
}
value.get()
}
fn get_property_stream_type(&self) -> StreamType {
let mut value = Value::from(&0u32);
unsafe {
gobject_ffi::g_object_get_property(self.to_glib_none().0, "stream-type".to_glib_none().0, value.to_glib_none_mut().0);
from_glib(transmute(value.get::<u32>().unwrap()))
}
}
fn set_property_stream_type(&self, stream_type: StreamType) {
let stream_type = stream_type.to_glib().bits() as u32;
unsafe {
gobject_ffi::g_object_set_property(self.to_glib_none().0, "stream-type".to_glib_none().0, Value::from(&stream_type).to_glib_none().0);
}
}
//fn get_property_tags(&self) -> /*Ignored*/Option<TagList> {
// let mut value = Value::from(None::<&/*Ignored*/TagList>);
// unsafe {
// gobject_ffi::g_object_get_property(self.to_glib_none().0, "tags".to_glib_none().0, value.to_glib_none_mut().0);
// }
// value.get()
//}
//fn set_property_tags(&self, tags: /*Ignored*/Option<&TagList>) {
// unsafe {
// gobject_ffi::g_object_set_property(self.to_glib_none().0, "tags".to_glib_none().0, Value::from(tags).to_glib_none().0);
// }
//}
}

View file

@ -0,0 +1,102 @@
// This file was generated by gir (33e9567) from gir-files (???)
// DO NOT EDIT
use Object;
#[cfg(feature = "v1_10")]
use Stream;
use ffi;
use glib;
use glib::Value;
use glib::object::IsA;
use glib::translate::*;
use gobject_ffi;
glib_wrapper! {
pub struct StreamCollection(Object<ffi::GstStreamCollection>): Object;
match fn {
get_type => || ffi::gst_stream_collection_get_type(),
}
}
impl StreamCollection {
#[cfg(feature = "v1_10")]
pub fn new<'a, P: Into<Option<&'a str>>>(upstream_id: P) -> StreamCollection {
let upstream_id = upstream_id.into();
let upstream_id = upstream_id.to_glib_none();
unsafe {
from_glib_full(ffi::gst_stream_collection_new(upstream_id.0))
}
}
}
unsafe impl Send for StreamCollection {}
unsafe impl Sync for StreamCollection {}
pub trait StreamCollectionExt {
#[cfg(feature = "v1_10")]
fn add_stream(&self, stream: &Stream) -> bool;
#[cfg(feature = "v1_10")]
fn get_size(&self) -> u32;
#[cfg(feature = "v1_10")]
fn get_stream(&self, index: u32) -> Option<Stream>;
#[cfg(feature = "v1_10")]
fn get_upstream_id(&self) -> Option<String>;
fn get_property_upstream_id(&self) -> Option<String>;
fn set_property_upstream_id(&self, upstream_id: Option<&str>);
//fn connect_stream_notify<Unsupported or ignored types>(&self, f: F) -> u64;
}
impl<O: IsA<StreamCollection> + IsA<glib::object::Object>> StreamCollectionExt for O {
#[cfg(feature = "v1_10")]
fn add_stream(&self, stream: &Stream) -> bool {
unsafe {
from_glib(ffi::gst_stream_collection_add_stream(self.to_glib_none().0, stream.to_glib_full()))
}
}
#[cfg(feature = "v1_10")]
fn get_size(&self) -> u32 {
unsafe {
ffi::gst_stream_collection_get_size(self.to_glib_none().0)
}
}
#[cfg(feature = "v1_10")]
fn get_stream(&self, index: u32) -> Option<Stream> {
unsafe {
from_glib_none(ffi::gst_stream_collection_get_stream(self.to_glib_none().0, index))
}
}
#[cfg(feature = "v1_10")]
fn get_upstream_id(&self) -> Option<String> {
unsafe {
from_glib_none(ffi::gst_stream_collection_get_upstream_id(self.to_glib_none().0))
}
}
fn get_property_upstream_id(&self) -> Option<String> {
let mut value = Value::from(None::<&str>);
unsafe {
gobject_ffi::g_object_get_property(self.to_glib_none().0, "upstream-id".to_glib_none().0, value.to_glib_none_mut().0);
}
value.get()
}
fn set_property_upstream_id(&self, upstream_id: Option<&str>) {
unsafe {
gobject_ffi::g_object_set_property(self.to_glib_none().0, "upstream-id".to_glib_none().0, Value::from(upstream_id).to_glib_none().0);
}
}
//fn connect_stream_notify<Unsupported or ignored types>(&self, f: F) -> u64 {
// Ignored p0: GObject.ParamSpec
//}
}

View file

@ -8,12 +8,16 @@
use ffi;
use Object;
use Element;
use miniobject::*;
use std::ptr;
use std::mem;
use std::ffi::CStr;
use glib;
use glib::translate::{from_glib, from_glib_none, from_glib_full};
use glib_ffi;
use glib::translate::{from_glib, from_glib_none, from_glib_full, ToGlibPtr};
#[repr(C)]
pub struct MessageImpl(ffi::GstMessage);
@ -247,53 +251,469 @@ impl<'a> Tag<'a> {
pub struct Buffering<'a>(&'a MessageImpl);
impl<'a> Buffering<'a> {
pub fn get_percent(&self) -> i32 {
let mut p = 0;
unsafe {
let mut p = mem::uninitialized();
ffi::gst_message_parse_buffering(self.0.as_mut_ptr(), &mut p);
p
}
p
}
pub fn get_buffering_stats(&self) -> (::BufferingMode, i32, i32, i64) {
let mut mode = ffi::GstBufferingMode::Stream;
let mut avg_in = 0;
let mut avg_out = 0;
let mut buffering_left = 0;
unsafe {
ffi::gst_message_parse_buffering_stats(self.0.as_mut_ptr(), &mut mode, &mut avg_in, &mut avg_out, &mut buffering_left);
}
let mut mode = mem::uninitialized();
let mut avg_in = mem::uninitialized();
let mut avg_out = mem::uninitialized();
let mut buffering_left = mem::uninitialized();
(from_glib(mode), avg_in, avg_out, buffering_left)
ffi::gst_message_parse_buffering_stats(self.0.as_mut_ptr(), &mut mode, &mut avg_in, &mut avg_out, &mut buffering_left);
(from_glib(mode), avg_in, avg_out, buffering_left)
}
}
}
pub struct StateChanged<'a>(&'a MessageImpl);
impl<'a> StateChanged<'a> {
pub fn get_old(&self) -> ::State {
unsafe {
let mut state = mem::uninitialized();
ffi::gst_message_parse_state_changed(self.0.as_mut_ptr(), &mut state, ptr::null_mut(), ptr::null_mut());
from_glib(state)
}
}
pub fn get_current(&self) -> ::State {
unsafe {
let mut state = mem::uninitialized();
ffi::gst_message_parse_state_changed(self.0.as_mut_ptr(), ptr::null_mut(), &mut state, ptr::null_mut());
from_glib(state)
}
}
pub fn get_pending(&self) -> ::State {
unsafe {
let mut state = mem::uninitialized();
ffi::gst_message_parse_state_changed(self.0.as_mut_ptr(), ptr::null_mut(), ptr::null_mut(), &mut state);
from_glib(state)
}
}
}
pub struct StepDone<'a>(&'a MessageImpl);
impl<'a> StepDone<'a> {
pub fn get(&self) -> (::Format, u64, f64, bool, bool, u64, bool) {
unsafe {
let mut format = mem::uninitialized();
let mut amount = mem::uninitialized();
let mut rate = mem::uninitialized();
let mut flush = mem::uninitialized();
let mut intermediate = mem::uninitialized();
let mut duration = mem::uninitialized();
let mut eos = mem::uninitialized();
ffi::gst_message_parse_step_done(self.0.as_mut_ptr(), &mut format, &mut amount, &mut rate, &mut flush, &mut intermediate, &mut duration, &mut eos);
(from_glib(format), amount, rate, from_glib(flush), from_glib(intermediate), duration, from_glib(eos))
}
}
}
pub struct ClockProvide<'a>(&'a MessageImpl);
impl<'a> ClockProvide<'a> {
pub fn get_clock(&self) -> Option<::Clock> {
let mut clock = ptr::null_mut();
unsafe {
ffi::gst_message_parse_clock_provide(self.0.as_mut_ptr(), &mut clock, ptr::null_mut());
from_glib_none(clock)
}
}
pub fn get_ready(&self) -> bool {
unsafe {
let mut ready = mem::uninitialized();
ffi::gst_message_parse_clock_provide(self.0.as_mut_ptr(), ptr::null_mut(), &mut ready);
from_glib(ready)
}
}
}
pub struct ClockLost<'a>(&'a MessageImpl);
impl<'a> ClockLost<'a> {
pub fn get_clock(&self) -> Option<::Clock> {
let mut clock = ptr::null_mut();
unsafe {
ffi::gst_message_parse_clock_lost(self.0.as_mut_ptr(), &mut clock);
from_glib_none(clock)
}
}
}
pub struct NewClock<'a>(&'a MessageImpl);
impl<'a> NewClock<'a> {
pub fn get_clock(&self) -> Option<::Clock> {
let mut clock = ptr::null_mut();
unsafe {
ffi::gst_message_parse_new_clock(self.0.as_mut_ptr(), &mut clock);
from_glib_none(clock)
}
}
}
pub struct StructureChange<'a>(&'a MessageImpl);
impl<'a> StructureChange<'a> {
pub fn get(&self) -> (::StructureChangeType, Option<Element>, bool) {
unsafe {
let mut type_ = mem::uninitialized();
let mut owner = ptr::null_mut();
let mut busy = mem::uninitialized();
ffi::gst_message_parse_structure_change(self.0.as_mut_ptr(), &mut type_, &mut owner, &mut busy);
(from_glib(type_), from_glib_none(owner), from_glib(busy))
}
}
}
pub struct StreamStatus<'a>(&'a MessageImpl);
impl<'a> StreamStatus<'a> {
pub fn get(&self) -> (::StreamStatusType, Option<Element>) {
unsafe {
let mut type_ = mem::uninitialized();
let mut owner = ptr::null_mut();
ffi::gst_message_parse_stream_status(self.0.as_mut_ptr(), &mut type_, &mut owner);
(from_glib(type_), from_glib_none(owner))
}
}
pub fn get_stream_status_object(&self) -> Option<glib::Value> {
unsafe {
let value = ffi::gst_message_get_stream_status_object(self.0.as_mut_ptr());
from_glib_none(value)
}
}
}
pub struct SegmentStart<'a>(&'a MessageImpl);
impl<'a> SegmentStart<'a> {
pub fn get(&self) -> (::Format, i64) {
unsafe {
let mut format = mem::uninitialized();
let mut position = mem::uninitialized();
ffi::gst_message_parse_segment_start(self.0.as_mut_ptr(), &mut format, &mut position);
(from_glib(format), position)
}
}
}
pub struct SegmentDone<'a>(&'a MessageImpl);
impl<'a> SegmentDone<'a> {
pub fn get(&self) -> (::Format, i64) {
unsafe {
let mut format = mem::uninitialized();
let mut position = mem::uninitialized();
ffi::gst_message_parse_segment_done(self.0.as_mut_ptr(), &mut format, &mut position);
(from_glib(format), position)
}
}
}
pub struct AsyncDone<'a>(&'a MessageImpl);
impl<'a> AsyncDone<'a> {
pub fn get_running_time(&self) -> u64 {
unsafe {
let mut running_time = mem::uninitialized();
ffi::gst_message_parse_async_done(self.0.as_mut_ptr(), &mut running_time);
running_time
}
}
}
pub struct RequestState<'a>(&'a MessageImpl);
impl<'a> RequestState<'a> {
pub fn get_requested_state(&self) -> ::State {
unsafe {
let mut state = mem::uninitialized();
ffi::gst_message_parse_request_state(self.0.as_mut_ptr(), &mut state);
from_glib(state)
}
}
}
pub struct StepStart<'a>(&'a MessageImpl);
impl<'a> StepStart<'a> {
pub fn get(&self) -> (bool, ::Format, u64, f64, bool, bool) {
unsafe {
let mut active = mem::uninitialized();
let mut format = mem::uninitialized();
let mut amount = mem::uninitialized();
let mut rate = mem::uninitialized();
let mut flush = mem::uninitialized();
let mut intermediate = mem::uninitialized();
ffi::gst_message_parse_step_start(self.0.as_mut_ptr(), &mut active, &mut format, &mut amount, &mut rate, &mut flush, &mut intermediate);
(from_glib(active), from_glib(format), amount, rate, from_glib(flush), from_glib(intermediate))
}
}
}
pub struct Qos<'a>(&'a MessageImpl);
impl<'a> Qos<'a> {
pub fn get(&self) -> (bool, u64, u64, u64, u64) {
unsafe {
let mut live = mem::uninitialized();
let mut running_time = mem::uninitialized();
let mut stream_time = mem::uninitialized();
let mut timestamp = mem::uninitialized();
let mut duration = mem::uninitialized();
ffi::gst_message_parse_qos(self.0.as_mut_ptr(), &mut live, &mut running_time, &mut stream_time, &mut timestamp, &mut duration);
(from_glib(live), running_time, stream_time, timestamp, duration)
}
}
pub fn get_values(&self) -> (i64, f64, i32) {
unsafe {
let mut jitter = mem::uninitialized();
let mut proportion = mem::uninitialized();
let mut quality = mem::uninitialized();
ffi::gst_message_parse_qos_values(self.0.as_mut_ptr(), &mut jitter, &mut proportion, &mut quality);
(jitter, proportion, quality)
}
}
pub fn get_stats(&self) -> (::Format, u64, u64) {
unsafe {
let mut format = mem::uninitialized();
let mut processed = mem::uninitialized();
let mut dropped = mem::uninitialized();
ffi::gst_message_parse_qos_stats(self.0.as_mut_ptr(), &mut format, &mut processed, &mut dropped);
(from_glib(format), processed, dropped)
}
}
}
pub struct Progress<'a>(&'a MessageImpl);
pub struct Toc<'a>(&'a MessageImpl);
impl<'a> Toc<'a> {
// TODO get_toc()
}
pub struct ResetTime<'a>(&'a MessageImpl);
impl<'a> ResetTime<'a> {
pub fn get_running_time(&self) -> u64 {
unsafe {
let mut running_time = mem::uninitialized();
ffi::gst_message_parse_reset_time(self.0.as_mut_ptr(), &mut running_time);
running_time
}
}
}
pub struct StreamStart<'a>(&'a MessageImpl);
impl<'a> StreamStart<'a> {
pub fn get_group_id(&self) -> Option<u32> {
unsafe {
let mut group_id = mem::uninitialized();
if from_glib(ffi::gst_message_parse_group_id(self.0.as_mut_ptr(), &mut group_id)) {
Some(group_id)
} else {
None
}
}
}
}
pub struct NeedContext<'a>(&'a MessageImpl);
impl<'a> NeedContext<'a> {
pub fn get_context_type(&self) -> Option<&str> {
unsafe {
let mut context_type = ptr::null();
if from_glib(ffi::gst_message_parse_context_type(self.0.as_mut_ptr(), &mut context_type)) && !context_type.is_null() {
Some(CStr::from_ptr(context_type).to_str().unwrap())
} else {
None
}
}
}
}
pub struct HaveContext<'a>(&'a MessageImpl);
impl<'a> HaveContext<'a> {
// TODO: get_context()
}
pub struct DeviceAdded<'a>(&'a MessageImpl);
impl<'a> DeviceAdded<'a> {
pub fn get_device(&self) -> ::Device {
unsafe {
let mut device = ptr::null_mut();
ffi::gst_message_parse_device_added(self.0.as_mut_ptr(), &mut device);
from_glib_none(device)
}
}
}
pub struct DeviceRemoved<'a>(&'a MessageImpl);
impl<'a> DeviceRemoved<'a> {
pub fn get_device(&self) -> ::Device {
unsafe {
let mut device = ptr::null_mut();
ffi::gst_message_parse_device_removed(self.0.as_mut_ptr(), &mut device);
from_glib_none(device)
}
}
}
pub struct PropertyNotify<'a>(&'a MessageImpl);
impl<'a> PropertyNotify<'a> {
#[cfg(feature = "v1_10")]
pub fn get(&self) -> (Object, &str, ::Value) {
unsafe {
let mut object = ptr::null_mut();
let mut property_name = ptr::null();
let mut value = ptr::null();
ffi::gst_message_parse_property_notify(self.0.as_mut_ptr(), &mut object, &mut property_name, &mut value);
(from_glib_none(object), CStr::from_ptr(property_name).to_str().unwrap(), from_glib_none(value))
}
}
}
pub struct StreamCollection<'a>(&'a MessageImpl);
impl<'a> StreamCollection<'a> {
#[cfg(feature = "v1_10")]
pub fn get_stream_collection(&self) -> ::StreamCollection {
unsafe {
let mut collection = ptr::null_mut();
ffi::gst_message_parse_stream_selection(self.0.as_mut_ptr(), &mut collection);
from_glib_full(collection)
}
}
}
pub struct StreamsSelected<'a>(&'a MessageImpl);
impl<'a> StreamsSelected<'a> {
#[cfg(feature = "v1_10")]
pub fn get_stream_collection(&self) -> ::StreamCollection {
unsafe {
let mut collection = ptr::null_mut();
ffi::gst_message_parse_streams_selected(self.0.as_mut_ptr(), &mut collection);
from_glib_full(collection)
}
}
#[cfg(feature = "v1_10")]
pub fn get_streams(&self) -> Vec<::Stream> {
unsafe {
let n = ffi::gst_message_streams_selected_get_size(self.0.as_mut_ptr());
(0..n).map(|i| from_glib_full(ffi::gst_message_streams_selected_get_stream(self.0.as_mut_ptr(), i))).collect()
}
}
}
pub struct Redirect<'a>(&'a MessageImpl);
impl<'a> StreamsSelected<'a> {
// TODO: tags, structure
#[cfg(feature = "v1_10")]
pub fn get_entries(&self) -> Vec<&str> {
unsafe {
let n = ffi::gst_message_num_redirect_entries(self.0.as_mut_ptr());
(0..n).map(|i| {
let mut location = ptr::null();
ffi::gst_message_parse_redirect_entry(self.0.as_mut_ptr(), &mut location, ptr::null_mut(), ptr::null_mut());
CStr::from_ptr(location).to_str().unwrap()
}).collect()
}
}
}
pub struct EosBuilder {
src: Option<Object>,
seqnum: Option<u32>,
}
impl EosBuilder {
pub fn new() -> EosBuilder {
EosBuilder {
src: None,
seqnum: None,
}
}
pub fn src(self, src: Option<Object>) -> EosBuilder {
EosBuilder {
src: src,
.. self
}
}
pub fn seqnum(self, seqnum: u32) -> EosBuilder {
EosBuilder {
seqnum: Some(seqnum),
.. self
}
}
pub fn build(self) -> Message {
unsafe {
let msg = ffi::gst_message_new_eos(self.src.to_glib_none().0);
if let Some(seqnum) = self.seqnum {
ffi::gst_message_set_seqnum(msg, seqnum);
}
from_glib_full(msg)
}
}
}
impl glib::types::StaticType for GstRc<MessageImpl> {
fn static_type() -> glib::types::Type {