Skip to content

Latest commit

 

History

History
205 lines (171 loc) · 14.3 KB

File metadata and controls

205 lines (171 loc) · 14.3 KB

Changelog

Unreleased

Fixed

  • Fixed DsmTrickMode::SlowMotion and DsmTrickMode::SlowReverse returning the 3-bit trick_mode_control value instead of the 5-bit rep_cntrl field from the DSM trick mode byte.
  • Fixed PesParsedContents::copyright() returning inverted values: bit=1 now produces Copyright::Protected and bit=0 produces Copyright::Undefined.
  • Fixed Timestamp::from_u64() incorrectly accepting 34-bit values; now correctly limited to 33-bit range (Timestamp::MAX).
  • Fixed StreamType::is_pes() incorrectly returning true for section-based stream types (MHEG, DSMCC_UN_MESSAGES, DSMCC_STREAM_DESCRIPTORS, DSMCC_SECTIONS, ISO_13818_6_MULTIPROTOCOL_ENCAPSULATION, FLEX_MUX_ISO_14496_SECTIONS, SYNCHRONIZED_DOWNLOAD_PROTOCOL, METADATA_IN_METADATA_SECTIONS, DSMCC_DATA_CAROUSEL_METADATA, DSMCC_OBJECT_CAROUSEL_METADATA, SYNCHRONIZED_DOWNLOAD_PROTOCOL_METADATA).
  • Raised PSI section_length limit from 1021 to 4093 in both SectionSyntaxSectionProcessor and CompactSyntaxSectionProcessor, matching the maximum allowed by the spec for private sections. The PAT and PMT retain their spec-mandated 1021 limit.
  • Fixed Timestamp::from_pts_bytes() rejecting valid PTS data when both PTS and DTS are present (prefix '0011'); it now accepts both '0010' and '0011' prefixes.
  • Fixed PSI section framing to handle multiple sections packed into a single TS packet payload. Previously, when a packet with payload_unit_start_indicator=1 carried a short section followed by the start of another section, the trailing section's leading bytes were silently dropped and every following continuation packet produced spurious ExtraDataAfterSectionComplete warnings until the next PUSI resync.
  • Fixed PSI section parsing to buffer section headers that straddle TS packet boundaries. Previously, if the initial payload slice contained fewer than 8 header bytes (legal per the spec) the section was abandoned with a SectionDataTooShort warning (formerly logged as "TODO: implement buffering"); the new SectionSyntaxFramer accumulates bytes until a full header is available before parsing.

Changed

  • Breaking: AdaptationField::splice_countdown() now returns Result<i8, ..> instead of Result<u8, ..>, since the spec defines this as a signed two's complement value.
  • Breaking: PesHeader::from_bytes() now returns Result<PesHeader, PesError> instead of Option<PesHeader>.
  • Breaking: PesParsedContents::from_bytes() now returns Result<PesParsedContents, PesError> instead of Option<PesParsedContents>.
  • Breaking: PesContents::Parsed now wraps Result<PesParsedContents, PesError> instead of Option<PesParsedContents>. Pattern matches should change from Parsed(Some(content)) / Parsed(None) to Parsed(Ok(content)) / Parsed(Err(_)).
  • Breaking: Packet::try_new() now returns Result<Packet, PacketError> instead of Option<Packet>.
  • Breaking: Packet::adaptation_field() now returns Result<Option<AdaptationField>, PacketError> instead of Option<AdaptationField>.
  • Breaking: Packet::payload() now returns Result<Option<&[u8]>, PacketError> instead of Option<&[u8]>.
  • Breaking: PatSection::programs() iterator now yields Result<ProgramDescriptor, PatError> instead of ProgramDescriptor.
  • Breaking: DemuxError has been renamed to PmtError and moved from the demultiplex module to psi::pmt.
  • Breaking: PmtSection::streams() iterator now yields Result<StreamInfo, PmtError> instead of StreamInfo.
  • Replaced all warn!() logging with the new ErrorSink::error() callback.
  • Breaking: DemuxContext now requires ErrorSink as a supertrait. The demux_context! macro automatically provides a no-op ErrorSink impl.
  • Breaking: PSI section framing has been reworked. The previous pipeline of SectionPacketConsumer wrapping BufferSectionSyntaxParser wrapping SectionSyntaxSectionProcessor (and the compact-syntax equivalents) is replaced by a single SectionSyntaxFramer (or CompactSyntaxFramer) that wraps a WholeSectionSyntaxPayloadParser directly. Construction sites change from e.g. SectionPacketConsumer::new(BufferSectionSyntaxParser::new(CrcCheckWholeSectionSyntaxPayloadParser::new(proc))) to SectionSyntaxFramer::new(pid, CrcCheckWholeSectionSyntaxPayloadParser::new(pid, proc)).
  • Breaking: Removed SectionPacketConsumer, BufferSectionSyntaxParser, BufferCompactSyntaxParser, SectionSyntaxSectionProcessor, and CompactSyntaxSectionProcessor - replaced by SectionSyntaxFramer / CompactSyntaxFramer.
  • Breaking: Removed the SectionProcessor, SectionSyntaxPayloadParser, and CompactSyntaxPayloadParser traits - WholeSectionSyntaxPayloadParser / WholeCompactSyntaxPayloadParser are now the only extension points.

