Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(cea): Add CEA parser for TS #4697

Merged
merged 20 commits into from
Nov 28, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions lib/cea/ts_cea_parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ shaka.cea.TsCeaParser = class {
for (const nalu of videoNalus) {
if (nalu.type == ICeaParser.H264_NALU_TYPE_SEI &&
nalu.time != null) {
for (const packet of this.seiProcessor_
.process(nalu.data)) {
for (const packet of this.seiProcessor_.process(nalu.data)) {
captionPackets.push({
packet: packet,
pts: nalu.time,
Expand Down
8 changes: 5 additions & 3 deletions lib/util/ts_parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,9 @@ shaka.util.TsParser = class {
/**
* Parse AVC Nalus
*
* The code is based on hls.js
* Credit to https://github.com/video-dev/hls.js/blob/master/src/demux/tsdemuxer.ts
*
* @param {shaka.util.TsParser.PES} pes
* @return {!Array.<shaka.util.TsParser.AvcNalu>}
*/
Expand All @@ -356,8 +359,7 @@ shaka.util.TsParser = class {

while (i < len) {
const value = data[i++];
// optimization. state 0 and 1 are the predominant case. let's handle
// them outside of the switch/case
// optimization. state 0 and 1 are the predominant case.
if (state == 0) {
avelad marked this conversation as resolved.
Show resolved Hide resolved
state = value ? 0 : 1;
continue;
Expand Down Expand Up @@ -599,7 +601,7 @@ shaka.util.TsParser.PES;
* time: ?number
* }}
*
* @summary PES.
* @summary AvcNalu.
* @property {!Uint8Array} data
* @property {string} type
avelad marked this conversation as resolved.
Show resolved Hide resolved
* @property {?number} time
Expand Down