gstreamer-rs/gstreamer-controller/src/auto/enums.rs
Marijn Suijten e8f340c60a Update gir and regenerate with clippy::use_self fixes
`Self` is now used in more places, shortening the code and making it
more readable at the same time.
2021-04-30 10:02:44 +02:00

171 lines
4.7 KiB
Rust

// 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::translate::*;
use glib::value::FromValue;
use glib::value::ToValue;
use glib::StaticType;
use glib::Type;
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
#[doc(alias = "GstInterpolationMode")]
pub enum InterpolationMode {
#[doc(alias = "GST_INTERPOLATION_MODE_NONE")]
None,
#[doc(alias = "GST_INTERPOLATION_MODE_LINEAR")]
Linear,
#[doc(alias = "GST_INTERPOLATION_MODE_CUBIC")]
Cubic,
#[doc(alias = "GST_INTERPOLATION_MODE_CUBIC_MONOTONIC")]
CubicMonotonic,
#[doc(hidden)]
__Unknown(i32),
}
#[doc(hidden)]
impl IntoGlib for InterpolationMode {
type GlibType = ffi::GstInterpolationMode;
fn into_glib(self) -> ffi::GstInterpolationMode {
match self {
Self::None => ffi::GST_INTERPOLATION_MODE_NONE,
Self::Linear => ffi::GST_INTERPOLATION_MODE_LINEAR,
Self::Cubic => ffi::GST_INTERPOLATION_MODE_CUBIC,
Self::CubicMonotonic => ffi::GST_INTERPOLATION_MODE_CUBIC_MONOTONIC,
Self::__Unknown(value) => value,
}
}
}
#[doc(hidden)]
impl FromGlib<ffi::GstInterpolationMode> for InterpolationMode {
unsafe fn from_glib(value: ffi::GstInterpolationMode) -> Self {
skip_assert_initialized!();
match value {
0 => Self::None,
1 => Self::Linear,
2 => Self::Cubic,
3 => Self::CubicMonotonic,
value => Self::__Unknown(value),
}
}
}
impl StaticType for InterpolationMode {
fn static_type() -> Type {
unsafe { from_glib(ffi::gst_interpolation_mode_get_type()) }
}
}
impl glib::value::ValueType for InterpolationMode {
type Type = Self;
}
unsafe impl<'a> FromValue<'a> for InterpolationMode {
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 InterpolationMode {
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()
}
}
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
#[doc(alias = "GstLFOWaveform")]
pub enum LFOWaveform {
#[doc(alias = "GST_LFO_WAVEFORM_SINE")]
Sine,
#[doc(alias = "GST_LFO_WAVEFORM_SQUARE")]
Square,
#[doc(alias = "GST_LFO_WAVEFORM_SAW")]
Saw,
#[doc(alias = "GST_LFO_WAVEFORM_REVERSE_SAW")]
ReverseSaw,
#[doc(alias = "GST_LFO_WAVEFORM_TRIANGLE")]
Triangle,
#[doc(hidden)]
__Unknown(i32),
}
#[doc(hidden)]
impl IntoGlib for LFOWaveform {
type GlibType = ffi::GstLFOWaveform;
fn into_glib(self) -> ffi::GstLFOWaveform {
match self {
Self::Sine => ffi::GST_LFO_WAVEFORM_SINE,
Self::Square => ffi::GST_LFO_WAVEFORM_SQUARE,
Self::Saw => ffi::GST_LFO_WAVEFORM_SAW,
Self::ReverseSaw => ffi::GST_LFO_WAVEFORM_REVERSE_SAW,
Self::Triangle => ffi::GST_LFO_WAVEFORM_TRIANGLE,
Self::__Unknown(value) => value,
}
}
}
#[doc(hidden)]
impl FromGlib<ffi::GstLFOWaveform> for LFOWaveform {
unsafe fn from_glib(value: ffi::GstLFOWaveform) -> Self {
skip_assert_initialized!();
match value {
0 => Self::Sine,
1 => Self::Square,
2 => Self::Saw,
3 => Self::ReverseSaw,
4 => Self::Triangle,
value => Self::__Unknown(value),
}
}
}
impl StaticType for LFOWaveform {
fn static_type() -> Type {
unsafe { from_glib(ffi::gst_lfo_waveform_get_type()) }
}
}
impl glib::value::ValueType for LFOWaveform {
type Type = Self;
}
unsafe impl<'a> FromValue<'a> for LFOWaveform {
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 LFOWaveform {
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()
}
}