Added

  • ErrorSink trait with a default no-op error() method. Override this to receive error reports about transport stream problems. When not overridden, monomorphization eliminates the calls entirely in release builds.
  • DemuxError enum (in the error module) for programmatic access to parsing problems (transport errors, scrambled packets, invalid table IDs, section length violations, PMT/PES parse errors).
  • PmtError enum (in the psi::pmt module) for PMT-specific parse errors (previously DemuxError in the demultiplex module).
  • CrcCheckWholeSectionSyntaxPayloadParser::new() now takes a pid parameter so errors carry the originating PID.
  • New SectionSyntaxFramer and CompactSyntaxFramer types in the psi module that frame PSI sections out of TS packet payloads. These collapse the previous three-layer pipeline (SectionPacketConsumerBuffer*SyntaxParser*SyntaxSectionProcessor) into a single type. Both constructors take a pid so errors carry the originating PID.
  • PesError variants: InvalidStartCode, InvalidCheckBits, HeaderLengthExceedsBuffer, HeaderDataLengthMismatch.
  • Updated StreamType constants and CoreDescriptors / AudioType variants to match the 2025 edition.
  • Added TSDT (Transport Stream Description Table) support: psi::tsdt::TsdtSection for parsing, demultiplex::TsdtConsumer trait for receiving parsed sections, and demultiplex::TsdtPacketFilter for integration with the demuxer.

Removed

  • log dependency.

0.18.2 - 2025-01-29

Fixed

  • Make StreamType(u8) constructor public so that it can be used in const contexts in other crates

0.18.1 - 2025-01-29

Fixed

  • Added StreamType::from(u8) which was missing in release 1.18.0

0.18.0 - 2025-01-28

Changed

  • The pes::StreamType and StreamId types changed from enums to structs. These changes reduce the risk of silent breakage in future releases of this crate, if support for additional StreamType or StreamId values are added.
  • descriptor::iso_639_language::Code::code() no longer takes any arguments, and now returns Cow<'_, str> rather than Result<String, ..> (due to the switch from the encoding crate to the encoding_rs crate).

Fixed

  • Removed the dependency on the unmaintained encoding create and switched to encoding_rs. See RUSTSEC-2021-0153.

0.16.0 - 2024-02-20

Changed

  • Updated to Rust 2021 edition
  • packet::TransportScramblingControl changed from an enum to a struct. New is_scrambled() and scheme() methods on TransportScramblingControl replace the functionality of the old enum variants. The changed type layout slightly improves performance.
  • packet::AdaptationControl changed from an enum to a struct. Its has_payload() method now takes self by reference, and a new has_adaptation_field() method has been added. The changed type layout slightly improves performance.

Added

  • FormatIdentifier is now re-exported from the smptera-format-identifiers-rust crate so that calling code can more easily use the same version of it as the mpeg2ts-reader crate.

0.15.0 - 2021-04-17

Changed

  • Iso639LanguageDescriptor::languages() now produces Result<Language> rather than just Language
  • Since we don't support decryption, scrambled TS packets (packets with values of transport_scrambling_control other than 0) are now dropped, to prevent the application being passed bogus data
  • AdaptationFieldExtension::new() changed to return Result

Fixed

  • Fixed a panic when parsing truncated PMT data
  • Fixed a panic when parsing a truncated descriptor value
  • Fixed a panic when parsing a truncated language code in iso_639_language_descriptor
  • Fixed a panic when reported PES header length does not fit within available space
  • Fixed a panic due to a bug parsing PES header ESCR_base field
  • Fixes a panic when PES_header_data_length is not long enough to accommodate all the headers actually present
  • Fixed so we accept very short but still syntactically valid PSI sections previously rejected in some cases
  • Fixed a panic on TS packet with adaptation_field_extension_flag set, but adaptation_field_extension_length is 0

