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
use super::bindings;
use crate::error::*;
use crate::format::*;
pub struct InputFormat {
pub profile: Profile,
pub min_width: u32,
pub min_height: u32,
pub max_width: u32,
pub max_height: u32,
}
impl InputFormat {
pub(crate) fn new(f: &bindings::vda_input_format_t) -> Result<InputFormat> {
let profile = Profile::n(f.profile).ok_or(Error::UnknownProfile(f.profile))?;
Ok(InputFormat {
profile,
min_width: f.min_width,
min_height: f.min_height,
max_width: f.max_width,
max_height: f.max_height,
})
}
pub(crate) unsafe fn from_raw_parts(
data: *const bindings::vda_input_format_t,
len: usize,
) -> Result<Vec<Self>> {
validate_formats(data, len, Self::new)
}
}