Expand description
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 logcrate
- 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
 
- currently problems are reported to the 
- General
- lots of places return Optionbut should returnResultand a descriptive error
 
- lots of places return 
Re-exports§
- pub use smptera_format_identifiers_rust as smptera;
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 Packetstruct 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
Descriptorthat you want to be able to handle in your application.
- packet_filter_ switch 
- Creates an enum which implements PacketFilterby delegating to otherPacketFilterimplementations, 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 theDemultiplextype, allowingDemultiplexto support many kinds ofPacketFilter, without the cost of having to box them.
Structs§
- StreamType 
- The types of Elementary Stream specified in ISO/IEC 13818-1.
Constants§
- STUFFING_PID 
- The identifier of TS Packets containing ‘stuffing’ data, with value 0x1fff