forked from mirrors/gstreamer-rs
video: Add bindings for ColorBalance
/ ColorBalanceChannel
This commit is contained in:
parent
0b544ffbd3
commit
1eba9b64e5
7 changed files with 307 additions and 0 deletions
|
@ -17,6 +17,9 @@ external_libraries = [
|
||||||
]
|
]
|
||||||
|
|
||||||
generate = [
|
generate = [
|
||||||
|
"GstVideo.ColorBalance",
|
||||||
|
"GstVideo.ColorBalanceChannel",
|
||||||
|
"GstVideo.ColorBalanceType",
|
||||||
"GstVideo.VideoAFDSpec",
|
"GstVideo.VideoAFDSpec",
|
||||||
"GstVideo.VideoAFDValue",
|
"GstVideo.VideoAFDValue",
|
||||||
"GstVideo.VideoAggregatorParallelConvertPad",
|
"GstVideo.VideoAggregatorParallelConvertPad",
|
||||||
|
|
135
gstreamer-video/src/auto/color_balance.rs
Normal file
135
gstreamer-video/src/auto/color_balance.rs
Normal file
|
@ -0,0 +1,135 @@
|
||||||
|
// 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::ColorBalanceChannel;
|
||||||
|
use crate::ColorBalanceType;
|
||||||
|
use glib::object::Cast;
|
||||||
|
use glib::object::IsA;
|
||||||
|
use glib::signal::connect_raw;
|
||||||
|
use glib::signal::SignalHandlerId;
|
||||||
|
use glib::translate::*;
|
||||||
|
use std::boxed::Box as Box_;
|
||||||
|
use std::mem::transmute;
|
||||||
|
|
||||||
|
glib::wrapper! {
|
||||||
|
#[doc(alias = "GstColorBalance")]
|
||||||
|
pub struct ColorBalance(Interface<ffi::GstColorBalance, ffi::GstColorBalanceInterface>);
|
||||||
|
|
||||||
|
match fn {
|
||||||
|
type_ => || ffi::gst_color_balance_get_type(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
unsafe impl Send for ColorBalance {}
|
||||||
|
unsafe impl Sync for ColorBalance {}
|
||||||
|
|
||||||
|
impl ColorBalance {
|
||||||
|
pub const NONE: Option<&'static ColorBalance> = None;
|
||||||
|
}
|
||||||
|
|
||||||
|
pub trait ColorBalanceExt: 'static {
|
||||||
|
#[doc(alias = "gst_color_balance_get_balance_type")]
|
||||||
|
#[doc(alias = "get_balance_type")]
|
||||||
|
fn balance_type(&self) -> ColorBalanceType;
|
||||||
|
|
||||||
|
#[doc(alias = "gst_color_balance_get_value")]
|
||||||
|
#[doc(alias = "get_value")]
|
||||||
|
fn value(&self, channel: &impl IsA<ColorBalanceChannel>) -> i32;
|
||||||
|
|
||||||
|
#[doc(alias = "gst_color_balance_list_channels")]
|
||||||
|
fn list_channels(&self) -> Vec<ColorBalanceChannel>;
|
||||||
|
|
||||||
|
#[doc(alias = "gst_color_balance_set_value")]
|
||||||
|
fn set_value(&self, channel: &impl IsA<ColorBalanceChannel>, value: i32);
|
||||||
|
|
||||||
|
#[doc(alias = "gst_color_balance_value_changed")]
|
||||||
|
fn value_changed(&self, channel: &impl IsA<ColorBalanceChannel>, value: i32);
|
||||||
|
|
||||||
|
#[doc(alias = "value-changed")]
|
||||||
|
fn connect_value_changed<F: Fn(&Self, &ColorBalanceChannel, i32) + Send + Sync + 'static>(
|
||||||
|
&self,
|
||||||
|
f: F,
|
||||||
|
) -> SignalHandlerId;
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<O: IsA<ColorBalance>> ColorBalanceExt for O {
|
||||||
|
fn balance_type(&self) -> ColorBalanceType {
|
||||||
|
unsafe {
|
||||||
|
from_glib(ffi::gst_color_balance_get_balance_type(
|
||||||
|
self.as_ref().to_glib_none().0,
|
||||||
|
))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn value(&self, channel: &impl IsA<ColorBalanceChannel>) -> i32 {
|
||||||
|
unsafe {
|
||||||
|
ffi::gst_color_balance_get_value(
|
||||||
|
self.as_ref().to_glib_none().0,
|
||||||
|
channel.as_ref().to_glib_none().0,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn list_channels(&self) -> Vec<ColorBalanceChannel> {
|
||||||
|
unsafe {
|
||||||
|
FromGlibPtrContainer::from_glib_none(ffi::gst_color_balance_list_channels(
|
||||||
|
self.as_ref().to_glib_none().0,
|
||||||
|
))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn set_value(&self, channel: &impl IsA<ColorBalanceChannel>, value: i32) {
|
||||||
|
unsafe {
|
||||||
|
ffi::gst_color_balance_set_value(
|
||||||
|
self.as_ref().to_glib_none().0,
|
||||||
|
channel.as_ref().to_glib_none().0,
|
||||||
|
value,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn value_changed(&self, channel: &impl IsA<ColorBalanceChannel>, value: i32) {
|
||||||
|
unsafe {
|
||||||
|
ffi::gst_color_balance_value_changed(
|
||||||
|
self.as_ref().to_glib_none().0,
|
||||||
|
channel.as_ref().to_glib_none().0,
|
||||||
|
value,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn connect_value_changed<F: Fn(&Self, &ColorBalanceChannel, i32) + Send + Sync + 'static>(
|
||||||
|
&self,
|
||||||
|
f: F,
|
||||||
|
) -> SignalHandlerId {
|
||||||
|
unsafe extern "C" fn value_changed_trampoline<
|
||||||
|
P: IsA<ColorBalance>,
|
||||||
|
F: Fn(&P, &ColorBalanceChannel, i32) + Send + Sync + 'static,
|
||||||
|
>(
|
||||||
|
this: *mut ffi::GstColorBalance,
|
||||||
|
channel: *mut ffi::GstColorBalanceChannel,
|
||||||
|
value: libc::c_int,
|
||||||
|
f: glib::ffi::gpointer,
|
||||||
|
) {
|
||||||
|
let f: &F = &*(f as *const F);
|
||||||
|
f(
|
||||||
|
ColorBalance::from_glib_borrow(this).unsafe_cast_ref(),
|
||||||
|
&from_glib_borrow(channel),
|
||||||
|
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),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
69
gstreamer-video/src/auto/color_balance_channel.rs
Normal file
69
gstreamer-video/src/auto/color_balance_channel.rs
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
// 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 glib::object::Cast;
|
||||||
|
use glib::object::IsA;
|
||||||
|
use glib::signal::connect_raw;
|
||||||
|
use glib::signal::SignalHandlerId;
|
||||||
|
use glib::translate::*;
|
||||||
|
use std::boxed::Box as Box_;
|
||||||
|
use std::mem::transmute;
|
||||||
|
|
||||||
|
glib::wrapper! {
|
||||||
|
#[doc(alias = "GstColorBalanceChannel")]
|
||||||
|
pub struct ColorBalanceChannel(Object<ffi::GstColorBalanceChannel, ffi::GstColorBalanceChannelClass>);
|
||||||
|
|
||||||
|
match fn {
|
||||||
|
type_ => || ffi::gst_color_balance_channel_get_type(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
unsafe impl Send for ColorBalanceChannel {}
|
||||||
|
unsafe impl Sync for ColorBalanceChannel {}
|
||||||
|
|
||||||
|
impl ColorBalanceChannel {
|
||||||
|
pub const NONE: Option<&'static ColorBalanceChannel> = None;
|
||||||
|
}
|
||||||
|
|
||||||
|
pub trait ColorBalanceChannelExt: 'static {
|
||||||
|
#[doc(alias = "value-changed")]
|
||||||
|
fn connect_value_changed<F: Fn(&Self, i32) + Send + Sync + 'static>(
|
||||||
|
&self,
|
||||||
|
f: F,
|
||||||
|
) -> SignalHandlerId;
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<O: IsA<ColorBalanceChannel>> ColorBalanceChannelExt for O {
|
||||||
|
fn connect_value_changed<F: Fn(&Self, i32) + Send + Sync + 'static>(
|
||||||
|
&self,
|
||||||
|
f: F,
|
||||||
|
) -> SignalHandlerId {
|
||||||
|
unsafe extern "C" fn value_changed_trampoline<
|
||||||
|
P: IsA<ColorBalanceChannel>,
|
||||||
|
F: Fn(&P, i32) + Send + Sync + 'static,
|
||||||
|
>(
|
||||||
|
this: *mut ffi::GstColorBalanceChannel,
|
||||||
|
value: libc::c_int,
|
||||||
|
f: glib::ffi::gpointer,
|
||||||
|
) {
|
||||||
|
let f: &F = &*(f as *const F);
|
||||||
|
f(
|
||||||
|
ColorBalanceChannel::from_glib_borrow(this).unsafe_cast_ref(),
|
||||||
|
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),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -11,6 +11,76 @@ use glib::Type;
|
||||||
use std::ffi::CStr;
|
use std::ffi::CStr;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
||||||
|
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
|
||||||
|
#[non_exhaustive]
|
||||||
|
#[doc(alias = "GstColorBalanceType")]
|
||||||
|
pub enum ColorBalanceType {
|
||||||
|
#[doc(alias = "GST_COLOR_BALANCE_HARDWARE")]
|
||||||
|
Hardware,
|
||||||
|
#[doc(alias = "GST_COLOR_BALANCE_SOFTWARE")]
|
||||||
|
Software,
|
||||||
|
#[doc(hidden)]
|
||||||
|
__Unknown(i32),
|
||||||
|
}
|
||||||
|
|
||||||
|
#[doc(hidden)]
|
||||||
|
impl IntoGlib for ColorBalanceType {
|
||||||
|
type GlibType = ffi::GstColorBalanceType;
|
||||||
|
|
||||||
|
fn into_glib(self) -> ffi::GstColorBalanceType {
|
||||||
|
match self {
|
||||||
|
Self::Hardware => ffi::GST_COLOR_BALANCE_HARDWARE,
|
||||||
|
Self::Software => ffi::GST_COLOR_BALANCE_SOFTWARE,
|
||||||
|
Self::__Unknown(value) => value,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[doc(hidden)]
|
||||||
|
impl FromGlib<ffi::GstColorBalanceType> for ColorBalanceType {
|
||||||
|
unsafe fn from_glib(value: ffi::GstColorBalanceType) -> Self {
|
||||||
|
skip_assert_initialized!();
|
||||||
|
match value {
|
||||||
|
ffi::GST_COLOR_BALANCE_HARDWARE => Self::Hardware,
|
||||||
|
ffi::GST_COLOR_BALANCE_SOFTWARE => Self::Software,
|
||||||
|
value => Self::__Unknown(value),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl StaticType for ColorBalanceType {
|
||||||
|
fn static_type() -> Type {
|
||||||
|
unsafe { from_glib(ffi::gst_color_balance_type_get_type()) }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl glib::value::ValueType for ColorBalanceType {
|
||||||
|
type Type = Self;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsafe impl<'a> FromValue<'a> for ColorBalanceType {
|
||||||
|
type Checker = glib::value::GenericValueTypeChecker<Self>;
|
||||||
|
|
||||||
|
unsafe fn from_value(value: &'a glib::Value) -> Self {
|
||||||
|
skip_assert_initialized!();
|
||||||
|
from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ToValue for ColorBalanceType {
|
||||||
|
fn to_value(&self) -> glib::Value {
|
||||||
|
let mut value = glib::Value::for_value_type::<Self>();
|
||||||
|
unsafe {
|
||||||
|
glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
|
||||||
|
}
|
||||||
|
value
|
||||||
|
}
|
||||||
|
|
||||||
|
fn value_type(&self) -> glib::Type {
|
||||||
|
Self::static_type()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(any(feature = "v1_18", feature = "dox"))]
|
#[cfg(any(feature = "v1_18", feature = "dox"))]
|
||||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
|
||||||
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
|
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
|
||||||
|
|
|
@ -3,6 +3,12 @@
|
||||||
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
|
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
|
||||||
// DO NOT EDIT
|
// DO NOT EDIT
|
||||||
|
|
||||||
|
mod color_balance;
|
||||||
|
pub use self::color_balance::ColorBalance;
|
||||||
|
|
||||||
|
mod color_balance_channel;
|
||||||
|
pub use self::color_balance_channel::ColorBalanceChannel;
|
||||||
|
|
||||||
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
||||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
||||||
mod video_aggregator_parallel_convert_pad;
|
mod video_aggregator_parallel_convert_pad;
|
||||||
|
@ -32,6 +38,7 @@ mod video_sink;
|
||||||
pub use self::video_sink::VideoSink;
|
pub use self::video_sink::VideoSink;
|
||||||
|
|
||||||
mod enums;
|
mod enums;
|
||||||
|
pub use self::enums::ColorBalanceType;
|
||||||
#[cfg(any(feature = "v1_18", feature = "dox"))]
|
#[cfg(any(feature = "v1_18", feature = "dox"))]
|
||||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
|
||||||
pub use self::enums::VideoAFDSpec;
|
pub use self::enums::VideoAFDSpec;
|
||||||
|
@ -82,6 +89,8 @@ pub use self::flags::VideoTimeCodeFlags;
|
||||||
|
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub mod traits {
|
pub mod traits {
|
||||||
|
pub use super::color_balance::ColorBalanceExt;
|
||||||
|
pub use super::color_balance_channel::ColorBalanceChannelExt;
|
||||||
pub use super::video_decoder::VideoDecoderExt;
|
pub use super::video_decoder::VideoDecoderExt;
|
||||||
pub use super::video_encoder::VideoEncoderExt;
|
pub use super::video_encoder::VideoEncoderExt;
|
||||||
pub use super::video_orientation::VideoOrientationExt;
|
pub use super::video_orientation::VideoOrientationExt;
|
||||||
|
|
19
gstreamer-video/src/color_balance_channel.rs
Normal file
19
gstreamer-video/src/color_balance_channel.rs
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
// Take a look at the license at the top of the repository in the LICENSE file.
|
||||||
|
|
||||||
|
use crate::ColorBalanceChannel;
|
||||||
|
use glib::prelude::*;
|
||||||
|
use glib::translate::*;
|
||||||
|
|
||||||
|
impl ColorBalanceChannel {
|
||||||
|
pub fn label(&self) -> glib::GString {
|
||||||
|
unsafe { from_glib_none((*self.as_ptr()).label) }
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn min_value(&self) -> i32 {
|
||||||
|
unsafe { (*self.as_ptr()).min_value }
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn max_value(&self) -> i32 {
|
||||||
|
unsafe { (*self.as_ptr()).max_value }
|
||||||
|
}
|
||||||
|
}
|
|
@ -114,6 +114,8 @@ mod video_hdr;
|
||||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
|
||||||
pub use crate::video_hdr::*;
|
pub use crate::video_hdr::*;
|
||||||
|
|
||||||
|
mod color_balance_channel;
|
||||||
|
|
||||||
pub const VIDEO_ENCODER_FLOW_NEED_DATA: gst::FlowSuccess = gst::FlowSuccess::CustomSuccess;
|
pub const VIDEO_ENCODER_FLOW_NEED_DATA: gst::FlowSuccess = gst::FlowSuccess::CustomSuccess;
|
||||||
pub const VIDEO_DECODER_FLOW_NEED_DATA: gst::FlowSuccess = gst::FlowSuccess::CustomSuccess;
|
pub const VIDEO_DECODER_FLOW_NEED_DATA: gst::FlowSuccess = gst::FlowSuccess::CustomSuccess;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue