From fd193408fc8f3aa19bcdd19410f1e55746a50433 Mon Sep 17 00:00:00 2001 From: James Almer Date: Wed, 10 Jul 2024 19:43:50 -0300 Subject: [PATCH] add support for lhvC box Defined in clause 9.4.3 of ISO/IEC 14496-15:2022 --- src/parsing/lhvC.js | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/parsing/lhvC.js diff --git a/src/parsing/lhvC.js b/src/parsing/lhvC.js new file mode 100644 index 00000000..4df3253f --- /dev/null +++ b/src/parsing/lhvC.js @@ -0,0 +1,29 @@ +BoxParser.createBoxCtor("lhvC", function(stream) { + var i, j; + var tmp_byte; + this.configurationVersion = stream.readUint8(); + this.min_spatial_segmentation_idc = stream.readUint16() & 0xFFF; + this.parallelismType = (stream.readUint8() & 0x3); + tmp_byte = stream.readUint8(); + this.numTemporalLayers = (tmp_byte & 0XD) >> 3; + this.temporalIdNested = (tmp_byte & 0X4) >> 2; + this.lengthSizeMinusOne = (tmp_byte & 0X3); + + this.nalu_arrays = []; + var numOfArrays = stream.readUint8(); + for (i = 0; i < numOfArrays; i++) { + var nalu_array = []; + this.nalu_arrays.push(nalu_array); + tmp_byte = stream.readUint8() + nalu_array.completeness = (tmp_byte & 0x80) >> 7; + nalu_array.nalu_type = tmp_byte & 0x3F; + var numNalus = stream.readUint16(); + for (j = 0; j < numNalus; j++) { + var nalu = {} + nalu_array.push(nalu); + var length = stream.readUint16(); + nalu.data = stream.readUint8Array(length); + } + } +}); +