// 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::ffi;
use glib::{prelude::*, translate::*, GStr};

#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
#[doc(alias = "GstAudioVisualizerShader")]
pub enum AudioVisualizerShader {
    #[doc(alias = "GST_AUDIO_VISUALIZER_SHADER_NONE")]
    None,
    #[doc(alias = "GST_AUDIO_VISUALIZER_SHADER_FADE")]
    Fade,
    #[doc(alias = "GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_UP")]
    FadeAndMoveUp,
    #[doc(alias = "GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_DOWN")]
    FadeAndMoveDown,
    #[doc(alias = "GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_LEFT")]
    FadeAndMoveLeft,
    #[doc(alias = "GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_RIGHT")]
    FadeAndMoveRight,
    #[doc(alias = "GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_HORIZ_OUT")]
    FadeAndMoveHorizOut,
    #[doc(alias = "GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_HORIZ_IN")]
    FadeAndMoveHorizIn,
    #[doc(alias = "GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_VERT_OUT")]
    FadeAndMoveVertOut,
    #[doc(alias = "GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_VERT_IN")]
    FadeAndMoveVertIn,
    #[doc(hidden)]
    __Unknown(i32),
}

#[doc(hidden)]
impl IntoGlib for AudioVisualizerShader {
    type GlibType = ffi::GstAudioVisualizerShader;

    #[inline]
    fn into_glib(self) -> ffi::GstAudioVisualizerShader {
        match self {
            Self::None => ffi::GST_AUDIO_VISUALIZER_SHADER_NONE,
            Self::Fade => ffi::GST_AUDIO_VISUALIZER_SHADER_FADE,
            Self::FadeAndMoveUp => ffi::GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_UP,
            Self::FadeAndMoveDown => ffi::GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_DOWN,
            Self::FadeAndMoveLeft => ffi::GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_LEFT,
            Self::FadeAndMoveRight => ffi::GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_RIGHT,
            Self::FadeAndMoveHorizOut => ffi::GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_HORIZ_OUT,
            Self::FadeAndMoveHorizIn => ffi::GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_HORIZ_IN,
            Self::FadeAndMoveVertOut => ffi::GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_VERT_OUT,
            Self::FadeAndMoveVertIn => ffi::GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_VERT_IN,
            Self::__Unknown(value) => value,
        }
    }
}

#[doc(hidden)]
impl FromGlib<ffi::GstAudioVisualizerShader> for AudioVisualizerShader {
    #[inline]
    unsafe fn from_glib(value: ffi::GstAudioVisualizerShader) -> Self {
        skip_assert_initialized!();

        match value {
            ffi::GST_AUDIO_VISUALIZER_SHADER_NONE => Self::None,
            ffi::GST_AUDIO_VISUALIZER_SHADER_FADE => Self::Fade,
            ffi::GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_UP => Self::FadeAndMoveUp,
            ffi::GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_DOWN => Self::FadeAndMoveDown,
            ffi::GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_LEFT => Self::FadeAndMoveLeft,
            ffi::GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_RIGHT => Self::FadeAndMoveRight,
            ffi::GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_HORIZ_OUT => Self::FadeAndMoveHorizOut,
            ffi::GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_HORIZ_IN => Self::FadeAndMoveHorizIn,
            ffi::GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_VERT_OUT => Self::FadeAndMoveVertOut,
            ffi::GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_VERT_IN => Self::FadeAndMoveVertIn,
            value => Self::__Unknown(value),
        }
    }
}

impl StaticType for AudioVisualizerShader {
    #[inline]
    #[doc(alias = "gst_audio_visualizer_shader_get_type")]
    fn static_type() -> glib::Type {
        unsafe { from_glib(ffi::gst_audio_visualizer_shader_get_type()) }
    }
}

impl glib::HasParamSpec for AudioVisualizerShader {
    type ParamSpec = glib::ParamSpecEnum;
    type SetValue = Self;
    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;

    fn param_spec_builder() -> Self::BuilderFn {
        Self::ParamSpec::builder_with_default
    }
}

impl glib::value::ValueType for AudioVisualizerShader {
    type Type = Self;
}

unsafe impl<'a> glib::value::FromValue<'a> for AudioVisualizerShader {
    type Checker = glib::value::GenericValueTypeChecker<Self>;

    #[inline]
    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 AudioVisualizerShader {
    #[inline]
    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
    }

