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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
// 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 glib::translate::*;

glib::wrapper! {
    #[doc(alias = "GstAdapter")]
    pub struct Adapter(Object<ffi::GstAdapter, ffi::GstAdapterClass>);

    match fn {
        type_ => || ffi::gst_adapter_get_type(),
    }
}

impl Adapter {
    #[doc(alias = "gst_adapter_new")]
    pub fn new() -> Adapter {
        assert_initialized_main_thread!();
        unsafe { from_glib_full(ffi::gst_adapter_new()) }
    }

    #[doc(alias = "gst_adapter_available")]
    pub fn available(&self) -> usize {
        unsafe { ffi::gst_adapter_available(self.to_glib_none().0) }
    }

    #[doc(alias = "gst_adapter_available_fast")]
    pub fn available_fast(&self) -> usize {
        unsafe { ffi::gst_adapter_available_fast(self.to_glib_none().0) }
    }

    #[doc(alias = "gst_adapter_clear")]
    pub fn clear(&self) {
        unsafe {
            ffi::gst_adapter_clear(self.to_glib_none().0);
        }
    }

    #[doc(alias = "gst_adapter_distance_from_discont")]
    pub fn distance_from_discont(&self) -> u64 {
        unsafe { ffi::gst_adapter_distance_from_discont(self.to_glib_none().0) }
    }

    #[doc(alias = "gst_adapter_dts_at_discont")]
    pub fn dts_at_discont(&self) -> Option<gst::ClockTime> {
        unsafe { from_glib(ffi::gst_adapter_dts_at_discont(self.to_glib_none().0)) }
    }

    #[doc(alias = "gst_adapter_offset_at_discont")]
    pub fn offset_at_discont(&self) -> u64 {
        unsafe { ffi::gst_adapter_offset_at_discont(self.to_glib_none().0) }
    }

    #[doc(alias = "gst_adapter_prev_dts")]
    pub fn prev_dts(&self) -> (Option<gst::ClockTime>, u64) {
        unsafe {
            let mut distance = std::mem::MaybeUninit::uninit();
            let ret = from_glib(ffi::gst_adapter_prev_dts(
                self.to_glib_none().0,
                distance.as_mut_ptr(),
            ));
            (ret, distance.assume_init())
        }
    }

    #[doc(alias = "gst_adapter_prev_dts_at_offset")]
    pub fn prev_dts_at_offset(&self, offset: usize) -> (Option<gst::ClockTime>, u64) {
        unsafe {
            let mut distance = std::mem::MaybeUninit::uninit();
            let ret = from_glib(ffi::gst_adapter_prev_dts_at_offset(
                self.to_glib_none().0,
                offset,
                distance.as_mut_ptr(),
            ));
            (ret, distance.assume_init())
        }
    }

    #[doc(alias = "gst_adapter_prev_offset")]
    pub fn prev_offset(&self) -> (u64, u64) {
        unsafe {
            let mut distance = std::mem::MaybeUninit::uninit();
            let ret = ffi::gst_adapter_prev_offset(self.to_glib_none().0, distance.as_mut_ptr());
            (ret, distance.assume_init())
        }
    }

    #[doc(alias = "gst_adapter_prev_pts")]
    pub fn prev_pts(&self) -> (Option<gst::ClockTime>, u64) {
        unsafe {
            let mut distance = std::mem::MaybeUninit::uninit();
            let ret = from_glib(ffi::gst_adapter_prev_pts(
                self.to_glib_none().0,
                distance.as_mut_ptr(),
            ));
            (ret, distance.assume_init())
        }
    }

    #[doc(alias = "gst_adapter_prev_pts_at_offset")]
    pub fn prev_pts_at_offset(&self, offset: usize) -> (Option<gst::ClockTime>, u64) {
        unsafe {
            let mut distance = std::mem::MaybeUninit::uninit();
            let ret = from_glib(ffi::gst_adapter_prev_pts_at_offset(
                self.to_glib_none().0,
                offset,
                distance.as_mut_ptr(),
            ));
            (ret, distance.assume_init())
        }
    }

    #[doc(alias = "gst_adapter_pts_at_discont")]
    pub fn pts_at_discont(&self) -> Option<gst::ClockTime> {
        unsafe { from_glib(ffi::gst_adapter_pts_at_discont(self.to_glib_none().0)) }
    }
}

impl Default for Adapter {
    fn default() -> Self {
        Self::new()
    }
}