Constructor
new Mpeg2tsProgram(programNumbernullable, filter)
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
programNumber |
number |
<nullable> |
The program to follow, or null for the first one the PAT lists. |
filter |
boolean | Whether to drop the packets of every other program and rewrite the PAT to list only this one. |
Members
MAX_SECTION_LENGTH_ :number
The longest a PAT or PMT section may be.
Type:
- number
VIDEO_STREAM_TYPES_ :Set<number>
The video stream_types whose access units can be told apart as random
access points: H.264 and H.265.
Type:
- Set<number>
patPackets_ :Array<!Uint8Array>
Type:
- Array<!Uint8Array>
pmtPackets_ :Array<!Uint8Array>
Type:
- Array<!Uint8Array>
rewrittenPat_ :Uint8Array
The rewritten PAT produced by the packet being processed, if any.
Type:
- Uint8Array
sections_ :Map<number, shaka.msf.packaging.Mpeg2tsProgram.Section>
Sections still being reassembled, by PID.
Type:
- Map<number, shaka.msf.packaging.Mpeg2tsProgram.Section>
selectedProgram_ :number
The program the PAT selected, which is the requested one when there is
one.
Type:
- number
streams_ :Map<number, number>
The stream_type of each elementary stream the PMT lists, by PID.
Type:
- Map<number, number>
Methods
copyPackets_(packetsnon-null) → {Array<!Uint8Array>}
Parameters:
| Name | Type | Description |
|---|---|---|
packets |
Array<!Uint8Array> |
Returns:
- Type
- Array<!Uint8Array>
getPayloadOffset(packetnon-null) → {number}
The offset of a transport packet's payload, which is the packet size when
it has none.
Parameters:
| Name | Type | Description |
|---|---|---|
packet |
Uint8Array |
Returns:
- Type
- number
getPid(packetnon-null) → {number}
Parameters:
| Name | Type | Description |
|---|---|---|
packet |
Uint8Array |
Returns:
- Type
- number
buildPat_(sourcenon-null, programNumber, pmtPid) → {Uint8Array}
Builds a PAT that lists only the given program.
Parameters:
| Name | Type | Description |
|---|---|---|
source |
Uint8Array | The PAT section it replaces. |
programNumber |
number | |
pmtPid |
number |
Returns:
- Type
- Uint8Array
continueSection_(pid, section, packetnon-null, chunknon-null) → {boolean}
Parameters:
| Name | Type | Description |
|---|---|---|
pid |
number | |
section |
shaka.msf.packaging.Mpeg2tsProgram.Section | |
packet |
Uint8Array | |
chunk |
Uint8Array |
Returns:
Whether the section is complete.
- Type
- boolean
getPcrPid() → {number}
The PID the PMT says carries the program clock, or null until the PMT has
been seen or when the program has none.
Returns:
- Type
- number
getPsi() → {Uint8Array}
The latest PAT and PMT of the program as transport packets, or an empty
array until both have been seen.
Returns:
- Type
- Uint8Array
getVideoStream() → {?{pid: number, streamType: number}}
The program's video elementary stream, or null when the PMT lists none
or has not been seen.
Returns:
- Type
- ?{pid: number, streamType: number}
isPsiPid(pid) → {boolean}
Whether a PID carries the program's PAT or PMT.
Parameters:
| Name | Type | Description |
|---|---|---|
pid |
number |
Returns:
- Type
- boolean
onPat_(sectionnon-null, packetsnon-null)
Parameters:
| Name | Type | Description |
|---|---|---|
section |
Uint8Array | |
packets |
Array<!Uint8Array> |
onPmt_(sectionnon-null, packetsnon-null)
Parameters:
| Name | Type | Description |
|---|---|---|
section |
Uint8Array | |
packets |
Array<!Uint8Array> |
onSection_(pid, sectionnon-null, packetsnon-null)
Parameters:
| Name | Type | Description |
|---|---|---|
pid |
number | |
section |
Uint8Array | |
packets |
Array<!Uint8Array> | The packets the section came in. |
process(packetnon-null) → {Uint8Array}
Reads one 188-octet transport packet and returns what should be kept of
it: the packet itself, a rewritten PAT in its place, or null when it does
not belong to the program.
Parameters:
| Name | Type | Description |
|---|---|---|
packet |
Uint8Array |
Returns:
- Type
- Uint8Array
readSections_(pid, packetnon-null)
Reassembles the PSI sections a packet carries, which may finish one that
started in an earlier packet, start several, or both.
Parameters:
| Name | Type | Description |
|---|---|---|
pid |
number | |
packet |
Uint8Array |
Type Definitions
Section
A PSI section being reassembled from the packets it spans.
Type:
- {data: !Uint8Array, received: number, packets: !Array<!Uint8Array>}