diff --git a/src/descriptor.js b/src/descriptor.js index a8d8b13e..db5cb0a3 100644 --- a/src/descriptor.js +++ b/src/descriptor.js @@ -160,6 +160,13 @@ var MPEG4DescriptorParser = function () { return this; } +var MPEG4DescriptorWriter = function (descriptor) { + this.writeOneDescriptor = function (stream) { + // TODO: implement + } +} + if (typeof exports !== 'undefined') { exports.MPEG4DescriptorParser = MPEG4DescriptorParser; + exports.MPEG4DescriptorWriter = MPEG4DescriptorWriter; } diff --git a/src/parsing/esds.js b/src/parsing/esds.js index 966a7566..8987e092 100644 --- a/src/parsing/esds.js +++ b/src/parsing/esds.js @@ -1,5 +1,5 @@ -BoxParser.createFullBoxCtor("esds", function(stream) { - var esd_data = stream.readUint8Array(this.size-this.hdr_size); +BoxParser.createFullBoxCtor("esds", function (stream) { + var esd_data = stream.readUint8Array(this.size - this.hdr_size); if (typeof MPEG4DescriptorParser !== "undefined") { var esd_parser = new MPEG4DescriptorParser(); this.esd = esd_parser.parseOneDescriptor(new DataStream(esd_data.buffer, 0, DataStream.BIG_ENDIAN)); diff --git a/src/writing/esds.js b/src/writing/esds.js new file mode 100644 index 00000000..694a8b5e --- /dev/null +++ b/src/writing/esds.js @@ -0,0 +1,10 @@ +BoxParser.esdsBox.prototype.write = function(stream) { + this.version = 0; + this.flags = 0; + this.size = this.esd.size; + this.writeHeader(stream); + if (typeof MPEG4DescriptorWriter !== "undefined") { + var esd_writer = new MPEG4DescriptorWriter(this.esd); + esd_writer.writeOneDescriptor(stream); + } +} \ No newline at end of file