Add MMT/TLV extractor for ISDB-S3 4K/8K broadcast streams#3332
Open
osscv wants to merge 2 commits into
Open
Conversation
Adds support to Media3 for demultiplexing MMT (MPEG Media Transport) carried over TLV (Type-Length-Value) packets, the transport stack used by ISDB-S3 4K/8K broadcasting (e.g. NHK BS4K/BS8K). New `androidx.media3.extractor.mmt` package: * TlvExtractor: sniffs and parses the TLV layer (IPv4 / IPv6 / header-compressed IP / signalling / null packets), unwraps IP + UDP and forwards MMTP packets. * MmtpReader: parses MMTP packet headers, routes signalling to the package-table parser, and reassembles MPU/MFU fragments (with fragmentation-indicator and aggregation handling) into access units. * MmtSignalingParser: parses the PA message / MMT Package Table (MPT) to map each packet_id to an asset type. * HEVC and AVC assets are output as samples by reusing the existing H265Reader / H264Reader elementary-stream readers. Wires the format into DefaultExtractorsFactory, FileTypes.MMT_TLV, MimeTypes.VIDEO_MMT_TLV, and .mmt/.mmts/.tlv extension detection, so the extractor is selected both by content sniffing and by MIME/extension. Adds unit tests for TLV sniffing and MPT asset discovery. Broadcast-specific extras are marked with TODOs and not yet implemented: accurate per-sample timing (MPU metadata moof/trun + MPU_timestamp descriptor), MH-AAC / MPEG-H 3D audio, ARIB subtitles, full header-compression context handling, and non-"same-flow" asset locations.
Analysis of live NHK BS4K/BS8K MMT/TLV captures showed the PA message
sets number_of_tables=0 and inlines the tables directly, so the previous
ISO-strict, index-driven parser discovered zero assets and produced no
tracks.
MmtSignalingParser.parsePaMessage now skips the (possibly empty) table
index and walks the concatenated tables by their own
{table_id, version, length} headers, which handles both the indexed and
the inlined layouts. Each table's length is used to advance, with a
zero-length guard.
Confirmed asset maps from the captures:
* BS8K: hev1 video, mp4a (MPEG-4 AAC) audio, 2x stpp (TTML) subtitles.
* BS4K: hev1 video, 2x mp4a audio, stpp subtitles, several aapp data
(application) assets.
Both streams are transported almost entirely as header-compressed IP
(TLV type 0x03, context types 0x60/0x61), validating that path.
Adds an end-to-end TlvExtractor test that drives a header-compressed IP
packet carrying an MMTP signaling packet / MPT and asserts a video track
is created, plus updates the signaling parser test to use the real
inlined-table framing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a new
androidx.media3.extractor.mmtpackage that demultiplexes MMT(MPEG Media Transport) carried over TLV (Type-Length-Value) packets — the
transport stack used by ISDB-S3 4K/8K broadcasting (e.g. NHK BS4K/BS8K).
The transport is parsed end to end:
TlvExtractor— sniffs and parses the TLV layer (IPv4 / IPv6 /header-compressed IP / signalling / null packets) and unwraps IP + UDP.
MmtpReader— parses MMTP packet headers and reassembles MPU/MFUfragments (fragmentation-indicator + aggregation) into access units.
MmtSignalingParser— parses the PA message / MMT Package Table (MPT)to map each
packet_idto an asset type.HEVC and AVC assets are output by reusing the existing
H265Reader/H264Readerelementary-stream readers. The format is wired intoDefaultExtractorsFactory,FileTypes.MMT_TLV,MimeTypes.VIDEO_MMT_TLVand
.mmt/.mmts/.tlvextension detection, so the extractor is selectedby both content sniffing and MIME/extension.
Parsing was validated against live NHK BS4K/BS8K captures, which are
delivered almost entirely as header-compressed IP and set the PA message's
number_of_tablesto 0 with the tables inlined — the MPT parser walks theconcatenated tables to handle this.
Unit tests cover TLV sniffing, MPT asset discovery, and the end-to-end
compressed-IP → MMTP → MPT → track-creation pipeline.