use objc2_core_foundation::CFRetained;
use objc2_core_media::CMFormatDescription;
use crate::{codecs::H265Config, VideoError};
pub(crate) fn format_description(
config: &H265Config,
) -> Result<CFRetained<CMFormatDescription>, VideoError> {
super::super::ffi::h265_format_description([
config.vps.as_ref(),
config.sps.as_ref(),
config.pps.as_ref(),
])
}
#[cfg(test)]
mod tests {
use crate::codecs::H265Config;
#[test]
fn creates_core_media_format_description() {
let config = H265Config::new(
vec![
0x40, 0x01, 0x0c, 0x01, 0xff, 0xff, 0x01, 0x60, 0x00, 0x00, 0x03, 0x00, 0x90, 0x00,
0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x3c, 0x95, 0x98, 0x09,
],
vec![
0x42, 0x01, 0x01, 0x01, 0x60, 0x00, 0x00, 0x03, 0x00, 0x90, 0x00, 0x00, 0x03, 0x00,
0x00, 0x03, 0x00, 0x3c, 0xa0, 0x0a, 0x08, 0x0f, 0x1d, 0xf9, 0x65, 0x66, 0x92, 0x4c,
0xaf, 0xff, 0x16, 0x9e, 0x16, 0x87, 0x68, 0x08, 0x00, 0x00, 0x03, 0x00, 0x08, 0x00,
0x00, 0x03, 0x00, 0xc8, 0x40,
],
vec![0x44, 0x01, 0xc1, 0x72, 0xb4, 0x62, 0x40],
)
.unwrap();
let result = super::format_description(&config);
assert!(result.is_ok(), "{result:?}");
}
}