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

codem-isoboxer

Package Overview
Dependencies
Maintainers
3
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

codem-isoboxer - npm Package Compare versions

Comparing version 0.3.7 to 0.3.8

6

CHANGELOG.md

@@ -0,1 +1,7 @@

## codem-isoboxer 0.3.8 (2023/02/17) ##
* Add support for prft boxes
* Add support for stts and ctts boxes
* Fix box parsing when length is equal to 0
## codem-isoboxer 0.3.7 (2019/02/04) ##

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

34

dist/iso_boxer.js

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

/*! codem-isoboxer v0.3.7 https://github.com/madebyhiro/codem-isoboxer/blob/master/LICENSE.txt */
/*! codem-isoboxer v0.3.8 https://github.com/madebyhiro/codem-isoboxer/blob/master/LICENSE.txt */
var ISOBoxer = {};

@@ -497,3 +497,4 @@

case 0:
this._raw = new DataView(this._raw.buffer, this._offset, (this._raw.byteLength - this._cursor.offset + 8));
// Size zero indicates last box in the file. Consume remaining buffer.
this._raw = new DataView(this._raw.buffer, this._offset);
break;

@@ -800,2 +801,12 @@ case 1:

// ISO/IEC 14496-12:2012 - 8.6.1.3 Composition Time To Sample Box
ISOBox.prototype._boxProcessors['ctts'] = function() {
this._procFullBox();
this._procField('entry_count', 'uint', 32);
this._procEntries('entries', this.entry_count, function(entry) {
this._procEntryField(entry, 'sample_count', 'uint', 32);
this._procEntryField(entry, 'sample_offset', (this.version === 1) ? 'int' : 'uint', 32);
});
};
// ISO/IEC 14496-12:2012 - 8.7.2 Data Reference Box

@@ -953,2 +964,11 @@ ISOBox.prototype._boxProcessors['dref'] = function() {

// ISO/IEC 14496-12:2012 - 8.16.5 Producer Reference Time
ISOBox.prototype._boxProcessors['prft'] = function() {
this._procFullBox();
this._procField('reference_track_ID', 'uint', 32);
this._procField('ntp_timestamp_sec', 'uint', 32);
this._procField('ntp_timestamp_frac', 'uint', 32);
this._procField('media_time', 'uint', (this.version == 1) ? 64 : 32);
};
//ISO/IEC 23001-7:2011 - 8.1 Protection System Specific Header Box

@@ -1042,2 +1062,12 @@ ISOBox.prototype._boxProcessors['pssh'] = function() {

// ISO/IEC 14496-12:2012 - 8.6.1.2 Decoding Time To Sample Box
ISOBox.prototype._boxProcessors['stts'] = function() {
this._procFullBox();
this._procField('entry_count', 'uint', 32);
this._procEntries('entries', this.entry_count, function(entry) {
this._procEntryField(entry, 'sample_count', 'uint', 32);
this._procEntryField(entry, 'sample_delta', 'uint', 32);
});
};
// ISO/IEC 14496-12:2015 - 8.7.7 Sub-Sample Information Box

@@ -1044,0 +1074,0 @@ ISOBox.prototype._boxProcessors['subs'] = function () {

4

dist/iso_boxer.min.js

@@ -1,3 +0,3 @@

/*! codem-isoboxer v0.3.7 https://github.com/madebyhiro/codem-isoboxer/blob/master/LICENSE.txt */
/*! codem-isoboxer v0.3.8 https://github.com/madebyhiro/codem-isoboxer/blob/master/LICENSE.txt */
var ISOBoxer={};ISOBoxer.parseBuffer=function(a){return new ISOFile(a).parse()},ISOBoxer.addBoxProcessor=function(a,b){"string"==typeof a&&"function"==typeof b&&(ISOBox.prototype._boxProcessors[a]=b)},ISOBoxer.createFile=function(){return new ISOFile},ISOBoxer.createBox=function(a,b,c){var d=ISOBox.create(a);return b&&b.append(d,c),d},ISOBoxer.createFullBox=function(a,b,c){var d=ISOBoxer.createBox(a,b,c);return d.version=0,d.flags=0,d},ISOBoxer.Utils={},ISOBoxer.Utils.dataViewToString=function(a,b){var c=b||"utf-8";if("undefined"!=typeof TextDecoder)return new TextDecoder(c).decode(a);var d=[],e=0;if("utf-8"===c)for(;e<a.byteLength;){var f=a.getUint8(e++);f<128||(f<224?(f=(31&f)<<6,f|=63&a.getUint8(e++)):f<240?(f=(15&f)<<12,f|=(63&a.getUint8(e++))<<6,f|=63&a.getUint8(e++)):(f=(7&f)<<18,f|=(63&a.getUint8(e++))<<12,f|=(63&a.getUint8(e++))<<6,f|=63&a.getUint8(e++))),d.push(String.fromCharCode(f))}else for(;e<a.byteLength;)d.push(String.fromCharCode(a.getUint8(e++)));return d.join("")},ISOBoxer.Utils.utf8ToByteArray=function(a){var b,c;if("undefined"!=typeof TextEncoder)b=(new TextEncoder).encode(a);else for(b=[],c=0;c<a.length;++c){var d=a.charCodeAt(c);d<128?b.push(d):d<2048?(b.push(192|d>>6),b.push(128|63&d)):d<65536?(b.push(224|d>>12),b.push(128|63&d>>6),b.push(128|63&d)):(b.push(240|d>>18),b.push(128|63&d>>12),b.push(128|63&d>>6),b.push(128|63&d))}return b},ISOBoxer.Utils.appendBox=function(a,b,c){if(b._offset=a._cursor.offset,b._root=a._root?a._root:a,b._raw=a._raw,b._parent=a,-1!==c){if(void 0===c||null===c)return void a.boxes.push(b);var d,e=-1;if("number"==typeof c)e=c;else{if("string"==typeof c)d=c;else{if("object"!=typeof c||!c.type)return void a.boxes.push(b);d=c.type}for(var f=0;f<a.boxes.length;f++)if(d===a.boxes[f].type){e=f+1;break}}a.boxes.splice(e,0,b)}},"undefined"!=typeof exports&&(exports.parseBuffer=ISOBoxer.parseBuffer,exports.addBoxProcessor=ISOBoxer.addBoxProcessor,exports.createFile=ISOBoxer.createFile,exports.createBox=ISOBoxer.createBox,exports.createFullBox=ISOBoxer.createFullBox,exports.Utils=ISOBoxer.Utils),ISOBoxer.Cursor=function(a){this.offset=void 0===a?0:a};var ISOFile=function(a){this._cursor=new ISOBoxer.Cursor,this.boxes=[],a&&(this._raw=new DataView(a))};ISOFile.prototype.fetch=function(a){var b=this.fetchAll(a,!0);return b.length?b[0]:null},ISOFile.prototype.fetchAll=function(a,b){var c=[];return ISOFile._sweep.call(this,a,c,b),c},ISOFile.prototype.parse=function(){for(this._cursor.offset=0,this.boxes=[];this._cursor.offset<this._raw.byteLength;){var a=ISOBox.parse(this);if(void 0===a.type)break;this.boxes.push(a)}return this},ISOFile._sweep=function(a,b,c){this.type&&this.type==a&&b.push(this);for(var d in this.boxes){if(b.length&&c)return;ISOFile._sweep.call(this.boxes[d],a,b,c)}},ISOFile.prototype.write=function(){var a,b=0;for(a=0;a<this.boxes.length;a++)b+=this.boxes[a].getLength(!1);var c=new Uint8Array(b);for(this._rawo=new DataView(c.buffer),this.bytes=c,this._cursor.offset=0,a=0;a<this.boxes.length;a++)this.boxes[a].write();return c.buffer},ISOFile.prototype.append=function(a,b){ISOBoxer.Utils.appendBox(this,a,b)};var ISOBox=function(){this._cursor=new ISOBoxer.Cursor};ISOBox.parse=function(a){var b=new ISOBox;return b._offset=a._cursor.offset,b._root=a._root?a._root:a,b._raw=a._raw,b._parent=a,b._parseBox(),a._cursor.offset=b._raw.byteOffset+b._raw.byteLength,b},ISOBox.create=function(a){var b=new ISOBox;return b.type=a,b.boxes=[],b},ISOBox.prototype._boxContainers=["dinf","edts","mdia","meco","mfra","minf","moof","moov","mvex","stbl","strk","traf","trak","tref","udta","vttc","sinf","schi","encv","enca"],ISOBox.prototype._boxProcessors={},ISOBox.prototype._procField=function(a,b,c){this._parsing?this[a]=this._readField(b,c):this._writeField(b,c,this[a])},ISOBox.prototype._procFieldArray=function(a,b,c,d){var e;if(this._parsing)for(this[a]=[],e=0;e<b;e++)this[a][e]=this._readField(c,d);else for(e=0;e<this[a].length;e++)this._writeField(c,d,this[a][e])},ISOBox.prototype._procFullBox=function(){this._procField("version","uint",8),this._procField("flags","uint",24)},ISOBox.prototype._procEntries=function(a,b,c){var d;if(this._parsing)for(this[a]=[],d=0;d<b;d++)this[a].push({}),c.call(this,this[a][d]);else for(d=0;d<b;d++)c.call(this,this[a][d])},ISOBox.prototype._procSubEntries=function(a,b,c,d){var e;if(this._parsing)for(a[b]=[],e=0;e<c;e++)a[b].push({}),d.call(this,a[b][e]);else for(e=0;e<c;e++)d.call(this,a[b][e])},ISOBox.prototype._procEntryField=function(a,b,c,d){this._parsing?a[b]=this._readField(c,d):this._writeField(c,d,a[b])},ISOBox.prototype._procSubBoxes=function(a,b){var c;if(this._parsing)for(this[a]=[],c=0;c<b;c++)this[a].push(ISOBox.parse(this));else for(c=0;c<b;c++)this._rawo?this[a][c].write():this.size+=this[a][c].getLength()},ISOBox.prototype._readField=function(a,b){switch(a){case"uint":return this._readUint(b);case"int":return this._readInt(b);case"template":return this._readTemplate(b);case"string":return-1===b?this._readTerminatedString():this._readString(b);case"data":return this._readData(b);case"utf8":return this._readUTF8String();default:return-1}},ISOBox.prototype._readInt=function(a){var b=null,c=this._cursor.offset-this._raw.byteOffset;switch(a){case 8:b=this._raw.getInt8(c);break;case 16:b=this._raw.getInt16(c);break;case 32:b=this._raw.getInt32(c);break;case 64:var d=this._raw.getInt32(c),e=this._raw.getInt32(c+4);b=d*Math.pow(2,32)+e}return this._cursor.offset+=a>>3,b},ISOBox.prototype._readUint=function(a){var b,c,d=null,e=this._cursor.offset-this._raw.byteOffset;switch(a){case 8:d=this._raw.getUint8(e);break;case 16:d=this._raw.getUint16(e);break;case 24:b=this._raw.getUint16(e),c=this._raw.getUint8(e+2),d=(b<<8)+c;break;case 32:d=this._raw.getUint32(e);break;case 64:b=this._raw.getUint32(e),c=this._raw.getUint32(e+4),d=b*Math.pow(2,32)+c}return this._cursor.offset+=a>>3,d},ISOBox.prototype._readString=function(a){for(var b="",c=0;c<a;c++){var d=this._readUint(8);b+=String.fromCharCode(d)}return b},ISOBox.prototype._readTemplate=function(a){return this._readUint(a/2)+this._readUint(a/2)/Math.pow(2,a/2)},ISOBox.prototype._readTerminatedString=function(){for(var a="";this._cursor.offset-this._offset<this._raw.byteLength;){var b=this._readUint(8);if(0===b)break;a+=String.fromCharCode(b)}return a},ISOBox.prototype._readData=function(a){var b=a>0?a:this._raw.byteLength-(this._cursor.offset-this._offset);if(b>0){var c=new Uint8Array(this._raw.buffer,this._cursor.offset,b);return this._cursor.offset+=b,c}return null},ISOBox.prototype._readUTF8String=function(){var a=this._raw.byteLength-(this._cursor.offset-this._offset),b=null;return a>0&&(b=new DataView(this._raw.buffer,this._cursor.offset,a),this._cursor.offset+=a),b?ISOBoxer.Utils.dataViewToString(b):b},ISOBox.prototype._parseBox=function(){if(this._parsing=!0,this._cursor.offset=this._offset,this._offset+8>this._raw.buffer.byteLength)return void(this._root._incomplete=!0);switch(this._procField("size","uint",32),this._procField("type","string",4),1===this.size&&this._procField("largesize","uint",64),"uuid"===this.type&&this._procFieldArray("usertype",16,"uint",8),this.size){case 0:this._raw=new DataView(this._raw.buffer,this._offset,this._raw.byteLength-this._cursor.offset+8);break;case 1:this._offset+this.size>this._raw.buffer.byteLength?(this._incomplete=!0,this._root._incomplete=!0):this._raw=new DataView(this._raw.buffer,this._offset,this.largesize);break;default:this._offset+this.size>this._raw.buffer.byteLength?(this._incomplete=!0,this._root._incomplete=!0):this._raw=new DataView(this._raw.buffer,this._offset,this.size)}this._incomplete||(this._boxProcessors[this.type]&&this._boxProcessors[this.type].call(this),-1!==this._boxContainers.indexOf(this.type)?this._parseContainerBox():this._data=this._readData())},ISOBox.prototype._parseFullBox=function(){this.version=this._readUint(8),this.flags=this._readUint(24)},ISOBox.prototype._parseContainerBox=function(){for(this.boxes=[];this._cursor.offset-this._raw.byteOffset<this._raw.byteLength;)this.boxes.push(ISOBox.parse(this))},ISOBox.prototype.append=function(a,b){ISOBoxer.Utils.appendBox(this,a,b)},ISOBox.prototype.getLength=function(){if(this._parsing=!1,this._rawo=null,this.size=0,this._procField("size","uint",32),this._procField("type","string",4),1===this.size&&this._procField("largesize","uint",64),"uuid"===this.type&&this._procFieldArray("usertype",16,"uint",8),this._boxProcessors[this.type]&&this._boxProcessors[this.type].call(this),-1!==this._boxContainers.indexOf(this.type))for(var a=0;a<this.boxes.length;a++)this.size+=this.boxes[a].getLength();return this._data&&this._writeData(this._data),this.size},ISOBox.prototype.write=function(){switch(this._parsing=!1,this._cursor.offset=this._parent._cursor.offset,this.size){case 0:this._rawo=new DataView(this._parent._rawo.buffer,this._cursor.offset,this.parent._rawo.byteLength-this._cursor.offset);break;case 1:this._rawo=new DataView(this._parent._rawo.buffer,this._cursor.offset,this.largesize);break;default:this._rawo=new DataView(this._parent._rawo.buffer,this._cursor.offset,this.size)}if(this._procField("size","uint",32),this._procField("type","string",4),1===this.size&&this._procField("largesize","uint",64),"uuid"===this.type&&this._procFieldArray("usertype",16,"uint",8),this._boxProcessors[this.type]&&this._boxProcessors[this.type].call(this),-1!==this._boxContainers.indexOf(this.type))for(var a=0;a<this.boxes.length;a++)this.boxes[a].write();return this._data&&this._writeData(this._data),this._parent._cursor.offset+=this.size,this.size},ISOBox.prototype._writeInt=function(a,b){if(this._rawo){var c=this._cursor.offset-this._rawo.byteOffset;switch(a){case 8:this._rawo.setInt8(c,b);break;case 16:this._rawo.setInt16(c,b);break;case 32:this._rawo.setInt32(c,b);break;case 64:var d=Math.floor(b/Math.pow(2,32)),e=b-d*Math.pow(2,32);this._rawo.setUint32(c,d),this._rawo.setUint32(c+4,e)}this._cursor.offset+=a>>3}else this.size+=a>>3},ISOBox.prototype._writeUint=function(a,b){if(this._rawo){var c,d,e=this._cursor.offset-this._rawo.byteOffset;switch(a){case 8:this._rawo.setUint8(e,b);break;case 16:this._rawo.setUint16(e,b);break;case 24:c=(16776960&b)>>8,d=255&b,this._rawo.setUint16(e,c),this._rawo.setUint8(e+2,d);break;case 32:this._rawo.setUint32(e,b);break;case 64:c=Math.floor(b/Math.pow(2,32)),d=b-c*Math.pow(2,32),this._rawo.setUint32(e,c),this._rawo.setUint32(e+4,d)}this._cursor.offset+=a>>3}else this.size+=a>>3},ISOBox.prototype._writeString=function(a,b){for(var c=0;c<a;c++)this._writeUint(8,b.charCodeAt(c))},ISOBox.prototype._writeTerminatedString=function(a){if(0!==a.length){for(var b=0;b<a.length;b++)this._writeUint(8,a.charCodeAt(b));this._writeUint(8,0)}},ISOBox.prototype._writeTemplate=function(a,b){var c=Math.floor(b),d=(b-c)*Math.pow(2,a/2);this._writeUint(a/2,c),this._writeUint(a/2,d)},ISOBox.prototype._writeData=function(a){var b;if(a)if(this._rawo){if(a instanceof Array){for(var c=this._cursor.offset-this._rawo.byteOffset,b=0;b<a.length;b++)this._rawo.setInt8(c+b,a[b]);this._cursor.offset+=a.length}a instanceof Uint8Array&&(this._root.bytes.set(a,this._cursor.offset),this._cursor.offset+=a.length)}else this.size+=a.length},ISOBox.prototype._writeUTF8String=function(a){var b=ISOBoxer.Utils.utf8ToByteArray(a);if(this._rawo)for(var c=new DataView(this._rawo.buffer,this._cursor.offset,b.length),d=0;d<b.length;d++)c.setUint8(d,b[d]);else this.size+=b.length},ISOBox.prototype._writeField=function(a,b,c){switch(a){case"uint":this._writeUint(b,c);break;case"int":this._writeInt(b,c);break;case"template":this._writeTemplate(b,c);break;case"string":-1==b?this._writeTerminatedString(c):this._writeString(b,c);break;case"data":this._writeData(c);break;case"utf8":this._writeUTF8String(c)}},ISOBox.prototype._boxProcessors.avc1=ISOBox.prototype._boxProcessors.avc2=ISOBox.prototype._boxProcessors.avc3=ISOBox.prototype._boxProcessors.avc4=ISOBox.prototype._boxProcessors.hvc1=ISOBox.prototype._boxProcessors.hev1=ISOBox.prototype._boxProcessors.encv=function(){this._procFieldArray("reserved1",6,"uint",8),this._procField("data_reference_index","uint",16),this._procField("pre_defined1","uint",16),this._procField("reserved2","uint",16),this._procFieldArray("pre_defined2",3,"uint",32),this._procField("width","uint",16),this._procField("height","uint",16),this._procField("horizresolution","template",32),this._procField("vertresolution","template",32),this._procField("reserved3","uint",32),this._procField("frame_count","uint",16),this._procFieldArray("compressorname",32,"uint",8),this._procField("depth","uint",16),this._procField("pre_defined3","int",16),this._procField("config","data",-1)},ISOBox.prototype._boxProcessors.dref=function(){this._procFullBox(),this._procField("entry_count","uint",32),this._procSubBoxes("entries",this.entry_count)},ISOBox.prototype._boxProcessors.elst=function(){this._procFullBox(),this._procField("entry_count","uint",32),this._procEntries("entries",this.entry_count,function(a){this._procEntryField(a,"segment_duration","uint",1===this.version?64:32),this._procEntryField(a,"media_time","int",1===this.version?64:32),this._procEntryField(a,"media_rate_integer","int",16),this._procEntryField(a,"media_rate_fraction","int",16)})},ISOBox.prototype._boxProcessors.emsg=function(){this._procFullBox(),1==this.version?(this._procField("timescale","uint",32),this._procField("presentation_time","uint",64),this._procField("event_duration","uint",32),this._procField("id","uint",32),this._procField("scheme_id_uri","string",-1),this._procField("value","string",-1)):(this._procField("scheme_id_uri","string",-1),this._procField("value","string",-1),this._procField("timescale","uint",32),this._procField("presentation_time_delta","uint",32),this._procField("event_duration","uint",32),this._procField("id","uint",32)),this._procField("message_data","data",-1)},ISOBox.prototype._boxProcessors.free=ISOBox.prototype._boxProcessors.skip=function(){this._procField("data","data",-1)},ISOBox.prototype._boxProcessors.frma=function(){this._procField("data_format","uint",32)},ISOBox.prototype._boxProcessors.ftyp=ISOBox.prototype._boxProcessors.styp=function(){this._procField("major_brand","string",4),this._procField("minor_version","uint",32);var a=-1;this._parsing&&(a=(this._raw.byteLength-(this._cursor.offset-this._raw.byteOffset))/4),this._procFieldArray("compatible_brands",a,"string",4)},ISOBox.prototype._boxProcessors.hdlr=function(){this._procFullBox(),this._procField("pre_defined","uint",32),this._procField("handler_type","string",4),this._procFieldArray("reserved",3,"uint",32),this._procField("name","string",-1)},ISOBox.prototype._boxProcessors.mdat=function(){this._procField("data","data",-1)},ISOBox.prototype._boxProcessors.mdhd=function(){this._procFullBox(),this._procField("creation_time","uint",1==this.version?64:32),this._procField("modification_time","uint",1==this.version?64:32),this._procField("timescale","uint",32),this._procField("duration","uint",1==this.version?64:32),this._parsing||"string"!=typeof this.language||(this.language=this.language.charCodeAt(0)-96<<10|this.language.charCodeAt(1)-96<<5|this.language.charCodeAt(2)-96),this._procField("language","uint",16),this._parsing&&(this.language=String.fromCharCode(96+(this.language>>10&31),96+(this.language>>5&31),96+(31&this.language))),this._procField("pre_defined","uint",16)},ISOBox.prototype._boxProcessors.mehd=function(){this._procFullBox(),this._procField("fragment_duration","uint",1==this.version?64:32)},ISOBox.prototype._boxProcessors.mfhd=function(){this._procFullBox(),this._procField("sequence_number","uint",32)},ISOBox.prototype._boxProcessors.mfro=function(){this._procFullBox(),this._procField("mfra_size","uint",32)},ISOBox.prototype._boxProcessors.mp4a=ISOBox.prototype._boxProcessors.enca=function(){this._procFieldArray("reserved1",6,"uint",8),this._procField("data_reference_index","uint",16),this._procFieldArray("reserved2",2,"uint",32),this._procField("channelcount","uint",16),this._procField("samplesize","uint",16),this._procField("pre_defined","uint",16),this._procField("reserved3","uint",16),this._procField("samplerate","template",32),this._procField("esds","data",-1)},ISOBox.prototype._boxProcessors.mvhd=function(){this._procFullBox(),this._procField("creation_time","uint",1==this.version?64:32),this._procField("modification_time","uint",1==this.version?64:32),this._procField("timescale","uint",32),this._procField("duration","uint",1==this.version?64:32),this._procField("rate","template",32),this._procField("volume","template",16),this._procField("reserved1","uint",16),this._procFieldArray("reserved2",2,"uint",32),this._procFieldArray("matrix",9,"template",32),this._procFieldArray("pre_defined",6,"uint",32),this._procField("next_track_ID","uint",32)},ISOBox.prototype._boxProcessors.payl=function(){this._procField("cue_text","utf8")},ISOBox.prototype._boxProcessors.pssh=function(){this._procFullBox(),this._procFieldArray("SystemID",16,"uint",8),this._procField("DataSize","uint",32),this._procFieldArray("Data",this.DataSize,"uint",8)},ISOBox.prototype._boxProcessors.schm=function(){this._procFullBox(),this._procField("scheme_type","uint",32),this._procField("scheme_version","uint",32),1&this.flags&&this._procField("scheme_uri","string",-1)},ISOBox.prototype._boxProcessors.sdtp=function(){this._procFullBox();var a=-1;this._parsing&&(a=this._raw.byteLength-(this._cursor.offset-this._raw.byteOffset)),this._procFieldArray("sample_dependency_table",a,"uint",8)},ISOBox.prototype._boxProcessors.sidx=function(){this._procFullBox(),this._procField("reference_ID","uint",32),this._procField("timescale","uint",32),this._procField("earliest_presentation_time","uint",1==this.version?64:32),this._procField("first_offset","uint",1==this.version?64:32),this._procField("reserved","uint",16),this._procField("reference_count","uint",16),this._procEntries("references",this.reference_count,function(a){this._parsing||(a.reference=(1&a.reference_type)<<31,a.reference|=2147483647&a.referenced_size,a.sap=(1&a.starts_with_SAP)<<31,a.sap|=(3&a.SAP_type)<<28,a.sap|=268435455&a.SAP_delta_time),this._procEntryField(a,"reference","uint",32),this._procEntryField(a,"subsegment_duration","uint",32),this._procEntryField(a,"sap","uint",32),this._parsing&&(a.reference_type=a.reference>>31&1,a.referenced_size=2147483647&a.reference,a.starts_with_SAP=a.sap>>31&1,a.SAP_type=a.sap>>28&7,a.SAP_delta_time=268435455&a.sap)})},ISOBox.prototype._boxProcessors.smhd=function(){this._procFullBox(),this._procField("balance","uint",16),this._procField("reserved","uint",16)},ISOBox.prototype._boxProcessors.ssix=function(){this._procFullBox(),this._procField("subsegment_count","uint",32),this._procEntries("subsegments",this.subsegment_count,function(a){this._procEntryField(a,"ranges_count","uint",32),this._procSubEntries(a,"ranges",a.ranges_count,function(a){this._procEntryField(a,"level","uint",8),this._procEntryField(a,"range_size","uint",24)})})},ISOBox.prototype._boxProcessors.stsd=function(){this._procFullBox(),this._procField("entry_count","uint",32),this._procSubBoxes("entries",this.entry_count)},ISOBox.prototype._boxProcessors.subs=function(){this._procFullBox(),this._procField("entry_count","uint",32),this._procEntries("entries",this.entry_count,function(a){this._procEntryField(a,"sample_delta","uint",32),this._procEntryField(a,"subsample_count","uint",16),this._procSubEntries(a,"subsamples",a.subsample_count,function(a){this._procEntryField(a,"subsample_size","uint",1===this.version?32:16),this._procEntryField(a,"subsample_priority","uint",8),this._procEntryField(a,"discardable","uint",8),this._procEntryField(a,"codec_specific_parameters","uint",32)})})},ISOBox.prototype._boxProcessors.tenc=function(){this._procFullBox(),this._procField("default_IsEncrypted","uint",24),this._procField("default_IV_size","uint",8),this._procFieldArray("default_KID",16,"uint",8)},ISOBox.prototype._boxProcessors.tfdt=function(){this._procFullBox(),this._procField("baseMediaDecodeTime","uint",1==this.version?64:32)},ISOBox.prototype._boxProcessors.tfhd=function(){this._procFullBox(),this._procField("track_ID","uint",32),1&this.flags&&this._procField("base_data_offset","uint",64),2&this.flags&&this._procField("sample_description_offset","uint",32),8&this.flags&&this._procField("default_sample_duration","uint",32),16&this.flags&&this._procField("default_sample_size","uint",32),32&this.flags&&this._procField("default_sample_flags","uint",32)},ISOBox.prototype._boxProcessors.tfra=function(){this._procFullBox(),this._procField("track_ID","uint",32),this._parsing||(this.reserved=0,this.reserved|=(48&this.length_size_of_traf_num)<<4,this.reserved|=(12&this.length_size_of_trun_num)<<2,this.reserved|=3&this.length_size_of_sample_num),this._procField("reserved","uint",32),this._parsing&&(this.length_size_of_traf_num=(48&this.reserved)>>4,this.length_size_of_trun_num=(12&this.reserved)>>2,this.length_size_of_sample_num=3&this.reserved),this._procField("number_of_entry","uint",32),this._procEntries("entries",this.number_of_entry,function(a){this._procEntryField(a,"time","uint",1===this.version?64:32),this._procEntryField(a,"moof_offset","uint",1===this.version?64:32),this._procEntryField(a,"traf_number","uint",8*(this.length_size_of_traf_num+1)),this._procEntryField(a,"trun_number","uint",8*(this.length_size_of_trun_num+1)),this._procEntryField(a,"sample_number","uint",8*(this.length_size_of_sample_num+1))})},ISOBox.prototype._boxProcessors.tkhd=function(){this._procFullBox(),this._procField("creation_time","uint",1==this.version?64:32),this._procField("modification_time","uint",1==this.version?64:32),this._procField("track_ID","uint",32),this._procField("reserved1","uint",32),this._procField("duration","uint",1==this.version?64:32),this._procFieldArray("reserved2",2,"uint",32),this._procField("layer","uint",16),this._procField("alternate_group","uint",16),this._procField("volume","template",16),this._procField("reserved3","uint",16),this._procFieldArray("matrix",9,"template",32),this._procField("width","template",32),this._procField("height","template",32)},ISOBox.prototype._boxProcessors.trex=function(){this._procFullBox(),this._procField("track_ID","uint",32),this._procField("default_sample_description_index","uint",32),this._procField("default_sample_duration","uint",32),this._procField("default_sample_size","uint",32),this._procField("default_sample_flags","uint",32)},ISOBox.prototype._boxProcessors.trun=function(){this._procFullBox(),this._procField("sample_count","uint",32),1&this.flags&&this._procField("data_offset","int",32),4&this.flags&&this._procField("first_sample_flags","uint",32),this._procEntries("samples",this.sample_count,function(a){256&this.flags&&this._procEntryField(a,"sample_duration","uint",32),512&this.flags&&this._procEntryField(a,"sample_size","uint",32),1024&this.flags&&this._procEntryField(a,"sample_flags","uint",32),2048&this.flags&&this._procEntryField(a,"sample_composition_time_offset",1===this.version?"int":"uint",32)})},ISOBox.prototype._boxProcessors["url "]=ISOBox.prototype._boxProcessors["urn "]=function(){this._procFullBox(),"urn "===this.type&&this._procField("name","string",-1),this._procField("location","string",-1)},ISOBox.prototype._boxProcessors.vlab=function(){this._procField("source_label","utf8")},ISOBox.prototype._boxProcessors.vmhd=function(){this._procFullBox(),this._procField("graphicsmode","uint",16),this._procFieldArray("opcolor",3,"uint",16)},ISOBox.prototype._boxProcessors.vttC=function(){this._procField("config","utf8")},ISOBox.prototype._boxProcessors.vtte=function(){};
var ISOBoxer={};ISOBoxer.parseBuffer=function(a){return new ISOFile(a).parse()},ISOBoxer.addBoxProcessor=function(a,b){"string"==typeof a&&"function"==typeof b&&(ISOBox.prototype._boxProcessors[a]=b)},ISOBoxer.createFile=function(){return new ISOFile},ISOBoxer.createBox=function(a,b,c){var d=ISOBox.create(a);return b&&b.append(d,c),d},ISOBoxer.createFullBox=function(a,b,c){var d=ISOBoxer.createBox(a,b,c);return d.version=0,d.flags=0,d},ISOBoxer.Utils={},ISOBoxer.Utils.dataViewToString=function(a,b){var c=b||"utf-8";if("undefined"!=typeof TextDecoder)return new TextDecoder(c).decode(a);var d=[],e=0;if("utf-8"===c)for(;e<a.byteLength;){var f=a.getUint8(e++);f<128||(f<224?(f=(31&f)<<6,f|=63&a.getUint8(e++)):f<240?(f=(15&f)<<12,f|=(63&a.getUint8(e++))<<6,f|=63&a.getUint8(e++)):(f=(7&f)<<18,f|=(63&a.getUint8(e++))<<12,f|=(63&a.getUint8(e++))<<6,f|=63&a.getUint8(e++))),d.push(String.fromCharCode(f))}else for(;e<a.byteLength;)d.push(String.fromCharCode(a.getUint8(e++)));return d.join("")},ISOBoxer.Utils.utf8ToByteArray=function(a){var b,c;if("undefined"!=typeof TextEncoder)b=(new TextEncoder).encode(a);else for(b=[],c=0;c<a.length;++c){var d=a.charCodeAt(c);d<128?b.push(d):d<2048?(b.push(192|d>>6),b.push(128|63&d)):d<65536?(b.push(224|d>>12),b.push(128|63&d>>6),b.push(128|63&d)):(b.push(240|d>>18),b.push(128|63&d>>12),b.push(128|63&d>>6),b.push(128|63&d))}return b},ISOBoxer.Utils.appendBox=function(a,b,c){if(b._offset=a._cursor.offset,b._root=a._root?a._root:a,b._raw=a._raw,b._parent=a,-1!==c){if(void 0===c||null===c)return void a.boxes.push(b);var d,e=-1;if("number"==typeof c)e=c;else{if("string"==typeof c)d=c;else{if("object"!=typeof c||!c.type)return void a.boxes.push(b);d=c.type}for(var f=0;f<a.boxes.length;f++)if(d===a.boxes[f].type){e=f+1;break}}a.boxes.splice(e,0,b)}},"undefined"!=typeof exports&&(exports.parseBuffer=ISOBoxer.parseBuffer,exports.addBoxProcessor=ISOBoxer.addBoxProcessor,exports.createFile=ISOBoxer.createFile,exports.createBox=ISOBoxer.createBox,exports.createFullBox=ISOBoxer.createFullBox,exports.Utils=ISOBoxer.Utils),ISOBoxer.Cursor=function(a){this.offset=void 0===a?0:a};var ISOFile=function(a){this._cursor=new ISOBoxer.Cursor,this.boxes=[],a&&(this._raw=new DataView(a))};ISOFile.prototype.fetch=function(a){var b=this.fetchAll(a,!0);return b.length?b[0]:null},ISOFile.prototype.fetchAll=function(a,b){var c=[];return ISOFile._sweep.call(this,a,c,b),c},ISOFile.prototype.parse=function(){for(this._cursor.offset=0,this.boxes=[];this._cursor.offset<this._raw.byteLength;){var a=ISOBox.parse(this);if(void 0===a.type)break;this.boxes.push(a)}return this},ISOFile._sweep=function(a,b,c){this.type&&this.type==a&&b.push(this);for(var d in this.boxes){if(b.length&&c)return;ISOFile._sweep.call(this.boxes[d],a,b,c)}},ISOFile.prototype.write=function(){var a,b=0;for(a=0;a<this.boxes.length;a++)b+=this.boxes[a].getLength(!1);var c=new Uint8Array(b);for(this._rawo=new DataView(c.buffer),this.bytes=c,this._cursor.offset=0,a=0;a<this.boxes.length;a++)this.boxes[a].write();return c.buffer},ISOFile.prototype.append=function(a,b){ISOBoxer.Utils.appendBox(this,a,b)};var ISOBox=function(){this._cursor=new ISOBoxer.Cursor};ISOBox.parse=function(a){var b=new ISOBox;return b._offset=a._cursor.offset,b._root=a._root?a._root:a,b._raw=a._raw,b._parent=a,b._parseBox(),a._cursor.offset=b._raw.byteOffset+b._raw.byteLength,b},ISOBox.create=function(a){var b=new ISOBox;return b.type=a,b.boxes=[],b},ISOBox.prototype._boxContainers=["dinf","edts","mdia","meco","mfra","minf","moof","moov","mvex","stbl","strk","traf","trak","tref","udta","vttc","sinf","schi","encv","enca"],ISOBox.prototype._boxProcessors={},ISOBox.prototype._procField=function(a,b,c){this._parsing?this[a]=this._readField(b,c):this._writeField(b,c,this[a])},ISOBox.prototype._procFieldArray=function(a,b,c,d){var e;if(this._parsing)for(this[a]=[],e=0;e<b;e++)this[a][e]=this._readField(c,d);else for(e=0;e<this[a].length;e++)this._writeField(c,d,this[a][e])},ISOBox.prototype._procFullBox=function(){this._procField("version","uint",8),this._procField("flags","uint",24)},ISOBox.prototype._procEntries=function(a,b,c){var d;if(this._parsing)for(this[a]=[],d=0;d<b;d++)this[a].push({}),c.call(this,this[a][d]);else for(d=0;d<b;d++)c.call(this,this[a][d])},ISOBox.prototype._procSubEntries=function(a,b,c,d){var e;if(this._parsing)for(a[b]=[],e=0;e<c;e++)a[b].push({}),d.call(this,a[b][e]);else for(e=0;e<c;e++)d.call(this,a[b][e])},ISOBox.prototype._procEntryField=function(a,b,c,d){this._parsing?a[b]=this._readField(c,d):this._writeField(c,d,a[b])},ISOBox.prototype._procSubBoxes=function(a,b){var c;if(this._parsing)for(this[a]=[],c=0;c<b;c++)this[a].push(ISOBox.parse(this));else for(c=0;c<b;c++)this._rawo?this[a][c].write():this.size+=this[a][c].getLength()},ISOBox.prototype._readField=function(a,b){switch(a){case"uint":return this._readUint(b);case"int":return this._readInt(b);case"template":return this._readTemplate(b);case"string":return-1===b?this._readTerminatedString():this._readString(b);case"data":return this._readData(b);case"utf8":return this._readUTF8String();default:return-1}},ISOBox.prototype._readInt=function(a){var b=null,c=this._cursor.offset-this._raw.byteOffset;switch(a){case 8:b=this._raw.getInt8(c);break;case 16:b=this._raw.getInt16(c);break;case 32:b=this._raw.getInt32(c);break;case 64:var d=this._raw.getInt32(c),e=this._raw.getInt32(c+4);b=d*Math.pow(2,32)+e}return this._cursor.offset+=a>>3,b},ISOBox.prototype._readUint=function(a){var b,c,d=null,e=this._cursor.offset-this._raw.byteOffset;switch(a){case 8:d=this._raw.getUint8(e);break;case 16:d=this._raw.getUint16(e);break;case 24:b=this._raw.getUint16(e),c=this._raw.getUint8(e+2),d=(b<<8)+c;break;case 32:d=this._raw.getUint32(e);break;case 64:b=this._raw.getUint32(e),c=this._raw.getUint32(e+4),d=b*Math.pow(2,32)+c}return this._cursor.offset+=a>>3,d},ISOBox.prototype._readString=function(a){for(var b="",c=0;c<a;c++){var d=this._readUint(8);b+=String.fromCharCode(d)}return b},ISOBox.prototype._readTemplate=function(a){return this._readUint(a/2)+this._readUint(a/2)/Math.pow(2,a/2)},ISOBox.prototype._readTerminatedString=function(){for(var a="";this._cursor.offset-this._offset<this._raw.byteLength;){var b=this._readUint(8);if(0===b)break;a+=String.fromCharCode(b)}return a},ISOBox.prototype._readData=function(a){var b=a>0?a:this._raw.byteLength-(this._cursor.offset-this._offset);if(b>0){var c=new Uint8Array(this._raw.buffer,this._cursor.offset,b);return this._cursor.offset+=b,c}return null},ISOBox.prototype._readUTF8String=function(){var a=this._raw.byteLength-(this._cursor.offset-this._offset),b=null;return a>0&&(b=new DataView(this._raw.buffer,this._cursor.offset,a),this._cursor.offset+=a),b?ISOBoxer.Utils.dataViewToString(b):b},ISOBox.prototype._parseBox=function(){if(this._parsing=!0,this._cursor.offset=this._offset,this._offset+8>this._raw.buffer.byteLength)return void(this._root._incomplete=!0);switch(this._procField("size","uint",32),this._procField("type","string",4),1===this.size&&this._procField("largesize","uint",64),"uuid"===this.type&&this._procFieldArray("usertype",16,"uint",8),this.size){case 0:this._raw=new DataView(this._raw.buffer,this._offset);break;case 1:this._offset+this.size>this._raw.buffer.byteLength?(this._incomplete=!0,this._root._incomplete=!0):this._raw=new DataView(this._raw.buffer,this._offset,this.largesize);break;default:this._offset+this.size>this._raw.buffer.byteLength?(this._incomplete=!0,this._root._incomplete=!0):this._raw=new DataView(this._raw.buffer,this._offset,this.size)}this._incomplete||(this._boxProcessors[this.type]&&this._boxProcessors[this.type].call(this),-1!==this._boxContainers.indexOf(this.type)?this._parseContainerBox():this._data=this._readData())},ISOBox.prototype._parseFullBox=function(){this.version=this._readUint(8),this.flags=this._readUint(24)},ISOBox.prototype._parseContainerBox=function(){for(this.boxes=[];this._cursor.offset-this._raw.byteOffset<this._raw.byteLength;)this.boxes.push(ISOBox.parse(this))},ISOBox.prototype.append=function(a,b){ISOBoxer.Utils.appendBox(this,a,b)},ISOBox.prototype.getLength=function(){if(this._parsing=!1,this._rawo=null,this.size=0,this._procField("size","uint",32),this._procField("type","string",4),1===this.size&&this._procField("largesize","uint",64),"uuid"===this.type&&this._procFieldArray("usertype",16,"uint",8),this._boxProcessors[this.type]&&this._boxProcessors[this.type].call(this),-1!==this._boxContainers.indexOf(this.type))for(var a=0;a<this.boxes.length;a++)this.size+=this.boxes[a].getLength();return this._data&&this._writeData(this._data),this.size},ISOBox.prototype.write=function(){switch(this._parsing=!1,this._cursor.offset=this._parent._cursor.offset,this.size){case 0:this._rawo=new DataView(this._parent._rawo.buffer,this._cursor.offset,this.parent._rawo.byteLength-this._cursor.offset);break;case 1:this._rawo=new DataView(this._parent._rawo.buffer,this._cursor.offset,this.largesize);break;default:this._rawo=new DataView(this._parent._rawo.buffer,this._cursor.offset,this.size)}if(this._procField("size","uint",32),this._procField("type","string",4),1===this.size&&this._procField("largesize","uint",64),"uuid"===this.type&&this._procFieldArray("usertype",16,"uint",8),this._boxProcessors[this.type]&&this._boxProcessors[this.type].call(this),-1!==this._boxContainers.indexOf(this.type))for(var a=0;a<this.boxes.length;a++)this.boxes[a].write();return this._data&&this._writeData(this._data),this._parent._cursor.offset+=this.size,this.size},ISOBox.prototype._writeInt=function(a,b){if(this._rawo){var c=this._cursor.offset-this._rawo.byteOffset;switch(a){case 8:this._rawo.setInt8(c,b);break;case 16:this._rawo.setInt16(c,b);break;case 32:this._rawo.setInt32(c,b);break;case 64:var d=Math.floor(b/Math.pow(2,32)),e=b-d*Math.pow(2,32);this._rawo.setUint32(c,d),this._rawo.setUint32(c+4,e)}this._cursor.offset+=a>>3}else this.size+=a>>3},ISOBox.prototype._writeUint=function(a,b){if(this._rawo){var c,d,e=this._cursor.offset-this._rawo.byteOffset;switch(a){case 8:this._rawo.setUint8(e,b);break;case 16:this._rawo.setUint16(e,b);break;case 24:c=(16776960&b)>>8,d=255&b,this._rawo.setUint16(e,c),this._rawo.setUint8(e+2,d);break;case 32:this._rawo.setUint32(e,b);break;case 64:c=Math.floor(b/Math.pow(2,32)),d=b-c*Math.pow(2,32),this._rawo.setUint32(e,c),this._rawo.setUint32(e+4,d)}this._cursor.offset+=a>>3}else this.size+=a>>3},ISOBox.prototype._writeString=function(a,b){for(var c=0;c<a;c++)this._writeUint(8,b.charCodeAt(c))},ISOBox.prototype._writeTerminatedString=function(a){if(0!==a.length){for(var b=0;b<a.length;b++)this._writeUint(8,a.charCodeAt(b));this._writeUint(8,0)}},ISOBox.prototype._writeTemplate=function(a,b){var c=Math.floor(b),d=(b-c)*Math.pow(2,a/2);this._writeUint(a/2,c),this._writeUint(a/2,d)},ISOBox.prototype._writeData=function(a){var b;if(a)if(this._rawo){if(a instanceof Array){for(var c=this._cursor.offset-this._rawo.byteOffset,b=0;b<a.length;b++)this._rawo.setInt8(c+b,a[b]);this._cursor.offset+=a.length}a instanceof Uint8Array&&(this._root.bytes.set(a,this._cursor.offset),this._cursor.offset+=a.length)}else this.size+=a.length},ISOBox.prototype._writeUTF8String=function(a){var b=ISOBoxer.Utils.utf8ToByteArray(a);if(this._rawo)for(var c=new DataView(this._rawo.buffer,this._cursor.offset,b.length),d=0;d<b.length;d++)c.setUint8(d,b[d]);else this.size+=b.length},ISOBox.prototype._writeField=function(a,b,c){switch(a){case"uint":this._writeUint(b,c);break;case"int":this._writeInt(b,c);break;case"template":this._writeTemplate(b,c);break;case"string":-1==b?this._writeTerminatedString(c):this._writeString(b,c);break;case"data":this._writeData(c);break;case"utf8":this._writeUTF8String(c)}},ISOBox.prototype._boxProcessors.avc1=ISOBox.prototype._boxProcessors.avc2=ISOBox.prototype._boxProcessors.avc3=ISOBox.prototype._boxProcessors.avc4=ISOBox.prototype._boxProcessors.hvc1=ISOBox.prototype._boxProcessors.hev1=ISOBox.prototype._boxProcessors.encv=function(){this._procFieldArray("reserved1",6,"uint",8),this._procField("data_reference_index","uint",16),this._procField("pre_defined1","uint",16),this._procField("reserved2","uint",16),this._procFieldArray("pre_defined2",3,"uint",32),this._procField("width","uint",16),this._procField("height","uint",16),this._procField("horizresolution","template",32),this._procField("vertresolution","template",32),this._procField("reserved3","uint",32),this._procField("frame_count","uint",16),this._procFieldArray("compressorname",32,"uint",8),this._procField("depth","uint",16),this._procField("pre_defined3","int",16),this._procField("config","data",-1)},ISOBox.prototype._boxProcessors.ctts=function(){this._procFullBox(),this._procField("entry_count","uint",32),this._procEntries("entries",this.entry_count,function(a){this._procEntryField(a,"sample_count","uint",32),this._procEntryField(a,"sample_offset",1===this.version?"int":"uint",32)})},ISOBox.prototype._boxProcessors.dref=function(){this._procFullBox(),this._procField("entry_count","uint",32),this._procSubBoxes("entries",this.entry_count)},ISOBox.prototype._boxProcessors.elst=function(){this._procFullBox(),this._procField("entry_count","uint",32),this._procEntries("entries",this.entry_count,function(a){this._procEntryField(a,"segment_duration","uint",1===this.version?64:32),this._procEntryField(a,"media_time","int",1===this.version?64:32),this._procEntryField(a,"media_rate_integer","int",16),this._procEntryField(a,"media_rate_fraction","int",16)})},ISOBox.prototype._boxProcessors.emsg=function(){this._procFullBox(),1==this.version?(this._procField("timescale","uint",32),this._procField("presentation_time","uint",64),this._procField("event_duration","uint",32),this._procField("id","uint",32),this._procField("scheme_id_uri","string",-1),this._procField("value","string",-1)):(this._procField("scheme_id_uri","string",-1),this._procField("value","string",-1),this._procField("timescale","uint",32),this._procField("presentation_time_delta","uint",32),this._procField("event_duration","uint",32),this._procField("id","uint",32)),this._procField("message_data","data",-1)},ISOBox.prototype._boxProcessors.free=ISOBox.prototype._boxProcessors.skip=function(){this._procField("data","data",-1)},ISOBox.prototype._boxProcessors.frma=function(){this._procField("data_format","uint",32)},ISOBox.prototype._boxProcessors.ftyp=ISOBox.prototype._boxProcessors.styp=function(){this._procField("major_brand","string",4),this._procField("minor_version","uint",32);var a=-1;this._parsing&&(a=(this._raw.byteLength-(this._cursor.offset-this._raw.byteOffset))/4),this._procFieldArray("compatible_brands",a,"string",4)},ISOBox.prototype._boxProcessors.hdlr=function(){this._procFullBox(),this._procField("pre_defined","uint",32),this._procField("handler_type","string",4),this._procFieldArray("reserved",3,"uint",32),this._procField("name","string",-1)},ISOBox.prototype._boxProcessors.mdat=function(){this._procField("data","data",-1)},ISOBox.prototype._boxProcessors.mdhd=function(){this._procFullBox(),this._procField("creation_time","uint",1==this.version?64:32),this._procField("modification_time","uint",1==this.version?64:32),this._procField("timescale","uint",32),this._procField("duration","uint",1==this.version?64:32),this._parsing||"string"!=typeof this.language||(this.language=this.language.charCodeAt(0)-96<<10|this.language.charCodeAt(1)-96<<5|this.language.charCodeAt(2)-96),this._procField("language","uint",16),this._parsing&&(this.language=String.fromCharCode(96+(this.language>>10&31),96+(this.language>>5&31),96+(31&this.language))),this._procField("pre_defined","uint",16)},ISOBox.prototype._boxProcessors.mehd=function(){this._procFullBox(),this._procField("fragment_duration","uint",1==this.version?64:32)},ISOBox.prototype._boxProcessors.mfhd=function(){this._procFullBox(),this._procField("sequence_number","uint",32)},ISOBox.prototype._boxProcessors.mfro=function(){this._procFullBox(),this._procField("mfra_size","uint",32)},ISOBox.prototype._boxProcessors.mp4a=ISOBox.prototype._boxProcessors.enca=function(){this._procFieldArray("reserved1",6,"uint",8),this._procField("data_reference_index","uint",16),this._procFieldArray("reserved2",2,"uint",32),this._procField("channelcount","uint",16),this._procField("samplesize","uint",16),this._procField("pre_defined","uint",16),this._procField("reserved3","uint",16),this._procField("samplerate","template",32),this._procField("esds","data",-1)},ISOBox.prototype._boxProcessors.mvhd=function(){this._procFullBox(),this._procField("creation_time","uint",1==this.version?64:32),this._procField("modification_time","uint",1==this.version?64:32),this._procField("timescale","uint",32),this._procField("duration","uint",1==this.version?64:32),this._procField("rate","template",32),this._procField("volume","template",16),this._procField("reserved1","uint",16),this._procFieldArray("reserved2",2,"uint",32),this._procFieldArray("matrix",9,"template",32),this._procFieldArray("pre_defined",6,"uint",32),this._procField("next_track_ID","uint",32)},ISOBox.prototype._boxProcessors.payl=function(){this._procField("cue_text","utf8")},ISOBox.prototype._boxProcessors.prft=function(){this._procFullBox(),this._procField("reference_track_ID","uint",32),this._procField("ntp_timestamp_sec","uint",32),this._procField("ntp_timestamp_frac","uint",32),this._procField("media_time","uint",1==this.version?64:32)},ISOBox.prototype._boxProcessors.pssh=function(){this._procFullBox(),this._procFieldArray("SystemID",16,"uint",8),this._procField("DataSize","uint",32),this._procFieldArray("Data",this.DataSize,"uint",8)},ISOBox.prototype._boxProcessors.schm=function(){this._procFullBox(),this._procField("scheme_type","uint",32),this._procField("scheme_version","uint",32),1&this.flags&&this._procField("scheme_uri","string",-1)},ISOBox.prototype._boxProcessors.sdtp=function(){this._procFullBox();var a=-1;this._parsing&&(a=this._raw.byteLength-(this._cursor.offset-this._raw.byteOffset)),this._procFieldArray("sample_dependency_table",a,"uint",8)},ISOBox.prototype._boxProcessors.sidx=function(){this._procFullBox(),this._procField("reference_ID","uint",32),this._procField("timescale","uint",32),this._procField("earliest_presentation_time","uint",1==this.version?64:32),this._procField("first_offset","uint",1==this.version?64:32),this._procField("reserved","uint",16),this._procField("reference_count","uint",16),this._procEntries("references",this.reference_count,function(a){this._parsing||(a.reference=(1&a.reference_type)<<31,a.reference|=2147483647&a.referenced_size,a.sap=(1&a.starts_with_SAP)<<31,a.sap|=(3&a.SAP_type)<<28,a.sap|=268435455&a.SAP_delta_time),this._procEntryField(a,"reference","uint",32),this._procEntryField(a,"subsegment_duration","uint",32),this._procEntryField(a,"sap","uint",32),this._parsing&&(a.reference_type=a.reference>>31&1,a.referenced_size=2147483647&a.reference,a.starts_with_SAP=a.sap>>31&1,a.SAP_type=a.sap>>28&7,a.SAP_delta_time=268435455&a.sap)})},ISOBox.prototype._boxProcessors.smhd=function(){this._procFullBox(),this._procField("balance","uint",16),this._procField("reserved","uint",16)},ISOBox.prototype._boxProcessors.ssix=function(){this._procFullBox(),this._procField("subsegment_count","uint",32),this._procEntries("subsegments",this.subsegment_count,function(a){this._procEntryField(a,"ranges_count","uint",32),this._procSubEntries(a,"ranges",a.ranges_count,function(a){this._procEntryField(a,"level","uint",8),this._procEntryField(a,"range_size","uint",24)})})},ISOBox.prototype._boxProcessors.stsd=function(){this._procFullBox(),this._procField("entry_count","uint",32),this._procSubBoxes("entries",this.entry_count)},ISOBox.prototype._boxProcessors.stts=function(){this._procFullBox(),this._procField("entry_count","uint",32),this._procEntries("entries",this.entry_count,function(a){this._procEntryField(a,"sample_count","uint",32),this._procEntryField(a,"sample_delta","uint",32)})},ISOBox.prototype._boxProcessors.subs=function(){this._procFullBox(),this._procField("entry_count","uint",32),this._procEntries("entries",this.entry_count,function(a){this._procEntryField(a,"sample_delta","uint",32),this._procEntryField(a,"subsample_count","uint",16),this._procSubEntries(a,"subsamples",a.subsample_count,function(a){this._procEntryField(a,"subsample_size","uint",1===this.version?32:16),this._procEntryField(a,"subsample_priority","uint",8),this._procEntryField(a,"discardable","uint",8),this._procEntryField(a,"codec_specific_parameters","uint",32)})})},ISOBox.prototype._boxProcessors.tenc=function(){this._procFullBox(),this._procField("default_IsEncrypted","uint",24),this._procField("default_IV_size","uint",8),this._procFieldArray("default_KID",16,"uint",8)},ISOBox.prototype._boxProcessors.tfdt=function(){this._procFullBox(),this._procField("baseMediaDecodeTime","uint",1==this.version?64:32)},ISOBox.prototype._boxProcessors.tfhd=function(){this._procFullBox(),this._procField("track_ID","uint",32),1&this.flags&&this._procField("base_data_offset","uint",64),2&this.flags&&this._procField("sample_description_offset","uint",32),8&this.flags&&this._procField("default_sample_duration","uint",32),16&this.flags&&this._procField("default_sample_size","uint",32),32&this.flags&&this._procField("default_sample_flags","uint",32)},ISOBox.prototype._boxProcessors.tfra=function(){this._procFullBox(),this._procField("track_ID","uint",32),this._parsing||(this.reserved=0,this.reserved|=(48&this.length_size_of_traf_num)<<4,this.reserved|=(12&this.length_size_of_trun_num)<<2,this.reserved|=3&this.length_size_of_sample_num),this._procField("reserved","uint",32),this._parsing&&(this.length_size_of_traf_num=(48&this.reserved)>>4,this.length_size_of_trun_num=(12&this.reserved)>>2,this.length_size_of_sample_num=3&this.reserved),this._procField("number_of_entry","uint",32),this._procEntries("entries",this.number_of_entry,function(a){this._procEntryField(a,"time","uint",1===this.version?64:32),this._procEntryField(a,"moof_offset","uint",1===this.version?64:32),this._procEntryField(a,"traf_number","uint",8*(this.length_size_of_traf_num+1)),this._procEntryField(a,"trun_number","uint",8*(this.length_size_of_trun_num+1)),this._procEntryField(a,"sample_number","uint",8*(this.length_size_of_sample_num+1))})},ISOBox.prototype._boxProcessors.tkhd=function(){this._procFullBox(),this._procField("creation_time","uint",1==this.version?64:32),this._procField("modification_time","uint",1==this.version?64:32),this._procField("track_ID","uint",32),this._procField("reserved1","uint",32),this._procField("duration","uint",1==this.version?64:32),this._procFieldArray("reserved2",2,"uint",32),this._procField("layer","uint",16),this._procField("alternate_group","uint",16),this._procField("volume","template",16),this._procField("reserved3","uint",16),this._procFieldArray("matrix",9,"template",32),this._procField("width","template",32),this._procField("height","template",32)},ISOBox.prototype._boxProcessors.trex=function(){this._procFullBox(),this._procField("track_ID","uint",32),this._procField("default_sample_description_index","uint",32),this._procField("default_sample_duration","uint",32),this._procField("default_sample_size","uint",32),this._procField("default_sample_flags","uint",32)},ISOBox.prototype._boxProcessors.trun=function(){this._procFullBox(),this._procField("sample_count","uint",32),1&this.flags&&this._procField("data_offset","int",32),4&this.flags&&this._procField("first_sample_flags","uint",32),this._procEntries("samples",this.sample_count,function(a){256&this.flags&&this._procEntryField(a,"sample_duration","uint",32),512&this.flags&&this._procEntryField(a,"sample_size","uint",32),1024&this.flags&&this._procEntryField(a,"sample_flags","uint",32),2048&this.flags&&this._procEntryField(a,"sample_composition_time_offset",1===this.version?"int":"uint",32)})},ISOBox.prototype._boxProcessors["url "]=ISOBox.prototype._boxProcessors["urn "]=function(){this._procFullBox(),"urn "===this.type&&this._procField("name","string",-1),this._procField("location","string",-1)},ISOBox.prototype._boxProcessors.vlab=function(){this._procField("source_label","utf8")},ISOBox.prototype._boxProcessors.vmhd=function(){this._procFullBox(),this._procField("graphicsmode","uint",16),this._procFieldArray("opcolor",3,"uint",16)},ISOBox.prototype._boxProcessors.vttC=function(){this._procField("config","utf8")},ISOBox.prototype._boxProcessors.vtte=function(){};
{
"name": "codem-isoboxer",
"version": "0.3.7",
"version": "0.3.8",
"description": "A lightweight JavaScript MP4 (MPEG-4, ISOBMFF) file/box parser.",
"keywords": [
"mp4", "mpeg-4", "mpeg4", "isobmff", "parser"
"mp4",
"mpeg-4",
"mpeg4",
"isobmff",
"parser"
],

@@ -24,2 +28,3 @@ "homepage": "https://github.com/madebyhiro/codem-isoboxer",

"devDependencies": {
"arraybuffer-equal": "^1.0.4",
"grunt": "^1.0.1",

@@ -30,4 +35,3 @@ "grunt-contrib-concat": "^1.0.1",

"grunt-preprocess": "^5.1.0",
"jasmine-node": "^1.14.5",
"arraybuffer-equal": "^1.0.4",
"jasmine-node": "^1.16.0",
"jshint": "^2.9.4"

@@ -38,5 +42,9 @@ },

"jshint": "jshint src/*.js src/**/*.js",
"grunt": "grunt",
"build": "grunt",
"watch": "grunt watch"
}
}
},
"files": [
"dist",
"CHANGELOG.md"
]
}
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