mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-04 02:09:22 +02:00
This commit is contained in:
parent
746e163d01
commit
1c7ea28b46
808 changed files with 316395 additions and 381162 deletions
15
node_modules/hls.js/src/utils/webvtt-parser.ts
generated
vendored
15
node_modules/hls.js/src/utils/webvtt-parser.ts
generated
vendored
|
@ -1,6 +1,9 @@
|
|||
import { VTTParser } from './vttparser';
|
||||
import { utf8ArrayToStr } from '../demux/id3';
|
||||
import { toMpegTsClockFromTimescale } from './timescale-conversion';
|
||||
import {
|
||||
RationalTimestamp,
|
||||
toMpegTsClockFromTimescale,
|
||||
} from './timescale-conversion';
|
||||
import { normalizePts } from '../remux/mp4-remuxer';
|
||||
import type { VTTCCs } from '../types/vtt';
|
||||
|
||||
|
@ -89,8 +92,7 @@ const calculateOffset = function (vttCCs: VTTCCs, cc, presentationTime) {
|
|||
|
||||
export function parseWebVTT(
|
||||
vttByteArray: ArrayBuffer,
|
||||
initPTS: number,
|
||||
timescale: number,
|
||||
initPTS: RationalTimestamp,
|
||||
vttCCs: VTTCCs,
|
||||
cc: number,
|
||||
timeOffset: number,
|
||||
|
@ -105,7 +107,10 @@ export function parseWebVTT(
|
|||
.replace(LINEBREAKS, '\n')
|
||||
.split('\n');
|
||||
const cues: VTTCue[] = [];
|
||||
const initPTS90Hz = toMpegTsClockFromTimescale(initPTS, timescale);
|
||||
const init90kHz = toMpegTsClockFromTimescale(
|
||||
initPTS.baseTime,
|
||||
initPTS.timescale
|
||||
);
|
||||
let cueTime = '00:00.000';
|
||||
let timestampMapMPEGTS = 0;
|
||||
let timestampMapLOCAL = 0;
|
||||
|
@ -118,7 +123,7 @@ export function parseWebVTT(
|
|||
let cueOffset = vttCCs.ccOffset;
|
||||
|
||||
// Calculate subtitle PTS offset
|
||||
const webVttMpegTsMapOffset = (timestampMapMPEGTS - initPTS90Hz) / 90000;
|
||||
const webVttMpegTsMapOffset = (timestampMapMPEGTS - init90kHz) / 90000;
|
||||
|
||||
// Update offsets for new discontinuities
|
||||
if (currCC?.new) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue