#[derive(hard_xml::XmlWrite, hard_xml::XmlRead, Default, PartialEq, Clone, Debug)]
#[xml(tag = "MediaFiles")]
pub struct MediaFiles<'a> {
#[xml(child = "ClosedCaptionFiles", default)]
pub closed_caption_files: Option<ClosedCaptionFiles<'a>>,
#[xml(child = "MediaFile", default)]
pub media_files: Vec<MediaFile<'a>>,
#[xml(child = "Mezzanine", default)]
pub mezzanines: Vec<Mezzanine<'a>>,
#[xml(child = "InteractiveCreativeFile", default)]
pub interactive_creative_files: Vec<InteractiveCreativeFile<'a>>,
}
#[derive(hard_xml::XmlWrite, hard_xml::XmlRead, Default, PartialEq, Clone, Debug)]
#[xml(tag = "MediaFile")]
pub struct MediaFile<'a> {
#[xml(attr = "id", default)]
pub id: Option<std::borrow::Cow<'a, str>>,
#[xml(attr = "delivery", default)]
pub delivery: DeliveryProtocol,
#[xml(attr = "type", default)]
pub mime_type: std::borrow::Cow<'a, str>,
#[xml(attr = "width", default)]
pub width: i32,
#[xml(attr = "height", default)]
pub height: i32,
#[xml(attr = "codec", default)]
pub codec: Option<std::borrow::Cow<'a, str>>,
#[xml(attr = "bitrate", default)]
pub bitrate: Option<i32>,
#[xml(attr = "minBitrate", default)]
pub min_bitrate: Option<i32>,
#[xml(attr = "maxBitrate", default)]
pub max_bitrate: Option<i32>,
#[xml(attr = "scalable", default)]
pub scalable: Option<bool>,
#[xml(attr = "maintainAspectRatio", default)]
pub maintain_aspect_ratio: Option<bool>,
#[xml(attr = "fileSize", default)]
pub file_size: Option<i32>,
#[xml(attr = "mediaType", default)]
pub media_type: Option<std::borrow::Cow<'a, str>>,
#[deprecated(since = "VAST 4.1")]
#[xml(attr = "apiFramework", default)]
pub api_framework: Option<std::borrow::Cow<'a, str>>,
#[xml(text, cdata, default)]
pub uri: std::borrow::Cow<'a, str>,
}
#[derive(Default, PartialEq, Clone, Debug)]
pub enum DeliveryProtocol {
#[default]
Progressive,
Streaming,
Unknown(crate::UnknownEvent),
}
impl std::str::FromStr for DeliveryProtocol {
type Err = crate::VastParseError;
fn from_str(s: &str) -> Result<Self, Self::Err> {
Ok(match s {
"progressive" => Self::Progressive,
"streaming" => Self::Streaming,
_ => Self::Unknown(crate::UnknownEvent {
body: s.to_string(),
}),
})
}
}
impl std::fmt::Display for DeliveryProtocol {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Self::Progressive => write!(f, "progressive"),
Self::Streaming => write!(f, "streaming"),
Self::Unknown(b) => write!(f, "{}", b.body),
}
}
}
#[derive(hard_xml::XmlWrite, hard_xml::XmlRead, Default, PartialEq, Clone, Debug)]
#[xml(tag = "Mezzanine")]
pub struct Mezzanine<'a> {
#[xml(attr = "id", default)]
pub id: Option<std::borrow::Cow<'a, str>>,
#[xml(attr = "delivery", default)]
pub delivery: DeliveryProtocol,
#[xml(attr = "type", default)]
pub mime_type: std::borrow::Cow<'a, str>,
#[xml(attr = "width", default)]
pub width: i32,
#[xml(attr = "height", default)]
pub height: i32,
#[xml(attr = "codec", default)]
pub codec: Option<std::borrow::Cow<'a, str>>,
#[xml(attr = "fileSize", default)]
pub file_size: Option<i32>,
#[xml(attr = "mediaType", default)]
pub media_type: Option<std::borrow::Cow<'a, str>>,
#[xml(text, cdata, default)]
pub uri: std::borrow::Cow<'a, str>,
}
#[derive(hard_xml::XmlWrite, hard_xml::XmlRead, Default, PartialEq, Clone, Debug)]
#[xml(tag = "InteractiveCreativeFile")]
pub struct InteractiveCreativeFile<'a> {
#[xml(attr = "type", default)]
pub mime_type: Option<std::borrow::Cow<'a, str>>,
#[xml(attr = "apiFramework", default)]
pub api_framework: Option<std::borrow::Cow<'a, str>>,
#[xml(attr = "variableDuration", default)]
pub variable_duration: Option<bool>,
#[xml(text, cdata, default)]
pub uri: std::borrow::Cow<'a, str>,
}
#[derive(hard_xml::XmlWrite, hard_xml::XmlRead, Default, PartialEq, Clone, Debug)]
#[xml(tag = "ClosedCaptionFiles")]
pub struct ClosedCaptionFiles<'a> {
#[xml(child = "ClosedCaptionFile")]
pub closed_caption_files: Vec<ClosedCaptionFile<'a>>,
}
#[derive(hard_xml::XmlWrite, hard_xml::XmlRead, Default, PartialEq, Clone, Debug)]
#[xml(tag = "ClosedCaptionFile")]
pub struct ClosedCaptionFile<'a> {
#[xml(attr = "type", default)]
pub mime_type: Option<std::borrow::Cow<'a, str>>,
#[xml(attr = "language", default)]
pub language: Option<std::borrow::Cow<'a, str>>,
#[xml(text, cdata, default)]
pub uri: std::borrow::Cow<'a, str>,
}