screencapturekit/stream/configuration/
captured_frames.rs1use super::internal::SCStreamConfiguration;
2use crate::cm::CMTime;
3
4impl SCStreamConfiguration {
5 pub fn set_queue_depth(&mut self, queue_depth: u32) {
7 #[allow(clippy::cast_possible_wrap)]
9 unsafe {
10 crate::ffi::sc_stream_configuration_set_queue_depth(
11 self.as_ptr(),
12 queue_depth as isize,
13 );
14 }
15 }
16
17 pub fn get_queue_depth(&self) -> u32 {
18 #[allow(clippy::cast_sign_loss, clippy::cast_possible_truncation)]
20 unsafe {
21 crate::ffi::sc_stream_configuration_get_queue_depth(self.as_ptr()) as u32
22 }
23 }
24
25 pub fn set_minimum_frame_interval(&mut self, cm_time: &CMTime) {
27 unsafe {
28 crate::ffi::sc_stream_configuration_set_minimum_frame_interval(
29 self.as_ptr(),
30 cm_time.value,
31 cm_time.timescale,
32 cm_time.flags,
33 cm_time.epoch,
34 );
35 }
36 }
37
38 pub fn get_minimum_frame_interval(&self) -> CMTime {
39 unsafe {
40 let mut value: i64 = 0;
41 let mut timescale: i32 = 0;
42 let mut flags: u32 = 0;
43 let mut epoch: i64 = 0;
44
45 crate::ffi::sc_stream_configuration_get_minimum_frame_interval(
46 self.as_ptr(),
47 &mut value,
48 &mut timescale,
49 &mut flags,
50 &mut epoch,
51 );
52
53 CMTime {
54 value,
55 timescale,
56 flags,
57 epoch,
58 }
59 }
60 }
61
62 pub fn set_capture_resolution(&mut self, width: usize, height: usize) {
70 #[allow(clippy::cast_possible_wrap)]
72 unsafe {
73 crate::ffi::sc_stream_configuration_set_capture_resolution(
74 self.as_ptr(),
75 width as isize,
76 height as isize,
77 );
78 }
79 }
80
81 pub fn get_capture_resolution(&self) -> (usize, usize) {
85 #[allow(clippy::cast_sign_loss)]
87 unsafe {
88 let mut width: isize = 0;
89 let mut height: isize = 0;
90 crate::ffi::sc_stream_configuration_get_capture_resolution(
91 self.as_ptr(),
92 &mut width,
93 &mut height,
94 );
95 (width as usize, height as usize)
96 }
97 }
98}