Constructor
new Mp4CeaParser()
- Implements:
- Source:
Members
BitstreamFormat :number
Type:
- number
Properties:
| Name | Value | Type | Description |
|---|---|---|---|
UNKNOWN |
0 | number | |
H264 |
1 | number | |
H265 |
2 | number | |
H266 |
3 | number | |
C608_TRACK |
4 | number | |
AV1 |
5 | number |
- Source:
CodecBitstreamMap_ :Map<string, shaka.cea.Mp4CeaParser.BitstreamFormat>
Type:
- Map<string, shaka.cea.Mp4CeaParser.BitstreamFormat>
- Source:
METADATA_TYPE_ITUT_T35_ :number
METADATA_TYPE_ITUT_T35, as defined by the AV1 bitstream specification.
Type:
- number
- Source:
OBU_TYPE_METADATA_ :number
OBU_METADATA, as defined by the AV1 bitstream specification.
Type:
- number
- Source:
defaultSampleDuration_ :number
Default sample duration, as specified by the TREX box.
Type:
- number
- Source:
defaultSampleSize_ :number
Default sample size, as specified by the TREX box.
Type:
- number
- Source:
trackIdToTimescale_ :Map<number, number>
Map of track id to corresponding timescale.
Type:
- Map<number, number>
- Source:
Methods
readLeb128_(datanon-null, offset) → {?{value: number, size: number}}
Reads the AV1 leb128() at the given offset. Returns null if the value is
truncated or malformed, in which case the rest of the sample cannot be
trusted either.
Parameters:
| Name | Type | Description |
|---|---|---|
data |
Uint8Array | |
offset |
number |
- Source:
Returns:
- Type
- ?{value: number, size: number}
init(initSegmentnon-null)
Parses the init segment. Gets Default Sample Duration and Size from the
TREX box, and constructs a map of Track IDs to timescales. Each TRAK box
contains a track header (TKHD) containing track ID, and a media header box
(MDHD) containing the timescale for the track
Parameters:
| Name | Type | Description |
|---|---|---|
initSegment |
BufferSource | init segment to parse. |
- Implements:
- Source:
parse(mediaSegmentnon-null) → {Array<!shaka.extern.ICeaParser.CaptionPacket>}
Parses each video segment. In fragmented MP4s, MOOF and MDAT come in
pairs. The following logic gets the necessary info from MOOFs to parse
MDATs (base media decode time, sample sizes/offsets/durations, etc),
and then parses the MDAT boxes for CEA-708 packets using this information.
CEA-708 packets are returned in the callback.
Parameters:
| Name | Type | Description |
|---|---|---|
mediaSegment |
BufferSource | media segment to parse. |
- Implements:
- Source:
Returns:
- Type
- Array<!shaka.extern.ICeaParser.CaptionPacket>
parseAv1Sample_(samplenon-null, pts, captionPacketsnon-null)
Parses the OBUs of a single AV1 coded sample (one temporal unit) and
extracts the caption payload of every metadata_itu_t_t35 OBU.
AV1 has no NAL units, so the cc_data() that AVC/HEVC carry in an SEI
message rides in a metadata OBU placed before the frame OBU instead. The
T.35/GA94 header and the cc_data() below it are identical to the SEI case,
so only the envelope differs and the extracted payload is handed to the
decoder as an SEI packet. OBUs carry no emulation prevention bytes, which
is why the payload does not go through the SEI processor.
Parameters:
| Name | Type | Description |
|---|---|---|
sample |
Uint8Array | |
pts |
number | |
captionPackets |
Array<!shaka.extern.ICeaParser.CaptionPacket> |
- Source:
parseC608Mdat_(readernon-null, time, timescale, defaultSampleDuration, defaultSampleSize, offset, parsedTRUNsnon-null, captionPacketsnon-null)
Parse MDAT box for C608 format
Parameters:
| Name | Type | Description |
|---|---|---|
reader |
shaka.util.DataViewReader | |
time |
number | |
timescale |
number | |
defaultSampleDuration |
number | |
defaultSampleSize |
number | |
offset |
number | |
parsedTRUNs |
Array<shaka.util.ParsedTRUNBox> | |
captionPackets |
Array<!shaka.extern.ICeaParser.CaptionPacket> |
- Source:
parseMdat_(readernon-null, time, timescale, defaultSampleDuration, defaultSampleSize, offset, parsedTRUNsnon-null, captionPacketsnon-null)
Parse MDAT box.
Parameters:
| Name | Type | Description |
|---|---|---|
reader |
shaka.util.DataViewReader | |
time |
number | |
timescale |
number | |
defaultSampleDuration |
number | |
defaultSampleSize |
number | |
offset |
number | |
parsedTRUNs |
Array<shaka.util.ParsedTRUNBox> | |
captionPackets |
Array<!shaka.extern.ICeaParser.CaptionPacket> |
- Source:
setBitstreamFormat_(codec)
Parameters:
| Name | Type | Description |
|---|---|---|
codec |
string | A fourcc for a codec. |
- Source:
Type Definitions
ParsedTRAF
Type:
- {trackId: ?number, baseMediaDecodeTime: ?number, defaultSampleDuration: number, defaultSampleSize: number, parsedTRUNs: !Array<shaka.util.ParsedTRUNBox>, timescale: number}
Properties:
| Name | Type | Attributes | Description |
|---|---|---|---|
trackId |
number |
<nullable> |
|
baseMediaDecodeTime |
number |
<nullable> |
|
defaultSampleDuration |
number | ||
defaultSampleSize |
number | ||
parsedTRUNs |
Array<shaka.util.ParsedTRUNBox> | ||
timescale |
number |
<nullable> |
- Source: