lib/flv/coalesce-stream.js
function(options) {
  // Number of Tracks per output segment
  // If greater than 1, we combine multiple
  // tracks into a single segment
  this.numberOfTracks = 0;
  this.metadataStream = options.metadataStream;

  this.videoTags = [];
  this.audioTags = [];
  this.videoTrack = null;
  this.audioTrack = null;
  this.pendingCaptions = [];
  this.pendingMetadata = [];
  this.pendingTracks = 0;
  this.processedTracks = 0;

  CoalesceStream.prototype.init.call(this);

  // Take output from multiple
  this.push = function(output) {
    // buffer incoming captions until the associated video segment
    // finishes
    if (output.text) {
      return this.pendingCaptions.push(output);
    }
    // buffer incoming id3 tags until the final flush
    if (output.frames) {
      return this.pendingMetadata.push(output);
    }

    if (output.track.type === 'video') {
      this.videoTrack = output.track;
      this.videoTags = output.tags;
      this.pendingTracks++;
    }
    if (output.track.type === 'audio') {
      this.audioTrack = output.track;
      this.audioTags = output.tags;
      this.pendingTracks++;
    }
  };
}
function(options) {
  // Number of Tracks per output segment
  // If greater than 1, we combine multiple
  // tracks into a single segment
  this.numberOfTracks = 0;
  this.metadataStream = options.metadataStream;

  this.videoTags = [];
  this.audioTags = [];
  this.videoTrack = null;
  this.audioTrack = null;
  this.pendingCaptions = [];
  this.pendingMetadata = [];
  this.pendingTracks = 0;
  this.processedTracks = 0;

  CoalesceStream.prototype.init.call(this);

  // Take output from multiple
  this.push = function(output) {
    // buffer incoming captions until the associated video segment
    // finishes
    if (output.text) {
      return this.pendingCaptions.push(output);
    }
    // buffer incoming id3 tags until the final flush
    if (output.frames) {
      return this.pendingMetadata.push(output);
    }

    if (output.track.type === 'video') {
      this.videoTrack = output.track;
      this.videoTags = output.tags;
      this.pendingTracks++;
    }
    if (output.track.type === 'audio') {
      this.audioTrack = output.track;
      this.audioTags = output.tags;
      this.pendingTracks++;
    }
  };
}
function ( options ) { // Number of Tracks per output segment // If greater than 1, we combine multiple // tracks into a single segment this . numberOfTracks = 0 ; this . metadataStream = options . metadataStream ; this . videoTags = [ ] ; this . audioTags = [ ] ; this . videoTrack = null ; this . audioTrack = null ; this . pendingCaptions = [ ] ; this . pendingMetadata = [ ] ; this . pendingTracks = 0 ; this . processedTracks = 0 ; CoalesceStream . prototype . init . call ( this ) ; // Take output from multiple this . push = function ( output ) { // buffer incoming captions until the associated video segment // finishes if ( output . text ) { return this . pendingCaptions . push ( output ) ; } // buffer incoming id3 tags until the final flush if ( output . frames ) { return this . pendingMetadata . push ( output ) ; } if ( output . track . type === 'video' ) { this . videoTrack = output . track ; this . videoTags = output . tags ; this . pendingTracks ++ ; } if ( output . track . type === 'audio' ) { this . audioTrack = output . track ; this . audioTags = output . tags ; this . pendingTracks ++ ; } } ; }
The final stage of the transmuxer that emits the flv tags
for audio, video, and metadata. Also tranlates in time and
outputs caption data and id3 cues.
The final stage of the transmuxer that emits the flv tags for audio video and metadata . Also tranlates in time and outputs caption data and id3 cues .