mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
update components
This commit is contained in:
parent
2a72f0256e
commit
048ba20590
26 changed files with 1377 additions and 136 deletions
|
@ -23,6 +23,7 @@
|
|||
this.remuxerClass = remuxerClass;
|
||||
this.lastCC = 0;
|
||||
this.remuxer = new this.remuxerClass(observer);
|
||||
this._userData = [];
|
||||
}
|
||||
|
||||
static probe(data) {
|
||||
|
@ -42,6 +43,7 @@
|
|||
this._avcTrack = {type: 'video', id :-1, sequenceNumber: 0, samples : [], len : 0, nbNalu : 0};
|
||||
this._aacTrack = {type: 'audio', id :-1, sequenceNumber: 0, samples : [], len : 0};
|
||||
this._id3Track = {type: 'id3', id :-1, sequenceNumber: 0, samples : [], len : 0};
|
||||
this._txtTrack = {type: 'text', id: -1, sequenceNumber: 0, samples: [], len: 0};
|
||||
this.remuxer.switchLevel();
|
||||
}
|
||||
|
||||
|
@ -81,6 +83,9 @@
|
|||
avcId = this._avcTrack.id,
|
||||
aacId = this._aacTrack.id,
|
||||
id3Id = this._id3Track.id;
|
||||
|
||||
// don't parse last TS packet if incomplete
|
||||
len -= len % 188;
|
||||
// loop through TS packets
|
||||
for (start = 0; start < len; start += 188) {
|
||||
if (data[start] === 0x47) {
|
||||
|
@ -165,7 +170,7 @@
|
|||
}
|
||||
|
||||
remux() {
|
||||
this.remuxer.remux(this._aacTrack,this._avcTrack, this._id3Track, this.timeOffset, this.contiguous);
|
||||
this.remuxer.remux(this._aacTrack, this._avcTrack, this._id3Track, this._txtTrack, this.timeOffset, this.contiguous);
|
||||
}
|
||||
|
||||
destroy() {
|
||||
|
@ -281,8 +286,10 @@
|
|||
debug = false,
|
||||
key = false,
|
||||
length = 0,
|
||||
expGolombDecoder,
|
||||
avcSample,
|
||||
push;
|
||||
push,
|
||||
i;
|
||||
// no NALu found
|
||||
if (units.length === 0 && samples.length > 0) {
|
||||
// append pes.data to previous NAL unit
|
||||
|
@ -298,6 +305,7 @@
|
|||
//free pes.data to save up some memory
|
||||
pes.data = null;
|
||||
var debugString = '';
|
||||
|
||||
units.forEach(unit => {
|
||||
switch(unit.type) {
|
||||
//NDR
|
||||
|
@ -315,11 +323,67 @@
|
|||
}
|
||||
key = true;
|
||||
break;
|
||||
//SEI
|
||||
case 6:
|
||||
push = true;
|
||||
if(debug) {
|
||||
debugString += 'SEI ';
|
||||
}
|
||||
expGolombDecoder = new ExpGolomb(unit.data);
|
||||
|
||||
// skip frameType
|
||||
expGolombDecoder.readUByte();
|
||||
|
||||
var payloadType = expGolombDecoder.readUByte();
|
||||
|
||||
// TODO: there can be more than one payload in an SEI packet...
|
||||
// TODO: need to read type and size in a while loop to get them all
|
||||
if (payloadType === 4)
|
||||
{
|
||||
var payloadSize = 0;
|
||||
|
||||
do {
|
||||
payloadSize = expGolombDecoder.readUByte();
|
||||
}
|
||||
while (payloadSize === 255);
|
||||
|
||||
var countryCode = expGolombDecoder.readUByte();
|
||||
|
||||
if (countryCode === 181)
|
||||
{
|
||||
var providerCode = expGolombDecoder.readUShort();
|
||||
|
||||
if (providerCode === 49)
|
||||
{
|
||||
var userStructure = expGolombDecoder.readUInt();
|
||||
|
||||
if (userStructure === 0x47413934)
|
||||
{
|
||||
var userDataType = expGolombDecoder.readUByte();
|
||||
|
||||
// Raw CEA-608 bytes wrapped in CEA-708 packet
|
||||
if (userDataType === 3)
|
||||
{
|
||||
var firstByte = expGolombDecoder.readUByte();
|
||||
var secondByte = expGolombDecoder.readUByte();
|
||||
|
||||
var totalCCs = 31 & firstByte;
|
||||
var byteArray = [firstByte, secondByte];
|
||||
|
||||
for (i=0; i<totalCCs; i++)
|
||||
{
|
||||
// 3 bytes per CC
|
||||
byteArray.push(expGolombDecoder.readUByte());
|
||||
byteArray.push(expGolombDecoder.readUByte());
|
||||
byteArray.push(expGolombDecoder.readUByte());
|
||||
}
|
||||
|
||||
this._txtTrack.samples.push({type: 3, pts: pes.pts, bytes: byteArray});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
//SPS
|
||||
case 7:
|
||||
|
@ -328,7 +392,7 @@
|
|||
debugString += 'SPS ';
|
||||
}
|
||||
if(!track.sps) {
|
||||
var expGolombDecoder = new ExpGolomb(unit.data);
|
||||
expGolombDecoder = new ExpGolomb(unit.data);
|
||||
var config = expGolombDecoder.readSPS();
|
||||
track.width = config.width;
|
||||
track.height = config.height;
|
||||
|
@ -337,7 +401,7 @@
|
|||
track.duration = this.remuxer.timescale * this._duration;
|
||||
var codecarray = unit.data.subarray(1, 4);
|
||||
var codecstring = 'avc1.';
|
||||
for (var i = 0; i < 3; i++) {
|
||||
for (i = 0; i < 3; i++) {
|
||||
var h = codecarray[i].toString(16);
|
||||
if (h.length < 2) {
|
||||
h = '0' + h;
|
||||
|
@ -358,7 +422,7 @@
|
|||
}
|
||||
break;
|
||||
case 9:
|
||||
push = true;
|
||||
push = false;
|
||||
if(debug) {
|
||||
debugString += 'AUD ';
|
||||
}
|
||||
|
@ -443,10 +507,6 @@
|
|||
}
|
||||
lastUnitStart = i;
|
||||
lastUnitType = unitType;
|
||||
if (unitType === 1 || unitType === 5) {
|
||||
// OPTI !!! if IDR/NDR unit, consider it is last NALu
|
||||
i = len;
|
||||
}
|
||||
state = 0;
|
||||
} else {
|
||||
state = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue