1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-04 10:19:24 +02:00

Chromecast moved to PlayerSkins plugin

aisplay option added on PlayerSkins
This commit is contained in:
Daniel Neto 2024-10-30 20:19:49 -03:00
parent 480ae72b99
commit efd0665a44
286 changed files with 72588 additions and 1487 deletions

View file

@ -17,11 +17,11 @@ var findBox = require('../mp4/find-box.js');
var parseTfdt = require('../tools/parse-tfdt.js');
var parseTrun = require('../tools/parse-trun.js');
var parseTfhd = require('../tools/parse-tfhd.js');
var window = require('global/window');
var _require = require('./samples.js'),
getMdatTrafPairs = _require.getMdatTrafPairs,
parseSamples = _require.parseSamples;
/**
* Maps an offset in the mdat to a sample based on the the size of the samples.
* Assumes that `parseSamples` has been called first.
@ -123,61 +123,6 @@ var findSeiNals = function findSeiNals(avcStream, samples, trackId) {
return result;
};
/**
* Parses sample information out of Track Run Boxes and calculates
* the absolute presentation and decode timestamps of each sample.
*
* @param {Array<Uint8Array>} truns - The Trun Run boxes to be parsed
* @param {Number|BigInt} baseMediaDecodeTime - base media decode time from tfdt
@see ISO-BMFF-12/2015, Section 8.8.12
* @param {Object} tfhd - The parsed Track Fragment Header
* @see inspect.parseTfhd
* @return {Object[]} the parsed samples
*
* @see ISO-BMFF-12/2015, Section 8.8.8
**/
var parseSamples = function parseSamples(truns, baseMediaDecodeTime, tfhd) {
var currentDts = baseMediaDecodeTime;
var defaultSampleDuration = tfhd.defaultSampleDuration || 0;
var defaultSampleSize = tfhd.defaultSampleSize || 0;
var trackId = tfhd.trackId;
var allSamples = [];
truns.forEach(function (trun) {
// Note: We currently do not parse the sample table as well
// as the trun. It's possible some sources will require this.
// moov > trak > mdia > minf > stbl
var trackRun = parseTrun(trun);
var samples = trackRun.samples;
samples.forEach(function (sample) {
if (sample.duration === undefined) {
sample.duration = defaultSampleDuration;
}
if (sample.size === undefined) {
sample.size = defaultSampleSize;
}
sample.trackId = trackId;
sample.dts = currentDts;
if (sample.compositionTimeOffset === undefined) {
sample.compositionTimeOffset = 0;
}
if (typeof currentDts === 'bigint') {
sample.pts = currentDts + window.BigInt(sample.compositionTimeOffset);
currentDts += window.BigInt(sample.duration);
} else {
sample.pts = currentDts + sample.compositionTimeOffset;
currentDts += sample.duration;
}
});
allSamples = allSamples.concat(samples);
});
return allSamples;
};
/**
* Parses out caption nals from an FMP4 segment's video tracks.
*
@ -189,20 +134,8 @@ var parseSamples = function parseSamples(truns, baseMediaDecodeTime, tfhd) {
var parseCaptionNals = function parseCaptionNals(segment, videoTrackId) {
// To get the samples
var trafs = findBox(segment, ['moof', 'traf']); // To get SEI NAL units
var mdats = findBox(segment, ['mdat']);
var captionNals = {};
var mdatTrafPairs = []; // Pair up each traf with a mdat as moofs and mdats are in pairs
mdats.forEach(function (mdat, index) {
var matchingTraf = trafs[index];
mdatTrafPairs.push({
mdat: mdat,
traf: matchingTraf
});
});
var mdatTrafPairs = getMdatTrafPairs(segment);
mdatTrafPairs.forEach(function (pair) {
var mdat = pair.mdat;
var traf = pair.traf;