feature: Add 2.5 ms and 5 ms LC3 plus frame durations

fix: Check TNS bitstream data

fix: LTPF Activation with 2.5 ms frame sizes
This commit is contained in:
anonymix007
2023-12-13 10:56:20 -08:00
committed by Antoine Soulier
parent a75f187e00
commit 149cb6537e
43 changed files with 3095 additions and 1628 deletions

View File

@@ -33,7 +33,7 @@ struct lc3bin_header {
uint16_t bitrate_100bps;
uint16_t channels;
uint16_t frame_10us;
uint16_t rfu;
uint16_t epmode;
uint16_t nsamples_low;
uint16_t nsamples_high;
};
@@ -46,17 +46,26 @@ int lc3bin_read_header(FILE *fp,
int *frame_us, int *srate_hz, int *nchannels, int *nsamples)
{
struct lc3bin_header hdr;
uint16_t hrmode = 0;
if (fread(&hdr, sizeof(hdr), 1, fp) != 1
|| hdr.file_id != LC3_FILE_ID
|| hdr.header_size < sizeof(hdr))
return -1;
int num_extended_params = (hdr.header_size - sizeof(hdr)) / sizeof(uint16_t);
if (num_extended_params >= 1 &&
fread(&hrmode, sizeof(hrmode), 1, fp) != 1)
return -1;
*nchannels = hdr.channels;
*frame_us = hdr.frame_10us * 10;
*srate_hz = hdr.srate_100hz * 100;
*nsamples = hdr.nsamples_low | (hdr.nsamples_high << 16);
if (hdr.epmode || hrmode)
return -1;
fseek(fp, hdr.header_size, SEEK_SET);
return 0;