tools: Add support of reading WAV file with metadata

This commit is contained in:
Antoine Soulier
2023-11-08 15:26:33 -08:00
parent 7552605dd0
commit 59cfa05274
+5 -3
View File
@@ -112,9 +112,11 @@ int wave_read_header(FILE *fp, int *bitdepth, int *samplesize,
fseek(fp, sizeof(format) - (8 + format.size), SEEK_CUR);
if (fread(&data, sizeof(data), 1, fp) != 1
|| data.id != WAVE_DATA_ID)
return -1;
for ( ; fread(&data, sizeof(data), 1, fp) == 1 && data.id != WAVE_DATA_ID
; fseek(fp, data.size, SEEK_CUR) );
if (feof(fp))
return -1;
*bitdepth = format.bitdepth;
*samplesize = format.framesize / format.channels;