Constructor
new Mpeg2tsSegmenter(config)
Parameters:
| Name | Type | Description |
|---|---|---|
config |
shaka.msf.packaging.Mpeg2ts.Config |
- Implements:
- Source:
Members
hasMedia_ :boolean
Whether an elementary stream has started a PES packet in the current
part, which is what makes a discontinuity worth a part of its own.
Type:
- boolean
- Source:
packets_ :Array<!Uint8Array>
The 188-octet transport packets kept of the current part of the group.
Type:
- Array<!Uint8Array>
- Source:
psi_ :Uint8Array
The PAT and PMT known when the current part began, which is what to put
in front of it if it does not open with its own.
Type:
- Uint8Array
- Source:
timelineOffset_ :number
Maps media time onto presentation time. Non-zero only once a
discontinuity has moved the media's own clock.
Type:
- number
- Source:
tsParser_ :shaka.util.TsParser
Kept across groups so that its 33-bit timestamp rollover reference
survives, which is what lets a group that straddles the wrap be timed
correctly.
Type:
- Source:
waitingForRandomAccess_ :boolean
Whether the first random access point is still to come. A subscription
joins a track at the start of a Group, and when the catalog does not
guarantee that a Group starts at a random access point, what comes
before the first one cannot be decoded.
Type:
- boolean
- Source:
Methods
append_(datanon-null) → {Array<!shaka.extern.MsfSegment>}
Validates an object's source packets and holds onto what is kept of them
until the group ends.
Parameters:
| Name | Type | Description |
|---|---|---|
data |
Uint8Array |
- Source:
Returns:
A part of the group cut short
by a discontinuity, if there was one.
- Type
- Array<!shaka.extern.MsfSegment>
buildData_(psinon-null, packetsnon-null) → {Uint8Array}
Copies the part's transport packets into one buffer, behind the program
information it needs.
The PAT/PMT is prepended because the draft only requires a publisher to
repeat the program information periodically, so a group may open without
it, and a transport stream cannot be interpreted without it. The latest
one seen in the track is used rather than the catalog's, because the
program information in the media takes precedence when the two differ.
Parameters:
| Name | Type | Description |
|---|---|---|
psi |
Uint8Array | |
packets |
Array<!Uint8Array> |
- Source:
Returns:
- Type
- Uint8Array
findRandomAccess_(packetsnon-null) → {number}
The index of the packet that starts the first random access point among
the given packets, or -1 when there is none.
A random access point is a PES packet of the video stream that the
publisher flagged with random_access_indicator, or whose first picture is
an IDR. A track without H.264 or H.265 video can be decoded from
anywhere, as far as can be told here.
Parameters:
| Name | Type | Description |
|---|---|---|
packets |
Array<!Uint8Array> |
- Source:
Returns:
- Type
- number
flush_() → {shaka.extern.MsfSegment}
Turns the accumulated part of the group into a segment.
- Source:
Returns:
getTiming_() → {?{startTime: number, duration: number}}
Derives the part's presentation timing from the timestamps of the
elementary stream the track is presented as.
- Source:
Returns:
- Type
- ?{startTime: number, duration: number}
isDiscontinuity_(packetnon-null, pid) → {boolean}
Reads the adaptation field's discontinuity_indicator, which is how the
draft requires a publisher to signal that it moved the clock between two
groups.
Only the PCR PID is trusted, because on other PIDs the same bit signals a
continuity counter discontinuity, which is a different thing and does not
move the clock. The PMT says which PID that is; the catalog's value is
advisory and only used until the PMT has been seen.
Parameters:
| Name | Type | Description |
|---|---|---|
packet |
Uint8Array | |
pid |
number |
- Source:
Returns:
- Type
- boolean
push(objnon-null) → {Array<!shaka.extern.MsfSegment>}
Consumes one MoQT object and returns the segments it completed, which is
usually none or one. Objects with an empty payload carry an object status
rather than media and are delivered here too, because for some packagings
they are the signal that a Group has ended.
Parameters:
| Name | Type | Description |
|---|---|---|
obj |
shaka.extern.MsfObject |
- Implements:
- Source:
Returns:
- Type
- Array<!shaka.extern.MsfSegment>
resetGroup_()
- Source:
startsWithIdr_(packetsnon-null, index, pid, streamType) → {boolean}
Whether the first picture of the PES packet that starts at the given
packet is an IDR.
Parameters:
| Name | Type | Description |
|---|---|---|
packets |
Array<!Uint8Array> | |
index |
number | |
pid |
number | |
streamType |
number |
- Source:
Returns:
- Type
- boolean