mjpeg-player: cosmetic changes to minimise diff

This commit is contained in:
Trek H 2019-12-13 13:53:52 +10:30
parent 47d9130385
commit 9ba9eb14af
1 changed files with 44 additions and 48 deletions

View File

@ -36,6 +36,7 @@ class MTSDemuxer{
init() {
this.pmtParsed = false;
this._pmtId = -1;
this._videoTrack = MTSDemuxer.createTrack('video');
this._audioTrack = MTSDemuxer.createTrack('audio');
this._id3Track = MTSDemuxer.createTrack('id3');
@ -80,26 +81,22 @@ class MTSDemuxer{
}
append(data) {
let videoTrack = this._videoTrack;
let videoData = videoTrack.pesData;
let videoId = videoTrack.pid;
let audioTrack = this._audioTrack;
let audioData = audioTrack.pesData;
let audioId = audioTrack.pid;
let id3Track = this._id3Track;
let id3Data = id3Track.pesData;
let id3Id = id3Track.pid;
let pmtId = this._pmtId;
let pmtParsed = this.pmtParsed;
let parsePAT = this._parsePAT;
let parsePMT = this._parsePMT;
let parsePES = this._parsePES;
let len = data.length;
let unknownPIDs = false;
let start, len = data.length, pusi, pid, afc, offset, pes,
unknownPIDs = false;
let pmtParsed = this.pmtParsed,
videoTrack = this._videoTrack,
audioTrack = this._audioTrack,
id3Track = this._id3Track,
videoId = videoTrack.pid,
audioId = audioTrack.pid,
id3Id = id3Track.pid,
pmtId = this._pmtId,
videoData = videoTrack.pesData,
audioData = audioTrack.pesData,
id3Data = id3Track.pesData,
parsePAT = this._parsePAT,
parsePMT = this._parsePMT,
parsePES = this._parsePES;
const syncOffset = MTSDemuxer._syncOffset(data);
@ -107,7 +104,6 @@ class MTSDemuxer{
len -= (len + syncOffset) % 188;
// Loop through TS packets.
let start, offset, pusi, pid, afc, pes;
for (start = syncOffset; start < len; start += 188) {
if (data[start] === 0x47) {
pusi = !!(data[start + 1] & 0x40);
@ -242,12 +238,12 @@ class MTSDemuxer{
}
_parsePMT (data, offset) {
let pid;
let result = { audio: -1, video: -1, id3: -1};
let sectionLength = (data[offset + 1] & 0x0f) << 8 | data[offset + 2];
let tableEnd = offset + 3 + sectionLength - 4;
// To determine where the table is, we have to figure out how long the program info descriptors are.
let programInfoLength = (data[offset + 10] & 0x0f) << 8 | data[offset + 11];
let programInfoLength, pid, result = { audio: -1, video: -1, id3: -1},
sectionLength = (data[offset + 1] & 0x0f) << 8 | data[offset + 2],
tableEnd = offset + 3 + sectionLength - 4;
// To determine where the table is, we have to figure out how
// long the program info descriptors are.
programInfoLength = (data[offset + 10] & 0x0f) << 8 | data[offset + 11];
// Advance the offset to the first entry in the mapping table.
offset += 12 + programInfoLength;
while (offset < tableEnd) {