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    #[doc(hidden)]
2130    __Unknown(i32),
2131}
2132
2133#[doc(hidden)]
2134impl IntoGlib for ParseError {
2135    type GlibType = ffi::GstParseError;
2136
2137    #[inline]
2138    fn into_glib(self) -> ffi::GstParseError {
2139        match self {
2140            Self::Syntax => ffi::GST_PARSE_ERROR_SYNTAX,
2141            Self::NoSuchElement => ffi::GST_PARSE_ERROR_NO_SUCH_ELEMENT,
2142            Self::NoSuchProperty => ffi::GST_PARSE_ERROR_NO_SUCH_PROPERTY,
2143            Self::Link => ffi::GST_PARSE_ERROR_LINK,
2144            Self::CouldNotSetProperty => ffi::GST_PARSE_ERROR_COULD_NOT_SET_PROPERTY,
2145            Self::EmptyBin => ffi::GST_PARSE_ERROR_EMPTY_BIN,
2146            Self::Empty => ffi::GST_PARSE_ERROR_EMPTY,
2147            Self::DelayedLink => ffi::GST_PARSE_ERROR_DELAYED_LINK,
2148            Self::__Unknown(value) => value,
2149        }
2150    }
2151}
2152
2153#[doc(hidden)]
2154impl FromGlib<ffi::GstParseError> for ParseError {
2155    #[inline]
2156    unsafe fn from_glib(value: ffi::GstParseError) -> Self {
2157        skip_assert_initialized!();
2158
2159        match value {
2160            ffi::GST_PARSE_ERROR_SYNTAX => Self::Syntax,
2161            ffi::GST_PARSE_ERROR_NO_SUCH_ELEMENT => Self::NoSuchElement,
2162            ffi::GST_PARSE_ERROR_NO_SUCH_PROPERTY => Self::NoSuchProperty,
2163            ffi::GST_PARSE_ERROR_LINK => Self::Link,
2164            ffi::GST_PARSE_ERROR_COULD_NOT_SET_PROPERTY => Self::CouldNotSetProperty,
2165            ffi::GST_PARSE_ERROR_EMPTY_BIN => Self::EmptyBin,
2166            ffi::GST_PARSE_ERROR_EMPTY => Self::Empty,
2167            ffi::GST_PARSE_ERROR_DELAYED_LINK => Self::DelayedLink,
2168            value => Self::__Unknown(value),
2169        }
2170    }
2171}
2172
2173impl glib::error::ErrorDomain for ParseError {
2174    #[inline]
2175    fn domain() -> glib::Quark {
2176        skip_assert_initialized!();
2177
2178        unsafe { from_glib(ffi::gst_parse_error_quark()) }
2179    }
2180
2181    #[inline]
2182    fn code(self) -> i32 {
2183        self.into_glib()
2184    }
2185
2186    #[inline]
2187    #[allow(clippy::match_single_binding)]
2188    fn from(code: i32) -> Option<Self> {
2189        skip_assert_initialized!();
2190        match unsafe { from_glib(code) } {
2191            value => Some(value),
2192        }
2193    }
2194}
2195
2196impl StaticType for ParseError {
2197    #[inline]
2198    #[doc(alias = "gst_parse_error_get_type")]
2199    fn static_type() -> glib::Type {
2200        unsafe { from_glib(ffi::gst_parse_error_get_type()) }
2201    }
2202}
2203
2204impl glib::HasParamSpec for ParseError {
2205    type ParamSpec = glib::ParamSpecEnum;
2206    type SetValue = Self;
2207    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
2208
2209    fn param_spec_builder() -> Self::BuilderFn {
2210        Self::ParamSpec::builder_with_default
2211    }
2212}
2213
2214impl glib::value::ValueType for ParseError {
2215    type Type = Self;
2216}
2217
2218unsafe impl<'a> glib::value::FromValue<'a> for ParseError {
2219    type Checker = glib::value::GenericValueTypeChecker<Self>;
2220
2221    #[inline]
2222    unsafe fn from_value(value: &'a glib::Value) -> Self {
2223        skip_assert_initialized!();
2224        unsafe { from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) }
2225    }
2226}
2227
2228impl ToValue for ParseError {
2229    #[inline]
2230    fn to_value(&self) -> glib::Value {
2231        let mut value = glib::Value::for_value_type::<Self>();
2232        unsafe {
2233            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
2234        }
2235        value
2236    }
2237
2238    #[inline]
2239    fn value_type(&self) -> glib::Type {
2240        Self::static_type()
2241    }
2242}
2243
2244impl From<ParseError> for glib::Value {
2245    #[inline]
2246    fn from(v: ParseError) -> Self {
2247        skip_assert_initialized!();
2248        ToValue::to_value(&v)
2249    }
2250}
2251
2252/// The plugin loading errors
2253#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
2254#[non_exhaustive]
2255#[doc(alias = "GstPluginError")]
2256pub enum PluginError {
2257    /// The plugin could not be loaded
2258    #[doc(alias = "GST_PLUGIN_ERROR_MODULE")]
2259    Module,
2260    /// The plugin has unresolved dependencies
2261    #[doc(alias = "GST_PLUGIN_ERROR_DEPENDENCIES")]
2262    Dependencies,
2263    /// The plugin has already be loaded from a different file
2264    #[doc(alias = "GST_PLUGIN_ERROR_NAME_MISMATCH")]
2265    NameMismatch,
2266    #[doc(hidden)]
2267    __Unknown(i32),
2268}
2269
2270#[doc(hidden)]
2271impl IntoGlib for PluginError {
2272    type GlibType = ffi::GstPluginError;
2273
2274    #[inline]
2275    fn into_glib(self) -> ffi::GstPluginError {
2276        match self {
2277            Self::Module => ffi::GST_PLUGIN_ERROR_MODULE,
2278            Self::Dependencies => ffi::GST_PLUGIN_ERROR_DEPENDENCIES,
2279            Self::NameMismatch => ffi::GST_PLUGIN_ERROR_NAME_MISMATCH,
2280            Self::__Unknown(value) => value,
2281        }
2282    }
2283}
2284
2285#[doc(hidden)]
2286impl FromGlib<ffi::GstPluginError> for PluginError {
2287    #[inline]
2288    unsafe fn from_glib(value: ffi::GstPluginError) -> Self {
2289        skip_assert_initialized!();
2290
2291        match value {
2292            ffi::GST_PLUGIN_ERROR_MODULE => Self::Module,
2293            ffi::GST_PLUGIN_ERROR_DEPENDENCIES => Self::Dependencies,
2294            ffi::GST_PLUGIN_ERROR_NAME_MISMATCH => Self::NameMismatch,
2295            value => Self::__Unknown(value),
2296        }
2297    }
2298}
2299
2300impl glib::error::ErrorDomain for PluginError {
2301    #[inline]
2302    fn domain() -> glib::Quark {
2303        skip_assert_initialized!();
2304
2305        unsafe { from_glib(ffi::gst_plugin_error_quark()) }
2306    }
2307
2308    #[inline]
2309    fn code(self) -> i32 {
2310        self.into_glib()
2311    }
2312
2313    #[inline]
2314    #[allow(clippy::match_single_binding)]
2315    fn from(code: i32) -> Option<Self> {
2316        skip_assert_initialized!();
2317        match unsafe { from_glib(code) } {
2318            value => Some(value),
2319        }
2320    }
2321}
2322
2323impl StaticType for PluginError {
2324    #[inline]
2325    #[doc(alias = "gst_plugin_error_get_type")]
2326    fn static_type() -> glib::Type {
2327        unsafe { from_glib(ffi::gst_plugin_error_get_type()) }
2328    }
2329}
2330
2331impl glib::HasParamSpec for PluginError {
2332    type ParamSpec = glib::ParamSpecEnum;
2333    type SetValue = Self;
2334    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
2335
2336    fn param_spec_builder() -> Self::BuilderFn {
2337        Self::ParamSpec::builder_with_default
2338    }
2339}
2340
2341impl glib::value::ValueType for PluginError {
2342    type Type = Self;
2343}
2344
2345unsafe impl<'a> glib::value::FromValue<'a> for PluginError {
2346    type Checker = glib::value::GenericValueTypeChecker<Self>;
2347
2348    #[inline]
2349    unsafe fn from_value(value: &'a glib::Value) -> Self {
2350        skip_assert_initialized!();
2351        unsafe { from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) }
2352    }
2353}
2354
2355impl ToValue for PluginError {
2356    #[inline]
2357    fn to_value(&self) -> glib::Value {
2358        let mut value = glib::Value::for_value_type::<Self>();
2359        unsafe {
2360            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
2361        }
2362        value
2363    }
2364
2365    #[inline]
2366    fn value_type(&self) -> glib::Type {
2367        Self::static_type()
2368    }
2369}
2370
2371impl From<PluginError> for glib::Value {
2372    #[inline]
2373    fn from(v: PluginError) -> Self {
2374        skip_assert_initialized!();
2375        ToValue::to_value(&v)
2376    }
2377}
2378
2379/// The type of a `GST_MESSAGE_PROGRESS`. The progress messages inform the
2380/// application of the status of asynchronous tasks.
2381#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
2382#[non_exhaustive]
2383#[doc(alias = "GstProgressType")]
2384pub enum ProgressType {
2385    /// A new task started.
2386    #[doc(alias = "GST_PROGRESS_TYPE_START")]
2387    Start,
2388    /// A task completed and a new one continues.
2389    #[doc(alias = "GST_PROGRESS_TYPE_CONTINUE")]
2390    Continue,
2391    /// A task completed.
2392    #[doc(alias = "GST_PROGRESS_TYPE_COMPLETE")]
2393    Complete,
2394    /// A task was canceled.
2395    #[doc(alias = "GST_PROGRESS_TYPE_CANCELED")]
2396    Canceled,
2397    /// A task caused an error. An error message is also
2398    ///  posted on the bus.
2399    #[doc(alias = "GST_PROGRESS_TYPE_ERROR")]
2400    Error,
2401    #[doc(hidden)]
2402    __Unknown(i32),
2403}
2404
2405#[doc(hidden)]
2406impl IntoGlib for ProgressType {
2407    type GlibType = ffi::GstProgressType;
2408
2409    #[inline]
2410    fn into_glib(self) -> ffi::GstProgressType {
2411        match self {
2412            Self::Start => ffi::GST_PROGRESS_TYPE_START,
2413            Self::Continue => ffi::GST_PROGRESS_TYPE_CONTINUE,
2414            Self::Complete => ffi::GST_PROGRESS_TYPE_COMPLETE,
2415            Self::Canceled => ffi::GST_PROGRESS_TYPE_CANCELED,
2416            Self::Error => ffi::GST_PROGRESS_TYPE_ERROR,
2417            Self::__Unknown(value) => value,
2418        }
2419    }
2420}
2421
2422#[doc(hidden)]
2423impl FromGlib<ffi::GstProgressType> for ProgressType {
2424    #[inline]
2425    unsafe fn from_glib(value: ffi::GstProgressType) -> Self {
2426        skip_assert_initialized!();
2427
2428        match value {
2429            ffi::GST_PROGRESS_TYPE_START => Self::Start,
2430            ffi::GST_PROGRESS_TYPE_CONTINUE => Self::Continue,
2431            ffi::GST_PROGRESS_TYPE_COMPLETE => Self::Complete,
2432            ffi::GST_PROGRESS_TYPE_CANCELED => Self::Canceled,
2433            ffi::GST_PROGRESS_TYPE_ERROR => Self::Error,
2434            value => Self::__Unknown(value),
2435        }
2436    }
2437}
2438
2439impl StaticType for ProgressType {
2440    #[inline]
2441    #[doc(alias = "gst_progress_type_get_type")]
2442    fn static_type() -> glib::Type {
2443        unsafe { from_glib(ffi::gst_progress_type_get_type()) }
2444    }
2445}
2446
2447impl glib::HasParamSpec for ProgressType {
2448    type ParamSpec = glib::ParamSpecEnum;
2449    type SetValue = Self;
2450    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
2451
2452    fn param_spec_builder() -> Self::BuilderFn {
2453        Self::ParamSpec::builder_with_default
2454    }
2455}
2456
2457impl glib::value::ValueType for ProgressType {
2458    type Type = Self;
2459}
2460
2461unsafe impl<'a> glib::value::FromValue<'a> for ProgressType {
2462    type Checker = glib::value::GenericValueTypeChecker<Self>;
2463
2464    #[inline]
2465    unsafe fn from_value(value: &'a glib::Value) -> Self {
2466        skip_assert_initialized!();
2467        unsafe { from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) }
2468    }
2469}
2470
2471impl ToValue for ProgressType {
2472    #[inline]
2473    fn to_value(&self) -> glib::Value {
2474        let mut value = glib::Value::for_value_type::<Self>();
2475        unsafe {
2476            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
2477        }
2478        value
2479    }
2480
2481    #[inline]
2482    fn value_type(&self) -> glib::Type {
2483        Self::static_type()
2484    }
2485}
2486
2487impl From<ProgressType> for glib::Value {
2488    #[inline]
2489    fn from(v: ProgressType) -> Self {
2490        skip_assert_initialized!();
2491        ToValue::to_value(&v)
2492    }
2493}
2494
2495/// The result of a [`Promise`][crate::Promise]
2496#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
2497#[non_exhaustive]
2498#[doc(alias = "GstPromiseResult")]
2499pub enum PromiseResult {
2500    /// Initial state. Waiting for transition to any
2501    ///     other state.
2502    #[doc(alias = "GST_PROMISE_RESULT_PENDING")]
2503    Pending,
2504    /// Interrupted by the consumer as it doesn't
2505    ///     want the value anymore.
2506    #[doc(alias = "GST_PROMISE_RESULT_INTERRUPTED")]
2507    Interrupted,
2508    /// A producer marked a reply
2509    #[doc(alias = "GST_PROMISE_RESULT_REPLIED")]
2510    Replied,
2511    /// The promise expired (the carrying object
2512    ///     lost all refs) and the promise will never be fulfilled.
2513    #[doc(alias = "GST_PROMISE_RESULT_EXPIRED")]
2514    Expired,
2515    #[doc(hidden)]
2516    __Unknown(i32),
2517}
2518
2519#[doc(hidden)]
2520impl IntoGlib for PromiseResult {
2521    type GlibType = ffi::GstPromiseResult;
2522
2523    #[inline]
2524    fn into_glib(self) -> ffi::GstPromiseResult {
2525        match self {
2526            Self::Pending => ffi::GST_PROMISE_RESULT_PENDING,
2527            Self::Interrupted => ffi::GST_PROMISE_RESULT_INTERRUPTED,
2528            Self::Replied => ffi::GST_PROMISE_RESULT_REPLIED,
2529            Self::Expired => ffi::GST_PROMISE_RESULT_EXPIRED,
2530            Self::__Unknown(value) => value,
2531        }
2532    }
2533}
2534
2535#[doc(hidden)]
2536impl FromGlib<ffi::GstPromiseResult> for PromiseResult {
2537    #[inline]
2538    unsafe fn from_glib(value: ffi::GstPromiseResult) -> Self {
2539        skip_assert_initialized!();
2540
2541        match value {
2542            ffi::GST_PROMISE_RESULT_PENDING => Self::Pending,
2543            ffi::GST_PROMISE_RESULT_INTERRUPTED => Self::Interrupted,
2544            ffi::GST_PROMISE_RESULT_REPLIED => Self::Replied,
2545            ffi::GST_PROMISE_RESULT_EXPIRED => Self::Expired,
2546            value => Self::__Unknown(value),
2547        }
2548    }
2549}
2550
2551impl StaticType for PromiseResult {
2552    #[inline]
2553    #[doc(alias = "gst_promise_result_get_type")]
2554    fn static_type() -> glib::Type {
2555        unsafe { from_glib(ffi::gst_promise_result_get_type()) }
2556    }
2557}
2558
2559impl glib::HasParamSpec for PromiseResult {
2560    type ParamSpec = glib::ParamSpecEnum;
2561    type SetValue = Self;
2562    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
2563
2564    fn param_spec_builder() -> Self::BuilderFn {
2565        Self::ParamSpec::builder_with_default
2566    }
2567}
2568
2569impl glib::value::ValueType for PromiseResult {
2570    type Type = Self;
2571}
2572
2573unsafe impl<'a> glib::value::FromValue<'a> for PromiseResult {
2574    type Checker = glib::value::GenericValueTypeChecker<Self>;
2575
2576    #[inline]
2577    unsafe fn from_value(value: &'a glib::Value) -> Self {
2578        skip_assert_initialized!();
2579        unsafe { from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) }
2580    }
2581}
2582
2583impl ToValue for PromiseResult {
2584    #[inline]
2585    fn to_value(&self) -> glib::Value {
2586        let mut value = glib::Value::for_value_type::<Self>();
2587        unsafe {
2588            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
2589        }
2590        value
2591    }
2592
2593    #[inline]
2594    fn value_type(&self) -> glib::Type {
2595        Self::static_type()
2596    }
2597}
2598
2599impl From<PromiseResult> for glib::Value {
2600    #[inline]
2601    fn from(v: PromiseResult) -> Self {
2602        skip_assert_initialized!();
2603        ToValue::to_value(&v)
2604    }
2605}
2606
2607/// The different types of QoS events that can be given to the
2608/// `gst_event_new_qos()` method.
2609#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
2610#[non_exhaustive]
2611#[doc(alias = "GstQOSType")]
2612pub enum QOSType {
2613    /// The QoS event type that is produced when upstream
2614    ///  elements are producing data too quickly and the element can't keep up
2615    ///  processing the data. Upstream should reduce their production rate. This
2616    ///  type is also used when buffers arrive early or in time.
2617    #[doc(alias = "GST_QOS_TYPE_OVERFLOW")]
2618    Overflow,
2619    /// The QoS event type that is produced when upstream
2620    ///  elements are producing data too slowly and need to speed up their
2621    ///  production rate.
2622    #[doc(alias = "GST_QOS_TYPE_UNDERFLOW")]
2623    Underflow,
2624    /// The QoS event type that is produced when the
2625    ///  application enabled throttling to limit the data rate.
2626    #[doc(alias = "GST_QOS_TYPE_THROTTLE")]
2627    Throttle,
2628    #[doc(hidden)]
2629    __Unknown(i32),
2630}
2631
2632#[doc(hidden)]
2633impl IntoGlib for QOSType {
2634    type GlibType = ffi::GstQOSType;
2635
2636    #[inline]
2637    fn into_glib(self) -> ffi::GstQOSType {
2638        match self {
2639            Self::Overflow => ffi::GST_QOS_TYPE_OVERFLOW,
2640            Self::Underflow => ffi::GST_QOS_TYPE_UNDERFLOW,
2641            Self::Throttle => ffi::GST_QOS_TYPE_THROTTLE,
2642            Self::__Unknown(value) => value,
2643        }
2644    }
2645}
2646
2647#[doc(hidden)]
2648impl FromGlib<ffi::GstQOSType> for QOSType {
2649    #[inline]
2650    unsafe fn from_glib(value: ffi::GstQOSType) -> Self {
2651        skip_assert_initialized!();
2652
2653        match value {
2654            ffi::GST_QOS_TYPE_OVERFLOW => Self::Overflow,
2655            ffi::GST_QOS_TYPE_UNDERFLOW => Self::Underflow,
2656            ffi::GST_QOS_TYPE_THROTTLE => Self::Throttle,
2657            value => Self::__Unknown(value),
2658        }
2659    }
2660}
2661
2662impl StaticType for QOSType {
2663    #[inline]
2664    #[doc(alias = "gst_qos_type_get_type")]
2665    fn static_type() -> glib::Type {
2666        unsafe { from_glib(ffi::gst_qos_type_get_type()) }
2667    }
2668}
2669
2670impl glib::HasParamSpec for QOSType {
2671    type ParamSpec = glib::ParamSpecEnum;
2672    type SetValue = Self;
2673    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
2674
2675    fn param_spec_builder() -> Self::BuilderFn {
2676        Self::ParamSpec::builder_with_default
2677    }
2678}
2679
2680impl glib::value::ValueType for QOSType {
2681    type Type = Self;
2682}
2683
2684unsafe impl<'a> glib::value::FromValue<'a> for QOSType {
2685    type Checker = glib::value::GenericValueTypeChecker<Self>;
2686
2687    #[inline]
2688    unsafe fn from_value(value: &'a glib::Value) -> Self {
2689        skip_assert_initialized!();
2690        unsafe { from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) }
2691    }
2692}
2693
2694impl ToValue for QOSType {
2695    #[inline]
2696    fn to_value(&self) -> glib::Value {
2697        let mut value = glib::Value::for_value_type::<Self>();
2698        unsafe {
2699            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
2700        }
2701        value
2702    }
2703
2704    #[inline]
2705    fn value_type(&self) -> glib::Type {
2706        Self::static_type()
2707    }
2708}
2709
2710impl From<QOSType> for glib::Value {
2711    #[inline]
2712    fn from(v: QOSType) -> Self {
2713        skip_assert_initialized!();
2714        ToValue::to_value(&v)
2715    }
2716}
2717
2718/// Standard predefined Query types
2719#[derive(Debug, PartialEq, Eq, Hash, Clone, Copy)]
2720#[non_exhaustive]
2721#[doc(alias = "GstQueryType")]
2722pub enum QueryType {
2723    /// unknown query type
2724    #[doc(alias = "GST_QUERY_UNKNOWN")]
2725    Unknown,
2726    /// current position in stream
2727    #[doc(alias = "GST_QUERY_POSITION")]
2728    Position,
2729    /// total duration of the stream
2730    #[doc(alias = "GST_QUERY_DURATION")]
2731    Duration,
2732    /// latency of stream
2733    #[doc(alias = "GST_QUERY_LATENCY")]
2734    Latency,
2735    /// current jitter of stream
2736    #[doc(alias = "GST_QUERY_JITTER")]
2737    Jitter,
2738    /// current rate of the stream
2739    #[doc(alias = "GST_QUERY_RATE")]
2740    Rate,
2741    /// seeking capabilities
2742    #[doc(alias = "GST_QUERY_SEEKING")]
2743    Seeking,
2744    /// segment start/stop positions
2745    #[doc(alias = "GST_QUERY_SEGMENT")]
2746    Segment,
2747    /// convert values between formats
2748    #[doc(alias = "GST_QUERY_CONVERT")]
2749    Convert,
2750    /// query supported formats for convert
2751    #[doc(alias = "GST_QUERY_FORMATS")]
2752    Formats,
2753    /// query available media for efficient seeking.
2754    #[doc(alias = "GST_QUERY_BUFFERING")]
2755    Buffering,
2756    /// a custom application or element defined query.
2757    #[doc(alias = "GST_QUERY_CUSTOM")]
2758    Custom,
2759    /// query the URI of the source or sink.
2760    #[doc(alias = "GST_QUERY_URI")]
2761    Uri,
2762    /// the buffer allocation properties
2763    #[doc(alias = "GST_QUERY_ALLOCATION")]
2764    Allocation,
2765    /// the scheduling properties
2766    #[doc(alias = "GST_QUERY_SCHEDULING")]
2767    Scheduling,
2768    /// the accept caps query
2769    #[doc(alias = "GST_QUERY_ACCEPT_CAPS")]
2770    AcceptCaps,
2771    /// the caps query
2772    #[doc(alias = "GST_QUERY_CAPS")]
2773    Caps,
2774    /// wait till all serialized data is consumed downstream
2775    #[doc(alias = "GST_QUERY_DRAIN")]
2776    Drain,
2777    /// query the pipeline-local context from
2778    ///  downstream or upstream (since 1.2)
2779    #[doc(alias = "GST_QUERY_CONTEXT")]
2780    Context,
2781    /// the bitrate query (since 1.16)
2782    #[doc(alias = "GST_QUERY_BITRATE")]
2783    Bitrate,
2784    /// Query stream selection capability.
2785    #[cfg(feature = "v1_22")]
2786    #[cfg_attr(docsrs, doc(cfg(feature = "v1_22")))]
2787    #[doc(alias = "GST_QUERY_SELECTABLE")]
2788    Selectable,
2789    #[doc(hidden)]
2790    __Unknown(i32),
2791}
2792
2793impl QueryType {
2794    //#[doc(alias = "gst_query_type_get_flags")]
2795    //#[doc(alias = "get_flags")]
2796    //pub fn flags(self) -> /*Ignored*/QueryTypeFlags {
2797    //    unsafe { TODO: call ffi:gst_query_type_get_flags() }
2798    //}
2799
2800    pub fn name<'a>(self) -> &'a GStr {
2801        unsafe {
2802            GStr::from_ptr(
2803                ffi::gst_query_type_get_name(self.into_glib())
2804                    .as_ref()
2805                    .expect("gst_query_type_get_name returned NULL"),
2806            )
2807        }
2808    }
2809
2810    #[doc(alias = "gst_query_type_to_quark")]
2811    pub fn to_quark(self) -> glib::Quark {
2812        assert_initialized_main_thread!();
2813        unsafe { from_glib(ffi::gst_query_type_to_quark(self.into_glib())) }
2814    }
2815}
2816
2817impl std::fmt::Display for QueryType {
2818    #[inline]
2819    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2820        f.write_str(&self.name())
2821    }
2822}
2823
2824#[doc(hidden)]
2825impl IntoGlib for QueryType {
2826    type GlibType = ffi::GstQueryType;
2827
2828    fn into_glib(self) -> ffi::GstQueryType {
2829        match self {
2830            Self::Unknown => ffi::GST_QUERY_UNKNOWN,
2831            Self::Position => ffi::GST_QUERY_POSITION,
2832            Self::Duration => ffi::GST_QUERY_DURATION,
2833            Self::Latency => ffi::GST_QUERY_LATENCY,
2834            Self::Jitter => ffi::GST_QUERY_JITTER,
2835            Self::Rate => ffi::GST_QUERY_RATE,
2836            Self::Seeking => ffi::GST_QUERY_SEEKING,
2837            Self::Segment => ffi::GST_QUERY_SEGMENT,
2838            Self::Convert => ffi::GST_QUERY_CONVERT,
2839            Self::Formats => ffi::GST_QUERY_FORMATS,
2840            Self::Buffering => ffi::GST_QUERY_BUFFERING,
2841            Self::Custom => ffi::GST_QUERY_CUSTOM,
2842            Self::Uri => ffi::GST_QUERY_URI,
2843            Self::Allocation => ffi::GST_QUERY_ALLOCATION,
2844            Self::Scheduling => ffi::GST_QUERY_SCHEDULING,
2845            Self::AcceptCaps => ffi::GST_QUERY_ACCEPT_CAPS,
2846            Self::Caps => ffi::GST_QUERY_CAPS,
2847            Self::Drain => ffi::GST_QUERY_DRAIN,
2848            Self::Context => ffi::GST_QUERY_CONTEXT,
2849            Self::Bitrate => ffi::GST_QUERY_BITRATE,
2850            #[cfg(feature = "v1_22")]
2851            Self::Selectable => ffi::GST_QUERY_SELECTABLE,
2852            Self::__Unknown(value) => value,
2853        }
2854    }
2855}
2856
2857#[doc(hidden)]
2858impl FromGlib<ffi::GstQueryType> for QueryType {
2859    unsafe fn from_glib(value: ffi::GstQueryType) -> Self {
2860        skip_assert_initialized!();
2861
2862        match value {
2863            ffi::GST_QUERY_UNKNOWN => Self::Unknown,
2864            ffi::GST_QUERY_POSITION => Self::Position,
2865            ffi::GST_QUERY_DURATION => Self::Duration,
2866            ffi::GST_QUERY_LATENCY => Self::Latency,
2867            ffi::GST_QUERY_JITTER => Self::Jitter,
2868            ffi::GST_QUERY_RATE => Self::Rate,
2869            ffi::GST_QUERY_SEEKING => Self::Seeking,
2870            ffi::GST_QUERY_SEGMENT => Self::Segment,
2871            ffi::GST_QUERY_CONVERT => Self::Convert,
2872            ffi::GST_QUERY_FORMATS => Self::Formats,
2873            ffi::GST_QUERY_BUFFERING => Self::Buffering,
2874            ffi::GST_QUERY_CUSTOM => Self::Custom,
2875            ffi::GST_QUERY_URI => Self::Uri,
2876            ffi::GST_QUERY_ALLOCATION => Self::Allocation,
2877            ffi::GST_QUERY_SCHEDULING => Self::Scheduling,
2878            ffi::GST_QUERY_ACCEPT_CAPS => Self::AcceptCaps,
2879            ffi::GST_QUERY_CAPS => Self::Caps,
2880            ffi::GST_QUERY_DRAIN => Self::Drain,
2881            ffi::GST_QUERY_CONTEXT => Self::Context,
2882            ffi::GST_QUERY_BITRATE => Self::Bitrate,
2883            #[cfg(feature = "v1_22")]
2884            ffi::GST_QUERY_SELECTABLE => Self::Selectable,
2885            value => Self::__Unknown(value),
2886        }
2887    }
2888}
2889
2890impl StaticType for QueryType {
2891    #[inline]
2892    #[doc(alias = "gst_query_type_get_type")]
2893    fn static_type() -> glib::Type {
2894        unsafe { from_glib(ffi::gst_query_type_get_type()) }
2895    }
2896}
2897
2898impl glib::HasParamSpec for QueryType {
2899    type ParamSpec = glib::ParamSpecEnum;
2900    type SetValue = Self;
2901    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
2902
2903    fn param_spec_builder() -> Self::BuilderFn {
2904        Self::ParamSpec::builder_with_default
2905    }
2906}
2907
2908impl glib::value::ValueType for QueryType {
2909    type Type = Self;
2910}
2911
2912unsafe impl<'a> glib::value::FromValue<'a> for QueryType {
2913    type Checker = glib::value::GenericValueTypeChecker<Self>;
2914
2915    #[inline]
2916    unsafe fn from_value(value: &'a glib::Value) -> Self {
2917        skip_assert_initialized!();
2918        unsafe { from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) }
2919    }
2920}
2921
2922impl ToValue for QueryType {
2923    #[inline]
2924    fn to_value(&self) -> glib::Value {
2925        let mut value = glib::Value::for_value_type::<Self>();
2926        unsafe {
2927            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
2928        }
2929        value
2930    }
2931
2932    #[inline]
2933    fn value_type(&self) -> glib::Type {
2934        Self::static_type()
2935    }
2936}
2937
2938impl From<QueryType> for glib::Value {
2939    #[inline]
2940    fn from(v: QueryType) -> Self {
2941        skip_assert_initialized!();
2942        ToValue::to_value(&v)
2943    }
2944}
2945
2946/// Resource errors are for any resource used by an element:
2947/// memory, files, network connections, process space, ...
2948/// They're typically used by source and sink elements.
2949#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
2950#[non_exhaustive]
2951#[doc(alias = "GstResourceError")]
2952pub enum ResourceError {
2953    /// a general error which doesn't fit in any other
2954    /// category. Make sure you add a custom message to the error call.
2955    #[doc(alias = "GST_RESOURCE_ERROR_FAILED")]
2956    Failed,
2957    /// do not use this except as a placeholder for
2958    /// deciding where to go while developing code.
2959    #[doc(alias = "GST_RESOURCE_ERROR_TOO_LAZY")]
2960    TooLazy,
2961    /// used when the resource could not be found.
2962    #[doc(alias = "GST_RESOURCE_ERROR_NOT_FOUND")]
2963    NotFound,
2964    /// used when resource is busy.
2965    #[doc(alias = "GST_RESOURCE_ERROR_BUSY")]
2966    Busy,
2967    /// used when resource fails to open for reading.
2968    #[doc(alias = "GST_RESOURCE_ERROR_OPEN_READ")]
2969    OpenRead,
2970    /// used when resource fails to open for writing.
2971    #[doc(alias = "GST_RESOURCE_ERROR_OPEN_WRITE")]
2972    OpenWrite,
2973    /// used when resource cannot be opened for
2974    /// both reading and writing, or either (but unspecified which).
2975    #[doc(alias = "GST_RESOURCE_ERROR_OPEN_READ_WRITE")]
2976    OpenReadWrite,
2977    /// used when the resource can't be closed.
2978    #[doc(alias = "GST_RESOURCE_ERROR_CLOSE")]
2979    Close,
2980    /// used when the resource can't be read from.
2981    #[doc(alias = "GST_RESOURCE_ERROR_READ")]
2982    Read,
2983    /// used when the resource can't be written to.
2984    #[doc(alias = "GST_RESOURCE_ERROR_WRITE")]
2985    Write,
2986    /// used when a seek on the resource fails.
2987    #[doc(alias = "GST_RESOURCE_ERROR_SEEK")]
2988    Seek,
2989    /// used when a synchronize on the resource fails.
2990    #[doc(alias = "GST_RESOURCE_ERROR_SYNC")]
2991    Sync,
2992    /// used when settings can't be manipulated on.
2993    #[doc(alias = "GST_RESOURCE_ERROR_SETTINGS")]
2994    Settings,
2995    /// used when the resource has no space left.
2996    #[doc(alias = "GST_RESOURCE_ERROR_NO_SPACE_LEFT")]
2997    NoSpaceLeft,
2998    /// used when the resource can't be opened
2999    ///  due to missing authorization.
3000    ///  (Since: 1.2.4)
3001    #[doc(alias = "GST_RESOURCE_ERROR_NOT_AUTHORIZED")]
3002    NotAuthorized,
3003    #[doc(hidden)]
3004    __Unknown(i32),
3005}
3006
3007#[doc(hidden)]
3008impl IntoGlib for ResourceError {
3009    type GlibType = ffi::GstResourceError;
3010
3011    fn into_glib(self) -> ffi::GstResourceError {
3012        match self {
3013            Self::Failed => ffi::GST_RESOURCE_ERROR_FAILED,
3014            Self::TooLazy => ffi::GST_RESOURCE_ERROR_TOO_LAZY,
3015            Self::NotFound => ffi::GST_RESOURCE_ERROR_NOT_FOUND,
3016            Self::Busy => ffi::GST_RESOURCE_ERROR_BUSY,
3017            Self::OpenRead => ffi::GST_RESOURCE_ERROR_OPEN_READ,
3018            Self::OpenWrite => ffi::GST_RESOURCE_ERROR_OPEN_WRITE,
3019            Self::OpenReadWrite => ffi::GST_RESOURCE_ERROR_OPEN_READ_WRITE,
3020            Self::Close => ffi::GST_RESOURCE_ERROR_CLOSE,
3021            Self::Read => ffi::GST_RESOURCE_ERROR_READ,
3022            Self::Write => ffi::GST_RESOURCE_ERROR_WRITE,
3023            Self::Seek => ffi::GST_RESOURCE_ERROR_SEEK,
3024            Self::Sync => ffi::GST_RESOURCE_ERROR_SYNC,
3025            Self::Settings => ffi::GST_RESOURCE_ERROR_SETTINGS,
3026            Self::NoSpaceLeft => ffi::GST_RESOURCE_ERROR_NO_SPACE_LEFT,
3027            Self::NotAuthorized => ffi::GST_RESOURCE_ERROR_NOT_AUTHORIZED,
3028            Self::__Unknown(value) => value,
3029        }
3030    }
3031}
3032
3033#[doc(hidden)]
3034impl FromGlib<ffi::GstResourceError> for ResourceError {
3035    unsafe fn from_glib(value: ffi::GstResourceError) -> Self {
3036        skip_assert_initialized!();
3037
3038        match value {
3039            ffi::GST_RESOURCE_ERROR_FAILED => Self::Failed,
3040            ffi::GST_RESOURCE_ERROR_TOO_LAZY => Self::TooLazy,
3041            ffi::GST_RESOURCE_ERROR_NOT_FOUND => Self::NotFound,
3042            ffi::GST_RESOURCE_ERROR_BUSY => Self::Busy,
3043            ffi::GST_RESOURCE_ERROR_OPEN_READ => Self::OpenRead,
3044            ffi::GST_RESOURCE_ERROR_OPEN_WRITE => Self::OpenWrite,
3045            ffi::GST_RESOURCE_ERROR_OPEN_READ_WRITE => Self::OpenReadWrite,
3046            ffi::GST_RESOURCE_ERROR_CLOSE => Self::Close,
3047            ffi::GST_RESOURCE_ERROR_READ => Self::Read,
3048            ffi::GST_RESOURCE_ERROR_WRITE => Self::Write,
3049            ffi::GST_RESOURCE_ERROR_SEEK => Self::Seek,
3050            ffi::GST_RESOURCE_ERROR_SYNC => Self::Sync,
3051            ffi::GST_RESOURCE_ERROR_SETTINGS => Self::Settings,
3052            ffi::GST_RESOURCE_ERROR_NO_SPACE_LEFT => Self::NoSpaceLeft,
3053            ffi::GST_RESOURCE_ERROR_NOT_AUTHORIZED => Self::NotAuthorized,
3054            value => Self::__Unknown(value),
3055        }
3056    }
3057}
3058
3059impl glib::error::ErrorDomain for ResourceError {
3060    #[inline]
3061    fn domain() -> glib::Quark {
3062        skip_assert_initialized!();
3063
3064        unsafe { from_glib(ffi::gst_resource_error_quark()) }
3065    }
3066
3067    #[inline]
3068    fn code(self) -> i32 {
3069        self.into_glib()
3070    }
3071
3072    #[inline]
3073    #[allow(clippy::match_single_binding)]
3074    fn from(code: i32) -> Option<Self> {
3075        skip_assert_initialized!();
3076        match unsafe { from_glib(code) } {
3077            Self::__Unknown(_) => Some(Self::Failed),
3078            value => Some(value),
3079        }
3080    }
3081}
3082
3083impl StaticType for ResourceError {
3084    #[inline]
3085    #[doc(alias = "gst_resource_error_get_type")]
3086    fn static_type() -> glib::Type {
3087        unsafe { from_glib(ffi::gst_resource_error_get_type()) }
3088    }
3089}
3090
3091impl glib::HasParamSpec for ResourceError {
3092    type ParamSpec = glib::ParamSpecEnum;
3093    type SetValue = Self;
3094    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
3095
3096    fn param_spec_builder() -> Self::BuilderFn {
3097        Self::ParamSpec::builder_with_default
3098    }
3099}
3100
3101impl glib::value::ValueType for ResourceError {
3102    type Type = Self;
3103}
3104
3105unsafe impl<'a> glib::value::FromValue<'a> for ResourceError {
3106    type Checker = glib::value::GenericValueTypeChecker<Self>;
3107
3108    #[inline]
3109    unsafe fn from_value(value: &'a glib::Value) -> Self {
3110        skip_assert_initialized!();
3111        unsafe { from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) }
3112    }
3113}
3114
3115impl ToValue for ResourceError {
3116    #[inline]
3117    fn to_value(&self) -> glib::Value {
3118        let mut value = glib::Value::for_value_type::<Self>();
3119        unsafe {
3120            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
3121        }
3122        value
3123    }
3124
3125    #[inline]
3126    fn value_type(&self) -> glib::Type {
3127        Self::static_type()
3128    }
3129}
3130
3131impl From<ResourceError> for glib::Value {
3132    #[inline]
3133    fn from(v: ResourceError) -> Self {
3134        skip_assert_initialized!();
3135        ToValue::to_value(&v)
3136    }
3137}
3138
3139/// The different types of seek events. When constructing a seek event with
3140/// `gst_event_new_seek()` or when doing gst_segment_do_seek ().
3141#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
3142#[repr(i32)]
3143#[doc(alias = "GstSeekType")]
3144pub enum SeekType {
3145    /// no change in position is required
3146    #[doc(alias = "GST_SEEK_TYPE_NONE")]
3147    None = ffi::GST_SEEK_TYPE_NONE,
3148    /// absolute position is requested
3149    #[doc(alias = "GST_SEEK_TYPE_SET")]
3150    Set = ffi::GST_SEEK_TYPE_SET,
3151    /// relative position to duration is requested
3152    #[doc(alias = "GST_SEEK_TYPE_END")]
3153    End = ffi::GST_SEEK_TYPE_END,
3154}
3155
3156#[doc(hidden)]
3157impl IntoGlib for SeekType {
3158    type GlibType = ffi::GstSeekType;
3159
3160    #[inline]
3161    fn into_glib(self) -> ffi::GstSeekType {
3162        self as ffi::GstSeekType
3163    }
3164}
3165
3166#[doc(hidden)]
3167impl FromGlib<ffi::GstSeekType> for SeekType {
3168    #[inline]
3169    unsafe fn from_glib(value: ffi::GstSeekType) -> Self {
3170        skip_assert_initialized!();
3171
3172        debug_assert!(
3173            [
3174                ffi::GST_SEEK_TYPE_NONE,
3175                ffi::GST_SEEK_TYPE_SET,
3176                ffi::GST_SEEK_TYPE_END
3177            ]
3178            .contains(&value)
3179        );
3180        unsafe { std::mem::transmute(value) }
3181    }
3182}
3183
3184impl StaticType for SeekType {
3185    #[inline]
3186    #[doc(alias = "gst_seek_type_get_type")]
3187    fn static_type() -> glib::Type {
3188        unsafe { from_glib(ffi::gst_seek_type_get_type()) }
3189    }
3190}
3191
3192impl glib::HasParamSpec for SeekType {
3193    type ParamSpec = glib::ParamSpecEnum;
3194    type SetValue = Self;
3195    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
3196
3197    fn param_spec_builder() -> Self::BuilderFn {
3198        Self::ParamSpec::builder_with_default
3199    }
3200}
3201
3202impl glib::value::ValueType for SeekType {
3203    type Type = Self;
3204}
3205
3206unsafe impl<'a> glib::value::FromValue<'a> for SeekType {
3207    type Checker = glib::value::GenericValueTypeChecker<Self>;
3208
3209    #[inline]
3210    unsafe fn from_value(value: &'a glib::Value) -> Self {
3211        skip_assert_initialized!();
3212        unsafe { from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) }
3213    }
3214}
3215
3216impl ToValue for SeekType {
3217    #[inline]
3218    fn to_value(&self) -> glib::Value {
3219        let mut value = glib::Value::for_value_type::<Self>();
3220        unsafe {
3221            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
3222        }
3223        value
3224    }
3225
3226    #[inline]
3227    fn value_type(&self) -> glib::Type {
3228        Self::static_type()
3229    }
3230}
3231
3232impl From<SeekType> for glib::Value {
3233    #[inline]
3234    fn from(v: SeekType) -> Self {
3235        skip_assert_initialized!();
3236        ToValue::to_value(&v)
3237    }
3238}
3239
3240/// The possible states an element can be in. States can be changed using
3241/// [`ElementExt::set_state()`][crate::prelude::ElementExt::set_state()] and checked using [`ElementExt::state()`][crate::prelude::ElementExt::state()].
3242#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
3243#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy)]
3244#[repr(i32)]
3245#[doc(alias = "GstState")]
3246pub enum State {
3247    /// no pending state.
3248    #[doc(alias = "GST_STATE_VOID_PENDING")]
3249    VoidPending = ffi::GST_STATE_VOID_PENDING,
3250    /// the NULL state or initial state of an element.
3251    #[doc(alias = "GST_STATE_NULL")]
3252    Null = ffi::GST_STATE_NULL,
3253    /// the element is ready to go to PAUSED.
3254    #[doc(alias = "GST_STATE_READY")]
3255    Ready = ffi::GST_STATE_READY,
3256    /// the element is PAUSED, it is ready to accept and
3257    ///  process data. Sink elements however only accept one
3258    ///  buffer and then block.
3259    #[doc(alias = "GST_STATE_PAUSED")]
3260    Paused = ffi::GST_STATE_PAUSED,
3261    /// the element is PLAYING, the [`Clock`][crate::Clock] is running and
3262    ///  the data is flowing.
3263    #[doc(alias = "GST_STATE_PLAYING")]
3264    Playing = ffi::GST_STATE_PLAYING,
3265}
3266
3267#[doc(hidden)]
3268impl IntoGlib for State {
3269    type GlibType = ffi::GstState;
3270
3271    #[inline]
3272    fn into_glib(self) -> ffi::GstState {
3273        self as ffi::GstState
3274    }
3275}
3276
3277#[doc(hidden)]
3278impl FromGlib<ffi::GstState> for State {
3279    #[inline]
3280    unsafe fn from_glib(value: ffi::GstState) -> Self {
3281        skip_assert_initialized!();
3282
3283        debug_assert!(
3284            [
3285                ffi::GST_STATE_VOID_PENDING,
3286                ffi::GST_STATE_NULL,
3287                ffi::GST_STATE_READY,
3288                ffi::GST_STATE_PAUSED,
3289                ffi::GST_STATE_PLAYING
3290            ]
3291            .contains(&value)
3292        );
3293        unsafe { std::mem::transmute(value) }
3294    }
3295}
3296
3297impl StaticType for State {
3298    #[inline]
3299    #[doc(alias = "gst_state_get_type")]
3300    fn static_type() -> glib::Type {
3301        unsafe { from_glib(ffi::gst_state_get_type()) }
3302    }
3303}
3304
3305impl glib::HasParamSpec for State {
3306    type ParamSpec = glib::ParamSpecEnum;
3307    type SetValue = Self;
3308    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
3309
3310    fn param_spec_builder() -> Self::BuilderFn {
3311        Self::ParamSpec::builder_with_default
3312    }
3313}
3314
3315impl glib::value::ValueType for State {
3316    type Type = Self;
3317}
3318
3319unsafe impl<'a> glib::value::FromValue<'a> for State {
3320    type Checker = glib::value::GenericValueTypeChecker<Self>;
3321
3322    #[inline]
3323    unsafe fn from_value(value: &'a glib::Value) -> Self {
3324        skip_assert_initialized!();
3325        unsafe { from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) }
3326    }
3327}
3328
3329impl ToValue for State {
3330    #[inline]
3331    fn to_value(&self) -> glib::Value {
3332        let mut value = glib::Value::for_value_type::<Self>();
3333        unsafe {
3334            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
3335        }
3336        value
3337    }
3338
3339    #[inline]
3340    fn value_type(&self) -> glib::Type {
3341        Self::static_type()
3342    }
3343}
3344
3345impl From<State> for glib::Value {
3346    #[inline]
3347    fn from(v: State) -> Self {
3348        skip_assert_initialized!();
3349        ToValue::to_value(&v)
3350    }
3351}
3352
3353/// These are the different state changes an element goes through.
3354/// [`State::Null`][crate::State::Null] &rArr; [`State::Playing`][crate::State::Playing] is called an upwards state change
3355/// and [`State::Playing`][crate::State::Playing] &rArr; [`State::Null`][crate::State::Null] a downwards state change.
3356#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
3357#[repr(i32)]
3358#[doc(alias = "GstStateChange")]
3359pub enum StateChange {
3360    /// state change from NULL to READY.
3361    ///  * The element must check if the resources it needs are available. Device
3362    ///  sinks and -sources typically try to probe the device to constrain their
3363    ///  caps.
3364    ///  * The element opens the device (in case feature need to be probed).
3365    #[doc(alias = "GST_STATE_CHANGE_NULL_TO_READY")]
3366    NullToReady = ffi::GST_STATE_CHANGE_NULL_TO_READY,
3367    /// state change from READY to PAUSED.
3368    ///  * The element pads are activated in order to receive data in PAUSED.
3369    ///  Streaming threads are started.
3370    ///  * Some elements might need to return [`StateChangeReturn::Async`][crate::StateChangeReturn::Async] and complete
3371    ///  the state change when they have enough information. It is a requirement
3372    ///  for sinks to return [`StateChangeReturn::Async`][crate::StateChangeReturn::Async] and complete the state change
3373    ///  when they receive the first buffer or [`EventType::Eos`][crate::EventType::Eos] (preroll).
3374    ///  Sinks also block the dataflow when in PAUSED.
3375    ///  * A pipeline resets the running_time to 0.
3376    ///  * Live sources return [`StateChangeReturn::NoPreroll`][crate::StateChangeReturn::NoPreroll] and don't generate data.
3377    #[doc(alias = "GST_STATE_CHANGE_READY_TO_PAUSED")]
3378    ReadyToPaused = ffi::GST_STATE_CHANGE_READY_TO_PAUSED,
3379    /// state change from PAUSED to PLAYING.
3380    ///  * Most elements ignore this state change.
3381    ///  * The pipeline selects a [`Clock`][crate::Clock] and distributes this to all the children
3382    ///  before setting them to PLAYING. This means that it is only allowed to
3383    ///  synchronize on the [`Clock`][crate::Clock] in the PLAYING state.
3384    ///  * The pipeline uses the [`Clock`][crate::Clock] and the running_time to calculate the
3385    ///  base_time. The base_time is distributed to all children when performing
3386    ///  the state change.
3387    ///  * Sink elements stop blocking on the preroll buffer or event and start
3388    ///  rendering the data.
3389    ///  * Sinks can post `GST_MESSAGE_EOS` in the PLAYING state. It is not allowed
3390    ///  to post `GST_MESSAGE_EOS` when not in the PLAYING state.
3391    ///  * While streaming in PAUSED or PLAYING elements can create and remove
3392    ///  sometimes pads.
3393    ///  * Live sources start generating data and return [`StateChangeReturn::Success`][crate::StateChangeReturn::Success].
3394    #[doc(alias = "GST_STATE_CHANGE_PAUSED_TO_PLAYING")]
3395    PausedToPlaying = ffi::GST_STATE_CHANGE_PAUSED_TO_PLAYING,
3396    /// state change from PLAYING to PAUSED.
3397    ///  * Most elements ignore this state change.
3398    ///  * The pipeline calculates the running_time based on the last selected
3399    ///  [`Clock`][crate::Clock] and the base_time. It stores this information to continue
3400    ///  playback when going back to the PLAYING state.
3401    ///  * Sinks unblock any [`Clock`][crate::Clock] wait calls.
3402    ///  * When a sink does not have a pending buffer to play, it returns
3403    ///  [`StateChangeReturn::Async`][crate::StateChangeReturn::Async] from this state change and completes the state
3404    ///  change when it receives a new buffer or an [`EventType::Eos`][crate::EventType::Eos].
3405    ///  * Any queued `GST_MESSAGE_EOS` items are removed since they will be reposted
3406    ///  when going back to the PLAYING state. The EOS messages are queued in
3407    ///  [`Bin`][crate::Bin] containers.
3408    ///  * Live sources stop generating data and return [`StateChangeReturn::NoPreroll`][crate::StateChangeReturn::NoPreroll].
3409    #[doc(alias = "GST_STATE_CHANGE_PLAYING_TO_PAUSED")]
3410    PlayingToPaused = ffi::GST_STATE_CHANGE_PLAYING_TO_PAUSED,
3411    /// state change from PAUSED to READY.
3412    ///  * Sinks unblock any waits in the preroll.
3413    ///  * Elements unblock any waits on devices
3414    ///  * Chain or get_range functions return [`FlowReturn::Flushing`][crate::FlowReturn::Flushing].
3415    ///  * The element pads are deactivated so that streaming becomes impossible and
3416    ///  all streaming threads are stopped.
3417    ///  * The sink forgets all negotiated formats
3418    ///  * Elements remove all sometimes pads
3419    #[doc(alias = "GST_STATE_CHANGE_PAUSED_TO_READY")]
3420    PausedToReady = ffi::GST_STATE_CHANGE_PAUSED_TO_READY,
3421    /// state change from READY to NULL.
3422    ///  * Elements close devices
3423    ///  * Elements reset any internal state.
3424    #[doc(alias = "GST_STATE_CHANGE_READY_TO_NULL")]
3425    ReadyToNull = ffi::GST_STATE_CHANGE_READY_TO_NULL,
3426    /// state change from NULL to NULL. (Since: 1.14)
3427    #[doc(alias = "GST_STATE_CHANGE_NULL_TO_NULL")]
3428    NullToNull = ffi::GST_STATE_CHANGE_NULL_TO_NULL,
3429    /// state change from READY to READY,
3430    /// This might happen when going to PAUSED asynchronously failed, in that case
3431    /// elements should make sure they are in a proper, coherent READY state. (Since: 1.14)
3432    #[doc(alias = "GST_STATE_CHANGE_READY_TO_READY")]
3433    ReadyToReady = ffi::GST_STATE_CHANGE_READY_TO_READY,
3434    /// state change from PAUSED to PAUSED.
3435    /// This might happen when elements were in PLAYING state and 'lost state',
3436    /// they should make sure to go back to real 'PAUSED' state (prerolling for example). (Since: 1.14)
3437    #[doc(alias = "GST_STATE_CHANGE_PAUSED_TO_PAUSED")]
3438    PausedToPaused = ffi::GST_STATE_CHANGE_PAUSED_TO_PAUSED,
3439    /// state change from PLAYING to PLAYING. (Since: 1.14)
3440    #[doc(alias = "GST_STATE_CHANGE_PLAYING_TO_PLAYING")]
3441    PlayingToPlaying = ffi::GST_STATE_CHANGE_PLAYING_TO_PLAYING,
3442}
3443
3444impl StateChange {
3445    pub fn name<'a>(self) -> &'a GStr {
3446        unsafe {
3447            GStr::from_ptr(
3448                ffi::gst_state_change_get_name(self.into_glib())
3449                    .as_ref()
3450                    .expect("gst_state_change_get_name returned NULL"),
3451            )
3452        }
3453    }
3454}
3455
3456impl std::fmt::Display for StateChange {
3457    #[inline]
3458    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3459        f.write_str(&self.name())
3460    }
3461}
3462
3463#[doc(hidden)]
3464impl IntoGlib for StateChange {
3465    type GlibType = ffi::GstStateChange;
3466
3467    #[inline]
3468    fn into_glib(self) -> ffi::GstStateChange {
3469        self as ffi::GstStateChange
3470    }
3471}
3472
3473#[doc(hidden)]
3474impl FromGlib<ffi::GstStateChange> for StateChange {
3475    #[inline]
3476    unsafe fn from_glib(value: ffi::GstStateChange) -> Self {
3477        skip_assert_initialized!();
3478
3479        debug_assert!(
3480            [
3481                ffi::GST_STATE_CHANGE_NULL_TO_READY,
3482                ffi::GST_STATE_CHANGE_READY_TO_PAUSED,
3483                ffi::GST_STATE_CHANGE_PAUSED_TO_PLAYING,
3484                ffi::GST_STATE_CHANGE_PLAYING_TO_PAUSED,
3485                ffi::GST_STATE_CHANGE_PAUSED_TO_READY,
3486                ffi::GST_STATE_CHANGE_READY_TO_NULL,
3487                ffi::GST_STATE_CHANGE_NULL_TO_NULL,
3488                ffi::GST_STATE_CHANGE_READY_TO_READY,
3489                ffi::GST_STATE_CHANGE_PAUSED_TO_PAUSED,
3490                ffi::GST_STATE_CHANGE_PLAYING_TO_PLAYING
3491            ]
3492            .contains(&value)
3493        );
3494        unsafe { std::mem::transmute(value) }
3495    }
3496}
3497
3498impl StaticType for StateChange {
3499    #[inline]
3500    #[doc(alias = "gst_state_change_get_type")]
3501    fn static_type() -> glib::Type {
3502        unsafe { from_glib(ffi::gst_state_change_get_type()) }
3503    }
3504}
3505
3506impl glib::HasParamSpec for StateChange {
3507    type ParamSpec = glib::ParamSpecEnum;
3508    type SetValue = Self;
3509    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
3510
3511    fn param_spec_builder() -> Self::BuilderFn {
3512        Self::ParamSpec::builder_with_default
3513    }
3514}
3515
3516impl glib::value::ValueType for StateChange {
3517    type Type = Self;
3518}
3519
3520unsafe impl<'a> glib::value::FromValue<'a> for StateChange {
3521    type Checker = glib::value::GenericValueTypeChecker<Self>;
3522
3523    #[inline]
3524    unsafe fn from_value(value: &'a glib::Value) -> Self {
3525        skip_assert_initialized!();
3526        unsafe { from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) }
3527    }
3528}
3529
3530impl ToValue for StateChange {
3531    #[inline]
3532    fn to_value(&self) -> glib::Value {
3533        let mut value = glib::Value::for_value_type::<Self>();
3534        unsafe {
3535            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
3536        }
3537        value
3538    }
3539
3540    #[inline]
3541    fn value_type(&self) -> glib::Type {
3542        Self::static_type()
3543    }
3544}
3545
3546impl From<StateChange> for glib::Value {
3547    #[inline]
3548    fn from(v: StateChange) -> Self {
3549        skip_assert_initialized!();
3550        ToValue::to_value(&v)
3551    }
3552}
3553
3554/// The possible return values from a state change function such as
3555/// [`ElementExt::set_state()`][crate::prelude::ElementExt::set_state()]. Only [`Failure`][Self::Failure] is a real failure.
3556#[must_use]
3557#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
3558#[repr(i32)]
3559#[doc(alias = "GstStateChangeReturn")]
3560pub enum StateChangeReturn {
3561    /// the state change failed
3562    #[doc(alias = "GST_STATE_CHANGE_FAILURE")]
3563    Failure = ffi::GST_STATE_CHANGE_FAILURE,
3564    /// the state change succeeded
3565    #[doc(alias = "GST_STATE_CHANGE_SUCCESS")]
3566    Success = ffi::GST_STATE_CHANGE_SUCCESS,
3567    /// the state change will happen asynchronously
3568    #[doc(alias = "GST_STATE_CHANGE_ASYNC")]
3569    Async = ffi::GST_STATE_CHANGE_ASYNC,
3570    /// the state change succeeded but the element
3571    ///  cannot produce data in [`State::Paused`][crate::State::Paused].
3572    ///  This typically happens with live sources.
3573    #[doc(alias = "GST_STATE_CHANGE_NO_PREROLL")]
3574    NoPreroll = ffi::GST_STATE_CHANGE_NO_PREROLL,
3575}
3576
3577#[doc(hidden)]
3578impl IntoGlib for StateChangeReturn {
3579    type GlibType = ffi::GstStateChangeReturn;
3580
3581    #[inline]
3582    fn into_glib(self) -> ffi::GstStateChangeReturn {
3583        self as ffi::GstStateChangeReturn
3584    }
3585}
3586
3587#[doc(hidden)]
3588impl FromGlib<ffi::GstStateChangeReturn> for StateChangeReturn {
3589    #[inline]
3590    unsafe fn from_glib(value: ffi::GstStateChangeReturn) -> Self {
3591        skip_assert_initialized!();
3592
3593        debug_assert!(
3594            [
3595                ffi::GST_STATE_CHANGE_FAILURE,
3596                ffi::GST_STATE_CHANGE_SUCCESS,
3597                ffi::GST_STATE_CHANGE_ASYNC,
3598                ffi::GST_STATE_CHANGE_NO_PREROLL
3599            ]
3600            .contains(&value)
3601        );
3602        unsafe { std::mem::transmute(value) }
3603    }
3604}
3605
3606impl StaticType for StateChangeReturn {
3607    #[inline]
3608    #[doc(alias = "gst_state_change_return_get_type")]
3609    fn static_type() -> glib::Type {
3610        unsafe { from_glib(ffi::gst_state_change_return_get_type()) }
3611    }
3612}
3613
3614impl glib::HasParamSpec for StateChangeReturn {
3615    type ParamSpec = glib::ParamSpecEnum;
3616    type SetValue = Self;
3617    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
3618
3619    fn param_spec_builder() -> Self::BuilderFn {
3620        Self::ParamSpec::builder_with_default
3621    }
3622}
3623
3624impl glib::value::ValueType for StateChangeReturn {
3625    type Type = Self;
3626}
3627
3628unsafe impl<'a> glib::value::FromValue<'a> for StateChangeReturn {
3629    type Checker = glib::value::GenericValueTypeChecker<Self>;
3630
3631    #[inline]
3632    unsafe fn from_value(value: &'a glib::Value) -> Self {
3633        skip_assert_initialized!();
3634        unsafe { from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) }
3635    }
3636}
3637
3638impl ToValue for StateChangeReturn {
3639    #[inline]
3640    fn to_value(&self) -> glib::Value {
3641        let mut value = glib::Value::for_value_type::<Self>();
3642        unsafe {
3643            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
3644        }
3645        value
3646    }
3647
3648    #[inline]
3649    fn value_type(&self) -> glib::Type {
3650        Self::static_type()
3651    }
3652}
3653
3654impl From<StateChangeReturn> for glib::Value {
3655    #[inline]
3656    fn from(v: StateChangeReturn) -> Self {
3657        skip_assert_initialized!();
3658        ToValue::to_value(&v)
3659    }
3660}
3661
3662/// Stream errors are for anything related to the stream being processed:
3663/// format errors, media type errors, ...
3664/// They're typically used by decoders, demuxers, converters, ...
3665#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
3666#[non_exhaustive]
3667#[doc(alias = "GstStreamError")]
3668pub enum StreamError {
3669    /// a general error which doesn't fit in any other
3670    /// category. Make sure you add a custom message to the error call.
3671    #[doc(alias = "GST_STREAM_ERROR_FAILED")]
3672    Failed,
3673    /// do not use this except as a placeholder for
3674    /// deciding where to go while developing code.
3675    #[doc(alias = "GST_STREAM_ERROR_TOO_LAZY")]
3676    TooLazy,
3677    /// use this when you do not want to implement
3678    /// this functionality yet.
3679    #[doc(alias = "GST_STREAM_ERROR_NOT_IMPLEMENTED")]
3680    NotImplemented,
3681    /// used when the element doesn't know the
3682    /// stream's type.
3683    #[doc(alias = "GST_STREAM_ERROR_TYPE_NOT_FOUND")]
3684    TypeNotFound,
3685    /// used when the element doesn't handle this type
3686    /// of stream.
3687    #[doc(alias = "GST_STREAM_ERROR_WRONG_TYPE")]
3688    WrongType,
3689    /// used when there's no codec to handle the
3690    /// stream's type.
3691    #[doc(alias = "GST_STREAM_ERROR_CODEC_NOT_FOUND")]
3692    CodecNotFound,
3693    /// used when decoding fails.
3694    #[doc(alias = "GST_STREAM_ERROR_DECODE")]
3695    Decode,
3696    /// used when encoding fails.
3697    #[doc(alias = "GST_STREAM_ERROR_ENCODE")]
3698    Encode,
3699    /// used when demuxing fails.
3700    #[doc(alias = "GST_STREAM_ERROR_DEMUX")]
3701    Demux,
3702    /// used when muxing fails.
3703    #[doc(alias = "GST_STREAM_ERROR_MUX")]
3704    Mux,
3705    /// used when the stream is of the wrong format
3706    /// (for example, wrong caps).
3707    #[doc(alias = "GST_STREAM_ERROR_FORMAT")]
3708    Format,
3709    /// used when the stream is encrypted and can't be
3710    /// decrypted because this is not supported by the element.
3711    #[doc(alias = "GST_STREAM_ERROR_DECRYPT")]
3712    Decrypt,
3713    /// used when the stream is encrypted and
3714    /// can't be decrypted because no suitable key is available.
3715    #[doc(alias = "GST_STREAM_ERROR_DECRYPT_NOKEY")]
3716    DecryptNokey,
3717    #[doc(hidden)]
3718    __Unknown(i32),
3719}
3720
3721#[doc(hidden)]
3722impl IntoGlib for StreamError {
3723    type GlibType = ffi::GstStreamError;
3724
3725    fn into_glib(self) -> ffi::GstStreamError {
3726        match self {
3727            Self::Failed => ffi::GST_STREAM_ERROR_FAILED,
3728            Self::TooLazy => ffi::GST_STREAM_ERROR_TOO_LAZY,
3729            Self::NotImplemented => ffi::GST_STREAM_ERROR_NOT_IMPLEMENTED,
3730            Self::TypeNotFound => ffi::GST_STREAM_ERROR_TYPE_NOT_FOUND,
3731            Self::WrongType => ffi::GST_STREAM_ERROR_WRONG_TYPE,
3732            Self::CodecNotFound => ffi::GST_STREAM_ERROR_CODEC_NOT_FOUND,
3733            Self::Decode => ffi::GST_STREAM_ERROR_DECODE,
3734            Self::Encode => ffi::GST_STREAM_ERROR_ENCODE,
3735            Self::Demux => ffi::GST_STREAM_ERROR_DEMUX,
3736            Self::Mux => ffi::GST_STREAM_ERROR_MUX,
3737            Self::Format => ffi::GST_STREAM_ERROR_FORMAT,
3738            Self::Decrypt => ffi::GST_STREAM_ERROR_DECRYPT,
3739            Self::DecryptNokey => ffi::GST_STREAM_ERROR_DECRYPT_NOKEY,
3740            Self::__Unknown(value) => value,
3741        }
3742    }
3743}
3744
3745#[doc(hidden)]
3746impl FromGlib<ffi::GstStreamError> for StreamError {
3747    unsafe fn from_glib(value: ffi::GstStreamError) -> Self {
3748        skip_assert_initialized!();
3749
3750        match value {
3751            ffi::GST_STREAM_ERROR_FAILED => Self::Failed,
3752            ffi::GST_STREAM_ERROR_TOO_LAZY => Self::TooLazy,
3753            ffi::GST_STREAM_ERROR_NOT_IMPLEMENTED => Self::NotImplemented,
3754            ffi::GST_STREAM_ERROR_TYPE_NOT_FOUND => Self::TypeNotFound,
3755            ffi::GST_STREAM_ERROR_WRONG_TYPE => Self::WrongType,
3756            ffi::GST_STREAM_ERROR_CODEC_NOT_FOUND => Self::CodecNotFound,
3757            ffi::GST_STREAM_ERROR_DECODE => Self::Decode,
3758            ffi::GST_STREAM_ERROR_ENCODE => Self::Encode,
3759            ffi::GST_STREAM_ERROR_DEMUX => Self::Demux,
3760            ffi::GST_STREAM_ERROR_MUX => Self::Mux,
3761            ffi::GST_STREAM_ERROR_FORMAT => Self::Format,
3762            ffi::GST_STREAM_ERROR_DECRYPT => Self::Decrypt,
3763            ffi::GST_STREAM_ERROR_DECRYPT_NOKEY => Self::DecryptNokey,
3764            value => Self::__Unknown(value),
3765        }
3766    }
3767}
3768
3769impl glib::error::ErrorDomain for StreamError {
3770    #[inline]
3771    fn domain() -> glib::Quark {
3772        skip_assert_initialized!();
3773
3774        unsafe { from_glib(ffi::gst_stream_error_quark()) }
3775    }
3776
3777    #[inline]
3778    fn code(self) -> i32 {
3779        self.into_glib()
3780    }
3781
3782    #[inline]
3783    #[allow(clippy::match_single_binding)]
3784    fn from(code: i32) -> Option<Self> {
3785        skip_assert_initialized!();
3786        match unsafe { from_glib(code) } {
3787            Self::__Unknown(_) => Some(Self::Failed),
3788            value => Some(value),
3789        }
3790    }
3791}
3792
3793impl StaticType for StreamError {
3794    #[inline]
3795    #[doc(alias = "gst_stream_error_get_type")]
3796    fn static_type() -> glib::Type {
3797        unsafe { from_glib(ffi::gst_stream_error_get_type()) }
3798    }
3799}
3800
3801impl glib::HasParamSpec for StreamError {
3802    type ParamSpec = glib::ParamSpecEnum;
3803    type SetValue = Self;
3804    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
3805
3806    fn param_spec_builder() -> Self::BuilderFn {
3807        Self::ParamSpec::builder_with_default
3808    }
3809}
3810
3811impl glib::value::ValueType for StreamError {
3812    type Type = Self;
3813}
3814
3815unsafe impl<'a> glib::value::FromValue<'a> for StreamError {
3816    type Checker = glib::value::GenericValueTypeChecker<Self>;
3817
3818    #[inline]
3819    unsafe fn from_value(value: &'a glib::Value) -> Self {
3820        skip_assert_initialized!();
3821        unsafe { from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) }
3822    }
3823}
3824
3825impl ToValue for StreamError {
3826    #[inline]
3827    fn to_value(&self) -> glib::Value {
3828        let mut value = glib::Value::for_value_type::<Self>();
3829        unsafe {
3830            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
3831        }
3832        value
3833    }
3834
3835    #[inline]
3836    fn value_type(&self) -> glib::Type {
3837        Self::static_type()
3838    }
3839}
3840
3841impl From<StreamError> for glib::Value {
3842    #[inline]
3843    fn from(v: StreamError) -> Self {
3844        skip_assert_initialized!();
3845        ToValue::to_value(&v)
3846    }
3847}
3848
3849/// The type of a `GST_MESSAGE_STREAM_STATUS`. The stream status messages inform the
3850/// application of new streaming threads and their status.
3851#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
3852#[non_exhaustive]
3853#[doc(alias = "GstStreamStatusType")]
3854pub enum StreamStatusType {
3855    /// A new thread need to be created.
3856    #[doc(alias = "GST_STREAM_STATUS_TYPE_CREATE")]
3857    Create,
3858    /// a thread entered its loop function
3859    #[doc(alias = "GST_STREAM_STATUS_TYPE_ENTER")]
3860    Enter,
3861    /// a thread left its loop function
3862    #[doc(alias = "GST_STREAM_STATUS_TYPE_LEAVE")]
3863    Leave,
3864    /// a thread is destroyed
3865    #[doc(alias = "GST_STREAM_STATUS_TYPE_DESTROY")]
3866    Destroy,
3867    /// a thread is started
3868    #[doc(alias = "GST_STREAM_STATUS_TYPE_START")]
3869    Start,
3870    /// a thread is paused
3871    #[doc(alias = "GST_STREAM_STATUS_TYPE_PAUSE")]
3872    Pause,
3873    /// a thread is stopped
3874    #[doc(alias = "GST_STREAM_STATUS_TYPE_STOP")]
3875    Stop,
3876    #[doc(hidden)]
3877    __Unknown(i32),
3878}
3879
3880#[doc(hidden)]
3881impl IntoGlib for StreamStatusType {
3882    type GlibType = ffi::GstStreamStatusType;
3883
3884    #[inline]
3885    fn into_glib(self) -> ffi::GstStreamStatusType {
3886        match self {
3887            Self::Create => ffi::GST_STREAM_STATUS_TYPE_CREATE,
3888            Self::Enter => ffi::GST_STREAM_STATUS_TYPE_ENTER,
3889            Self::Leave => ffi::GST_STREAM_STATUS_TYPE_LEAVE,
3890            Self::Destroy => ffi::GST_STREAM_STATUS_TYPE_DESTROY,
3891            Self::Start => ffi::GST_STREAM_STATUS_TYPE_START,
3892            Self::Pause => ffi::GST_STREAM_STATUS_TYPE_PAUSE,
3893            Self::Stop => ffi::GST_STREAM_STATUS_TYPE_STOP,
3894            Self::__Unknown(value) => value,
3895        }
3896    }
3897}
3898
3899#[doc(hidden)]
3900impl FromGlib<ffi::GstStreamStatusType> for StreamStatusType {
3901    #[inline]
3902    unsafe fn from_glib(value: ffi::GstStreamStatusType) -> Self {
3903        skip_assert_initialized!();
3904
3905        match value {
3906            ffi::GST_STREAM_STATUS_TYPE_CREATE => Self::Create,
3907            ffi::GST_STREAM_STATUS_TYPE_ENTER => Self::Enter,
3908            ffi::GST_STREAM_STATUS_TYPE_LEAVE => Self::Leave,
3909            ffi::GST_STREAM_STATUS_TYPE_DESTROY => Self::Destroy,
3910            ffi::GST_STREAM_STATUS_TYPE_START => Self::Start,
3911            ffi::GST_STREAM_STATUS_TYPE_PAUSE => Self::Pause,
3912            ffi::GST_STREAM_STATUS_TYPE_STOP => Self::Stop,
3913            value => Self::__Unknown(value),
3914        }
3915    }
3916}
3917
3918impl StaticType for StreamStatusType {
3919    #[inline]
3920    #[doc(alias = "gst_stream_status_type_get_type")]
3921    fn static_type() -> glib::Type {
3922        unsafe { from_glib(ffi::gst_stream_status_type_get_type()) }
3923    }
3924}
3925
3926impl glib::HasParamSpec for StreamStatusType {
3927    type ParamSpec = glib::ParamSpecEnum;
3928    type SetValue = Self;
3929    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
3930
3931    fn param_spec_builder() -> Self::BuilderFn {
3932        Self::ParamSpec::builder_with_default
3933    }
3934}
3935
3936impl glib::value::ValueType for StreamStatusType {
3937    type Type = Self;
3938}
3939
3940unsafe impl<'a> glib::value::FromValue<'a> for StreamStatusType {
3941    type Checker = glib::value::GenericValueTypeChecker<Self>;
3942
3943    #[inline]
3944    unsafe fn from_value(value: &'a glib::Value) -> Self {
3945        skip_assert_initialized!();
3946        unsafe { from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) }
3947    }
3948}
3949
3950impl ToValue for StreamStatusType {
3951    #[inline]
3952    fn to_value(&self) -> glib::Value {
3953        let mut value = glib::Value::for_value_type::<Self>();
3954        unsafe {
3955            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
3956        }
3957        value
3958    }
3959
3960    #[inline]
3961    fn value_type(&self) -> glib::Type {
3962        Self::static_type()
3963    }
3964}
3965
3966impl From<StreamStatusType> for glib::Value {
3967    #[inline]
3968    fn from(v: StreamStatusType) -> Self {
3969        skip_assert_initialized!();
3970        ToValue::to_value(&v)
3971    }
3972}
3973
3974/// The type of a `GST_MESSAGE_STRUCTURE_CHANGE`.
3975#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
3976#[non_exhaustive]
3977#[doc(alias = "GstStructureChangeType")]
3978pub enum StructureChangeType {
3979    /// Pad linking is starting or done.
3980    #[doc(alias = "GST_STRUCTURE_CHANGE_TYPE_PAD_LINK")]
3981    Link,
3982    /// Pad unlinking is starting or done.
3983    #[doc(alias = "GST_STRUCTURE_CHANGE_TYPE_PAD_UNLINK")]
3984    Unlink,
3985    #[doc(hidden)]
3986    __Unknown(i32),
3987}
3988
3989#[doc(hidden)]
3990impl IntoGlib for StructureChangeType {
3991    type GlibType = ffi::GstStructureChangeType;
3992
3993    #[inline]
3994    fn into_glib(self) -> ffi::GstStructureChangeType {
3995        match self {
3996            Self::Link => ffi::GST_STRUCTURE_CHANGE_TYPE_PAD_LINK,
3997            Self::Unlink => ffi::GST_STRUCTURE_CHANGE_TYPE_PAD_UNLINK,
3998            Self::__Unknown(value) => value,
3999        }
4000    }
4001}
4002
4003#[doc(hidden)]
4004impl FromGlib<ffi::GstStructureChangeType> for StructureChangeType {
4005    #[inline]
4006    unsafe fn from_glib(value: ffi::GstStructureChangeType) -> Self {
4007        skip_assert_initialized!();
4008
4009        match value {
4010            ffi::GST_STRUCTURE_CHANGE_TYPE_PAD_LINK => Self::Link,
4011            ffi::GST_STRUCTURE_CHANGE_TYPE_PAD_UNLINK => Self::Unlink,
4012            value => Self::__Unknown(value),
4013        }
4014    }
4015}
4016
4017impl StaticType for StructureChangeType {
4018    #[inline]
4019    #[doc(alias = "gst_structure_change_type_get_type")]
4020    fn static_type() -> glib::Type {
4021        unsafe { from_glib(ffi::gst_structure_change_type_get_type()) }
4022    }
4023}
4024
4025impl glib::HasParamSpec for StructureChangeType {
4026    type ParamSpec = glib::ParamSpecEnum;
4027    type SetValue = Self;
4028    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
4029
4030    fn param_spec_builder() -> Self::BuilderFn {
4031        Self::ParamSpec::builder_with_default
4032    }
4033}
4034
4035impl glib::value::ValueType for StructureChangeType {
4036    type Type = Self;
4037}
4038
4039unsafe impl<'a> glib::value::FromValue<'a> for StructureChangeType {
4040    type Checker = glib::value::GenericValueTypeChecker<Self>;
4041
4042    #[inline]
4043    unsafe fn from_value(value: &'a glib::Value) -> Self {
4044        skip_assert_initialized!();
4045        unsafe { from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) }
4046    }
4047}
4048
4049impl ToValue for StructureChangeType {
4050    #[inline]
4051    fn to_value(&self) -> glib::Value {
4052        let mut value = glib::Value::for_value_type::<Self>();
4053        unsafe {
4054            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
4055        }
4056        value
4057    }
4058
4059    #[inline]
4060    fn value_type(&self) -> glib::Type {
4061        Self::static_type()
4062    }
4063}
4064
4065impl From<StructureChangeType> for glib::Value {
4066    #[inline]
4067    fn from(v: StructureChangeType) -> Self {
4068        skip_assert_initialized!();
4069        ToValue::to_value(&v)
4070    }
4071}
4072
4073/// Extra tag flags used when registering tags.
4074#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
4075#[non_exhaustive]
4076#[doc(alias = "GstTagFlag")]
4077pub enum TagFlag {
4078    /// undefined flag
4079    #[doc(alias = "GST_TAG_FLAG_UNDEFINED")]
4080    Undefined,
4081    /// tag is meta data
4082    #[doc(alias = "GST_TAG_FLAG_META")]
4083    Meta,
4084    /// tag is encoded
4085    #[doc(alias = "GST_TAG_FLAG_ENCODED")]
4086    Encoded,
4087    /// tag is decoded
4088    #[doc(alias = "GST_TAG_FLAG_DECODED")]
4089    Decoded,
4090    #[doc(hidden)]
4091    __Unknown(i32),
4092}
4093
4094#[doc(hidden)]
4095impl IntoGlib for TagFlag {
4096    type GlibType = ffi::GstTagFlag;
4097
4098    #[inline]
4099    fn into_glib(self) -> ffi::GstTagFlag {
4100        match self {
4101            Self::Undefined => ffi::GST_TAG_FLAG_UNDEFINED,
4102            Self::Meta => ffi::GST_TAG_FLAG_META,
4103            Self::Encoded => ffi::GST_TAG_FLAG_ENCODED,
4104            Self::Decoded => ffi::GST_TAG_FLAG_DECODED,
4105            Self::__Unknown(value) => value,
4106        }
4107    }
4108}
4109
4110#[doc(hidden)]
4111impl FromGlib<ffi::GstTagFlag> for TagFlag {
4112    #[inline]
4113    unsafe fn from_glib(value: ffi::GstTagFlag) -> Self {
4114        skip_assert_initialized!();
4115
4116        match value {
4117            ffi::GST_TAG_FLAG_UNDEFINED => Self::Undefined,
4118            ffi::GST_TAG_FLAG_META => Self::Meta,
4119            ffi::GST_TAG_FLAG_ENCODED => Self::Encoded,
4120            ffi::GST_TAG_FLAG_DECODED => Self::Decoded,
4121            value => Self::__Unknown(value),
4122        }
4123    }
4124}
4125
4126impl StaticType for TagFlag {
4127    #[inline]
4128    #[doc(alias = "gst_tag_flag_get_type")]
4129    fn static_type() -> glib::Type {
4130        unsafe { from_glib(ffi::gst_tag_flag_get_type()) }
4131    }
4132}
4133
4134impl glib::HasParamSpec for TagFlag {
4135    type ParamSpec = glib::ParamSpecEnum;
4136    type SetValue = Self;
4137    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
4138
4139    fn param_spec_builder() -> Self::BuilderFn {
4140        Self::ParamSpec::builder_with_default
4141    }
4142}
4143
4144impl glib::value::ValueType for TagFlag {
4145    type Type = Self;
4146}
4147
4148unsafe impl<'a> glib::value::FromValue<'a> for TagFlag {
4149    type Checker = glib::value::GenericValueTypeChecker<Self>;
4150
4151    #[inline]
4152    unsafe fn from_value(value: &'a glib::Value) -> Self {
4153        skip_assert_initialized!();
4154        unsafe { from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) }
4155    }
4156}
4157
4158impl ToValue for TagFlag {
4159    #[inline]
4160    fn to_value(&self) -> glib::Value {
4161        let mut value = glib::Value::for_value_type::<Self>();
4162        unsafe {
4163            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
4164        }
4165        value
4166    }
4167
4168    #[inline]
4169    fn value_type(&self) -> glib::Type {
4170        Self::static_type()
4171    }
4172}
4173
4174impl From<TagFlag> for glib::Value {
4175    #[inline]
4176    fn from(v: TagFlag) -> Self {
4177        skip_assert_initialized!();
4178        ToValue::to_value(&v)
4179    }
4180}
4181
4182/// The different tag merging modes are basically replace, overwrite and append,
4183/// but they can be seen from two directions. Given two taglists: (A) the tags
4184/// already in the element and (B) the ones that are supplied to the element (
4185/// e.g. via [`TagSetterExt::merge_tags()`][crate::prelude::TagSetterExt::merge_tags()] / `gst_tag_setter_add_tags()` or a
4186/// [`EventType::Tag`][crate::EventType::Tag]), how are these tags merged?
4187/// In the table below this is shown for the cases that a tag exists in the list
4188/// (A) or does not exists (!A) and combinations thereof.
4189///
4190/// | merge mode | A + B | A + !B | !A + B | !A + !B |
4191/// | ----------- | ----- | ------ | ------ | ------- |
4192/// | REPLACE_ALL | B | ø | B | ø |
4193/// | REPLACE | B | A | B | ø |
4194/// | APPEND | A, B | A | B | ø |
4195/// | PREPEND | B, A | A | B | ø |
4196/// | KEEP | A | A | B | ø |
4197/// | KEEP_ALL | A | A | ø | ø |
4198#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
4199#[non_exhaustive]
4200#[doc(alias = "GstTagMergeMode")]
4201pub enum TagMergeMode {
4202    /// undefined merge mode
4203    #[doc(alias = "GST_TAG_MERGE_UNDEFINED")]
4204    Undefined,
4205    /// replace all tags (clear list and append)
4206    #[doc(alias = "GST_TAG_MERGE_REPLACE_ALL")]
4207    ReplaceAll,
4208    /// replace tags
4209    #[doc(alias = "GST_TAG_MERGE_REPLACE")]
4210    Replace,
4211    /// append tags
4212    #[doc(alias = "GST_TAG_MERGE_APPEND")]
4213    Append,
4214    /// prepend tags
4215    #[doc(alias = "GST_TAG_MERGE_PREPEND")]
4216    Prepend,
4217    /// keep existing tags
4218    #[doc(alias = "GST_TAG_MERGE_KEEP")]
4219    Keep,
4220    /// keep all existing tags
4221    #[doc(alias = "GST_TAG_MERGE_KEEP_ALL")]
4222    KeepAll,
4223    #[doc(hidden)]
4224    __Unknown(i32),
4225}
4226
4227#[doc(hidden)]
4228impl IntoGlib for TagMergeMode {
4229    type GlibType = ffi::GstTagMergeMode;
4230
4231    #[inline]
4232    fn into_glib(self) -> ffi::GstTagMergeMode {
4233        match self {
4234            Self::Undefined => ffi::GST_TAG_MERGE_UNDEFINED,
4235            Self::ReplaceAll => ffi::GST_TAG_MERGE_REPLACE_ALL,
4236            Self::Replace => ffi::GST_TAG_MERGE_REPLACE,
4237            Self::Append => ffi::GST_TAG_MERGE_APPEND,
4238            Self::Prepend => ffi::GST_TAG_MERGE_PREPEND,
4239            Self::Keep => ffi::GST_TAG_MERGE_KEEP,
4240            Self::KeepAll => ffi::GST_TAG_MERGE_KEEP_ALL,
4241            Self::__Unknown(value) => value,
4242        }
4243    }
4244}
4245
4246#[doc(hidden)]
4247impl FromGlib<ffi::GstTagMergeMode> for TagMergeMode {
4248    #[inline]
4249    unsafe fn from_glib(value: ffi::GstTagMergeMode) -> Self {
4250        skip_assert_initialized!();
4251
4252        match value {
4253            ffi::GST_TAG_MERGE_UNDEFINED => Self::Undefined,
4254            ffi::GST_TAG_MERGE_REPLACE_ALL => Self::ReplaceAll,
4255            ffi::GST_TAG_MERGE_REPLACE => Self::Replace,
4256            ffi::GST_TAG_MERGE_APPEND => Self::Append,
4257            ffi::GST_TAG_MERGE_PREPEND => Self::Prepend,
4258            ffi::GST_TAG_MERGE_KEEP => Self::Keep,
4259            ffi::GST_TAG_MERGE_KEEP_ALL => Self::KeepAll,
4260            value => Self::__Unknown(value),
4261        }
4262    }
4263}
4264
4265impl StaticType for TagMergeMode {
4266    #[inline]
4267    #[doc(alias = "gst_tag_merge_mode_get_type")]
4268    fn static_type() -> glib::Type {
4269        unsafe { from_glib(ffi::gst_tag_merge_mode_get_type()) }
4270    }
4271}
4272
4273impl glib::HasParamSpec for TagMergeMode {
4274    type ParamSpec = glib::ParamSpecEnum;
4275    type SetValue = Self;
4276    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
4277
4278    fn param_spec_builder() -> Self::BuilderFn {
4279        Self::ParamSpec::builder_with_default
4280    }
4281}
4282
4283impl glib::value::ValueType for TagMergeMode {
4284    type Type = Self;
4285}
4286
4287unsafe impl<'a> glib::value::FromValue<'a> for TagMergeMode {
4288    type Checker = glib::value::GenericValueTypeChecker<Self>;
4289
4290    #[inline]
4291    unsafe fn from_value(value: &'a glib::Value) -> Self {
4292        skip_assert_initialized!();
4293        unsafe { from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) }
4294    }
4295}
4296
4297impl ToValue for TagMergeMode {
4298    #[inline]
4299    fn to_value(&self) -> glib::Value {
4300        let mut value = glib::Value::for_value_type::<Self>();
4301        unsafe {
4302            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
4303        }
4304        value
4305    }
4306
4307    #[inline]
4308    fn value_type(&self) -> glib::Type {
4309        Self::static_type()
4310    }
4311}
4312
4313impl From<TagMergeMode> for glib::Value {
4314    #[inline]
4315    fn from(v: TagMergeMode) -> Self {
4316        skip_assert_initialized!();
4317        ToValue::to_value(&v)
4318    }
4319}
4320
4321/// GstTagScope specifies if a taglist applies to the complete
4322/// medium or only to one single stream.
4323#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
4324#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy)]
4325#[non_exhaustive]
4326#[doc(alias = "GstTagScope")]
4327pub enum TagScope {
4328    /// tags specific to this single stream
4329    #[doc(alias = "GST_TAG_SCOPE_STREAM")]
4330    Stream,
4331    /// global tags for the complete medium
4332    #[doc(alias = "GST_TAG_SCOPE_GLOBAL")]
4333    Global,
4334    #[doc(hidden)]
4335    __Unknown(i32),
4336}
4337
4338#[doc(hidden)]
4339impl IntoGlib for TagScope {
4340    type GlibType = ffi::GstTagScope;
4341
4342    #[inline]
4343    fn into_glib(self) -> ffi::GstTagScope {
4344        match self {
4345            Self::Stream => ffi::GST_TAG_SCOPE_STREAM,
4346            Self::Global => ffi::GST_TAG_SCOPE_GLOBAL,
4347            Self::__Unknown(value) => value,
4348        }
4349    }
4350}
4351
4352#[doc(hidden)]
4353impl FromGlib<ffi::GstTagScope> for TagScope {
4354    #[inline]
4355    unsafe fn from_glib(value: ffi::GstTagScope) -> Self {
4356        skip_assert_initialized!();
4357
4358        match value {
4359            ffi::GST_TAG_SCOPE_STREAM => Self::Stream,
4360            ffi::GST_TAG_SCOPE_GLOBAL => Self::Global,
4361            value => Self::__Unknown(value),
4362        }
4363    }
4364}
4365
4366impl StaticType for TagScope {
4367    #[inline]
4368    #[doc(alias = "gst_tag_scope_get_type")]
4369    fn static_type() -> glib::Type {
4370        unsafe { from_glib(ffi::gst_tag_scope_get_type()) }
4371    }
4372}
4373
4374impl glib::HasParamSpec for TagScope {
4375    type ParamSpec = glib::ParamSpecEnum;
4376    type SetValue = Self;
4377    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
4378
4379    fn param_spec_builder() -> Self::BuilderFn {
4380        Self::ParamSpec::builder_with_default
4381    }
4382}
4383
4384impl glib::value::ValueType for TagScope {
4385    type Type = Self;
4386}
4387
4388unsafe impl<'a> glib::value::FromValue<'a> for TagScope {
4389    type Checker = glib::value::GenericValueTypeChecker<Self>;
4390
4391    #[inline]
4392    unsafe fn from_value(value: &'a glib::Value) -> Self {
4393        skip_assert_initialized!();
4394        unsafe { from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) }
4395    }
4396}
4397
4398impl ToValue for TagScope {
4399    #[inline]
4400    fn to_value(&self) -> glib::Value {
4401        let mut value = glib::Value::for_value_type::<Self>();
4402        unsafe {
4403            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
4404        }
4405        value
4406    }
4407
4408    #[inline]
4409    fn value_type(&self) -> glib::Type {
4410        Self::static_type()
4411    }
4412}
4413
4414impl From<TagScope> for glib::Value {
4415    #[inline]
4416    fn from(v: TagScope) -> Self {
4417        skip_assert_initialized!();
4418        ToValue::to_value(&v)
4419    }
4420}
4421
4422/// The different states a task can be in
4423#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
4424#[non_exhaustive]
4425#[doc(alias = "GstTaskState")]
4426pub enum TaskState {
4427    /// the task is started and running
4428    #[doc(alias = "GST_TASK_STARTED")]
4429    Started,
4430    /// the task is stopped
4431    #[doc(alias = "GST_TASK_STOPPED")]
4432    Stopped,
4433    /// the task is paused
4434    #[doc(alias = "GST_TASK_PAUSED")]
4435    Paused,
4436    #[doc(hidden)]
4437    __Unknown(i32),
4438}
4439
4440#[doc(hidden)]
4441impl IntoGlib for TaskState {
4442    type GlibType = ffi::GstTaskState;
4443
4444    #[inline]
4445    fn into_glib(self) -> ffi::GstTaskState {
4446        match self {
4447            Self::Started => ffi::GST_TASK_STARTED,
4448            Self::Stopped => ffi::GST_TASK_STOPPED,
4449            Self::Paused => ffi::GST_TASK_PAUSED,
4450            Self::__Unknown(value) => value,
4451        }
4452    }
4453}
4454
4455#[doc(hidden)]
4456impl FromGlib<ffi::GstTaskState> for TaskState {
4457    #[inline]
4458    unsafe fn from_glib(value: ffi::GstTaskState) -> Self {
4459        skip_assert_initialized!();
4460
4461        match value {
4462            ffi::GST_TASK_STARTED => Self::Started,
4463            ffi::GST_TASK_STOPPED => Self::Stopped,
4464            ffi::GST_TASK_PAUSED => Self::Paused,
4465            value => Self::__Unknown(value),
4466        }
4467    }
4468}
4469
4470impl StaticType for TaskState {
4471    #[inline]
4472    #[doc(alias = "gst_task_state_get_type")]
4473    fn static_type() -> glib::Type {
4474        unsafe { from_glib(ffi::gst_task_state_get_type()) }
4475    }
4476}
4477
4478impl glib::HasParamSpec for TaskState {
4479    type ParamSpec = glib::ParamSpecEnum;
4480    type SetValue = Self;
4481    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
4482
4483    fn param_spec_builder() -> Self::BuilderFn {
4484        Self::ParamSpec::builder_with_default
4485    }
4486}
4487
4488impl glib::value::ValueType for TaskState {
4489    type Type = Self;
4490}
4491
4492unsafe impl<'a> glib::value::FromValue<'a> for TaskState {
4493    type Checker = glib::value::GenericValueTypeChecker<Self>;
4494
4495    #[inline]
4496    unsafe fn from_value(value: &'a glib::Value) -> Self {
4497        skip_assert_initialized!();
4498        unsafe { from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) }
4499    }
4500}
4501
4502impl ToValue for TaskState {
4503    #[inline]
4504    fn to_value(&self) -> glib::Value {
4505        let mut value = glib::Value::for_value_type::<Self>();
4506        unsafe {
4507            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
4508        }
4509        value
4510    }
4511
4512    #[inline]
4513    fn value_type(&self) -> glib::Type {
4514        Self::static_type()
4515    }
4516}
4517
4518impl From<TaskState> for glib::Value {
4519    #[inline]
4520    fn from(v: TaskState) -> Self {
4521        skip_assert_initialized!();
4522        ToValue::to_value(&v)
4523    }
4524}
4525
4526/// The different types of TOC entries (see [`TocEntry`][crate::TocEntry]).
4527///
4528/// There are two types of TOC entries: alternatives or parts in a sequence.
4529#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
4530#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy)]
4531#[non_exhaustive]
4532#[doc(alias = "GstTocEntryType")]
4533pub enum TocEntryType {
4534    /// entry is an angle (i.e. an alternative)
4535    #[doc(alias = "GST_TOC_ENTRY_TYPE_ANGLE")]
4536    Angle,
4537    /// entry is a version (i.e. alternative)
4538    #[doc(alias = "GST_TOC_ENTRY_TYPE_VERSION")]
4539    Version,
4540    /// entry is an edition (i.e. alternative)
4541    #[doc(alias = "GST_TOC_ENTRY_TYPE_EDITION")]
4542    Edition,
4543    /// invalid entry type value
4544    #[doc(alias = "GST_TOC_ENTRY_TYPE_INVALID")]
4545    Invalid,
4546    /// entry is a title (i.e. a part of a sequence)
4547    #[doc(alias = "GST_TOC_ENTRY_TYPE_TITLE")]
4548    Title,
4549    /// entry is a track (i.e. a part of a sequence)
4550    #[doc(alias = "GST_TOC_ENTRY_TYPE_TRACK")]
4551    Track,
4552    /// entry is a chapter (i.e. a part of a sequence)
4553    #[doc(alias = "GST_TOC_ENTRY_TYPE_CHAPTER")]
4554    Chapter,
4555    #[doc(hidden)]
4556    __Unknown(i32),
4557}
4558
4559impl TocEntryType {
4560    pub fn nick<'a>(self) -> &'a GStr {
4561        unsafe {
4562            GStr::from_ptr(
4563                ffi::gst_toc_entry_type_get_nick(self.into_glib())
4564                    .as_ref()
4565                    .expect("gst_toc_entry_type_get_nick returned NULL"),
4566            )
4567        }
4568    }
4569}
4570
4571#[doc(hidden)]
4572impl IntoGlib for TocEntryType {
4573    type GlibType = ffi::GstTocEntryType;
4574
4575    #[inline]
4576    fn into_glib(self) -> ffi::GstTocEntryType {
4577        match self {
4578            Self::Angle => ffi::GST_TOC_ENTRY_TYPE_ANGLE,
4579            Self::Version => ffi::GST_TOC_ENTRY_TYPE_VERSION,
4580            Self::Edition => ffi::GST_TOC_ENTRY_TYPE_EDITION,
4581            Self::Invalid => ffi::GST_TOC_ENTRY_TYPE_INVALID,
4582            Self::Title => ffi::GST_TOC_ENTRY_TYPE_TITLE,
4583            Self::Track => ffi::GST_TOC_ENTRY_TYPE_TRACK,
4584            Self::Chapter => ffi::GST_TOC_ENTRY_TYPE_CHAPTER,
4585            Self::__Unknown(value) => value,
4586        }
4587    }
4588}
4589
4590#[doc(hidden)]
4591impl FromGlib<ffi::GstTocEntryType> for TocEntryType {
4592    #[inline]
4593    unsafe fn from_glib(value: ffi::GstTocEntryType) -> Self {
4594        skip_assert_initialized!();
4595
4596        match value {
4597            ffi::GST_TOC_ENTRY_TYPE_ANGLE => Self::Angle,
4598            ffi::GST_TOC_ENTRY_TYPE_VERSION => Self::Version,
4599            ffi::GST_TOC_ENTRY_TYPE_EDITION => Self::Edition,
4600            ffi::GST_TOC_ENTRY_TYPE_INVALID => Self::Invalid,
4601            ffi::GST_TOC_ENTRY_TYPE_TITLE => Self::Title,
4602            ffi::GST_TOC_ENTRY_TYPE_TRACK => Self::Track,
4603            ffi::GST_TOC_ENTRY_TYPE_CHAPTER => Self::Chapter,
4604            value => Self::__Unknown(value),
4605        }
4606    }
4607}
4608
4609impl StaticType for TocEntryType {
4610    #[inline]
4611    #[doc(alias = "gst_toc_entry_type_get_type")]
4612    fn static_type() -> glib::Type {
4613        unsafe { from_glib(ffi::gst_toc_entry_type_get_type()) }
4614    }
4615}
4616
4617impl glib::HasParamSpec for TocEntryType {
4618    type ParamSpec = glib::ParamSpecEnum;
4619    type SetValue = Self;
4620    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
4621
4622    fn param_spec_builder() -> Self::BuilderFn {
4623        Self::ParamSpec::builder_with_default
4624    }
4625}
4626
4627impl glib::value::ValueType for TocEntryType {
4628    type Type = Self;
4629}
4630
4631unsafe impl<'a> glib::value::FromValue<'a> for TocEntryType {
4632    type Checker = glib::value::GenericValueTypeChecker<Self>;
4633
4634    #[inline]
4635    unsafe fn from_value(value: &'a glib::Value) -> Self {
4636        skip_assert_initialized!();
4637        unsafe { from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) }
4638    }
4639}
4640
4641impl ToValue for TocEntryType {
4642    #[inline]
4643    fn to_value(&self) -> glib::Value {
4644        let mut value = glib::Value::for_value_type::<Self>();
4645        unsafe {
4646            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
4647        }
4648        value
4649    }
4650
4651    #[inline]
4652    fn value_type(&self) -> glib::Type {
4653        Self::static_type()
4654    }
4655}
4656
4657impl From<TocEntryType> for glib::Value {
4658    #[inline]
4659    fn from(v: TocEntryType) -> Self {
4660        skip_assert_initialized!();
4661        ToValue::to_value(&v)
4662    }
4663}
4664
4665/// How a [`TocEntry`][crate::TocEntry] should be repeated. By default, entries are played a
4666/// single time.
4667#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
4668#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy)]
4669#[non_exhaustive]
4670#[doc(alias = "GstTocLoopType")]
4671pub enum TocLoopType {
4672    /// single forward playback
4673    #[doc(alias = "GST_TOC_LOOP_NONE")]
4674    None,
4675    /// repeat forward
4676    #[doc(alias = "GST_TOC_LOOP_FORWARD")]
4677    Forward,
4678    /// repeat backward
4679    #[doc(alias = "GST_TOC_LOOP_REVERSE")]
4680    Reverse,
4681    /// repeat forward and backward
4682    #[doc(alias = "GST_TOC_LOOP_PING_PONG")]
4683    PingPong,
4684    #[doc(hidden)]
4685    __Unknown(i32),
4686}
4687
4688#[doc(hidden)]
4689impl IntoGlib for TocLoopType {
4690    type GlibType = ffi::GstTocLoopType;
4691
4692    #[inline]
4693    fn into_glib(self) -> ffi::GstTocLoopType {
4694        match self {
4695            Self::None => ffi::GST_TOC_LOOP_NONE,
4696            Self::Forward => ffi::GST_TOC_LOOP_FORWARD,
4697            Self::Reverse => ffi::GST_TOC_LOOP_REVERSE,
4698            Self::PingPong => ffi::GST_TOC_LOOP_PING_PONG,
4699            Self::__Unknown(value) => value,
4700        }
4701    }
4702}
4703
4704#[doc(hidden)]
4705impl FromGlib<ffi::GstTocLoopType> for TocLoopType {
4706    #[inline]
4707    unsafe fn from_glib(value: ffi::GstTocLoopType) -> Self {
4708        skip_assert_initialized!();
4709
4710        match value {
4711            ffi::GST_TOC_LOOP_NONE => Self::None,
4712            ffi::GST_TOC_LOOP_FORWARD => Self::Forward,
4713            ffi::GST_TOC_LOOP_REVERSE => Self::Reverse,
4714            ffi::GST_TOC_LOOP_PING_PONG => Self::PingPong,
4715            value => Self::__Unknown(value),
4716        }
4717    }
4718}
4719
4720impl StaticType for TocLoopType {
4721    #[inline]
4722    #[doc(alias = "gst_toc_loop_type_get_type")]
4723    fn static_type() -> glib::Type {
4724        unsafe { from_glib(ffi::gst_toc_loop_type_get_type()) }
4725    }
4726}
4727
4728impl glib::HasParamSpec for TocLoopType {
4729    type ParamSpec = glib::ParamSpecEnum;
4730    type SetValue = Self;
4731    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
4732
4733    fn param_spec_builder() -> Self::BuilderFn {
4734        Self::ParamSpec::builder_with_default
4735    }
4736}
4737
4738impl glib::value::ValueType for TocLoopType {
4739    type Type = Self;
4740}
4741
4742unsafe impl<'a> glib::value::FromValue<'a> for TocLoopType {
4743    type Checker = glib::value::GenericValueTypeChecker<Self>;
4744
4745    #[inline]
4746    unsafe fn from_value(value: &'a glib::Value) -> Self {
4747        skip_assert_initialized!();
4748        unsafe { from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) }
4749    }
4750}
4751
4752impl ToValue for TocLoopType {
4753    #[inline]
4754    fn to_value(&self) -> glib::Value {
4755        let mut value = glib::Value::for_value_type::<Self>();
4756        unsafe {
4757            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
4758        }
4759        value
4760    }
4761
4762    #[inline]
4763    fn value_type(&self) -> glib::Type {
4764        Self::static_type()
4765    }
4766}
4767
4768impl From<TocLoopType> for glib::Value {
4769    #[inline]
4770    fn from(v: TocLoopType) -> Self {
4771        skip_assert_initialized!();
4772        ToValue::to_value(&v)
4773    }
4774}
4775
4776/// The scope of a TOC.
4777#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
4778#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy)]
4779#[non_exhaustive]
4780#[doc(alias = "GstTocScope")]
4781pub enum TocScope {
4782    /// global TOC representing all selectable options
4783    ///  (this is what applications are usually interested in)
4784    #[doc(alias = "GST_TOC_SCOPE_GLOBAL")]
4785    Global,
4786    /// TOC for the currently active/selected stream
4787    ///  (this is a TOC representing the current stream from start to EOS,
4788    ///  and is what a TOC writer / muxer is usually interested in; it will
4789    ///  usually be a subset of the global TOC, e.g. just the chapters of
4790    ///  the current title, or the chapters selected for playback from the
4791    ///  current title)
4792    #[doc(alias = "GST_TOC_SCOPE_CURRENT")]
4793    Current,
4794    #[doc(hidden)]
4795    __Unknown(i32),
4796}
4797
4798#[doc(hidden)]
4799impl IntoGlib for TocScope {
4800    type GlibType = ffi::GstTocScope;
4801
4802    #[inline]
4803    fn into_glib(self) -> ffi::GstTocScope {
4804        match self {
4805            Self::Global => ffi::GST_TOC_SCOPE_GLOBAL,
4806            Self::Current => ffi::GST_TOC_SCOPE_CURRENT,
4807            Self::__Unknown(value) => value,
4808        }
4809    }
4810}
4811
4812#[doc(hidden)]
4813impl FromGlib<ffi::GstTocScope> for TocScope {
4814    #[inline]
4815    unsafe fn from_glib(value: ffi::GstTocScope) -> Self {
4816        skip_assert_initialized!();
4817
4818        match value {
4819            ffi::GST_TOC_SCOPE_GLOBAL => Self::Global,
4820            ffi::GST_TOC_SCOPE_CURRENT => Self::Current,
4821            value => Self::__Unknown(value),
4822        }
4823    }
4824}
4825
4826impl StaticType for TocScope {
4827    #[inline]
4828    #[doc(alias = "gst_toc_scope_get_type")]
4829    fn static_type() -> glib::Type {
4830        unsafe { from_glib(ffi::gst_toc_scope_get_type()) }
4831    }
4832}
4833
4834impl glib::HasParamSpec for TocScope {
4835    type ParamSpec = glib::ParamSpecEnum;
4836    type SetValue = Self;
4837    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
4838
4839    fn param_spec_builder() -> Self::BuilderFn {
4840        Self::ParamSpec::builder_with_default
4841    }
4842}
4843
4844impl glib::value::ValueType for TocScope {
4845    type Type = Self;
4846}
4847
4848unsafe impl<'a> glib::value::FromValue<'a> for TocScope {
4849    type Checker = glib::value::GenericValueTypeChecker<Self>;
4850
4851    #[inline]
4852    unsafe fn from_value(value: &'a glib::Value) -> Self {
4853        skip_assert_initialized!();
4854        unsafe { from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) }
4855    }
4856}
4857
4858impl ToValue for TocScope {
4859    #[inline]
4860    fn to_value(&self) -> glib::Value {
4861        let mut value = glib::Value::for_value_type::<Self>();
4862        unsafe {
4863            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
4864        }
4865        value
4866    }
4867
4868    #[inline]
4869    fn value_type(&self) -> glib::Type {
4870        Self::static_type()
4871    }
4872}
4873
4874impl From<TocScope> for glib::Value {
4875    #[inline]
4876    fn from(v: TocScope) -> Self {
4877        skip_assert_initialized!();
4878        ToValue::to_value(&v)
4879    }
4880}
4881
4882/// The probability of the typefind function. Higher values have more certainty
4883/// in doing a reliable typefind.
4884#[derive(Debug, Clone, Copy)]
4885#[non_exhaustive]
4886#[doc(alias = "GstTypeFindProbability")]
4887pub enum TypeFindProbability {
4888    /// type undetected.
4889    #[doc(alias = "GST_TYPE_FIND_NONE")]
4890    None,
4891    /// unlikely typefind.
4892    #[doc(alias = "GST_TYPE_FIND_MINIMUM")]
4893    Minimum,
4894    /// possible type detected.
4895    #[doc(alias = "GST_TYPE_FIND_POSSIBLE")]
4896    Possible,
4897    /// likely a type was detected.
4898    #[doc(alias = "GST_TYPE_FIND_LIKELY")]
4899    Likely,
4900    /// nearly certain that a type was detected.
4901    #[doc(alias = "GST_TYPE_FIND_NEARLY_CERTAIN")]
4902    NearlyCertain,
4903    /// very certain a type was detected.
4904    #[doc(alias = "GST_TYPE_FIND_MAXIMUM")]
4905    Maximum,
4906    #[doc(hidden)]
4907    __Unknown(i32),
4908}
4909
4910#[doc(hidden)]
4911impl IntoGlib for TypeFindProbability {
4912    type GlibType = ffi::GstTypeFindProbability;
4913
4914    #[inline]
4915    fn into_glib(self) -> ffi::GstTypeFindProbability {
4916        match self {
4917            Self::None => ffi::GST_TYPE_FIND_NONE,
4918            Self::Minimum => ffi::GST_TYPE_FIND_MINIMUM,
4919            Self::Possible => ffi::GST_TYPE_FIND_POSSIBLE,
4920            Self::Likely => ffi::GST_TYPE_FIND_LIKELY,
4921            Self::NearlyCertain => ffi::GST_TYPE_FIND_NEARLY_CERTAIN,
4922            Self::Maximum => ffi::GST_TYPE_FIND_MAXIMUM,
4923            Self::__Unknown(value) => value,
4924        }
4925    }
4926}
4927
4928#[doc(hidden)]
4929impl FromGlib<ffi::GstTypeFindProbability> for TypeFindProbability {
4930    #[inline]
4931    unsafe fn from_glib(value: ffi::GstTypeFindProbability) -> Self {
4932        skip_assert_initialized!();
4933
4934        match value {
4935            ffi::GST_TYPE_FIND_NONE => Self::None,
4936            ffi::GST_TYPE_FIND_MINIMUM => Self::Minimum,
4937            ffi::GST_TYPE_FIND_POSSIBLE => Self::Possible,
4938            ffi::GST_TYPE_FIND_LIKELY => Self::Likely,
4939            ffi::GST_TYPE_FIND_NEARLY_CERTAIN => Self::NearlyCertain,
4940            ffi::GST_TYPE_FIND_MAXIMUM => Self::Maximum,
4941            value => Self::__Unknown(value),
4942        }
4943    }
4944}
4945
4946impl StaticType for TypeFindProbability {
4947    #[inline]
4948    #[doc(alias = "gst_type_find_probability_get_type")]
4949    fn static_type() -> glib::Type {
4950        unsafe { from_glib(ffi::gst_type_find_probability_get_type()) }
4951    }
4952}
4953
4954impl glib::HasParamSpec for TypeFindProbability {
4955    type ParamSpec = glib::ParamSpecEnum;
4956    type SetValue = Self;
4957    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
4958
4959    fn param_spec_builder() -> Self::BuilderFn {
4960        Self::ParamSpec::builder_with_default
4961    }
4962}
4963
4964impl glib::value::ValueType for TypeFindProbability {
4965    type Type = Self;
4966}
4967
4968unsafe impl<'a> glib::value::FromValue<'a> for TypeFindProbability {
4969    type Checker = glib::value::GenericValueTypeChecker<Self>;
4970
4971    #[inline]
4972    unsafe fn from_value(value: &'a glib::Value) -> Self {
4973        skip_assert_initialized!();
4974        unsafe { from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) }
4975    }
4976}
4977
4978impl ToValue for TypeFindProbability {
4979    #[inline]
4980    fn to_value(&self) -> glib::Value {
4981        let mut value = glib::Value::for_value_type::<Self>();
4982        unsafe {
4983            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
4984        }
4985        value
4986    }
4987
4988    #[inline]
4989    fn value_type(&self) -> glib::Type {
4990        Self::static_type()
4991    }
4992}
4993
4994impl From<TypeFindProbability> for glib::Value {
4995    #[inline]
4996    fn from(v: TypeFindProbability) -> Self {
4997        skip_assert_initialized!();
4998        ToValue::to_value(&v)
4999    }
5000}
5001
5002/// Different URI-related errors that can occur.
5003#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
5004#[non_exhaustive]
5005#[doc(alias = "GstURIError")]
5006pub enum URIError {
5007    /// The protocol is not supported
5008    #[doc(alias = "GST_URI_ERROR_UNSUPPORTED_PROTOCOL")]
5009    UnsupportedProtocol,
5010    /// There was a problem with the URI
5011    #[doc(alias = "GST_URI_ERROR_BAD_URI")]
5012    BadUri,
5013    /// Could not set or change the URI because the
5014    ///  URI handler was in a state where that is not possible or not permitted
5015    #[doc(alias = "GST_URI_ERROR_BAD_STATE")]
5016    BadState,
5017    /// There was a problem with the entity that
5018    ///  the URI references
5019    #[doc(alias = "GST_URI_ERROR_BAD_REFERENCE")]
5020    BadReference,
5021    #[doc(hidden)]
5022    __Unknown(i32),
5023}
5024
5025#[doc(hidden)]
5026impl IntoGlib for URIError {
5027    type GlibType = ffi::GstURIError;
5028
5029    #[inline]
5030    fn into_glib(self) -> ffi::GstURIError {
5031        match self {
5032            Self::UnsupportedProtocol => ffi::GST_URI_ERROR_UNSUPPORTED_PROTOCOL,
5033            Self::BadUri => ffi::GST_URI_ERROR_BAD_URI,
5034            Self::BadState => ffi::GST_URI_ERROR_BAD_STATE,
5035            Self::BadReference => ffi::GST_URI_ERROR_BAD_REFERENCE,
5036            Self::__Unknown(value) => value,
5037        }
5038    }
5039}
5040
5041#[doc(hidden)]
5042impl FromGlib<ffi::GstURIError> for URIError {
5043    #[inline]
5044    unsafe fn from_glib(value: ffi::GstURIError) -> Self {
5045        skip_assert_initialized!();
5046
5047        match value {
5048            ffi::GST_URI_ERROR_UNSUPPORTED_PROTOCOL => Self::UnsupportedProtocol,
5049            ffi::GST_URI_ERROR_BAD_URI => Self::BadUri,
5050            ffi::GST_URI_ERROR_BAD_STATE => Self::BadState,
5051            ffi::GST_URI_ERROR_BAD_REFERENCE => Self::BadReference,
5052            value => Self::__Unknown(value),
5053        }
5054    }
5055}
5056
5057impl glib::error::ErrorDomain for URIError {
5058    #[inline]
5059    fn domain() -> glib::Quark {
5060        skip_assert_initialized!();
5061
5062        unsafe { from_glib(ffi::gst_uri_error_quark()) }
5063    }
5064
5065    #[inline]
5066    fn code(self) -> i32 {
5067        self.into_glib()
5068    }
5069
5070    #[inline]
5071    #[allow(clippy::match_single_binding)]
5072    fn from(code: i32) -> Option<Self> {
5073        skip_assert_initialized!();
5074        match unsafe { from_glib(code) } {
5075            value => Some(value),
5076        }
5077    }
5078}
5079
5080impl StaticType for URIError {
5081    #[inline]
5082    #[doc(alias = "gst_uri_error_get_type")]
5083    fn static_type() -> glib::Type {
5084        unsafe { from_glib(ffi::gst_uri_error_get_type()) }
5085    }
5086}
5087
5088impl glib::HasParamSpec for URIError {
5089    type ParamSpec = glib::ParamSpecEnum;
5090    type SetValue = Self;
5091    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
5092
5093    fn param_spec_builder() -> Self::BuilderFn {
5094        Self::ParamSpec::builder_with_default
5095    }
5096}
5097
5098impl glib::value::ValueType for URIError {
5099    type Type = Self;
5100}
5101
5102unsafe impl<'a> glib::value::FromValue<'a> for URIError {
5103    type Checker = glib::value::GenericValueTypeChecker<Self>;
5104
5105    #[inline]
5106    unsafe fn from_value(value: &'a glib::Value) -> Self {
5107        skip_assert_initialized!();
5108        unsafe { from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) }
5109    }
5110}
5111
5112impl ToValue for URIError {
5113    #[inline]
5114    fn to_value(&self) -> glib::Value {
5115        let mut value = glib::Value::for_value_type::<Self>();
5116        unsafe {
5117            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
5118        }
5119        value
5120    }
5121
5122    #[inline]
5123    fn value_type(&self) -> glib::Type {
5124        Self::static_type()
5125    }
5126}
5127
5128impl From<URIError> for glib::Value {
5129    #[inline]
5130    fn from(v: URIError) -> Self {
5131        skip_assert_initialized!();
5132        ToValue::to_value(&v)
5133    }
5134}
5135
5136/// The different types of URI direction.
5137#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
5138#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy)]
5139#[repr(i32)]
5140#[doc(alias = "GstURIType")]
5141pub enum URIType {
5142    /// The URI direction is unknown
5143    #[doc(alias = "GST_URI_UNKNOWN")]
5144    Unknown = ffi::GST_URI_UNKNOWN,
5145    /// The URI is a consumer.
5146    #[doc(alias = "GST_URI_SINK")]
5147    Sink = ffi::GST_URI_SINK,
5148    /// The URI is a producer.
5149    #[doc(alias = "GST_URI_SRC")]
5150    Src = ffi::GST_URI_SRC,
5151}
5152
5153#[doc(hidden)]
5154impl IntoGlib for URIType {
5155    type GlibType = ffi::GstURIType;
5156
5157    #[inline]
5158    fn into_glib(self) -> ffi::GstURIType {
5159        self as ffi::GstURIType
5160    }
5161}
5162
5163#[doc(hidden)]
5164impl FromGlib<ffi::GstURIType> for URIType {
5165    #[inline]
5166    unsafe fn from_glib(value: ffi::GstURIType) -> Self {
5167        skip_assert_initialized!();
5168
5169        debug_assert!([ffi::GST_URI_UNKNOWN, ffi::GST_URI_SINK, ffi::GST_URI_SRC].contains(&value));
5170        unsafe { std::mem::transmute(value) }
5171    }
5172}
5173
5174impl StaticType for URIType {
5175    #[inline]
5176    #[doc(alias = "gst_uri_type_get_type")]
5177    fn static_type() -> glib::Type {
5178        unsafe { from_glib(ffi::gst_uri_type_get_type()) }
5179    }
5180}
5181
5182impl glib::HasParamSpec for URIType {
5183    type ParamSpec = glib::ParamSpecEnum;
5184    type SetValue = Self;
5185    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
5186
5187    fn param_spec_builder() -> Self::BuilderFn {
5188        Self::ParamSpec::builder_with_default
5189    }
5190}
5191
5192impl glib::value::ValueType for URIType {
5193    type Type = Self;
5194}
5195
5196unsafe impl<'a> glib::value::FromValue<'a> for URIType {
5197    type Checker = glib::value::GenericValueTypeChecker<Self>;
5198
5199    #[inline]
5200    unsafe fn from_value(value: &'a glib::Value) -> Self {
5201        skip_assert_initialized!();
5202        unsafe { from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) }
5203    }
5204}
5205
5206impl ToValue for URIType {
5207    #[inline]
5208    fn to_value(&self) -> glib::Value {
5209        let mut value = glib::Value::for_value_type::<Self>();
5210        unsafe {
5211            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
5212        }
5213        value
5214    }
5215
5216    #[inline]
5217    fn value_type(&self) -> glib::Type {
5218        Self::static_type()
5219    }
5220}
5221
5222impl From<URIType> for glib::Value {
5223    #[inline]
5224    fn from(v: URIType) -> Self {
5225        skip_assert_initialized!();
5226        ToValue::to_value(&v)
5227    }
5228}