Class: shaka.msf.packaging.Mpeg2tsProgram

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.
Source:

Members

MAX_SECTION_LENGTH_ :number

The longest a PAT or PMT section may be.
Type:
  • number
Source:

NULL_PID_ :number

@const
Type:
  • number
Source:

PACKET_SIZE :number

Type:
  • number
Source:

PAT_PID_ :number

@const
Type:
  • number
Source:

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>
Source:

filter_ :boolean

Type:
  • boolean
Source:

patContinuityCounter_ :number

Type:
  • number
Source:

patPackets_ :Array<!Uint8Array>

Type:
  • Array<!Uint8Array>
Source:

pcrPid_ :number

Type:
  • number
Source:

pmtPackets_ :Array<!Uint8Array>

Type:
  • Array<!Uint8Array>
Source:

pmtPid_ :number

Type:
  • number
Source:

programNumber_ :number

Type:
  • number
Source:

rewrittenPat_ :Uint8Array

The rewritten PAT produced by the packet being processed, if any.
Type:
  • Uint8Array
Source:

sections_ :Map<number, shaka.msf.packaging.Mpeg2tsProgram.Section>

Sections still being reassembled, by PID.
Type:
Source:

selectedProgram_ :number

The program the PAT selected, which is the requested one when there is one.
Type:
  • number
Source:

streams_ :Map<number, number>

The stream_type of each elementary stream the PMT lists, by PID.
Type:
  • Map<number, number>
Source:

Methods

copyPackets_(packetsnon-null) → {Array<!Uint8Array>}

Parameters:
Name Type Description
packets Array<!Uint8Array>
Source:
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
Source:
Returns:
Type
number

getPid(packetnon-null) → {number}

Parameters:
Name Type Description
packet Uint8Array
Source:
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
Source:
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
Source:
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.
Source:
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.
Source:
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.
Source:
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
Source:
Returns:
Type
boolean

onPat_(sectionnon-null, packetsnon-null)

Parameters:
Name Type Description
section Uint8Array
packets Array<!Uint8Array>
Source:

onPmt_(sectionnon-null, packetsnon-null)

Parameters:
Name Type Description
section Uint8Array
packets Array<!Uint8Array>
Source:

onSection_(pid, sectionnon-null, packetsnon-null)

Parameters:
Name Type Description
pid number
section Uint8Array
packets Array<!Uint8Array> The packets the section came in.
Source:

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
Source:
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
Source:

Type Definitions

Section

A PSI section being reassembled from the packets it spans.
Type:
  • {data: !Uint8Array, received: number, packets: !Array<!Uint8Array>}
Source: