1 | use super::Context; |
2 | use ffi::*; |
3 | |
4 | #[derive (PartialEq, Eq, Copy, Clone, Debug)] |
5 | pub struct Delay { |
6 | pub seconds: i64, |
7 | pub milliseconds: i64, |
8 | pub input: i64, |
9 | pub output: i64, |
10 | } |
11 | |
12 | impl Delay { |
13 | pub fn from(context: &Context) -> Self { |
14 | unsafe { |
15 | Delay { |
16 | seconds: swr_get_delay(context.as_ptr() as *mut _, 1), |
17 | milliseconds: swr_get_delay(context.as_ptr() as *mut _, 1000), |
18 | input: swr_get_delay(context.as_ptr() as *mut _, i64::from(context.input().rate)), |
19 | output: swr_get_delay(context.as_ptr() as *mut _, i64::from(context.output().rate)), |
20 | } |
21 | } |
22 | } |
23 | } |
24 | |