libbitsub_core/pgs/
segment.rs1#[repr(u8)]
5#[derive(Debug, Clone, Copy, PartialEq, Eq)]
6pub enum SegmentType {
7 PaletteDefinition = 0x14,
9 ObjectDefinition = 0x15,
11 PresentationComposition = 0x16,
13 WindowDefinition = 0x17,
15 End = 0x80,
17}
18
19impl TryFrom<u8> for SegmentType {
20 type Error = u8;
21
22 fn try_from(value: u8) -> Result<Self, Self::Error> {
23 match value {
24 0x14 => Ok(SegmentType::PaletteDefinition),
25 0x15 => Ok(SegmentType::ObjectDefinition),
26 0x16 => Ok(SegmentType::PresentationComposition),
27 0x17 => Ok(SegmentType::WindowDefinition),
28 0x80 => Ok(SegmentType::End),
29 _ => Err(value),
30 }
31 }
32}
33
34#[repr(u8)]
36#[derive(Debug, Clone, Copy, PartialEq, Eq)]
37pub enum CompositionState {
38 Normal = 0x00,
40 AcquisitionPoint = 0x40,
42 EpochStart = 0x80,
44}
45
46impl TryFrom<u8> for CompositionState {
47 type Error = u8;
48
49 fn try_from(value: u8) -> Result<Self, Self::Error> {
50 match value {
51 0x00 => Ok(CompositionState::Normal),
52 0x40 => Ok(CompositionState::AcquisitionPoint),
53 0x80 => Ok(CompositionState::EpochStart),
54 _ => Err(value),
55 }
56 }
57}