Constructor
new LocTransmuxer(mimeType)
Parameters:
| Name | Type | Description |
|---|---|---|
mimeType |
string |
- Implements:
- Extends:
- Source:
Extends
Members
SUPPORTED_AUDIO_CODECS_ :Array<string>
Supported audio codecs.
Type:
- Array<string>
- Source:
SUPPORTED_VIDEO_CODECS_ :Array<string>
Supported video codecs.
Type:
- Array<string>
- Source:
avcInfo_ :?{videoConfig: !Uint8Array, hSpacing: number, vSpacing: number, height: number, width: number}
Cached result of H264.parseInfo(), populated from the first IDR frame
that carries SPS+PPS. Reused for all subsequent non-IDR frames.
Type:
- ?{videoConfig: !Uint8Array, hSpacing: number, vSpacing: number, height: number, width: number}
- Source:
frameIndex :number
Type:
- number
- Overrides:
- Source:
hvcInfo_ :?{videoConfig: !Uint8Array, hSpacing: number, vSpacing: number, height: number, width: number}
Cached result of H265.parseInfo(), populated from the first IDR frame
that carries VPS+SPS+PPS. Reused for all subsequent non-IDR frames.
Type:
- ?{videoConfig: !Uint8Array, hSpacing: number, vSpacing: number, height: number, width: number}
- Source:
initSegments :Map<string, !Uint8Array>
Type:
- Map<string, !Uint8Array>
- Overrides:
- Source:
lastInitSegment_ :Uint8Array
Type:
- Uint8Array
- Overrides:
- Source:
originalMimeType_ :string
Type:
- string
Methods
convertCodecs(contentType, mimeType) → {string}
For any stream, convert its codecs to MP4 codecs.
Parameters:
| Name | Type | Description |
|---|---|---|
contentType |
string | |
mimeType |
string |
- Implements:
- Source:
Returns:
- Type
- string
destroy()
Destroy
- Overrides:
- Implements:
- Source:
extractNalus_(datanon-null, codec) → {Array<shaka.extern.VideoNalu>}
Extracts NAL units from a LOC video payload.
The LOC spec (§2.1) allows two framing formats:
- **Length-prefix** (§2.1.3): 4-byte big-endian length before each NALU.
This is the canonical AVCC/HVCC format.
- **Start-code** (§2.1.4): a 4-byte value of `0x00000001` (= 1 in network
byte order) is reserved as a start-code sentinel; the extractor then
scans ahead for the next 3- or 4-byte start code boundary. Per the
spec a length value of 1 SHOULD be interpreted this way.
Parameters:
| Name | Type | Description |
|---|---|---|
data |
Uint8Array | |
codec |
string | Normalised codec string: 'avc' or 'hvc' |
- Source:
Returns:
- Type
- Array<shaka.extern.VideoNalu>
getAacStreamInfo_(datanon-null, stream, duration, referencenullable) → {shaka.util.Mp4Generator.StreamInfo}
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
data |
Uint8Array | ||
stream |
shaka.extern.Stream | ||
duration |
number | ||
reference |
shaka.media.SegmentReference |
<nullable> |
- Source:
Returns:
getAvcStreamInfo_(datanon-null, stream, referencenullable, duration) → {shaka.util.Mp4Generator.StreamInfo}
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
data |
Uint8Array | ||
stream |
shaka.extern.Stream | ||
reference |
shaka.media.SegmentReference |
<nullable> |
|
duration |
number |
- Source:
Returns:
getHvcStreamInfo_(datanon-null, stream, duration, referencenullable) → {shaka.util.Mp4Generator.StreamInfo}
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
data |
Uint8Array | ||
stream |
shaka.extern.Stream | ||
duration |
number | ||
reference |
shaka.media.SegmentReference |
<nullable> |
- Source:
Returns:
getId3Timestamp(id3Datanon-null, defaultTimestamp) → {number}
Reads the transport-stream timestamp carried in the given ID3 data (the
'com.apple.streaming.transportStreamTimestamp' frame), if present, falling
back to the provided default otherwise.
Parameters:
| Name | Type | Description |
|---|---|---|
id3Data |
Uint8Array | |
defaultTimestamp |
number |
- Overrides:
- Source:
Returns:
- Type
- number
getOpusStreamInfo_(datanon-null, stream, duration, referencenullable) → {shaka.util.Mp4Generator.StreamInfo}
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
data |
Uint8Array | ||
stream |
shaka.extern.Stream | ||
duration |
number | ||
reference |
shaka.media.SegmentReference |
<nullable> |
- Source:
Returns:
getOriginalMimeType() → {string}
- Overrides:
- Implements:
- Source:
Returns:
- Type
- string
isLocContainer_(mimeType) → {boolean}
Parameters:
| Name | Type | Description |
|---|---|---|
mimeType |
string |
- Source:
Returns:
- Type
- boolean
isSupported(mimeType, contentTypeopt) → {boolean}
Check if the mime type and the content type is supported.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
mimeType |
string | ||
contentType |
string |
<optional> |
- Implements:
- Source:
Returns:
- Type
- boolean
packageSegment(mp4Generatornon-null, stream, referencenullable) → {shaka.extern.TransmuxerOutput}
Packages the init and media segments produced by the given Mp4Generator.
The init segment is cached per discontinuity and the running frame index is
advanced. The init segment is only (re)appended when it differs from the
last one used.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
mp4Generator |
shaka.util.Mp4Generator | ||
stream |
shaka.extern.Stream | ||
reference |
shaka.media.SegmentReference |
<nullable> |
- Overrides:
- Source:
Returns:
transmux(data, stream, referencenullable, duration, contentType) → {Promise<(!Uint8Array|!shaka.extern.TransmuxerOutput)>}
Transmux a input data to MP4.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
data |
BufferSource | ||
stream |
shaka.extern.Stream | ||
reference |
shaka.media.SegmentReference |
<nullable> |
The segment reference, or null for init segments |
duration |
number | ||
contentType |
string |
- Implements:
- Source:
Returns:
If you
only want to return the result, use Uint8Array, if you want to separate
the initialization segment and the data segment, you have to use
shaka.extern.TransmuxerOutput
- Type
- Promise<(!Uint8Array|!shaka.extern.TransmuxerOutput)>