diff options
author | Andreas Huber <andih@google.com> | 2010-02-08 11:04:56 -0800 |
---|---|---|
committer | Andreas Huber <andih@google.com> | 2010-02-08 16:46:27 -0800 |
commit | 4c23b7d543cd95250e766cef7558d0f4c941ddcb (patch) | |
tree | 4c68df49927ea79a80de37b8654b79ea9b9511ff /media/libstagefright/id3 | |
parent | 2dd73b65542c9eeb82bb567098f235349d18b06f (diff) | |
download | frameworks_av-4c23b7d543cd95250e766cef7558d0f4c941ddcb.zip frameworks_av-4c23b7d543cd95250e766cef7558d0f4c941ddcb.tar.gz frameworks_av-4c23b7d543cd95250e766cef7558d0f4c941ddcb.tar.bz2 |
ID3v1 tag's strings are ISO8859, not UTF-8, so do the proper conversion when extracting metadata.
related-to-bug: 2399408
Diffstat (limited to 'media/libstagefright/id3')
-rw-r--r-- | media/libstagefright/id3/ID3.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/media/libstagefright/id3/ID3.cpp b/media/libstagefright/id3/ID3.cpp index 65a4ae4..e022bb0 100644 --- a/media/libstagefright/id3/ID3.cpp +++ b/media/libstagefright/id3/ID3.cpp @@ -274,7 +274,9 @@ static void convertISO8859ToString8( String8 *s) { size_t utf8len = 0; for (size_t i = 0; i < size; ++i) { - if (data[i] < 0x80) { + if (data[i] == '\0') { + break; + } else if (data[i] < 0x80) { ++utf8len; } else { utf8len += 2; @@ -291,7 +293,9 @@ static void convertISO8859ToString8( char *tmp = new char[utf8len]; char *ptr = tmp; for (size_t i = 0; i < size; ++i) { - if (data[i] < 0x80) { + if (data[i] == '\0') { + break; + } else if (data[i] < 0x80) { *ptr++ = data[i]; } else if (data[i] < 0xc0) { *ptr++ = 0xc2; @@ -325,7 +329,7 @@ void ID3::Iterator::getString(String8 *id) const { return; } - id->setTo((const char *)mFrameData, mFrameSize); + convertISO8859ToString8(mFrameData, mFrameSize, id); return; } |