Class: shaka.msf.packaging.Mpeg2ts

Members

DEFAULT_AUDIO_CODECS_ :Map<string, string>

@const
Type:
  • Map<string, string>
Source:

DEFAULT_VIDEO_CODECS_ :Map<string, string>

@const
Type:
  • Map<string, string>
Source:

M2TS_PACKET_SIZE :number

The size of an M2TS source packet: a transport packet behind a 4-octet prefix.
Type:
  • number
Source:

M2TS_PREFIX_SIZE :number

Type:
  • number
Source:

MAX_PID_ :number

@const
Type:
  • number
Source:

Mode_ :string

The values of mpeg2tsMode.
Type:
  • string
Properties:
Name Value Type Description
UNMODIFIED_PROGRAM unmodified-program string
UNMODIFIED_MULTIPLEX unmodified-multiplex string
PER_PROGRAM per-program string
ES_PACKETS es-packets string
Source:

TS_PACKET_SIZE :number

The size of an MPEG-2 transport packet.
Type:
  • number
Source:

Methods

codecsFromPsi_(psinon-null) → {Array<string>}

Reads the codecs of a program from its PMT. A PMT only says which kind of codec each stream uses, not its profile or level, so these are the same defaults used when a transport stream is probed. The transmuxer writes the real ones into the initialization segment it produces.
Parameters:
Name Type Description
psi Uint8Array The program's PAT and PMT.
Source:
Returns:
Type
Array<string>

feed_(programnon-null, datanon-null)

Parameters:
Name Type Description
program shaka.msf.packaging.Mpeg2tsProgram
data Uint8Array 188-octet transport packets.
Source:

isAudioCodec_(codec) → {boolean}

Parameters:
Name Type Description
codec string
Source:
Returns:
Type
boolean

isVideoCodec_(codec) → {boolean}

Parameters:
Name Type Description
codec string
Source:
Returns:
Type
boolean

isWholePackets_(datanon-null, packetSize) → {boolean}

Parameters:
Name Type Description
data Uint8Array
packetSize number
Source:
Returns:
Type
boolean

normalizePackets_(datanon-null, packetSize) → {Uint8Array}

Copies out the 188-octet transport packets of a buffer of source packets, dropping the 4-octet prefix of 192-octet M2TS source packets. Whatever the prefix carries -- an arrival time, or something the draft leaves opaque -- says nothing about presentation, so nothing downstream wants it. Removing it here means the rest of the player only ever sees plain transport packets.
Parameters:
Name Type Description
data Uint8Array
packetSize number
Source:
Returns:
Type
Uint8Array

createSegmenter(codecopt) → {shaka.extern.MsfSegmenter}

Creates a segmenter for the track this instance described. Called each time the stream's segment index is created, so a track that is unsubscribed and resubscribed starts from a clean segmenter.
Parameters:
Name Type Attributes Description
codec shaka.extern.MsfCodec <optional>
The negotiated draft's primitive codec. A packaging whose objects carry MoQT-encoded fields -- Object Properties, for one -- needs it, because that encoding changed between draft-16 and draft-18 and the object bytes alone do not say which one they are in. Packagings that read no such field ignore it.
Implements:
Source:
Returns:
Type
shaka.extern.MsfSegmenter

describeTrack(track, initDatanon-null) → {shaka.extern.MsfTrackDescription}

Inspects a catalog track and describes how to present it, or returns null if this packaging cannot handle the track, in which case the track is skipped. Called once per track, before any objects arrive.
Parameters:
Name Type Description
track msfCatalog.Track
initData Uint8Array The track's resolved initialization data, empty when the catalog carries none. Its meaning is packaging-specific: an MP4 initialization segment for CMAF, PAT/PMT transport packets for mpeg2ts.
Implements:
Source:
Returns:
Type
shaka.extern.MsfTrackDescription

Type Definitions

Config

What a segmenter needs to know about its track.
Type:
  • {packetSize: number, psi: !Uint8Array, programNumber: ?number, filter: boolean, timingContentType: string, frameDuration: number, pcrPid: ?number, randomAccess: boolean}
Properties:
Name Type Attributes Description
packetSize number The source packet size, 188 or 192.
psi Uint8Array The catalog's initialization packets, normalized to 188 octets.
programNumber number <nullable>
The program to follow, or null for the first one.
filter boolean Whether the track is a multiplex to cut down to that program.
timingContentType string The elementary stream the track's timing is read from.
frameDuration number Seconds per frame from the catalog, or 0 when it does not say.
pcrPid number <nullable>
The catalog's PCR PID, used until the PMT has been seen.
randomAccess boolean Whether every group is guaranteed to begin at a random access point.
Source: