gstreamer/auto/
enums.rs

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