Skip to content

Commit

Permalink
Fix endianness in Vorbis Identification header decoder
Browse files Browse the repository at this point in the history
Remove unused import
  • Loading branch information
Borewit committed Jun 30, 2024
1 parent d53dd84 commit c1ee297
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
1 change: 0 additions & 1 deletion lib/ParserFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { fileTypeFromBuffer } from 'file-type';
import ContentType from 'content-type';
import MimeType from 'media-typer';
import initDebug from 'debug';
import { Buffer } from 'node:buffer';

import { INativeMetadataCollector, MetadataCollector } from './common/MetadataCollector.js';
import { AIFFParser } from './aiff/AiffParser.js';
Expand Down
13 changes: 6 additions & 7 deletions lib/ogg/vorbis/Vorbis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,14 +132,13 @@ export const IdentificationHeader: IGetToken<IFormatInfo> = {
len: 23,

get: (uint8Array, off): IFormatInfo => {
const dataView = new DataView(uint8Array.buffer, uint8Array.byteOffset);
return {
version: dataView.getUint32(off + 0, true),
channelMode: dataView.getUint8(off + 4),
sampleRate: dataView.getUint32(off + 5, true),
bitrateMax: dataView.getUint32(off + 9, true),
bitrateNominal: dataView.getUint32(off + 13, true),
bitrateMin: dataView.getUint32(off + 17, true)
version: Token.UINT32_LE.get(uint8Array, off + 0),
channelMode: Token.UINT8.get(uint8Array, off + 4),
sampleRate: Token.UINT32_LE.get(uint8Array, off + 5),
bitrateMax: Token.UINT32_LE.get(uint8Array, off + 9),
bitrateNominal: Token.UINT32_LE.get(uint8Array, off + 13),
bitrateMin: Token.UINT32_LE.get(uint8Array, off + 17)
};
}
};

0 comments on commit c1ee297

Please sign in to comment.