aboutsummaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
authortrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2012-11-11 15:36:36 +0000
committertrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2012-11-11 15:36:36 +0000
commita599adee719341f679c17279a1eb5119c22b6494 (patch)
treea7194954a6595a940d71a1fd59f91364aadfa598 /src/plugins
parent6ec82a3943d55a41158521311fae360bf848bb6d (diff)
downloadqmmp-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')
-rw-r--r--src/plugins/Input/aac/aacfile.cpp16
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;