    #[inline]
    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

impl From<AudioVisualizerShader> for glib::Value {
    #[inline]
    fn from(v: AudioVisualizerShader) -> Self {
        skip_assert_initialized!();
        ToValue::to_value(&v)
    }
}

#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
#[doc(alias = "GstDiscovererResult")]
pub enum DiscovererResult {
    #[doc(alias = "GST_DISCOVERER_OK")]
    Ok,
    #[doc(alias = "GST_DISCOVERER_URI_INVALID")]
    UriInvalid,
    #[doc(alias = "GST_DISCOVERER_ERROR")]
    Error,
    #[doc(alias = "GST_DISCOVERER_TIMEOUT")]
    Timeout,
    #[doc(alias = "GST_DISCOVERER_BUSY")]
    Busy,
    #[doc(alias = "GST_DISCOVERER_MISSING_PLUGINS")]
    MissingPlugins,
    #[doc(hidden)]
    __Unknown(i32),
}

#[doc(hidden)]
impl IntoGlib for DiscovererResult {
    type GlibType = ffi::GstDiscovererResult;

    #[inline]
    fn into_glib(self) -> ffi::GstDiscovererResult {
        match self {
            Self::Ok => ffi::GST_DISCOVERER_OK,
            Self::UriInvalid => ffi::GST_DISCOVERER_URI_INVALID,
            Self::Error => ffi::GST_DISCOVERER_ERROR,
            Self::Timeout => ffi::GST_DISCOVERER_TIMEOUT,
            Self::Busy => ffi::GST_DISCOVERER_BUSY,
            Self::MissingPlugins => ffi::GST_DISCOVERER_MISSING_PLUGINS,
            Self::__Unknown(value) => value,
        }
    }
}

#[doc(hidden)]
impl FromGlib<ffi::GstDiscovererResult> for DiscovererResult {
    #[inline]
    unsafe fn from_glib(value: ffi::GstDiscovererResult) -> Self {
        skip_assert_initialized!();

        match value {
            ffi::GST_DISCOVERER_OK => Self::Ok,
            ffi::GST_DISCOVERER_URI_INVALID => Self::UriInvalid,
            ffi::GST_DISCOVERER_ERROR => Self::Error,
            ffi::GST_DISCOVERER_TIMEOUT => Self::Timeout,
            ffi::GST_DISCOVERER_BUSY => Self::Busy,
            ffi::GST_DISCOVERER_MISSING_PLUGINS => Self::MissingPlugins,
            value => Self::__Unknown(value),
        }
    }
}

impl StaticType for DiscovererResult {
    #[inline]
    #[doc(alias = "gst_discoverer_result_get_type")]
    fn static_type() -> glib::Type {
        unsafe { from_glib(ffi::gst_discoverer_result_get_type()) }
    }
}

impl glib::HasParamSpec for DiscovererResult {
    type ParamSpec = glib::ParamSpecEnum;
    type SetValue = Self;
    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;

    fn param_spec_builder() -> Self::BuilderFn {
        Self::ParamSpec::builder_with_default
    }
}

impl glib::value::ValueType for DiscovererResult {
    type Type = Self;
}

unsafe impl<'a> glib::value::FromValue<'a> for DiscovererResult {
    type Checker = glib::value::GenericValueTypeChecker<Self>;

    #[inline]
    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 DiscovererResult {
    #[inline]
    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
    }

    #[inline]
    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

impl From<DiscovererResult> for glib::Value {
    #[inline]
    fn from(v: DiscovererResult) -> Self {
        skip_assert_initialized!();
        ToValue::to_value(&v)
    }
}

#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
#[doc(alias = "GstInstallPluginsReturn")]
pub enum InstallPluginsReturn {
    #[doc(alias = "GST_INSTALL_PLUGINS_SUCCESS")]
    Success,
    #[doc(alias = "GST_INSTALL_PLUGINS_NOT_FOUND")]
    NotFound,
    #[doc(alias = "GST_INSTALL_PLUGINS_ERROR")]
    Error,
    #[doc(alias = "GST_INSTALL_PLUGINS_PARTIAL_SUCCESS")]
    PartialSuccess,
    #[doc(alias = "GST_INSTALL_PLUGINS_USER_ABORT")]
    UserAbort,
    #[doc(alias = "GST_INSTALL_PLUGINS_CRASHED")]
    Crashed,
    #[doc(alias = "GST_INSTALL_PLUGINS_INVALID")]
    Invalid,
    #[doc(alias = "GST_INSTALL_PLUGINS_STARTED_OK")]
    StartedOk,
    #[doc(alias = "GST_INSTALL_PLUGINS_INTERNAL_FAILURE")]
    InternalFailure,
    #[doc(alias = "GST_INSTALL_PLUGINS_HELPER_MISSING")]
    HelperMissing,
    #[doc(alias = "GST_INSTALL_PLUGINS_INSTALL_IN_PROGRESS")]
    InstallInProgress,
    #[doc(hidden)]
    __Unknown(i32),
}

impl InstallPluginsReturn {
    pub fn name<'a>(self) -> &'a GStr {
        unsafe {
            GStr::from_ptr(
                ffi::gst_install_plugins_return_get_name(self.into_glib())
                    .as_ref()
                    .expect("gst_install_plugins_return_get_name returned NULL"),
            )
        }
    }
}

impl std::fmt::Display for InstallPluginsReturn {
    #[inline]
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
        f.write_str(&self.name())
    }
}

#[doc(hidden)]
impl IntoGlib for InstallPluginsReturn {
    type GlibType = ffi::GstInstallPluginsReturn;

