Expand description
This crate contains an MP4 parser ported from the shaka-player project.
It also includes optional features for decryption, parsing subtitles, and processing PSSH and SIDX boxes.
§Optional Features
The following Cargo features can be enabled or disabled (all features are enabled by default):
| Feature | Description |
|---|---|
decrypt-cenc | Enables support for Common Encryption (CENC) scheme decryption. |
decrypt-hls | Enables support for HTTP Live Streaming (HLS) segment decryption. |
pssh | Enables support for parsing Protection System Specific Header (PSSH) boxes. |
sidx | Enables support for parsing Segment Index (SIDX) boxes. |
sub-ttml | Enables support for extracting subtitles from STPP boxes. |
sub-vtt | Enables support for extracting subtitles from WVTT boxes. |
Modules§
- boxes
- MP4 box structures and parsers.
- decrypt
decrypt-cencordecrypt-hls - Decryption utilities for protected MP4 and HLS streams.
- pssh
pssh - MP4 protection system-specific header (
PSSH) box parsing. - sub
sub-ttmlorsub-vtt - Subtitle extraction and parsing utilities for MP4 streams.
Macros§
- bail
- Early-returns with an
Error::Othervariant. - data
- Helper macro to create a reference-counted, interior-mutable
Optioncell.
Structs§
- Mp4Parser
- A parser for extracting structure and metadata from MP4 files.
- Parsed
Box - A representation of a parsed MP4 box containing its header information and payload reader.
- Reader
- A reader for parsing binary data of MP4 containers with support for big-endian and little-endian formats.
Enums§
Functions§
- alldata
- Create a callback that tells the Mp4 parser to treat the body of a box as a binary blob and to parse the body’s contents using the provided callback.
- audio_
sample_ entry - A callback that tells the Mp4 parser to treat the body of a box as a audio sample entry. A audio sample entry has some fixed-sized fields describing the audio codec parameters, followed by an arbitrary number of ppended children. Each child is a box.
- children
- A callback that tells the Mp4 parser to treat the body of a box as a series of boxes. The number of boxes is limited by the size of the parent box.
- sample_
description - A callback that tells the Mp4 parser to treat the body of a box as a sample description. A sample description box has a fixed number of children. The number of children is represented by a 4 byte unsigned integer. Each child is a box.
- type_
from_ string - Convert an ascii string name to the integer type for a box. The name must be four characters long.
- type_
to_ string - Convert an integer type from a box into an ascii string name. Useful for debugging.
- visual_
sample_ entry - A callback that tells the Mp4 parser to treat the body of a box as a visual sample entry. A visual sample entry has some fixed-sized fields describing the video codec parameters, followed by an arbitrary number of appended children. Each child is a box.