[][src]Crate mpeg2ts_reader

Structures for parsing MPEG2 Transport Stream data, per the ISO/IEC 13818-1 standard.

Design principals

  • Avoid copying and allocating if possible. Most of the implementation works by borrowing slices of the underlying byte buffer. The implementation tries to avoid buffering up intermediate data where practical.
  • Non-blocking. It should be possible to integrate this library into a system non-blocking event-loop. The caller has to 'push' data.
  • Extensible. The standard calls out a number of 'reserved values' and other points of extension. This library should make it possible for other crates to implement such extensions.
  • Minimal. Lots of commonly used Transport Stream functionality is specified in standards from by ISDB / DVB / ATSC / SCTE / etc. and not in 13818-1 itself. I hope support for these features can be added via external crates. (None implemented any yet!)
  • Transport Neutral. There is currently no code here supporting consuming from files or the network. The APIs accept &[u8], and the caller handles providing the data from wherever.

Planned API changes

  • Add 'context' objects
    • Real usage will likely need to thread context objects through the API in order to track application-specific details.
    • Currently mutable state is stored in the instance for each type of syntax parser, and it would be nice to explore extracting this out into parser-specific context types
  • Event generation / remove warn!()
    • currently problems are reported to the log crate
    • I would much prefer a way to emit 'events' for interesting data that can't just be an error return value, and to not have any logging code mixed with parsing logic
  • General
    • lots of places return Option but should return Result and a descriptive error

Modules

demultiplex

Main types implementing the demultiplexer state-machine.

descriptor

Descriptors provide metadata about an element of a Transport Stream.

mpegts_crc

MPEG Cyclic Redundancy Check calculation

packet

A Packet struct and associated infrastructure to read an MPEG Transport Stream packet

pes

Support for Packetised Elementary Stream syntax within Transport Stream packet payloads. Elementary streams are split into 'elementary stream packets', which are then further split into the payloads of transport stream packets.

psi

Types for processing tables of Program Specific Information in a transport stream.

Macros

demux_context

Creates the boilerplate needed for a filter-implementation-specific DemuxContext.

descriptor_enum

Builds an enum to encapsulate all possible implementations of Descriptor that you want to be able to handle in your application.

packet_filter_switch

Creates an enum which implements PacketFilter by delegating to other PacketFilter implementations, depending on the enum-variant. It's intended that the types created by this macro be used as the type-parameter for an instance of the Demultiplex type, allowing Demultiplex to support many kinds of PacketFilter, without the cost of having to box them.

Enums

StreamType

The types of Elementary Stream specified in ISO/IEC 13818-1.