    #[inline]
    fn into_glib(self) -> ffi::GstInstallPluginsReturn {
        match self {
            Self::Success => ffi::GST_INSTALL_PLUGINS_SUCCESS,
            Self::NotFound => ffi::GST_INSTALL_PLUGINS_NOT_FOUND,
            Self::Error => ffi::GST_INSTALL_PLUGINS_ERROR,
            Self::PartialSuccess => ffi::GST_INSTALL_PLUGINS_PARTIAL_SUCCESS,
            Self::UserAbort => ffi::GST_INSTALL_PLUGINS_USER_ABORT,
            Self::Crashed => ffi::GST_INSTALL_PLUGINS_CRASHED,
            Self::Invalid => ffi::GST_INSTALL_PLUGINS_INVALID,
            Self::StartedOk => ffi::GST_INSTALL_PLUGINS_STARTED_OK,
            Self::InternalFailure => ffi::GST_INSTALL_PLUGINS_INTERNAL_FAILURE,
            Self::HelperMissing => ffi::GST_INSTALL_PLUGINS_HELPER_MISSING,
            Self::InstallInProgress => ffi::GST_INSTALL_PLUGINS_INSTALL_IN_PROGRESS,
            Self::__Unknown(value) => value,
        }
    }
}

#[doc(hidden)]
impl FromGlib<ffi::GstInstallPluginsReturn> for InstallPluginsReturn {
    #[inline]
    unsafe fn from_glib(value: ffi::GstInstallPluginsReturn) -> Self {
        skip_assert_initialized!();

        match value {
            ffi::GST_INSTALL_PLUGINS_SUCCESS => Self::Success,
            ffi::GST_INSTALL_PLUGINS_NOT_FOUND => Self::NotFound,
            ffi::GST_INSTALL_PLUGINS_ERROR => Self::Error,
            ffi::GST_INSTALL_PLUGINS_PARTIAL_SUCCESS => Self::PartialSuccess,
            ffi::GST_INSTALL_PLUGINS_USER_ABORT => Self::UserAbort,
            ffi::GST_INSTALL_PLUGINS_CRASHED => Self::Crashed,
            ffi::GST_INSTALL_PLUGINS_INVALID => Self::Invalid,
            ffi::GST_INSTALL_PLUGINS_STARTED_OK => Self::StartedOk,
            ffi::GST_INSTALL_PLUGINS_INTERNAL_FAILURE => Self::InternalFailure,
            ffi::GST_INSTALL_PLUGINS_HELPER_MISSING => Self::HelperMissing,
            ffi::GST_INSTALL_PLUGINS_INSTALL_IN_PROGRESS => Self::InstallInProgress,
            value => Self::__Unknown(value),
        }
    }
}

impl StaticType for InstallPluginsReturn {
    #[inline]
    #[doc(alias = "gst_install_plugins_return_get_type")]
    fn static_type() -> glib::Type {
        unsafe { from_glib(ffi::gst_install_plugins_return_get_type()) }
    }
}

impl glib::HasParamSpec for InstallPluginsReturn {
    type ParamSpec = glib::ParamSpecEnum;
    type SetValue = Self;
    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;

    fn param_spec_builder() -> Self::BuilderFn {
        Self::ParamSpec::builder_with_default
    }
}

impl glib::value::ValueType for InstallPluginsReturn {
    type Type = Self;
}

unsafe impl<'a> glib::value::FromValue<'a> for InstallPluginsReturn {
    type Checker = glib::value::GenericValueTypeChecker<Self>;

    #[inline]
    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 InstallPluginsReturn {
    #[inline]
    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
    }

    #[inline]
    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

impl From<InstallPluginsReturn> for glib::Value {
    #[inline]
    fn from(v: InstallPluginsReturn) -> Self {
        skip_assert_initialized!();
        ToValue::to_value(&v)
    }
}
