mjpeg-player: revert reorder of switch cases to minimise diff

This commit is contained in:
Trek H 2019-12-13 14:03:39 +10:30
parent 9ba9eb14af
commit ee4b188175
1 changed files with 37 additions and 37 deletions

View File

@ -121,6 +121,43 @@ class MTSDemuxer{
offset = start + 4; offset = start + 4;
} }
switch (pid) { switch (pid) {
case videoId:
if (pusi) {
if (videoData && (pes = parsePES(videoData)) && pes.pts !== undefined) {
videoTrack.data.push(pes.data);
// TODO: here pes contains data, pts, dts and len. Are all these needed?
}
videoData = { data: [], size: 0 };
}
if (videoData) {
videoData.data.push(data.subarray(offset, start + 188));
videoData.size += start + 188 - offset;
}
break;
case audioId:
if (pusi) {
if (audioData && (pes = parsePES(audioData)) && pes.pts !== undefined) {
audioTrack.data.push(pes.data);
}
audioData = { data: [], size: 0 };
}
if (audioData) {
audioData.data.push(data.subarray(offset, start + 188));
audioData.size += start + 188 - offset;
}
break;
case id3Id:
if (pusi) {
if (id3Data && (pes = parsePES(id3Data)) && pes.pts !== undefined) {
id3Track.data.push(pes.data);
}
id3Data = { data: [], size: 0 };
}
if (id3Data) {
id3Data.data.push(data.subarray(offset, start + 188));
id3Data.size += start + 188 - offset;
}
break;
case 0: case 0:
if (pusi) { if (pusi) {
offset += data[offset] + 1; offset += data[offset] + 1;
@ -159,43 +196,6 @@ class MTSDemuxer{
} }
pmtParsed = this.pmtParsed = true; pmtParsed = this.pmtParsed = true;
break; break;
case videoId:
if (pusi) {
if (videoData && (pes = parsePES(videoData)) && pes.pts !== undefined) {
videoTrack.data.push(pes.data);
// TODO: here pes contains data, pts, dts and len. Are all these needed?
}
videoData = { data: [], size: 0 };
}
if (videoData) {
videoData.data.push(data.subarray(offset, start + 188));
videoData.size += start + 188 - offset;
}
break;
case audioId:
if (pusi) {
if (audioData && (pes = parsePES(audioData)) && pes.pts !== undefined) {
audioTrack.data.push(pes.data);
}
audioData = { data: [], size: 0 };
}
if (audioData) {
audioData.data.push(data.subarray(offset, start + 188));
audioData.size += start + 188 - offset;
}
break;
case id3Id:
if (pusi) {
if (id3Data && (pes = parsePES(id3Data)) && pes.pts !== undefined) {
id3Track.data.push(pes.data);
}
id3Data = { data: [], size: 0 };
}
if (id3Data) {
id3Data.data.push(data.subarray(offset, start + 188));
id3Data.size += start + 188 - offset;
}
break;
default: default:
unknownPIDs = true; unknownPIDs = true;
break; break;