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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT

use glib::error::ErrorDomain;
use glib::translate::*;
use glib::value::FromValue;
use glib::value::FromValueOptional;
use glib::value::SetValue;
use glib::value::Value;
use glib::Quark;
use glib::StaticType;
use glib::Type;
use gobject_sys;
use gst_player_sys;

#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
pub enum PlayerColorBalanceType {
    Hue,
    Brightness,
    Saturation,
    Contrast,
    #[doc(hidden)]
    __Unknown(i32),
}

#[doc(hidden)]
impl ToGlib for PlayerColorBalanceType {
    type GlibType = gst_player_sys::GstPlayerColorBalanceType;

    fn to_glib(&self) -> gst_player_sys::GstPlayerColorBalanceType {
        match *self {
            PlayerColorBalanceType::Hue => gst_player_sys::GST_PLAYER_COLOR_BALANCE_HUE,
            PlayerColorBalanceType::Brightness => {
                gst_player_sys::GST_PLAYER_COLOR_BALANCE_BRIGHTNESS
            }
            PlayerColorBalanceType::Saturation => {
                gst_player_sys::GST_PLAYER_COLOR_BALANCE_SATURATION
            }
            PlayerColorBalanceType::Contrast => gst_player_sys::GST_PLAYER_COLOR_BALANCE_CONTRAST,
            PlayerColorBalanceType::__Unknown(value) => value,
        }
    }
}

#[doc(hidden)]
impl FromGlib<gst_player_sys::GstPlayerColorBalanceType> for PlayerColorBalanceType {
    fn from_glib(value: gst_player_sys::GstPlayerColorBalanceType) -> Self {
        skip_assert_initialized!();
        match value {
            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(gst_player_sys::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(gobject_sys::g_value_get_enum(value.to_glib_none().0))
    }
}

impl SetValue for PlayerColorBalanceType {
    unsafe fn set_value(value: &mut Value, this: &Self) {
        gobject_sys::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib())
    }
}

#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
pub enum PlayerError {
    Failed,
    #[doc(hidden)]
    __Unknown(i32),
}

#[doc(hidden)]
impl ToGlib for PlayerError {
    type GlibType = gst_player_sys::GstPlayerError;

    fn to_glib(&self) -> gst_player_sys::GstPlayerError {
        match *self {
            PlayerError::Failed => gst_player_sys::GST_PLAYER_ERROR_FAILED,
            PlayerError::__Unknown(value) => value,
        }
    }
}

#[doc(hidden)]
impl FromGlib<gst_player_sys::GstPlayerError> for PlayerError {
    fn from_glib(value: gst_player_sys::GstPlayerError) -> Self {
        skip_assert_initialized!();
        match value {
            0 => PlayerError::Failed,
            value => PlayerError::__Unknown(value),
        }
    }
}

impl ErrorDomain for PlayerError {
    fn domain() -> Quark {
        skip_assert_initialized!();
        unsafe { from_glib(gst_player_sys::gst_player_error_quark()) }
    }

    fn code(self) -> i32 {
        self.to_glib()
    }

    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(gst_player_sys::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(gobject_sys::g_value_get_enum(value.to_glib_none().0))
    }
}

impl SetValue for PlayerError {
    unsafe fn set_value(value: &mut Value, this: &Self) {
        gobject_sys::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib())
    }
}

#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
pub enum PlayerSnapshotFormat {
    RawNative,
    RawXrgb,
    RawBgrx,
    Jpg,
    Png,
    #[doc(hidden)]
    __Unknown(i32),
}

#[doc(hidden)]
impl ToGlib for PlayerSnapshotFormat {
    type GlibType = gst_player_sys::GstPlayerSnapshotFormat;

    fn to_glib(&self) -> gst_player_sys::GstPlayerSnapshotFormat {
        match *self {
            PlayerSnapshotFormat::RawNative => gst_player_sys::GST_PLAYER_THUMBNAIL_RAW_NATIVE,
            PlayerSnapshotFormat::RawXrgb => gst_player_sys::GST_PLAYER_THUMBNAIL_RAW_xRGB,
            PlayerSnapshotFormat::RawBgrx => gst_player_sys::GST_PLAYER_THUMBNAIL_RAW_BGRx,
            PlayerSnapshotFormat::Jpg => gst_player_sys::GST_PLAYER_THUMBNAIL_JPG,
            PlayerSnapshotFormat::Png => gst_player_sys::GST_PLAYER_THUMBNAIL_PNG,
            PlayerSnapshotFormat::__Unknown(value) => value,
        }
    }
}

#[doc(hidden)]
impl FromGlib<gst_player_sys::GstPlayerSnapshotFormat> for PlayerSnapshotFormat {
    fn from_glib(value: gst_player_sys::GstPlayerSnapshotFormat) -> Self {
        skip_assert_initialized!();
        match value {
            0 => PlayerSnapshotFormat::RawNative,
            1 => PlayerSnapshotFormat::RawXrgb,
            2 => PlayerSnapshotFormat::RawBgrx,
            3 => PlayerSnapshotFormat::Jpg,
            4 => PlayerSnapshotFormat::Png,
            value => PlayerSnapshotFormat::__Unknown(value),
        }
    }
}

#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
pub enum PlayerState {
    Stopped,
    Buffering,
    Paused,
    Playing,
    #[doc(hidden)]
    __Unknown(i32),
}

#[doc(hidden)]
impl ToGlib for PlayerState {
    type GlibType = gst_player_sys::GstPlayerState;

    fn to_glib(&self) -> gst_player_sys::GstPlayerState {
        match *self {
            PlayerState::Stopped => gst_player_sys::GST_PLAYER_STATE_STOPPED,
            PlayerState::Buffering => gst_player_sys::GST_PLAYER_STATE_BUFFERING,
            PlayerState::Paused => gst_player_sys::GST_PLAYER_STATE_PAUSED,
            PlayerState::Playing => gst_player_sys::GST_PLAYER_STATE_PLAYING,
            PlayerState::__Unknown(value) => value,
        }
    }
}

#[doc(hidden)]
impl FromGlib<gst_player_sys::GstPlayerState> for PlayerState {
    fn from_glib(value: gst_player_sys::GstPlayerState) -> Self {
        skip_assert_initialized!();
        match value {
            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(gst_player_sys::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(gobject_sys::g_value_get_enum(value.to_glib_none().0))
    }
}

impl SetValue for PlayerState {
    unsafe fn set_value(value: &mut Value, this: &Self) {
        gobject_sys::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib())
    }
}