1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
// DO NOT EDIT

use bitflags::bitflags;
use glib::translate::*;
use glib::value::FromValue;
use glib::value::ToValue;
use glib::StaticType;
use glib::Type;

bitflags! {
    /// You can use these flags to control what is serialized by
    /// [`DiscovererInfo::to_variant()`][crate::DiscovererInfo::to_variant()]
    #[doc(alias = "GstDiscovererSerializeFlags")]
    pub struct DiscovererSerializeFlags: u32 {
        /// Serialize the caps for each stream
        #[doc(alias = "GST_DISCOVERER_SERIALIZE_CAPS")]
        const CAPS = ffi::GST_DISCOVERER_SERIALIZE_CAPS as u32;
        /// Serialize the tags for each stream
        #[doc(alias = "GST_DISCOVERER_SERIALIZE_TAGS")]
        const TAGS = ffi::GST_DISCOVERER_SERIALIZE_TAGS as u32;
        /// Serialize miscellaneous information for each stream
        #[doc(alias = "GST_DISCOVERER_SERIALIZE_MISC")]
        const MISC = ffi::GST_DISCOVERER_SERIALIZE_MISC as u32;
    }
}

#[doc(hidden)]
impl IntoGlib for DiscovererSerializeFlags {
    type GlibType = ffi::GstDiscovererSerializeFlags;

    fn into_glib(self) -> ffi::GstDiscovererSerializeFlags {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<ffi::GstDiscovererSerializeFlags> for DiscovererSerializeFlags {
    unsafe fn from_glib(value: ffi::GstDiscovererSerializeFlags) -> Self {
        skip_assert_initialized!();
        Self::from_bits_truncate(value)
    }
}

impl StaticType for DiscovererSerializeFlags {
    fn static_type() -> Type {
        unsafe { from_glib(ffi::gst_discoverer_serialize_flags_get_type()) }
    }
}

impl glib::value::ValueType for DiscovererSerializeFlags {
    type Type = Self;
}

unsafe impl<'a> FromValue<'a> for DiscovererSerializeFlags {
    type Checker = glib::value::GenericValueTypeChecker<Self>;

    unsafe fn from_value(value: &'a glib::Value) -> Self {
        skip_assert_initialized!();
        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
    }
}

impl ToValue for DiscovererSerializeFlags {
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}