import { ITokenizer } from 'strtok3/lib/core' ; import * as initDebug from 'debug' ; import { IOptions } from '../../type' ; import { INativeMetadataCollector } from '../../common/MetadataCollector' ; import * as Ogg from '../Ogg' ; import { IdentificationHeader } from './Theora' ; const debug = initDebug ( 'music-metadata:parser:ogg:theora' ) ; /**
 * Ref:
 *   https://theora.org/doc/Theora.pdf
 */ export class TheoraParser implements Ogg . IPageConsumer { constructor ( private metadata , options , private tokenizer ) { } param header param pageData public parsePage ( header , pageData ) { if ( header . headerType . firstPage ) { this . parseFirstPage ( header , pageData ) ; } } public flush ( ) { debug ( 'flush' ) ; } public calculateDuration ( header ) { debug ( 'duration calculation not implemented' ) ; } param { IPageHeader } header param { Buffer } pageData protected 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 ) ; } }