use super::{KeyId, KeyIdSystemType};
use crate::{Error, Result};
use prost::Message;
include!(concat!(env!("OUT_DIR"), "/widevine.rs"));
pub(super) fn parse(data: &[u8]) -> Result<impl IntoIterator<Item = KeyId>> {
let wv = WidevinePsshData::decode(data).map_err(|x| {
Error::new_decode(format!("PSSH box data as valid widevine data.\n\n{:#?}", x))
})?;
Ok(wv.key_ids.into_iter().map(|x| KeyId {
system_type: KeyIdSystemType::WideVine,
value: hex::encode(x),
}))
}