Merge pull request #28 from jcdr428/patch-1

Correct EAC3 sampling rate and channel parsing
master
Dan 2019-11-24 20:00:27 +00:00 committed by GitHub
commit 67ba8c5fff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 10 deletions

View File

@ -163,7 +163,7 @@ int AC3Codec::parseHeader(uint8_t* buf, uint8_t* end)
return AC3_PARSE_ERROR_BSID;
m_bsid = id;
if(m_bsid > 10)
if(m_bsid > 10) // bsid = 16 => EAC3
{
unsigned int numblkscod, strmtyp, substreamid;
@ -177,9 +177,9 @@ int AC3Codec::parseHeader(uint8_t* buf, uint8_t* end)
if (m_frame_size < AC3_HEADER_SIZE)
return 0; // invalid header size
int fscod = gbc.getBits( 2);
m_fscod = gbc.getBits( 2);
if (fscod == 3) {
if (m_fscod == 3) {
m_fscod2 = gbc.getBits( 2);
numblkscod = 3;
if(m_fscod2 == 3)
@ -190,15 +190,15 @@ int AC3Codec::parseHeader(uint8_t* buf, uint8_t* end)
numblkscod = gbc.getBits( 2);
m_sample_rate = ff_ac3_freqs[m_fscod];
}
int acmodExt = gbc.getBits( 3);
int lfeonExt = gbc.getBit();
m_bsmod = 0;
m_acmod = gbc.getBits( 3);
m_lfeon = gbc.getBit();
m_channels = ff_ac3_channels[m_acmod] + m_lfeon;
m_samples = eac3_blocks[numblkscod] * 256;
m_bit_rateExt = m_frame_size * (m_sample_rate) * 8 / (m_samples);
int bsId = gbc.getBits(5);
gbc.skipBits(5); // skip bsid, already got it
m_bsidBase = m_bsid;
for (int i = 0; i < (acmodExt ? 1 : 2); i++) {
gbc.skipBits(5); // skip dialog normalization
if (gbc.getBit()) {
@ -216,7 +216,7 @@ int AC3Codec::parseHeader(uint8_t* buf, uint8_t* end)
}
}
}
else
else // AC-3
{
m_bsidBase = m_bsid; // id except AC3+ frames
m_samples = AC3_FRAME_SIZE;