Crate scte35_reader

source ·
Expand description

Parser data formatted according to SCTE-35.

Intended to be used in conjunction with the mpeg2ts-reader crate’s facilities for processing the Transport Stream structures within which SCTE-35 data is usually embedded.

§Example

pub struct DumpSpliceInfoProcessor;
impl scte35_reader::SpliceInfoProcessor for DumpSpliceInfoProcessor {
    fn process(
        &self,
        header: scte35_reader::SpliceInfoHeader<'_>,
        command: scte35_reader::SpliceCommand,
        descriptors: scte35_reader::SpliceDescriptors<'_>,
    ) {
        println!("{:?} {:#?}", header, command);
        for d in &descriptors {
            println!(" - {:?}", d);
        }
    }
}

let data = hex!(
            "fc302500000000000000fff01405000000017feffe2d142b00fe0123d3080001010100007f157a49"
        );
let mut parser = Scte35SectionProcessor::new(DumpSpliceInfoProcessor);
let header = psi::SectionCommonHeader::new(&data[..psi::SectionCommonHeader::SIZE]);
let mut ctx = NullDemuxContext::new();
parser.section(&mut ctx, &header, &data[..]);

Output:

SpliceInfoHeader { protocol_version: 0, encrypted_packet: false, encryption_algorithm: None, pts_adjustment: 0, cw_index: 0, tier: 4095 } SpliceInsert {
    splice_event_id: 1,
    reserved: 127,
    splice_detail: Insert {
        network_indicator: Out,
        splice_mode: Program(
            Timed(
                Some(
                    756296448
                )
            )
        ),
        duration: Some(
            SpliceDuration {
                return_mode: Automatic,
                duration: 19125000
            }
        ),
        unique_program_id: 1,
        avail_num: 1,
        avails_expected: 1
    }
}

Modules§

  • Unique Program Identifier types from a range of different identification schemes supported in SCTE-35 segmentation_descriptor() messages.

Structs§

Enums§

Constants§

Traits§

Functions§

  • Utility function to search the PTM section for a CUEI registration descriptor per SCTE-35, section 8.1, which indicates that streams with stream_type equal to the private value 0x86 within this PMT section are formatted according to SCTE-35.