moving pes data to container object so we don't polute our new frame objects
Showing
1 changed file
with
13 additions
and
10 deletions
... | @@ -282,12 +282,15 @@ ProgramStream = function() { | ... | @@ -282,12 +282,15 @@ ProgramStream = function() { |
282 | i = 0, | 282 | i = 0, |
283 | fragment; | 283 | fragment; |
284 | 284 | ||
285 | // move over data from PES into Stream frame | 285 | if ( pes !== undefined) { |
286 | event.pts = pes.pts; | 286 | // move over data from PES into Stream frame |
287 | event.dts = pes.dts; | 287 | event.pes = {}; |
288 | event.pid = pes.pid; | 288 | event.pes.pts = pes.pts; |
289 | event.dataAlignmentIndicator = pes.dataAlignmentIndicator; | 289 | event.pes.dts = pes.dts; |
290 | event.payloadUnitStartIndicator = pes.payloadUnitStartIndicator | 290 | event.pes.pid = pes.pid; |
291 | event.pes.dataAlignmentIndicator = pes.dataAlignmentIndicator; | ||
292 | event.pes.payloadUnitStartIndicator = pes.payloadUnitStartIndicator | ||
293 | } | ||
291 | 294 | ||
292 | // do nothing if there is no buffered data | 295 | // do nothing if there is no buffered data |
293 | if (!stream.data.length) { | 296 | if (!stream.data.length) { |
... | @@ -376,7 +379,6 @@ ProgramStream = function() { | ... | @@ -376,7 +379,6 @@ ProgramStream = function() { |
376 | * will flush the buffered packets. | 379 | * will flush the buffered packets. |
377 | */ | 380 | */ |
378 | this.end = function() { | 381 | this.end = function() { |
379 | debugger | ||
380 | flushStream(video, 'video'); | 382 | flushStream(video, 'video'); |
381 | flushStream(audio, 'audio'); | 383 | flushStream(audio, 'audio'); |
382 | }; | 384 | }; |
... | @@ -394,7 +396,6 @@ AacStream = function() { | ... | @@ -394,7 +396,6 @@ AacStream = function() { |
394 | 396 | ||
395 | this.push = function(packet) { | 397 | this.push = function(packet) { |
396 | if (packet.type == "audio") { | 398 | if (packet.type == "audio") { |
397 | console.log('AAC Stream Push!'); | ||
398 | this.trigger('data', packet); | 399 | this.trigger('data', packet); |
399 | } | 400 | } |
400 | }; | 401 | }; |
... | @@ -412,7 +413,6 @@ H264Stream = function() { | ... | @@ -412,7 +413,6 @@ H264Stream = function() { |
412 | 413 | ||
413 | this.push = function(packet) { | 414 | this.push = function(packet) { |
414 | if (packet.type == "video") { | 415 | if (packet.type == "video") { |
415 | console.log('h264 Stream Push!'); | ||
416 | this.trigger('data', packet); | 416 | this.trigger('data', packet); |
417 | } | 417 | } |
418 | }; | 418 | }; |
... | @@ -434,6 +434,7 @@ Transmuxer = function() { | ... | @@ -434,6 +434,7 @@ Transmuxer = function() { |
434 | packetStream.pipe(parseStream); | 434 | packetStream.pipe(parseStream); |
435 | parseStream.pipe(programStream); | 435 | parseStream.pipe(programStream); |
436 | programStream.pipe(aacStream); | 436 | programStream.pipe(aacStream); |
437 | programStream.pipe(h264Stream); | ||
437 | 438 | ||
438 | // generate an init segment | 439 | // generate an init segment |
439 | this.initSegment = mp4.initSegment(); | 440 | this.initSegment = mp4.initSegment(); |
... | @@ -441,7 +442,9 @@ Transmuxer = function() { | ... | @@ -441,7 +442,9 @@ Transmuxer = function() { |
441 | aacStream.on('data', function(data) { | 442 | aacStream.on('data', function(data) { |
442 | self.trigger('data', data); | 443 | self.trigger('data', data); |
443 | }); | 444 | }); |
444 | 445 | h264Stream.on('data', function(data) { | |
446 | self.trigger('data', data); | ||
447 | }); | ||
445 | // feed incoming data to the front of the parsing pipeline | 448 | // feed incoming data to the front of the parsing pipeline |
446 | this.push = function(data) { | 449 | this.push = function(data) { |
447 | packetStream.push(data); | 450 | packetStream.push(data); | ... | ... |
-
Please register or sign in to post a comment