Skip to content

Commit

Permalink
Add SEI with resolution payloadType 5 based on H264 specification (Us…
Browse files Browse the repository at this point in the history
…er data unregistered SEI message) (video-dev#2126)
  • Loading branch information
bruce1i authored and John Bartos committed May 7, 2019
1 parent 634946a commit f4792b4
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/demux/tsdemuxer.js
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,33 @@ class TSDemuxer {
}
}
}
} else if (payloadType === 5 && expGolombDecoder.bytesAvailable !== 0) {
endOfCaptions = true;

if (payloadSize > 16) {
let uuidStrArray = [];
let userDataPayloadBytes = [];

for (i = 0; i < 16; i++) {
uuidStrArray.push(expGolombDecoder.readUByte().toString(16));

if (i === 3 || i === 5 || i === 7 || i === 9) {
uuidStrArray.push('-');
}
}

for (i = 16; i < payloadSize; i++) {
userDataPayloadBytes.push(expGolombDecoder.readUByte());
}

this._insertSampleInOrder(this._txtTrack.samples, {
pts: pes.pts,
payloadType: payloadType,
uuid: uuidStrArray.join(''),
userData: String.fromCharCode.apply(null, userDataPayloadBytes),
userDataBytes: userDataPayloadBytes
});
}
} else if (payloadSize < expGolombDecoder.bytesAvailable) {
for (i = 0; i < payloadSize; i++) {
expGolombDecoder.readUByte();
Expand Down

0 comments on commit f4792b4

Please sign in to comment.