1 | // Take a look at the license at the top of the repository in the LICENSE file. |
2 | |
3 | use std::ptr; |
4 | |
5 | use glib::{prelude::*, translate::*}; |
6 | |
7 | use crate::{Buffer, BufferList, FlowError, FlowSuccess, Pad, ProxyPad}; |
8 | |
9 | impl ProxyPad { |
10 | #[doc (alias = "gst_proxy_pad_chain_default" )] |
11 | pub fn chain_default<O: IsA<ProxyPad>>( |
12 | pad: &O, |
13 | parent: Option<&impl IsA<crate::Object>>, |
14 | buffer: Buffer, |
15 | ) -> Result<FlowSuccess, FlowError> { |
16 | skip_assert_initialized!(); |
17 | unsafe { |
18 | try_from_glib(ffi::gst_proxy_pad_chain_default( |
19 | pad.as_ptr() as *mut ffi::GstPad, |
20 | parent.map(|p| p.as_ref()).to_glib_none().0, |
21 | buffer.into_glib_ptr(), |
22 | )) |
23 | } |
24 | } |
25 | |
26 | #[doc (alias = "gst_proxy_pad_chain_list_default" )] |
27 | pub fn chain_list_default<O: IsA<ProxyPad>>( |
28 | pad: &O, |
29 | parent: Option<&impl IsA<crate::Object>>, |
30 | list: BufferList, |
31 | ) -> Result<FlowSuccess, FlowError> { |
32 | skip_assert_initialized!(); |
33 | unsafe { |
34 | try_from_glib(ffi::gst_proxy_pad_chain_list_default( |
35 | pad.as_ptr() as *mut ffi::GstPad, |
36 | parent.map(|p| p.as_ref()).to_glib_none().0, |
37 | list.into_glib_ptr(), |
38 | )) |
39 | } |
40 | } |
41 | |
42 | #[doc (alias = "gst_proxy_pad_getrange_default" )] |
43 | pub fn getrange_default<O: IsA<ProxyPad>>( |
44 | pad: &O, |
45 | parent: Option<&impl IsA<crate::Object>>, |
46 | offset: u64, |
47 | size: u32, |
48 | ) -> Result<Buffer, FlowError> { |
49 | skip_assert_initialized!(); |
50 | unsafe { |
51 | let mut buffer = ptr::null_mut(); |
52 | FlowSuccess::try_from_glib(ffi::gst_proxy_pad_getrange_default( |
53 | pad.as_ptr() as *mut ffi::GstPad, |
54 | parent.map(|p| p.as_ref()).to_glib_none().0, |
55 | offset, |
56 | size, |
57 | &mut buffer, |
58 | )) |
59 | .map(|_| from_glib_full(buffer)) |
60 | } |
61 | } |
62 | |
63 | #[doc (alias = "gst_proxy_pad_iterate_internal_links_default" )] |
64 | pub fn iterate_internal_links_default<O: IsA<ProxyPad>>( |
65 | pad: &O, |
66 | parent: Option<&impl IsA<crate::Object>>, |
67 | ) -> Option<crate::Iterator<Pad>> { |
68 | skip_assert_initialized!(); |
69 | unsafe { |
70 | from_glib_full(ffi::gst_proxy_pad_iterate_internal_links_default( |
71 | pad.as_ptr() as *mut ffi::GstPad, |
72 | parent.map(|p| p.as_ref()).to_glib_none().0, |
73 | )) |
74 | } |
75 | } |
76 | } |
77 | |