Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

fix to compatible with new Stream2 with .push() #5

Open
wants to merge 1 commit into from

2 participants

@arunoda

Fix to support .push() in .transform().

@arunoda

hmm. Seems like a failure in v0.9.12.

Let me see how this works in 0.10.x

@arunoda

Tests passed in 0.8.x and 0.10.x

@andrewrk

This PR is outdated but the fix it outlines still works. If I fix it up will you merge @TooTallNate ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 9 additions and 8 deletions.
  1. +3 −2 lib/decoder.js
  2. +5 −5 lib/encoder.js
  3. +1 −1  package.json
View
5 lib/decoder.js
@@ -67,6 +67,7 @@ Decoder.prototype.packetin = Decoder.prototype.write;
Decoder.prototype._transform = function (packet, output, fn) {
debug('_transform()');
+ var self = this;
var r;
if (this._headerCount > 0) {
debug('headerin', this._headerCount);
@@ -125,14 +126,14 @@ Decoder.prototype._transform = function (packet, output, fn) {
var b = binding.vorbis_synthesis_pcmout(vd, channels);
if (0 === b) {
debug('need more "vorbis_block" data...');
- if (eos) output(null); // emit "end"
+ if (eos) self.push(null); // emit "end"
fn();
} else if (b < 0) {
// some other error...
fn(new Error('vorbis_synthesis_pcmout() failed: ' + b));
} else {
debug('got PCM data (%d bytes)', b.length);
- output(b);
+ self.push(b);
// try to get more data out
pcmout();
View
10 lib/encoder.js
@@ -166,12 +166,12 @@ Encoder.prototype._writeHeader = function (output, fn) {
op_comments.replace();
op_code.replace();
- output(op_header); // automatically gets placed in its own `ogg_page`
- output(op_comments);
+ this.push(op_header); // automatically gets placed in its own `ogg_page`
+ this.push(op_comments);
// specify that a page flush() call is required after this 3rd packet
op_code.flush = true;
- output(op_code);
+ this.push(op_code);
// don't call this function again
this._headerWritten = true;
@@ -274,7 +274,7 @@ Encoder.prototype._flushpacket = function (output, fn) {
// got a packet, output it
// the consumer should call `pageout()` after this packet
packet.pageout = true;
- output(packet);
+ self.push(packet);
// attempt to get another `ogg_packet`...
self._flushpacket(output, fn);
@@ -395,4 +395,4 @@ Encoder.prototype._pipe = function (source) {
debug('_pipe()');
this._format(source);
source.once('format', this._format.bind(this));
-};
+};
View
2  package.json
@@ -20,7 +20,7 @@
"bindings": "*",
"debug": "*",
"ogg": "*",
- "readable-stream": "0"
+ "readable-stream": "1.0.x"
},
"devDependencies": {
"mocha": "*"
Something went wrong with that request. Please try again.