Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mux.js

Package Overview
Dependencies
Maintainers
2
Versions
104
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mux.js - npm Package Compare versions

Comparing version 1.2.0 to 1.3.0

39

lib/m2ts/m2ts.js

@@ -286,5 +286,6 @@ /**

// mathematical operations.
// We construct a 32-bit value using bitwise operators over the 32
// most significant bits and then multiply by 2 (equal to a left-shift
// of 1) before we add the final LSB of the timestamp (equal to an OR.)
// We construct a 31-bit value using bitwise operators over the 31
// most significant bits and then multiply by 4 (equal to a left-shift
// of 2) before we add the final 2 least significant bits of the
// timestamp (equal to an OR.)
if (ptsDtsFlags & 0xC0) {

@@ -294,18 +295,18 @@ // the PTS and DTS are not written out directly. For information

// http://dvd.sourceforge.net/dvdinfo/pes-hdr.html
pes.pts = (payload[9] & 0x0E) << 28
| (payload[10] & 0xFF) << 21
| (payload[11] & 0xFE) << 13
| (payload[12] & 0xFF) << 6
| (payload[13] & 0xFE) >>> 2;
pes.pts *= 2; // Left shift by 1
pes.pts += (payload[13] & 0x02) >>> 1; // OR by the LSB
pes.pts = (payload[9] & 0x0E) << 27
| (payload[10] & 0xFF) << 20
| (payload[11] & 0xFE) << 12
| (payload[12] & 0xFF) << 5
| (payload[13] & 0xFE) >>> 3;
pes.pts *= 4; // Left shift by 2
pes.pts += (payload[13] & 0x06) >>> 1; // OR by the two LSBs
pes.dts = pes.pts;
if (ptsDtsFlags & 0x40) {
pes.dts = (payload[14] & 0x0E ) << 28
| (payload[15] & 0xFF ) << 21
| (payload[16] & 0xFE ) << 13
| (payload[17] & 0xFF ) << 6
| (payload[18] & 0xFE ) >>> 2;
pes.dts *= 2; // Left shift by 1
pes.dts += (payload[18] & 0x02) >>> 1; // OR by the LSB
pes.dts = (payload[14] & 0x0E ) << 27
| (payload[15] & 0xFF ) << 20
| (payload[16] & 0xFE ) << 12
| (payload[17] & 0xFF ) << 5
| (payload[18] & 0xFE ) >>> 3;
pes.dts *= 4; // Left shift by 2
pes.dts += (payload[18] & 0x06) >>> 1; // OR by the two LSBs
}

@@ -406,3 +407,5 @@ }

track = {
timelineStartInfo: {}
timelineStartInfo: {
baseMediaDecodeTime: 0
}
};

@@ -409,0 +412,0 @@ track.id = +k;

@@ -301,5 +301,2 @@ /**

track.timelineStartInfo.pts = data.pts;
} else {
track.timelineStartInfo.pts =
Math.min(track.timelineStartInfo.pts, data.pts);
}

@@ -311,5 +308,2 @@ }

track.timelineStartInfo.dts = data.dts;
} else {
track.timelineStartInfo.dts =
Math.min(track.timelineStartInfo.dts, data.dts);
}

@@ -350,3 +344,3 @@

track.baseMediaDecodeTime = track.minSegmentDts - track.timelineStartInfo.dts;
track.baseMediaDecodeTime = track.minSegmentDts - track.timelineStartInfo.dts + track.timelineStartInfo.baseMediaDecodeTime;

@@ -430,2 +424,3 @@ if (track.type === 'audio') {

timelineStartPts = 0,
baseMediaDecodeTime = 0,
i;

@@ -441,4 +436,6 @@

timelineStartPts = this.videoTrack.timelineStartInfo.pts;
baseMediaDecodeTime = this.videoTrack.timelineStartInfo.baseMediaDecodeTime;
} else if (this.audioTrack) {
timelineStartPts = this.audioTrack.timelineStartInfo.pts;
baseMediaDecodeTime = this.audioTrack.timelineStartInfo.baseMediaDecodeTime;
}

@@ -475,5 +472,5 @@

caption = this.pendingCaptions[i];
caption.startTime = caption.startPts - timelineStartPts;
caption.startTime = (caption.startPts - timelineStartPts) + baseMediaDecodeTime;
caption.startTime /= 90e3;
caption.endTime = caption.endPts - timelineStartPts;
caption.endTime = (caption.endPts - timelineStartPts) + baseMediaDecodeTime;
caption.endTime /= 90e3;

@@ -487,3 +484,3 @@ event.captions.push(caption);

id3 = this.pendingMetadata[i];
id3.cueTime = id3.pts - timelineStartPts;
id3.cueTime = (id3.pts - timelineStartPts) + baseMediaDecodeTime;
id3.cueTime /= 90e3;

@@ -524,3 +521,2 @@ event.metadata.push(id3);

audioTrack,
packetStream, parseStream, elementaryStream,

@@ -534,2 +530,4 @@ aacStream, h264Stream,

this.baseMediaDecodeTime = options.baseMediaDecodeTime || 0;
// expose the metadata stream

@@ -572,3 +570,3 @@ this.metadataStream = new muxjs.mp2t.MetadataStream();

elementaryStream.on('data', function(data) {
var i, videoTrack, audioTrack;
var i;

@@ -580,6 +578,8 @@ if (data.type === 'metadata') {

while (i--) {
if (data.tracks[i].type === 'video') {
if (!videoTrack && data.tracks[i].type === 'video') {
videoTrack = data.tracks[i];
} else if (data.tracks[i].type === 'audio') {
videoTrack.timelineStartInfo.baseMediaDecodeTime = self.baseMediaDecodeTime;
} else if (!audioTrack && data.tracks[i].type === 'audio') {
audioTrack = data.tracks[i];
audioTrack.timelineStartInfo.baseMediaDecodeTime = self.baseMediaDecodeTime;
}

@@ -627,2 +627,18 @@ }

this.setBaseMediaDecodeTime = function (baseMediaDecodeTime) {
this.baseMediaDecodeTime = baseMediaDecodeTime;
if (audioTrack) {
audioTrack.timelineStartInfo.dts = undefined;
audioTrack.timelineStartInfo.pts = undefined;
clearDtsInfo(audioTrack);
audioTrack.timelineStartInfo.baseMediaDecodeTime = baseMediaDecodeTime;
}
if (videoTrack) {
videoTrack.timelineStartInfo.dts = undefined;
videoTrack.timelineStartInfo.pts = undefined;
clearDtsInfo(videoTrack);
videoTrack.timelineStartInfo.baseMediaDecodeTime = baseMediaDecodeTime;
}
};
// feed incoming data to the front of the parsing pipeline

@@ -629,0 +645,0 @@ this.push = function(data) {

{
"name": "mux.js",
"version": "1.2.0",
"version": "1.3.0",
"description": "A collection of lightweight utilities for inspecting and manipulating video container formats.",

@@ -5,0 +5,0 @@ "repository": {

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc