Comparing version 2.1.0 to 2.2.0
@@ -25,3 +25,3 @@ var Transform = require('stream').Transform, | ||
if(chunk[0] === 'start') { | ||
this.startTag(chunk[1].name); | ||
this.startTag(chunk[1].name, chunk[1]); | ||
} else if(chunk[0] === 'tag') { | ||
@@ -81,4 +81,4 @@ this.writeTag(chunk[1].name, chunk[1].data); | ||
EbmlEncoder.prototype._encodeTag = function(tagId, tagData) { | ||
return Buffers([tagId, tools.writeVint(tagData.length), tagData]); | ||
EbmlEncoder.prototype._encodeTag = function(tagId, tagData, end) { | ||
return Buffers([tagId, end === -1 ? Buffer('01ffffffffffffff', 'hex') : tools.writeVint(tagData.length), tagData]); | ||
}; | ||
@@ -102,3 +102,3 @@ | ||
EbmlEncoder.prototype.startTag = function(tagName) { | ||
EbmlEncoder.prototype.startTag = function(tagName, info) { | ||
var tagId = this.getSchemaInfo(tagName); | ||
@@ -112,2 +112,3 @@ if (!tagId) { | ||
name: tagName, | ||
end: info.end, | ||
children: [] | ||
@@ -128,3 +129,3 @@ }; | ||
}); | ||
tag.data = this._encodeTag(tag.id, Buffers(childTagDataBuffers)); | ||
tag.data = this._encodeTag(tag.id, Buffers(childTagDataBuffers), tag.end); | ||
@@ -131,0 +132,0 @@ if (this._stack.length < 1) { |
{ | ||
"name": "ebml", | ||
"version": "2.1.0", | ||
"version": "2.2.0", | ||
"description": "ebml parser", | ||
@@ -14,5 +14,11 @@ "main": "index.js", | ||
"type": "git", | ||
"url": "git://github.com/themasch/node-ebml" | ||
"url": "git://github.com/themasch/node-ebml.git" | ||
}, | ||
"keywords": ["ebml", "webm", "mkv", "matroska", "format"], | ||
"keywords": [ | ||
"ebml", | ||
"webm", | ||
"mkv", | ||
"matroska", | ||
"format" | ||
], | ||
"dependencies": { | ||
@@ -32,26 +38,17 @@ "buffers": "^0.1.1", | ||
}, | ||
"author": "Mark Schmale <masch@masch.it>", | ||
"contributors": [{ | ||
"name": "Chris Price", | ||
"email": "price.c@gmail.com" | ||
}, { | ||
"name": "Manuel Wiedenmann", | ||
"email": "manuel@funkensturm.de" | ||
}, { | ||
"name": "Ed Markowski", | ||
"email": "siphon@protonmail.com" | ||
}, { | ||
"name": "Davy Van Deursen", | ||
"email": "d.vandeursen@evs.com" | ||
}, { | ||
"name": "Max Ogden", | ||
"email": "max@maxogden.com" | ||
}, { | ||
"name": "Oliver Walzer", | ||
"email": "walzer@incuray.com" | ||
}], | ||
"contributors": [ | ||
"Chris Price <price.c@gmail.com>", | ||
"Davy Van Deursen <d.vandeursen@evs.com>", | ||
"Ed Markowski <siphon@protonmail.com>", | ||
"Manuel Wiedenmann <manuel@funkensturm.de>", | ||
"Mathias Buus <mathiasbuus@gmail.com>", | ||
"Max Ogden <max@maxogden.com>", | ||
"Oliver Walzer <walzer@incuray.com>" | ||
], | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/themasch/node-ebml/issues" | ||
} | ||
}, | ||
"homepage": "https://github.com/themasch/node-ebml#readme", | ||
"author": "Mark Schmale <masch@masch.it>" | ||
} |
@@ -15,4 +15,19 @@ # EBML [![Build Status](https://travis-ci.org/themasch/node-ebml.png?branch=master)](https://travis-ci.org/themasch/node-ebml) [![NPM](https://nodei.co/npm/ebml.png?compact=true)](https://www.npmjs.com/package/ebml) | ||
TBD. (meanwhile see example.js) | ||
``` | ||
var ebml = require('./index.js'); | ||
var fs = require('fs'); | ||
var decoder = new ebml.Decoder(); | ||
decoder.on('data', function(chunk) { | ||
console.log(chunk); | ||
}); | ||
fs.readFile('media/test.webm', function(err, data) { | ||
if (err) | ||
throw err; | ||
decoder.write(data); | ||
}); | ||
``` | ||
# state of this project | ||
@@ -22,2 +37,4 @@ | ||
Thanks to @chrisprice we got an encoder! | ||
# license | ||
@@ -36,3 +53,4 @@ | ||
* [Mark Schmale](https://github.com/themasch) | ||
* [Mathias Buus](https://github.com/mafintosh) | ||
* [Max Ogden](https://github.com/maxogden) | ||
* [Oliver Walzer](https://github.com/owcd) |
@@ -17,3 +17,18 @@ var ebml = require('../lib/ebml/index.js'), | ||
}); | ||
it('should support end === -1', function (done) { | ||
var decoder = new ebml.Decoder(); | ||
var encoder = new ebml.Encoder(); | ||
encoder.write(['start', {name: 'Cluster', start: 0, end: -1}]); | ||
encoder.write(['end', {name: 'Cluster', start: 0, end: -1}]); | ||
encoder.pipe(decoder).on('data', function (data) { | ||
assert.equal(data[1].name, 'Cluster'); | ||
assert.equal(data[1].start, 0); | ||
assert.equal(data[1].end, -1); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
}); |
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
314579
2700
0
54