0.14.0 - 2021-04-11

Changed

  • The pes::ElementaryStreamConsumer type and its methods are now parameterised to gain access to the context object you provided to the demultiplexer. Thanks @fkaa.
  • RegistrationDescriptor::format_identifier() return type changed from u32 to a value of the FormatIdentifier enum from the smptera-format-identifiers-rust crate. Also RegistrationDescriptor fields are no longer public.
  • Pid::new() is now a const function. Other crates can now define Pid constants.
  • Definitions of constants for 'PAT' and 'stuffing' PIDs have been relocated, now that don't have to be in the same module as the Pid type.

Added

  • Implementation of TryFrom<u16> for Pid

0.13.0

Changed

  • The descriptor_enum!{} macro no longer provides a default case (which used to produce Error), so callers which don't define mappings for all possible descriptor tag values (0-255) will now get a compiler error.

Fixed

  • Fixed incorrect value of Timestamp::MAX.

Added

  • Added Timestamp::TIMEBASE constant.

0.12.00

Added

  • AVC_video_descriptor() parsing.
  • maximum_bitrate_descriptor() parsing.
  • Timestamp::likely_wrapped_since() utility for detecting wraparound, and supporting Timestamp::MAX constant.

0.11.0

Added

  • Made mpegts_crc::sum_32() public.
  • Added types to psi module for handling 'compact syntax' sections (mirroring existing types for handling 'section syntax' sections).

0.10.0

Added

  • StreamType::is_pes() util function to identify those StreamType values that the spec expects to carry PES content.

0.9.0

Fixed

  • Made the methods of descriptor::iso_639_language::Language public (they were private by mistake)
  • Drop TS packets that have transport_error_indicator flag set, rather than passing known-bad data to the application.

Added

  • Some more descriptor-tag values in CoreDescriptors (but not the descriptor definitions themselves yet).

Changed

  • Removed the StreamConstructor trait, and merged its previous responsibilities into DemuxContext. This makes it much simpler for client code to gain access to any relevant DemuxContext state when the demuxer requests a handler for a newly discovered stream within the TS.
  • Added a StreamId enum to replace the u8 previously used as the return value for PesHeader::stream_id()
  • Removed single usage of hex-slice crate; resulting Debug impl is not quite so nice, but now there's one less dependency.
  • Avoid calling start_stream() on ElementaryStreamConsumer after parsing errors. It was only intended to be called when the substream was first encountered in the multiplex.

0.8.0

Fixed

  • Avoid panics due to 0-length adaptation_field, larger-than-expected program_info_length and too small section_length. All found through fuzz testing.

Changed

  • All public API members now have at least minimal documentation
  • Removed the demultiplex::UnhandledPid type to try and simplify the API slightly.
  • Removed PesPacketConsumer. The types PesPacketFilter and PesPacketConsumer seem in hindsight to be redundant (the first just being a thin wrapper for the second). PesPacketFilter now implements the complete functionality.
  • Removed PmtSection::program_info_length() and StreamInfo::es_info_length() from public API.
  • Changed PmtSection::pcr_pid() to return a Pid (got missed when others changed from u16 to Pid) in version 0.7.0.

0.7.0

Fixed

  • Removed some unused dependencies

Changed

  • Changed the representation of PID values in the API from plain u16 to a new Pid wrapper, so that the API can't represent invalid PID values.
  • FilterRequest::ByStream changes from tuple to struct variant, and gains program_id of the program to which the stream belongs.
  • All uses of println!() have been replaced with use of warn!() from the log crate.

0.6.0

Fixed

  • PES data is no longer truncated at the end of the TS packet with payload_unit_start_indicator

Changed

  • Many methods previously taking a Packet by value now instead take it by reference. This breaks with the old API, but may deliver a small performance improvement for some workloads.
  • Many objects that previously offered a no-args new() method have had this replaced with a default() impl.
  • The PCR type has been renamed ClockRef, since it's used to represent the values of both Prograem Clock Reference and Elementry Stream Clock Reference fields.
  • descriptor::RegistrationDescriptor became descriptor::registration::RegistrationDescriptor. New descriptor implementations will be added each in their own source file.
  • Moved PAT/PMT types from demultiplex module into psi::pat and psi::pmt modules.
  • Refactored some methods returning custom Iterator types to instead return impl Iterator, so that the actual iterator types can be hidden from the public API
  • pes_packet_length is now represented as enum PesLength, rather than directly as a u16, so that the special status of the length-value 0 can be made explicit (it's now mapped to PesLength::Unbounded)

Added

  • Added iso_639_language_descriptor support