Skip to main content

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