Add gstreamer-controller

This commit is contained in:
Alexey Galakhov 2020-06-09 03:06:49 +02:00 committed by Sebastian Dröge
parent 8ff3cdde7e
commit 4120ded424
29 changed files with 3163 additions and 41 deletions

View file

@ -5,6 +5,7 @@ members = [
"gstreamer-app",
"gstreamer-audio",
"gstreamer-base",
"gstreamer-controller",
"gstreamer-net",
"gstreamer-player",
"gstreamer-rtsp",

View file

@ -64,6 +64,7 @@ manual = [
"Gst.Segment",
"Gst.StaticCaps",
"Gst.StaticPadTemplate",
"GObject.Value",
]
[[object]]
@ -201,6 +202,12 @@ status = "generate"
name = "Gst.ChildProxy"
status = "generate"
manual_traits = ["ChildProxyExtManual"]
[[object.function]]
name = "get_property"
ignore = true
[[object.function]]
name = "set_property"
ignore = true
[[object]]
name = "Gst.ClockTime"
@ -267,6 +274,9 @@ status = "generate"
name = "Gst.TagSetter"
status = "generate"
manual_traits = ["TagSetterExtManual"]
[[object.function]]
name = "add_tag_value"
ignore = true
[[object]]
name = "Gst.TocScope"
@ -816,6 +826,15 @@ trait_name = "GstObjectExt"
[object.function.return]
bool_return_is_error = "Failed to sync values"
[[object.function]]
name = "get_g_value_array"
ignore = true
[[object.function]]
name = "add_control_binding"
[object.function.return]
bool_return_is_error = "Failed to add control binding"
[[object]]
name = "Gst.ObjectFlags"
status = "generate"
@ -1778,3 +1797,25 @@ status = "generate"
name = "to_iso8601_string"
[object.function.return]
nullable_return_is_error = "Failed to create ISO-8601 string from DateTime"
[[object]]
name = "Gst.ControlSource"
status = "generate"
manual_traits = ["ControlSourceExtManual"]
generate_builder = true
[[object.function]]
name = "control_source_get_value"
rename = "get_value"
[[object.function]]
name = "control_source_get_value_array"
ignore = true
[[object]]
name = "Gst.ControlBinding"
status = "generate"
manual_traits = ["ControlBindingExtManual"]
generate_builder = true
[[object.function]]
name = "get_g_value_array"
ignore = true

45
Gir_GstController.toml Normal file
View file

@ -0,0 +1,45 @@
[options]
girs_dir = "gir-files"
library = "GstController"
version = "1.0"
min_cfg_version = "1.8"
target_path = "gstreamer-controller"
work_mode = "normal"
concurrency = "send+sync"
generate_safety_asserts = true
single_version_file = true
doc_target_path = "docs/gstreamer-controller/docs.md"
generate_display_trait = false
external_libraries = [
"GLib",
"GObject",
"Gst",
]
generate = [
"GstController.ARGBControlBinding",
"GstController.DirectControlBinding",
"GstController.InterpolationControlSource",
"GstController.LFOControlSource",
"GstController.ProxyControlBinding",
"GstController.TimedValueControlSource",
"GstController.TriggerControlSource",
"GstController.DirectControlBindingConvertValue",
"GstController.DirectControlBindingConvertGValue",
"GstController.LFOWaveform",
"GstController.InterpolationMode",
]
manual = [
"Gst.Object",
"Gst.ControlBinding",
"Gst.ControlSource",
"GstController.ControlPoint",
]
[[object]]
name = "Gst.ClockTime"
status = "manual"
conversion_type = "scalar"

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,41 @@
[package]
name = "gstreamer-controller"
version = "0.17.0"
authors = ["Alexey Galakhov <agalakhov@gmail.com>", "Sebastian Dröge <sebastian@centricular.com>"]
categories = ["api-bindings", "multimedia"]
description = "Rust bindings for GStreamer Controller library"
repository = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs"
license = "MIT/Apache-2.0"
readme = "README.md"
homepage = "https://gstreamer.freedesktop.org"
documentation = "https://gstreamer.pages.freedesktop.org/gstreamer-rs/gstreamer_controller/"
keywords = ["gstreamer", "multimedia", "audio", "video", "gnome"]
build = "build.rs"
[dependencies]
bitflags = "1.0"
once_cell = "1.0"
glib-sys = { git = "https://github.com/gtk-rs/sys" }
gobject-sys = { git = "https://github.com/gtk-rs/sys" }
gstreamer-sys = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs-sys", features = ["v1_8"] }
gstreamer-controller-sys = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs-sys", features = ["v1_8"] }
glib = { git = "https://github.com/gtk-rs/glib" }
gstreamer = { path = "../gstreamer" }
[build-dependencies.rustdoc-stripper]
version = "0.1"
optional = true
[features]
default = []
v1_10 = ["gstreamer/v1_10", "gstreamer-controller-sys/v1_10"]
v1_12 = ["gstreamer/v1_12", "gstreamer-controller-sys/v1_12", "v1_10"]
v1_14 = ["gstreamer/v1_14", "gstreamer-controller-sys/v1_14", "v1_12"]
v1_16 = ["gstreamer/v1_16", "gstreamer-controller-sys/v1_16", "v1_14"]
v1_18 = ["gstreamer/v1_18", "gstreamer-controller-sys/v1_18", "v1_16"]
embed-lgpl-docs = ["rustdoc-stripper"]
purge-lgpl-docs = ["rustdoc-stripper"]
dox = ["v1_18", "gstreamer-controller-sys/dox", "glib/dox", "gstreamer/dox"]
[package.metadata.docs.rs]
dox = ["v1_18", "gstreamer-controller-sys/dox", "glib/dox", "gstreamer/dox"]

View file

@ -0,0 +1,23 @@
fn main() {
manage_docs();
}
#[cfg(all(
any(feature = "embed-lgpl-docs", feature = "purge-lgpl-docs"),
not(all(feature = "embed-lgpl-docs", feature = "purge-lgpl-docs"))
))]
fn manage_docs() {
extern crate lgpl_docs;
const PATH: &str = "src";
const IGNORES: &[&str] = &[];
lgpl_docs::purge(PATH, IGNORES);
if cfg!(feature = "embed-lgpl-docs") {
lgpl_docs::embed(lgpl_docs::Library::GstController, PATH, IGNORES);
}
}
#[cfg(any(
all(feature = "embed-lgpl-docs", feature = "purge-lgpl-docs"),
not(any(feature = "embed-lgpl-docs", feature = "purge-lgpl-docs"))
))]
fn manage_docs() {}

View file

