diff options
| author | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2012-11-11 15:36:36 +0000 |
|---|---|---|
| committer | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2012-11-11 15:36:36 +0000 |
| commit | a599adee719341f679c17279a1eb5119c22b6494 (patch) | |
| tree | a7194954a6595a940d71a1fd59f91364aadfa598 /src/plugins/Input/aac/aacfile.cpp | |
| parent | 6ec82a3943d55a41158521311fae360bf848bb6d (diff) | |
| download | qmmp-a599adee719341f679c17279a1eb5119c22b6494.tar.gz qmmp-a599adee719341f679c17279a1eb5119c22b6494.tar.bz2 qmmp-a599adee719341f679c17279a1eb5119c22b6494.zip | |
aac decoder: improved detection by content
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@2987 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src/plugins/Input/aac/aacfile.cpp')
| -rw-r--r-- | src/plugins/Input/aac/aacfile.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/plugins/Input/aac/aacfile.cpp b/src/plugins/Input/aac/aacfile.cpp index c7fee32a7..288d4c3ca 100644 --- a/src/plugins/Input/aac/aacfile.cpp +++ b/src/plugins/Input/aac/aacfile.cpp @@ -70,7 +70,21 @@ AACFile::AACFile(QIODevice *i, bool metaData, bool adts) //try to determnate header type; if (buf[adts_offset] == 0xff && ((buf[adts_offset+1] & 0xf6) == 0xf0)) { - qDebug("AACFile: ADTS header found"); + int frame_length = ((((unsigned int)buf[adts_offset+3] & 0x3)) << 11) + | (((unsigned int)buf[adts_offset+4]) << 3) | (buf[adts_offset+5] >> 5); + + if(adts_offset + frame_length > buf_at - 6) + break; + + //check second sync word + if ((buf[adts_offset + frame_length] == 0xFF) && + ((buf[adts_offset + frame_length + 1] & 0xF6) == 0xF0)) + { + qDebug("AACFile: ADTS header found"); + } + else + break; + if (!i->isSequential() && adts) parseADTS(); m_isValid = true; |
