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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT

use ffi;
use glib;
use glib::translate::*;
use glib_ffi;
use gobject_ffi;
use gst;
use std::mem;
use std::ptr;

glib_wrapper! {
    pub struct Adapter(Object<ffi::GstAdapter, ffi::GstAdapterClass>);

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

impl Adapter {
    pub fn new() -> Adapter {
        assert_initialized_main_thread!();
        unsafe {
            from_glib_full(ffi::gst_adapter_new())
        }
    }

    pub fn available(&self) -> usize {
        unsafe {
            ffi::gst_adapter_available(self.to_glib_none().0)
        }
    }

    pub fn available_fast(&self) -> usize {
        unsafe {
            ffi::gst_adapter_available_fast(self.to_glib_none().0)
        }
    }

    pub fn clear(&self) {
        unsafe {
            ffi::gst_adapter_clear(self.to_glib_none().0);
        }
    }

    pub fn copy_bytes(&self, offset: usize, size: usize) -> Option<glib::Bytes> {
        unsafe {
            from_glib_full(ffi::gst_adapter_copy_bytes(self.to_glib_none().0, offset, size))
        }
    }

    pub fn distance_from_discont(&self) -> u64 {
        unsafe {
            ffi::gst_adapter_distance_from_discont(self.to_glib_none().0)
        }
    }

    #[cfg(any(feature = "v1_10", feature = "dox"))]
    pub fn dts_at_discont(&self) -> gst::ClockTime {
        unsafe {
            from_glib(ffi::gst_adapter_dts_at_discont(self.to_glib_none().0))
        }
    }

    pub fn flush(&self, flush: usize) {
        unsafe {
            ffi::gst_adapter_flush(self.to_glib_none().0, flush);
        }
    }

    pub fn get_buffer(&self, nbytes: usize) -> Option<gst::Buffer> {
        unsafe {
            from_glib_full(ffi::gst_adapter_get_buffer(self.to_glib_none().0, nbytes))
        }
    }

    pub fn get_buffer_fast(&self, nbytes: usize) -> Option<gst::Buffer> {
        unsafe {
            from_glib_full(ffi::gst_adapter_get_buffer_fast(self.to_glib_none().0, nbytes))
        }
    }

    pub fn get_buffer_list(&self, nbytes: usize) -> Option<gst::BufferList> {
        unsafe {
            from_glib_full(ffi::gst_adapter_get_buffer_list(self.to_glib_none().0, nbytes))
        }
    }

    pub fn get_list(&self, nbytes: usize) -> Vec<gst::Buffer> {
        unsafe {
            FromGlibPtrContainer::from_glib_full(ffi::gst_adapter_get_list(self.to_glib_none().0, nbytes))
        }
    }

    pub fn masked_scan_uint32(&self, mask: u32, pattern: u32, offset: usize, size: usize) -> isize {
        unsafe {
            ffi::gst_adapter_masked_scan_uint32(self.to_glib_none().0, mask, pattern, offset, size)
        }
    }

    pub fn masked_scan_uint32_peek(&self, mask: u32, pattern: u32, offset: usize, size: usize) -> (isize, u32) {
        unsafe {
            let mut value = mem::uninitialized();
            let ret = ffi::gst_adapter_masked_scan_uint32_peek(self.to_glib_none().0, mask, pattern, offset, size, &mut value);
            (ret, value)
        }
    }

    #[cfg(any(feature = "v1_10", feature = "dox"))]
    pub fn offset_at_discont(&self) -> u64 {
        unsafe {
            ffi::gst_adapter_offset_at_discont(self.to_glib_none().0)
        }
    }

    pub fn prev_dts(&self) -> (gst::ClockTime, u64) {
        unsafe {
            let mut distance = mem::uninitialized();
            let ret = from_glib(ffi::gst_adapter_prev_dts(self.to_glib_none().0, &mut distance));
            (ret, distance)
        }
    }

    pub fn prev_dts_at_offset(&self, offset: usize) -> (gst::ClockTime, u64) {
        unsafe {
            let mut distance = mem::uninitialized();
            let ret = from_glib(ffi::gst_adapter_prev_dts_at_offset(self.to_glib_none().0, offset, &mut distance));
            (ret, distance)
        }
    }

    #[cfg(any(feature = "v1_10", feature = "dox"))]
    pub fn prev_offset(&self) -> (u64, u64) {
        unsafe {
            let mut distance = mem::uninitialized();
            let ret = ffi::gst_adapter_prev_offset(self.to_glib_none().0, &mut distance);
            (ret, distance)
        }
    }

    pub fn prev_pts(&self) -> (gst::ClockTime, u64) {
        unsafe {
            let mut distance = mem::uninitialized();
            let ret = from_glib(ffi::gst_adapter_prev_pts(self.to_glib_none().0, &mut distance));
            (ret, distance)
        }
    }

    pub fn prev_pts_at_offset(&self, offset: usize) -> (gst::ClockTime, u64) {
        unsafe {
            let mut distance = mem::uninitialized();
            let ret = from_glib(ffi::gst_adapter_prev_pts_at_offset(self.to_glib_none().0, offset, &mut distance));
            (ret, distance)
        }
    }

    #[cfg(any(feature = "v1_10", feature = "dox"))]
    pub fn pts_at_discont(&self) -> gst::ClockTime {
        unsafe {
            from_glib(ffi::gst_adapter_pts_at_discont(self.to_glib_none().0))
        }
    }

    pub fn take_buffer(&self, nbytes: usize) -> Option<gst::Buffer> {
        unsafe {
            from_glib_full(ffi::gst_adapter_take_buffer(self.to_glib_none().0, nbytes))
        }
    }

    pub fn take_buffer_fast(&self, nbytes: usize) -> Option<gst::Buffer> {
        unsafe {
            from_glib_full(ffi::gst_adapter_take_buffer_fast(self.to_glib_none().0, nbytes))
        }
    }

    pub fn take_buffer_list(&self, nbytes: usize) -> Option<gst::BufferList> {
        unsafe {
            from_glib_full(ffi::gst_adapter_take_buffer_list(self.to_glib_none().0, nbytes))
        }
    }

    pub fn take_list(&self, nbytes: usize) -> Vec<gst::Buffer> {
        unsafe {
            FromGlibPtrContainer::from_glib_full(ffi::gst_adapter_take_list(self.to_glib_none().0, nbytes))
        }
    }
}

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