fixes lint and svelte-check
This commit is contained in:
parent
bdd234d925
commit
c4cd974105
2 changed files with 49 additions and 24 deletions
|
|
@ -118,24 +118,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#debugger {
|
|
||||||
width: 100%;
|
|
||||||
height: 100vh;
|
|
||||||
background-color: hotpink;
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
z-index: 1;
|
|
||||||
|
|
||||||
img {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
object-fit: cover;
|
|
||||||
padding: 0;
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.step-foreground-container {
|
.step-foreground-container {
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
|
||||||
|
|
@ -50,9 +50,14 @@ class Writer {
|
||||||
* @param avccBox
|
* @param avccBox
|
||||||
* @returns {*}
|
* @returns {*}
|
||||||
*/
|
*/
|
||||||
|
interface NALUnit {
|
||||||
|
length: number;
|
||||||
|
nalu: number[];
|
||||||
|
}
|
||||||
|
|
||||||
const getExtradata = (avccBox: {
|
const getExtradata = (avccBox: {
|
||||||
SPS: string | unknown[];
|
SPS: NALUnit[];
|
||||||
PPS: string | unknown[];
|
PPS: NALUnit[];
|
||||||
configurationVersion: number;
|
configurationVersion: number;
|
||||||
AVCProfileIndication: number;
|
AVCProfileIndication: number;
|
||||||
profile_compatibility: number;
|
profile_compatibility: number;
|
||||||
|
|
@ -65,11 +70,11 @@ const getExtradata = (avccBox: {
|
||||||
let size = 7;
|
let size = 7;
|
||||||
for (i = 0; i < avccBox.SPS.length; i += 1) {
|
for (i = 0; i < avccBox.SPS.length; i += 1) {
|
||||||
// nalu length is encoded as a uint16.
|
// nalu length is encoded as a uint16.
|
||||||
size += 2 + avccBox.SPS[i].length;
|
size += 2 + (avccBox.SPS[i] as { length: number }).length;
|
||||||
}
|
}
|
||||||
for (i = 0; i < avccBox.PPS.length; i += 1) {
|
for (i = 0; i < avccBox.PPS.length; i += 1) {
|
||||||
// nalu length is encoded as a uint16.
|
// nalu length is encoded as a uint16.
|
||||||
size += 2 + avccBox.PPS[i].length;
|
size += 2 + (avccBox.PPS[i] as { length: number }).length;
|
||||||
}
|
}
|
||||||
|
|
||||||
const writer = new Writer(size);
|
const writer = new Writer(size);
|
||||||
|
|
@ -164,9 +169,47 @@ const decodeVideo = (
|
||||||
if (debug) console.info('Video with codec:', codec);
|
if (debug) console.info('Video with codec:', codec);
|
||||||
scrollyVideoState.framesData.codec = codec;
|
scrollyVideoState.framesData.codec = codec;
|
||||||
|
|
||||||
|
// Define a type for moov to avoid using 'any'
|
||||||
|
interface AvcCBox {
|
||||||
|
SPS: NALUnit[];
|
||||||
|
PPS: NALUnit[];
|
||||||
|
configurationVersion: number;
|
||||||
|
AVCProfileIndication: number;
|
||||||
|
profile_compatibility: number;
|
||||||
|
AVCLevelIndication: number;
|
||||||
|
lengthSizeMinusOne: number;
|
||||||
|
nb_SPS_nalus: number;
|
||||||
|
nb_PPS_nalus: number;
|
||||||
|
}
|
||||||
|
interface StsdEntry {
|
||||||
|
avcC: AvcCBox;
|
||||||
|
}
|
||||||
|
interface Stsd {
|
||||||
|
entries: StsdEntry[];
|
||||||
|
}
|
||||||
|
interface Stbl {
|
||||||
|
stsd: Stsd;
|
||||||
|
}
|
||||||
|
interface Minf {
|
||||||
|
stbl: Stbl;
|
||||||
|
}
|
||||||
|
interface Mdia {
|
||||||
|
minf: Minf;
|
||||||
|
}
|
||||||
|
interface Trak {
|
||||||
|
mdia: Mdia;
|
||||||
|
}
|
||||||
|
interface Moov {
|
||||||
|
traks: Trak[];
|
||||||
|
}
|
||||||
|
|
||||||
// Gets the avccbox used for reading extradata
|
// Gets the avccbox used for reading extradata
|
||||||
const avccBox =
|
const moov = mp4boxfile.moov as Moov | undefined;
|
||||||
mp4boxfile.moov.traks[0].mdia.minf.stbl.stsd.entries[0].avcC;
|
const avccBox = moov?.traks[0].mdia.minf.stbl.stsd.entries[0].avcC;
|
||||||
|
if (!avccBox) {
|
||||||
|
reject(new Error('Could not find avcC box for extradata.'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
const extradata = getExtradata(avccBox);
|
const extradata = getExtradata(avccBox);
|
||||||
|
|
||||||
// configure decoder
|
// configure decoder
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue