Added WAV extractor.

This commit is contained in:
n1073645 2019-11-08 14:56:54 +00:00
parent f3864b00fe
commit a4772941a7
1 changed files with 17 additions and 1 deletions

View File

@ -736,7 +736,7 @@ export const FILE_SIGNATURES = {
10: 0x56,
11: 0x45
},
extractor: null
extractor: extractWAV
},
{
name: "OGG audio",
@ -2642,6 +2642,22 @@ export function extractBMP(bytes, offset) {
return stream.carve();
}
/**
* WAV extractor.
*
* @param {Uint8Array} bytes
* @param {Number} offset
* @returns {Uint8Array}
*/
export function extractWAV(bytes, offset) {
const stream = new Stream(bytes.slice(offset));
stream.moveTo(4);
// Move to file size.
stream.moveTo(stream.readInt(4, "le")-4);
return stream.carve();
}
/**
* FLV extractor.