@ -0,0 +1,341 @@
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT
use glib::object::Cast;
use glib::object::IsA;
use glib::signal::connect_raw;
use glib::signal::SignalHandlerId;
use glib::translate::*;
use glib::value::SetValueOptional;
use glib::StaticType;
use glib::Value;
use glib_sys;
use gobject_sys;
use gst;
use gst_controller_sys;
use std::boxed::Box as Box_;
use std::mem::transmute;
glib_wrapper! {
pub struct ARGBControlBinding(Object<gst_controller_sys::GstARGBControlBinding, gst_controller_sys::GstARGBControlBindingClass, ARGBControlBindingClass>) @extends gst::ControlBinding, gst::Object;
match fn {
get_type => || gst_controller_sys::gst_argb_control_binding_get_type(),
}
}
impl ARGBControlBinding {
pub fn new<
P: IsA<gst::Object>,
Q: IsA<gst::ControlSource>,
R: IsA<gst::ControlSource>,
S: IsA<gst::ControlSource>,
T: IsA<gst::ControlSource>,
>(
object: &P,
property_name: &str,
cs_a: &Q,
cs_r: &R,
cs_g: &S,
cs_b: &T,
) -> ARGBControlBinding {
assert_initialized_main_thread!();
unsafe {
gst::ControlBinding::from_glib_none(gst_controller_sys::gst_argb_control_binding_new(
object.as_ref().to_glib_none().0,
property_name.to_glib_none().0,
cs_a.as_ref().to_glib_none().0,
cs_r.as_ref().to_glib_none().0,
cs_g.as_ref().to_glib_none().0,
cs_b.as_ref().to_glib_none().0,
))
.unsafe_cast()
}
}
}
unsafe impl Send for ARGBControlBinding {}
unsafe impl Sync for ARGBControlBinding {}
pub const NONE_ARGB_CONTROL_BINDING: Option<&ARGBControlBinding> = None;
pub trait ARGBControlBindingExt: 'static {
fn get_property_control_source_a(&self) -> Option<gst::ControlSource>;
fn set_property_control_source_a<P: IsA<gst::ControlSource> + SetValueOptional>(
&self,
control_source_a: Option<&P>,
);
fn get_property_control_source_b(&self) -> Option<gst::ControlSource>;
fn set_property_control_source_b<P: IsA<gst::ControlSource> + SetValueOptional>(
&self,
control_source_b: Option<&P>,
);
fn get_property_control_source_g(&self) -> Option<gst::ControlSource>;
fn set_property_control_source_g<P: IsA<gst::ControlSource> + SetValueOptional>(
&self,
control_source_g: Option<&P>,
);
fn get_property_control_source_r(&self) -> Option<gst::ControlSource>;
fn set_property_control_source_r<P: IsA<gst::ControlSource> + SetValueOptional>(
&self,
control_source_r: Option<&P>,
);
fn connect_property_control_source_a_notify<F: Fn(&Self) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId;
fn connect_property_control_source_b_notify<F: Fn(&Self) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId;
fn connect_property_control_source_g_notify<F: Fn(&Self) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId;
fn connect_property_control_source_r_notify<F: Fn(&Self) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId;
}
impl<O: IsA<ARGBControlBinding>> ARGBControlBindingExt for O {
fn get_property_control_source_a(&self) -> Option<gst::ControlSource> {
unsafe {
let mut value = Value::from_type(<gst::ControlSource as StaticType>::static_type());
gobject_sys::g_object_get_property(
self.to_glib_none().0 as *mut gobject_sys::GObject,
b"control-source-a\0".as_ptr() as *const _,
value.to_glib_none_mut().0,
);
value
.get()
.expect("Return Value for property `control-source-a` getter")
}
}
fn set_property_control_source_a<P: IsA<gst::ControlSource> + SetValueOptional>(
&self,
control_source_a: Option<&P>,
) {
unsafe {
gobject_sys::g_object_set_property(
self.to_glib_none().0 as *mut gobject_sys::GObject,
b"control-source-a\0".as_ptr() as *const _,
Value::from(control_source_a).to_glib_none().0,
);
}
}
fn get_property_control_source_b(&self) -> Option<gst::ControlSource> {
unsafe {
let mut value = Value::from_type(<gst::ControlSource as StaticType>::static_type());
gobject_sys::g_object_get_property(
self.to_glib_none().0 as *mut gobject_sys::GObject,
b"control-source-b\0".as_ptr() as *const _,
value.to_glib_none_mut().0,
);
value
.get()
.expect("Return Value for property `control-source-b` getter")
}
}
fn set_property_control_source_b<P: IsA<gst::ControlSource> + SetValueOptional>(
&self,
control_source_b: Option<&P>,
) {
unsafe {
gobject_sys::g_object_set_property(
self.to_glib_none().0 as *mut gobject_sys::GObject,
b"control-source-b\0".as_ptr() as *const _,
Value::from(control_source_b).to_glib_none().0,
);
}
}
fn get_property_control_source_g(&self) -> Option<gst::ControlSource> {
unsafe {
let mut value = Value::from_type(<gst::ControlSource as StaticType>::static_type());
gobject_sys::g_object_get_property(
self.to_glib_none().0 as *mut gobject_sys::GObject,
b"control-source-g\0".as_ptr() as *const _,
value.to_glib_none_mut().0,
);
value
.get()
.expect("Return Value for property `control-source-g` getter")
}
}
fn set_property_control_source_g<P: IsA<gst::ControlSource> + SetValueOptional>(
&self,
control_source_g: Option<&P>,
) {
unsafe {
gobject_sys::g_object_set_property(
self.to_glib_none().0 as *mut gobject_sys::GObject,
b"control-source-g\0".as_ptr() as *const _,
Value::from(control_source_g).to_glib_none().0,
);
}
}
fn get_property_control_source_r(&self) -> Option<gst::ControlSource> {
unsafe {
let mut value = Value::from_type(<gst::ControlSource as StaticType>::static_type());
gobject_sys::g_object_get_property(
self.to_glib_none().0 as *mut gobject_sys::GObject,
b"control-source-r\0".as_ptr() as *const _,
value.to_glib_none_mut().0,
);
value
.get()
.expect("Return Value for property `control-source-r` getter")
}
}
fn set_property_control_source_r<P: IsA<gst::ControlSource> + SetValueOptional>(
&self,
control_source_r: Option<&P>,
) {
unsafe {
gobject_sys::g_object_set_property(
self.to_glib_none().0 as *mut gobject_sys::GObject,
b"control-source-r\0".as_ptr() as *const _,
Value::from(control_source_r).to_glib_none().0,
);
}
}
fn connect_property_control_source_a_notify<F: Fn(&Self) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId {
unsafe extern "C" fn notify_control_source_a_trampoline<
P,
F: Fn(&P) + Send + Sync + 'static,
>(
this: *mut gst_controller_sys::GstARGBControlBinding,
_param_spec: glib_sys::gpointer,
f: glib_sys::gpointer,
) where
P: IsA<ARGBControlBinding>,
{
let f: &F = &*(f as *const F);
f(&ARGBControlBinding::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::control-source-a\0".as_ptr() as *const _,
Some(transmute::<_, unsafe extern "C" fn()>(
notify_control_source_a_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
fn connect_property_control_source_b_notify<F: Fn(&Self) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId {
unsafe extern "C" fn notify_control_source_b_trampoline<
P,
F: Fn(&P) + Send + Sync + 'static,
>(
this: *mut gst_controller_sys::GstARGBControlBinding,
_param_spec: glib_sys::gpointer,
f: glib_sys::gpointer,
) where
P: IsA<ARGBControlBinding>,
{
let f: &F = &*(f as *const F);
f(&ARGBControlBinding::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::control-source-b\0".as_ptr() as *const _,
Some(transmute::<_, unsafe extern "C" fn()>(
notify_control_source_b_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
fn connect_property_control_source_g_notify<F: Fn(&Self) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId {
unsafe extern "C" fn notify_control_source_g_trampoline<
P,
F: Fn(&P) + Send + Sync + 'static,
>(
this: *mut gst_controller_sys::GstARGBControlBinding,
_param_spec: glib_sys::gpointer,
f: glib_sys::gpointer,
) where
P: IsA<ARGBControlBinding>,
{
let f: &F = &*(f as *const F);
f(&ARGBControlBinding::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::control-source-g\0".as_ptr() as *const _,
Some(transmute::<_, unsafe extern "C" fn()>(
notify_control_source_g_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
fn connect_property_control_source_r_notify<F: Fn(&Self) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId {
unsafe extern "C" fn notify_control_source_r_trampoline<
P,
F: Fn(&P) + Send + Sync + 'static,
>(
this: *mut gst_controller_sys::GstARGBControlBinding,
_param_spec: glib_sys::gpointer,
f: glib_sys::gpointer,
) where
P: IsA<ARGBControlBinding>,
{
let f: &F = &*(f as *const F);
f(&ARGBControlBinding::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::control-source-r\0".as_ptr() as *const _,
Some(transmute::<_, unsafe extern "C" fn()>(
notify_control_source_r_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
}

View file

@ -0,0 +1,157 @@
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT
use glib::object::Cast;
use glib::object::IsA;
use glib::signal::connect_raw;
use glib::signal::SignalHandlerId;
use glib::translate::*;
use glib::value::SetValueOptional;
use glib::StaticType;
use glib::Value;
use glib_sys;
use gobject_sys;
use gst;
use gst_controller_sys;
use std::boxed::Box as Box_;
use std::mem::transmute;
glib_wrapper! {
pub struct DirectControlBinding(Object<gst_controller_sys::GstDirectControlBinding, gst_controller_sys::GstDirectControlBindingClass, DirectControlBindingClass>) @extends gst::ControlBinding, gst::Object;
match fn {
get_type => || gst_controller_sys::gst_direct_control_binding_get_type(),
}
}
impl DirectControlBinding {
pub fn new<P: IsA<gst::Object>, Q: IsA<gst::ControlSource>>(
object: &P,
property_name: &str,
cs: &Q,
) -> DirectControlBinding {
assert_initialized_main_thread!();
unsafe {
gst::ControlBinding::from_glib_none(gst_controller_sys::gst_direct_control_binding_new(
object.as_ref().to_glib_none().0,
property_name.to_glib_none().0,
cs.as_ref().to_glib_none().0,
))
.unsafe_cast()
}
}
pub fn new_absolute<P: IsA<gst::Object>, Q: IsA<gst::ControlSource>>(
object: &P,
property_name: &str,
cs: &Q,
) -> DirectControlBinding {
assert_initialized_main_thread!();
unsafe {
gst::ControlBinding::from_glib_none(
gst_controller_sys::gst_direct_control_binding_new_absolute(
object.as_ref().to_glib_none().0,
property_name.to_glib_none().0,
cs.as_ref().to_glib_none().0,
),
)
.unsafe_cast()
}
}
}
unsafe impl Send for DirectControlBinding {}
unsafe impl Sync for DirectControlBinding {}
pub const NONE_DIRECT_CONTROL_BINDING: Option<&DirectControlBinding> = None;
pub trait DirectControlBindingExt: 'static {
fn get_property_absolute(&self) -> bool;
fn get_property_control_source(&self) -> Option<gst::ControlSource>;
fn set_property_control_source<P: IsA<gst::ControlSource> + SetValueOptional>(
&self,
control_source: Option<&P>,
);
fn connect_property_control_source_notify<F: Fn(&Self) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId;
}
impl<O: IsA<DirectControlBinding>> DirectControlBindingExt for O {
fn get_property_absolute(&self) -> bool {
unsafe {
let mut value = Value::from_type(<bool as StaticType>::static_type());
gobject_sys::g_object_get_property(
self.to_glib_none().0 as *mut gobject_sys::GObject,
b"absolute\0".as_ptr() as *const _,
value.to_glib_none_mut().0,
);
value
.get()
.expect("Return Value for property `absolute` getter")
.unwrap()
}
}
fn get_property_control_source(&self) -> Option<gst::ControlSource> {
unsafe {
let mut value = Value::from_type(<gst::ControlSource as StaticType>::static_type());
gobject_sys::g_object_get_property(
self.to_glib_none().0 as *mut gobject_sys::GObject,
b"control-source\0".as_ptr() as *const _,
value.to_glib_none_mut().0,
);
value
.get()
.expect("Return Value for property `control-source` getter")
}
}
fn set_property_control_source<P: IsA<gst::ControlSource> + SetValueOptional>(
&self,
control_source: Option<&P>,
) {
unsafe {
gobject_sys::g_object_set_property(
self.to_glib_none().0 as *mut gobject_sys::GObject,
b"control-source\0".as_ptr() as *const _,
Value::from(control_source).to_glib_none().0,
);
}
}
fn connect_property_control_source_notify<F: Fn(&Self) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId {
unsafe extern "C" fn notify_control_source_trampoline<
P,
F: Fn(&P) + Send + Sync + 'static,
>(
this: *mut gst_controller_sys::GstDirectControlBinding,
_param_spec: glib_sys::gpointer,
f: glib_sys::gpointer,
) where
P: IsA<DirectControlBinding>,
{
let f: &F = &*(f as *const F);
f(&DirectControlBinding::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::control-source\0".as_ptr() as *const _,
Some(transmute::<_, unsafe extern "C" fn()>(
notify_control_source_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
}

View file

@ -0,0 +1,146 @@
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT
use glib::translate::*;
use glib::value::FromValue;
use glib::value::FromValueOptional;
use glib::value::SetValue;
use glib::value::Value;
use glib::StaticType;
use glib::Type;
use gobject_sys;
use gst_controller_sys;
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
pub enum InterpolationMode {
None,
Linear,
Cubic,
CubicMonotonic,
#[doc(hidden)]
__Unknown(i32),
}
#[doc(hidden)]
impl ToGlib for InterpolationMode {
type GlibType = gst_controller_sys::GstInterpolationMode;
fn to_glib(&self) -> gst_controller_sys::GstInterpolationMode {
match *self {
InterpolationMode::None => gst_controller_sys::GST_INTERPOLATION_MODE_NONE,
InterpolationMode::Linear => gst_controller_sys::GST_INTERPOLATION_MODE_LINEAR,
InterpolationMode::Cubic => gst_controller_sys::GST_INTERPOLATION_MODE_CUBIC,
InterpolationMode::CubicMonotonic => {
gst_controller_sys::GST_INTERPOLATION_MODE_CUBIC_MONOTONIC
}
InterpolationMode::__Unknown(value) => value,
}
}
}
#[doc(hidden)]
impl FromGlib<gst_controller_sys::GstInterpolationMode> for InterpolationMode {
fn from_glib(value: gst_controller_sys::GstInterpolationMode) -> Self {
skip_assert_initialized!();
match value {
0 => InterpolationMode::None,
1 => InterpolationMode::Linear,
2 => InterpolationMode::Cubic,
3 => InterpolationMode::CubicMonotonic,
value => InterpolationMode::__Unknown(value),
}
}
}
impl StaticType for InterpolationMode {
fn static_type() -> Type {
unsafe { from_glib(gst_controller_sys::gst_interpolation_mode_get_type()) }
}
}
impl<'a> FromValueOptional<'a> for InterpolationMode {
unsafe fn from_value_optional(value: &Value) -> Option<Self> {
Some(FromValue::from_value(value))
}
}
impl<'a> FromValue<'a> for InterpolationMode {
unsafe fn from_value(value: &Value) -> Self {
from_glib(gobject_sys::g_value_get_enum(value.to_glib_none().0))
}
}
impl SetValue for InterpolationMode {
unsafe fn set_value(value: &mut Value, this: &Self) {
gobject_sys::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib())
}
}
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
pub enum LFOWaveform {
Sine,
Square,
Saw,
ReverseSaw,
Triangle,
#[doc(hidden)]
__Unknown(i32),
}
#[doc(hidden)]
impl ToGlib for LFOWaveform {
type GlibType = gst_controller_sys::GstLFOWaveform;
fn to_glib(&self) -> gst_controller_sys::GstLFOWaveform {
match *self {
LFOWaveform::Sine => gst_controller_sys::GST_LFO_WAVEFORM_SINE,
LFOWaveform::Square => gst_controller_sys::GST_LFO_WAVEFORM_SQUARE,
LFOWaveform::Saw => gst_controller_sys::GST_LFO_WAVEFORM_SAW,
LFOWaveform::ReverseSaw => gst_controller_sys::GST_LFO_WAVEFORM_REVERSE_SAW,
LFOWaveform::Triangle => gst_controller_sys::GST_LFO_WAVEFORM_TRIANGLE,
LFOWaveform::__Unknown(value) => value,
}
}
}
#[doc(hidden)]
impl FromGlib<gst_controller_sys::GstLFOWaveform> for LFOWaveform {
fn from_glib(value: gst_controller_sys::GstLFOWaveform) -> Self {
skip_assert_initialized!();
match value {
0 => LFOWaveform::Sine,
1 => LFOWaveform::Square,
2 => LFOWaveform::Saw,
3 => LFOWaveform::ReverseSaw,
4 => LFOWaveform::Triangle,
value => LFOWaveform::__Unknown(value),
}
}
}
impl StaticType for LFOWaveform {
fn static_type() -> Type {
unsafe { from_glib(gst_controller_sys::gst_lfo_waveform_get_type()) }
}
}
impl<'a> FromValueOptional<'a> for LFOWaveform {
unsafe fn from_value_optional(value: &Value) -> Option<Self> {
Some(FromValue::from_value(value))
}
}
impl<'a> FromValue<'a> for LFOWaveform {
unsafe fn from_value(value: &Value) -> Self {
from_glib(gobject_sys::g_value_get_enum(value.to_glib_none().0))
}
}
impl SetValue for LFOWaveform {
unsafe fn set_value(value: &mut Value, this: &Self) {
gobject_sys::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib())
}
}

View file

@ -0,0 +1,115 @@
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT
use glib::object::Cast;
use glib::object::IsA;
use glib::signal::connect_raw;
use glib::signal::SignalHandlerId;
use glib::translate::*;
use glib::StaticType;
use glib::Value;
use glib_sys;
use gobject_sys;
use gst;
use gst_controller_sys;
use std::boxed::Box as Box_;
use std::mem::transmute;
use InterpolationMode;
use TimedValueControlSource;
glib_wrapper! {
pub struct InterpolationControlSource(Object<gst_controller_sys::GstInterpolationControlSource, gst_controller_sys::GstInterpolationControlSourceClass, InterpolationControlSourceClass>) @extends TimedValueControlSource, gst::ControlSource, gst::Object;
match fn {
get_type => || gst_controller_sys::gst_interpolation_control_source_get_type(),
}
}
impl InterpolationControlSource {
pub fn new() -> InterpolationControlSource {
assert_initialized_main_thread!();
unsafe {
gst::ControlSource::from_glib_full(
gst_controller_sys::gst_interpolation_control_source_new(),
)
.unsafe_cast()
}
}
}
impl Default for InterpolationControlSource {
fn default() -> Self {
Self::new()
}
}
unsafe impl Send for InterpolationControlSource {}
unsafe impl Sync for InterpolationControlSource {}
pub const NONE_INTERPOLATION_CONTROL_SOURCE: Option<&InterpolationControlSource> = None;
pub trait InterpolationControlSourceExt: 'static {
fn get_property_mode(&self) -> InterpolationMode;
fn set_property_mode(&self, mode: InterpolationMode);
fn connect_property_mode_notify<F: Fn(&Self) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId;
}
impl<O: IsA<InterpolationControlSource>> InterpolationControlSourceExt for O {
fn get_property_mode(&self) -> InterpolationMode {
unsafe {
let mut value = Value::from_type(<InterpolationMode as StaticType>::static_type());
gobject_sys::g_object_get_property(
self.to_glib_none().0 as *mut gobject_sys::GObject,
b"mode\0".as_ptr() as *const _,
value.to_glib_none_mut().0,
);
value
.get()
.expect("Return Value for property `mode` getter")
.unwrap()
}
}
fn set_property_mode(&self, mode: InterpolationMode) {
unsafe {
gobject_sys::g_object_set_property(
self.to_glib_none().0 as *mut gobject_sys::GObject,
b"mode\0".as_ptr() as *const _,
Value::from(&mode).to_glib_none().0,
);
}
}
fn connect_property_mode_notify<F: Fn(&Self) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId {
unsafe extern "C" fn notify_mode_trampoline<P, F: Fn(&P) + Send + Sync + 'static>(
this: *mut gst_controller_sys::GstInterpolationControlSource,
_param_spec: glib_sys::gpointer,
f: glib_sys::gpointer,
) where
P: IsA<InterpolationControlSource>,
{
let f: &F = &*(f as *const F);
f(&InterpolationControlSource::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::mode\0".as_ptr() as *const _,
Some(transmute::<_, unsafe extern "C" fn()>(
notify_mode_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
}

View file

@ -0,0 +1,356 @@
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT
use glib::object::Cast;
use glib::object::IsA;
use glib::signal::connect_raw;
use glib::signal::SignalHandlerId;
use glib::translate::*;
use glib::StaticType;
use glib::Value;
use glib_sys;
use gobject_sys;
use gst;
use gst_controller_sys;
use std::boxed::Box as Box_;
use std::mem::transmute;
use LFOWaveform;
glib_wrapper! {
pub struct LFOControlSource(Object<gst_controller_sys::GstLFOControlSource, gst_controller_sys::GstLFOControlSourceClass, LFOControlSourceClass>) @extends gst::ControlSource, gst::Object;
match fn {
get_type => || gst_controller_sys::gst_lfo_control_source_get_type(),
}
}
impl LFOControlSource {
pub fn new() -> LFOControlSource {
assert_initialized_main_thread!();
unsafe {
gst::ControlSource::from_glib_full(gst_controller_sys::gst_lfo_control_source_new())
.unsafe_cast()
}
}
}
impl Default for LFOControlSource {
fn default() -> Self {
Self::new()
}
}
unsafe impl Send for LFOControlSource {}
unsafe impl Sync for LFOControlSource {}
pub const NONE_LFO_CONTROL_SOURCE: Option<&LFOControlSource> = None;
pub trait LFOControlSourceExt: 'static {
fn get_property_amplitude(&self) -> f64;
fn set_property_amplitude(&self, amplitude: f64);
fn get_property_frequency(&self) -> f64;
fn set_property_frequency(&self, frequency: f64);
fn get_property_offset(&self) -> f64;
fn set_property_offset(&self, offset: f64);
fn get_property_timeshift(&self) -> u64;
fn set_property_timeshift(&self, timeshift: u64);
fn get_property_waveform(&self) -> LFOWaveform;
fn set_property_waveform(&self, waveform: LFOWaveform);
fn connect_property_amplitude_notify<F: Fn(&Self) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId;
fn connect_property_frequency_notify<F: Fn(&Self) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId;
fn connect_property_offset_notify<F: Fn(&Self) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId;
fn connect_property_timeshift_notify<F: Fn(&Self) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId;
fn connect_property_waveform_notify<F: Fn(&Self) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId;
}
impl<O: IsA<LFOControlSource>> LFOControlSourceExt for O {
fn get_property_amplitude(&self) -> f64 {
unsafe {
let mut value = Value::from_type(<f64 as StaticType>::static_type());
gobject_sys::g_object_get_property(
self.to_glib_none().0 as *mut gobject_sys::GObject,
b"amplitude\0".as_ptr() as *const _,
value.to_glib_none_mut().0,
);
value
.get()
.expect("Return Value for property `amplitude` getter")
.unwrap()
}
}
fn set_property_amplitude(&self, amplitude: f64) {
unsafe {
gobject_sys::g_object_set_property(
self.to_glib_none().0 as *mut gobject_sys::GObject,
b"amplitude\0".as_ptr() as *const _,
Value::from(&amplitude).to_glib_none().0,
);
}
}
fn get_property_frequency(&self) -> f64 {
unsafe {
let mut value = Value::from_type(<f64 as StaticType>::static_type());
gobject_sys::g_object_get_property(
self.to_glib_none().0 as *mut gobject_sys::GObject,
b"frequency\0".as_ptr() as *const _,
value.to_glib_none_mut().0,
);
value
.get()
.expect("Return Value for property `frequency` getter")
.unwrap()
}
}
fn set_property_frequency(&self, frequency: f64) {
unsafe {
gobject_sys::g_object_set_property(
self.to_glib_none().0 as *mut gobject_sys::GObject,
b"frequency\0".as_ptr() as *const _,
Value::from(&frequency).to_glib_none().0,
);
}
}
fn get_property_offset(&self) -> f64 {
unsafe {
let mut value = Value::from_type(<f64 as StaticType>::static_type());
gobject_sys::g_object_get_property(
self.to_glib_none().0 as *mut gobject_sys::GObject,
b"offset\0".as_ptr() as *const _,
value.to_glib_none_mut().0,
);
value
.get()
.expect("Return Value for property `offset` getter")
.unwrap()
}
}
fn set_property_offset(&self, offset: f64) {
unsafe {
gobject_sys::g_object_set_property(
self.to_glib_none().0 as *mut gobject_sys::GObject,
b"offset\0".as_ptr() as *const _,
Value::from(&offset).to_glib_none().0,
);
}
}
fn get_property_timeshift(&self) -> u64 {
unsafe {
let mut value = Value::from_type(<u64 as StaticType>::static_type());
gobject_sys::g_object_get_property(
self.to_glib_none().0 as *mut gobject_sys::GObject,
b"timeshift\0".as_ptr() as *const _,
value.to_glib_none_mut().0,
);
value
.get()
.expect("Return Value for property `timeshift` getter")
.unwrap()
}
}
fn set_property_timeshift(&self, timeshift: u64) {
unsafe {
gobject_sys::g_object_set_property(
self.to_glib_none().0 as *mut gobject_sys::GObject,
b"timeshift\0".as_ptr() as *const _,
Value::from(&timeshift).to_glib_none().0,
);
}
}
fn get_property_waveform(&self) -> LFOWaveform {
unsafe {
let mut value = Value::from_type(<LFOWaveform as StaticType>::static_type());
gobject_sys::g_object_get_property(
self.to_glib_none().0 as *mut gobject_sys::GObject,
b"waveform\0".as_ptr() as *const _,
value.to_glib_none_mut().0,
);
value
.get()
.expect("Return Value for property `waveform` getter")
.unwrap()
}
}
fn set_property_waveform(&self, waveform: LFOWaveform) {
unsafe {
gobject_sys::g_object_set_property(
self.to_glib_none().0 as *mut gobject_sys::GObject,
b"waveform\0".as_ptr() as *const _,
Value::from(&waveform).to_glib_none().0,
);
}
}
fn connect_property_amplitude_notify<F: Fn(&Self) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId {
unsafe extern "C" fn notify_amplitude_trampoline<P, F: Fn(&P) + Send + Sync + 'static>(
this: *mut gst_controller_sys::GstLFOControlSource,
_param_spec: glib_sys::gpointer,
f: glib_sys::gpointer,
) where
P: IsA<LFOControlSource>,
{
let f: &F = &*(f as *const F);
f(&LFOControlSource::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::amplitude\0".as_ptr() as *const _,
Some(transmute::<_, unsafe extern "C" fn()>(
notify_amplitude_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
fn connect_property_frequency_notify<F: Fn(&Self) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId {
unsafe extern "C" fn notify_frequency_trampoline<P, F: Fn(&P) + Send + Sync + 'static>(
this: *mut gst_controller_sys::GstLFOControlSource,
_param_spec: glib_sys::gpointer,
f: glib_sys::gpointer,
) where
P: IsA<LFOControlSource>,
{
let f: &F = &*(f as *const F);
f(&LFOControlSource::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::frequency\0".as_ptr() as *const _,
Some(transmute::<_, unsafe extern "C" fn()>(
notify_frequency_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
fn connect_property_offset_notify<F: Fn(&Self) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId {
unsafe extern "C" fn notify_offset_trampoline<P, F: Fn(&P) + Send + Sync + 'static>(
this: *mut gst_controller_sys::GstLFOControlSource,
_param_spec: glib_sys::gpointer,
f: glib_sys::gpointer,
) where
P: IsA<LFOControlSource>,
{
let f: &F = &*(f as *const F);
f(&LFOControlSource::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::offset\0".as_ptr() as *const _,
Some(transmute::<_, unsafe extern "C" fn()>(
notify_offset_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
fn connect_property_timeshift_notify<F: Fn(&Self) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId {
unsafe extern "C" fn notify_timeshift_trampoline<P, F: Fn(&P) + Send + Sync + 'static>(
this: *mut gst_controller_sys::GstLFOControlSource,
_param_spec: glib_sys::gpointer,
f: glib_sys::gpointer,
) where
P: IsA<LFOControlSource>,
{
let f: &F = &*(f as *const F);
f(&LFOControlSource::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::timeshift\0".as_ptr() as *const _,
Some(transmute::<_, unsafe extern "C" fn()>(
notify_timeshift_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
fn connect_property_waveform_notify<F: Fn(&Self) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId {
unsafe extern "C" fn notify_waveform_trampoline<P, F: Fn(&P) + Send + Sync + 'static>(
this: *mut gst_controller_sys::GstLFOControlSource,
_param_spec: glib_sys::gpointer,
f: glib_sys::gpointer,
) where
P: IsA<LFOControlSource>,
{
let f: &F = &*(f as *const F);
f(&LFOControlSource::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::waveform\0".as_ptr() as *const _,
Some(transmute::<_, unsafe extern "C" fn()>(
notify_waveform_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
}

View file

@ -0,0 +1,60 @@
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT
mod argb_control_binding;
pub use self::argb_control_binding::ARGBControlBindingExt;
pub use self::argb_control_binding::{
ARGBControlBinding, ARGBControlBindingClass, NONE_ARGB_CONTROL_BINDING,
};
mod direct_control_binding;
pub use self::direct_control_binding::DirectControlBindingExt;
pub use self::direct_control_binding::{
DirectControlBinding, DirectControlBindingClass, NONE_DIRECT_CONTROL_BINDING,
};
mod interpolation_control_source;
pub use self::interpolation_control_source::InterpolationControlSourceExt;
pub use self::interpolation_control_source::{
InterpolationControlSource, InterpolationControlSourceClass, NONE_INTERPOLATION_CONTROL_SOURCE,
};
mod lfo_control_source;
pub use self::lfo_control_source::LFOControlSourceExt;
pub use self::lfo_control_source::{
LFOControlSource, LFOControlSourceClass, NONE_LFO_CONTROL_SOURCE,
};
#[cfg(any(feature = "v1_12", feature = "dox"))]
mod proxy_control_binding;
#[cfg(any(feature = "v1_12", feature = "dox"))]
pub use self::proxy_control_binding::{
ProxyControlBinding, ProxyControlBindingClass, NONE_PROXY_CONTROL_BINDING,
};
mod timed_value_control_source;
pub use self::timed_value_control_source::TimedValueControlSourceExt;
pub use self::timed_value_control_source::{
TimedValueControlSource, TimedValueControlSourceClass, NONE_TIMED_VALUE_CONTROL_SOURCE,
};
mod trigger_control_source;
pub use self::trigger_control_source::TriggerControlSourceExt;
pub use self::trigger_control_source::{
TriggerControlSource, TriggerControlSourceClass, NONE_TRIGGER_CONTROL_SOURCE,
};
mod enums;
pub use self::enums::InterpolationMode;
pub use self::enums::LFOWaveform;
#[doc(hidden)]
pub mod traits {
pub use super::ARGBControlBindingExt;
pub use super::DirectControlBindingExt;
pub use super::InterpolationControlSourceExt;
pub use super::LFOControlSourceExt;
pub use super::TimedValueControlSourceExt;
pub use super::TriggerControlSourceExt;
}

View file

@ -0,0 +1,45 @@
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT
#[cfg(any(feature = "v1_12", feature = "dox"))]
use glib::object::Cast;
#[cfg(any(feature = "v1_12", feature = "dox"))]
use glib::object::IsA;
use glib::translate::*;
use gst;
use gst_controller_sys;
glib_wrapper! {
pub struct ProxyControlBinding(Object<gst_controller_sys::GstProxyControlBinding, gst_controller_sys::GstProxyControlBindingClass, ProxyControlBindingClass>) @extends gst::ControlBinding, gst::Object;
match fn {
get_type => || gst_controller_sys::gst_proxy_control_binding_get_type(),
}
}
impl ProxyControlBinding {
#[cfg(any(feature = "v1_12", feature = "dox"))]
pub fn new<P: IsA<gst::Object>, Q: IsA<gst::Object>>(
object: &P,
property_name: &str,
ref_object: &Q,
ref_property_name: &str,
) -> ProxyControlBinding {
assert_initialized_main_thread!();
unsafe {
gst::ControlBinding::from_glib_none(gst_controller_sys::gst_proxy_control_binding_new(
object.as_ref().to_glib_none().0,
property_name.to_glib_none().0,
ref_object.as_ref().to_glib_none().0,
ref_property_name.to_glib_none().0,
))
.unsafe_cast()
}
}
}
unsafe impl Send for ProxyControlBinding {}
unsafe impl Sync for ProxyControlBinding {}
pub const NONE_PROXY_CONTROL_BINDING: Option<&ProxyControlBinding> = None;

View file

@ -0,0 +1,207 @@
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT
use glib::object::Cast;
use glib::object::IsA;
use glib::signal::connect_raw;
use glib::signal::SignalHandlerId;
use glib::translate::*;
use glib_sys;
use gst;
use gst_controller_sys;
use std::boxed::Box as Box_;
use std::mem::transmute;
use ControlPoint;
glib_wrapper! {
pub struct TimedValueControlSource(Object<gst_controller_sys::GstTimedValueControlSource, gst_controller_sys::GstTimedValueControlSourceClass, TimedValueControlSourceClass>) @extends gst::ControlSource, gst::Object;
match fn {
get_type => || gst_controller_sys::gst_timed_value_control_source_get_type(),
}
}
unsafe impl Send for TimedValueControlSource {}
unsafe impl Sync for TimedValueControlSource {}
pub const NONE_TIMED_VALUE_CONTROL_SOURCE: Option<&TimedValueControlSource> = None;
pub trait TimedValueControlSourceExt: 'static {
//fn find_control_point_iter(&self, timestamp: gst::ClockTime) -> /*Ignored*/Option<glib::SequenceIter>;
//fn get_all(&self) -> /*Ignored*/Vec<gst::TimedValue>;
fn get_count(&self) -> i32;
fn set(&self, timestamp: gst::ClockTime, value: f64) -> bool;
//fn set_from_list(&self, timedvalues: /*Ignored*/&[&gst::TimedValue]) -> bool;
fn unset(&self, timestamp: gst::ClockTime) -> bool;
fn unset_all(&self);
fn connect_value_added<F: Fn(&Self, &ControlPoint) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId;
fn connect_value_changed<F: Fn(&Self, &ControlPoint) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId;
fn connect_value_removed<F: Fn(&Self, &ControlPoint) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId;
}
impl<O: IsA<TimedValueControlSource>> TimedValueControlSourceExt for O {
//fn find_control_point_iter(&self, timestamp: gst::ClockTime) -> /*Ignored*/Option<glib::SequenceIter> {
// unsafe { TODO: call gst_controller_sys:gst_timed_value_control_source_find_control_point_iter() }
//}
//fn get_all(&self) -> /*Ignored*/Vec<gst::TimedValue> {
// unsafe { TODO: call gst_controller_sys:gst_timed_value_control_source_get_all() }
//}
fn get_count(&self) -> i32 {
unsafe {
gst_controller_sys::gst_timed_value_control_source_get_count(
self.as_ref().to_glib_none().0,
)
}
}
fn set(&self, timestamp: gst::ClockTime, value: f64) -> bool {
unsafe {
from_glib(gst_controller_sys::gst_timed_value_control_source_set(
self.as_ref().to_glib_none().0,
timestamp.to_glib(),
value,
))
}
}
//fn set_from_list(&self, timedvalues: /*Ignored*/&[&gst::TimedValue]) -> bool {
// unsafe { TODO: call gst_controller_sys:gst_timed_value_control_source_set_from_list() }
//}
fn unset(&self, timestamp: gst::ClockTime) -> bool {
unsafe {
from_glib(gst_controller_sys::gst_timed_value_control_source_unset(
self.as_ref().to_glib_none().0,
timestamp.to_glib(),
))
}
}
fn unset_all(&self) {
unsafe {
gst_controller_sys::gst_timed_value_control_source_unset_all(
self.as_ref().to_glib_none().0,
);
}
}
fn connect_value_added<F: Fn(&Self, &ControlPoint) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId {
unsafe extern "C" fn value_added_trampoline<
P,
F: Fn(&P, &ControlPoint) + Send + Sync + 'static,
>(
this: *mut gst_controller_sys::GstTimedValueControlSource,
timed_value: *mut gst_controller_sys::GstControlPoint,
f: glib_sys::gpointer,
) where
P: IsA<TimedValueControlSource>,
{
let f: &F = &*(f as *const F);
f(
&TimedValueControlSource::from_glib_borrow(this).unsafe_cast_ref(),
&from_glib_borrow(timed_value),
)
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"value-added\0".as_ptr() as *const _,
Some(transmute::<_, unsafe extern "C" fn()>(
value_added_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
fn connect_value_changed<F: Fn(&Self, &ControlPoint) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId {
unsafe extern "C" fn value_changed_trampoline<
P,
F: Fn(&P, &ControlPoint) + Send + Sync + 'static,
>(
this: *mut gst_controller_sys::GstTimedValueControlSource,
timed_value: *mut gst_controller_sys::GstControlPoint,
f: glib_sys::gpointer,
) where
P: IsA<TimedValueControlSource>,
{
let f: &F = &*(f as *const F);
f(
&TimedValueControlSource::from_glib_borrow(this).unsafe_cast_ref(),
&from_glib_borrow(timed_value),
)
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"value-changed\0".as_ptr() as *const _,
Some(transmute::<_, unsafe extern "C" fn()>(
value_changed_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
fn connect_value_removed<F: Fn(&Self, &ControlPoint) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId {
unsafe extern "C" fn value_removed_trampoline<
P,
F: Fn(&P, &ControlPoint) + Send + Sync + 'static,
>(
this: *mut gst_controller_sys::GstTimedValueControlSource,
timed_value: *mut gst_controller_sys::GstControlPoint,
f: glib_sys::gpointer,
) where
P: IsA<TimedValueControlSource>,
{
let f: &F = &*(f as *const F);
f(
&TimedValueControlSource::from_glib_borrow(this).unsafe_cast_ref(),
&from_glib_borrow(timed_value),
)
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"value-removed\0".as_ptr() as *const _,
Some(transmute::<_, unsafe extern "C" fn()>(
value_removed_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
}

View file

@ -0,0 +1,112 @@
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT
use glib::object::Cast;
use glib::object::IsA;
use glib::signal::connect_raw;
use glib::signal::SignalHandlerId;
use glib::translate::*;
use glib::StaticType;
use glib::Value;
use glib_sys;
use gobject_sys;
use gst;
use gst_controller_sys;
use std::boxed::Box as Box_;
use std::mem::transmute;
use TimedValueControlSource;
glib_wrapper! {
pub struct TriggerControlSource(Object<gst_controller_sys::GstTriggerControlSource, gst_controller_sys::GstTriggerControlSourceClass, TriggerControlSourceClass>) @extends TimedValueControlSource, gst::ControlSource, gst::Object;
match fn {
get_type => || gst_controller_sys::gst_trigger_control_source_get_type(),
}
}
impl TriggerControlSource {
pub fn new() -> TriggerControlSource {
assert_initialized_main_thread!();
unsafe {
gst::ControlSource::from_glib_full(gst_controller_sys::gst_trigger_control_source_new())
.unsafe_cast()
}
}
}
impl Default for TriggerControlSource {
fn default() -> Self {
Self::new()
}
}
unsafe impl Send for TriggerControlSource {}
unsafe impl Sync for TriggerControlSource {}
pub const NONE_TRIGGER_CONTROL_SOURCE: Option<&TriggerControlSource> = None;
pub trait TriggerControlSourceExt: 'static {
fn get_property_tolerance(&self) -> i64;
fn set_property_tolerance(&self, tolerance: i64);
fn connect_property_tolerance_notify<F: Fn(&Self) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId;
}
impl<O: IsA<TriggerControlSource>> TriggerControlSourceExt for O {
fn get_property_tolerance(&self) -> i64 {
unsafe {
let mut value = Value::from_type(<i64 as StaticType>::static_type());
gobject_sys::g_object_get_property(
self.to_glib_none().0 as *mut gobject_sys::GObject,
b"tolerance\0".as_ptr() as *const _,
value.to_glib_none_mut().0,
);
value
.get()
.expect("Return Value for property `tolerance` getter")
.unwrap()
}
}
fn set_property_tolerance(&self, tolerance: i64) {
unsafe {
gobject_sys::g_object_set_property(
self.to_glib_none().0 as *mut gobject_sys::GObject,
b"tolerance\0".as_ptr() as *const _,
Value::from(&tolerance).to_glib_none().0,
);
}
}
fn connect_property_tolerance_notify<F: Fn(&Self) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId {
unsafe extern "C" fn notify_tolerance_trampoline<P, F: Fn(&P) + Send + Sync + 'static>(
this: *mut gst_controller_sys::GstTriggerControlSource,
_param_spec: glib_sys::gpointer,
f: glib_sys::gpointer,
) where
P: IsA<TriggerControlSource>,
{
let f: &F = &*(f as *const F);
f(&TriggerControlSource::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::tolerance\0".as_ptr() as *const _,
Some(transmute::<_, unsafe extern "C" fn()>(
notify_tolerance_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
}

View file

@ -0,0 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ a6737c7)
from gir-files (https://github.com/gtk-rs/gir-files @ f9bc6779)

View file

@ -0,0 +1,32 @@
use glib::translate::*;
use gst_controller_sys;
glib_wrapper! {
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct ControlPoint(Boxed<gst_controller_sys::GstControlPoint>);
match fn {
copy => |ptr| gst_controller_sys::gst_control_point_copy(mut_override(ptr)),
free => |ptr| gst_controller_sys::gst_control_point_free(ptr),
get_type => || gst_controller_sys::gst_control_point_get_type(),
}
}
impl ControlPoint {
pub fn timestamp(&self) -> gst::ClockTime {
unsafe {
let ptr = self.to_glib_none().0;
from_glib((*ptr).timestamp)
}
}
pub fn value(&self) -> f64 {
unsafe {
let ptr = self.to_glib_none().0;
(*ptr).value
}
}
}
unsafe impl Send for ControlPoint {}
unsafe impl Sync for ControlPoint {}

View file

@ -0,0 +1,32 @@
#[macro_use]
extern crate glib;
extern crate glib_sys;
extern crate gobject_sys;
extern crate gstreamer as gst;
extern crate gstreamer_sys as gst_sys;
extern crate gstreamer_controller_sys as gst_controller_sys;
macro_rules! assert_initialized_main_thread {
() => {
if unsafe { ::gst_sys::gst_is_initialized() } != ::glib_sys::GTRUE {
panic!("GStreamer has not been initialized. Call `gst::init` first.");
}
};
}
macro_rules! skip_assert_initialized {
() => {};
}
#[allow(clippy::unreadable_literal)]
#[allow(clippy::too_many_arguments)]
#[allow(clippy::match_same_arms)]
mod auto;
mod control_point;
pub use auto::*;
use control_point::*;
pub mod prelude {
pub use auto::traits::*;
}

View file

@ -42,16 +42,12 @@ pub trait ChildProxyExt: 'static {
fn get_children_count(&self) -> u32;
//fn get_property(&self, name: &str, value: /*Ignored*/glib::Value);
//fn get_valist(&self, first_property_name: &str, var_args: /*Unknown conversion*//*Unimplemented*/Unsupported);
//fn lookup(&self, name: &str, pspec: /*Ignored*/glib::ParamSpec) -> Option<glib::Object>;
//fn set(&self, first_property_name: &str, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs);
//fn set_property(&self, name: &str, value: /*Ignored*/&glib::Value);
//fn set_valist(&self, first_property_name: &str, var_args: /*Unknown conversion*//*Unimplemented*/Unsupported);
fn connect_child_added<F: Fn(&Self, &glib::Object, &str) + Send + Sync + 'static>(
@ -112,10 +108,6 @@ impl<O: IsA<ChildProxy>> ChildProxyExt for O {
unsafe { gst_sys::gst_child_proxy_get_children_count(self.as_ref().to_glib_none().0) }
}
//fn get_property(&self, name: &str, value: /*Ignored*/glib::Value) {
// unsafe { TODO: call gst_sys:gst_child_proxy_get_property() }
//}
//fn get_valist(&self, first_property_name: &str, var_args: /*Unknown conversion*//*Unimplemented*/Unsupported) {
// unsafe { TODO: call gst_sys:gst_child_proxy_get_valist() }
//}
@ -128,10 +120,6 @@ impl<O: IsA<ChildProxy>> ChildProxyExt for O {
// unsafe { TODO: call gst_sys:gst_child_proxy_set() }
//}
//fn set_property(&self, name: &str, value: /*Ignored*/&glib::Value) {
// unsafe { TODO: call gst_sys:gst_child_proxy_set_property() }
//}
//fn set_valist(&self, first_property_name: &str, var_args: /*Unknown conversion*//*Unimplemented*/Unsupported) {
// unsafe { TODO: call gst_sys:gst_child_proxy_set_valist() }
//}

View file

@ -0,0 +1,107 @@
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT
use glib;
use glib::object::IsA;
use glib::translate::*;
use glib::StaticType;
use glib::Value;
use gobject_sys;
use gst_sys;
use ClockTime;
use Object;
glib_wrapper! {
pub struct ControlBinding(Object<gst_sys::GstControlBinding, gst_sys::GstControlBindingClass, ControlBindingClass>) @extends Object;
match fn {
get_type => || gst_sys::gst_control_binding_get_type(),
}
}
unsafe impl Send for ControlBinding {}
unsafe impl Sync for ControlBinding {}
pub const NONE_CONTROL_BINDING: Option<&ControlBinding> = None;
pub trait ControlBindingExt: 'static {
fn get_value(&self, timestamp: ClockTime) -> Option<glib::Value>;
//fn get_value_array(&self, timestamp: ClockTime, interval: ClockTime, values: /*Unimplemented*/&[&Fundamental: Pointer]) -> bool;
fn is_disabled(&self) -> bool;
fn set_disabled(&self, disabled: bool);
fn sync_values<P: IsA<Object>>(
&self,
object: &P,
timestamp: ClockTime,
last_sync: ClockTime,
) -> bool;
fn get_property_object(&self) -> Option<Object>;
}
impl<O: IsA<ControlBinding>> ControlBindingExt for O {
fn get_value(&self, timestamp: ClockTime) -> Option<glib::Value> {
unsafe {
from_glib_full(gst_sys::gst_control_binding_get_value(
self.as_ref().to_glib_none().0,
timestamp.to_glib(),
))
}
}
//fn get_value_array(&self, timestamp: ClockTime, interval: ClockTime, values: /*Unimplemented*/&[&Fundamental: Pointer]) -> bool {
// unsafe { TODO: call gst_sys:gst_control_binding_get_value_array() }
//}
fn is_disabled(&self) -> bool {
unsafe {
from_glib(gst_sys::gst_control_binding_is_disabled(
self.as_ref().to_glib_none().0,
))
}
}
fn set_disabled(&self, disabled: bool) {
unsafe {
gst_sys::gst_control_binding_set_disabled(
self.as_ref().to_glib_none().0,
disabled.to_glib(),
);
}
}
fn sync_values<P: IsA<Object>>(
&self,
object: &P,
timestamp: ClockTime,
last_sync: ClockTime,
) -> bool {
unsafe {
from_glib(gst_sys::gst_control_binding_sync_values(
self.as_ref().to_glib_none().0,
object.as_ref().to_glib_none().0,
timestamp.to_glib(),
last_sync.to_glib(),
))
}
}
fn get_property_object(&self) -> Option<Object> {
unsafe {
let mut value = Value::from_type(<Object as StaticType>::static_type());
gobject_sys::g_object_get_property(
self.to_glib_none().0 as *mut gobject_sys::GObject,
b"object\0".as_ptr() as *const _,
value.to_glib_none_mut().0,
);
value
.get()
.expect("Return Value for property `object` getter")
}
}
}

View file

@ -0,0 +1,46 @@
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT
use glib::object::IsA;
use glib::translate::*;
use gst_sys;
use std::mem;
use ClockTime;
use Object;
glib_wrapper! {
pub struct ControlSource(Object<gst_sys::GstControlSource, gst_sys::GstControlSourceClass, ControlSourceClass>) @extends Object;
match fn {
get_type => || gst_sys::gst_control_source_get_type(),
}
}
unsafe impl Send for ControlSource {}
unsafe impl Sync for ControlSource {}
pub const NONE_CONTROL_SOURCE: Option<&ControlSource> = None;
pub trait ControlSourceExt: 'static {
fn get_value(&self, timestamp: ClockTime) -> Option<f64>;
}
impl<O: IsA<ControlSource>> ControlSourceExt for O {
fn get_value(&self, timestamp: ClockTime) -> Option<f64> {
unsafe {
let mut value = mem::MaybeUninit::uninit();
let ret = from_glib(gst_sys::gst_control_source_get_value(
self.as_ref().to_glib_none().0,
timestamp.to_glib(),
value.as_mut_ptr(),
));
let value = value.assume_init();
if ret {
Some(value)
} else {
None
}
}
}
}

View file

@ -25,6 +25,14 @@ mod clock;
pub use self::clock::ClockExt;
pub use self::clock::{Clock, ClockClass, NONE_CLOCK};
mod control_binding;
pub use self::control_binding::ControlBindingExt;
pub use self::control_binding::{ControlBinding, ControlBindingClass, NONE_CONTROL_BINDING};
mod control_source;
pub use self::control_source::ControlSourceExt;
pub use self::control_source::{ControlSource, ControlSourceClass, NONE_CONTROL_SOURCE};
mod device;
pub use self::device::DeviceExt;
pub use self::device::{Device, DeviceClass, NONE_DEVICE};
@ -201,6 +209,8 @@ pub mod traits {
pub use super::BufferPoolExt;
pub use super::ChildProxyExt;
pub use super::ClockExt;
pub use super::ControlBindingExt;
pub use super::ControlSourceExt;
pub use super::DeviceExt;
pub use super::DeviceMonitorExt;
pub use super::DeviceProviderExt;

View file

@ -14,6 +14,7 @@ use gst_sys;
use std::boxed::Box as Box_;
use std::mem::transmute;
use ClockTime;
use ControlBinding;
glib_wrapper! {
pub struct Object(Object<gst_sys::GstObject, gst_sys::GstObjectClass, ObjectClass>);
@ -53,23 +54,24 @@ unsafe impl Sync for Object {}
pub const NONE_OBJECT: Option<&Object> = None;
pub trait GstObjectExt: 'static {
//fn add_control_binding(&self, binding: /*Ignored*/&ControlBinding) -> bool;
fn add_control_binding<P: IsA<ControlBinding>>(
&self,
binding: &P,
) -> Result<(), glib::error::BoolError>;
fn default_error(&self, error: &glib::Error, debug: Option<&str>);
//fn get_control_binding(&self, property_name: &str) -> /*Ignored*/Option<ControlBinding>;
fn get_control_binding(&self, property_name: &str) -> Option<ControlBinding>;
fn get_control_rate(&self) -> ClockTime;
//fn get_g_value_array(&self, property_name: &str, timestamp: ClockTime, interval: ClockTime, values: /*Ignored*/&[&glib::Value]) -> bool;
fn get_name(&self) -> GString;
fn get_parent(&self) -> Option<Object>;
fn get_path_string(&self) -> GString;
//fn get_value(&self, property_name: &str, timestamp: ClockTime) -> /*Ignored*/Option<glib::Value>;
fn get_value(&self, property_name: &str, timestamp: ClockTime) -> Option<glib::Value>;
//fn get_value_array(&self, property_name: &str, timestamp: ClockTime, interval: ClockTime, n_values: u32, values: /*Unimplemented*/Option<Fundamental: Pointer>) -> bool;
@ -81,7 +83,7 @@ pub trait GstObjectExt: 'static {
fn has_as_parent<P: IsA<Object>>(&self, parent: &P) -> bool;
//fn remove_control_binding(&self, binding: /*Ignored*/&ControlBinding) -> bool;
fn remove_control_binding<P: IsA<ControlBinding>>(&self, binding: &P) -> bool;
fn set_control_binding_disabled(&self, property_name: &str, disabled: bool);
@ -106,9 +108,20 @@ pub trait GstObjectExt: 'static {
}
impl<O: IsA<Object>> GstObjectExt for O {
//fn add_control_binding(&self, binding: /*Ignored*/&ControlBinding) -> bool {
// unsafe { TODO: call gst_sys:gst_object_add_control_binding() }
//}
fn add_control_binding<P: IsA<ControlBinding>>(
&self,
binding: &P,
) -> Result<(), glib::error::BoolError> {
unsafe {
glib_result_from_gboolean!(
gst_sys::gst_object_add_control_binding(
self.as_ref().to_glib_none().0,
binding.as_ref().to_glib_none().0
),
"Failed to add control binding"
)
}
}
fn default_error(&self, error: &glib::Error, debug: Option<&str>) {
unsafe {
@ -120,9 +133,14 @@ impl<O: IsA<Object>> GstObjectExt for O {
}
}
//fn get_control_binding(&self, property_name: &str) -> /*Ignored*/Option<ControlBinding> {
// unsafe { TODO: call gst_sys:gst_object_get_control_binding() }
//}
fn get_control_binding(&self, property_name: &str) -> Option<ControlBinding> {
unsafe {
from_glib_full(gst_sys::gst_object_get_control_binding(
self.as_ref().to_glib_none().0,
property_name.to_glib_none().0,
))
}
}
fn get_control_rate(&self) -> ClockTime {
unsafe {
@ -132,10 +150,6 @@ impl<O: IsA<Object>> GstObjectExt for O {
}
}
//fn get_g_value_array(&self, property_name: &str, timestamp: ClockTime, interval: ClockTime, values: /*Ignored*/&[&glib::Value]) -> bool {
// unsafe { TODO: call gst_sys:gst_object_get_g_value_array() }
//}
fn get_name(&self) -> GString {
unsafe { from_glib_full(gst_sys::gst_object_get_name(self.as_ref().to_glib_none().0)) }
}
@ -156,9 +170,15 @@ impl<O: IsA<Object>> GstObjectExt for O {
}
}
//fn get_value(&self, property_name: &str, timestamp: ClockTime) -> /*Ignored*/Option<glib::Value> {
// unsafe { TODO: call gst_sys:gst_object_get_value() }
//}
fn get_value(&self, property_name: &str, timestamp: ClockTime) -> Option<glib::Value> {
unsafe {
from_glib_full(gst_sys::gst_object_get_value(
self.as_ref().to_glib_none().0,
property_name.to_glib_none().0,
timestamp.to_glib(),
))
}
}
//fn get_value_array(&self, property_name: &str, timestamp: ClockTime, interval: ClockTime, n_values: u32, values: /*Unimplemented*/Option<Fundamental: Pointer>) -> bool {
// unsafe { TODO: call gst_sys:gst_object_get_value_array() }
@ -199,9 +219,14 @@ impl<O: IsA<Object>> GstObjectExt for O {
}
}
//fn remove_control_binding(&self, binding: /*Ignored*/&ControlBinding) -> bool {
// unsafe { TODO: call gst_sys:gst_object_remove_control_binding() }
//}
fn remove_control_binding<P: IsA<ControlBinding>>(&self, binding: &P) -> bool {
unsafe {
from_glib(gst_sys::gst_object_remove_control_binding(
self.as_ref().to_glib_none().0,
binding.as_ref().to_glib_none().0,
))
}
}
fn set_control_binding_disabled(&self, property_name: &str, disabled: bool) {
unsafe {

View file

@ -28,8 +28,6 @@ pub trait TagSetterExt: 'static {
//fn add_tag_valist_values(&self, mode: TagMergeMode, tag: &str, var_args: /*Unknown conversion*//*Unimplemented*/Unsupported);
//fn add_tag_value(&self, mode: TagMergeMode, tag: &str, value: /*Ignored*/&glib::Value);
//fn add_tag_values(&self, mode: TagMergeMode, tag: &str, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs);
//fn add_tags(&self, mode: TagMergeMode, tag: &str, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs);
@ -54,10 +52,6 @@ impl<O: IsA<TagSetter>> TagSetterExt for O {
// unsafe { TODO: call gst_sys:gst_tag_setter_add_tag_valist_values() }
//}
//fn add_tag_value(&self, mode: TagMergeMode, tag: &str, value: /*Ignored*/&glib::Value) {
// unsafe { TODO: call gst_sys:gst_tag_setter_add_tag_value() }
//}
//fn add_tag_values(&self, mode: TagMergeMode, tag: &str, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) {
// unsafe { TODO: call gst_sys:gst_tag_setter_add_tag_values() }
//}

View file

@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ 60cbef0)
from gir-files (https://github.com/gtk-rs/gir-files @ 0877e6fc)
from gir-files (https://github.com/gtk-rs/gir-files @ 233d39ae)

View file

@ -0,0 +1,45 @@
// Copyright (C) 2017 Sebastian Dröge <sebastian@centricular.com>
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use glib::object::IsA;
use glib::translate::*;
use gst_sys;
use ClockTime;
use ControlBinding;
pub trait ControlBindingExtManual: 'static {
fn get_g_value_array(
&self,
timestamp: ClockTime,
interval: ClockTime,
values: &mut [glib::Value],
) -> Result<(), glib::error::BoolError>;
}
impl<O: IsA<ControlBinding>> ControlBindingExtManual for O {
fn get_g_value_array(
&self,
timestamp: ClockTime,
interval: ClockTime,
values: &mut [glib::Value],
) -> Result<(), glib::error::BoolError> {
let n_values = values.len() as u32;
unsafe {
glib_result_from_gboolean!(
gst_sys::gst_control_binding_get_g_value_array(
self.as_ref().to_glib_none().0,
timestamp.to_glib(),
interval.to_glib(),
n_values,
values.as_mut_ptr() as *mut gobject_sys::GValue,
),
"Failed to get value array"
)
}
}
}

View file

@ -0,0 +1,45 @@
// Copyright (C) 2017 Sebastian Dröge <sebastian@centricular.com>
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use glib::object::IsA;
use glib::translate::*;
use gst_sys;
use ClockTime;
use ControlSource;
pub trait ControlSourceExtManual: 'static {
fn get_value_array(
&self,
timestamp: ClockTime,
interval: ClockTime,
values: &mut [f64],
) -> Result<(), glib::error::BoolError>;
}
impl<O: IsA<ControlSource>> ControlSourceExtManual for O {
fn get_value_array(
&self,
timestamp: ClockTime,
interval: ClockTime,
values: &mut [f64],
) -> Result<(), glib::error::BoolError> {
let n_values = values.len() as u32;
unsafe {
glib_result_from_gboolean!(
gst_sys::gst_control_source_get_value_array(
self.as_ref().to_glib_none().0,
timestamp.to_glib(),
interval.to_glib(),
n_values,
values.to_glib_none().0,
),
"Failed to get value array"
)
}
}
}

View file

@ -204,6 +204,8 @@ mod iterator;
mod object;
mod pad;
pub use pad::PadBuilder;
mod control_binding;
mod control_source;
mod parse_context;
mod proxy_pad;
mod tag_setter;

View file

@ -14,6 +14,7 @@ use glib::IsA;
use gobject_sys;
use ClockTime;
use ObjectFlags;
pub trait GstObjectExtManual: 'static {
@ -28,6 +29,14 @@ pub trait GstObjectExtManual: 'static {
fn unset_object_flags(&self, flags: ObjectFlags);
fn get_object_flags(&self) -> ObjectFlags;
fn get_g_value_array(
&self,
property_name: &str,
timestamp: ClockTime,
interval: ClockTime,
values: &mut [glib::Value],
) -> Result<(), glib::error::BoolError>;
}
impl<O: IsA<::Object>> GstObjectExtManual for O {
@ -98,6 +107,29 @@ impl<O: IsA<::Object>> GstObjectExtManual for O {
from_glib((*ptr).flags)
}
}
fn get_g_value_array(
&self,
property_name: &str,
timestamp: ClockTime,
interval: ClockTime,
values: &mut [glib::Value],
) -> Result<(), glib::error::BoolError> {
let n_values = values.len() as u32;
unsafe {
glib_result_from_gboolean!(
gst_sys::gst_object_get_g_value_array(
self.as_ref().to_glib_none().0,
property_name.to_glib_none().0,
timestamp.to_glib(),
interval.to_glib(),
n_values,
values.as_mut_ptr() as *mut gobject_sys::GValue,
),
"Failed to get value array"
)
}
}
}
#[cfg(test)]