UNPKG

mp4box

Version:

JavaScript version of GPAC's MP4Box tool

38 lines (36 loc) 1.07 kB
BoxParser.tfhdBox.prototype.write = function(stream) { this.version = 0; this.size = 4; if (this.flags & BoxParser.TFHD_FLAG_BASE_DATA_OFFSET) { this.size += 8; } if (this.flags & BoxParser.TFHD_FLAG_SAMPLE_DESC) { this.size += 4; } if (this.flags & BoxParser.TFHD_FLAG_SAMPLE_DUR) { this.size += 4; } if (this.flags & BoxParser.TFHD_FLAG_SAMPLE_SIZE) { this.size += 4; } if (this.flags & BoxParser.TFHD_FLAG_SAMPLE_FLAGS) { this.size += 4; } this.writeHeader(stream); stream.writeUint32(this.track_id); if (this.flags & BoxParser.TFHD_FLAG_BASE_DATA_OFFSET) { stream.writeUint64(this.base_data_offset); } if (this.flags & BoxParser.TFHD_FLAG_SAMPLE_DESC) { stream.writeUint32(this.default_sample_description_index); } if (this.flags & BoxParser.TFHD_FLAG_SAMPLE_DUR) { stream.writeUint32(this.default_sample_duration); } if (this.flags & BoxParser.TFHD_FLAG_SAMPLE_SIZE) { stream.writeUint32(this.default_sample_size); } if (this.flags & BoxParser.TFHD_FLAG_SAMPLE_FLAGS) { stream.writeUint32(this.default_sample_flags); } }