media-stream-library
Version:
Media stream library for Node & the Web.
38 lines (37 loc) • 1.15 kB
TypeScript
import { IsomMessage } from '../message';
/**
* Parser class with a public method that takes a data chunk and returns the
* next box, or null of there is no complete box. The parser keeps track of the
* added chunks internally in an array and only concatenates chunks when data is
* needed to construct a message.
* @type {[type]}
*/
export declare class Parser {
private _chunks;
private _length;
private _box?;
private _ftyp?;
/**
* Create a new Parser object.
*/
constructor();
/**
* Initialize the internal properties to their default starting
* values.
*/
_init(): void;
_push(chunk: Buffer): void;
/**
* Extract MP4 boxes.
* @return {Array} An array of messages, possibly empty.
*/
_parseBox(): Buffer | null;
/**
* Add the next chunk of data to the parser and extract messages.
* If no message can be extracted, an empty array is returned, otherwise
* an array of messages is returned.
* @param chunk - The next piece of data.
* @return An array of messages, possibly empty.
*/
parse(chunk: Buffer): IsomMessage[];
}