gstreamer/auto/
enums.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
4// DO NOT EDIT
5
6use crate::{ffi, EventTypeFlags};
7use glib::{prelude::*, translate::*, GStr};
8
9/// The different types of buffering methods.
10#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
11#[non_exhaustive]
12#[doc(alias = "GstBufferingMode")]
13pub enum BufferingMode {
14    /// a small amount of data is buffered
15    #[doc(alias = "GST_BUFFERING_STREAM")]
16    Stream,
17    /// the stream is being downloaded
18    #[doc(alias = "GST_BUFFERING_DOWNLOAD")]
19    Download,
20    /// the stream is being downloaded in a ringbuffer
21    #[doc(alias = "GST_BUFFERING_TIMESHIFT")]
22    Timeshift,
23    /// the stream is a live stream
24    #[doc(alias = "GST_BUFFERING_LIVE")]
25    Live,
26    #[doc(hidden)]
27    __Unknown(i32),
28}
29
30#[doc(hidden)]
31impl IntoGlib for BufferingMode {
32    type GlibType = ffi::GstBufferingMode;
33
34    #[inline]
35    fn into_glib(self) -> ffi::GstBufferingMode {
36        match self {
37            Self::Stream => ffi::GST_BUFFERING_STREAM,
38            Self::Download => ffi::GST_BUFFERING_DOWNLOAD,
39            Self::Timeshift => ffi::GST_BUFFERING_TIMESHIFT,
40            Self::Live => ffi::GST_BUFFERING_LIVE,
41            Self::__Unknown(value) => value,
42        }
43    }
44}
45
46#[doc(hidden)]
47impl FromGlib<ffi::GstBufferingMode> for BufferingMode {
48    #[inline]
49    unsafe fn from_glib(value: ffi::GstBufferingMode) -> Self {
50        skip_assert_initialized!();
51
52        match value {
53            ffi::GST_BUFFERING_STREAM => Self::Stream,
54            ffi::GST_BUFFERING_DOWNLOAD => Self::Download,
55            ffi::GST_BUFFERING_TIMESHIFT => Self::Timeshift,
56            ffi::GST_BUFFERING_LIVE => Self::Live,
57            value => Self::__Unknown(value),
58        }
59    }
60}
61
62impl StaticType for BufferingMode {
63    #[inline]
64    #[doc(alias = "gst_buffering_mode_get_type")]
65    fn static_type() -> glib::Type {
66        unsafe { from_glib(ffi::gst_buffering_mode_get_type()) }
67    }
68}
69
70impl glib::HasParamSpec for BufferingMode {
71    type ParamSpec = glib::ParamSpecEnum;
72    type SetValue = Self;
73    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
74
75    fn param_spec_builder() -> Self::BuilderFn {
76        Self::ParamSpec::builder_with_default
77    }
78}
79
80impl glib::value::ValueType for BufferingMode {
81    type Type = Self;
82}
83
84unsafe impl<'a> glib::value::FromValue<'a> for BufferingMode {
85    type Checker = glib::value::GenericValueTypeChecker<Self>;
86
87    #[inline]
88    unsafe fn from_value(value: &'a glib::Value) -> Self {
89        skip_assert_initialized!();
90        from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0))
91    }
92}
93
94impl ToValue for BufferingMode {
95    #[inline]
96    fn to_value(&self) -> glib::Value {
97        let mut value = glib::Value::for_value_type::<Self>();
98        unsafe {
99            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
100        }
101        value
102    }
103
104    #[inline]
105    fn value_type(&self) -> glib::Type {
106        Self::static_type()
107    }
108}
109
110impl From<BufferingMode> for glib::Value {
111    #[inline]
112    fn from(v: BufferingMode) -> Self {
113        skip_assert_initialized!();
114        ToValue::to_value(&v)
115    }
116}
117
118/// The result values for a GstBusSyncHandler.
119#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
120#[repr(i32)]
121#[doc(alias = "GstBusSyncReply")]
122pub enum BusSyncReply {
123    /// drop the message
124    #[doc(alias = "GST_BUS_DROP")]
125    Drop = ffi::GST_BUS_DROP,
126    /// pass the message to the async queue
127    #[doc(alias = "GST_BUS_PASS")]
128    Pass = ffi::GST_BUS_PASS,
129    /// pass message to async queue, continue if message is handled
130    #[doc(alias = "GST_BUS_ASYNC")]
131    Async = ffi::GST_BUS_ASYNC,
132}
133
134#[doc(hidden)]
135impl IntoGlib for BusSyncReply {
136    type GlibType = ffi::GstBusSyncReply;
137
138    #[inline]
139    fn into_glib(self) -> ffi::GstBusSyncReply {
140        self as ffi::GstBusSyncReply
141    }
142}
143
144#[doc(hidden)]
145impl FromGlib<ffi::GstBusSyncReply> for BusSyncReply {
146    #[inline]
147    unsafe fn from_glib(value: ffi::GstBusSyncReply) -> Self {
148        skip_assert_initialized!();
149
150        debug_assert!([ffi::GST_BUS_DROP, ffi::GST_BUS_PASS, ffi::GST_BUS_ASYNC].contains(&value));
151        std::mem::transmute(value)
152    }
153}
154
155impl StaticType for BusSyncReply {
156    #[inline]
157    #[doc(alias = "gst_bus_sync_reply_get_type")]
158    fn static_type() -> glib::Type {
159        unsafe { from_glib(ffi::gst_bus_sync_reply_get_type()) }
160    }
161}
162
163impl glib::HasParamSpec for BusSyncReply {
164    type ParamSpec = glib::ParamSpecEnum;
165    type SetValue = Self;
166    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
167
168    fn param_spec_builder() -> Self::BuilderFn {
169        Self::ParamSpec::builder_with_default
170    }
171}
172
173impl glib::value::ValueType for BusSyncReply {
174    type Type = Self;
175}
176
177unsafe impl<'a> glib::value::FromValue<'a> for BusSyncReply {
178    type Checker = glib::value::GenericValueTypeChecker<Self>;
179
180    #[inline]
181    unsafe fn from_value(value: &'a glib::Value) -> Self {
182        skip_assert_initialized!();
183        from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0))
184    }
185}
186
187impl ToValue for BusSyncReply {
188    #[inline]
189    fn to_value(&self) -> glib::Value {
190        let mut value = glib::Value::for_value_type::<Self>();
191        unsafe {
192            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
193        }
194        value
195    }
196
197    #[inline]
198    fn value_type(&self) -> glib::Type {
199        Self::static_type()
200    }
201}
202
203impl From<BusSyncReply> for glib::Value {
204    #[inline]
205    fn from(v: BusSyncReply) -> Self {
206        skip_assert_initialized!();
207        ToValue::to_value(&v)
208    }
209}
210
211/// Modes of caps intersection
212///
213/// [`ZigZag`][Self::ZigZag] tries to preserve overall order of both caps
214/// by iterating on the caps' structures as the following matrix shows:
215///
216/// ```text
217///          caps1
218///       +-------------
219///       | 1  2  4  7
220/// caps2 | 3  5  8 10
221///       | 6  9 11 12
222/// ```
223///
224/// Used when there is no explicit precedence of one caps over the other. e.g.
225/// tee's sink pad getcaps function, it will probe its src pad peers' for their
226/// caps and intersect them with this mode.
227///
228/// [`First`][Self::First] is useful when an element wants to preserve
229/// another element's caps priority order when intersecting with its own caps.
230/// Example: If caps1 is `[A, B, C]` and caps2 is `[E, B, D, A]`, the result
231/// would be `[A, B]`, maintaining the first caps priority on the intersection.
232#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
233#[non_exhaustive]
234#[doc(alias = "GstCapsIntersectMode")]
235pub enum CapsIntersectMode {
236    /// Zig-zags over both caps.
237    #[doc(alias = "GST_CAPS_INTERSECT_ZIG_ZAG")]
238    ZigZag,
239    /// Keeps the first caps order.
240    #[doc(alias = "GST_CAPS_INTERSECT_FIRST")]
241    First,
242    #[doc(hidden)]
243    __Unknown(i32),
244}
245
246#[doc(hidden)]
247impl IntoGlib for CapsIntersectMode {
248    type GlibType = ffi::GstCapsIntersectMode;
249
250    #[inline]
251    fn into_glib(self) -> ffi::GstCapsIntersectMode {
252        match self {
253            Self::ZigZag => ffi::GST_CAPS_INTERSECT_ZIG_ZAG,
254            Self::First => ffi::GST_CAPS_INTERSECT_FIRST,
255            Self::__Unknown(value) => value,
256        }
257    }
258}
259
260#[doc(hidden)]
261impl FromGlib<ffi::GstCapsIntersectMode> for CapsIntersectMode {
262    #[inline]
263    unsafe fn from_glib(value: ffi::GstCapsIntersectMode) -> Self {
264        skip_assert_initialized!();
265
266        match value {
267            ffi::GST_CAPS_INTERSECT_ZIG_ZAG => Self::ZigZag,
268            ffi::GST_CAPS_INTERSECT_FIRST => Self::First,
269            value => Self::__Unknown(value),
270        }
271    }
272}
273
274impl StaticType for CapsIntersectMode {
275    #[inline]
276    #[doc(alias = "gst_caps_intersect_mode_get_type")]
277    fn static_type() -> glib::Type {
278        unsafe { from_glib(ffi::gst_caps_intersect_mode_get_type()) }
279    }
280}
281
282impl glib::HasParamSpec for CapsIntersectMode {
283    type ParamSpec = glib::ParamSpecEnum;
284    type SetValue = Self;
285    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
286
287    fn param_spec_builder() -> Self::BuilderFn {
288        Self::ParamSpec::builder_with_default
289    }
290}
291
292impl glib::value::ValueType for CapsIntersectMode {
293    type Type = Self;
294}
295
296unsafe impl<'a> glib::value::FromValue<'a> for CapsIntersectMode {
297    type Checker = glib::value::GenericValueTypeChecker<Self>;
298
299    #[inline]
300    unsafe fn from_value(value: &'a glib::Value) -> Self {
301        skip_assert_initialized!();
302        from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0))
303    }
304}
305
306impl ToValue for CapsIntersectMode {
307    #[inline]
308    fn to_value(&self) -> glib::Value {
309        let mut value = glib::Value::for_value_type::<Self>();
310        unsafe {
311            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
312        }
313        value
314    }
315
316    #[inline]
317    fn value_type(&self) -> glib::Type {
318        Self::static_type()
319    }
320}
321
322impl From<CapsIntersectMode> for glib::Value {
323    #[inline]
324    fn from(v: CapsIntersectMode) -> Self {
325        skip_assert_initialized!();
326        ToValue::to_value(&v)
327    }
328}
329
330/// The type of the clock entry
331#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
332#[non_exhaustive]
333#[doc(alias = "GstClockEntryType")]
334pub enum ClockEntryType {
335    /// a single shot timeout
336    #[doc(alias = "GST_CLOCK_ENTRY_SINGLE")]
337    Single,
338    /// a periodic timeout request
339    #[doc(alias = "GST_CLOCK_ENTRY_PERIODIC")]
340    Periodic,
341    #[doc(hidden)]
342    __Unknown(i32),
343}
344
345#[doc(hidden)]
346impl IntoGlib for ClockEntryType {
347    type GlibType = ffi::GstClockEntryType;
348
349    #[inline]
350    fn into_glib(self) -> ffi::GstClockEntryType {
351        match self {
352            Self::Single => ffi::GST_CLOCK_ENTRY_SINGLE,
353            Self::Periodic => ffi::GST_CLOCK_ENTRY_PERIODIC,
354            Self::__Unknown(value) => value,
355        }
356    }
357}
358
359#[doc(hidden)]
360impl FromGlib<ffi::GstClockEntryType> for ClockEntryType {
361    #[inline]
362    unsafe fn from_glib(value: ffi::GstClockEntryType) -> Self {
363        skip_assert_initialized!();
364
365        match value {
366            ffi::GST_CLOCK_ENTRY_SINGLE => Self::Single,
367            ffi::GST_CLOCK_ENTRY_PERIODIC => Self::Periodic,
368            value => Self::__Unknown(value),
369        }
370    }
371}
372
373impl StaticType for ClockEntryType {
374    #[inline]
375    #[doc(alias = "gst_clock_entry_type_get_type")]
376    fn static_type() -> glib::Type {
377        unsafe { from_glib(ffi::gst_clock_entry_type_get_type()) }
378    }
379}
380
381impl glib::HasParamSpec for ClockEntryType {
382    type ParamSpec = glib::ParamSpecEnum;
383    type SetValue = Self;
384    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
385
386    fn param_spec_builder() -> Self::BuilderFn {
387        Self::ParamSpec::builder_with_default
388    }
389}
390
391impl glib::value::ValueType for ClockEntryType {
392    type Type = Self;
393}
394
395unsafe impl<'a> glib::value::FromValue<'a> for ClockEntryType {
396    type Checker = glib::value::GenericValueTypeChecker<Self>;
397
398    #[inline]
399    unsafe fn from_value(value: &'a glib::Value) -> Self {
400        skip_assert_initialized!();
401        from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0))
402    }
403}
404
405impl ToValue for ClockEntryType {
406    #[inline]
407    fn to_value(&self) -> glib::Value {
408        let mut value = glib::Value::for_value_type::<Self>();
409        unsafe {
410            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
411        }
412        value
413    }
414
415    #[inline]
416    fn value_type(&self) -> glib::Type {
417        Self::static_type()
418    }
419}
420
421impl From<ClockEntryType> for glib::Value {
422    #[inline]
423    fn from(v: ClockEntryType) -> Self {
424        skip_assert_initialized!();
425        ToValue::to_value(&v)
426    }
427}
428
429/// The return value of a clock operation.
430#[must_use]
431#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
432#[repr(i32)]
433#[doc(alias = "GstClockReturn")]
434pub enum ClockReturn {
435    /// The operation succeeded.
436    #[doc(alias = "GST_CLOCK_OK")]
437    Ok = ffi::GST_CLOCK_OK,
438    /// The operation was scheduled too late.
439    #[doc(alias = "GST_CLOCK_EARLY")]
440    Early = ffi::GST_CLOCK_EARLY,
441    /// The clockID was unscheduled
442    #[doc(alias = "GST_CLOCK_UNSCHEDULED")]
443    Unscheduled = ffi::GST_CLOCK_UNSCHEDULED,
444    /// The ClockID is busy
445    #[doc(alias = "GST_CLOCK_BUSY")]
446    Busy = ffi::GST_CLOCK_BUSY,
447    /// A bad time was provided to a function.
448    #[doc(alias = "GST_CLOCK_BADTIME")]
449    Badtime = ffi::GST_CLOCK_BADTIME,
450    /// An error occurred
451    #[doc(alias = "GST_CLOCK_ERROR")]
452    Error = ffi::GST_CLOCK_ERROR,
453    /// Operation is not supported
454    #[doc(alias = "GST_CLOCK_UNSUPPORTED")]
455    Unsupported = ffi::GST_CLOCK_UNSUPPORTED,
456    /// The ClockID is done waiting
457    #[doc(alias = "GST_CLOCK_DONE")]
458    Done = ffi::GST_CLOCK_DONE,
459}
460
461#[doc(hidden)]
462impl IntoGlib for ClockReturn {
463    type GlibType = ffi::GstClockReturn;
464
465    #[inline]
466    fn into_glib(self) -> ffi::GstClockReturn {
467        self as ffi::GstClockReturn
468    }
469}
470
471#[doc(hidden)]
472impl FromGlib<ffi::GstClockReturn> for ClockReturn {
473    #[inline]
474    unsafe fn from_glib(value: ffi::GstClockReturn) -> Self {
475        skip_assert_initialized!();
476
477        debug_assert!([
478            ffi::GST_CLOCK_OK,
479            ffi::GST_CLOCK_EARLY,
480            ffi::GST_CLOCK_UNSCHEDULED,
481            ffi::GST_CLOCK_BUSY,
482            ffi::GST_CLOCK_BADTIME,
483            ffi::GST_CLOCK_ERROR,
484            ffi::GST_CLOCK_UNSUPPORTED,
485            ffi::GST_CLOCK_DONE
486        ]
487        .contains(&value));
488        std::mem::transmute(value)
489    }
490}
491
492impl StaticType for ClockReturn {
493    #[inline]
494    #[doc(alias = "gst_clock_return_get_type")]
495    fn static_type() -> glib::Type {
496        unsafe { from_glib(ffi::gst_clock_return_get_type()) }
497    }
498}
499
500impl glib::HasParamSpec for ClockReturn {
501    type ParamSpec = glib::ParamSpecEnum;
502    type SetValue = Self;
503    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
504
505    fn param_spec_builder() -> Self::BuilderFn {
506        Self::ParamSpec::builder_with_default
507    }
508}
509
510impl glib::value::ValueType for ClockReturn {
511    type Type = Self;
512}
513
514unsafe impl<'a> glib::value::FromValue<'a> for ClockReturn {
515    type Checker = glib::value::GenericValueTypeChecker<Self>;
516
517    #[inline]
518    unsafe fn from_value(value: &'a glib::Value) -> Self {
519        skip_assert_initialized!();
520        from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0))
521    }
522}
523
524impl ToValue for ClockReturn {
525    #[inline]
526    fn to_value(&self) -> glib::Value {
527        let mut value = glib::Value::for_value_type::<Self>();
528        unsafe {
529            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
530        }
531        value
532    }
533
534    #[inline]
535    fn value_type(&self) -> glib::Type {
536        Self::static_type()
537    }
538}
539
540impl From<ClockReturn> for glib::Value {
541    #[inline]
542    fn from(v: ClockReturn) -> Self {
543        skip_assert_initialized!();
544        ToValue::to_value(&v)
545    }
546}
547
548/// The different kind of clocks.
549#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
550#[non_exhaustive]
551#[doc(alias = "GstClockType")]
552pub enum ClockType {
553    /// time since Epoch
554    #[doc(alias = "GST_CLOCK_TYPE_REALTIME")]
555    Realtime,
556    /// monotonic time since some unspecified starting
557    ///  point
558    #[doc(alias = "GST_CLOCK_TYPE_MONOTONIC")]
559    Monotonic,
560    /// some other time source is used (Since: 1.0.5)
561    #[doc(alias = "GST_CLOCK_TYPE_OTHER")]
562    Other,
563    /// time since Epoch, but using International Atomic Time
564    ///  as reference (Since: 1.18)
565    #[cfg(feature = "v1_18")]
566    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
567    #[doc(alias = "GST_CLOCK_TYPE_TAI")]
568    Tai,
569    #[doc(hidden)]
570    __Unknown(i32),
571}
572
573#[doc(hidden)]
574impl IntoGlib for ClockType {
575    type GlibType = ffi::GstClockType;
576
577    #[inline]
578    fn into_glib(self) -> ffi::GstClockType {
579        match self {
580            Self::Realtime => ffi::GST_CLOCK_TYPE_REALTIME,
581            Self::Monotonic => ffi::GST_CLOCK_TYPE_MONOTONIC,
582            Self::Other => ffi::GST_CLOCK_TYPE_OTHER,
583            #[cfg(feature = "v1_18")]
584            Self::Tai => ffi::GST_CLOCK_TYPE_TAI,
585            Self::__Unknown(value) => value,
586        }
587    }
588}
589
590#[doc(hidden)]
591impl FromGlib<ffi::GstClockType> for ClockType {
592    #[inline]
593    unsafe fn from_glib(value: ffi::GstClockType) -> Self {
594        skip_assert_initialized!();
595
596        match value {
597            ffi::GST_CLOCK_TYPE_REALTIME => Self::Realtime,
598            ffi::GST_CLOCK_TYPE_MONOTONIC => Self::Monotonic,
599            ffi::GST_CLOCK_TYPE_OTHER => Self::Other,
600            #[cfg(feature = "v1_18")]
601            ffi::GST_CLOCK_TYPE_TAI => Self::Tai,
602            value => Self::__Unknown(value),
603        }
604    }
605}
606
607impl StaticType for ClockType {
608    #[inline]
609    #[doc(alias = "gst_clock_type_get_type")]
610    fn static_type() -> glib::Type {
611        unsafe { from_glib(ffi::gst_clock_type_get_type()) }
612    }
613}
614
615impl glib::HasParamSpec for ClockType {
616    type ParamSpec = glib::ParamSpecEnum;
617    type SetValue = Self;
618    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
619
620    fn param_spec_builder() -> Self::BuilderFn {
621        Self::ParamSpec::builder_with_default
622    }
623}
624
625impl glib::value::ValueType for ClockType {
626    type Type = Self;
627}
628
629unsafe impl<'a> glib::value::FromValue<'a> for ClockType {
630    type Checker = glib::value::GenericValueTypeChecker<Self>;
631
632    #[inline]
633    unsafe fn from_value(value: &'a glib::Value) -> Self {
634        skip_assert_initialized!();
635        from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0))
636    }
637}
638
639impl ToValue for ClockType {
640    #[inline]
641    fn to_value(&self) -> glib::Value {
642        let mut value = glib::Value::for_value_type::<Self>();
643        unsafe {
644            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
645        }
646        value
647    }
648
649    #[inline]
650    fn value_type(&self) -> glib::Type {
651        Self::static_type()
652    }
653}
654
655impl From<ClockType> for glib::Value {
656    #[inline]
657    fn from(v: ClockType) -> Self {
658        skip_assert_initialized!();
659        ToValue::to_value(&v)
660    }
661}
662
663/// Core errors are errors inside the core GStreamer library.
664#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
665#[non_exhaustive]
666#[doc(alias = "GstCoreError")]
667pub enum CoreError {
668    /// a general error which doesn't fit in any other
669    /// category. Make sure you add a custom message to the error call.
670    #[doc(alias = "GST_CORE_ERROR_FAILED")]
671    Failed,
672    /// do not use this except as a placeholder for
673    /// deciding where to go while developing code.
674    #[doc(alias = "GST_CORE_ERROR_TOO_LAZY")]
675    TooLazy,
676    /// use this when you do not want to implement
677    /// this functionality yet.
678    #[doc(alias = "GST_CORE_ERROR_NOT_IMPLEMENTED")]
679    NotImplemented,
680    /// used for state change errors.
681    #[doc(alias = "GST_CORE_ERROR_STATE_CHANGE")]
682    StateChange,
683    /// used for pad-related errors.
684    #[doc(alias = "GST_CORE_ERROR_PAD")]
685    Pad,
686    /// used for thread-related errors.
687    #[doc(alias = "GST_CORE_ERROR_THREAD")]
688    Thread,
689    /// used for negotiation-related errors.
690    #[doc(alias = "GST_CORE_ERROR_NEGOTIATION")]
691    Negotiation,
692    /// used for event-related errors.
693    #[doc(alias = "GST_CORE_ERROR_EVENT")]
694    Event,
695    /// used for seek-related errors.
696    #[doc(alias = "GST_CORE_ERROR_SEEK")]
697    Seek,
698    /// used for caps-related errors.
699    #[doc(alias = "GST_CORE_ERROR_CAPS")]
700    Caps,
701    /// used for negotiation-related errors.
702    #[doc(alias = "GST_CORE_ERROR_TAG")]
703    Tag,
704    /// used if a plugin is missing.
705    #[doc(alias = "GST_CORE_ERROR_MISSING_PLUGIN")]
706    MissingPlugin,
707    /// used for clock related errors.
708    #[doc(alias = "GST_CORE_ERROR_CLOCK")]
709    Clock,
710    /// used if functionality has been disabled at
711    ///  compile time.
712    #[doc(alias = "GST_CORE_ERROR_DISABLED")]
713    Disabled,
714    #[doc(hidden)]
715    __Unknown(i32),
716}
717
718#[doc(hidden)]
719impl IntoGlib for CoreError {
720    type GlibType = ffi::GstCoreError;
721
722    fn into_glib(self) -> ffi::GstCoreError {
723        match self {
724            Self::Failed => ffi::GST_CORE_ERROR_FAILED,
725            Self::TooLazy => ffi::GST_CORE_ERROR_TOO_LAZY,
726            Self::NotImplemented => ffi::GST_CORE_ERROR_NOT_IMPLEMENTED,
727            Self::StateChange => ffi::GST_CORE_ERROR_STATE_CHANGE,
728            Self::Pad => ffi::GST_CORE_ERROR_PAD,
729            Self::Thread => ffi::GST_CORE_ERROR_THREAD,
730            Self::Negotiation => ffi::GST_CORE_ERROR_NEGOTIATION,
731            Self::Event => ffi::GST_CORE_ERROR_EVENT,
732            Self::Seek => ffi::GST_CORE_ERROR_SEEK,
733            Self::Caps => ffi::GST_CORE_ERROR_CAPS,
734            Self::Tag => ffi::GST_CORE_ERROR_TAG,
735            Self::MissingPlugin => ffi::GST_CORE_ERROR_MISSING_PLUGIN,
736            Self::Clock => ffi::GST_CORE_ERROR_CLOCK,
737            Self::Disabled => ffi::GST_CORE_ERROR_DISABLED,
738            Self::__Unknown(value) => value,
739        }
740    }
741}
742
743#[doc(hidden)]
744impl FromGlib<ffi::GstCoreError> for CoreError {
745    unsafe fn from_glib(value: ffi::GstCoreError) -> Self {
746        skip_assert_initialized!();
747
748        match value {
749            ffi::GST_CORE_ERROR_FAILED => Self::Failed,
750            ffi::GST_CORE_ERROR_TOO_LAZY => Self::TooLazy,
751            ffi::GST_CORE_ERROR_NOT_IMPLEMENTED => Self::NotImplemented,
752            ffi::GST_CORE_ERROR_STATE_CHANGE => Self::StateChange,
753            ffi::GST_CORE_ERROR_PAD => Self::Pad,
754            ffi::GST_CORE_ERROR_THREAD => Self::Thread,
755            ffi::GST_CORE_ERROR_NEGOTIATION => Self::Negotiation,
756            ffi::GST_CORE_ERROR_EVENT => Self::Event,
757            ffi::GST_CORE_ERROR_SEEK => Self::Seek,
758            ffi::GST_CORE_ERROR_CAPS => Self::Caps,
759            ffi::GST_CORE_ERROR_TAG => Self::Tag,
760            ffi::GST_CORE_ERROR_MISSING_PLUGIN => Self::MissingPlugin,
761            ffi::GST_CORE_ERROR_CLOCK => Self::Clock,
762            ffi::GST_CORE_ERROR_DISABLED => Self::Disabled,
763            value => Self::__Unknown(value),
764        }
765    }
766}
767
768impl glib::error::ErrorDomain for CoreError {
769    #[inline]
770    fn domain() -> glib::Quark {
771        skip_assert_initialized!();
772
773        unsafe { from_glib(ffi::gst_core_error_quark()) }
774    }
775
776    #[inline]
777    fn code(self) -> i32 {
778        self.into_glib()
779    }
780
781    #[inline]
782    #[allow(clippy::match_single_binding)]
783    fn from(code: i32) -> Option<Self> {
784        skip_assert_initialized!();
785        match unsafe { from_glib(code) } {
786            Self::__Unknown(_) => Some(Self::Failed),
787            value => Some(value),
788        }
789    }
790}
791
792impl StaticType for CoreError {
793    #[inline]
794    #[doc(alias = "gst_core_error_get_type")]
795    fn static_type() -> glib::Type {
796        unsafe { from_glib(ffi::gst_core_error_get_type()) }
797    }
798}
799
800impl glib::HasParamSpec for CoreError {
801    type ParamSpec = glib::ParamSpecEnum;
802    type SetValue = Self;
803    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
804
805    fn param_spec_builder() -> Self::BuilderFn {
806        Self::ParamSpec::builder_with_default
807    }
808}
809
810impl glib::value::ValueType for CoreError {
811    type Type = Self;
812}
813
814unsafe impl<'a> glib::value::FromValue<'a> for CoreError {
815    type Checker = glib::value::GenericValueTypeChecker<Self>;
816
817    #[inline]
818    unsafe fn from_value(value: &'a glib::Value) -> Self {
819        skip_assert_initialized!();
820        from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0))
821    }
822}
823
824impl ToValue for CoreError {
825    #[inline]
826    fn to_value(&self) -> glib::Value {
827        let mut value = glib::Value::for_value_type::<Self>();
828        unsafe {
829            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
830        }
831        value
832    }
833
834    #[inline]
835    fn value_type(&self) -> glib::Type {
836        Self::static_type()
837    }
838}
839
840impl From<CoreError> for glib::Value {
841    #[inline]
842    fn from(v: CoreError) -> Self {
843        skip_assert_initialized!();
844        ToValue::to_value(&v)
845    }
846}
847
848/// The level defines the importance of a debugging message. The more important a
849/// message is, the greater the probability that the debugging system outputs it.
850#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
851#[non_exhaustive]
852#[doc(alias = "GstDebugLevel")]
853pub enum DebugLevel {
854    /// No debugging level specified or desired. Used to deactivate
855    ///  debugging output.
856    #[doc(alias = "GST_LEVEL_NONE")]
857    None,
858    /// Error messages are to be used only when an error occurred
859    ///  that stops the application from keeping working correctly.
860    ///  An examples is gst_element_error, which outputs a message with this priority.
861    ///  It does not mean that the application is terminating as with g_error.
862    #[doc(alias = "GST_LEVEL_ERROR")]
863    Error,
864    /// Warning messages are to inform about abnormal behaviour
865    ///  that could lead to problems or weird behaviour later on. An example of this
866    ///  would be clocking issues ("your computer is pretty slow") or broken input
867    ///  data ("Can't synchronize to stream.")
868    #[doc(alias = "GST_LEVEL_WARNING")]
869    Warning,
870    /// Fixme messages are messages that indicate that something
871    ///  in the executed code path is not fully implemented or handled yet. Note
872    ///  that this does not replace proper error handling in any way, the purpose
873    ///  of this message is to make it easier to spot incomplete/unfinished pieces
874    ///  of code when reading the debug log.
875    #[doc(alias = "GST_LEVEL_FIXME")]
876    Fixme,
877    /// Informational messages should be used to keep the developer
878    ///  updated about what is happening.
879    ///  Examples where this should be used are when a typefind function has
880    ///  successfully determined the type of the stream or when an mp3 plugin detects
881    ///  the format to be used. ("This file has mono sound.")
882    #[doc(alias = "GST_LEVEL_INFO")]
883    Info,
884    /// Debugging messages should be used when something common
885    ///  happens that is not the expected default behavior, or something that's
886    ///  useful to know but doesn't happen all the time (ie. per loop iteration or
887    ///  buffer processed or event handled).
888    ///  An example would be notifications about state changes or receiving/sending
889    ///  of events.
890    #[doc(alias = "GST_LEVEL_DEBUG")]
891    Debug,
892    /// Log messages are messages that are very common but might be
893    ///  useful to know. As a rule of thumb a pipeline that is running as expected
894    ///  should never output anything else but LOG messages whilst processing data.
895    ///  Use this log level to log recurring information in chain functions and
896    ///  loop functions, for example.
897    #[doc(alias = "GST_LEVEL_LOG")]
898    Log,
899    /// Tracing-related messages.
900    ///  Examples for this are referencing/dereferencing of objects.
901    #[doc(alias = "GST_LEVEL_TRACE")]
902    Trace,
903    /// memory dump messages are used to log (small) chunks of
904    ///  data as memory dumps in the log. They will be displayed as hexdump with
905    ///  ASCII characters.
906    #[doc(alias = "GST_LEVEL_MEMDUMP")]
907    Memdump,
908    #[doc(hidden)]
909    __Unknown(i32),
910}
911
912impl DebugLevel {
913    pub fn name<'a>(self) -> &'a GStr {
914        unsafe {
915            GStr::from_ptr(
916                ffi::gst_debug_level_get_name(self.into_glib())
917                    .as_ref()
918                    .expect("gst_debug_level_get_name returned NULL"),
919            )
920        }
921    }
922}
923
924impl std::fmt::Display for DebugLevel {
925    #[inline]
926    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
927        f.write_str(&self.name())
928    }
929}
930
931#[doc(hidden)]
932impl IntoGlib for DebugLevel {
933    type GlibType = ffi::GstDebugLevel;
934
935    #[inline]
936    fn into_glib(self) -> ffi::GstDebugLevel {
937        match self {
938            Self::None => ffi::GST_LEVEL_NONE,
939            Self::Error => ffi::GST_LEVEL_ERROR,
940            Self::Warning => ffi::GST_LEVEL_WARNING,
941            Self::Fixme => ffi::GST_LEVEL_FIXME,
942            Self::Info => ffi::GST_LEVEL_INFO,
943            Self::Debug => ffi::GST_LEVEL_DEBUG,
944            Self::Log => ffi::GST_LEVEL_LOG,
945            Self::Trace => ffi::GST_LEVEL_TRACE,
946            Self::Memdump => ffi::GST_LEVEL_MEMDUMP,
947            Self::__Unknown(value) => value,
948        }
949    }
950}
951
952#[doc(hidden)]
953impl FromGlib<ffi::GstDebugLevel> for DebugLevel {
954    #[inline]
955    unsafe fn from_glib(value: ffi::GstDebugLevel) -> Self {
956        skip_assert_initialized!();
957
958        match value {
959            ffi::GST_LEVEL_NONE => Self::None,
960            ffi::GST_LEVEL_ERROR => Self::Error,
961            ffi::GST_LEVEL_WARNING => Self::Warning,
962            ffi::GST_LEVEL_FIXME => Self::Fixme,
963            ffi::GST_LEVEL_INFO => Self::Info,
964            ffi::GST_LEVEL_DEBUG => Self::Debug,
965            ffi::GST_LEVEL_LOG => Self::Log,
966            ffi::GST_LEVEL_TRACE => Self::Trace,
967            ffi::GST_LEVEL_MEMDUMP => Self::Memdump,
968            value => Self::__Unknown(value),
969        }
970    }
971}
972
973impl StaticType for DebugLevel {
974    #[inline]
975    #[doc(alias = "gst_debug_level_get_type")]
976    fn static_type() -> glib::Type {
977        unsafe { from_glib(ffi::gst_debug_level_get_type()) }
978    }
979}
980
981impl glib::HasParamSpec for DebugLevel {
982    type ParamSpec = glib::ParamSpecEnum;
983    type SetValue = Self;
984    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
985
986    fn param_spec_builder() -> Self::BuilderFn {
987        Self::ParamSpec::builder_with_default
988    }
989}
990
991impl glib::value::ValueType for DebugLevel {
992    type Type = Self;
993}
994
995unsafe impl<'a> glib::value::FromValue<'a> for DebugLevel {
996    type Checker = glib::value::GenericValueTypeChecker<Self>;
997
998    #[inline]
999    unsafe fn from_value(value: &'a glib::Value) -> Self {
1000        skip_assert_initialized!();
1001        from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0))
1002    }
1003}
1004
1005impl ToValue for DebugLevel {
1006    #[inline]
1007    fn to_value(&self) -> glib::Value {
1008        let mut value = glib::Value::for_value_type::<Self>();
1009        unsafe {
1010            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
1011        }
1012        value
1013    }
1014
1015    #[inline]
1016    fn value_type(&self) -> glib::Type {
1017        Self::static_type()
1018    }
1019}
1020
1021impl From<DebugLevel> for glib::Value {
1022    #[inline]
1023    fn from(v: DebugLevel) -> Self {
1024        skip_assert_initialized!();
1025        ToValue::to_value(&v)
1026    }
1027}
1028
1029/// [`EventType`][crate::EventType] lists the standard event types that can be sent in a pipeline.
1030///
1031/// The custom event types can be used for private messages between elements
1032/// that can't be expressed using normal
1033/// GStreamer buffer passing semantics. Custom events carry an arbitrary
1034/// [`Structure`][crate::Structure].
1035/// Specific custom events are distinguished by the name of the structure.
1036#[derive(Debug, PartialEq, Eq, Hash, Clone, Copy)]
1037#[non_exhaustive]
1038#[doc(alias = "GstEventType")]
1039pub enum EventType {
1040    /// unknown event.
1041    #[doc(alias = "GST_EVENT_UNKNOWN")]
1042    Unknown,
1043    /// Start a flush operation. This event clears all data
1044    ///  from the pipeline and unblock all streaming threads.
1045    #[doc(alias = "GST_EVENT_FLUSH_START")]
1046    FlushStart,
1047    /// Stop a flush operation. This event resets the
1048    ///  running-time of the pipeline.
1049    #[doc(alias = "GST_EVENT_FLUSH_STOP")]
1050    FlushStop,
1051    /// Event to mark the start of a new stream. Sent before any
1052    ///  other serialized event and only sent at the start of a new stream,
1053    ///  not after flushing seeks.
1054    #[doc(alias = "GST_EVENT_STREAM_START")]
1055    StreamStart,
1056    /// [`Caps`][crate::Caps] event. Notify the pad of a new media type.
1057    #[doc(alias = "GST_EVENT_CAPS")]
1058    Caps,
1059    /// A new media segment follows in the dataflow. The
1060    ///  segment events contains information for clipping buffers and
1061    ///  converting buffer timestamps to running-time and
1062    ///  stream-time.
1063    #[doc(alias = "GST_EVENT_SEGMENT")]
1064    Segment,
1065    /// A new [`StreamCollection`][crate::StreamCollection] is available (Since: 1.10)
1066    #[doc(alias = "GST_EVENT_STREAM_COLLECTION")]
1067    StreamCollection,
1068    /// A new set of metadata tags has been found in the stream.
1069    #[doc(alias = "GST_EVENT_TAG")]
1070    Tag,
1071    /// Notification of buffering requirements. Currently not
1072    ///  used yet.
1073    #[doc(alias = "GST_EVENT_BUFFERSIZE")]
1074    Buffersize,
1075    /// An event that sinks turn into a message. Used to
1076    ///  send messages that should be emitted in sync with
1077    ///  rendering.
1078    #[doc(alias = "GST_EVENT_SINK_MESSAGE")]
1079    SinkMessage,
1080    /// Indicates that there is no more data for
1081    ///  the stream group ID in the message. Sent before EOS
1082    ///  in some instances and should be handled mostly the same. (Since: 1.10)
1083    #[doc(alias = "GST_EVENT_STREAM_GROUP_DONE")]
1084    StreamGroupDone,
1085    /// End-Of-Stream. No more data is to be expected to follow
1086    ///  without either a STREAM_START event, or a FLUSH_STOP and a SEGMENT
1087    ///  event.
1088    #[doc(alias = "GST_EVENT_EOS")]
1089    Eos,
1090    /// An event which indicates that a new table of contents (TOC)
1091    ///  was found or updated.
1092    #[doc(alias = "GST_EVENT_TOC")]
1093    Toc,
1094    /// An event which indicates that new or updated
1095    ///  encryption information has been found in the stream.
1096    #[doc(alias = "GST_EVENT_PROTECTION")]
1097    Protection,
1098    /// Marks the end of a segment playback.
1099    #[doc(alias = "GST_EVENT_SEGMENT_DONE")]
1100    SegmentDone,
1101    /// Marks a gap in the datastream.
1102    #[doc(alias = "GST_EVENT_GAP")]
1103    Gap,
1104    /// Notify downstream that a playback rate override
1105    ///  should be applied as soon as possible. (Since: 1.18)
1106    #[cfg(feature = "v1_18")]
1107    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
1108    #[doc(alias = "GST_EVENT_INSTANT_RATE_CHANGE")]
1109    InstantRateChange,
1110    /// A quality message. Used to indicate to upstream elements
1111    ///  that the downstream elements should adjust their processing
1112    ///  rate.
1113    #[doc(alias = "GST_EVENT_QOS")]
1114    Qos,
1115    /// A request for a new playback position and rate.
1116    #[doc(alias = "GST_EVENT_SEEK")]
1117    Seek,
1118    /// Navigation events are usually used for communicating
1119    ///  user requests, such as mouse or keyboard movements,
1120    ///  to upstream elements.
1121    #[doc(alias = "GST_EVENT_NAVIGATION")]
1122    Navigation,
1123    /// Notification of new latency adjustment. Sinks will use
1124    ///  the latency information to adjust their synchronisation.
1125    #[doc(alias = "GST_EVENT_LATENCY")]
1126    Latency,
1127    /// A request for stepping through the media. Sinks will usually
1128    ///  execute the step operation.
1129    #[doc(alias = "GST_EVENT_STEP")]
1130    Step,
1131    /// A request for upstream renegotiating caps and reconfiguring.
1132    #[doc(alias = "GST_EVENT_RECONFIGURE")]
1133    Reconfigure,
1134    /// A request for a new playback position based on TOC
1135    ///  entry's UID.
1136    #[doc(alias = "GST_EVENT_TOC_SELECT")]
1137    TocSelect,
1138    /// A request to select one or more streams (Since: 1.10)
1139    #[doc(alias = "GST_EVENT_SELECT_STREAMS")]
1140    SelectStreams,
1141    /// Sent by the pipeline to notify elements that handle the
1142    ///  instant-rate-change event about the running-time when
1143    ///  the rate multiplier should be applied (or was applied). (Since: 1.18)
1144    #[cfg(feature = "v1_18")]
1145    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
1146    #[doc(alias = "GST_EVENT_INSTANT_RATE_SYNC_TIME")]
1147    InstantRateSyncTime,
1148    /// Upstream custom event
1149    #[doc(alias = "GST_EVENT_CUSTOM_UPSTREAM")]
1150    CustomUpstream,
1151    /// Downstream custom event that travels in the
1152    ///  data flow.
1153    #[doc(alias = "GST_EVENT_CUSTOM_DOWNSTREAM")]
1154    CustomDownstream,
1155    /// Custom out-of-band downstream event.
1156    #[doc(alias = "GST_EVENT_CUSTOM_DOWNSTREAM_OOB")]
1157    CustomDownstreamOob,
1158    /// Custom sticky downstream event.
1159    #[doc(alias = "GST_EVENT_CUSTOM_DOWNSTREAM_STICKY")]
1160    CustomDownstreamSticky,
1161    /// Custom upstream or downstream event.
1162    ///  In-band when travelling downstream.
1163    #[doc(alias = "GST_EVENT_CUSTOM_BOTH")]
1164    CustomBoth,
1165    /// Custom upstream or downstream out-of-band event.
1166    #[doc(alias = "GST_EVENT_CUSTOM_BOTH_OOB")]
1167    CustomBothOob,
1168    #[doc(hidden)]
1169    __Unknown(i32),
1170}
1171
1172impl EventType {
1173    #[doc(alias = "gst_event_type_get_flags")]
1174    #[doc(alias = "get_flags")]
1175    pub fn flags(self) -> EventTypeFlags {
1176        assert_initialized_main_thread!();
1177        unsafe { from_glib(ffi::gst_event_type_get_flags(self.into_glib())) }
1178    }
1179
1180    pub fn name<'a>(self) -> &'a GStr {
1181        unsafe {
1182            GStr::from_ptr(
1183                ffi::gst_event_type_get_name(self.into_glib())
1184                    .as_ref()
1185                    .expect("gst_event_type_get_name returned NULL"),
1186            )
1187        }
1188    }
1189
1190    #[doc(alias = "gst_event_type_to_quark")]
1191    pub fn to_quark(self) -> glib::Quark {
1192        assert_initialized_main_thread!();
1193        unsafe { from_glib(ffi::gst_event_type_to_quark(self.into_glib())) }
1194    }
1195}
1196
1197impl std::fmt::Display for EventType {
1198    #[inline]
1199    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1200        f.write_str(&self.name())
1201    }
1202}
1203
1204#[doc(hidden)]
1205impl IntoGlib for EventType {
1206    type GlibType = ffi::GstEventType;
1207
1208    fn into_glib(self) -> ffi::GstEventType {
1209        match self {
1210            Self::Unknown => ffi::GST_EVENT_UNKNOWN,
1211            Self::FlushStart => ffi::GST_EVENT_FLUSH_START,
1212            Self::FlushStop => ffi::GST_EVENT_FLUSH_STOP,
1213            Self::StreamStart => ffi::GST_EVENT_STREAM_START,
1214            Self::Caps => ffi::GST_EVENT_CAPS,
1215            Self::Segment => ffi::GST_EVENT_SEGMENT,
1216            Self::StreamCollection => ffi::GST_EVENT_STREAM_COLLECTION,
1217            Self::Tag => ffi::GST_EVENT_TAG,
1218            Self::Buffersize => ffi::GST_EVENT_BUFFERSIZE,
1219            Self::SinkMessage => ffi::GST_EVENT_SINK_MESSAGE,
1220            Self::StreamGroupDone => ffi::GST_EVENT_STREAM_GROUP_DONE,
1221            Self::Eos => ffi::GST_EVENT_EOS,
1222            Self::Toc => ffi::GST_EVENT_TOC,
1223            Self::Protection => ffi::GST_EVENT_PROTECTION,
1224            Self::SegmentDone => ffi::GST_EVENT_SEGMENT_DONE,
1225            Self::Gap => ffi::GST_EVENT_GAP,
1226            #[cfg(feature = "v1_18")]
1227            Self::InstantRateChange => ffi::GST_EVENT_INSTANT_RATE_CHANGE,
1228            Self::Qos => ffi::GST_EVENT_QOS,
1229            Self::Seek => ffi::GST_EVENT_SEEK,
1230            Self::Navigation => ffi::GST_EVENT_NAVIGATION,
1231            Self::Latency => ffi::GST_EVENT_LATENCY,
1232            Self::Step => ffi::GST_EVENT_STEP,
1233            Self::Reconfigure => ffi::GST_EVENT_RECONFIGURE,
1234            Self::TocSelect => ffi::GST_EVENT_TOC_SELECT,
1235            Self::SelectStreams => ffi::GST_EVENT_SELECT_STREAMS,
1236            #[cfg(feature = "v1_18")]
1237            Self::InstantRateSyncTime => ffi::GST_EVENT_INSTANT_RATE_SYNC_TIME,
1238            Self::CustomUpstream => ffi::GST_EVENT_CUSTOM_UPSTREAM,
1239            Self::CustomDownstream => ffi::GST_EVENT_CUSTOM_DOWNSTREAM,
1240            Self::CustomDownstreamOob => ffi::GST_EVENT_CUSTOM_DOWNSTREAM_OOB,
1241            Self::CustomDownstreamSticky => ffi::GST_EVENT_CUSTOM_DOWNSTREAM_STICKY,
1242            Self::CustomBoth => ffi::GST_EVENT_CUSTOM_BOTH,
1243            Self::CustomBothOob => ffi::GST_EVENT_CUSTOM_BOTH_OOB,
1244            Self::__Unknown(value) => value,
1245        }
1246    }
1247}
1248
1249#[doc(hidden)]
1250impl FromGlib<ffi::GstEventType> for EventType {
1251    unsafe fn from_glib(value: ffi::GstEventType) -> Self {
1252        skip_assert_initialized!();
1253
1254        match value {
1255            ffi::GST_EVENT_UNKNOWN => Self::Unknown,
1256            ffi::GST_EVENT_FLUSH_START => Self::FlushStart,
1257            ffi::GST_EVENT_FLUSH_STOP => Self::FlushStop,
1258            ffi::GST_EVENT_STREAM_START => Self::StreamStart,
1259            ffi::GST_EVENT_CAPS => Self::Caps,
1260            ffi::GST_EVENT_SEGMENT => Self::Segment,
1261            ffi::GST_EVENT_STREAM_COLLECTION => Self::StreamCollection,
1262            ffi::GST_EVENT_TAG => Self::Tag,
1263            ffi::GST_EVENT_BUFFERSIZE => Self::Buffersize,
1264            ffi::GST_EVENT_SINK_MESSAGE => Self::SinkMessage,
1265            ffi::GST_EVENT_STREAM_GROUP_DONE => Self::StreamGroupDone,
1266            ffi::GST_EVENT_EOS => Self::Eos,
1267            ffi::GST_EVENT_TOC => Self::Toc,
1268            ffi::GST_EVENT_PROTECTION => Self::Protection,
1269            ffi::GST_EVENT_SEGMENT_DONE => Self::SegmentDone,
1270            ffi::GST_EVENT_GAP => Self::Gap,
1271            #[cfg(feature = "v1_18")]
1272            ffi::GST_EVENT_INSTANT_RATE_CHANGE => Self::InstantRateChange,
1273            ffi::GST_EVENT_QOS => Self::Qos,
1274            ffi::GST_EVENT_SEEK => Self::Seek,
1275            ffi::GST_EVENT_NAVIGATION => Self::Navigation,
1276            ffi::GST_EVENT_LATENCY => Self::Latency,
1277            ffi::GST_EVENT_STEP => Self::Step,
1278            ffi::GST_EVENT_RECONFIGURE => Self::Reconfigure,
1279            ffi::GST_EVENT_TOC_SELECT => Self::TocSelect,
1280            ffi::GST_EVENT_SELECT_STREAMS => Self::SelectStreams,
1281            #[cfg(feature = "v1_18")]
1282            ffi::GST_EVENT_INSTANT_RATE_SYNC_TIME => Self::InstantRateSyncTime,
1283            ffi::GST_EVENT_CUSTOM_UPSTREAM => Self::CustomUpstream,
1284            ffi::GST_EVENT_CUSTOM_DOWNSTREAM => Self::CustomDownstream,
1285            ffi::GST_EVENT_CUSTOM_DOWNSTREAM_OOB => Self::CustomDownstreamOob,
1286            ffi::GST_EVENT_CUSTOM_DOWNSTREAM_STICKY => Self::CustomDownstreamSticky,
1287            ffi::GST_EVENT_CUSTOM_BOTH => Self::CustomBoth,
1288            ffi::GST_EVENT_CUSTOM_BOTH_OOB => Self::CustomBothOob,
1289            value => Self::__Unknown(value),
1290        }
1291    }
1292}
1293
1294impl StaticType for EventType {
1295    #[inline]
1296    #[doc(alias = "gst_event_type_get_type")]
1297    fn static_type() -> glib::Type {
1298        unsafe { from_glib(ffi::gst_event_type_get_type()) }
1299    }
1300}
1301
1302impl glib::HasParamSpec for EventType {
1303    type ParamSpec = glib::ParamSpecEnum;
1304    type SetValue = Self;
1305    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
1306
1307    fn param_spec_builder() -> Self::BuilderFn {
1308        Self::ParamSpec::builder_with_default
1309    }
1310}
1311
1312impl glib::value::ValueType for EventType {
1313    type Type = Self;
1314}
1315
1316unsafe impl<'a> glib::value::FromValue<'a> for EventType {
1317    type Checker = glib::value::GenericValueTypeChecker<Self>;
1318
1319    #[inline]
1320    unsafe fn from_value(value: &'a glib::Value) -> Self {
1321        skip_assert_initialized!();
1322        from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0))
1323    }
1324}
1325
1326impl ToValue for EventType {
1327    #[inline]
1328    fn to_value(&self) -> glib::Value {
1329        let mut value = glib::Value::for_value_type::<Self>();
1330        unsafe {
1331            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
1332        }
1333        value
1334    }
1335
1336    #[inline]
1337    fn value_type(&self) -> glib::Type {
1338        Self::static_type()
1339    }
1340}
1341
1342impl From<EventType> for glib::Value {
1343    #[inline]
1344    fn from(v: EventType) -> Self {
1345        skip_assert_initialized!();
1346        ToValue::to_value(&v)
1347    }
1348}
1349
1350/// Standard predefined formats
1351#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1352#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy)]
1353#[non_exhaustive]
1354#[doc(alias = "GstFormat")]
1355pub enum Format {
1356    /// undefined format
1357    #[doc(alias = "GST_FORMAT_UNDEFINED")]
1358    Undefined,
1359    /// the default format of the pad/element. This can be
1360    ///  samples for raw audio, frames/fields for raw video (some, but not all,
1361    ///  elements support this; use [`Time`][Self::Time] if you don't have a good
1362    ///  reason to query for samples/frames)
1363    #[doc(alias = "GST_FORMAT_DEFAULT")]
1364    Default,
1365    /// bytes
1366    #[doc(alias = "GST_FORMAT_BYTES")]
1367    Bytes,
1368    /// time in nanoseconds
1369    #[doc(alias = "GST_FORMAT_TIME")]
1370    Time,
1371    /// buffers (few, if any, elements implement this as of
1372    ///  May 2009)
1373    #[doc(alias = "GST_FORMAT_BUFFERS")]
1374    Buffers,
1375    /// percentage of stream (few, if any, elements implement
1376    ///  this as of May 2009)
1377    #[doc(alias = "GST_FORMAT_PERCENT")]
1378    Percent,
1379    #[doc(hidden)]
1380    __Unknown(i32),
1381}
1382
1383impl Format {
1384    #[doc(alias = "gst_format_get_by_nick")]
1385    #[doc(alias = "get_by_nick")]
1386    pub fn by_nick(nick: &str) -> Format {
1387        assert_initialized_main_thread!();
1388        unsafe { from_glib(ffi::gst_format_get_by_nick(nick.to_glib_none().0)) }
1389    }
1390
1391    //#[doc(alias = "gst_format_get_details")]
1392    //#[doc(alias = "get_details")]
1393    //pub fn details(self) -> /*Ignored*/Option<FormatDefinition> {
1394    //    unsafe { TODO: call ffi:gst_format_get_details() }
1395    //}
1396
1397    #[doc(alias = "gst_format_get_name")]
1398    #[doc(alias = "get_name")]
1399    pub fn name(self) -> Option<glib::GString> {
1400        assert_initialized_main_thread!();
1401        unsafe { from_glib_none(ffi::gst_format_get_name(self.into_glib())) }
1402    }
1403
1404    //#[doc(alias = "gst_format_iterate_definitions")]
1405    //pub fn iterate_definitions() -> /*Ignored*/Iterator {
1406    //    unsafe { TODO: call ffi:gst_format_iterate_definitions() }
1407    //}
1408
1409    #[doc(alias = "gst_format_to_quark")]
1410    pub fn to_quark(self) -> glib::Quark {
1411        assert_initialized_main_thread!();
1412        unsafe { from_glib(ffi::gst_format_to_quark(self.into_glib())) }
1413    }
1414}
1415
1416#[doc(hidden)]
1417impl IntoGlib for Format {
1418    type GlibType = ffi::GstFormat;
1419
1420    #[inline]
1421    fn into_glib(self) -> ffi::GstFormat {
1422        match self {
1423            Self::Undefined => ffi::GST_FORMAT_UNDEFINED,
1424            Self::Default => ffi::GST_FORMAT_DEFAULT,
1425            Self::Bytes => ffi::GST_FORMAT_BYTES,
1426            Self::Time => ffi::GST_FORMAT_TIME,
1427            Self::Buffers => ffi::GST_FORMAT_BUFFERS,
1428            Self::Percent => ffi::GST_FORMAT_PERCENT,
1429            Self::__Unknown(value) => value,
1430        }
1431    }
1432}
1433
1434#[doc(hidden)]
1435impl FromGlib<ffi::GstFormat> for Format {
1436    #[inline]
1437    unsafe fn from_glib(value: ffi::GstFormat) -> Self {
1438        skip_assert_initialized!();
1439
1440        match value {
1441            ffi::GST_FORMAT_UNDEFINED => Self::Undefined,
1442            ffi::GST_FORMAT_DEFAULT => Self::Default,
1443            ffi::GST_FORMAT_BYTES => Self::Bytes,
1444            ffi::GST_FORMAT_TIME => Self::Time,
1445            ffi::GST_FORMAT_BUFFERS => Self::Buffers,
1446            ffi::GST_FORMAT_PERCENT => Self::Percent,
1447            value => Self::__Unknown(value),
1448        }
1449    }
1450}
1451
1452impl StaticType for Format {
1453    #[inline]
1454    #[doc(alias = "gst_format_get_type")]
1455    fn static_type() -> glib::Type {
1456        unsafe { from_glib(ffi::gst_format_get_type()) }
1457    }
1458}
1459
1460impl glib::HasParamSpec for Format {
1461    type ParamSpec = glib::ParamSpecEnum;
1462    type SetValue = Self;
1463    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
1464
1465    fn param_spec_builder() -> Self::BuilderFn {
1466        Self::ParamSpec::builder_with_default
1467    }
1468}
1469
1470impl glib::value::ValueType for Format {
1471    type Type = Self;
1472}
1473
1474unsafe impl<'a> glib::value::FromValue<'a> for Format {
1475    type Checker = glib::value::GenericValueTypeChecker<Self>;
1476
1477    #[inline]
1478    unsafe fn from_value(value: &'a glib::Value) -> Self {
1479        skip_assert_initialized!();
1480        from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0))
1481    }
1482}
1483
1484impl ToValue for Format {
1485    #[inline]
1486    fn to_value(&self) -> glib::Value {
1487        let mut value = glib::Value::for_value_type::<Self>();
1488        unsafe {
1489            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
1490        }
1491        value
1492    }
1493
1494    #[inline]
1495    fn value_type(&self) -> glib::Type {
1496        Self::static_type()
1497    }
1498}
1499
1500impl From<Format> for glib::Value {
1501    #[inline]
1502    fn from(v: Format) -> Self {
1503        skip_assert_initialized!();
1504        ToValue::to_value(&v)
1505    }
1506}
1507
1508/// Library errors are for errors from the library being used by elements
1509/// (initializing, finalizing, settings, ...)
1510#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
1511#[non_exhaustive]
1512#[doc(alias = "GstLibraryError")]
1513pub enum LibraryError {
1514    /// a general error which doesn't fit in any other
1515    /// category. Make sure you add a custom message to the error call.
1516    #[doc(alias = "GST_LIBRARY_ERROR_FAILED")]
1517    Failed,
1518    /// do not use this except as a placeholder for
1519    /// deciding where to go while developing code.
1520    #[doc(alias = "GST_LIBRARY_ERROR_TOO_LAZY")]
1521    TooLazy,
1522    /// used when the library could not be opened.
1523    #[doc(alias = "GST_LIBRARY_ERROR_INIT")]
1524    Init,
1525    /// used when the library could not be closed.
1526    #[doc(alias = "GST_LIBRARY_ERROR_SHUTDOWN")]
1527    Shutdown,
1528    /// used when the library doesn't accept settings.
1529    #[doc(alias = "GST_LIBRARY_ERROR_SETTINGS")]
1530    Settings,
1531    /// used when the library generated an encoding error.
1532    #[doc(alias = "GST_LIBRARY_ERROR_ENCODE")]
1533    Encode,
1534    #[doc(hidden)]
1535    __Unknown(i32),
1536}
1537
1538#[doc(hidden)]
1539impl IntoGlib for LibraryError {
1540    type GlibType = ffi::GstLibraryError;
1541
1542    #[inline]
1543    fn into_glib(self) -> ffi::GstLibraryError {
1544        match self {
1545            Self::Failed => ffi::GST_LIBRARY_ERROR_FAILED,
1546            Self::TooLazy => ffi::GST_LIBRARY_ERROR_TOO_LAZY,
1547            Self::Init => ffi::GST_LIBRARY_ERROR_INIT,
1548            Self::Shutdown => ffi::GST_LIBRARY_ERROR_SHUTDOWN,
1549            Self::Settings => ffi::GST_LIBRARY_ERROR_SETTINGS,
1550            Self::Encode => ffi::GST_LIBRARY_ERROR_ENCODE,
1551            Self::__Unknown(value) => value,
1552        }
1553    }
1554}
1555
1556#[doc(hidden)]
1557impl FromGlib<ffi::GstLibraryError> for LibraryError {
1558    #[inline]
1559    unsafe fn from_glib(value: ffi::GstLibraryError) -> Self {
1560        skip_assert_initialized!();
1561
1562        match value {
1563            ffi::GST_LIBRARY_ERROR_FAILED => Self::Failed,
1564            ffi::GST_LIBRARY_ERROR_TOO_LAZY => Self::TooLazy,
1565            ffi::GST_LIBRARY_ERROR_INIT => Self::Init,
1566            ffi::GST_LIBRARY_ERROR_SHUTDOWN => Self::Shutdown,
1567            ffi::GST_LIBRARY_ERROR_SETTINGS => Self::Settings,
1568            ffi::GST_LIBRARY_ERROR_ENCODE => Self::Encode,
1569            value => Self::__Unknown(value),
1570        }
1571    }
1572}
1573
1574impl glib::error::ErrorDomain for LibraryError {
1575    #[inline]
1576    fn domain() -> glib::Quark {
1577        skip_assert_initialized!();
1578
1579        unsafe { from_glib(ffi::gst_library_error_quark()) }
1580    }
1581
1582    #[inline]
1583    fn code(self) -> i32 {
1584        self.into_glib()
1585    }
1586
1587    #[inline]
1588    #[allow(clippy::match_single_binding)]
1589    fn from(code: i32) -> Option<Self> {
1590        skip_assert_initialized!();
1591        match unsafe { from_glib(code) } {
1592            Self::__Unknown(_) => Some(Self::Failed),
1593            value => Some(value),
1594        }
1595    }
1596}
1597
1598impl StaticType for LibraryError {
1599    #[inline]
1600    #[doc(alias = "gst_library_error_get_type")]
1601    fn static_type() -> glib::Type {
1602        unsafe { from_glib(ffi::gst_library_error_get_type()) }
1603    }
1604}
1605
1606impl glib::HasParamSpec for LibraryError {
1607    type ParamSpec = glib::ParamSpecEnum;
1608    type SetValue = Self;
1609    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
1610
1611    fn param_spec_builder() -> Self::BuilderFn {
1612        Self::ParamSpec::builder_with_default
1613    }
1614}
1615
1616impl glib::value::ValueType for LibraryError {
1617    type Type = Self;
1618}
1619
1620unsafe impl<'a> glib::value::FromValue<'a> for LibraryError {
1621    type Checker = glib::value::GenericValueTypeChecker<Self>;
1622
1623    #[inline]
1624    unsafe fn from_value(value: &'a glib::Value) -> Self {
1625        skip_assert_initialized!();
1626        from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0))
1627    }
1628}
1629
1630impl ToValue for LibraryError {
1631    #[inline]
1632    fn to_value(&self) -> glib::Value {
1633        let mut value = glib::Value::for_value_type::<Self>();
1634        unsafe {
1635            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
1636        }
1637        value
1638    }
1639
1640    #[inline]
1641    fn value_type(&self) -> glib::Type {
1642        Self::static_type()
1643    }
1644}
1645
1646impl From<LibraryError> for glib::Value {
1647    #[inline]
1648    fn from(v: LibraryError) -> Self {
1649        skip_assert_initialized!();
1650        ToValue::to_value(&v)
1651    }
1652}
1653
1654/// The direction of a pad.
1655#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1656#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy)]
1657#[repr(i32)]
1658#[doc(alias = "GstPadDirection")]
1659pub enum PadDirection {
1660    /// direction is unknown.
1661    #[doc(alias = "GST_PAD_UNKNOWN")]
1662    Unknown = ffi::GST_PAD_UNKNOWN,
1663    /// the pad is a source pad.
1664    #[doc(alias = "GST_PAD_SRC")]
1665    Src = ffi::GST_PAD_SRC,
1666    /// the pad is a sink pad.
1667    #[doc(alias = "GST_PAD_SINK")]
1668    Sink = ffi::GST_PAD_SINK,
1669}
1670
1671#[doc(hidden)]
1672impl IntoGlib for PadDirection {
1673    type GlibType = ffi::GstPadDirection;
1674
1675    #[inline]
1676    fn into_glib(self) -> ffi::GstPadDirection {
1677        self as ffi::GstPadDirection
1678    }
1679}
1680
1681#[doc(hidden)]
1682impl FromGlib<ffi::GstPadDirection> for PadDirection {
1683    #[inline]
1684    unsafe fn from_glib(value: ffi::GstPadDirection) -> Self {
1685        skip_assert_initialized!();
1686
1687        debug_assert!([ffi::GST_PAD_UNKNOWN, ffi::GST_PAD_SRC, ffi::GST_PAD_SINK].contains(&value));
1688        std::mem::transmute(value)
1689    }
1690}
1691
1692impl StaticType for PadDirection {
1693    #[inline]
1694    #[doc(alias = "gst_pad_direction_get_type")]
1695    fn static_type() -> glib::Type {
1696        unsafe { from_glib(ffi::gst_pad_direction_get_type()) }
1697    }
1698}
1699
1700impl glib::HasParamSpec for PadDirection {
1701    type ParamSpec = glib::ParamSpecEnum;
1702    type SetValue = Self;
1703    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
1704
1705    fn param_spec_builder() -> Self::BuilderFn {
1706        Self::ParamSpec::builder_with_default
1707    }
1708}
1709
1710impl glib::value::ValueType for PadDirection {
1711    type Type = Self;
1712}
1713
1714unsafe impl<'a> glib::value::FromValue<'a> for PadDirection {
1715    type Checker = glib::value::GenericValueTypeChecker<Self>;
1716
1717    #[inline]
1718    unsafe fn from_value(value: &'a glib::Value) -> Self {
1719        skip_assert_initialized!();
1720        from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0))
1721    }
1722}
1723
1724impl ToValue for PadDirection {
1725    #[inline]
1726    fn to_value(&self) -> glib::Value {
1727        let mut value = glib::Value::for_value_type::<Self>();
1728        unsafe {
1729            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
1730        }
1731        value
1732    }
1733
1734    #[inline]
1735    fn value_type(&self) -> glib::Type {
1736        Self::static_type()
1737    }
1738}
1739
1740impl From<PadDirection> for glib::Value {
1741    #[inline]
1742    fn from(v: PadDirection) -> Self {
1743        skip_assert_initialized!();
1744        ToValue::to_value(&v)
1745    }
1746}
1747
1748/// The status of a GstPad. After activating a pad, which usually happens when the
1749/// parent element goes from READY to PAUSED, the GstPadMode defines if the
1750/// pad operates in push or pull mode.
1751#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
1752#[repr(i32)]
1753#[doc(alias = "GstPadMode")]
1754pub enum PadMode {
1755    /// Pad will not handle dataflow
1756    #[doc(alias = "GST_PAD_MODE_NONE")]
1757    None = ffi::GST_PAD_MODE_NONE,
1758    /// Pad handles dataflow in downstream push mode
1759    #[doc(alias = "GST_PAD_MODE_PUSH")]
1760    Push = ffi::GST_PAD_MODE_PUSH,
1761    /// Pad handles dataflow in upstream pull mode
1762    #[doc(alias = "GST_PAD_MODE_PULL")]
1763    Pull = ffi::GST_PAD_MODE_PULL,
1764}
1765
1766impl PadMode {
1767    pub fn name<'a>(self) -> &'a GStr {
1768        unsafe {
1769            GStr::from_ptr(
1770                ffi::gst_pad_mode_get_name(self.into_glib())
1771                    .as_ref()
1772                    .expect("gst_pad_mode_get_name returned NULL"),
1773            )
1774        }
1775    }
1776}
1777
1778impl std::fmt::Display for PadMode {
1779    #[inline]
1780    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1781        f.write_str(&self.name())
1782    }
1783}
1784
1785#[doc(hidden)]
1786impl IntoGlib for PadMode {
1787    type GlibType = ffi::GstPadMode;
1788
1789    #[inline]
1790    fn into_glib(self) -> ffi::GstPadMode {
1791        self as ffi::GstPadMode
1792    }
1793}
1794
1795#[doc(hidden)]
1796impl FromGlib<ffi::GstPadMode> for PadMode {
1797    #[inline]
1798    unsafe fn from_glib(value: ffi::GstPadMode) -> Self {
1799        skip_assert_initialized!();
1800
1801        debug_assert!([
1802            ffi::GST_PAD_MODE_NONE,
1803            ffi::GST_PAD_MODE_PUSH,
1804            ffi::GST_PAD_MODE_PULL
1805        ]
1806        .contains(&value));
1807        std::mem::transmute(value)
1808    }
1809}
1810
1811impl StaticType for PadMode {
1812    #[inline]
1813    #[doc(alias = "gst_pad_mode_get_type")]
1814    fn static_type() -> glib::Type {
1815        unsafe { from_glib(ffi::gst_pad_mode_get_type()) }
1816    }
1817}
1818
1819impl glib::HasParamSpec for PadMode {
1820    type ParamSpec = glib::ParamSpecEnum;
1821    type SetValue = Self;
1822    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
1823
1824    fn param_spec_builder() -> Self::BuilderFn {
1825        Self::ParamSpec::builder_with_default
1826    }
1827}
1828
1829impl glib::value::ValueType for PadMode {
1830    type Type = Self;
1831}
1832
1833unsafe impl<'a> glib::value::FromValue<'a> for PadMode {
1834    type Checker = glib::value::GenericValueTypeChecker<Self>;
1835
1836    #[inline]
1837    unsafe fn from_value(value: &'a glib::Value) -> Self {
1838        skip_assert_initialized!();
1839        from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0))
1840    }
1841}
1842
1843impl ToValue for PadMode {
1844    #[inline]
1845    fn to_value(&self) -> glib::Value {
1846        let mut value = glib::Value::for_value_type::<Self>();
1847        unsafe {
1848            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
1849        }
1850        value
1851    }
1852
1853    #[inline]
1854    fn value_type(&self) -> glib::Type {
1855        Self::static_type()
1856    }
1857}
1858
1859impl From<PadMode> for glib::Value {
1860    #[inline]
1861    fn from(v: PadMode) -> Self {
1862        skip_assert_initialized!();
1863        ToValue::to_value(&v)
1864    }
1865}
1866
1867/// Indicates when this pad will become available.
1868#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1869#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy)]
1870#[repr(i32)]
1871#[doc(alias = "GstPadPresence")]
1872pub enum PadPresence {
1873    /// the pad is always available
1874    #[doc(alias = "GST_PAD_ALWAYS")]
1875    Always = ffi::GST_PAD_ALWAYS,
1876    /// the pad will become available depending on the media stream
1877    #[doc(alias = "GST_PAD_SOMETIMES")]
1878    Sometimes = ffi::GST_PAD_SOMETIMES,
1879    /// the pad is only available on request with
1880    ///  [`ElementExt::request_pad()`][crate::prelude::ElementExt::request_pad()].
1881    #[doc(alias = "GST_PAD_REQUEST")]
1882    Request = ffi::GST_PAD_REQUEST,
1883}
1884
1885#[doc(hidden)]
1886impl IntoGlib for PadPresence {
1887    type GlibType = ffi::GstPadPresence;
1888
1889    #[inline]
1890    fn into_glib(self) -> ffi::GstPadPresence {
1891        self as ffi::GstPadPresence
1892    }
1893}
1894
1895#[doc(hidden)]
1896impl FromGlib<ffi::GstPadPresence> for PadPresence {
1897    #[inline]
1898    unsafe fn from_glib(value: ffi::GstPadPresence) -> Self {
1899        skip_assert_initialized!();
1900
1901        debug_assert!([
1902            ffi::GST_PAD_ALWAYS,
1903            ffi::GST_PAD_SOMETIMES,
1904            ffi::GST_PAD_REQUEST
1905        ]
1906        .contains(&value));
1907        std::mem::transmute(value)
1908    }
1909}
1910
1911impl StaticType for PadPresence {
1912    #[inline]
1913    #[doc(alias = "gst_pad_presence_get_type")]
1914    fn static_type() -> glib::Type {
1915        unsafe { from_glib(ffi::gst_pad_presence_get_type()) }
1916    }
1917}
1918
1919impl glib::HasParamSpec for PadPresence {
1920    type ParamSpec = glib::ParamSpecEnum;
1921    type SetValue = Self;
1922    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
1923
1924    fn param_spec_builder() -> Self::BuilderFn {
1925        Self::ParamSpec::builder_with_default
1926    }
1927}
1928
1929impl glib::value::ValueType for PadPresence {
1930    type Type = Self;
1931}
1932
1933unsafe impl<'a> glib::value::FromValue<'a> for PadPresence {
1934    type Checker = glib::value::GenericValueTypeChecker<Self>;
1935
1936    #[inline]
1937    unsafe fn from_value(value: &'a glib::Value) -> Self {
1938        skip_assert_initialized!();
1939        from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0))
1940    }
1941}
1942
1943impl ToValue for PadPresence {
1944    #[inline]
1945    fn to_value(&self) -> glib::Value {
1946        let mut value = glib::Value::for_value_type::<Self>();
1947        unsafe {
1948            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
1949        }
1950        value
1951    }
1952
1953    #[inline]
1954    fn value_type(&self) -> glib::Type {
1955        Self::static_type()
1956    }
1957}
1958
1959impl From<PadPresence> for glib::Value {
1960    #[inline]
1961    fn from(v: PadPresence) -> Self {
1962        skip_assert_initialized!();
1963        ToValue::to_value(&v)
1964    }
1965}
1966
1967/// Different return values for the `GstPadProbeCallback`.
1968#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
1969#[repr(i32)]
1970#[doc(alias = "GstPadProbeReturn")]
1971pub enum PadProbeReturn {
1972    /// drop data in data probes. For push mode this means that
1973    ///  the data item is not sent downstream. For pull mode, it means that
1974    ///  the data item is not passed upstream. In both cases, no other probes
1975    ///  are called for this item and [`FlowReturn::Ok`][crate::FlowReturn::Ok] or [`true`] is returned to the
1976    ///  caller.
1977    #[doc(alias = "GST_PAD_PROBE_DROP")]
1978    Drop = ffi::GST_PAD_PROBE_DROP,
1979    /// normal probe return value. This leaves the probe in
1980    ///  place, and defers decisions about dropping or passing data to other
1981    ///  probes, if any. If there are no other probes, the default behaviour
1982    ///  for the probe type applies ('block' for blocking probes,
1983    ///  and 'pass' for non-blocking probes).
1984    #[doc(alias = "GST_PAD_PROBE_OK")]
1985    Ok = ffi::GST_PAD_PROBE_OK,
1986    /// remove this probe, passing the data. For blocking probes
1987    ///  this will cause data flow to unblock, unless there are also other
1988    ///  blocking probes installed.
1989    #[doc(alias = "GST_PAD_PROBE_REMOVE")]
1990    Remove = ffi::GST_PAD_PROBE_REMOVE,
1991    /// pass the data item in the block probe and block on the
1992    ///  next item. Note, that if there are multiple pad probes installed and
1993    ///  any probe returns PASS, the data will be passed.
1994    #[doc(alias = "GST_PAD_PROBE_PASS")]
1995    Pass = ffi::GST_PAD_PROBE_PASS,
1996    /// Data has been handled in the probe and will not be
1997    ///  forwarded further. For events and buffers this is the same behaviour as
1998    ///  [`Drop`][Self::Drop] (except that in this case you need to unref the buffer
1999    ///  or event yourself). For queries it will also return [`true`] to the caller.
2000    ///  The probe can also modify the [`FlowReturn`][crate::FlowReturn] value by using the
2001    ///  `GST_PAD_PROBE_INFO_FLOW_RETURN`() accessor.
2002    ///  Note that the resulting query must contain valid entries.
2003    ///  Since: 1.6
2004    #[doc(alias = "GST_PAD_PROBE_HANDLED")]
2005    Handled = ffi::GST_PAD_PROBE_HANDLED,
2006}
2007
2008#[doc(hidden)]
2009impl IntoGlib for PadProbeReturn {
2010    type GlibType = ffi::GstPadProbeReturn;
2011
2012    #[inline]
2013    fn into_glib(self) -> ffi::GstPadProbeReturn {
2014        self as ffi::GstPadProbeReturn
2015    }
2016}
2017
2018#[doc(hidden)]
2019impl FromGlib<ffi::GstPadProbeReturn> for PadProbeReturn {
2020    #[inline]
2021    unsafe fn from_glib(value: ffi::GstPadProbeReturn) -> Self {
2022        skip_assert_initialized!();
2023
2024        debug_assert!([
2025            ffi::GST_PAD_PROBE_DROP,
2026            ffi::GST_PAD_PROBE_OK,
2027            ffi::GST_PAD_PROBE_REMOVE,
2028            ffi::GST_PAD_PROBE_PASS,
2029            ffi::GST_PAD_PROBE_HANDLED
2030        ]
2031        .contains(&value));
2032        std::mem::transmute(value)
2033    }
2034}
2035
2036impl StaticType for PadProbeReturn {
2037    #[inline]
2038    #[doc(alias = "gst_pad_probe_return_get_type")]
2039    fn static_type() -> glib::Type {
2040        unsafe { from_glib(ffi::gst_pad_probe_return_get_type()) }
2041    }
2042}
2043
2044impl glib::HasParamSpec for PadProbeReturn {
2045    type ParamSpec = glib::ParamSpecEnum;
2046    type SetValue = Self;
2047    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
2048
2049    fn param_spec_builder() -> Self::BuilderFn {
2050        Self::ParamSpec::builder_with_default
2051    }
2052}
2053
2054impl glib::value::ValueType for PadProbeReturn {
2055    type Type = Self;
2056}
2057
2058unsafe impl<'a> glib::value::FromValue<'a> for PadProbeReturn {
2059    type Checker = glib::value::GenericValueTypeChecker<Self>;
2060
2061    #[inline]
2062    unsafe fn from_value(value: &'a glib::Value) -> Self {
2063        skip_assert_initialized!();
2064        from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0))
2065    }
2066}
2067
2068impl ToValue for PadProbeReturn {
2069    #[inline]
2070    fn to_value(&self) -> glib::Value {
2071        let mut value = glib::Value::for_value_type::<Self>();
2072        unsafe {
2073            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
2074        }
2075        value
2076    }
2077
2078    #[inline]
2079    fn value_type(&self) -> glib::Type {
2080        Self::static_type()
2081    }
2082}
2083
2084impl From<PadProbeReturn> for glib::Value {
2085    #[inline]
2086    fn from(v: PadProbeReturn) -> Self {
2087        skip_assert_initialized!();
2088        ToValue::to_value(&v)
2089    }
2090}
2091
2092/// The different parsing errors that can occur.
2093#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
2094#[non_exhaustive]
2095#[doc(alias = "GstParseError")]
2096pub enum ParseError {
2097    /// A syntax error occurred.
2098    #[doc(alias = "GST_PARSE_ERROR_SYNTAX")]
2099    Syntax,
2100    /// The description contained an unknown element
2101    #[doc(alias = "GST_PARSE_ERROR_NO_SUCH_ELEMENT")]
2102    NoSuchElement,
2103    /// An element did not have a specified property
2104    #[doc(alias = "GST_PARSE_ERROR_NO_SUCH_PROPERTY")]
2105    NoSuchProperty,
2106    /// There was an error linking two pads.
2107    #[doc(alias = "GST_PARSE_ERROR_LINK")]
2108    Link,
2109    /// There was an error setting a property
2110    #[doc(alias = "GST_PARSE_ERROR_COULD_NOT_SET_PROPERTY")]
2111    CouldNotSetProperty,
2112    /// An empty bin was specified.
2113    #[doc(alias = "GST_PARSE_ERROR_EMPTY_BIN")]
2114    EmptyBin,
2115    /// An empty description was specified
2116    #[doc(alias = "GST_PARSE_ERROR_EMPTY")]
2117    Empty,
2118    /// A delayed link did not get resolved.
2119    #[doc(alias = "GST_PARSE_ERROR_DELAYED_LINK")]
2120    DelayedLink,
2121    #[doc(hidden)]
2122    __Unknown(i32),
2123}
2124
2125#[doc(hidden)]
2126impl IntoGlib for ParseError {
2127    type GlibType = ffi::GstParseError;
2128
2129    #[inline]
2130    fn into_glib(self) -> ffi::GstParseError {
2131        match self {
2132            Self::Syntax => ffi::GST_PARSE_ERROR_SYNTAX,
2133            Self::NoSuchElement => ffi::GST_PARSE_ERROR_NO_SUCH_ELEMENT,
2134            Self::NoSuchProperty => ffi::GST_PARSE_ERROR_NO_SUCH_PROPERTY,
2135            Self::Link => ffi::GST_PARSE_ERROR_LINK,
2136            Self::CouldNotSetProperty => ffi::GST_PARSE_ERROR_COULD_NOT_SET_PROPERTY,
2137            Self::EmptyBin => ffi::GST_PARSE_ERROR_EMPTY_BIN,
2138            Self::Empty => ffi::GST_PARSE_ERROR_EMPTY,
2139            Self::DelayedLink => ffi::GST_PARSE_ERROR_DELAYED_LINK,
2140            Self::__Unknown(value) => value,
2141        }
2142    }
2143}
2144
2145#[doc(hidden)]
2146impl FromGlib<ffi::GstParseError> for ParseError {
2147    #[inline]
2148    unsafe fn from_glib(value: ffi::GstParseError) -> Self {
2149        skip_assert_initialized!();
2150
2151        match value {
2152            ffi::GST_PARSE_ERROR_SYNTAX => Self::Syntax,
2153            ffi::GST_PARSE_ERROR_NO_SUCH_ELEMENT => Self::NoSuchElement,
2154            ffi::GST_PARSE_ERROR_NO_SUCH_PROPERTY => Self::NoSuchProperty,
2155            ffi::GST_PARSE_ERROR_LINK => Self::Link,
2156            ffi::GST_PARSE_ERROR_COULD_NOT_SET_PROPERTY => Self::CouldNotSetProperty,
2157            ffi::GST_PARSE_ERROR_EMPTY_BIN => Self::EmptyBin,
2158            ffi::GST_PARSE_ERROR_EMPTY => Self::Empty,
2159            ffi::GST_PARSE_ERROR_DELAYED_LINK => Self::DelayedLink,
2160            value => Self::__Unknown(value),
2161        }
2162    }
2163}
2164
2165impl glib::error::ErrorDomain for ParseError {
2166    #[inline]
2167    fn domain() -> glib::Quark {
2168        skip_assert_initialized!();
2169
2170        unsafe { from_glib(ffi::gst_parse_error_quark()) }
2171    }
2172
2173    #[inline]
2174    fn code(self) -> i32 {
2175        self.into_glib()
2176    }
2177
2178    #[inline]
2179    #[allow(clippy::match_single_binding)]
2180    fn from(code: i32) -> Option<Self> {
2181        skip_assert_initialized!();
2182        match unsafe { from_glib(code) } {
2183            value => Some(value),
2184        }
2185    }
2186}
2187
2188impl StaticType for ParseError {
2189    #[inline]
2190    #[doc(alias = "gst_parse_error_get_type")]
2191    fn static_type() -> glib::Type {
2192        unsafe { from_glib(ffi::gst_parse_error_get_type()) }
2193    }
2194}
2195
2196impl glib::HasParamSpec for ParseError {
2197    type ParamSpec = glib::ParamSpecEnum;
2198    type SetValue = Self;
2199    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
2200
2201    fn param_spec_builder() -> Self::BuilderFn {
2202        Self::ParamSpec::builder_with_default
2203    }
2204}
2205
2206impl glib::value::ValueType for ParseError {
2207    type Type = Self;
2208}
2209
2210unsafe impl<'a> glib::value::FromValue<'a> for ParseError {
2211    type Checker = glib::value::GenericValueTypeChecker<Self>;
2212
2213    #[inline]
2214    unsafe fn from_value(value: &'a glib::Value) -> Self {
2215        skip_assert_initialized!();
2216        from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0))
2217    }
2218}
2219
2220impl ToValue for ParseError {
2221    #[inline]
2222    fn to_value(&self) -> glib::Value {
2223        let mut value = glib::Value::for_value_type::<Self>();
2224        unsafe {
2225            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
2226        }
2227        value
2228    }
2229
2230    #[inline]
2231    fn value_type(&self) -> glib::Type {
2232        Self::static_type()
2233    }
2234}
2235
2236impl From<ParseError> for glib::Value {
2237    #[inline]
2238    fn from(v: ParseError) -> Self {
2239        skip_assert_initialized!();
2240        ToValue::to_value(&v)
2241    }
2242}
2243
2244/// The plugin loading errors
2245#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
2246#[non_exhaustive]
2247#[doc(alias = "GstPluginError")]
2248pub enum PluginError {
2249    /// The plugin could not be loaded
2250    #[doc(alias = "GST_PLUGIN_ERROR_MODULE")]
2251    Module,
2252    /// The plugin has unresolved dependencies
2253    #[doc(alias = "GST_PLUGIN_ERROR_DEPENDENCIES")]
2254    Dependencies,
2255    /// The plugin has already be loaded from a different file
2256    #[doc(alias = "GST_PLUGIN_ERROR_NAME_MISMATCH")]
2257    NameMismatch,
2258    #[doc(hidden)]
2259    __Unknown(i32),
2260}
2261
2262#[doc(hidden)]
2263impl IntoGlib for PluginError {
2264    type GlibType = ffi::GstPluginError;
2265
2266    #[inline]
2267    fn into_glib(self) -> ffi::GstPluginError {
2268        match self {
2269            Self::Module => ffi::GST_PLUGIN_ERROR_MODULE,
2270            Self::Dependencies => ffi::GST_PLUGIN_ERROR_DEPENDENCIES,
2271            Self::NameMismatch => ffi::GST_PLUGIN_ERROR_NAME_MISMATCH,
2272            Self::__Unknown(value) => value,
2273        }
2274    }
2275}
2276
2277#[doc(hidden)]
2278impl FromGlib<ffi::GstPluginError> for PluginError {
2279    #[inline]
2280    unsafe fn from_glib(value: ffi::GstPluginError) -> Self {
2281        skip_assert_initialized!();
2282
2283        match value {
2284            ffi::GST_PLUGIN_ERROR_MODULE => Self::Module,
2285            ffi::GST_PLUGIN_ERROR_DEPENDENCIES => Self::Dependencies,
2286            ffi::GST_PLUGIN_ERROR_NAME_MISMATCH => Self::NameMismatch,
2287            value => Self::__Unknown(value),
2288        }
2289    }
2290}
2291
2292impl glib::error::ErrorDomain for PluginError {
2293    #[inline]
2294    fn domain() -> glib::Quark {
2295        skip_assert_initialized!();
2296
2297        unsafe { from_glib(ffi::gst_plugin_error_quark()) }
2298    }
2299
2300    #[inline]
2301    fn code(self) -> i32 {
2302        self.into_glib()
2303    }
2304
2305    #[inline]
2306    #[allow(clippy::match_single_binding)]
2307    fn from(code: i32) -> Option<Self> {
2308        skip_assert_initialized!();
2309        match unsafe { from_glib(code) } {
2310            value => Some(value),
2311        }
2312    }
2313}
2314
2315impl StaticType for PluginError {
2316    #[inline]
2317    #[doc(alias = "gst_plugin_error_get_type")]
2318    fn static_type() -> glib::Type {
2319        unsafe { from_glib(ffi::gst_plugin_error_get_type()) }
2320    }
2321}
2322
2323impl glib::HasParamSpec for PluginError {
2324    type ParamSpec = glib::ParamSpecEnum;
2325    type SetValue = Self;
2326    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
2327
2328    fn param_spec_builder() -> Self::BuilderFn {
2329        Self::ParamSpec::builder_with_default
2330    }
2331}
2332
2333impl glib::value::ValueType for PluginError {
2334    type Type = Self;
2335}
2336
2337unsafe impl<'a> glib::value::FromValue<'a> for PluginError {
2338    type Checker = glib::value::GenericValueTypeChecker<Self>;
2339
2340    #[inline]
2341    unsafe fn from_value(value: &'a glib::Value) -> Self {
2342        skip_assert_initialized!();
2343        from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0))
2344    }
2345}
2346
2347impl ToValue for PluginError {
2348    #[inline]
2349    fn to_value(&self) -> glib::Value {
2350        let mut value = glib::Value::for_value_type::<Self>();
2351        unsafe {
2352            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
2353        }
2354        value
2355    }
2356
2357    #[inline]
2358    fn value_type(&self) -> glib::Type {
2359        Self::static_type()
2360    }
2361}
2362
2363impl From<PluginError> for glib::Value {
2364    #[inline]
2365    fn from(v: PluginError) -> Self {
2366        skip_assert_initialized!();
2367        ToValue::to_value(&v)
2368    }
2369}
2370
2371/// The type of a `GST_MESSAGE_PROGRESS`. The progress messages inform the
2372/// application of the status of asynchronous tasks.
2373#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
2374#[non_exhaustive]
2375#[doc(alias = "GstProgressType")]
2376pub enum ProgressType {
2377    /// A new task started.
2378    #[doc(alias = "GST_PROGRESS_TYPE_START")]
2379    Start,
2380    /// A task completed and a new one continues.
2381    #[doc(alias = "GST_PROGRESS_TYPE_CONTINUE")]
2382    Continue,
2383    /// A task completed.
2384    #[doc(alias = "GST_PROGRESS_TYPE_COMPLETE")]
2385    Complete,
2386    /// A task was canceled.
2387    #[doc(alias = "GST_PROGRESS_TYPE_CANCELED")]
2388    Canceled,
2389    /// A task caused an error. An error message is also
2390    ///  posted on the bus.
2391    #[doc(alias = "GST_PROGRESS_TYPE_ERROR")]
2392    Error,
2393    #[doc(hidden)]
2394    __Unknown(i32),
2395}
2396
2397#[doc(hidden)]
2398impl IntoGlib for ProgressType {
2399    type GlibType = ffi::GstProgressType;
2400
2401    #[inline]
2402    fn into_glib(self) -> ffi::GstProgressType {
2403        match self {
2404            Self::Start => ffi::GST_PROGRESS_TYPE_START,
2405            Self::Continue => ffi::GST_PROGRESS_TYPE_CONTINUE,
2406            Self::Complete => ffi::GST_PROGRESS_TYPE_COMPLETE,
2407            Self::Canceled => ffi::GST_PROGRESS_TYPE_CANCELED,
2408            Self::Error => ffi::GST_PROGRESS_TYPE_ERROR,
2409            Self::__Unknown(value) => value,
2410        }
2411    }
2412}
2413
2414#[doc(hidden)]
2415impl FromGlib<ffi::GstProgressType> for ProgressType {
2416    #[inline]
2417    unsafe fn from_glib(value: ffi::GstProgressType) -> Self {
2418        skip_assert_initialized!();
2419
2420        match value {
2421            ffi::GST_PROGRESS_TYPE_START => Self::Start,
2422            ffi::GST_PROGRESS_TYPE_CONTINUE => Self::Continue,
2423            ffi::GST_PROGRESS_TYPE_COMPLETE => Self::Complete,
2424            ffi::GST_PROGRESS_TYPE_CANCELED => Self::Canceled,
2425            ffi::GST_PROGRESS_TYPE_ERROR => Self::Error,
2426            value => Self::__Unknown(value),
2427        }
2428    }
2429}
2430
2431impl StaticType for ProgressType {
2432    #[inline]
2433    #[doc(alias = "gst_progress_type_get_type")]
2434    fn static_type() -> glib::Type {
2435        unsafe { from_glib(ffi::gst_progress_type_get_type()) }
2436    }
2437}
2438
2439impl glib::HasParamSpec for ProgressType {
2440    type ParamSpec = glib::ParamSpecEnum;
2441    type SetValue = Self;
2442    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
2443
2444    fn param_spec_builder() -> Self::BuilderFn {
2445        Self::ParamSpec::builder_with_default
2446    }
2447}
2448
2449impl glib::value::ValueType for ProgressType {
2450    type Type = Self;
2451}
2452
2453unsafe impl<'a> glib::value::FromValue<'a> for ProgressType {
2454    type Checker = glib::value::GenericValueTypeChecker<Self>;
2455
2456    #[inline]
2457    unsafe fn from_value(value: &'a glib::Value) -> Self {
2458        skip_assert_initialized!();
2459        from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0))
2460    }
2461}
2462
2463impl ToValue for ProgressType {
2464    #[inline]
2465    fn to_value(&self) -> glib::Value {
2466        let mut value = glib::Value::for_value_type::<Self>();
2467        unsafe {
2468            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
2469        }
2470        value
2471    }
2472
2473    #[inline]
2474    fn value_type(&self) -> glib::Type {
2475        Self::static_type()
2476    }
2477}
2478
2479impl From<ProgressType> for glib::Value {
2480    #[inline]
2481    fn from(v: ProgressType) -> Self {
2482        skip_assert_initialized!();
2483        ToValue::to_value(&v)
2484    }
2485}
2486
2487/// The result of a [`Promise`][crate::Promise]
2488#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
2489#[non_exhaustive]
2490#[doc(alias = "GstPromiseResult")]
2491pub enum PromiseResult {
2492    /// Initial state. Waiting for transition to any
2493    ///     other state.
2494    #[doc(alias = "GST_PROMISE_RESULT_PENDING")]
2495    Pending,
2496    /// Interrupted by the consumer as it doesn't
2497    ///     want the value anymore.
2498    #[doc(alias = "GST_PROMISE_RESULT_INTERRUPTED")]
2499    Interrupted,
2500    /// A producer marked a reply
2501    #[doc(alias = "GST_PROMISE_RESULT_REPLIED")]
2502    Replied,
2503    /// The promise expired (the carrying object
2504    ///     lost all refs) and the promise will never be fulfilled.
2505    #[doc(alias = "GST_PROMISE_RESULT_EXPIRED")]
2506    Expired,
2507    #[doc(hidden)]
2508    __Unknown(i32),
2509}
2510
2511#[doc(hidden)]
2512impl IntoGlib for PromiseResult {
2513    type GlibType = ffi::GstPromiseResult;
2514
2515    #[inline]
2516    fn into_glib(self) -> ffi::GstPromiseResult {
2517        match self {
2518            Self::Pending => ffi::GST_PROMISE_RESULT_PENDING,
2519            Self::Interrupted => ffi::GST_PROMISE_RESULT_INTERRUPTED,
2520            Self::Replied => ffi::GST_PROMISE_RESULT_REPLIED,
2521            Self::Expired => ffi::GST_PROMISE_RESULT_EXPIRED,
2522            Self::__Unknown(value) => value,
2523        }
2524    }
2525}
2526
2527#[doc(hidden)]
2528impl FromGlib<ffi::GstPromiseResult> for PromiseResult {
2529    #[inline]
2530    unsafe fn from_glib(value: ffi::GstPromiseResult) -> Self {
2531        skip_assert_initialized!();
2532
2533        match value {
2534            ffi::GST_PROMISE_RESULT_PENDING => Self::Pending,
2535            ffi::GST_PROMISE_RESULT_INTERRUPTED => Self::Interrupted,
2536            ffi::GST_PROMISE_RESULT_REPLIED => Self::Replied,
2537            ffi::GST_PROMISE_RESULT_EXPIRED => Self::Expired,
2538            value => Self::__Unknown(value),
2539        }
2540    }
2541}
2542
2543impl StaticType for PromiseResult {
2544    #[inline]
2545    #[doc(alias = "gst_promise_result_get_type")]
2546    fn static_type() -> glib::Type {
2547        unsafe { from_glib(ffi::gst_promise_result_get_type()) }
2548    }
2549}
2550
2551impl glib::HasParamSpec for PromiseResult {
2552    type ParamSpec = glib::ParamSpecEnum;
2553    type SetValue = Self;
2554    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
2555
2556    fn param_spec_builder() -> Self::BuilderFn {
2557        Self::ParamSpec::builder_with_default
2558    }
2559}
2560
2561impl glib::value::ValueType for PromiseResult {
2562    type Type = Self;
2563}
2564
2565unsafe impl<'a> glib::value::FromValue<'a> for PromiseResult {
2566    type Checker = glib::value::GenericValueTypeChecker<Self>;
2567
2568    #[inline]
2569    unsafe fn from_value(value: &'a glib::Value) -> Self {
2570        skip_assert_initialized!();
2571        from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0))
2572    }
2573}
2574
2575impl ToValue for PromiseResult {
2576    #[inline]
2577    fn to_value(&self) -> glib::Value {
2578        let mut value = glib::Value::for_value_type::<Self>();
2579        unsafe {
2580            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
2581        }
2582        value
2583    }
2584
2585    #[inline]
2586    fn value_type(&self) -> glib::Type {
2587        Self::static_type()
2588    }
2589}
2590
2591impl From<PromiseResult> for glib::Value {
2592    #[inline]
2593    fn from(v: PromiseResult) -> Self {
2594        skip_assert_initialized!();
2595        ToValue::to_value(&v)
2596    }
2597}
2598
2599/// The different types of QoS events that can be given to the
2600/// `gst_event_new_qos()` method.
2601#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
2602#[non_exhaustive]
2603#[doc(alias = "GstQOSType")]
2604pub enum QOSType {
2605    /// The QoS event type that is produced when upstream
2606    ///  elements are producing data too quickly and the element can't keep up
2607    ///  processing the data. Upstream should reduce their production rate. This
2608    ///  type is also used when buffers arrive early or in time.
2609    #[doc(alias = "GST_QOS_TYPE_OVERFLOW")]
2610    Overflow,
2611    /// The QoS event type that is produced when upstream
2612    ///  elements are producing data too slowly and need to speed up their
2613    ///  production rate.
2614    #[doc(alias = "GST_QOS_TYPE_UNDERFLOW")]
2615    Underflow,
2616    /// The QoS event type that is produced when the
2617    ///  application enabled throttling to limit the data rate.
2618    #[doc(alias = "GST_QOS_TYPE_THROTTLE")]
2619    Throttle,
2620    #[doc(hidden)]
2621    __Unknown(i32),
2622}
2623
2624#[doc(hidden)]
2625impl IntoGlib for QOSType {
2626    type GlibType = ffi::GstQOSType;
2627
2628    #[inline]
2629    fn into_glib(self) -> ffi::GstQOSType {
2630        match self {
2631            Self::Overflow => ffi::GST_QOS_TYPE_OVERFLOW,
2632            Self::Underflow => ffi::GST_QOS_TYPE_UNDERFLOW,
2633            Self::Throttle => ffi::GST_QOS_TYPE_THROTTLE,
2634            Self::__Unknown(value) => value,
2635        }
2636    }
2637}
2638
2639#[doc(hidden)]
2640impl FromGlib<ffi::GstQOSType> for QOSType {
2641    #[inline]
2642    unsafe fn from_glib(value: ffi::GstQOSType) -> Self {
2643        skip_assert_initialized!();
2644
2645        match value {
2646            ffi::GST_QOS_TYPE_OVERFLOW => Self::Overflow,
2647            ffi::GST_QOS_TYPE_UNDERFLOW => Self::Underflow,
2648            ffi::GST_QOS_TYPE_THROTTLE => Self::Throttle,
2649            value => Self::__Unknown(value),
2650        }
2651    }
2652}
2653
2654impl StaticType for QOSType {
2655    #[inline]
2656    #[doc(alias = "gst_qos_type_get_type")]
2657    fn static_type() -> glib::Type {
2658        unsafe { from_glib(ffi::gst_qos_type_get_type()) }
2659    }
2660}
2661
2662impl glib::HasParamSpec for QOSType {
2663    type ParamSpec = glib::ParamSpecEnum;
2664    type SetValue = Self;
2665    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
2666
2667    fn param_spec_builder() -> Self::BuilderFn {
2668        Self::ParamSpec::builder_with_default
2669    }
2670}
2671
2672impl glib::value::ValueType for QOSType {
2673    type Type = Self;
2674}
2675
2676unsafe impl<'a> glib::value::FromValue<'a> for QOSType {
2677    type Checker = glib::value::GenericValueTypeChecker<Self>;
2678
2679    #[inline]
2680    unsafe fn from_value(value: &'a glib::Value) -> Self {
2681        skip_assert_initialized!();
2682        from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0))
2683    }
2684}
2685
2686impl ToValue for QOSType {
2687    #[inline]
2688    fn to_value(&self) -> glib::Value {
2689        let mut value = glib::Value::for_value_type::<Self>();
2690        unsafe {
2691            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
2692        }
2693        value
2694    }
2695
2696    #[inline]
2697    fn value_type(&self) -> glib::Type {
2698        Self::static_type()
2699    }
2700}
2701
2702impl From<QOSType> for glib::Value {
2703    #[inline]
2704    fn from(v: QOSType) -> Self {
2705        skip_assert_initialized!();
2706        ToValue::to_value(&v)
2707    }
2708}
2709
2710/// Resource errors are for any resource used by an element:
2711/// memory, files, network connections, process space, ...
2712/// They're typically used by source and sink elements.
2713#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
2714#[non_exhaustive]
2715#[doc(alias = "GstResourceError")]
2716pub enum ResourceError {
2717    /// a general error which doesn't fit in any other
2718    /// category. Make sure you add a custom message to the error call.
2719    #[doc(alias = "GST_RESOURCE_ERROR_FAILED")]
2720    Failed,
2721    /// do not use this except as a placeholder for
2722    /// deciding where to go while developing code.
2723    #[doc(alias = "GST_RESOURCE_ERROR_TOO_LAZY")]
2724    TooLazy,
2725    /// used when the resource could not be found.
2726    #[doc(alias = "GST_RESOURCE_ERROR_NOT_FOUND")]
2727    NotFound,
2728    /// used when resource is busy.
2729    #[doc(alias = "GST_RESOURCE_ERROR_BUSY")]
2730    Busy,
2731    /// used when resource fails to open for reading.
2732    #[doc(alias = "GST_RESOURCE_ERROR_OPEN_READ")]
2733    OpenRead,
2734    /// used when resource fails to open for writing.
2735    #[doc(alias = "GST_RESOURCE_ERROR_OPEN_WRITE")]
2736    OpenWrite,
2737    /// used when resource cannot be opened for
2738    /// both reading and writing, or either (but unspecified which).
2739    #[doc(alias = "GST_RESOURCE_ERROR_OPEN_READ_WRITE")]
2740    OpenReadWrite,
2741    /// used when the resource can't be closed.
2742    #[doc(alias = "GST_RESOURCE_ERROR_CLOSE")]
2743    Close,
2744    /// used when the resource can't be read from.
2745    #[doc(alias = "GST_RESOURCE_ERROR_READ")]
2746    Read,
2747    /// used when the resource can't be written to.
2748    #[doc(alias = "GST_RESOURCE_ERROR_WRITE")]
2749    Write,
2750    /// used when a seek on the resource fails.
2751    #[doc(alias = "GST_RESOURCE_ERROR_SEEK")]
2752    Seek,
2753    /// used when a synchronize on the resource fails.
2754    #[doc(alias = "GST_RESOURCE_ERROR_SYNC")]
2755    Sync,
2756    /// used when settings can't be manipulated on.
2757    #[doc(alias = "GST_RESOURCE_ERROR_SETTINGS")]
2758    Settings,
2759    /// used when the resource has no space left.
2760    #[doc(alias = "GST_RESOURCE_ERROR_NO_SPACE_LEFT")]
2761    NoSpaceLeft,
2762    /// used when the resource can't be opened
2763    ///  due to missing authorization.
2764    ///  (Since: 1.2.4)
2765    #[doc(alias = "GST_RESOURCE_ERROR_NOT_AUTHORIZED")]
2766    NotAuthorized,
2767    #[doc(hidden)]
2768    __Unknown(i32),
2769}
2770
2771#[doc(hidden)]
2772impl IntoGlib for ResourceError {
2773    type GlibType = ffi::GstResourceError;
2774
2775    fn into_glib(self) -> ffi::GstResourceError {
2776        match self {
2777            Self::Failed => ffi::GST_RESOURCE_ERROR_FAILED,
2778            Self::TooLazy => ffi::GST_RESOURCE_ERROR_TOO_LAZY,
2779            Self::NotFound => ffi::GST_RESOURCE_ERROR_NOT_FOUND,
2780            Self::Busy => ffi::GST_RESOURCE_ERROR_BUSY,
2781            Self::OpenRead => ffi::GST_RESOURCE_ERROR_OPEN_READ,
2782            Self::OpenWrite => ffi::GST_RESOURCE_ERROR_OPEN_WRITE,
2783            Self::OpenReadWrite => ffi::GST_RESOURCE_ERROR_OPEN_READ_WRITE,
2784            Self::Close => ffi::GST_RESOURCE_ERROR_CLOSE,
2785            Self::Read => ffi::GST_RESOURCE_ERROR_READ,
2786            Self::Write => ffi::GST_RESOURCE_ERROR_WRITE,
2787            Self::Seek => ffi::GST_RESOURCE_ERROR_SEEK,
2788            Self::Sync => ffi::GST_RESOURCE_ERROR_SYNC,
2789            Self::Settings => ffi::GST_RESOURCE_ERROR_SETTINGS,
2790            Self::NoSpaceLeft => ffi::GST_RESOURCE_ERROR_NO_SPACE_LEFT,
2791            Self::NotAuthorized => ffi::GST_RESOURCE_ERROR_NOT_AUTHORIZED,
2792            Self::__Unknown(value) => value,
2793        }
2794    }
2795}
2796
2797#[doc(hidden)]
2798impl FromGlib<ffi::GstResourceError> for ResourceError {
2799    unsafe fn from_glib(value: ffi::GstResourceError) -> Self {
2800        skip_assert_initialized!();
2801
2802        match value {
2803            ffi::GST_RESOURCE_ERROR_FAILED => Self::Failed,
2804            ffi::GST_RESOURCE_ERROR_TOO_LAZY => Self::TooLazy,
2805            ffi::GST_RESOURCE_ERROR_NOT_FOUND => Self::NotFound,
2806            ffi::GST_RESOURCE_ERROR_BUSY => Self::Busy,
2807            ffi::GST_RESOURCE_ERROR_OPEN_READ => Self::OpenRead,
2808            ffi::GST_RESOURCE_ERROR_OPEN_WRITE => Self::OpenWrite,
2809            ffi::GST_RESOURCE_ERROR_OPEN_READ_WRITE => Self::OpenReadWrite,
2810            ffi::GST_RESOURCE_ERROR_CLOSE => Self::Close,
2811            ffi::GST_RESOURCE_ERROR_READ => Self::Read,
2812            ffi::GST_RESOURCE_ERROR_WRITE => Self::Write,
2813            ffi::GST_RESOURCE_ERROR_SEEK => Self::Seek,
2814            ffi::GST_RESOURCE_ERROR_SYNC => Self::Sync,
2815            ffi::GST_RESOURCE_ERROR_SETTINGS => Self::Settings,
2816            ffi::GST_RESOURCE_ERROR_NO_SPACE_LEFT => Self::NoSpaceLeft,
2817            ffi::GST_RESOURCE_ERROR_NOT_AUTHORIZED => Self::NotAuthorized,
2818            value => Self::__Unknown(value),
2819        }
2820    }
2821}
2822
2823impl glib::error::ErrorDomain for ResourceError {
2824    #[inline]
2825    fn domain() -> glib::Quark {
2826        skip_assert_initialized!();
2827
2828        unsafe { from_glib(ffi::gst_resource_error_quark()) }
2829    }
2830
2831    #[inline]
2832    fn code(self) -> i32 {
2833        self.into_glib()
2834    }
2835
2836    #[inline]
2837    #[allow(clippy::match_single_binding)]
2838    fn from(code: i32) -> Option<Self> {
2839        skip_assert_initialized!();
2840        match unsafe { from_glib(code) } {
2841            Self::__Unknown(_) => Some(Self::Failed),
2842            value => Some(value),
2843        }
2844    }
2845}
2846
2847impl StaticType for ResourceError {
2848    #[inline]
2849    #[doc(alias = "gst_resource_error_get_type")]
2850    fn static_type() -> glib::Type {
2851        unsafe { from_glib(ffi::gst_resource_error_get_type()) }
2852    }
2853}
2854
2855impl glib::HasParamSpec for ResourceError {
2856    type ParamSpec = glib::ParamSpecEnum;
2857    type SetValue = Self;
2858    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
2859
2860    fn param_spec_builder() -> Self::BuilderFn {
2861        Self::ParamSpec::builder_with_default
2862    }
2863}
2864
2865impl glib::value::ValueType for ResourceError {
2866    type Type = Self;
2867}
2868
2869unsafe impl<'a> glib::value::FromValue<'a> for ResourceError {
2870    type Checker = glib::value::GenericValueTypeChecker<Self>;
2871
2872    #[inline]
2873    unsafe fn from_value(value: &'a glib::Value) -> Self {
2874        skip_assert_initialized!();
2875        from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0))
2876    }
2877}
2878
2879impl ToValue for ResourceError {
2880    #[inline]
2881    fn to_value(&self) -> glib::Value {
2882        let mut value = glib::Value::for_value_type::<Self>();
2883        unsafe {
2884            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
2885        }
2886        value
2887    }
2888
2889    #[inline]
2890    fn value_type(&self) -> glib::Type {
2891        Self::static_type()
2892    }
2893}
2894
2895impl From<ResourceError> for glib::Value {
2896    #[inline]
2897    fn from(v: ResourceError) -> Self {
2898        skip_assert_initialized!();
2899        ToValue::to_value(&v)
2900    }
2901}
2902
2903/// The different types of seek events. When constructing a seek event with
2904/// `gst_event_new_seek()` or when doing gst_segment_do_seek ().
2905#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
2906#[repr(i32)]
2907#[doc(alias = "GstSeekType")]
2908pub enum SeekType {
2909    /// no change in position is required
2910    #[doc(alias = "GST_SEEK_TYPE_NONE")]
2911    None = ffi::GST_SEEK_TYPE_NONE,
2912    /// absolute position is requested
2913    #[doc(alias = "GST_SEEK_TYPE_SET")]
2914    Set = ffi::GST_SEEK_TYPE_SET,
2915    /// relative position to duration is requested
2916    #[doc(alias = "GST_SEEK_TYPE_END")]
2917    End = ffi::GST_SEEK_TYPE_END,
2918}
2919
2920#[doc(hidden)]
2921impl IntoGlib for SeekType {
2922    type GlibType = ffi::GstSeekType;
2923
2924    #[inline]
2925    fn into_glib(self) -> ffi::GstSeekType {
2926        self as ffi::GstSeekType
2927    }
2928}
2929
2930#[doc(hidden)]
2931impl FromGlib<ffi::GstSeekType> for SeekType {
2932    #[inline]
2933    unsafe fn from_glib(value: ffi::GstSeekType) -> Self {
2934        skip_assert_initialized!();
2935
2936        debug_assert!([
2937            ffi::GST_SEEK_TYPE_NONE,
2938            ffi::GST_SEEK_TYPE_SET,
2939            ffi::GST_SEEK_TYPE_END
2940        ]
2941        .contains(&value));
2942        std::mem::transmute(value)
2943    }
2944}
2945
2946impl StaticType for SeekType {
2947    #[inline]
2948    #[doc(alias = "gst_seek_type_get_type")]
2949    fn static_type() -> glib::Type {
2950        unsafe { from_glib(ffi::gst_seek_type_get_type()) }
2951    }
2952}
2953
2954impl glib::HasParamSpec for SeekType {
2955    type ParamSpec = glib::ParamSpecEnum;
2956    type SetValue = Self;
2957    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
2958
2959    fn param_spec_builder() -> Self::BuilderFn {
2960        Self::ParamSpec::builder_with_default
2961    }
2962}
2963
2964impl glib::value::ValueType for SeekType {
2965    type Type = Self;
2966}
2967
2968unsafe impl<'a> glib::value::FromValue<'a> for SeekType {
2969    type Checker = glib::value::GenericValueTypeChecker<Self>;
2970
2971    #[inline]
2972    unsafe fn from_value(value: &'a glib::Value) -> Self {
2973        skip_assert_initialized!();
2974        from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0))
2975    }
2976}
2977
2978impl ToValue for SeekType {
2979    #[inline]
2980    fn to_value(&self) -> glib::Value {
2981        let mut value = glib::Value::for_value_type::<Self>();
2982        unsafe {
2983            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
2984        }
2985        value
2986    }
2987
2988    #[inline]
2989    fn value_type(&self) -> glib::Type {
2990        Self::static_type()
2991    }
2992}
2993
2994impl From<SeekType> for glib::Value {
2995    #[inline]
2996    fn from(v: SeekType) -> Self {
2997        skip_assert_initialized!();
2998        ToValue::to_value(&v)
2999    }
3000}
3001
3002/// The possible states an element can be in. States can be changed using
3003/// [`ElementExt::set_state()`][crate::prelude::ElementExt::set_state()] and checked using [`ElementExt::state()`][crate::prelude::ElementExt::state()].
3004#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
3005#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy)]
3006#[repr(i32)]
3007#[doc(alias = "GstState")]
3008pub enum State {
3009    /// no pending state.
3010    #[doc(alias = "GST_STATE_VOID_PENDING")]
3011    VoidPending = ffi::GST_STATE_VOID_PENDING,
3012    /// the NULL state or initial state of an element.
3013    #[doc(alias = "GST_STATE_NULL")]
3014    Null = ffi::GST_STATE_NULL,
3015    /// the element is ready to go to PAUSED.
3016    #[doc(alias = "GST_STATE_READY")]
3017    Ready = ffi::GST_STATE_READY,
3018    /// the element is PAUSED, it is ready to accept and
3019    ///  process data. Sink elements however only accept one
3020    ///  buffer and then block.
3021    #[doc(alias = "GST_STATE_PAUSED")]
3022    Paused = ffi::GST_STATE_PAUSED,
3023    /// the element is PLAYING, the [`Clock`][crate::Clock] is running and
3024    ///  the data is flowing.
3025    #[doc(alias = "GST_STATE_PLAYING")]
3026    Playing = ffi::GST_STATE_PLAYING,
3027}
3028
3029#[doc(hidden)]
3030impl IntoGlib for State {
3031    type GlibType = ffi::GstState;
3032
3033    #[inline]
3034    fn into_glib(self) -> ffi::GstState {
3035        self as ffi::GstState
3036    }
3037}
3038
3039#[doc(hidden)]
3040impl FromGlib<ffi::GstState> for State {
3041    #[inline]
3042    unsafe fn from_glib(value: ffi::GstState) -> Self {
3043        skip_assert_initialized!();
3044
3045        debug_assert!([
3046            ffi::GST_STATE_VOID_PENDING,
3047            ffi::GST_STATE_NULL,
3048            ffi::GST_STATE_READY,
3049            ffi::GST_STATE_PAUSED,
3050            ffi::GST_STATE_PLAYING
3051        ]
3052        .contains(&value));
3053        std::mem::transmute(value)
3054    }
3055}
3056
3057impl StaticType for State {
3058    #[inline]
3059    #[doc(alias = "gst_state_get_type")]
3060    fn static_type() -> glib::Type {
3061        unsafe { from_glib(ffi::gst_state_get_type()) }
3062    }
3063}
3064
3065impl glib::HasParamSpec for State {
3066    type ParamSpec = glib::ParamSpecEnum;
3067    type SetValue = Self;
3068    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
3069
3070    fn param_spec_builder() -> Self::BuilderFn {
3071        Self::ParamSpec::builder_with_default
3072    }
3073}
3074
3075impl glib::value::ValueType for State {
3076    type Type = Self;
3077}
3078
3079unsafe impl<'a> glib::value::FromValue<'a> for State {
3080    type Checker = glib::value::GenericValueTypeChecker<Self>;
3081
3082    #[inline]
3083    unsafe fn from_value(value: &'a glib::Value) -> Self {
3084        skip_assert_initialized!();
3085        from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0))
3086    }
3087}
3088
3089impl ToValue for State {
3090    #[inline]
3091    fn to_value(&self) -> glib::Value {
3092        let mut value = glib::Value::for_value_type::<Self>();
3093        unsafe {
3094            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
3095        }
3096        value
3097    }
3098
3099    #[inline]
3100    fn value_type(&self) -> glib::Type {
3101        Self::static_type()
3102    }
3103}
3104
3105impl From<State> for glib::Value {
3106    #[inline]
3107    fn from(v: State) -> Self {
3108        skip_assert_initialized!();
3109        ToValue::to_value(&v)
3110    }
3111}
3112
3113/// These are the different state changes an element goes through.
3114/// [`State::Null`][crate::State::Null] &rArr; [`State::Playing`][crate::State::Playing] is called an upwards state change
3115/// and [`State::Playing`][crate::State::Playing] &rArr; [`State::Null`][crate::State::Null] a downwards state change.
3116#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
3117#[repr(i32)]
3118#[doc(alias = "GstStateChange")]
3119pub enum StateChange {
3120    /// state change from NULL to READY.
3121    ///  * The element must check if the resources it needs are available. Device
3122    ///  sinks and -sources typically try to probe the device to constrain their
3123    ///  caps.
3124    ///  * The element opens the device (in case feature need to be probed).
3125    #[doc(alias = "GST_STATE_CHANGE_NULL_TO_READY")]
3126    NullToReady = ffi::GST_STATE_CHANGE_NULL_TO_READY,
3127    /// state change from READY to PAUSED.
3128    ///  * The element pads are activated in order to receive data in PAUSED.
3129    ///  Streaming threads are started.
3130    ///  * Some elements might need to return [`StateChangeReturn::Async`][crate::StateChangeReturn::Async] and complete
3131    ///  the state change when they have enough information. It is a requirement
3132    ///  for sinks to return [`StateChangeReturn::Async`][crate::StateChangeReturn::Async] and complete the state change
3133    ///  when they receive the first buffer or [`EventType::Eos`][crate::EventType::Eos] (preroll).
3134    ///  Sinks also block the dataflow when in PAUSED.
3135    ///  * A pipeline resets the running_time to 0.
3136    ///  * Live sources return [`StateChangeReturn::NoPreroll`][crate::StateChangeReturn::NoPreroll] and don't generate data.
3137    #[doc(alias = "GST_STATE_CHANGE_READY_TO_PAUSED")]
3138    ReadyToPaused = ffi::GST_STATE_CHANGE_READY_TO_PAUSED,
3139    /// state change from PAUSED to PLAYING.
3140    ///  * Most elements ignore this state change.
3141    ///  * The pipeline selects a [`Clock`][crate::Clock] and distributes this to all the children
3142    ///  before setting them to PLAYING. This means that it is only allowed to
3143    ///  synchronize on the [`Clock`][crate::Clock] in the PLAYING state.
3144    ///  * The pipeline uses the [`Clock`][crate::Clock] and the running_time to calculate the
3145    ///  base_time. The base_time is distributed to all children when performing
3146    ///  the state change.
3147    ///  * Sink elements stop blocking on the preroll buffer or event and start
3148    ///  rendering the data.
3149    ///  * Sinks can post `GST_MESSAGE_EOS` in the PLAYING state. It is not allowed
3150    ///  to post `GST_MESSAGE_EOS` when not in the PLAYING state.
3151    ///  * While streaming in PAUSED or PLAYING elements can create and remove
3152    ///  sometimes pads.
3153    ///  * Live sources start generating data and return [`StateChangeReturn::Success`][crate::StateChangeReturn::Success].
3154    #[doc(alias = "GST_STATE_CHANGE_PAUSED_TO_PLAYING")]
3155    PausedToPlaying = ffi::GST_STATE_CHANGE_PAUSED_TO_PLAYING,
3156    /// state change from PLAYING to PAUSED.
3157    ///  * Most elements ignore this state change.
3158    ///  * The pipeline calculates the running_time based on the last selected
3159    ///  [`Clock`][crate::Clock] and the base_time. It stores this information to continue
3160    ///  playback when going back to the PLAYING state.
3161    ///  * Sinks unblock any [`Clock`][crate::Clock] wait calls.
3162    ///  * When a sink does not have a pending buffer to play, it returns
3163    ///  [`StateChangeReturn::Async`][crate::StateChangeReturn::Async] from this state change and completes the state
3164    ///  change when it receives a new buffer or an [`EventType::Eos`][crate::EventType::Eos].
3165    ///  * Any queued `GST_MESSAGE_EOS` items are removed since they will be reposted
3166    ///  when going back to the PLAYING state. The EOS messages are queued in
3167    ///  [`Bin`][crate::Bin] containers.
3168    ///  * Live sources stop generating data and return [`StateChangeReturn::NoPreroll`][crate::StateChangeReturn::NoPreroll].
3169    #[doc(alias = "GST_STATE_CHANGE_PLAYING_TO_PAUSED")]
3170    PlayingToPaused = ffi::GST_STATE_CHANGE_PLAYING_TO_PAUSED,
3171    /// state change from PAUSED to READY.
3172    ///  * Sinks unblock any waits in the preroll.
3173    ///  * Elements unblock any waits on devices
3174    ///  * Chain or get_range functions return [`FlowReturn::Flushing`][crate::FlowReturn::Flushing].
3175    ///  * The element pads are deactivated so that streaming becomes impossible and
3176    ///  all streaming threads are stopped.
3177    ///  * The sink forgets all negotiated formats
3178    ///  * Elements remove all sometimes pads
3179    #[doc(alias = "GST_STATE_CHANGE_PAUSED_TO_READY")]
3180    PausedToReady = ffi::GST_STATE_CHANGE_PAUSED_TO_READY,
3181    /// state change from READY to NULL.
3182    ///  * Elements close devices
3183    ///  * Elements reset any internal state.
3184    #[doc(alias = "GST_STATE_CHANGE_READY_TO_NULL")]
3185    ReadyToNull = ffi::GST_STATE_CHANGE_READY_TO_NULL,
3186    /// state change from NULL to NULL. (Since: 1.14)
3187    #[doc(alias = "GST_STATE_CHANGE_NULL_TO_NULL")]
3188    NullToNull = ffi::GST_STATE_CHANGE_NULL_TO_NULL,
3189    /// state change from READY to READY,
3190    /// This might happen when going to PAUSED asynchronously failed, in that case
3191    /// elements should make sure they are in a proper, coherent READY state. (Since: 1.14)
3192    #[doc(alias = "GST_STATE_CHANGE_READY_TO_READY")]
3193    ReadyToReady = ffi::GST_STATE_CHANGE_READY_TO_READY,
3194    /// state change from PAUSED to PAUSED.
3195    /// This might happen when elements were in PLAYING state and 'lost state',
3196    /// they should make sure to go back to real 'PAUSED' state (prerolling for example). (Since: 1.14)
3197    #[doc(alias = "GST_STATE_CHANGE_PAUSED_TO_PAUSED")]
3198    PausedToPaused = ffi::GST_STATE_CHANGE_PAUSED_TO_PAUSED,
3199    /// state change from PLAYING to PLAYING. (Since: 1.14)
3200    #[doc(alias = "GST_STATE_CHANGE_PLAYING_TO_PLAYING")]
3201    PlayingToPlaying = ffi::GST_STATE_CHANGE_PLAYING_TO_PLAYING,
3202}
3203
3204impl StateChange {
3205    pub fn name<'a>(self) -> &'a GStr {
3206        unsafe {
3207            GStr::from_ptr(
3208                ffi::gst_state_change_get_name(self.into_glib())
3209                    .as_ref()
3210                    .expect("gst_state_change_get_name returned NULL"),
3211            )
3212        }
3213    }
3214}
3215
3216impl std::fmt::Display for StateChange {
3217    #[inline]
3218    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3219        f.write_str(&self.name())
3220    }
3221}
3222
3223#[doc(hidden)]
3224impl IntoGlib for StateChange {
3225    type GlibType = ffi::GstStateChange;
3226
3227    #[inline]
3228    fn into_glib(self) -> ffi::GstStateChange {
3229        self as ffi::GstStateChange
3230    }
3231}
3232
3233#[doc(hidden)]
3234impl FromGlib<ffi::GstStateChange> for StateChange {
3235    #[inline]
3236    unsafe fn from_glib(value: ffi::GstStateChange) -> Self {
3237        skip_assert_initialized!();
3238
3239        debug_assert!([
3240            ffi::GST_STATE_CHANGE_NULL_TO_READY,
3241            ffi::GST_STATE_CHANGE_READY_TO_PAUSED,
3242            ffi::GST_STATE_CHANGE_PAUSED_TO_PLAYING,
3243            ffi::GST_STATE_CHANGE_PLAYING_TO_PAUSED,
3244            ffi::GST_STATE_CHANGE_PAUSED_TO_READY,
3245            ffi::GST_STATE_CHANGE_READY_TO_NULL,
3246            ffi::GST_STATE_CHANGE_NULL_TO_NULL,
3247            ffi::GST_STATE_CHANGE_READY_TO_READY,
3248            ffi::GST_STATE_CHANGE_PAUSED_TO_PAUSED,
3249            ffi::GST_STATE_CHANGE_PLAYING_TO_PLAYING
3250        ]
3251        .contains(&value));
3252        std::mem::transmute(value)
3253    }
3254}
3255
3256impl StaticType for StateChange {
3257    #[inline]
3258    #[doc(alias = "gst_state_change_get_type")]
3259    fn static_type() -> glib::Type {
3260        unsafe { from_glib(ffi::gst_state_change_get_type()) }
3261    }
3262}
3263
3264impl glib::HasParamSpec for StateChange {
3265    type ParamSpec = glib::ParamSpecEnum;
3266    type SetValue = Self;
3267    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
3268
3269    fn param_spec_builder() -> Self::BuilderFn {
3270        Self::ParamSpec::builder_with_default
3271    }
3272}
3273
3274impl glib::value::ValueType for StateChange {
3275    type Type = Self;
3276}
3277
3278unsafe impl<'a> glib::value::FromValue<'a> for StateChange {
3279    type Checker = glib::value::GenericValueTypeChecker<Self>;
3280
3281    #[inline]
3282    unsafe fn from_value(value: &'a glib::Value) -> Self {
3283        skip_assert_initialized!();
3284        from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0))
3285    }
3286}
3287
3288impl ToValue for StateChange {
3289    #[inline]
3290    fn to_value(&self) -> glib::Value {
3291        let mut value = glib::Value::for_value_type::<Self>();
3292        unsafe {
3293            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
3294        }
3295        value
3296    }
3297
3298    #[inline]
3299    fn value_type(&self) -> glib::Type {
3300        Self::static_type()
3301    }
3302}
3303
3304impl From<StateChange> for glib::Value {
3305    #[inline]
3306    fn from(v: StateChange) -> Self {
3307        skip_assert_initialized!();
3308        ToValue::to_value(&v)
3309    }
3310}
3311
3312/// The possible return values from a state change function such as
3313/// [`ElementExt::set_state()`][crate::prelude::ElementExt::set_state()]. Only [`Failure`][Self::Failure] is a real failure.
3314#[must_use]
3315#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
3316#[repr(i32)]
3317#[doc(alias = "GstStateChangeReturn")]
3318pub enum StateChangeReturn {
3319    /// the state change failed
3320    #[doc(alias = "GST_STATE_CHANGE_FAILURE")]
3321    Failure = ffi::GST_STATE_CHANGE_FAILURE,
3322    /// the state change succeeded
3323    #[doc(alias = "GST_STATE_CHANGE_SUCCESS")]
3324    Success = ffi::GST_STATE_CHANGE_SUCCESS,
3325    /// the state change will happen asynchronously
3326    #[doc(alias = "GST_STATE_CHANGE_ASYNC")]
3327    Async = ffi::GST_STATE_CHANGE_ASYNC,
3328    /// the state change succeeded but the element
3329    ///  cannot produce data in [`State::Paused`][crate::State::Paused].
3330    ///  This typically happens with live sources.
3331    #[doc(alias = "GST_STATE_CHANGE_NO_PREROLL")]
3332    NoPreroll = ffi::GST_STATE_CHANGE_NO_PREROLL,
3333}
3334
3335#[doc(hidden)]
3336impl IntoGlib for StateChangeReturn {
3337    type GlibType = ffi::GstStateChangeReturn;
3338
3339    #[inline]
3340    fn into_glib(self) -> ffi::GstStateChangeReturn {
3341        self as ffi::GstStateChangeReturn
3342    }
3343}
3344
3345#[doc(hidden)]
3346impl FromGlib<ffi::GstStateChangeReturn> for StateChangeReturn {
3347    #[inline]
3348    unsafe fn from_glib(value: ffi::GstStateChangeReturn) -> Self {
3349        skip_assert_initialized!();
3350
3351        debug_assert!([
3352            ffi::GST_STATE_CHANGE_FAILURE,
3353            ffi::GST_STATE_CHANGE_SUCCESS,
3354            ffi::GST_STATE_CHANGE_ASYNC,
3355            ffi::GST_STATE_CHANGE_NO_PREROLL
3356        ]
3357        .contains(&value));
3358        std::mem::transmute(value)
3359    }
3360}
3361
3362impl StaticType for StateChangeReturn {
3363    #[inline]
3364    #[doc(alias = "gst_state_change_return_get_type")]
3365    fn static_type() -> glib::Type {
3366        unsafe { from_glib(ffi::gst_state_change_return_get_type()) }
3367    }
3368}
3369
3370impl glib::HasParamSpec for StateChangeReturn {
3371    type ParamSpec = glib::ParamSpecEnum;
3372    type SetValue = Self;
3373    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
3374
3375    fn param_spec_builder() -> Self::BuilderFn {
3376        Self::ParamSpec::builder_with_default
3377    }
3378}
3379
3380impl glib::value::ValueType for StateChangeReturn {
3381    type Type = Self;
3382}
3383
3384unsafe impl<'a> glib::value::FromValue<'a> for StateChangeReturn {
3385    type Checker = glib::value::GenericValueTypeChecker<Self>;
3386
3387    #[inline]
3388    unsafe fn from_value(value: &'a glib::Value) -> Self {
3389        skip_assert_initialized!();
3390        from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0))
3391    }
3392}
3393
3394impl ToValue for StateChangeReturn {
3395    #[inline]
3396    fn to_value(&self) -> glib::Value {
3397        let mut value = glib::Value::for_value_type::<Self>();
3398        unsafe {
3399            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
3400        }
3401        value
3402    }
3403
3404    #[inline]
3405    fn value_type(&self) -> glib::Type {
3406        Self::static_type()
3407    }
3408}
3409
3410impl From<StateChangeReturn> for glib::Value {
3411    #[inline]
3412    fn from(v: StateChangeReturn) -> Self {
3413        skip_assert_initialized!();
3414        ToValue::to_value(&v)
3415    }
3416}
3417
3418/// Stream errors are for anything related to the stream being processed:
3419/// format errors, media type errors, ...
3420/// They're typically used by decoders, demuxers, converters, ...
3421#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
3422#[non_exhaustive]
3423#[doc(alias = "GstStreamError")]
3424pub enum StreamError {
3425    /// a general error which doesn't fit in any other
3426    /// category. Make sure you add a custom message to the error call.
3427    #[doc(alias = "GST_STREAM_ERROR_FAILED")]
3428    Failed,
3429    /// do not use this except as a placeholder for
3430    /// deciding where to go while developing code.
3431    #[doc(alias = "GST_STREAM_ERROR_TOO_LAZY")]
3432    TooLazy,
3433    /// use this when you do not want to implement
3434    /// this functionality yet.
3435    #[doc(alias = "GST_STREAM_ERROR_NOT_IMPLEMENTED")]
3436    NotImplemented,
3437    /// used when the element doesn't know the
3438    /// stream's type.
3439    #[doc(alias = "GST_STREAM_ERROR_TYPE_NOT_FOUND")]
3440    TypeNotFound,
3441    /// used when the element doesn't handle this type
3442    /// of stream.
3443    #[doc(alias = "GST_STREAM_ERROR_WRONG_TYPE")]
3444    WrongType,
3445    /// used when there's no codec to handle the
3446    /// stream's type.
3447    #[doc(alias = "GST_STREAM_ERROR_CODEC_NOT_FOUND")]
3448    CodecNotFound,
3449    /// used when decoding fails.
3450    #[doc(alias = "GST_STREAM_ERROR_DECODE")]
3451    Decode,
3452    /// used when encoding fails.
3453    #[doc(alias = "GST_STREAM_ERROR_ENCODE")]
3454    Encode,
3455    /// used when demuxing fails.
3456    #[doc(alias = "GST_STREAM_ERROR_DEMUX")]
3457    Demux,
3458    /// used when muxing fails.
3459    #[doc(alias = "GST_STREAM_ERROR_MUX")]
3460    Mux,
3461    /// used when the stream is of the wrong format
3462    /// (for example, wrong caps).
3463    #[doc(alias = "GST_STREAM_ERROR_FORMAT")]
3464    Format,
3465    /// used when the stream is encrypted and can't be
3466    /// decrypted because this is not supported by the element.
3467    #[doc(alias = "GST_STREAM_ERROR_DECRYPT")]
3468    Decrypt,
3469    /// used when the stream is encrypted and
3470    /// can't be decrypted because no suitable key is available.
3471    #[doc(alias = "GST_STREAM_ERROR_DECRYPT_NOKEY")]
3472    DecryptNokey,
3473    #[doc(hidden)]
3474    __Unknown(i32),
3475}
3476
3477#[doc(hidden)]
3478impl IntoGlib for StreamError {
3479    type GlibType = ffi::GstStreamError;
3480
3481    fn into_glib(self) -> ffi::GstStreamError {
3482        match self {
3483            Self::Failed => ffi::GST_STREAM_ERROR_FAILED,
3484            Self::TooLazy => ffi::GST_STREAM_ERROR_TOO_LAZY,
3485            Self::NotImplemented => ffi::GST_STREAM_ERROR_NOT_IMPLEMENTED,
3486            Self::TypeNotFound => ffi::GST_STREAM_ERROR_TYPE_NOT_FOUND,
3487            Self::WrongType => ffi::GST_STREAM_ERROR_WRONG_TYPE,
3488            Self::CodecNotFound => ffi::GST_STREAM_ERROR_CODEC_NOT_FOUND,
3489            Self::Decode => ffi::GST_STREAM_ERROR_DECODE,
3490            Self::Encode => ffi::GST_STREAM_ERROR_ENCODE,
3491            Self::Demux => ffi::GST_STREAM_ERROR_DEMUX,
3492            Self::Mux => ffi::GST_STREAM_ERROR_MUX,
3493            Self::Format => ffi::GST_STREAM_ERROR_FORMAT,
3494            Self::Decrypt => ffi::GST_STREAM_ERROR_DECRYPT,
3495            Self::DecryptNokey => ffi::GST_STREAM_ERROR_DECRYPT_NOKEY,
3496            Self::__Unknown(value) => value,
3497        }
3498    }
3499}
3500
3501#[doc(hidden)]
3502impl FromGlib<ffi::GstStreamError> for StreamError {
3503    unsafe fn from_glib(value: ffi::GstStreamError) -> Self {
3504        skip_assert_initialized!();
3505
3506        match value {
3507            ffi::GST_STREAM_ERROR_FAILED => Self::Failed,
3508            ffi::GST_STREAM_ERROR_TOO_LAZY => Self::TooLazy,
3509            ffi::GST_STREAM_ERROR_NOT_IMPLEMENTED => Self::NotImplemented,
3510            ffi::GST_STREAM_ERROR_TYPE_NOT_FOUND => Self::TypeNotFound,
3511            ffi::GST_STREAM_ERROR_WRONG_TYPE => Self::WrongType,
3512            ffi::GST_STREAM_ERROR_CODEC_NOT_FOUND => Self::CodecNotFound,
3513            ffi::GST_STREAM_ERROR_DECODE => Self::Decode,
3514            ffi::GST_STREAM_ERROR_ENCODE => Self::Encode,
3515            ffi::GST_STREAM_ERROR_DEMUX => Self::Demux,
3516            ffi::GST_STREAM_ERROR_MUX => Self::Mux,
3517            ffi::GST_STREAM_ERROR_FORMAT => Self::Format,
3518            ffi::GST_STREAM_ERROR_DECRYPT => Self::Decrypt,
3519            ffi::GST_STREAM_ERROR_DECRYPT_NOKEY => Self::DecryptNokey,
3520            value => Self::__Unknown(value),
3521        }
3522    }
3523}
3524
3525impl glib::error::ErrorDomain for StreamError {
3526    #[inline]
3527    fn domain() -> glib::Quark {
3528        skip_assert_initialized!();
3529
3530        unsafe { from_glib(ffi::gst_stream_error_quark()) }
3531    }
3532
3533    #[inline]
3534    fn code(self) -> i32 {
3535        self.into_glib()
3536    }
3537
3538    #[inline]
3539    #[allow(clippy::match_single_binding)]
3540    fn from(code: i32) -> Option<Self> {
3541        skip_assert_initialized!();
3542        match unsafe { from_glib(code) } {
3543            Self::__Unknown(_) => Some(Self::Failed),
3544            value => Some(value),
3545        }
3546    }
3547}
3548
3549impl StaticType for StreamError {
3550    #[inline]
3551    #[doc(alias = "gst_stream_error_get_type")]
3552    fn static_type() -> glib::Type {
3553        unsafe { from_glib(ffi::gst_stream_error_get_type()) }
3554    }
3555}
3556
3557impl glib::HasParamSpec for StreamError {
3558    type ParamSpec = glib::ParamSpecEnum;
3559    type SetValue = Self;
3560    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
3561
3562    fn param_spec_builder() -> Self::BuilderFn {
3563        Self::ParamSpec::builder_with_default
3564    }
3565}
3566
3567impl glib::value::ValueType for StreamError {
3568    type Type = Self;
3569}
3570
3571unsafe impl<'a> glib::value::FromValue<'a> for StreamError {
3572    type Checker = glib::value::GenericValueTypeChecker<Self>;
3573
3574    #[inline]
3575    unsafe fn from_value(value: &'a glib::Value) -> Self {
3576        skip_assert_initialized!();
3577        from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0))
3578    }
3579}
3580
3581impl ToValue for StreamError {
3582    #[inline]
3583    fn to_value(&self) -> glib::Value {
3584        let mut value = glib::Value::for_value_type::<Self>();
3585        unsafe {
3586            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
3587        }
3588        value
3589    }
3590
3591    #[inline]
3592    fn value_type(&self) -> glib::Type {
3593        Self::static_type()
3594    }
3595}
3596
3597impl From<StreamError> for glib::Value {
3598    #[inline]
3599    fn from(v: StreamError) -> Self {
3600        skip_assert_initialized!();
3601        ToValue::to_value(&v)
3602    }
3603}
3604
3605/// The type of a `GST_MESSAGE_STREAM_STATUS`. The stream status messages inform the
3606/// application of new streaming threads and their status.
3607#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
3608#[non_exhaustive]
3609#[doc(alias = "GstStreamStatusType")]
3610pub enum StreamStatusType {
3611    /// A new thread need to be created.
3612    #[doc(alias = "GST_STREAM_STATUS_TYPE_CREATE")]
3613    Create,
3614    /// a thread entered its loop function
3615    #[doc(alias = "GST_STREAM_STATUS_TYPE_ENTER")]
3616    Enter,
3617    /// a thread left its loop function
3618    #[doc(alias = "GST_STREAM_STATUS_TYPE_LEAVE")]
3619    Leave,
3620    /// a thread is destroyed
3621    #[doc(alias = "GST_STREAM_STATUS_TYPE_DESTROY")]
3622    Destroy,
3623    /// a thread is started
3624    #[doc(alias = "GST_STREAM_STATUS_TYPE_START")]
3625    Start,
3626    /// a thread is paused
3627    #[doc(alias = "GST_STREAM_STATUS_TYPE_PAUSE")]
3628    Pause,
3629    /// a thread is stopped
3630    #[doc(alias = "GST_STREAM_STATUS_TYPE_STOP")]
3631    Stop,
3632    #[doc(hidden)]
3633    __Unknown(i32),
3634}
3635
3636#[doc(hidden)]
3637impl IntoGlib for StreamStatusType {
3638    type GlibType = ffi::GstStreamStatusType;
3639
3640    #[inline]
3641    fn into_glib(self) -> ffi::GstStreamStatusType {
3642        match self {
3643            Self::Create => ffi::GST_STREAM_STATUS_TYPE_CREATE,
3644            Self::Enter => ffi::GST_STREAM_STATUS_TYPE_ENTER,
3645            Self::Leave => ffi::GST_STREAM_STATUS_TYPE_LEAVE,
3646            Self::Destroy => ffi::GST_STREAM_STATUS_TYPE_DESTROY,
3647            Self::Start => ffi::GST_STREAM_STATUS_TYPE_START,
3648            Self::Pause => ffi::GST_STREAM_STATUS_TYPE_PAUSE,
3649            Self::Stop => ffi::GST_STREAM_STATUS_TYPE_STOP,
3650            Self::__Unknown(value) => value,
3651        }
3652    }
3653}
3654
3655#[doc(hidden)]
3656impl FromGlib<ffi::GstStreamStatusType> for StreamStatusType {
3657    #[inline]
3658    unsafe fn from_glib(value: ffi::GstStreamStatusType) -> Self {
3659        skip_assert_initialized!();
3660
3661        match value {
3662            ffi::GST_STREAM_STATUS_TYPE_CREATE => Self::Create,
3663            ffi::GST_STREAM_STATUS_TYPE_ENTER => Self::Enter,
3664            ffi::GST_STREAM_STATUS_TYPE_LEAVE => Self::Leave,
3665            ffi::GST_STREAM_STATUS_TYPE_DESTROY => Self::Destroy,
3666            ffi::GST_STREAM_STATUS_TYPE_START => Self::Start,
3667            ffi::GST_STREAM_STATUS_TYPE_PAUSE => Self::Pause,
3668            ffi::GST_STREAM_STATUS_TYPE_STOP => Self::Stop,
3669            value => Self::__Unknown(value),
3670        }
3671    }
3672}
3673
3674impl StaticType for StreamStatusType {
3675    #[inline]
3676    #[doc(alias = "gst_stream_status_type_get_type")]
3677    fn static_type() -> glib::Type {
3678        unsafe { from_glib(ffi::gst_stream_status_type_get_type()) }
3679    }
3680}
3681
3682impl glib::HasParamSpec for StreamStatusType {
3683    type ParamSpec = glib::ParamSpecEnum;
3684    type SetValue = Self;
3685    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
3686
3687    fn param_spec_builder() -> Self::BuilderFn {
3688        Self::ParamSpec::builder_with_default
3689    }
3690}
3691
3692impl glib::value::ValueType for StreamStatusType {
3693    type Type = Self;
3694}
3695
3696unsafe impl<'a> glib::value::FromValue<'a> for StreamStatusType {
3697    type Checker = glib::value::GenericValueTypeChecker<Self>;
3698
3699    #[inline]
3700    unsafe fn from_value(value: &'a glib::Value) -> Self {
3701        skip_assert_initialized!();
3702        from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0))
3703    }
3704}
3705
3706impl ToValue for StreamStatusType {
3707    #[inline]
3708    fn to_value(&self) -> glib::Value {
3709        let mut value = glib::Value::for_value_type::<Self>();
3710        unsafe {
3711            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
3712        }
3713        value
3714    }
3715
3716    #[inline]
3717    fn value_type(&self) -> glib::Type {
3718        Self::static_type()
3719    }
3720}
3721
3722impl From<StreamStatusType> for glib::Value {
3723    #[inline]
3724    fn from(v: StreamStatusType) -> Self {
3725        skip_assert_initialized!();
3726        ToValue::to_value(&v)
3727    }
3728}
3729
3730/// The type of a `GST_MESSAGE_STRUCTURE_CHANGE`.
3731#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
3732#[non_exhaustive]
3733#[doc(alias = "GstStructureChangeType")]
3734pub enum StructureChangeType {
3735    /// Pad linking is starting or done.
3736    #[doc(alias = "GST_STRUCTURE_CHANGE_TYPE_PAD_LINK")]
3737    Link,
3738    /// Pad unlinking is starting or done.
3739    #[doc(alias = "GST_STRUCTURE_CHANGE_TYPE_PAD_UNLINK")]
3740    Unlink,
3741    #[doc(hidden)]
3742    __Unknown(i32),
3743}
3744
3745#[doc(hidden)]
3746impl IntoGlib for StructureChangeType {
3747    type GlibType = ffi::GstStructureChangeType;
3748
3749    #[inline]
3750    fn into_glib(self) -> ffi::GstStructureChangeType {
3751        match self {
3752            Self::Link => ffi::GST_STRUCTURE_CHANGE_TYPE_PAD_LINK,
3753            Self::Unlink => ffi::GST_STRUCTURE_CHANGE_TYPE_PAD_UNLINK,
3754            Self::__Unknown(value) => value,
3755        }
3756    }
3757}
3758
3759#[doc(hidden)]
3760impl FromGlib<ffi::GstStructureChangeType> for StructureChangeType {
3761    #[inline]
3762    unsafe fn from_glib(value: ffi::GstStructureChangeType) -> Self {
3763        skip_assert_initialized!();
3764
3765        match value {
3766            ffi::GST_STRUCTURE_CHANGE_TYPE_PAD_LINK => Self::Link,
3767            ffi::GST_STRUCTURE_CHANGE_TYPE_PAD_UNLINK => Self::Unlink,
3768            value => Self::__Unknown(value),
3769        }
3770    }
3771}
3772
3773impl StaticType for StructureChangeType {
3774    #[inline]
3775    #[doc(alias = "gst_structure_change_type_get_type")]
3776    fn static_type() -> glib::Type {
3777        unsafe { from_glib(ffi::gst_structure_change_type_get_type()) }
3778    }
3779}
3780
3781impl glib::HasParamSpec for StructureChangeType {
3782    type ParamSpec = glib::ParamSpecEnum;
3783    type SetValue = Self;
3784    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
3785
3786    fn param_spec_builder() -> Self::BuilderFn {
3787        Self::ParamSpec::builder_with_default
3788    }
3789}
3790
3791impl glib::value::ValueType for StructureChangeType {
3792    type Type = Self;
3793}
3794
3795unsafe impl<'a> glib::value::FromValue<'a> for StructureChangeType {
3796    type Checker = glib::value::GenericValueTypeChecker<Self>;
3797
3798    #[inline]
3799    unsafe fn from_value(value: &'a glib::Value) -> Self {
3800        skip_assert_initialized!();
3801        from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0))
3802    }
3803}
3804
3805impl ToValue for StructureChangeType {
3806    #[inline]
3807    fn to_value(&self) -> glib::Value {
3808        let mut value = glib::Value::for_value_type::<Self>();
3809        unsafe {
3810            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
3811        }
3812        value
3813    }
3814
3815    #[inline]
3816    fn value_type(&self) -> glib::Type {
3817        Self::static_type()
3818    }
3819}
3820
3821impl From<StructureChangeType> for glib::Value {
3822    #[inline]
3823    fn from(v: StructureChangeType) -> Self {
3824        skip_assert_initialized!();
3825        ToValue::to_value(&v)
3826    }
3827}
3828
3829/// Extra tag flags used when registering tags.
3830#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
3831#[non_exhaustive]
3832#[doc(alias = "GstTagFlag")]
3833pub enum TagFlag {
3834    /// undefined flag
3835    #[doc(alias = "GST_TAG_FLAG_UNDEFINED")]
3836    Undefined,
3837    /// tag is meta data
3838    #[doc(alias = "GST_TAG_FLAG_META")]
3839    Meta,
3840    /// tag is encoded
3841    #[doc(alias = "GST_TAG_FLAG_ENCODED")]
3842    Encoded,
3843    /// tag is decoded
3844    #[doc(alias = "GST_TAG_FLAG_DECODED")]
3845    Decoded,
3846    #[doc(hidden)]
3847    __Unknown(i32),
3848}
3849
3850#[doc(hidden)]
3851impl IntoGlib for TagFlag {
3852    type GlibType = ffi::GstTagFlag;
3853
3854    #[inline]
3855    fn into_glib(self) -> ffi::GstTagFlag {
3856        match self {
3857            Self::Undefined => ffi::GST_TAG_FLAG_UNDEFINED,
3858            Self::Meta => ffi::GST_TAG_FLAG_META,
3859            Self::Encoded => ffi::GST_TAG_FLAG_ENCODED,
3860            Self::Decoded => ffi::GST_TAG_FLAG_DECODED,
3861            Self::__Unknown(value) => value,
3862        }
3863    }
3864}
3865
3866#[doc(hidden)]
3867impl FromGlib<ffi::GstTagFlag> for TagFlag {
3868    #[inline]
3869    unsafe fn from_glib(value: ffi::GstTagFlag) -> Self {
3870        skip_assert_initialized!();
3871
3872        match value {
3873            ffi::GST_TAG_FLAG_UNDEFINED => Self::Undefined,
3874            ffi::GST_TAG_FLAG_META => Self::Meta,
3875            ffi::GST_TAG_FLAG_ENCODED => Self::Encoded,
3876            ffi::GST_TAG_FLAG_DECODED => Self::Decoded,
3877            value => Self::__Unknown(value),
3878        }
3879    }
3880}
3881
3882impl StaticType for TagFlag {
3883    #[inline]
3884    #[doc(alias = "gst_tag_flag_get_type")]
3885    fn static_type() -> glib::Type {
3886        unsafe { from_glib(ffi::gst_tag_flag_get_type()) }
3887    }
3888}
3889
3890impl glib::HasParamSpec for TagFlag {
3891    type ParamSpec = glib::ParamSpecEnum;
3892    type SetValue = Self;
3893    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
3894
3895    fn param_spec_builder() -> Self::BuilderFn {
3896        Self::ParamSpec::builder_with_default
3897    }
3898}
3899
3900impl glib::value::ValueType for TagFlag {
3901    type Type = Self;
3902}
3903
3904unsafe impl<'a> glib::value::FromValue<'a> for TagFlag {
3905    type Checker = glib::value::GenericValueTypeChecker<Self>;
3906
3907    #[inline]
3908    unsafe fn from_value(value: &'a glib::Value) -> Self {
3909        skip_assert_initialized!();
3910        from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0))
3911    }
3912}
3913
3914impl ToValue for TagFlag {
3915    #[inline]
3916    fn to_value(&self) -> glib::Value {
3917        let mut value = glib::Value::for_value_type::<Self>();
3918        unsafe {
3919            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
3920        }
3921        value
3922    }
3923
3924    #[inline]
3925    fn value_type(&self) -> glib::Type {
3926        Self::static_type()
3927    }
3928}
3929
3930impl From<TagFlag> for glib::Value {
3931    #[inline]
3932    fn from(v: TagFlag) -> Self {
3933        skip_assert_initialized!();
3934        ToValue::to_value(&v)
3935    }
3936}
3937
3938/// The different tag merging modes are basically replace, overwrite and append,
3939/// but they can be seen from two directions. Given two taglists: (A) the tags
3940/// already in the element and (B) the ones that are supplied to the element (
3941/// e.g. via [`TagSetterExt::merge_tags()`][crate::prelude::TagSetterExt::merge_tags()] / `gst_tag_setter_add_tags()` or a
3942/// [`EventType::Tag`][crate::EventType::Tag]), how are these tags merged?
3943/// In the table below this is shown for the cases that a tag exists in the list
3944/// (A) or does not exists (!A) and combinations thereof.
3945///
3946/// | merge mode | A + B | A + !B | !A + B | !A + !B |
3947/// | ----------- | ----- | ------ | ------ | ------- |
3948/// | REPLACE_ALL | B | ø | B | ø |
3949/// | REPLACE | B | A | B | ø |
3950/// | APPEND | A, B | A | B | ø |
3951/// | PREPEND | B, A | A | B | ø |
3952/// | KEEP | A | A | B | ø |
3953/// | KEEP_ALL | A | A | ø | ø |
3954#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
3955#[non_exhaustive]
3956#[doc(alias = "GstTagMergeMode")]
3957pub enum TagMergeMode {
3958    /// undefined merge mode
3959    #[doc(alias = "GST_TAG_MERGE_UNDEFINED")]
3960    Undefined,
3961    /// replace all tags (clear list and append)
3962    #[doc(alias = "GST_TAG_MERGE_REPLACE_ALL")]
3963    ReplaceAll,
3964    /// replace tags
3965    #[doc(alias = "GST_TAG_MERGE_REPLACE")]
3966    Replace,
3967    /// append tags
3968    #[doc(alias = "GST_TAG_MERGE_APPEND")]
3969    Append,
3970    /// prepend tags
3971    #[doc(alias = "GST_TAG_MERGE_PREPEND")]
3972    Prepend,
3973    /// keep existing tags
3974    #[doc(alias = "GST_TAG_MERGE_KEEP")]
3975    Keep,
3976    /// keep all existing tags
3977    #[doc(alias = "GST_TAG_MERGE_KEEP_ALL")]
3978    KeepAll,
3979    #[doc(hidden)]
3980    __Unknown(i32),
3981}
3982
3983#[doc(hidden)]
3984impl IntoGlib for TagMergeMode {
3985    type GlibType = ffi::GstTagMergeMode;
3986
3987    #[inline]
3988    fn into_glib(self) -> ffi::GstTagMergeMode {
3989        match self {
3990            Self::Undefined => ffi::GST_TAG_MERGE_UNDEFINED,
3991            Self::ReplaceAll => ffi::GST_TAG_MERGE_REPLACE_ALL,
3992            Self::Replace => ffi::GST_TAG_MERGE_REPLACE,
3993            Self::Append => ffi::GST_TAG_MERGE_APPEND,
3994            Self::Prepend => ffi::GST_TAG_MERGE_PREPEND,
3995            Self::Keep => ffi::GST_TAG_MERGE_KEEP,
3996            Self::KeepAll => ffi::GST_TAG_MERGE_KEEP_ALL,
3997            Self::__Unknown(value) => value,
3998        }
3999    }
4000}
4001
4002#[doc(hidden)]
4003impl FromGlib<ffi::GstTagMergeMode> for TagMergeMode {
4004    #[inline]
4005    unsafe fn from_glib(value: ffi::GstTagMergeMode) -> Self {
4006        skip_assert_initialized!();
4007
4008        match value {
4009            ffi::GST_TAG_MERGE_UNDEFINED => Self::Undefined,
4010            ffi::GST_TAG_MERGE_REPLACE_ALL => Self::ReplaceAll,
4011            ffi::GST_TAG_MERGE_REPLACE => Self::Replace,
4012            ffi::GST_TAG_MERGE_APPEND => Self::Append,
4013            ffi::GST_TAG_MERGE_PREPEND => Self::Prepend,
4014            ffi::GST_TAG_MERGE_KEEP => Self::Keep,
4015            ffi::GST_TAG_MERGE_KEEP_ALL => Self::KeepAll,
4016            value => Self::__Unknown(value),
4017        }
4018    }
4019}
4020
4021impl StaticType for TagMergeMode {
4022    #[inline]
4023    #[doc(alias = "gst_tag_merge_mode_get_type")]
4024    fn static_type() -> glib::Type {
4025        unsafe { from_glib(ffi::gst_tag_merge_mode_get_type()) }
4026    }
4027}
4028
4029impl glib::HasParamSpec for TagMergeMode {
4030    type ParamSpec = glib::ParamSpecEnum;
4031    type SetValue = Self;
4032    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
4033
4034    fn param_spec_builder() -> Self::BuilderFn {
4035        Self::ParamSpec::builder_with_default
4036    }
4037}
4038
4039impl glib::value::ValueType for TagMergeMode {
4040    type Type = Self;
4041}
4042
4043unsafe impl<'a> glib::value::FromValue<'a> for TagMergeMode {
4044    type Checker = glib::value::GenericValueTypeChecker<Self>;
4045
4046    #[inline]
4047    unsafe fn from_value(value: &'a glib::Value) -> Self {
4048        skip_assert_initialized!();
4049        from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0))
4050    }
4051}
4052
4053impl ToValue for TagMergeMode {
4054    #[inline]
4055    fn to_value(&self) -> glib::Value {
4056        let mut value = glib::Value::for_value_type::<Self>();
4057        unsafe {
4058            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
4059        }
4060        value
4061    }
4062
4063    #[inline]
4064    fn value_type(&self) -> glib::Type {
4065        Self::static_type()
4066    }
4067}
4068
4069impl From<TagMergeMode> for glib::Value {
4070    #[inline]
4071    fn from(v: TagMergeMode) -> Self {
4072        skip_assert_initialized!();
4073        ToValue::to_value(&v)
4074    }
4075}
4076
4077/// GstTagScope specifies if a taglist applies to the complete
4078/// medium or only to one single stream.
4079#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
4080#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy)]
4081#[non_exhaustive]
4082#[doc(alias = "GstTagScope")]
4083pub enum TagScope {
4084    /// tags specific to this single stream
4085    #[doc(alias = "GST_TAG_SCOPE_STREAM")]
4086    Stream,
4087    /// global tags for the complete medium
4088    #[doc(alias = "GST_TAG_SCOPE_GLOBAL")]
4089    Global,
4090    #[doc(hidden)]
4091    __Unknown(i32),
4092}
4093
4094#[doc(hidden)]
4095impl IntoGlib for TagScope {
4096    type GlibType = ffi::GstTagScope;
4097
4098    #[inline]
4099    fn into_glib(self) -> ffi::GstTagScope {
4100        match self {
4101            Self::Stream => ffi::GST_TAG_SCOPE_STREAM,
4102            Self::Global => ffi::GST_TAG_SCOPE_GLOBAL,
4103            Self::__Unknown(value) => value,
4104        }
4105    }
4106}
4107
4108#[doc(hidden)]
4109impl FromGlib<ffi::GstTagScope> for TagScope {
4110    #[inline]
4111    unsafe fn from_glib(value: ffi::GstTagScope) -> Self {
4112        skip_assert_initialized!();
4113
4114        match value {
4115            ffi::GST_TAG_SCOPE_STREAM => Self::Stream,
4116            ffi::GST_TAG_SCOPE_GLOBAL => Self::Global,
4117            value => Self::__Unknown(value),
4118        }
4119    }
4120}
4121
4122impl StaticType for TagScope {
4123    #[inline]
4124    #[doc(alias = "gst_tag_scope_get_type")]
4125    fn static_type() -> glib::Type {
4126        unsafe { from_glib(ffi::gst_tag_scope_get_type()) }
4127    }
4128}
4129
4130impl glib::HasParamSpec for TagScope {
4131    type ParamSpec = glib::ParamSpecEnum;
4132    type SetValue = Self;
4133    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
4134
4135    fn param_spec_builder() -> Self::BuilderFn {
4136        Self::ParamSpec::builder_with_default
4137    }
4138}
4139
4140impl glib::value::ValueType for TagScope {
4141    type Type = Self;
4142}
4143
4144unsafe impl<'a> glib::value::FromValue<'a> for TagScope {
4145    type Checker = glib::value::GenericValueTypeChecker<Self>;
4146
4147    #[inline]
4148    unsafe fn from_value(value: &'a glib::Value) -> Self {
4149        skip_assert_initialized!();
4150        from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0))
4151    }
4152}
4153
4154impl ToValue for TagScope {
4155    #[inline]
4156    fn to_value(&self) -> glib::Value {
4157        let mut value = glib::Value::for_value_type::<Self>();
4158        unsafe {
4159            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
4160        }
4161        value
4162    }
4163
4164    #[inline]
4165    fn value_type(&self) -> glib::Type {
4166        Self::static_type()
4167    }
4168}
4169
4170impl From<TagScope> for glib::Value {
4171    #[inline]
4172    fn from(v: TagScope) -> Self {
4173        skip_assert_initialized!();
4174        ToValue::to_value(&v)
4175    }
4176}
4177
4178/// The different states a task can be in
4179#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
4180#[non_exhaustive]
4181#[doc(alias = "GstTaskState")]
4182pub enum TaskState {
4183    /// the task is started and running
4184    #[doc(alias = "GST_TASK_STARTED")]
4185    Started,
4186    /// the task is stopped
4187    #[doc(alias = "GST_TASK_STOPPED")]
4188    Stopped,
4189    /// the task is paused
4190    #[doc(alias = "GST_TASK_PAUSED")]
4191    Paused,
4192    #[doc(hidden)]
4193    __Unknown(i32),
4194}
4195
4196#[doc(hidden)]
4197impl IntoGlib for TaskState {
4198    type GlibType = ffi::GstTaskState;
4199
4200    #[inline]
4201    fn into_glib(self) -> ffi::GstTaskState {
4202        match self {
4203            Self::Started => ffi::GST_TASK_STARTED,
4204            Self::Stopped => ffi::GST_TASK_STOPPED,
4205            Self::Paused => ffi::GST_TASK_PAUSED,
4206            Self::__Unknown(value) => value,
4207        }
4208    }
4209}
4210
4211#[doc(hidden)]
4212impl FromGlib<ffi::GstTaskState> for TaskState {
4213    #[inline]
4214    unsafe fn from_glib(value: ffi::GstTaskState) -> Self {
4215        skip_assert_initialized!();
4216
4217        match value {
4218            ffi::GST_TASK_STARTED => Self::Started,
4219            ffi::GST_TASK_STOPPED => Self::Stopped,
4220            ffi::GST_TASK_PAUSED => Self::Paused,
4221            value => Self::__Unknown(value),
4222        }
4223    }
4224}
4225
4226impl StaticType for TaskState {
4227    #[inline]
4228    #[doc(alias = "gst_task_state_get_type")]
4229    fn static_type() -> glib::Type {
4230        unsafe { from_glib(ffi::gst_task_state_get_type()) }
4231    }
4232}
4233
4234impl glib::HasParamSpec for TaskState {
4235    type ParamSpec = glib::ParamSpecEnum;
4236    type SetValue = Self;
4237    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
4238
4239    fn param_spec_builder() -> Self::BuilderFn {
4240        Self::ParamSpec::builder_with_default
4241    }
4242}
4243
4244impl glib::value::ValueType for TaskState {
4245    type Type = Self;
4246}
4247
4248unsafe impl<'a> glib::value::FromValue<'a> for TaskState {
4249    type Checker = glib::value::GenericValueTypeChecker<Self>;
4250
4251    #[inline]
4252    unsafe fn from_value(value: &'a glib::Value) -> Self {
4253        skip_assert_initialized!();
4254        from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0))
4255    }
4256}
4257
4258impl ToValue for TaskState {
4259    #[inline]
4260    fn to_value(&self) -> glib::Value {
4261        let mut value = glib::Value::for_value_type::<Self>();
4262        unsafe {
4263            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
4264        }
4265        value
4266    }
4267
4268    #[inline]
4269    fn value_type(&self) -> glib::Type {
4270        Self::static_type()
4271    }
4272}
4273
4274impl From<TaskState> for glib::Value {
4275    #[inline]
4276    fn from(v: TaskState) -> Self {
4277        skip_assert_initialized!();
4278        ToValue::to_value(&v)
4279    }
4280}
4281
4282/// The different types of TOC entries (see [`TocEntry`][crate::TocEntry]).
4283///
4284/// There are two types of TOC entries: alternatives or parts in a sequence.
4285#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
4286#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy)]
4287#[non_exhaustive]
4288#[doc(alias = "GstTocEntryType")]
4289pub enum TocEntryType {
4290    /// entry is an angle (i.e. an alternative)
4291    #[doc(alias = "GST_TOC_ENTRY_TYPE_ANGLE")]
4292    Angle,
4293    /// entry is a version (i.e. alternative)
4294    #[doc(alias = "GST_TOC_ENTRY_TYPE_VERSION")]
4295    Version,
4296    /// entry is an edition (i.e. alternative)
4297    #[doc(alias = "GST_TOC_ENTRY_TYPE_EDITION")]
4298    Edition,
4299    /// invalid entry type value
4300    #[doc(alias = "GST_TOC_ENTRY_TYPE_INVALID")]
4301    Invalid,
4302    /// entry is a title (i.e. a part of a sequence)
4303    #[doc(alias = "GST_TOC_ENTRY_TYPE_TITLE")]
4304    Title,
4305    /// entry is a track (i.e. a part of a sequence)
4306    #[doc(alias = "GST_TOC_ENTRY_TYPE_TRACK")]
4307    Track,
4308    /// entry is a chapter (i.e. a part of a sequence)
4309    #[doc(alias = "GST_TOC_ENTRY_TYPE_CHAPTER")]
4310    Chapter,
4311    #[doc(hidden)]
4312    __Unknown(i32),
4313}
4314
4315impl TocEntryType {
4316    pub fn nick<'a>(self) -> &'a GStr {
4317        unsafe {
4318            GStr::from_ptr(
4319                ffi::gst_toc_entry_type_get_nick(self.into_glib())
4320                    .as_ref()
4321                    .expect("gst_toc_entry_type_get_nick returned NULL"),
4322            )
4323        }
4324    }
4325}
4326
4327#[doc(hidden)]
4328impl IntoGlib for TocEntryType {
4329    type GlibType = ffi::GstTocEntryType;
4330
4331    #[inline]
4332    fn into_glib(self) -> ffi::GstTocEntryType {
4333        match self {
4334            Self::Angle => ffi::GST_TOC_ENTRY_TYPE_ANGLE,
4335            Self::Version => ffi::GST_TOC_ENTRY_TYPE_VERSION,
4336            Self::Edition => ffi::GST_TOC_ENTRY_TYPE_EDITION,
4337            Self::Invalid => ffi::GST_TOC_ENTRY_TYPE_INVALID,
4338            Self::Title => ffi::GST_TOC_ENTRY_TYPE_TITLE,
4339            Self::Track => ffi::GST_TOC_ENTRY_TYPE_TRACK,
4340            Self::Chapter => ffi::GST_TOC_ENTRY_TYPE_CHAPTER,
4341            Self::__Unknown(value) => value,
4342        }
4343    }
4344}
4345
4346#[doc(hidden)]
4347impl FromGlib<ffi::GstTocEntryType> for TocEntryType {
4348    #[inline]
4349    unsafe fn from_glib(value: ffi::GstTocEntryType) -> Self {
4350        skip_assert_initialized!();
4351
4352        match value {
4353            ffi::GST_TOC_ENTRY_TYPE_ANGLE => Self::Angle,
4354            ffi::GST_TOC_ENTRY_TYPE_VERSION => Self::Version,
4355            ffi::GST_TOC_ENTRY_TYPE_EDITION => Self::Edition,
4356            ffi::GST_TOC_ENTRY_TYPE_INVALID => Self::Invalid,
4357            ffi::GST_TOC_ENTRY_TYPE_TITLE => Self::Title,
4358            ffi::GST_TOC_ENTRY_TYPE_TRACK => Self::Track,
4359            ffi::GST_TOC_ENTRY_TYPE_CHAPTER => Self::Chapter,
4360            value => Self::__Unknown(value),
4361        }
4362    }
4363}
4364
4365impl StaticType for TocEntryType {
4366    #[inline]
4367    #[doc(alias = "gst_toc_entry_type_get_type")]
4368    fn static_type() -> glib::Type {
4369        unsafe { from_glib(ffi::gst_toc_entry_type_get_type()) }
4370    }
4371}
4372
4373impl glib::HasParamSpec for TocEntryType {
4374    type ParamSpec = glib::ParamSpecEnum;
4375    type SetValue = Self;
4376    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
4377
4378    fn param_spec_builder() -> Self::BuilderFn {
4379        Self::ParamSpec::builder_with_default
4380    }
4381}
4382
4383impl glib::value::ValueType for TocEntryType {
4384    type Type = Self;
4385}
4386
4387unsafe impl<'a> glib::value::FromValue<'a> for TocEntryType {
4388    type Checker = glib::value::GenericValueTypeChecker<Self>;
4389
4390    #[inline]
4391    unsafe fn from_value(value: &'a glib::Value) -> Self {
4392        skip_assert_initialized!();
4393        from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0))
4394    }
4395}
4396
4397impl ToValue for TocEntryType {
4398    #[inline]
4399    fn to_value(&self) -> glib::Value {
4400        let mut value = glib::Value::for_value_type::<Self>();
4401        unsafe {
4402            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
4403        }
4404        value
4405    }
4406
4407    #[inline]
4408    fn value_type(&self) -> glib::Type {
4409        Self::static_type()
4410    }
4411}
4412
4413impl From<TocEntryType> for glib::Value {
4414    #[inline]
4415    fn from(v: TocEntryType) -> Self {
4416        skip_assert_initialized!();
4417        ToValue::to_value(&v)
4418    }
4419}
4420
4421/// How a [`TocEntry`][crate::TocEntry] should be repeated. By default, entries are played a
4422/// single time.
4423#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
4424#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy)]
4425#[non_exhaustive]
4426#[doc(alias = "GstTocLoopType")]
4427pub enum TocLoopType {
4428    /// single forward playback
4429    #[doc(alias = "GST_TOC_LOOP_NONE")]
4430    None,
4431    /// repeat forward
4432    #[doc(alias = "GST_TOC_LOOP_FORWARD")]
4433    Forward,
4434    /// repeat backward
4435    #[doc(alias = "GST_TOC_LOOP_REVERSE")]
4436    Reverse,
4437    /// repeat forward and backward
4438    #[doc(alias = "GST_TOC_LOOP_PING_PONG")]
4439    PingPong,
4440    #[doc(hidden)]
4441    __Unknown(i32),
4442}
4443
4444#[doc(hidden)]
4445impl IntoGlib for TocLoopType {
4446    type GlibType = ffi::GstTocLoopType;
4447
4448    #[inline]
4449    fn into_glib(self) -> ffi::GstTocLoopType {
4450        match self {
4451            Self::None => ffi::GST_TOC_LOOP_NONE,
4452            Self::Forward => ffi::GST_TOC_LOOP_FORWARD,
4453            Self::Reverse => ffi::GST_TOC_LOOP_REVERSE,
4454            Self::PingPong => ffi::GST_TOC_LOOP_PING_PONG,
4455            Self::__Unknown(value) => value,
4456        }
4457    }
4458}
4459
4460#[doc(hidden)]
4461impl FromGlib<ffi::GstTocLoopType> for TocLoopType {
4462    #[inline]
4463    unsafe fn from_glib(value: ffi::GstTocLoopType) -> Self {
4464        skip_assert_initialized!();
4465
4466        match value {
4467            ffi::GST_TOC_LOOP_NONE => Self::None,
4468            ffi::GST_TOC_LOOP_FORWARD => Self::Forward,
4469            ffi::GST_TOC_LOOP_REVERSE => Self::Reverse,
4470            ffi::GST_TOC_LOOP_PING_PONG => Self::PingPong,
4471            value => Self::__Unknown(value),
4472        }
4473    }
4474}
4475
4476impl StaticType for TocLoopType {
4477    #[inline]
4478    #[doc(alias = "gst_toc_loop_type_get_type")]
4479    fn static_type() -> glib::Type {
4480        unsafe { from_glib(ffi::gst_toc_loop_type_get_type()) }
4481    }
4482}
4483
4484impl glib::HasParamSpec for TocLoopType {
4485    type ParamSpec = glib::ParamSpecEnum;
4486    type SetValue = Self;
4487    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
4488
4489    fn param_spec_builder() -> Self::BuilderFn {
4490        Self::ParamSpec::builder_with_default
4491    }
4492}
4493
4494impl glib::value::ValueType for TocLoopType {
4495    type Type = Self;
4496}
4497
4498unsafe impl<'a> glib::value::FromValue<'a> for TocLoopType {
4499    type Checker = glib::value::GenericValueTypeChecker<Self>;
4500
4501    #[inline]
4502    unsafe fn from_value(value: &'a glib::Value) -> Self {
4503        skip_assert_initialized!();
4504        from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0))
4505    }
4506}
4507
4508impl ToValue for TocLoopType {
4509    #[inline]
4510    fn to_value(&self) -> glib::Value {
4511        let mut value = glib::Value::for_value_type::<Self>();
4512        unsafe {
4513            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
4514        }
4515        value
4516    }
4517
4518    #[inline]
4519    fn value_type(&self) -> glib::Type {
4520        Self::static_type()
4521    }
4522}
4523
4524impl From<TocLoopType> for glib::Value {
4525    #[inline]
4526    fn from(v: TocLoopType) -> Self {
4527        skip_assert_initialized!();
4528        ToValue::to_value(&v)
4529    }
4530}
4531
4532/// The scope of a TOC.
4533#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
4534#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy)]
4535#[non_exhaustive]
4536#[doc(alias = "GstTocScope")]
4537pub enum TocScope {
4538    /// global TOC representing all selectable options
4539    ///  (this is what applications are usually interested in)
4540    #[doc(alias = "GST_TOC_SCOPE_GLOBAL")]
4541    Global,
4542    /// TOC for the currently active/selected stream
4543    ///  (this is a TOC representing the current stream from start to EOS,
4544    ///  and is what a TOC writer / muxer is usually interested in; it will
4545    ///  usually be a subset of the global TOC, e.g. just the chapters of
4546    ///  the current title, or the chapters selected for playback from the
4547    ///  current title)
4548    #[doc(alias = "GST_TOC_SCOPE_CURRENT")]
4549    Current,
4550    #[doc(hidden)]
4551    __Unknown(i32),
4552}
4553
4554#[doc(hidden)]
4555impl IntoGlib for TocScope {
4556    type GlibType = ffi::GstTocScope;
4557
4558    #[inline]
4559    fn into_glib(self) -> ffi::GstTocScope {
4560        match self {
4561            Self::Global => ffi::GST_TOC_SCOPE_GLOBAL,
4562            Self::Current => ffi::GST_TOC_SCOPE_CURRENT,
4563            Self::__Unknown(value) => value,
4564        }
4565    }
4566}
4567
4568#[doc(hidden)]
4569impl FromGlib<ffi::GstTocScope> for TocScope {
4570    #[inline]
4571    unsafe fn from_glib(value: ffi::GstTocScope) -> Self {
4572        skip_assert_initialized!();
4573
4574        match value {
4575            ffi::GST_TOC_SCOPE_GLOBAL => Self::Global,
4576            ffi::GST_TOC_SCOPE_CURRENT => Self::Current,
4577            value => Self::__Unknown(value),
4578        }
4579    }
4580}
4581
4582impl StaticType for TocScope {
4583    #[inline]
4584    #[doc(alias = "gst_toc_scope_get_type")]
4585    fn static_type() -> glib::Type {
4586        unsafe { from_glib(ffi::gst_toc_scope_get_type()) }
4587    }
4588}
4589
4590impl glib::HasParamSpec for TocScope {
4591    type ParamSpec = glib::ParamSpecEnum;
4592    type SetValue = Self;
4593    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
4594
4595    fn param_spec_builder() -> Self::BuilderFn {
4596        Self::ParamSpec::builder_with_default
4597    }
4598}
4599
4600impl glib::value::ValueType for TocScope {
4601    type Type = Self;
4602}
4603
4604unsafe impl<'a> glib::value::FromValue<'a> for TocScope {
4605    type Checker = glib::value::GenericValueTypeChecker<Self>;
4606
4607    #[inline]
4608    unsafe fn from_value(value: &'a glib::Value) -> Self {
4609        skip_assert_initialized!();
4610        from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0))
4611    }
4612}
4613
4614impl ToValue for TocScope {
4615    #[inline]
4616    fn to_value(&self) -> glib::Value {
4617        let mut value = glib::Value::for_value_type::<Self>();
4618        unsafe {
4619            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
4620        }
4621        value
4622    }
4623
4624    #[inline]
4625    fn value_type(&self) -> glib::Type {
4626        Self::static_type()
4627    }
4628}
4629
4630impl From<TocScope> for glib::Value {
4631    #[inline]
4632    fn from(v: TocScope) -> Self {
4633        skip_assert_initialized!();
4634        ToValue::to_value(&v)
4635    }
4636}
4637
4638/// The probability of the typefind function. Higher values have more certainty
4639/// in doing a reliable typefind.
4640#[derive(Debug, Clone, Copy)]
4641#[non_exhaustive]
4642#[doc(alias = "GstTypeFindProbability")]
4643pub enum TypeFindProbability {
4644    /// type undetected.
4645    #[doc(alias = "GST_TYPE_FIND_NONE")]
4646    None,
4647    /// unlikely typefind.
4648    #[doc(alias = "GST_TYPE_FIND_MINIMUM")]
4649    Minimum,
4650    /// possible type detected.
4651    #[doc(alias = "GST_TYPE_FIND_POSSIBLE")]
4652    Possible,
4653    /// likely a type was detected.
4654    #[doc(alias = "GST_TYPE_FIND_LIKELY")]
4655    Likely,
4656    /// nearly certain that a type was detected.
4657    #[doc(alias = "GST_TYPE_FIND_NEARLY_CERTAIN")]
4658    NearlyCertain,
4659    /// very certain a type was detected.
4660    #[doc(alias = "GST_TYPE_FIND_MAXIMUM")]
4661    Maximum,
4662    #[doc(hidden)]
4663    __Unknown(i32),
4664}
4665
4666#[doc(hidden)]
4667impl IntoGlib for TypeFindProbability {
4668    type GlibType = ffi::GstTypeFindProbability;
4669
4670    #[inline]
4671    fn into_glib(self) -> ffi::GstTypeFindProbability {
4672        match self {
4673            Self::None => ffi::GST_TYPE_FIND_NONE,
4674            Self::Minimum => ffi::GST_TYPE_FIND_MINIMUM,
4675            Self::Possible => ffi::GST_TYPE_FIND_POSSIBLE,
4676            Self::Likely => ffi::GST_TYPE_FIND_LIKELY,
4677            Self::NearlyCertain => ffi::GST_TYPE_FIND_NEARLY_CERTAIN,
4678            Self::Maximum => ffi::GST_TYPE_FIND_MAXIMUM,
4679            Self::__Unknown(value) => value,
4680        }
4681    }
4682}
4683
4684#[doc(hidden)]
4685impl FromGlib<ffi::GstTypeFindProbability> for TypeFindProbability {
4686    #[inline]
4687    unsafe fn from_glib(value: ffi::GstTypeFindProbability) -> Self {
4688        skip_assert_initialized!();
4689
4690        match value {
4691            ffi::GST_TYPE_FIND_NONE => Self::None,
4692            ffi::GST_TYPE_FIND_MINIMUM => Self::Minimum,
4693            ffi::GST_TYPE_FIND_POSSIBLE => Self::Possible,
4694            ffi::GST_TYPE_FIND_LIKELY => Self::Likely,
4695            ffi::GST_TYPE_FIND_NEARLY_CERTAIN => Self::NearlyCertain,
4696            ffi::GST_TYPE_FIND_MAXIMUM => Self::Maximum,
4697            value => Self::__Unknown(value),
4698        }
4699    }
4700}
4701
4702impl StaticType for TypeFindProbability {
4703    #[inline]
4704    #[doc(alias = "gst_type_find_probability_get_type")]
4705    fn static_type() -> glib::Type {
4706        unsafe { from_glib(ffi::gst_type_find_probability_get_type()) }
4707    }
4708}
4709
4710impl glib::HasParamSpec for TypeFindProbability {
4711    type ParamSpec = glib::ParamSpecEnum;
4712    type SetValue = Self;
4713    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
4714
4715    fn param_spec_builder() -> Self::BuilderFn {
4716        Self::ParamSpec::builder_with_default
4717    }
4718}
4719
4720impl glib::value::ValueType for TypeFindProbability {
4721    type Type = Self;
4722}
4723
4724unsafe impl<'a> glib::value::FromValue<'a> for TypeFindProbability {
4725    type Checker = glib::value::GenericValueTypeChecker<Self>;
4726
4727    #[inline]
4728    unsafe fn from_value(value: &'a glib::Value) -> Self {
4729        skip_assert_initialized!();
4730        from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0))
4731    }
4732}
4733
4734impl ToValue for TypeFindProbability {
4735    #[inline]
4736    fn to_value(&self) -> glib::Value {
4737        let mut value = glib::Value::for_value_type::<Self>();
4738        unsafe {
4739            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
4740        }
4741        value
4742    }
4743
4744    #[inline]
4745    fn value_type(&self) -> glib::Type {
4746        Self::static_type()
4747    }
4748}
4749
4750impl From<TypeFindProbability> for glib::Value {
4751    #[inline]
4752    fn from(v: TypeFindProbability) -> Self {
4753        skip_assert_initialized!();
4754        ToValue::to_value(&v)
4755    }
4756}
4757
4758/// Different URI-related errors that can occur.
4759#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
4760#[non_exhaustive]
4761#[doc(alias = "GstURIError")]
4762pub enum URIError {
4763    /// The protocol is not supported
4764    #[doc(alias = "GST_URI_ERROR_UNSUPPORTED_PROTOCOL")]
4765    UnsupportedProtocol,
4766    /// There was a problem with the URI
4767    #[doc(alias = "GST_URI_ERROR_BAD_URI")]
4768    BadUri,
4769    /// Could not set or change the URI because the
4770    ///  URI handler was in a state where that is not possible or not permitted
4771    #[doc(alias = "GST_URI_ERROR_BAD_STATE")]
4772    BadState,
4773    /// There was a problem with the entity that
4774    ///  the URI references
4775    #[doc(alias = "GST_URI_ERROR_BAD_REFERENCE")]
4776    BadReference,
4777    #[doc(hidden)]
4778    __Unknown(i32),
4779}
4780
4781#[doc(hidden)]
4782impl IntoGlib for URIError {
4783    type GlibType = ffi::GstURIError;
4784
4785    #[inline]
4786    fn into_glib(self) -> ffi::GstURIError {
4787        match self {
4788            Self::UnsupportedProtocol => ffi::GST_URI_ERROR_UNSUPPORTED_PROTOCOL,
4789            Self::BadUri => ffi::GST_URI_ERROR_BAD_URI,
4790            Self::BadState => ffi::GST_URI_ERROR_BAD_STATE,
4791            Self::BadReference => ffi::GST_URI_ERROR_BAD_REFERENCE,
4792            Self::__Unknown(value) => value,
4793        }
4794    }
4795}
4796
4797#[doc(hidden)]
4798impl FromGlib<ffi::GstURIError> for URIError {
4799    #[inline]
4800    unsafe fn from_glib(value: ffi::GstURIError) -> Self {
4801        skip_assert_initialized!();
4802
4803        match value {
4804            ffi::GST_URI_ERROR_UNSUPPORTED_PROTOCOL => Self::UnsupportedProtocol,
4805            ffi::GST_URI_ERROR_BAD_URI => Self::BadUri,
4806            ffi::GST_URI_ERROR_BAD_STATE => Self::BadState,
4807            ffi::GST_URI_ERROR_BAD_REFERENCE => Self::BadReference,
4808            value => Self::__Unknown(value),
4809        }
4810    }
4811}
4812
4813impl glib::error::ErrorDomain for URIError {
4814    #[inline]
4815    fn domain() -> glib::Quark {
4816        skip_assert_initialized!();
4817
4818        unsafe { from_glib(ffi::gst_uri_error_quark()) }
4819    }
4820
4821    #[inline]
4822    fn code(self) -> i32 {
4823        self.into_glib()
4824    }
4825
4826    #[inline]
4827    #[allow(clippy::match_single_binding)]
4828    fn from(code: i32) -> Option<Self> {
4829        skip_assert_initialized!();
4830        match unsafe { from_glib(code) } {
4831            value => Some(value),
4832        }
4833    }
4834}
4835
4836impl StaticType for URIError {
4837    #[inline]
4838    #[doc(alias = "gst_uri_error_get_type")]
4839    fn static_type() -> glib::Type {
4840        unsafe { from_glib(ffi::gst_uri_error_get_type()) }
4841    }
4842}
4843
4844impl glib::HasParamSpec for URIError {
4845    type ParamSpec = glib::ParamSpecEnum;
4846    type SetValue = Self;
4847    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
4848
4849    fn param_spec_builder() -> Self::BuilderFn {
4850        Self::ParamSpec::builder_with_default
4851    }
4852}
4853
4854impl glib::value::ValueType for URIError {
4855    type Type = Self;
4856}
4857
4858unsafe impl<'a> glib::value::FromValue<'a> for URIError {
4859    type Checker = glib::value::GenericValueTypeChecker<Self>;
4860
4861    #[inline]
4862    unsafe fn from_value(value: &'a glib::Value) -> Self {
4863        skip_assert_initialized!();
4864        from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0))
4865    }
4866}
4867
4868impl ToValue for URIError {
4869    #[inline]
4870    fn to_value(&self) -> glib::Value {
4871        let mut value = glib::Value::for_value_type::<Self>();
4872        unsafe {
4873            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
4874        }
4875        value
4876    }
4877
4878    #[inline]
4879    fn value_type(&self) -> glib::Type {
4880        Self::static_type()
4881    }
4882}
4883
4884impl From<URIError> for glib::Value {
4885    #[inline]
4886    fn from(v: URIError) -> Self {
4887        skip_assert_initialized!();
4888        ToValue::to_value(&v)
4889    }
4890}
4891
4892/// The different types of URI direction.
4893#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
4894#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy)]
4895#[repr(i32)]
4896#[doc(alias = "GstURIType")]
4897pub enum URIType {
4898    /// The URI direction is unknown
4899    #[doc(alias = "GST_URI_UNKNOWN")]
4900    Unknown = ffi::GST_URI_UNKNOWN,
4901    /// The URI is a consumer.
4902    #[doc(alias = "GST_URI_SINK")]
4903    Sink = ffi::GST_URI_SINK,
4904    /// The URI is a producer.
4905    #[doc(alias = "GST_URI_SRC")]
4906    Src = ffi::GST_URI_SRC,
4907}
4908
4909#[doc(hidden)]
4910impl IntoGlib for URIType {
4911    type GlibType = ffi::GstURIType;
4912
4913    #[inline]
4914    fn into_glib(self) -> ffi::GstURIType {
4915        self as ffi::GstURIType
4916    }
4917}
4918
4919#[doc(hidden)]
4920impl FromGlib<ffi::GstURIType> for URIType {
4921    #[inline]
4922    unsafe fn from_glib(value: ffi::GstURIType) -> Self {
4923        skip_assert_initialized!();
4924
4925        debug_assert!([ffi::GST_URI_UNKNOWN, ffi::GST_URI_SINK, ffi::GST_URI_SRC].contains(&value));
4926        std::mem::transmute(value)
4927    }
4928}
4929
4930impl StaticType for URIType {
4931    #[inline]
4932    #[doc(alias = "gst_uri_type_get_type")]
4933    fn static_type() -> glib::Type {
4934        unsafe { from_glib(ffi::gst_uri_type_get_type()) }
4935    }
4936}
4937
4938impl glib::HasParamSpec for URIType {
4939    type ParamSpec = glib::ParamSpecEnum;
4940    type SetValue = Self;
4941    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
4942
4943    fn param_spec_builder() -> Self::BuilderFn {
4944        Self::ParamSpec::builder_with_default
4945    }
4946}
4947
4948impl glib::value::ValueType for URIType {
4949    type Type = Self;
4950}
4951
4952unsafe impl<'a> glib::value::FromValue<'a> for URIType {
4953    type Checker = glib::value::GenericValueTypeChecker<Self>;
4954
4955    #[inline]
4956    unsafe fn from_value(value: &'a glib::Value) -> Self {
4957        skip_assert_initialized!();
4958        from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0))
4959    }
4960}
4961
4962impl ToValue for URIType {
4963    #[inline]
4964    fn to_value(&self) -> glib::Value {
4965        let mut value = glib::Value::for_value_type::<Self>();
4966        unsafe {
4967            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
4968        }
4969        value
4970    }
4971
4972    #[inline]
4973    fn value_type(&self) -> glib::Type {
4974        Self::static_type()
4975    }
4976}
4977
4978impl From<URIType> for glib::Value {
4979    #[inline]
4980    fn from(v: URIType) -> Self {
4981        skip_assert_initialized!();
4982        ToValue::to_value(&v)
4983    }
4984}