mirror of
https://github.com/google/liblc3.git
synced 2026-04-24 00:04:48 +00:00
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:
committed by
Antoine Soulier
parent
a75f187e00
commit
149cb6537e
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user