1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
// DO NOT EDIT

use crate::ClockTime;
use crate::Object;
use glib::object::IsA;
use glib::translate::*;
use glib::StaticType;

glib::wrapper! {
    #[doc(alias = "GstControlBinding")]
    pub struct ControlBinding(Object<ffi::GstControlBinding, ffi::GstControlBindingClass>) @extends Object;

    match fn {
        type_ => || ffi::gst_control_binding_get_type(),
    }
}

impl ControlBinding {
    pub const NONE: Option<&'static ControlBinding> = None;
}

unsafe impl Send for ControlBinding {}
unsafe impl Sync for ControlBinding {}

pub trait ControlBindingExt: 'static {
    #[doc(alias = "gst_control_binding_get_value")]
    #[doc(alias = "get_value")]
    fn value(&self, timestamp: ClockTime) -> Option<glib::Value>;

    //#[doc(alias = "gst_control_binding_get_value_array")]
    //#[doc(alias = "get_value_array")]
    //fn is_value_array(&self, timestamp: impl Into<Option<ClockTime>>, interval: impl Into<Option<ClockTime>>, values: /*Unimplemented*/&[&Fundamental: Pointer]) -> bool;

    #[doc(alias = "gst_control_binding_is_disabled")]
    fn is_disabled(&self) -> bool;

    #[doc(alias = "gst_control_binding_set_disabled")]
    fn set_disabled(&self, disabled: bool);

    #[doc(alias = "gst_control_binding_sync_values")]
    fn sync_values(
        &self,
        object: &impl IsA<Object>,
        timestamp: ClockTime,
        last_sync: impl Into<Option<ClockTime>>,
    ) -> bool;

    fn object(&self) -> Option<Object>;
}

impl<O: IsA<ControlBinding>> ControlBindingExt for O {
    fn value(&self, timestamp: ClockTime) -> Option<glib::Value> {
        unsafe {
            from_glib_full(ffi::gst_control_binding_get_value(
                self.as_ref().to_glib_none().0,
                timestamp.into_glib(),
            ))
        }
    }

    //fn is_value_array(&self, timestamp: impl Into<Option<ClockTime>>, interval: impl Into<Option<ClockTime>>, values: /*Unimplemented*/&[&Fundamental: Pointer]) -> bool {
    //    unsafe { TODO: call ffi:gst_control_binding_get_value_array() }
    //}

    fn is_disabled(&self) -> bool {
        unsafe {
            from_glib(ffi::gst_control_binding_is_disabled(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    fn set_disabled(&self, disabled: bool) {
        unsafe {
            ffi::gst_control_binding_set_disabled(
                self.as_ref().to_glib_none().0,
                disabled.into_glib(),
            );
        }
    }

    fn sync_values(
        &self,
        object: &impl IsA<Object>,
        timestamp: ClockTime,
        last_sync: impl Into<Option<ClockTime>>,
    ) -> bool {
        unsafe {
            from_glib(ffi::gst_control_binding_sync_values(
                self.as_ref().to_glib_none().0,
                object.as_ref().to_glib_none().0,
                timestamp.into_glib(),
                last_sync.into().into_glib(),
            ))
        }
    }

    fn object(&self) -> Option<Object> {
        glib::ObjectExt::property(self.as_ref(), "object")
    }
}