import { Tube } from '../component' ; import { Transform } from 'stream' ; import { Message , MessageType } from '../message' ; import { Parser } from './parser' ; extends Component export class Mp4Parser extends Tube { /**
     * Create a new RTSP parser component.
     */ constructor ( ) { const parser = new Parser ( ) ; const incoming = new Transform ( { objectMode : true , transform : function ( msg , _ , callback ) { if ( msg . type === MessageType . RAW ) { parser . parse ( msg . data ) . forEach ( ( message ) => incoming . push ( message ) ) ; callback ( ) ; } else { callback ( undefined , msg ) ; } } , } ) ; super ( incoming ) ; } }