diff options
author | Marco Nelissen <marcone@google.com> | 2012-03-20 09:48:02 -0700 |
---|---|---|
committer | Marco Nelissen <marcone@google.com> | 2012-03-20 09:48:02 -0700 |
commit | 092406a2568316bbe5ed1ec6335e6f1d128ebf8e (patch) | |
tree | 8d4d9cc825dfec85704d1e8f966662261f9a3031 /media | |
parent | b636abde14f2612ea236257846b9ab15d87d4623 (diff) | |
download | frameworks_av-092406a2568316bbe5ed1ec6335e6f1d128ebf8e.zip frameworks_av-092406a2568316bbe5ed1ec6335e6f1d128ebf8e.tar.gz frameworks_av-092406a2568316bbe5ed1ec6335e6f1d128ebf8e.tar.bz2 |
Move COM tag parsing to constructor
Change-Id: Icfcf05655ca98ccccad4f94834770c2f4098a764
Diffstat (limited to 'media')
-rw-r--r-- | media/libstagefright/MP3Extractor.cpp | 58 |
1 files changed, 31 insertions, 27 deletions
diff --git a/media/libstagefright/MP3Extractor.cpp b/media/libstagefright/MP3Extractor.cpp index 1886050..6abaf23 100644 --- a/media/libstagefright/MP3Extractor.cpp +++ b/media/libstagefright/MP3Extractor.cpp @@ -348,6 +348,37 @@ MP3Extractor::MP3Extractor( } mInitCheck = OK; + + // get iTunes-style gapless info if present + ID3 id3(mDataSource); + if (id3.isValid()) { + ID3::Iterator *com = new ID3::Iterator(id3, "COM"); + if (com->done()) { + delete com; + com = new ID3::Iterator(id3, "COMM"); + } + while(!com->done()) { + String8 commentdesc; + String8 commentvalue; + com->getString(&commentdesc, &commentvalue); + const char * desc = commentdesc.string(); + const char * value = commentvalue.string(); + + // first 3 characters are the language, which we don't care about + if(strlen(desc) > 3 && strcmp(desc + 3, "iTunSMPB") == 0) { + + int32_t delay, padding; + if (sscanf(value, " %*x %x %x %*x", &delay, &padding) == 2) { + mMeta->setInt32(kKeyEncoderDelay, delay); + mMeta->setInt32(kKeyEncoderPadding, padding); + } + break; + } + com->next(); + } + delete com; + com = NULL; + } } size_t MP3Extractor::countTracks() { @@ -555,33 +586,6 @@ sp<MetaData> MP3Extractor::getMetaData() { return meta; } - ID3::Iterator *com = new ID3::Iterator(id3, "COM"); - if (com->done()) { - delete com; - com = new ID3::Iterator(id3, "COMM"); - } - while(!com->done()) { - String8 commentdesc; - String8 commentvalue; - com->getString(&commentdesc, &commentvalue); - const char * desc = commentdesc.string(); - const char * value = commentvalue.string(); - - // first 3 characters are the language, which we don't care about - if(strlen(desc) > 3 && strcmp(desc + 3, "iTunSMPB") == 0) { - - int32_t delay, padding; - if (sscanf(value, " %*x %x %x %*x", &delay, &padding) == 2) { - mMeta->setInt32(kKeyEncoderDelay, delay); - mMeta->setInt32(kKeyEncoderPadding, padding); - } - break; - } - com->next(); - } - delete com; - com = NULL; - struct Map { int key; const char *tag1; |