#[repr(u8)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum SegmentType {
PaletteDefinition = 0x14,
ObjectDefinition = 0x15,
PresentationComposition = 0x16,
WindowDefinition = 0x17,
End = 0x80,
}
impl TryFrom<u8> for SegmentType {
type Error = u8;
fn try_from(value: u8) -> Result<Self, Self::Error> {
match value {
0x14 => Ok(SegmentType::PaletteDefinition),
0x15 => Ok(SegmentType::ObjectDefinition),
0x16 => Ok(SegmentType::PresentationComposition),
0x17 => Ok(SegmentType::WindowDefinition),
0x80 => Ok(SegmentType::End),
_ => Err(value),
}
}
}
#[repr(u8)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum CompositionState {
Normal = 0x00,
AcquisitionPoint = 0x40,
EpochStart = 0x80,
}
impl TryFrom<u8> for CompositionState {
type Error = u8;
fn try_from(value: u8) -> Result<Self, Self::Error> {
match value {
0x00 => Ok(CompositionState::Normal),
0x40 => Ok(CompositionState::AcquisitionPoint),
0x80 => Ok(CompositionState::EpochStart),
_ => Err(value),
}
}
}