From b7f280d753d925973e25563d0883562f3eb74b6a Mon Sep 17 00:00:00 2001 From: Rafael Caricio Date: Sun, 24 Apr 2022 00:05:28 +0200 Subject: [PATCH] Initial version --- .gitignore | 2 ++ Cargo.toml | 10 +++++++ src/lib.rs | 84 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 96 insertions(+) create mode 100644 .gitignore create mode 100644 Cargo.toml create mode 100644 src/lib.rs diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..96ef6c0 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/target +Cargo.lock diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..90bb6e9 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,10 @@ +[package] +name = "scte35" +authors = ["Rafael Caricio "] +version = "0.1.0" +edition = "2021" +license = "MIT" + +[dependencies] +bitstream-io = "1.3.0" +crc = "3.0.0" diff --git a/src/lib.rs b/src/lib.rs new file mode 100644 index 0000000..57cf70a --- /dev/null +++ b/src/lib.rs @@ -0,0 +1,84 @@ + +struct SegmentationDescriptor { + tag: u8, + descriptor_length: u8, + identifier: u32, + segmentation_event_id: u32, + segmentation_event_cancel_indicator: bool, + program_segmentation: Option>, + delivery_restricted: Option, + segmentation_duration: Option, + segmentation_upid: SegmentationUpid, +} + +struct DeliveryRestriction { + web_delivery_allowed_flag: bool, + no_regional_blackout_flag: bool, + archive_allowed_flag: bool, + device_restrictions: DeviceRestrictions, +} + +enum DeviceRestrictions { + RestrictGroup0 = 0x00, + RestrictGroup1 = 0x01, + RestrictGroup2 = 0x10, + None = 0x11, +} + +enum SegmentationUpidType { + NotUsed, + UserDefinedDeprecated, + ISCI, + AdID, + UMID, + ISANDeprecated, + ISAN, + TID, + TI, + ADI, + EIDR, + ATSCContentIdentifier, + MPU, + MID, + ADSInformation, + URI, + UUID, + SCR, + Reserved +} + +enum SegmentationUpid { + NotUsed, + UserDefinedDeprecated, + ISCI, + AdID, + UMID, + ISANDeprecated, + ISAN, + TID, + TI, + ADI, + EIDR, + ATSCContentIdentifier, + MPU, + MID, + ADSInformation, + URI, + UUID, + SCR, + Reserved +} + +struct Component { + component_tag: u8, + pts_offset: u64, +} + +#[cfg(test)] +mod tests { + #[test] + fn it_works() { + let result = 2 + 2; + assert_eq!(result, 4); + } +}