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

mux.js

Package Overview
Dependencies
Maintainers
15
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 5.6.3 to 5.6.4

6

dist/mux-flv.min.js

@@ -0,2 +1,8 @@

/**
* mux.js
*
* Copyright (c) Brightcove
* Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE
*/
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var i;i="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,i.muxjs=t()}}(function(){return function(){function t(i,e,s){function a(r,o){if(!e[r]){if(!i[r]){var h="function"==typeof require&&require;if(!o&&h)return h(r,!0);if(n)return n(r,!0);var p=new Error("Cannot find module '"+r+"'");throw p.code="MODULE_NOT_FOUND",p}var d=e[r]={exports:{}};i[r][0].call(d.exports,function(t){return a(i[r][1][t]||t)},d,d.exports,t,i,e,s)}return e[r].exports}for(var n="function"==typeof require&&require,r=0;r<s.length;r++)a(s[r]);return a}return t}()({1:[function(t,i,e){"use strict";var s,a=t(17),n=t(15).ONE_SECOND_IN_TS,r=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];s=function(t){var i,e=0;s.prototype.init.call(this),this.push=function(s){var a,o,h,p,d,l,u=0;if(t||(e=0),"audio"===s.type)for(i?(p=i,i=new Uint8Array(p.byteLength+s.data.byteLength),i.set(p),i.set(s.data,p.byteLength)):i=s.data;u+5<i.length;)if(255===i[u]&&240==(246&i[u+1])){if(o=2*(1&~i[u+1]),a=(3&i[u+3])<<11|i[u+4]<<3|(224&i[u+5])>>5,d=1024*(1+(3&i[u+6])),l=d*n/r[(60&i[u+2])>>>2],h=u+a,i.byteLength<h)return;if(this.trigger("data",{pts:s.pts+e*l,dts:s.dts+e*l,sampleCount:d,audioobjecttype:1+(i[u+2]>>>6&3),channelcount:(1&i[u+2])<<2|(192&i[u+3])>>>6,samplerate:r[(60&i[u+2])>>>2],samplingfrequencyindex:(60&i[u+2])>>>2,samplesize:16,data:i.subarray(u+7+o,h)}),e++,i.byteLength===h)return void(i=void 0);i=i.subarray(h)}else u++},this.flush=function(){e=0,this.trigger("done")},this.reset=function(){i=void 0,this.trigger("reset")},this.endTimeline=function(){i=void 0,this.trigger("endedtimeline")}},s.prototype=new a,i.exports=s},{15:15,17:17}],2:[function(t,i,e){"use strict";var s,a,n,r=t(17),o=t(16);a=function(){var t,i,e=0;a.prototype.init.call(this),this.push=function(s){var a;i?(a=new Uint8Array(i.byteLength+s.data.byteLength),a.set(i),a.set(s.data,i.byteLength),i=a):i=s.data;for(var n=i.byteLength;e<n-3;e++)if(1===i[e+2]){t=e+5;break}for(;t<n;)switch(i[t]){case 0:if(0!==i[t-1]){t+=2;break}if(0!==i[t-2]){t++;break}e+3!==t-2&&this.trigger("data",i.subarray(e+3,t-2));do{t++}while(1!==i[t]&&t<n);e=t-2,t+=3;break;case 1:if(0!==i[t-1]||0!==i[t-2]){t+=3;break}this.trigger("data",i.subarray(e+3,t-2)),e=t-2,t+=3;break;default:t+=3}i=i.subarray(e),t-=e,e=0},this.reset=function(){i=null,e=0,this.trigger("reset")},this.flush=function(){i&&i.byteLength>3&&this.trigger("data",i.subarray(e+3)),i=null,e=0,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")}},a.prototype=new r,n={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},s=function(){var t,i,e,r,h,p,d,l=new a;s.prototype.init.call(this),t=this,this.push=function(t){"video"===t.type&&(i=t.trackId,e=t.pts,r=t.dts,l.push(t))},l.on("data",function(s){var a={trackId:i,pts:e,dts:r,data:s};switch(31&s[0]){case 5:a.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:a.nalUnitType="sei_rbsp",a.escapedRBSP=h(s.subarray(1));break;case 7:a.nalUnitType="seq_parameter_set_rbsp",a.escapedRBSP=h(s.subarray(1)),a.config=p(a.escapedRBSP);break;case 8:a.nalUnitType="pic_parameter_set_rbsp";break;case 9:a.nalUnitType="access_unit_delimiter_rbsp"}t.trigger("data",a)}),l.on("done",function(){t.trigger("done")}),l.on("partialdone",function(){t.trigger("partialdone")}),l.on("reset",function(){t.trigger("reset")}),l.on("endedtimeline",function(){t.trigger("endedtimeline")}),this.flush=function(){l.flush()},this.partialFlush=function(){l.partialFlush()},this.reset=function(){l.reset()},this.endTimeline=function(){l.endTimeline()},d=function(t,i){var e,s,a=8,n=8;for(e=0;e<t;e++)0!==n&&(s=i.readExpGolomb(),n=(a+s+256)%256),a=0===n?a:n},h=function(t){for(var i,e,s=t.byteLength,a=[],n=1;n<s-2;)0===t[n]&&0===t[n+1]&&3===t[n+2]?(a.push(n+2),n+=2):n++;if(0===a.length)return t;i=s-a.length,e=new Uint8Array(i);var r=0;for(n=0;n<i;r++,n++)r===a[0]&&(r++,a.shift()),e[n]=t[r];return e},p=function(t){var i,e,s,a,r,h,p,l,u,c,f,g,y,m=0,_=0,T=0,b=0,v=1;if(i=new o(t),e=i.readUnsignedByte(),a=i.readUnsignedByte(),s=i.readUnsignedByte(),i.skipUnsignedExpGolomb(),n[e]&&(r=i.readUnsignedExpGolomb(),3===r&&i.skipBits(1),i.skipUnsignedExpGolomb(),i.skipUnsignedExpGolomb(),i.skipBits(1),i.readBoolean()))for(f=3!==r?8:12,y=0;y<f;y++)i.readBoolean()&&(y<6?d(16,i):d(64,i));if(i.skipUnsignedExpGolomb(),0===(h=i.readUnsignedExpGolomb()))i.readUnsignedExpGolomb();else if(1===h)for(i.skipBits(1),i.skipExpGolomb(),i.skipExpGolomb(),p=i.readUnsignedExpGolomb(),y=0;y<p;y++)i.skipExpGolomb();if(i.skipUnsignedExpGolomb(),i.skipBits(1),l=i.readUnsignedExpGolomb(),u=i.readUnsignedExpGolomb(),c=i.readBits(1),0===c&&i.skipBits(1),i.skipBits(1),i.readBoolean()&&(m=i.readUnsignedExpGolomb(),_=i.readUnsignedExpGolomb(),T=i.readUnsignedExpGolomb(),b=i.readUnsignedExpGolomb()),i.readBoolean()&&i.readBoolean()){switch(i.readUnsignedByte()){case 1:g=[1,1];break;case 2:g=[12,11];break;case 3:g=[10,11];break;case 4:g=[16,11];break;case 5:g=[40,33];break;case 6:g=[24,11];break;case 7:g=[20,11];break;case 8:g=[32,11];break;case 9:g=[80,33];break;case 10:g=[18,11];break;case 11:g=[15,11];break;case 12:g=[64,33];break;case 13:g=[160,99];break;case 14:g=[4,3];break;case 15:g=[3,2];break;case 16:g=[2,1];break;case 255:g=[i.readUnsignedByte()<<8|i.readUnsignedByte(),i.readUnsignedByte()<<8|i.readUnsignedByte()]}g&&(v=g[0]/g[1])}return{profileIdc:e,levelIdc:s,profileCompatibility:a,width:Math.ceil((16*(l+1)-2*m-2*_)*v),height:(2-c)*(u+1)*16-2*T-2*b,sarRatio:g}}},s.prototype=new r,i.exports={H264Stream:s,NalByteStream:a}},{16:16,17:17}],3:[function(t,i,e){"use strict";var s=t(17),a=function(t){this.numberOfTracks=0,this.metadataStream=t.metadataStream,this.videoTags=[],this.audioTags=[],this.videoTrack=null,this.audioTrack=null,this.pendingCaptions=[],this.pendingMetadata=[],this.pendingTracks=0,this.processedTracks=0,a.prototype.init.call(this),this.push=function(t){return t.text?this.pendingCaptions.push(t):t.frames?this.pendingMetadata.push(t):("video"===t.track.type&&(this.videoTrack=t.track,this.videoTags=t.tags,this.pendingTracks++),void("audio"===t.track.type&&(this.audioTrack=t.track,this.audioTags=t.tags,this.pendingTracks++)))}};a.prototype=new s,a.prototype.flush=function(t){var i,e,s,a,n={tags:{},captions:[],captionStreams:{},metadata:[]};if(this.pendingTracks<this.numberOfTracks){if("VideoSegmentStream"!==t&&"AudioSegmentStream"!==t)return;if(0===this.pendingTracks&&++this.processedTracks<this.numberOfTracks)return}if(this.processedTracks+=this.pendingTracks,this.pendingTracks=0,!(this.processedTracks<this.numberOfTracks)){for(this.videoTrack?a=this.videoTrack.timelineStartInfo.pts:this.audioTrack&&(a=this.audioTrack.timelineStartInfo.pts),n.tags.videoTags=this.videoTags,n.tags.audioTags=this.audioTags,s=0;s<this.pendingCaptions.length;s++)e=this.pendingCaptions[s],e.startTime=e.startPts-a,e.startTime/=9e4,e.endTime=e.endPts-a,e.endTime/=9e4,n.captionStreams[e.stream]=!0,n.captions.push(e);for(s=0;s<this.pendingMetadata.length;s++)i=this.pendingMetadata[s],i.cueTime=i.pts-a,i.cueTime/=9e4,n.metadata.push(i);n.metadata.dispatchType=this.metadataStream.dispatchType,this.videoTrack=null,this.audioTrack=null,this.videoTags=[],this.audioTags=[],this.pendingCaptions.length=0,this.pendingMetadata.length=0,this.pendingTracks=0,this.processedTracks=0,this.trigger("data",n),this.trigger("done")}},i.exports=a},{17:17}],4:[function(t,i,e){"use strict";var s=t(5),a=function(t,i,e){var a,n,r,o=new Uint8Array(9),h=new DataView(o.buffer);return t=t||0,i=void 0===i||i,e=void 0===e||e,h.setUint8(0,70),h.setUint8(1,76),h.setUint8(2,86),h.setUint8(3,1),h.setUint8(4,(i?4:0)|(e?1:0)),h.setUint32(5,o.byteLength),t<=0?(n=new Uint8Array(o.byteLength+4),n.set(o),n.set([0,0,0,0],o.byteLength),n):(a=new s(s.METADATA_TAG),a.pts=a.dts=0,a.writeMetaDataDouble("duration",t),r=a.finalize().length,n=new Uint8Array(o.byteLength+r),n.set(o),n.set(h.byteLength,r),n)};i.exports=a},{5:5}],5:[function(t,i,e){"use strict";var s;s=function(t,i){var e,a=0,n=16384,r=function(t,i){var e,s=t.position+i;s<t.bytes.byteLength||(e=new Uint8Array(2*s),e.set(t.bytes.subarray(0,t.position),0),t.bytes=e,t.view=new DataView(t.bytes.buffer))},o=s.widthBytes||new Uint8Array("width".length),h=s.heightBytes||new Uint8Array("height".length),p=s.videocodecidBytes||new Uint8Array("videocodecid".length);if(!s.widthBytes){for(e=0;e<"width".length;e++)o[e]="width".charCodeAt(e);for(e=0;e<"height".length;e++)h[e]="height".charCodeAt(e);for(e=0;e<"videocodecid".length;e++)p[e]="videocodecid".charCodeAt(e);s.widthBytes=o,s.heightBytes=h,s.videocodecidBytes=p}switch(this.keyFrame=!1,t){case s.VIDEO_TAG:this.length=16,n*=6;break;case s.AUDIO_TAG:this.length=13,this.keyFrame=!0;break;case s.METADATA_TAG:this.length=29,this.keyFrame=!0;break;default:throw new Error("Unknown FLV tag type")}this.bytes=new Uint8Array(n),this.view=new DataView(this.bytes.buffer),this.bytes[0]=t,this.position=this.length,this.keyFrame=i,this.pts=0,this.dts=0,this.writeBytes=function(t,i,e){var s,a=i||0;e=e||t.byteLength,s=a+e,r(this,e),this.bytes.set(t.subarray(a,s),this.position),this.position+=e,this.length=Math.max(this.length,this.position)},this.writeByte=function(t){r(this,1),this.bytes[this.position]=t,this.position++,this.length=Math.max(this.length,this.position)},this.writeShort=function(t){r(this,2),this.view.setUint16(this.position,t),this.position+=2,this.length=Math.max(this.length,this.position)},this.negIndex=function(t){return this.bytes[this.length-t]},this.nalUnitSize=function(){return 0===a?0:this.length-(a+4)},this.startNalUnit=function(){if(a>0)throw new Error("Attempted to create new NAL wihout closing the old one");a=this.length,this.length+=4,this.position=this.length},this.endNalUnit=function(t){var i,e;this.length===a+4?this.length-=4:a>0&&(i=a+4,e=this.length-i,this.position=a,this.view.setUint32(this.position,e),this.position=this.length,t&&t.push(this.bytes.subarray(i,i+e))),a=0},this.writeMetaDataDouble=function(t,i){var e;if(r(this,2+t.length+9),this.view.setUint16(this.position,t.length),this.position+=2,"width"===t)this.bytes.set(o,this.position),this.position+=5;else if("height"===t)this.bytes.set(h,this.position),this.position+=6;else if("videocodecid"===t)this.bytes.set(p,this.position),this.position+=12;else for(e=0;e<t.length;e++)this.bytes[this.position]=t.charCodeAt(e),this.position++;this.position++,this.view.setFloat64(this.position,i),this.position+=8,this.length=Math.max(this.length,this.position),++a},this.writeMetaDataBoolean=function(t,i){var e;for(r(this,2),this.view.setUint16(this.position,t.length),this.position+=2,e=0;e<t.length;e++)r(this,1),this.bytes[this.position]=t.charCodeAt(e),this.position++;r(this,2),this.view.setUint8(this.position,1),this.position++,this.view.setUint8(this.position,i?1:0),this.position++,this.length=Math.max(this.length,this.position),++a},this.finalize=function(){var t,e;switch(this.bytes[0]){case s.VIDEO_TAG:this.bytes[11]=7|(this.keyFrame||i?16:32),this.bytes[12]=i?0:1,t=this.pts-this.dts,this.bytes[13]=(16711680&t)>>>16,this.bytes[14]=(65280&t)>>>8,this.bytes[15]=(255&t)>>>0;break;case s.AUDIO_TAG:this.bytes[11]=175,this.bytes[12]=i?0:1;break;case s.METADATA_TAG:this.position=11,this.view.setUint8(this.position,2),this.position++,this.view.setUint16(this.position,10),this.position+=2,this.bytes.set([111,110,77,101,116,97,68,97,116,97],this.position),this.position+=10,this.bytes[this.position]=8,this.position++,this.view.setUint32(this.position,a),this.position=this.length,this.bytes.set([0,0,9],this.position),this.position+=3,this.length=this.position}return e=this.length-11,this.bytes[1]=(16711680&e)>>>16,this.bytes[2]=(65280&e)>>>8,this.bytes[3]=(255&e)>>>0,this.bytes[4]=(16711680&this.dts)>>>16,this.bytes[5]=(65280&this.dts)>>>8,this.bytes[6]=(255&this.dts)>>>0,this.bytes[7]=(4278190080&this.dts)>>>24,this.bytes[8]=0,this.bytes[9]=0,this.bytes[10]=0,r(this,4),this.view.setUint32(this.length,this.length),this.length+=4,this.position+=4,this.bytes=this.bytes.subarray(0,this.length),this.frameTime=s.frameTime(this.bytes),this}},s.AUDIO_TAG=8,s.VIDEO_TAG=9,s.METADATA_TAG=18,s.isAudioFrame=function(t){return s.AUDIO_TAG===t[0]},s.isVideoFrame=function(t){return s.VIDEO_TAG===t[0]},s.isMetaData=function(t){return s.METADATA_TAG===t[0]},s.isKeyFrame=function(t){return s.isVideoFrame(t)?23===t[11]:!!s.isAudioFrame(t)||!!s.isMetaData(t)},s.frameTime=function(t){var i=t[4]<<16;return i|=t[5]<<8,i|=t[6]<<0,i|=t[7]<<24},i.exports=s},{}],6:[function(t,i,e){i.exports={tag:t(5),Transmuxer:t(8),getFlvHeader:t(4)}},{4:4,5:5,8:8}],7:[function(t,i,e){"use strict";var s=function(){var t=this;this.list=[],this.push=function(t){this.list.push({bytes:t.bytes,dts:t.dts,pts:t.pts,keyFrame:t.keyFrame,metaDataTag:t.metaDataTag})},Object.defineProperty(this,"length",{get:function(){return t.list.length}})};i.exports=s},{}],8:[function(t,i,e){"use strict";var s,a,n,r,o,h,p=t(17),d=t(5),l=t(10),u=t(1),c=t(2).H264Stream,f=t(3),g=t(7);r=function(t,i){"number"==typeof i.pts&&(void 0===t.timelineStartInfo.pts?t.timelineStartInfo.pts=i.pts:t.timelineStartInfo.pts=Math.min(t.timelineStartInfo.pts,i.pts)),"number"==typeof i.dts&&(void 0===t.timelineStartInfo.dts?t.timelineStartInfo.dts=i.dts:t.timelineStartInfo.dts=Math.min(t.timelineStartInfo.dts,i.dts))},o=function(t,i){var e=new d(d.METADATA_TAG);return e.dts=i,e.pts=i,e.writeMetaDataDouble("videocodecid",7),e.writeMetaDataDouble("width",t.width),e.writeMetaDataDouble("height",t.height),e},h=function(t,i){var e,s=new d(d.VIDEO_TAG,!0);for(s.dts=i,s.pts=i,s.writeByte(1),s.writeByte(t.profileIdc),s.writeByte(t.profileCompatibility),s.writeByte(t.levelIdc),s.writeByte(255),s.writeByte(225),s.writeShort(t.sps[0].length),s.writeBytes(t.sps[0]),s.writeByte(t.pps.length),e=0;e<t.pps.length;++e)s.writeShort(t.pps[e].length),s.writeBytes(t.pps[e]);return s},n=function(t){var i,e=[],s=[];n.prototype.init.call(this),this.push=function(i){r(t,i),t&&(t.audioobjecttype=i.audioobjecttype,t.channelcount=i.channelcount,t.samplerate=i.samplerate,t.samplingfrequencyindex=i.samplingfrequencyindex,t.samplesize=i.samplesize,t.extraData=t.audioobjecttype<<11|t.samplingfrequencyindex<<7|t.channelcount<<3),i.pts=Math.round(i.pts/90),i.dts=Math.round(i.dts/90),e.push(i)},this.flush=function(){var a,n,r,o=new g;if(0===e.length)return void this.trigger("done","AudioSegmentStream");for(r=-1/0;e.length;)a=e.shift(),s.length&&a.pts>=s[0]&&(r=s.shift(),this.writeMetaDataTags(o,r)),(t.extraData!==i||a.pts-r>=1e3)&&(this.writeMetaDataTags(o,a.pts),i=t.extraData,r=a.pts),n=new d(d.AUDIO_TAG),n.pts=a.pts,n.dts=a.dts,n.writeBytes(a.data),o.push(n.finalize());s.length=0,i=null,this.trigger("data",{track:t,tags:o.list}),this.trigger("done","AudioSegmentStream")},this.writeMetaDataTags=function(i,e){var s;s=new d(d.METADATA_TAG),s.pts=e,s.dts=e,s.writeMetaDataDouble("audiocodecid",10),s.writeMetaDataBoolean("stereo",2===t.channelcount),s.writeMetaDataDouble("audiosamplerate",t.samplerate),s.writeMetaDataDouble("audiosamplesize",16),i.push(s.finalize()),s=new d(d.AUDIO_TAG,!0),s.pts=e,s.dts=e,s.view.setUint16(s.position,t.extraData),s.position+=2,s.length=Math.max(s.length,s.position),i.push(s.finalize())},this.onVideoKeyFrame=function(t){s.push(t)}},n.prototype=new p,a=function(t){var i,e,s=[];a.prototype.init.call(this),this.finishFrame=function(s,a){if(a){if(i&&t&&t.newMetadata&&(a.keyFrame||0===s.length)){var n=o(i,a.dts).finalize(),r=h(t,a.dts).finalize();n.metaDataTag=r.metaDataTag=!0,s.push(n),s.push(r),t.newMetadata=!1,this.trigger("keyframe",a.dts)}a.endNalUnit(),s.push(a.finalize()),e=null}},this.push=function(i){r(t,i),i.pts=Math.round(i.pts/90),i.dts=Math.round(i.dts/90),s.push(i)},this.flush=function(){for(var a,n=new g;s.length&&"access_unit_delimiter_rbsp"!==s[0].nalUnitType;)s.shift();if(0===s.length)return void this.trigger("done","VideoSegmentStream");for(;s.length;)a=s.shift(),"seq_parameter_set_rbsp"===a.nalUnitType?(t.newMetadata=!0,i=a.config,t.width=i.width,t.height=i.height,t.sps=[a.data],t.profileIdc=i.profileIdc,t.levelIdc=i.levelIdc,t.profileCompatibility=i.profileCompatibility,e.endNalUnit()):"pic_parameter_set_rbsp"===a.nalUnitType?(t.newMetadata=!0,t.pps=[a.data],e.endNalUnit()):"access_unit_delimiter_rbsp"===a.nalUnitType?(e&&this.finishFrame(n,e),e=new d(d.VIDEO_TAG),e.pts=a.pts,e.dts=a.dts):("slice_layer_without_partitioning_rbsp_idr"===a.nalUnitType&&(e.keyFrame=!0),e.endNalUnit()),e.startNalUnit(),e.writeBytes(a.data);e&&this.finishFrame(n,e),this.trigger("data",{track:t,tags:n.list}),this.trigger("done","VideoSegmentStream")}},a.prototype=new p,s=function(t){var i,e,r,o,h,p,d,g,y,m,_,T,b=this;s.prototype.init.call(this),t=t||{},this.metadataStream=new l.MetadataStream,t.metadataStream=this.metadataStream,i=new l.TransportPacketStream,e=new l.TransportParseStream,r=new l.ElementaryStream,o=new l.TimestampRolloverStream("video"),h=new l.TimestampRolloverStream("audio"),p=new l.TimestampRolloverStream("timed-metadata"),d=new u,g=new c,T=new f(t),i.pipe(e).pipe(r),r.pipe(o).pipe(g),r.pipe(h).pipe(d),r.pipe(p).pipe(this.metadataStream).pipe(T),_=new l.CaptionStream,g.pipe(_).pipe(T),r.on("data",function(t){var i,e,s;if("metadata"===t.type){for(i=t.tracks.length;i--;)"video"===t.tracks[i].type?e=t.tracks[i]:"audio"===t.tracks[i].type&&(s=t.tracks[i]);e&&!y&&(T.numberOfTracks++,y=new a(e),g.pipe(y).pipe(T)),s&&!m&&(T.numberOfTracks++,m=new n(s),d.pipe(m).pipe(T),y&&y.on("keyframe",m.onVideoKeyFrame))}}),this.push=function(t){i.push(t)},this.flush=function(){i.flush()},this.resetCaptions=function(){_.reset()},T.on("data",function(t){b.trigger("data",t)}),T.on("done",function(){b.trigger("done")})},s.prototype=new p,i.exports=s},{1:1,10:10,17:17,2:2,3:3,5:5,7:7}],9:[function(t,i,e){"use strict";var s=t(17),a=t(14),n=function(){n.prototype.init.call(this),this.captionPackets_=[],this.ccStreams_=[new d(0,0),new d(0,1),new d(1,0),new d(1,1)],this.reset(),this.ccStreams_.forEach(function(t){t.on("data",this.trigger.bind(this,"data")),t.on("partialdone",this.trigger.bind(this,"partialdone")),t.on("done",this.trigger.bind(this,"done"))},this)};n.prototype=new s,n.prototype.push=function(t){var i,e,s;if("sei_rbsp"===t.nalUnitType&&(i=a.parseSei(t.escapedRBSP),i.payloadType===a.USER_DATA_REGISTERED_ITU_T_T35&&(e=a.parseUserData(i)))){if(t.dts<this.latestDts_)return void(this.ignoreNextEqualDts_=!0);if(t.dts===this.latestDts_&&this.ignoreNextEqualDts_)return void(--this.numSameDts_||(this.ignoreNextEqualDts_=!1));s=a.parseCaptionPackets(t.pts,e),this.captionPackets_=this.captionPackets_.concat(s),this.latestDts_!==t.dts&&(this.numSameDts_=0),this.numSameDts_++,this.latestDts_=t.dts}},n.prototype.flushCCStreams=function(t){this.ccStreams_.forEach(function(i){return"flush"===t?i.flush():i.partialFlush()},this)},n.prototype.flushStream=function(t){if(!this.captionPackets_.length)return void this.flushCCStreams(t);this.captionPackets_.forEach(function(t,i){t.presortIndex=i}),this.captionPackets_.sort(function(t,i){return t.pts===i.pts?t.presortIndex-i.presortIndex:t.pts-i.pts}),this.captionPackets_.forEach(function(t){t.type<2&&this.dispatchCea608Packet(t)},this),this.captionPackets_.length=0,this.flushCCStreams(t)},n.prototype.flush=function(){return this.flushStream("flush")},n.prototype.partialFlush=function(){return this.flushStream("partialFlush")},n.prototype.reset=function(){this.latestDts_=null,this.ignoreNextEqualDts_=!1,this.numSameDts_=0,this.activeCea608Channel_=[null,null],this.ccStreams_.forEach(function(t){t.reset()})},n.prototype.dispatchCea608Packet=function(t){this.setsTextOrXDSActive(t)?this.activeCea608Channel_[t.type]=null:this.setsChannel1Active(t)?this.activeCea608Channel_[t.type]=0:this.setsChannel2Active(t)&&(this.activeCea608Channel_[t.type]=1),null!==this.activeCea608Channel_[t.type]&&this.ccStreams_[(t.type<<1)+this.activeCea608Channel_[t.type]].push(t)},n.prototype.setsChannel1Active=function(t){return 4096==(30720&t.ccData)},n.prototype.setsChannel2Active=function(t){return 6144==(30720&t.ccData)},n.prototype.setsTextOrXDSActive=function(t){return 256==(28928&t.ccData)||4138==(30974&t.ccData)||6186==(30974&t.ccData)};var r={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,304:174,305:176,306:189,307:191,308:8482,309:162,310:163,311:9834,312:224,313:160,314:232,315:226,316:234,317:238,318:244,319:251,544:193,545:201,546:211,547:218,548:220,549:252,550:8216,551:161,552:42,553:39,554:8212,555:169,556:8480,557:8226,558:8220,559:8221,560:192,561:194,562:199,563:200,564:202,565:203,566:235,567:206,568:207,569:239,570:212,571:217,572:249,573:219,574:171,575:187,800:195,801:227,802:205,803:204,804:236,805:210,806:242,807:213,808:245,809:123,810:125,811:92,812:94,813:95,814:124,815:126,816:196,817:228,818:214,819:246,820:223,821:165,822:164,823:9474,824:197,825:229,826:216,827:248,828:9484,829:9488,830:9492,831:9496},o=function(t){return null===t?"":(t=r[t]||t,String.fromCharCode(t))},h=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],p=function(){for(var t=[],i=15;i--;)t.push("");return t},d=function(t,i){d.prototype.init.call(this),this.field_=t||0,this.dataChannel_=i||0,this.name_="CC"+(1+(this.field_<<1|this.dataChannel_)),this.setConstants(),this.reset(),this.push=function(t){var i,e,s,a,n;if((i=32639&t.ccData)===this.lastControlCode_)return void(this.lastControlCode_=null);if(4096==(61440&i)?this.lastControlCode_=i:i!==this.PADDING_&&(this.lastControlCode_=null),s=i>>>8,a=255&i,i!==this.PADDING_)if(i===this.RESUME_CAPTION_LOADING_)this.mode_="popOn";else if(i===this.END_OF_CAPTION_)this.mode_="popOn",this.clearFormatting(t.pts),this.flushDisplayed(t.pts),e=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=e,this.startPts_=t.pts;else if(i===this.ROLL_UP_2_ROWS_)this.rollUpRows_=2,this.setRollUp(t.pts);else if(i===this.ROLL_UP_3_ROWS_)this.rollUpRows_=3,this.setRollUp(t.pts);else if(i===this.ROLL_UP_4_ROWS_)this.rollUpRows_=4,this.setRollUp(t.pts);else if(i===this.CARRIAGE_RETURN_)this.clearFormatting(t.pts),this.flushDisplayed(t.pts),this.shiftRowsUp_(),this.startPts_=t.pts;else if(i===this.BACKSPACE_)"popOn"===this.mode_?this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1):this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1);else if(i===this.ERASE_DISPLAYED_MEMORY_)this.flushDisplayed(t.pts),this.displayed_=p();else if(i===this.ERASE_NON_DISPLAYED_MEMORY_)this.nonDisplayed_=p();else if(i===this.RESUME_DIRECT_CAPTIONING_)"paintOn"!==this.mode_&&(this.flushDisplayed(t.pts),this.displayed_=p()),this.mode_="paintOn",this.startPts_=t.pts;else if(this.isSpecialCharacter(s,a))s=(3&s)<<8,n=o(s|a),this[this.mode_](t.pts,n),this.column_++;else if(this.isExtCharacter(s,a))"popOn"===this.mode_?this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1):this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1),s=(3&s)<<8,n=o(s|a),this[this.mode_](t.pts,n),this.column_++;else if(this.isMidRowCode(s,a))this.clearFormatting(t.pts),this[this.mode_](t.pts," "),this.column_++,14==(14&a)&&this.addFormatting(t.pts,["i"]),1==(1&a)&&this.addFormatting(t.pts,["u"]);else if(this.isOffsetControlCode(s,a))this.column_+=3&a;else if(this.isPAC(s,a)){var r=h.indexOf(7968&i);"rollUp"===this.mode_&&(r-this.rollUpRows_+1<0&&(r=this.rollUpRows_-1),this.setRollUp(t.pts,r)),r!==this.row_&&(this.clearFormatting(t.pts),this.row_=r),1&a&&-1===this.formatting_.indexOf("u")&&this.addFormatting(t.pts,["u"]),16==(16&i)&&(this.column_=4*((14&i)>>1)),this.isColorPAC(a)&&14==(14&a)&&this.addFormatting(t.pts,["i"])}else this.isNormalChar(s)&&(0===a&&(a=null),n=o(s),n+=o(a),this[this.mode_](t.pts,n),this.column_+=n.length)}};d.prototype=new s,d.prototype.flushDisplayed=function(t){var i=this.displayed_.map(function(t){try{return t.trim()}catch(t){return console.error("Skipping malformed caption."),""}}).join("\n").replace(/^\n+|\n+$/g,"");i.length&&this.trigger("data",{startPts:this.startPts_,endPts:t,text:i,stream:this.name_})},d.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=p(),this.nonDisplayed_=p(),this.lastControlCode_=null,this.column_=0,this.row_=14,this.rollUpRows_=2,this.formatting_=[]},d.prototype.setConstants=function(){0===this.dataChannel_?(this.BASE_=16,this.EXT_=17,this.CONTROL_=(20|this.field_)<<8,this.OFFSET_=23):1===this.dataChannel_&&(this.BASE_=24,this.EXT_=25,this.CONTROL_=(28|this.field_)<<8,this.OFFSET_=31),this.PADDING_=0,this.RESUME_CAPTION_LOADING_=32|this.CONTROL_,this.END_OF_CAPTION_=47|this.CONTROL_,this.ROLL_UP_2_ROWS_=37|this.CONTROL_,this.ROLL_UP_3_ROWS_=38|this.CONTROL_,this.ROLL_UP_4_ROWS_=39|this.CONTROL_,this.CARRIAGE_RETURN_=45|this.CONTROL_,this.RESUME_DIRECT_CAPTIONING_=41|this.CONTROL_,this.BACKSPACE_=33|this.CONTROL_,this.ERASE_DISPLAYED_MEMORY_=44|this.CONTROL_,this.ERASE_NON_DISPLAYED_MEMORY_=46|this.CONTROL_},d.prototype.isSpecialCharacter=function(t,i){return t===this.EXT_&&i>=48&&i<=63},d.prototype.isExtCharacter=function(t,i){return(t===this.EXT_+1||t===this.EXT_+2)&&i>=32&&i<=63},d.prototype.isMidRowCode=function(t,i){return t===this.EXT_&&i>=32&&i<=47},d.prototype.isOffsetControlCode=function(t,i){return t===this.OFFSET_&&i>=33&&i<=35},d.prototype.isPAC=function(t,i){return t>=this.BASE_&&t<this.BASE_+8&&i>=64&&i<=127},d.prototype.isColorPAC=function(t){return t>=64&&t<=79||t>=96&&t<=127},d.prototype.isNormalChar=function(t){return t>=32&&t<=127},d.prototype.setRollUp=function(t,i){if("rollUp"!==this.mode_&&(this.row_=14,this.mode_="rollUp",this.flushDisplayed(t),this.nonDisplayed_=p(),this.displayed_=p()),void 0!==i&&i!==this.row_)for(var e=0;e<this.rollUpRows_;e++)this.displayed_[i-e]=this.displayed_[this.row_-e],this.displayed_[this.row_-e]="";void 0===i&&(i=this.row_),this.topRow_=i-this.rollUpRows_+1},d.prototype.addFormatting=function(t,i){this.formatting_=this.formatting_.concat(i);var e=i.reduce(function(t,i){return t+"<"+i+">"},"");this[this.mode_](t,e)},d.prototype.clearFormatting=function(t){if(this.formatting_.length){var i=this.formatting_.reverse().reduce(function(t,i){return t+"</"+i+">"},"");this.formatting_=[],this[this.mode_](t,i)}},d.prototype.popOn=function(t,i){var e=this.nonDisplayed_[this.row_];e+=i,this.nonDisplayed_[this.row_]=e},d.prototype.rollUp=function(t,i){var e=this.displayed_[this.row_];e+=i,this.displayed_[this.row_]=e},d.prototype.shiftRowsUp_=function(){var t;for(t=0;t<this.topRow_;t++)this.displayed_[t]="";for(t=this.row_+1;t<15;t++)this.displayed_[t]="";for(t=this.topRow_;t<this.row_;t++)this.displayed_[t]=this.displayed_[t+1];this.displayed_[this.row_]=""},d.prototype.paintOn=function(t,i){var e=this.displayed_[this.row_];e+=i,this.displayed_[this.row_]=e},i.exports={CaptionStream:n,Cea608Stream:d}},{14:14,17:17}],10:[function(t,i,e){"use strict";var s,a,n,r=t(17),o=t(9),h=t(12),p=t(13).TimestampRolloverStream;s=function(){var t=new Uint8Array(188),i=0;s.prototype.init.call(this),this.push=function(e){var s,a=0,n=188;for(i?(s=new Uint8Array(e.byteLength+i),s.set(t.subarray(0,i)),s.set(e,i),i=0):s=e;n<s.byteLength;)71!==s[a]||71!==s[n]?(a++,n++):(this.trigger("data",s.subarray(a,n)),a+=188,n+=188);a<s.byteLength&&(t.set(s.subarray(a),0),i=s.byteLength-a)},this.flush=function(){188===i&&71===t[0]&&(this.trigger("data",t),i=0),this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.reset=function(){i=0,this.trigger("reset")}},s.prototype=new r,a=function(){var t,i,e,s;a.prototype.init.call(this),s=this,this.packetsWaitingForPmt=[],this.programMapTable=void 0,t=function(t,s){var a=0;s.payloadUnitStartIndicator&&(a+=t[a]+1),"pat"===s.type?i(t.subarray(a),s):e(t.subarray(a),s)},i=function(t,i){i.section_number=t[7],i.last_section_number=t[8],s.pmtPid=(31&t[10])<<8|t[11],i.pmtPid=s.pmtPid},e=function(t,i){var e,a,n,r;if(1&t[5]){for(s.programMapTable={video:null,audio:null,"timed-metadata":{}},e=(15&t[1])<<8|t[2],a=3+e-4,n=(15&t[10])<<8|t[11],r=12+n;r<a;){var o=t[r],p=(31&t[r+1])<<8|t[r+2];o===h.H264_STREAM_TYPE&&null===s.programMapTable.video?s.programMapTable.video=p:o===h.ADTS_STREAM_TYPE&&null===s.programMapTable.audio?s.programMapTable.audio=p:o===h.METADATA_STREAM_TYPE&&(s.programMapTable["timed-metadata"][p]=o),r+=5+((15&t[r+3])<<8|t[r+4])}i.programMapTable=s.programMapTable}},this.push=function(i){var e={},s=4;if(e.payloadUnitStartIndicator=!!(64&i[1]),e.pid=31&i[1],e.pid<<=8,e.pid|=i[2],(48&i[3])>>>4>1&&(s+=i[s]+1),0===e.pid)e.type="pat",t(i.subarray(s),e),this.trigger("data",e);else if(e.pid===this.pmtPid)for(e.type="pmt",t(i.subarray(s),e),this.trigger("data",e);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else void 0===this.programMapTable?this.packetsWaitingForPmt.push([i,s,e]):this.processPes_(i,s,e)},this.processPes_=function(t,i,e){e.pid===this.programMapTable.video?e.streamType=h.H264_STREAM_TYPE:e.pid===this.programMapTable.audio?e.streamType=h.ADTS_STREAM_TYPE:e.streamType=this.programMapTable["timed-metadata"][e.pid],e.type="pes",e.data=t.subarray(i),this.trigger("data",e)}},a.prototype=new r,a.STREAM_TYPES={h264:27,adts:15},n=function(){var t,i=this,e={data:[],size:0},s={data:[],size:0},a={data:[],size:0},r=function(t,i){var e;i.packetLength=6+(t[4]<<8|t[5]),i.dataAlignmentIndicator=0!=(4&t[6]),e=t[7],192&e&&(i.pts=(14&t[9])<<27|(255&t[10])<<20|(254&t[11])<<12|(255&t[12])<<5|(254&t[13])>>>3,i.pts*=4,i.pts+=(6&t[13])>>>1,i.dts=i.pts,64&e&&(i.dts=(14&t[14])<<27|(255&t[15])<<20|(254&t[16])<<12|(255&t[17])<<5|(254&t[18])>>>3,i.dts*=4,i.dts+=(6&t[18])>>>1)),i.data=t.subarray(9+t[8])},o=function(t,e,s){var a,n=new Uint8Array(t.size),o={type:e},h=0,p=0,d=!1;if(t.data.length&&!(t.size<9)){for(o.trackId=t.data[0].pid,h=0;h<t.data.length;h++)a=t.data[h],n.set(a.data,p),p+=a.data.byteLength;r(n,o),d="video"===e||o.packetLength<=t.size,(s||d)&&(t.size=0,t.data.length=0),d&&i.trigger("data",o)}};n.prototype.init.call(this),this.push=function(n){({pat:function(){},pes:function(){var t,i;switch(n.streamType){case h.H264_STREAM_TYPE:t=e,i="video";break;case h.ADTS_STREAM_TYPE:t=s,i="audio";break;case h.METADATA_STREAM_TYPE:t=a,i="timed-metadata";break;default:return}n.payloadUnitStartIndicator&&o(t,i,!0),t.data.push(n),t.size+=n.data.byteLength},pmt:function(){var e={type:"metadata",tracks:[]};t=n.programMapTable,null!==t.video&&e.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+t.video,codec:"avc",type:"video"}),null!==t.audio&&e.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+t.audio,codec:"adts",type:"audio"}),i.trigger("data",e)}})[n.type]()},this.reset=function(){e.size=0,e.data.length=0,s.size=0,s.data.length=0,this.trigger("reset")},this.flushStreams_=function(){o(e,"video"),o(s,"audio"),o(a,"timed-metadata")},this.flush=function(){this.flushStreams_(),this.trigger("done")}},n.prototype=new r;var d={PAT_PID:0,MP2T_PACKET_LENGTH:188,TransportPacketStream:s,TransportParseStream:a,ElementaryStream:n,TimestampRolloverStream:p,CaptionStream:o.CaptionStream,Cea608Stream:o.Cea608Stream,MetadataStream:t(11)};for(var l in h)h.hasOwnProperty(l)&&(d[l]=h[l]);i.exports=d},{11:11,12:12,13:13,17:17,9:9}],11:[function(t,i,e){"use strict";var s,a=t(17),n=t(12),r=function(t,i,e){var s,a="";for(s=i;s<e;s++)a+="%"+("00"+t[s].toString(16)).slice(-2);return a},o=function(t,i,e){return decodeURIComponent(r(t,i,e))},h=function(t,i,e){return unescape(r(t,i,e))},p=function(t){return t[0]<<21|t[1]<<14|t[2]<<7|t[3]},d={TXXX:function(t){var i;if(3===t.data[0]){for(i=1;i<t.data.length;i++)if(0===t.data[i]){t.description=o(t.data,1,i),t.value=o(t.data,i+1,t.data.length).replace(/\0*$/,"");break}t.data=t.value}},WXXX:function(t){var i;if(3===t.data[0])for(i=1;i<t.data.length;i++)if(0===t.data[i]){t.description=o(t.data,1,i),
t.url=o(t.data,i+1,t.data.length);break}},PRIV:function(t){var i;for(i=0;i<t.data.length;i++)if(0===t.data[i]){t.owner=h(t.data,0,i);break}t.privateData=t.data.subarray(i+1),t.data=t.privateData}};s=function(t){var i,e={debug:!(!t||!t.debug),descriptor:t&&t.descriptor},a=0,r=[],o=0;if(s.prototype.init.call(this),this.dispatchType=n.METADATA_STREAM_TYPE.toString(16),e.descriptor)for(i=0;i<e.descriptor.length;i++)this.dispatchType+=("00"+e.descriptor[i].toString(16)).slice(-2);this.push=function(t){var i,s,n,h,l,u;if("timed-metadata"===t.type){if(t.dataAlignmentIndicator&&(o=0,r.length=0),0===r.length&&(t.data.length<10||t.data[0]!=="I".charCodeAt(0)||t.data[1]!=="D".charCodeAt(0)||t.data[2]!=="3".charCodeAt(0)))return void(e.debug&&console.log("Skipping unrecognized metadata packet"));if(r.push(t),o+=t.data.byteLength,1===r.length&&(a=p(t.data.subarray(6,10)),a+=10),!(o<a)){for(i={data:new Uint8Array(a),frames:[],pts:r[0].pts,dts:r[0].dts},l=0;l<a;)i.data.set(r[0].data.subarray(0,a-l),l),l+=r[0].data.byteLength,o-=r[0].data.byteLength,r.shift();s=10,64&i.data[5]&&(s+=4,s+=p(i.data.subarray(10,14)),a-=p(i.data.subarray(16,20)));do{if((n=p(i.data.subarray(s+4,s+8)))<1)return console.log("Malformed ID3 frame encountered. Skipping metadata parsing.");if(u=String.fromCharCode(i.data[s],i.data[s+1],i.data[s+2],i.data[s+3]),h={id:u,data:i.data.subarray(s+10,s+n+10)},h.key=h.id,d[h.id]&&(d[h.id](h),"com.apple.streaming.transportStreamTimestamp"===h.owner)){var c=h.data,f=(1&c[3])<<30|c[4]<<22|c[5]<<14|c[6]<<6|c[7]>>>2;f*=4,f+=3&c[7],h.timeStamp=f,void 0===i.pts&&void 0===i.dts&&(i.pts=h.timeStamp,i.dts=h.timeStamp),this.trigger("timestamp",h)}i.frames.push(h),s+=10,s+=n}while(s<a);this.trigger("data",i)}}}},s.prototype=new a,i.exports=s},{12:12,17:17}],12:[function(t,i,e){"use strict";i.exports={H264_STREAM_TYPE:27,ADTS_STREAM_TYPE:15,METADATA_STREAM_TYPE:21}},{}],13:[function(t,i,e){"use strict";var s=t(17),a=function(t,i){var e=1;for(t>i&&(e=-1);Math.abs(i-t)>4294967296;)t+=8589934592*e;return t},n=function(t){var i,e;n.prototype.init.call(this),this.type_=t||"shared",this.push=function(t){"shared"!==this.type_&&t.type!==this.type_||(void 0===e&&(e=t.dts),t.dts=a(t.dts,e),t.pts=a(t.pts,e),i=t.dts,this.trigger("data",t))},this.flush=function(){e=i,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.discontinuity=function(){e=void 0,i=void 0},this.reset=function(){this.discontinuity(),this.trigger("reset")}};n.prototype=new s,i.exports={TimestampRolloverStream:n,handleRollover:a}},{17:17}],14:[function(t,i,e){"use strict";var s=function(t){for(var i=0,e={payloadType:-1,payloadSize:0},s=0,a=0;i<t.byteLength&&128!==t[i];){for(;255===t[i];)s+=255,i++;for(s+=t[i++];255===t[i];)a+=255,i++;if(a+=t[i++],!e.payload&&4===s){if("GA94"===String.fromCharCode(t[i+3],t[i+4],t[i+5],t[i+6])){e.payloadType=s,e.payloadSize=a,e.payload=t.subarray(i,i+a);break}e.payload=void 0}i+=a,s=0,a=0}return e},a=function(t){return 181!==t.payload[0]?null:49!=(t.payload[1]<<8|t.payload[2])?null:"GA94"!==String.fromCharCode(t.payload[3],t.payload[4],t.payload[5],t.payload[6])?null:3!==t.payload[7]?null:t.payload.subarray(8,t.payload.length-1)},n=function(t,i){var e,s,a,n,r=[];if(!(64&i[0]))return r;for(s=31&i[0],e=0;e<s;e++)a=3*e,n={type:3&i[a+2],pts:t},4&i[a+2]&&(n.ccData=i[a+3]<<8|i[a+4],r.push(n));return r},r=function(t){for(var i,e,s=t.byteLength,a=[],n=1;n<s-2;)0===t[n]&&0===t[n+1]&&3===t[n+2]?(a.push(n+2),n+=2):n++;if(0===a.length)return t;i=s-a.length,e=new Uint8Array(i);var r=0;for(n=0;n<i;r++,n++)r===a[0]&&(r++,a.shift()),e[n]=t[r];return e};i.exports={parseSei:s,parseUserData:a,parseCaptionPackets:n,discardEmulationPreventionBytes:r,USER_DATA_REGISTERED_ITU_T_T35:4}},{}],15:[function(t,i,e){var s,a,n,r,o,h,p;s=function(t){return 9e4*t},a=function(t,i){return t*i},n=function(t){return t/9e4},r=function(t,i){return t/i},o=function(t,i){return s(r(t,i))},h=function(t,i){return a(n(t),i)},p=function(t,i,e){return n(e?t:t-i)},i.exports={ONE_SECOND_IN_TS:9e4,secondsToVideoTs:s,secondsToAudioTs:a,videoTsToSeconds:n,audioTsToSeconds:r,audioTsToVideoTs:o,videoTsToAudioTs:h,metadataTsToSeconds:p}},{}],16:[function(t,i,e){"use strict";var s;s=function(t){var i=t.byteLength,e=0,s=0;this.length=function(){return 8*i},this.bitsAvailable=function(){return 8*i+s},this.loadWord=function(){var a=t.byteLength-i,n=new Uint8Array(4),r=Math.min(4,i);if(0===r)throw new Error("no bytes available");n.set(t.subarray(a,a+r)),e=new DataView(n.buffer).getUint32(0),s=8*r,i-=r},this.skipBits=function(t){var a;s>t?(e<<=t,s-=t):(t-=s,a=Math.floor(t/8),t-=8*a,i-=a,this.loadWord(),e<<=t,s-=t)},this.readBits=function(t){var a=Math.min(s,t),n=e>>>32-a;return s-=a,s>0?e<<=a:i>0&&this.loadWord(),a=t-a,a>0?n<<a|this.readBits(a):n},this.skipLeadingZeros=function(){var t;for(t=0;t<s;++t)if(0!=(e&2147483648>>>t))return e<<=t,s-=t,t;return this.loadWord(),t+this.skipLeadingZeros()},this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.readUnsignedExpGolomb=function(){var t=this.skipLeadingZeros();return this.readBits(t+1)-1},this.readExpGolomb=function(){var t=this.readUnsignedExpGolomb();return 1&t?1+t>>>1:-1*(t>>>1)},this.readBoolean=function(){return 1===this.readBits(1)},this.readUnsignedByte=function(){return this.readBits(8)},this.loadWord()},i.exports=s},{}],17:[function(t,i,e){"use strict";var s=function(){this.init=function(){var t={};this.on=function(i,e){t[i]||(t[i]=[]),t[i]=t[i].concat(e)},this.off=function(i,e){var s;return!!t[i]&&(s=t[i].indexOf(e),t[i]=t[i].slice(),t[i].splice(s,1),s>-1)},this.trigger=function(i){var e,s,a,n;if(e=t[i])if(2===arguments.length)for(a=e.length,s=0;s<a;++s)e[s].call(this,arguments[1]);else{for(n=[],s=arguments.length,s=1;s<arguments.length;++s)n.push(arguments[s]);for(a=e.length,s=0;s<a;++s)e[s].apply(this,n)}},this.dispose=function(){t={}}}};s.prototype.pipe=function(t){return this.on("data",function(i){t.push(i)}),this.on("done",function(i){t.flush(i)}),this.on("partialdone",function(i){t.partialFlush(i)}),this.on("endedtimeline",function(i){t.endTimeline(i)}),this.on("reset",function(i){t.reset(i)}),t},s.prototype.push=function(t){this.trigger("data",t)},s.prototype.flush=function(t){this.trigger("done",t)},s.prototype.partialFlush=function(t){this.trigger("partialdone",t)},s.prototype.endTimeline=function(t){this.trigger("endedtimeline",t)},s.prototype.reset=function(t){this.trigger("reset",t)},i.exports=s},{}]},{},[6])(6)});

