pub trait SectionProcessor {
    type Context;

    // Required methods
    fn start_section(
        &mut self,
        ctx: &mut Self::Context,
        header: &SectionCommonHeader,
        section_data: &[u8]
    );
    fn continue_section(&mut self, ctx: &mut Self::Context, section_data: &[u8]);
    fn reset(&mut self);
}
Expand description

Trait for types which process the data within a PSI section following the 12-byte section_length field (which is one of the items available in the SectionCommonHeader that is passed in.

  • For PSI tables that use ‘section syntax’, the existing SectionSyntaxSectionProcessor implementation of this trait can be used.
  • This trait should be implemented directly for PSI tables that use ‘compact’ syntax (i.e. they lack the 5-bytes-worth of fields represented by TableSyntaxHeader)

Implementations of this trait will need to use the section_length method of the header param passed to start_section() to determine when the complete section has been supplied (if the complete header is not supplied in the call to start_section() more data may be supplied in one or more subsequent calls to continue_section().

Required Associated Types§

source

type Context

The type of the context object that the caller will pass through to the methods of this trait

Required Methods§

source

fn start_section( &mut self, ctx: &mut Self::Context, header: &SectionCommonHeader, section_data: &[u8] )

Note that the first 3 bytes of section_data contain the header fields that have also been supplied to this call in the header parameter. This is to allow implementers to calculate a CRC over the whole section if required.

source

fn continue_section(&mut self, ctx: &mut Self::Context, section_data: &[u8])

may be called to pass the implementation additional slices of section data, if the complete section was not already passed.

source

fn reset(&mut self)

called if there is a problem in the transport stream that means any in-progress section data should be discarded.

Implementors§