UNPKG

music-metadata

Version:

Music metadata parser for Node.js, supporting virtual any audio and tag format.

41 lines 1.23 kB
import initDebug from 'debug'; import { IdentificationHeader } from './Theora.js'; const debug = initDebug('music-metadata:parser:ogg:theora'); /** * Ref: * - https://theora.org/doc/Theora.pdf */ export class TheoraParser { constructor(metadata, options, tokenizer) { this.metadata = metadata; this.tokenizer = tokenizer; } /** * Vorbis 1 parser * @param header Ogg Page Header * @param pageData Page data */ async parsePage(header, pageData) { if (header.headerType.firstPage) { await this.parseFirstPage(header, pageData); } } async flush() { debug('flush'); } calculateDuration(header) { debug('duration calculation not implemented'); } /** * Parse first Theora Ogg page. the initial identification header packet * @param {IPageHeader} header * @param {Buffer} pageData */ async parseFirstPage(header, pageData) { debug('First Ogg/Theora page'); this.metadata.setFormat('codec', 'Theora'); const idHeader = IdentificationHeader.get(pageData, 0); this.metadata.setFormat('bitrate', idHeader.nombr); } } //# sourceMappingURL=TheoraParser.js.map