11

lib/mp4/caption-parser.js

@@ -14,3 +14,2 @@ /**

var CaptionStream = require('../m2ts/caption-stream').CaptionStream;
var probe = require('./probe');
var inspect = require('../tools/mp4-inspector');

@@ -174,5 +173,5 @@

// To get the samples
var trafs = probe.findBox(segment, ['moof', 'traf']);
var trafs = inspect.findBox(segment, ['moof', 'traf']);
// To get SEI NAL units
var mdats = probe.findBox(segment, ['mdat']);
var mdats = inspect.findBox(segment, ['mdat']);
var captionNals = {};

@@ -193,10 +192,10 @@ var mdatTrafPairs = [];

var traf = pair.traf;
var tfhd = probe.findBox(traf, ['tfhd']);
var tfhd = inspect.findBox(traf, ['tfhd']);
// Exactly 1 tfhd per traf
var headerInfo = inspect.parseTfhd(tfhd[0]);
var trackId = headerInfo.trackId;
var tfdt = probe.findBox(traf, ['tfdt']);
var tfdt = inspect.findBox(traf, ['tfdt']);
// Either 0 or 1 tfdt per traf
var baseMediaDecodeTime = (tfdt.length > 0) ? inspect.parseTfdt(tfdt[0]).baseMediaDecodeTime : 0;
var truns = probe.findBox(traf, ['trun']);
var truns = inspect.findBox(traf, ['trun']);
var samples;

@@ -203,0 +202,0 @@ var seiNals;

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

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

"uglify": "npm-run-all -p uglify:*",
"uglify:mp4": "uglifyjs --mangle --compress -o dist/mux-mp4.min.js dist/mux-mp4.js",
"uglify:flv": "uglifyjs --mangle --compress -o dist/mux-flv.min.js dist/mux-flv.js",
"uglify:js": "uglifyjs --mangle --compress -o dist/mux.min.js dist/mux.js",
"uglify:mp4": "uglifyjs --mangle --compress -o dist/mux-mp4.min.js dist/mux-mp4.js && node scripts/insert-license-header.js dist/mux-mp4.min.js",
"uglify:flv": "uglifyjs --mangle --compress -o dist/mux-flv.min.js dist/mux-flv.js && node scripts/insert-license-header.js dist/mux-flv.min.js",
"uglify:js": "uglifyjs --mangle --compress -o dist/mux.min.js dist/mux.js && node scripts/insert-license-header.js dist/mux.min.js",
"clean": "rm -rf dist dist-test",

@@ -31,0 +31,0 @@ "prepublish": "not-in-install && npm run build || in-install"

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

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

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

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