gstreamer-rs/gstreamer-player/src/auto/enums.rs
2017-08-17 14:50:25 +03:00

254 lines
7.3 KiB
Rust

// This file was generated by gir (651da6e) from gir-files (???)
// DO NOT EDIT
use ffi;
use glib_ffi;
use glib::error::ErrorDomain;
use glib::Type;
use glib::StaticType;
use glib::value::{Value, SetValue, FromValue, FromValueOptional};
use gobject_ffi;
use glib::translate::*;
use std;
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]
pub enum PlayerColorBalanceType {
Hue,
Brightness,
Saturation,
Contrast,
#[doc(hidden)]
__Unknown(i32),
}
#[doc(hidden)]
impl ToGlib for PlayerColorBalanceType {
type GlibType = ffi::GstPlayerColorBalanceType;
fn to_glib(&self) -> ffi::GstPlayerColorBalanceType {
match *self {
PlayerColorBalanceType::Hue => ffi::GST_PLAYER_COLOR_BALANCE_HUE,
PlayerColorBalanceType::Brightness => ffi::GST_PLAYER_COLOR_BALANCE_BRIGHTNESS,
PlayerColorBalanceType::Saturation => ffi::GST_PLAYER_COLOR_BALANCE_SATURATION,
PlayerColorBalanceType::Contrast => ffi::GST_PLAYER_COLOR_BALANCE_CONTRAST,
PlayerColorBalanceType::__Unknown(value) => unsafe{std::mem::transmute(value)}
}
}
}
#[doc(hidden)]
impl FromGlib<ffi::GstPlayerColorBalanceType> for PlayerColorBalanceType {
fn from_glib(value: ffi::GstPlayerColorBalanceType) -> Self {
skip_assert_initialized!();
match value as i32 {
3 => PlayerColorBalanceType::Hue,
0 => PlayerColorBalanceType::Brightness,
2 => PlayerColorBalanceType::Saturation,
1 => PlayerColorBalanceType::Contrast,
value => PlayerColorBalanceType::__Unknown(value),
}
}
}
impl StaticType for PlayerColorBalanceType {
fn static_type() -> Type {
unsafe { from_glib(ffi::gst_player_color_balance_type_get_type()) }
}
}
impl<'a> FromValueOptional<'a> for PlayerColorBalanceType {
unsafe fn from_value_optional(value: &Value) -> Option<Self> {
Some(FromValue::from_value(value))
}
}
impl<'a> FromValue<'a> for PlayerColorBalanceType {
unsafe fn from_value(value: &Value) -> Self {
from_glib(std::mem::transmute::<i32, ffi::GstPlayerColorBalanceType>(gobject_ffi::g_value_get_enum(value.to_glib_none().0)))
}
}
impl SetValue for PlayerColorBalanceType {
unsafe fn set_value(value: &mut Value, this: &Self) {
gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib() as i32)
}
}
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]
pub enum PlayerError {
Failed,
#[doc(hidden)]
__Unknown(i32),
}
#[doc(hidden)]
impl ToGlib for PlayerError {
type GlibType = ffi::GstPlayerError;
fn to_glib(&self) -> ffi::GstPlayerError {
match *self {
PlayerError::Failed => ffi::GST_PLAYER_ERROR_FAILED,
PlayerError::__Unknown(value) => unsafe{std::mem::transmute(value)}
}
}
}
#[doc(hidden)]
impl FromGlib<ffi::GstPlayerError> for PlayerError {
fn from_glib(value: ffi::GstPlayerError) -> Self {
skip_assert_initialized!();
match value as i32 {
0 => PlayerError::Failed,
value => PlayerError::__Unknown(value),
}
}
}
impl ErrorDomain for PlayerError {
fn domain() -> glib_ffi::GQuark {
skip_assert_initialized!();
unsafe { ffi::gst_player_error_quark() }
}
fn code(self) -> i32 {
self.to_glib() as i32
}
fn from(code: i32) -> Option<Self> {
skip_assert_initialized!();
match code {
0 => Some(PlayerError::Failed),
_ => Some(PlayerError::Failed),
}
}
}
impl StaticType for PlayerError {
fn static_type() -> Type {
unsafe { from_glib(ffi::gst_player_error_get_type()) }
}
}
impl<'a> FromValueOptional<'a> for PlayerError {
unsafe fn from_value_optional(value: &Value) -> Option<Self> {
Some(FromValue::from_value(value))
}
}
impl<'a> FromValue<'a> for PlayerError {
unsafe fn from_value(value: &Value) -> Self {
from_glib(std::mem::transmute::<i32, ffi::GstPlayerError>(gobject_ffi::g_value_get_enum(value.to_glib_none().0)))
}
}
impl SetValue for PlayerError {
unsafe fn set_value(value: &mut Value, this: &Self) {
gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib() as i32)
}
}
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]
pub enum PlayerSnapshotFormat {
RawNative,
RawXrgb,
RawBgrx,
Jpg,
Png,
#[doc(hidden)]
__Unknown(i32),
}
#[doc(hidden)]
impl ToGlib for PlayerSnapshotFormat {
type GlibType = ffi::GstPlayerSnapshotFormat;
fn to_glib(&self) -> ffi::GstPlayerSnapshotFormat {
match *self {
PlayerSnapshotFormat::RawNative => ffi::GST_PLAYER_THUMBNAIL_RAW_NATIVE,
PlayerSnapshotFormat::RawXrgb => ffi::GST_PLAYER_THUMBNAIL_RAW_xRGB,
PlayerSnapshotFormat::RawBgrx => ffi::GST_PLAYER_THUMBNAIL_RAW_BGRx,
PlayerSnapshotFormat::Jpg => ffi::GST_PLAYER_THUMBNAIL_JPG,
PlayerSnapshotFormat::Png => ffi::GST_PLAYER_THUMBNAIL_PNG,
PlayerSnapshotFormat::__Unknown(value) => unsafe{std::mem::transmute(value)}
}
}
}
#[doc(hidden)]
impl FromGlib<ffi::GstPlayerSnapshotFormat> for PlayerSnapshotFormat {
fn from_glib(value: ffi::GstPlayerSnapshotFormat) -> Self {
skip_assert_initialized!();
match value as i32 {
0 => PlayerSnapshotFormat::RawNative,
1 => PlayerSnapshotFormat::RawXrgb,
2 => PlayerSnapshotFormat::RawBgrx,
3 => PlayerSnapshotFormat::Jpg,
4 => PlayerSnapshotFormat::Png,
value => PlayerSnapshotFormat::__Unknown(value),
}
}
}
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]
pub enum PlayerState {
Stopped,
Buffering,
Paused,
Playing,
#[doc(hidden)]
__Unknown(i32),
}
#[doc(hidden)]
impl ToGlib for PlayerState {
type GlibType = ffi::GstPlayerState;
fn to_glib(&self) -> ffi::GstPlayerState {
match *self {
PlayerState::Stopped => ffi::GST_PLAYER_STATE_STOPPED,
PlayerState::Buffering => ffi::GST_PLAYER_STATE_BUFFERING,
PlayerState::Paused => ffi::GST_PLAYER_STATE_PAUSED,
PlayerState::Playing => ffi::GST_PLAYER_STATE_PLAYING,
PlayerState::__Unknown(value) => unsafe{std::mem::transmute(value)}
}
}
}
#[doc(hidden)]
impl FromGlib<ffi::GstPlayerState> for PlayerState {
fn from_glib(value: ffi::GstPlayerState) -> Self {
skip_assert_initialized!();
match value as i32 {
0 => PlayerState::Stopped,
1 => PlayerState::Buffering,
2 => PlayerState::Paused,
3 => PlayerState::Playing,
value => PlayerState::__Unknown(value),
}
}
}
impl StaticType for PlayerState {
fn static_type() -> Type {
unsafe { from_glib(ffi::gst_player_state_get_type()) }
}
}
impl<'a> FromValueOptional<'a> for PlayerState {
unsafe fn from_value_optional(value: &Value) -> Option<Self> {
Some(FromValue::from_value(value))
}
}
impl<'a> FromValue<'a> for PlayerState {
unsafe fn from_value(value: &Value) -> Self {
from_glib(std::mem::transmute::<i32, ffi::GstPlayerState>(gobject_ffi::g_value_get_enum(value.to_glib_none().0)))
}
}
impl SetValue for PlayerState {
unsafe fn set_value(value: &mut Value, this: &Self) {
gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib() as i32)
}
}