debug_msg(RELEASE, "ID3tag v222--------------------------------------------------------------\n");
- if (needToloopv2taglen - MP3_TAGv2_22_TXT_HEADER_LEN > MP3_TAGv2_22_TXT_HEADER_LEN) {
- while (needToloopv2taglen > MP3_TAGv2_22_TXT_HEADER_LEN) {
- if ((buffer[curPos] < '0' || buffer[curPos] > 'Z') || (buffer[curPos + 1] < '0' || buffer[curPos + 1] > 'Z')
- || (buffer[curPos + 2] < '0' || buffer[curPos + 2] > 'Z'))
- break;
+ while (needToloopv2taglen > MP3_TAGv2_22_TXT_HEADER_LEN) {
+ if ((buffer[curPos] < '0' || buffer[curPos] > 'Z') || (buffer[curPos + 1] < '0' || buffer[curPos + 1] > 'Z')
+ || (buffer[curPos + 2] < '0' || buffer[curPos + 2] > 'Z'))
+ break;
- memcpy(CompTmp, &buffer[curPos], 3);
+ memcpy(CompTmp, &buffer[curPos], 3);
- CompTmp[3] = 0;
- oneFrameLen = MP3_TAGv2_22_TXT_HEADER_LEN;
- oneFrameLen += (unsigned long)buffer[3 + curPos] << 16 | (unsigned long)buffer[4 + curPos] << 8
- | (unsigned long)buffer[5 + curPos];
- if (oneFrameLen > taglen - curPos)
- break;
- purelyFramelen = oneFrameLen - MP3_TAGv2_22_TXT_HEADER_LEN;
- curPos += MP3_TAGv2_22_TXT_HEADER_LEN;
+ CompTmp[3] = 0;
+ oneFrameLen = MP3_TAGv2_22_TXT_HEADER_LEN;
+ oneFrameLen += (unsigned long)buffer[3 + curPos] << 16 | (unsigned long)buffer[4 + curPos] << 8
+ | (unsigned long)buffer[5 + curPos];
- if (oneFrameLen > MP3_TAGv2_22_TXT_HEADER_LEN && purelyFramelen <= taglen - curPos) {
- curPos += purelyFramelen;
+ if (oneFrameLen > taglen - curPos)
+ break;
- if (buffer[curPos - purelyFramelen] == 0x00) {
- encodingOffSet = 1;
- textEncodingType = AV_ID3V2_ISO_8859;
- } else if (buffer[curPos - purelyFramelen] == 0x01) {
- encodingOffSet = 1;
- textEncodingType = AV_ID3V2_UTF16;
- }
+ purelyFramelen = oneFrameLen - MP3_TAGv2_22_TXT_HEADER_LEN;
+ curPos += oneFrameLen;
- /*in order to deliver valid string to MP */
- while ((buffer[curPos - purelyFramelen + encodingOffSet] < 0x20) && (encodingOffSet < purelyFramelen))
- encodingOffSet++;
+ if (purelyFramelen > 0) {
+ if (buffer[curPos - purelyFramelen] == 0x00) {
+ encodingOffSet = 1;
+ textEncodingType = AV_ID3V2_ISO_8859;
+ } else if (buffer[curPos - purelyFramelen] == 0x01) {
+ encodingOffSet = 1;
+ textEncodingType = AV_ID3V2_UTF16;
+ }
- if (encodingOffSet < purelyFramelen) {
- realCpyFrameNum = purelyFramelen - encodingOffSet;
- mmfile_free(pExtContent);
- pExtContent = mmfile_malloc(realCpyFrameNum + 3);
+ /*in order to deliver valid string to MP */
+ while ((buffer[curPos - purelyFramelen + encodingOffSet] < 0x20) && (encodingOffSet < purelyFramelen))
+ encodingOffSet++;
- if (pExtContent == NULL) {
- debug_error(DEBUG, "out of memory for pExtContent\n");
- continue;
- }
-
- memset(pExtContent, '\0', realCpyFrameNum + 3);
-
- memcpy(pExtContent, &buffer[curPos - purelyFramelen + encodingOffSet], purelyFramelen - encodingOffSet);
-
- if (realCpyFrameNum > 0) {
- if (strncmp((char *)CompTmp, "TT2", 3) == 0 && pInfo->tagV2Info.bTitleMarked == false) {
- pInfo->pTitle = mmfile_string_convert((const char *)pExtContent, realCpyFrameNum, "UTF-8", charset_array[textEncodingType], NULL, (unsigned int *)&pInfo->titleLen);
- debug_msg(RELEASE, "pInfo->pTitle returned = (%s), pInfo->titleLen(%d)\n", pInfo->pTitle, pInfo->titleLen);
- pInfo->tagV2Info.bTitleMarked = true;
- } else if (strncmp((char *)CompTmp, "TP1", 3) == 0 && pInfo->tagV2Info.bArtistMarked == false) {
- pInfo->pArtist = mmfile_string_convert((const char *)pExtContent, realCpyFrameNum, "UTF-8", charset_array[textEncodingType], NULL, (unsigned int *)&pInfo->artistLen);
- debug_msg(RELEASE, "pInfo->pArtist returned = (%s), pInfo->artistLen(%d)\n", pInfo->pArtist, pInfo->artistLen);
- pInfo->tagV2Info.bArtistMarked = true;
- } else if (strncmp((char *)CompTmp, "TP2", 3) == 0 && pInfo->tagV2Info.bAlbum_ArtistMarked == false) {
- pInfo->pAlbum_Artist = mmfile_string_convert((const char *)pExtContent, realCpyFrameNum, "UTF-8", charset_array[textEncodingType], NULL, (unsigned int *)&pInfo->album_artistLen);
- debug_msg(RELEASE, "pInfo->pAlbum_Artist returned = (%s), pInfo->album_artistLen(%d)\n", pInfo->pAlbum_Artist, pInfo->album_artistLen);
- pInfo->tagV2Info.bAlbum_ArtistMarked = true;
- } else if (strncmp((char *)CompTmp, "TP3", 3) == 0 && pInfo->tagV2Info.bConductorMarked == false) {
- pInfo->pConductor = mmfile_string_convert((const char *)pExtContent, realCpyFrameNum, "UTF-8", charset_array[textEncodingType], NULL, (unsigned int *)&pInfo->conductorLen);
- debug_msg(RELEASE, "pInfo->pConductor returned = (%s), pInfo->conductorLen(%d)\n", pInfo->pConductor, pInfo->conductorLen);
- pInfo->tagV2Info.bConductorMarked = true;
- } else if (strncmp((char *)CompTmp, "TAL", 3) == 0 && pInfo->tagV2Info.bAlbumMarked == false) {
- pInfo->pAlbum = mmfile_string_convert((const char *)pExtContent, realCpyFrameNum, "UTF-8", charset_array[textEncodingType], NULL, (unsigned int *)&pInfo->albumLen);
- debug_msg(RELEASE, "pInfo->pAlbum returned = (%s), pInfo->albumLen(%d)\n", pInfo->pAlbum, pInfo->albumLen);
- pInfo->tagV2Info.bAlbumMarked = true;
- } else if (strncmp((char *)CompTmp, "TYE", 3) == 0 && pInfo->tagV2Info.bYearMarked == false) {
- pInfo->pYear = mmfile_string_convert((const char *)pExtContent, realCpyFrameNum, "UTF-8", charset_array[textEncodingType], NULL, (unsigned int *)&pInfo->yearLen);
- debug_msg(RELEASE, "pInfo->pYear returned = (%s), pInfo->yearLen(%d)\n", pInfo->pYear, pInfo->yearLen);
- pInfo->tagV2Info.bYearMarked = true;
- } else if (strncmp((char *)CompTmp, "COM", 3) == 0 && pInfo->tagV2Info.bDescriptionMarked == false) {
- /*skip language data! */
- if (realCpyFrameNum > 4) {
- realCpyFrameNum -= 4;
- tmp = 4;
+ if (encodingOffSet < purelyFramelen) {
+ realCpyFrameNum = purelyFramelen - encodingOffSet;
+ mmfile_free(pExtContent);
+ pExtContent = mmfile_malloc(realCpyFrameNum + 3);
- /*pExtContent[tmp+1] value should't have encoding value */
- if (pExtContent[tmp] > 0x20 && (pExtContent[tmp - 1] == 0x00 || pExtContent[tmp - 1] == 0x01)) {
- textEncodingType = __id3tag_get_text_encoding_v222(pExtContent, tmp);
+ if (pExtContent == NULL) {
+ debug_error(DEBUG, "out of memory for pExtContent\n");
+ continue;
+ }
- pInfo->pComment = mmfile_string_convert((char *)&pExtContent[tmp], realCpyFrameNum, "UTF-8", charset_array[textEncodingType], NULL, (unsigned int *)&pInfo->commentLen);
- debug_msg(RELEASE, "pInfo->pComment returned = (%s), pInfo->commentLen(%d)\n", pInfo->pComment, pInfo->commentLen);
- pInfo->tagV2Info.bDescriptionMarked = true;
- } else {
- debug_msg(RELEASE, "mmf_file_id3tag_parse_v222: failed to get Comment Info tmp(%d), purelyFramelen - encodingOffSet(%lu)\n", tmp, purelyFramelen - encodingOffSet);
- }
+ memset(pExtContent, '\0', realCpyFrameNum + 3);
+
+ memcpy(pExtContent, &buffer[curPos - purelyFramelen + encodingOffSet], purelyFramelen - encodingOffSet);
+
+ if (realCpyFrameNum > 0) {
+ if (strncmp((char *)CompTmp, "TT2", 3) == 0 && pInfo->tagV2Info.bTitleMarked == false) {
+ pInfo->pTitle = mmfile_string_convert((const char *)pExtContent, realCpyFrameNum, "UTF-8", charset_array[textEncodingType], NULL, (unsigned int *)&pInfo->titleLen);
+ debug_msg(RELEASE, "pInfo->pTitle returned = (%s), pInfo->titleLen(%d)\n", pInfo->pTitle, pInfo->titleLen);
+ pInfo->tagV2Info.bTitleMarked = true;
+ } else if (strncmp((char *)CompTmp, "TP1", 3) == 0 && pInfo->tagV2Info.bArtistMarked == false) {
+ pInfo->pArtist = mmfile_string_convert((const char *)pExtContent, realCpyFrameNum, "UTF-8", charset_array[textEncodingType], NULL, (unsigned int *)&pInfo->artistLen);
+ debug_msg(RELEASE, "pInfo->pArtist returned = (%s), pInfo->artistLen(%d)\n", pInfo->pArtist, pInfo->artistLen);
+ pInfo->tagV2Info.bArtistMarked = true;
+ } else if (strncmp((char *)CompTmp, "TP2", 3) == 0 && pInfo->tagV2Info.bAlbum_ArtistMarked == false) {
+ pInfo->pAlbum_Artist = mmfile_string_convert((const char *)pExtContent, realCpyFrameNum, "UTF-8", charset_array[textEncodingType], NULL, (unsigned int *)&pInfo->album_artistLen);
+ debug_msg(RELEASE, "pInfo->pAlbum_Artist returned = (%s), pInfo->album_artistLen(%d)\n", pInfo->pAlbum_Artist, pInfo->album_artistLen);
+ pInfo->tagV2Info.bAlbum_ArtistMarked = true;
+ } else if (strncmp((char *)CompTmp, "TP3", 3) == 0 && pInfo->tagV2Info.bConductorMarked == false) {
+ pInfo->pConductor = mmfile_string_convert((const char *)pExtContent, realCpyFrameNum, "UTF-8", charset_array[textEncodingType], NULL, (unsigned int *)&pInfo->conductorLen);
+ debug_msg(RELEASE, "pInfo->pConductor returned = (%s), pInfo->conductorLen(%d)\n", pInfo->pConductor, pInfo->conductorLen);
+ pInfo->tagV2Info.bConductorMarked = true;
+ } else if (strncmp((char *)CompTmp, "TAL", 3) == 0 && pInfo->tagV2Info.bAlbumMarked == false) {
+ pInfo->pAlbum = mmfile_string_convert((const char *)pExtContent, realCpyFrameNum, "UTF-8", charset_array[textEncodingType], NULL, (unsigned int *)&pInfo->albumLen);
+ debug_msg(RELEASE, "pInfo->pAlbum returned = (%s), pInfo->albumLen(%d)\n", pInfo->pAlbum, pInfo->albumLen);
+ pInfo->tagV2Info.bAlbumMarked = true;
+ } else if (strncmp((char *)CompTmp, "TYE", 3) == 0 && pInfo->tagV2Info.bYearMarked == false) {
+ pInfo->pYear = mmfile_string_convert((const char *)pExtContent, realCpyFrameNum, "UTF-8", charset_array[textEncodingType], NULL, (unsigned int *)&pInfo->yearLen);
+ debug_msg(RELEASE, "pInfo->pYear returned = (%s), pInfo->yearLen(%d)\n", pInfo->pYear, pInfo->yearLen);
+ pInfo->tagV2Info.bYearMarked = true;
+ } else if (strncmp((char *)CompTmp, "COM", 3) == 0 && pInfo->tagV2Info.bDescriptionMarked == false) {
+ /*skip language data! */
+ if (realCpyFrameNum > 4) {
+ realCpyFrameNum -= 4;
+ tmp = 4;
+
+ /*pExtContent[tmp+1] value should't have encoding value */
+ if (pExtContent[tmp] > 0x20 && (pExtContent[tmp - 1] == 0x00 || pExtContent[tmp - 1] == 0x01)) {
+ textEncodingType = __id3tag_get_text_encoding_v222(pExtContent, tmp);
+
+ pInfo->pComment = mmfile_string_convert((char *)&pExtContent[tmp], realCpyFrameNum, "UTF-8", charset_array[textEncodingType], NULL, (unsigned int *)&pInfo->commentLen);
+ debug_msg(RELEASE, "pInfo->pComment returned = (%s), pInfo->commentLen(%d)\n", pInfo->pComment, pInfo->commentLen);
+ pInfo->tagV2Info.bDescriptionMarked = true;
} else {
- debug_msg(RELEASE, "mmf_file_id3tag_parse_v222: Description info too small to parse realCpyFrameNum(%d)\n", realCpyFrameNum);
+ debug_msg(RELEASE, "mmf_file_id3tag_parse_v222: failed to get Comment Info tmp(%d), purelyFramelen - encodingOffSet(%lu)\n", tmp, purelyFramelen - encodingOffSet);
}
- tmp = 0;
-
- } else if (strncmp((char *)CompTmp, "TCO", 3) == 0 && pInfo->tagV2Info.bGenreMarked == false) {
- pInfo->pGenre = mmfile_string_convert((const char *)pExtContent, realCpyFrameNum, "UTF-8", charset_array[textEncodingType], NULL, (unsigned int *)&pInfo->genreLen);
- debug_msg(RELEASE, "pInfo->pGenre returned = (%s), pInfo->genreLen(%d)\n", pInfo->pGenre, pInfo->genreLen);
- _mm_file_id3tag_add_bracket_at_genre(&pInfo->pGenre, pInfo->genreLen);
- pInfo->tagV2Info.bGenreMarked = true;
- } else if (strncmp((char *)CompTmp, "TRK", 3) == 0 && pInfo->tagV2Info.bTrackNumMarked == false) {
- pInfo->pTrackNum = mmfile_string_convert((const char *)pExtContent, realCpyFrameNum, "UTF-8", charset_array[textEncodingType], NULL, (unsigned int *)&pInfo->tracknumLen);
- debug_msg(RELEASE, "pInfo->pTrackNum returned = (%s), pInfo->tracknumLen(%d)\n", pInfo->pTrackNum, pInfo->tracknumLen);
- pInfo->tagV2Info.bTrackNumMarked = true;
- } else if (strncmp((char *)CompTmp, "TEN", 3) == 0 && pInfo->tagV2Info.bEncByMarked == false) {
- pInfo->pEncBy = mmfile_string_convert((const char *)pExtContent, realCpyFrameNum, "UTF-8", charset_array[textEncodingType], NULL, (unsigned int *)&pInfo->encbyLen);
- debug_msg(RELEASE, "pInfo->pEncBy returned = (%s), pInfo->encbyLen(%d)\n", pInfo->pEncBy, pInfo->encbyLen);
- pInfo->tagV2Info.bEncByMarked = true;
- } else if (strncmp((char *)CompTmp, "WXX", 3) == 0 && pInfo->tagV2Info.bURLMarked == false) {
- if (realCpyFrameNum > 4) {
- /*skip language data! */
- realCpyFrameNum -= 4;
- tmp = 4;
-
- /*pExtContent[tmp+1] value should't have null value */
- if (pExtContent[tmp] > 0x20 && (pExtContent[tmp - 1] == 0x00 || pExtContent[tmp - 1] == 0x01)) {
- textEncodingType = __id3tag_get_text_encoding_v222(pExtContent, tmp);
-
- pInfo->pURL = mmfile_string_convert((const char *)pExtContent, realCpyFrameNum, "UTF-8", charset_array[textEncodingType], NULL, (unsigned int *)&pInfo->urlLen);
- debug_msg(RELEASE, "pInfo->pURL returned = (%s), pInfo->urlLen(%d)\n", pInfo->pURL, pInfo->urlLen);
- pInfo->tagV2Info.bURLMarked = true;
- } else {
- debug_msg(RELEASE, "mmf_file_id3tag_parse_v222: failed to get URL Info tmp(%d), purelyFramelen - encodingOffSet(%lu)\n", tmp, purelyFramelen - encodingOffSet);
- }
+ } else {
+ debug_msg(RELEASE, "mmf_file_id3tag_parse_v222: Description info too small to parse realCpyFrameNum(%d)\n", realCpyFrameNum);
+ }
+ tmp = 0;
+
+ } else if (strncmp((char *)CompTmp, "TCO", 3) == 0 && pInfo->tagV2Info.bGenreMarked == false) {
+ pInfo->pGenre = mmfile_string_convert((const char *)pExtContent, realCpyFrameNum, "UTF-8", charset_array[textEncodingType], NULL, (unsigned int *)&pInfo->genreLen);
+ debug_msg(RELEASE, "pInfo->pGenre returned = (%s), pInfo->genreLen(%d)\n", pInfo->pGenre, pInfo->genreLen);
+ _mm_file_id3tag_add_bracket_at_genre(&pInfo->pGenre, pInfo->genreLen);
+ pInfo->tagV2Info.bGenreMarked = true;
+ } else if (strncmp((char *)CompTmp, "TRK", 3) == 0 && pInfo->tagV2Info.bTrackNumMarked == false) {
+ pInfo->pTrackNum = mmfile_string_convert((const char *)pExtContent, realCpyFrameNum, "UTF-8", charset_array[textEncodingType], NULL, (unsigned int *)&pInfo->tracknumLen);
+ debug_msg(RELEASE, "pInfo->pTrackNum returned = (%s), pInfo->tracknumLen(%d)\n", pInfo->pTrackNum, pInfo->tracknumLen);
+ pInfo->tagV2Info.bTrackNumMarked = true;
+ } else if (strncmp((char *)CompTmp, "TEN", 3) == 0 && pInfo->tagV2Info.bEncByMarked == false) {
+ pInfo->pEncBy = mmfile_string_convert((const char *)pExtContent, realCpyFrameNum, "UTF-8", charset_array[textEncodingType], NULL, (unsigned int *)&pInfo->encbyLen);
+ debug_msg(RELEASE, "pInfo->pEncBy returned = (%s), pInfo->encbyLen(%d)\n", pInfo->pEncBy, pInfo->encbyLen);
+ pInfo->tagV2Info.bEncByMarked = true;
+ } else if (strncmp((char *)CompTmp, "WXX", 3) == 0 && pInfo->tagV2Info.bURLMarked == false) {
+ if (realCpyFrameNum > 4) {
+ /*skip language data! */
+ realCpyFrameNum -= 4;
+ tmp = 4;
+
+ /*pExtContent[tmp+1] value should't have null value */
+ if (pExtContent[tmp] > 0x20 && (pExtContent[tmp - 1] == 0x00 || pExtContent[tmp - 1] == 0x01)) {
+ textEncodingType = __id3tag_get_text_encoding_v222(pExtContent, tmp);
+
+ pInfo->pURL = mmfile_string_convert((const char *)pExtContent, realCpyFrameNum, "UTF-8", charset_array[textEncodingType], NULL, (unsigned int *)&pInfo->urlLen);
+ debug_msg(RELEASE, "pInfo->pURL returned = (%s), pInfo->urlLen(%d)\n", pInfo->pURL, pInfo->urlLen);
+ pInfo->tagV2Info.bURLMarked = true;
} else {
- debug_msg(RELEASE, "mmf_file_id3tag_parse_v222: URL info too small to parse realCpyFrameNum(%d)\n", realCpyFrameNum);
+ debug_msg(RELEASE, "mmf_file_id3tag_parse_v222: failed to get URL Info tmp(%d), purelyFramelen - encodingOffSet(%lu)\n", tmp, purelyFramelen - encodingOffSet);
}
- tmp = 0;
- } else if (strncmp((char *)CompTmp, "TCR", 3) == 0 && pInfo->tagV2Info.bCopyRightMarked == false) {
- pInfo->pCopyright = mmfile_string_convert((const char *)pExtContent, realCpyFrameNum, "UTF-8", charset_array[textEncodingType], NULL, (unsigned int *)&pInfo->copyrightLen);
- debug_msg(RELEASE, "pInfo->pCopyright returned = (%s), pInfo->copyrightLen(%d)\n", pInfo->pCopyright, pInfo->copyrightLen);
- pInfo->tagV2Info.bCopyRightMarked = true;
- } else if (strncmp((char *)CompTmp, "TOA", 3) == 0 && pInfo->tagV2Info.bOriginArtistMarked == false) {
- pInfo->pOriginArtist = mmfile_string_convert((const char *)pExtContent, realCpyFrameNum, "UTF-8", charset_array[textEncodingType], NULL, (unsigned int *)&pInfo->originartistLen);
- debug_msg(RELEASE, "pInfo->pOriginArtist returned = (%s), pInfo->originartistLen(%d)\n", pInfo->pOriginArtist, pInfo->originartistLen);
- pInfo->tagV2Info.bOriginArtistMarked = true;
- } else if (strncmp((char *)CompTmp, "TCM", 3) == 0 && pInfo->tagV2Info.bComposerMarked == false) {
- pInfo->pComposer = mmfile_string_convert((const char *)pExtContent, realCpyFrameNum, "UTF-8", charset_array[textEncodingType], NULL, (unsigned int *)&pInfo->composerLen);
- debug_msg(RELEASE, "pInfo->pComposer returned = (%s), pInfo->originartistLen(%d)\n", pInfo->pComposer, pInfo->composerLen);
- pInfo->tagV2Info.bComposerMarked = true;
- } else if (strncmp((char *)CompTmp, "TRD", 3) == 0 && pInfo->tagV2Info.bRecDateMarked == false) {
- pInfo->pRecDate = mmfile_string_convert((const char *)pExtContent, realCpyFrameNum, "UTF-8", charset_array[textEncodingType], NULL, (unsigned int *)&pInfo->recdateLen);
- debug_msg(RELEASE, "pInfo->pRecDate returned = (%s), pInfo->recdateLen(%d)\n", pInfo->pRecDate, pInfo->recdateLen);
- pInfo->tagV2Info.bRecDateMarked = true;
- } else if (strncmp((char *)CompTmp, "PIC", 3) == 0 && pInfo->tagV2Info.bImageMarked == false && realCpyFrameNum <= 2000000) {
- debug_msg(DEBUG, "text encoding %d \n", textEncodingType);
- _mm_file_id3tag_parse_PIC(pInfo, pExtContent, realCpyFrameNum, (const char*)charset_array[textEncodingType]);
- pInfo->tagV2Info.bImageMarked = true;
+ } else {
+ debug_msg(RELEASE, "mmf_file_id3tag_parse_v222: URL info too small to parse realCpyFrameNum(%d)\n", realCpyFrameNum);
}
+ tmp = 0;
+ } else if (strncmp((char *)CompTmp, "TCR", 3) == 0 && pInfo->tagV2Info.bCopyRightMarked == false) {
+ pInfo->pCopyright = mmfile_string_convert((const char *)pExtContent, realCpyFrameNum, "UTF-8", charset_array[textEncodingType], NULL, (unsigned int *)&pInfo->copyrightLen);
+ debug_msg(RELEASE, "pInfo->pCopyright returned = (%s), pInfo->copyrightLen(%d)\n", pInfo->pCopyright, pInfo->copyrightLen);
+ pInfo->tagV2Info.bCopyRightMarked = true;
+ } else if (strncmp((char *)CompTmp, "TOA", 3) == 0 && pInfo->tagV2Info.bOriginArtistMarked == false) {
+ pInfo->pOriginArtist = mmfile_string_convert((const char *)pExtContent, realCpyFrameNum, "UTF-8", charset_array[textEncodingType], NULL, (unsigned int *)&pInfo->originartistLen);
+ debug_msg(RELEASE, "pInfo->pOriginArtist returned = (%s), pInfo->originartistLen(%d)\n", pInfo->pOriginArtist, pInfo->originartistLen);
+ pInfo->tagV2Info.bOriginArtistMarked = true;
+ } else if (strncmp((char *)CompTmp, "TCM", 3) == 0 && pInfo->tagV2Info.bComposerMarked == false) {
+ pInfo->pComposer = mmfile_string_convert((const char *)pExtContent, realCpyFrameNum, "UTF-8", charset_array[textEncodingType], NULL, (unsigned int *)&pInfo->composerLen);
+ debug_msg(RELEASE, "pInfo->pComposer returned = (%s), pInfo->originartistLen(%d)\n", pInfo->pComposer, pInfo->composerLen);
+ pInfo->tagV2Info.bComposerMarked = true;
+ } else if (strncmp((char *)CompTmp, "TRD", 3) == 0 && pInfo->tagV2Info.bRecDateMarked == false) {
+ pInfo->pRecDate = mmfile_string_convert((const char *)pExtContent, realCpyFrameNum, "UTF-8", charset_array[textEncodingType], NULL, (unsigned int *)&pInfo->recdateLen);
+ debug_msg(RELEASE, "pInfo->pRecDate returned = (%s), pInfo->recdateLen(%d)\n", pInfo->pRecDate, pInfo->recdateLen);
+ pInfo->tagV2Info.bRecDateMarked = true;
+ } else if (strncmp((char *)CompTmp, "PIC", 3) == 0 && pInfo->tagV2Info.bImageMarked == false && realCpyFrameNum <= 2000000) {
+ debug_msg(DEBUG, "text encoding %d \n", textEncodingType);
+ _mm_file_id3tag_parse_PIC(pInfo, pExtContent, realCpyFrameNum, (const char*)charset_array[textEncodingType]);
+ pInfo->tagV2Info.bImageMarked = true;
}
-
}
- } else {
- curPos += purelyFramelen;
- if (purelyFramelen != 0)
- needToloopv2taglen = MP3_TAGv2_22_TXT_HEADER_LEN;
+
}
+ }
- mmfile_free(pExtContent);
- memset(CompTmp, 0, 4);
- if (curPos < taglen)
- needToloopv2taglen -= oneFrameLen;
- else
- needToloopv2taglen = MP3_TAGv2_22_TXT_HEADER_LEN;
+ mmfile_free(pExtContent);
+ memset(CompTmp, 0, 4);
- oneFrameLen = 0;
- encodingOffSet = 0;
- realCpyFrameNum = 0;
- textEncodingType = 0;
- purelyFramelen = 0;
+ if (curPos >= taglen)
+ break;
+
+ needToloopv2taglen -= oneFrameLen;
+
+ oneFrameLen = 0;
+ encodingOffSet = 0;
+ realCpyFrameNum = 0;
+ textEncodingType = 0;
+ purelyFramelen = 0;
- }
}
release_characterset_array(charset_array);
}
}
- if (needToloopv2taglen - MP3_TAGv2_23_TXT_HEADER_LEN > MP3_TAGv2_23_TXT_HEADER_LEN) {
- while (needToloopv2taglen > MP3_TAGv2_23_TXT_HEADER_LEN) {
- if ((buffer[curPos] < '0' || buffer[curPos] > 'Z') || (buffer[curPos + 1] < '0' || buffer[curPos + 1] > 'Z')
- || (buffer[curPos + 2] < '0' || buffer[curPos + 2] > 'Z') || (buffer[curPos + 3] < '0' || buffer[curPos + 3] > 'Z'))
- break;
-
- memcpy(CompTmp, &buffer[curPos], 4);
-
- CompTmp[4] = 0;
- oneFrameLen = MP3_TAGv2_23_TXT_HEADER_LEN;
- oneFrameLen += (unsigned long)buffer[4 + curPos] << 24 | (unsigned long)buffer[5 + curPos] << 16
- | (unsigned long)buffer[6 + curPos] << 8 | (unsigned long)buffer[7 + curPos];
+ while (needToloopv2taglen > MP3_TAGv2_23_TXT_HEADER_LEN) {
+ if ((buffer[curPos] < '0' || buffer[curPos] > 'Z') || (buffer[curPos + 1] < '0' || buffer[curPos + 1] > 'Z')
+ || (buffer[curPos + 2] < '0' || buffer[curPos + 2] > 'Z') || (buffer[curPos + 3] < '0' || buffer[curPos + 3] > 'Z'))
+ break;
- debug_msg(RELEASE, "----------------------------------------------------------------------------------------------------\n");
+ memcpy(CompTmp, &buffer[curPos], 4);
- if (oneFrameLen > taglen - curPos)
- break;
+ CompTmp[4] = 0;
+ oneFrameLen = MP3_TAGv2_23_TXT_HEADER_LEN;
+ oneFrameLen += (unsigned long)buffer[4 + curPos] << 24 | (unsigned long)buffer[5 + curPos] << 16
+ | (unsigned long)buffer[6 + curPos] << 8 | (unsigned long)buffer[7 + curPos];
- purelyFramelen = oneFrameLen - MP3_TAGv2_23_TXT_HEADER_LEN;
- curPos += MP3_TAGv2_23_TXT_HEADER_LEN;
+ debug_msg(RELEASE, "----------------------------------------------------------------------------------------------------\n");
- if (oneFrameLen > MP3_TAGv2_23_TXT_HEADER_LEN && purelyFramelen <= taglen - curPos) {
- curPos += purelyFramelen;
+ if (oneFrameLen > taglen - curPos)
+ break;
- if (IS_ENCODEDBY_UTF16(buffer + (curPos - purelyFramelen))) {
- encodingOffSet = 2;
- debug_msg(RELEASE, "this text string(%s) encoded by UTF16 encodingOffSet(%d)\n", CompTmp, encodingOffSet);
- textEncodingType = AV_ID3V2_UTF16;
- } else if (IS_ENCODEDBY_UTF16_R(buffer + (curPos - purelyFramelen))) {
- encodingOffSet = 2;
- debug_msg(RELEASE, "this text string(%s) encoded by UTF16 encodingOffSet(%d)\n", CompTmp, encodingOffSet);
- textEncodingType = AV_ID3V2_UTF16_BE;
- } else if (IS_ENCODEDBY_UTF16(buffer + (curPos - purelyFramelen + 1))) {
- encodingOffSet = 3;
- debug_msg(RELEASE, "this text string(%s) encoded by UTF16 encodingOffSet(%d)\n", CompTmp, encodingOffSet);
- textEncodingType = AV_ID3V2_UTF16;
- } else if (IS_ENCODEDBY_UTF16_R(buffer + (curPos - purelyFramelen + 1))) {
- encodingOffSet = 3;
- debug_msg(RELEASE, "this text string(%s) encoded by UTF16 encodingOffSet(%d)\n", CompTmp, encodingOffSet);
- textEncodingType = AV_ID3V2_UTF16_BE;
+ purelyFramelen = oneFrameLen - MP3_TAGv2_23_TXT_HEADER_LEN;
+ curPos += oneFrameLen;
+
+ if (purelyFramelen > 0) {
+ if (IS_ENCODEDBY_UTF16(buffer + (curPos - purelyFramelen))) {
+ encodingOffSet = 2;
+ debug_msg(RELEASE, "this text string(%s) encoded by UTF16 encodingOffSet(%d)\n", CompTmp, encodingOffSet);
+ textEncodingType = AV_ID3V2_UTF16;
+ } else if (IS_ENCODEDBY_UTF16_R(buffer + (curPos - purelyFramelen))) {
+ encodingOffSet = 2;
+ debug_msg(RELEASE, "this text string(%s) encoded by UTF16 encodingOffSet(%d)\n", CompTmp, encodingOffSet);
+ textEncodingType = AV_ID3V2_UTF16_BE;
+ } else if (IS_ENCODEDBY_UTF16(buffer + (curPos - purelyFramelen + 1))) {
+ encodingOffSet = 3;
+ debug_msg(RELEASE, "this text string(%s) encoded by UTF16 encodingOffSet(%d)\n", CompTmp, encodingOffSet);
+ textEncodingType = AV_ID3V2_UTF16;
+ } else if (IS_ENCODEDBY_UTF16_R(buffer + (curPos - purelyFramelen + 1))) {
+ encodingOffSet = 3;
+ debug_msg(RELEASE, "this text string(%s) encoded by UTF16 encodingOffSet(%d)\n", CompTmp, encodingOffSet);
+ textEncodingType = AV_ID3V2_UTF16_BE;
+ } else {
+ if (buffer[curPos - purelyFramelen + encodingOffSet] == 0x00) {
+ debug_msg(RELEASE, "encodingOffset will be set to 1\n");
+ encodingOffSet = 1;
} else {
- if (buffer[curPos - purelyFramelen + encodingOffSet] == 0x00) {
- debug_msg(RELEASE, "encodingOffset will be set to 1\n");
- encodingOffSet = 1;
- } else {
- debug_msg(RELEASE, "Finding encodingOffset\n");
+ debug_msg(RELEASE, "Finding encodingOffset\n");
- while ((buffer[curPos - purelyFramelen + encodingOffSet] < 0x20) && (encodingOffSet < purelyFramelen)) /* text string encoded by ISO-8859-1 */
- encodingOffSet++;
- }
- textEncodingType = AV_ID3V2_ISO_8859;
- debug_msg(RELEASE, "this text string(%s) encoded by ISO-8859-1 encodingOffSet(%d)\n", CompTmp, encodingOffSet);
+ while ((buffer[curPos - purelyFramelen + encodingOffSet] < 0x20) && (encodingOffSet < purelyFramelen)) /* text string encoded by ISO-8859-1 */
+ encodingOffSet++;
}
+ textEncodingType = AV_ID3V2_ISO_8859;
+ debug_msg(RELEASE, "this text string(%s) encoded by ISO-8859-1 encodingOffSet(%d)\n", CompTmp, encodingOffSet);
+ }
- mmfile_free(pExtContent);
+ mmfile_free(pExtContent);
- if (encodingOffSet < purelyFramelen) {
- realCpyFrameNum = purelyFramelen - encodingOffSet;
- pExtContent = mmfile_malloc(realCpyFrameNum + 3);
+ if (encodingOffSet < purelyFramelen) {
+ realCpyFrameNum = purelyFramelen - encodingOffSet;
+ pExtContent = mmfile_malloc(realCpyFrameNum + 3);
- if (pExtContent == NULL) {
- debug_msg(DEBUG, "pExtContent malloc failed\n");
- continue;
- }
+ if (pExtContent == NULL) {
+ debug_msg(DEBUG, "pExtContent malloc failed\n");
+ continue;
+ }
- memset(pExtContent, '\0', realCpyFrameNum + 3);
+ memset(pExtContent, '\0', realCpyFrameNum + 3);
- if (textEncodingType != AV_ID3V2_UTF16 && textEncodingType != AV_ID3V2_UTF16_BE) {
- if (CompTmp[0] == 'T' || (strcmp(CompTmp, "APIC") == 0)) {
- debug_msg(RELEASE, "get the new text ecoding type\n");
- textEncodingType = buffer[curPos - purelyFramelen + encodingOffSet - 1];
- }
+ if (textEncodingType != AV_ID3V2_UTF16 && textEncodingType != AV_ID3V2_UTF16_BE) {
+ if (CompTmp[0] == 'T' || (strcmp(CompTmp, "APIC") == 0)) {
+ debug_msg(RELEASE, "get the new text ecoding type\n");
+ textEncodingType = buffer[curPos - purelyFramelen + encodingOffSet - 1];
}
+ }
- if (textEncodingType > AV_ID3V2_MAX) {
- debug_msg(DEBUG, "WRONG ENCOIDNG TYPE [%d], FRAME[%s]\n", textEncodingType, (char *)CompTmp);
- continue;
- }
+ if (textEncodingType > AV_ID3V2_MAX) {
+ debug_msg(DEBUG, "WRONG ENCOIDNG TYPE [%d], FRAME[%s]\n", textEncodingType, (char *)CompTmp);
+ continue;
+ }
- memcpy(pExtContent, &buffer[curPos - purelyFramelen + encodingOffSet], purelyFramelen - encodingOffSet);
- if (realCpyFrameNum > 0) {
- if (strncmp((char *)CompTmp, "COMM", 4) == 0 && pInfo->tagV2Info.bDescriptionMarked == false) {
- if (realCpyFrameNum > 3) {
- realCpyFrameNum -= 3;
- tmp = 3;
+ memcpy(pExtContent, &buffer[curPos - purelyFramelen + encodingOffSet], purelyFramelen - encodingOffSet);
+ if (realCpyFrameNum > 0) {
+ if (strncmp((char *)CompTmp, "COMM", 4) == 0 && pInfo->tagV2Info.bDescriptionMarked == false) {
+ if (realCpyFrameNum > 3) {
+ realCpyFrameNum -= 3;
+ tmp = 3;
- /*pExtContent[tmp+1] value should't have encoding value */
- if (pExtContent[tmp] == 0x00 || pExtContent[tmp] == 0xFF || pExtContent[tmp] == 0xFE) {
- textEncodingType = __id3tag_get_text_encoding_v223(pExtContent, &realCpyFrameNum, textEncodingType, &tmp);
+ /*pExtContent[tmp+1] value should't have encoding value */
+ if (pExtContent[tmp] == 0x00 || pExtContent[tmp] == 0xFF || pExtContent[tmp] == 0xFE) {
+ textEncodingType = __id3tag_get_text_encoding_v223(pExtContent, &realCpyFrameNum, textEncodingType, &tmp);
- debug_msg(RELEASE, "tmp(%d) textEncodingType(%d), realCpyFrameNum(%d)\n", tmp, textEncodingType, realCpyFrameNum);
- pInfo->pComment = mmfile_string_convert((const char *)&pExtContent[tmp], realCpyFrameNum, "UTF-8", charset_array[textEncodingType], NULL, (unsigned int *)&pInfo->commentLen);
- } else {
- debug_msg(RELEASE, "failed to get Comment Info tmp(%d), purelyFramelen - encodingOffSet(%lu)\n", tmp, purelyFramelen - encodingOffSet);
- pInfo->commentLen = 0;
- }
+ debug_msg(RELEASE, "tmp(%d) textEncodingType(%d), realCpyFrameNum(%d)\n", tmp, textEncodingType, realCpyFrameNum);
+ pInfo->pComment = mmfile_string_convert((const char *)&pExtContent[tmp], realCpyFrameNum, "UTF-8", charset_array[textEncodingType], NULL, (unsigned int *)&pInfo->commentLen);
} else {
- debug_msg(RELEASE, "Description info too small to parse realCpyFrameNum(%d)\n", realCpyFrameNum);
+ debug_msg(RELEASE, "failed to get Comment Info tmp(%d), purelyFramelen - encodingOffSet(%lu)\n", tmp, purelyFramelen - encodingOffSet);
pInfo->commentLen = 0;
}
- tmp = 0;
+ } else {
+ debug_msg(RELEASE, "Description info too small to parse realCpyFrameNum(%d)\n", realCpyFrameNum);
+ pInfo->commentLen = 0;
+ }
+ tmp = 0;
- debug_msg(RELEASE, "pInfo->pComment returned = (%s), pInfo->commentLen(%d)\n", pInfo->pComment, pInfo->commentLen);
- pInfo->tagV2Info.bDescriptionMarked = true;
- } else if (strncmp((char *)CompTmp, "SYLT", 4) == 0 && pInfo->tagV2Info.bSyncLyricsMarked == false) {
- if (realCpyFrameNum > 5) {
- realCpyFrameNum -= 5;
- tmp = 5;
+ debug_msg(RELEASE, "pInfo->pComment returned = (%s), pInfo->commentLen(%d)\n", pInfo->pComment, pInfo->commentLen);
+ pInfo->tagV2Info.bDescriptionMarked = true;
+ } else if (strncmp((char *)CompTmp, "SYLT", 4) == 0 && pInfo->tagV2Info.bSyncLyricsMarked == false) {
+ if (realCpyFrameNum > 5) {
+ realCpyFrameNum -= 5;
+ tmp = 5;
- /*pExtContent[tmp+1] value should't have encoding value */
- if (pExtContent[tmp] == 0x00 || pExtContent[tmp] == 0xFF || pExtContent[tmp] == 0xFE) {
- textEncodingType = __id3tag_get_text_encoding_v223(pExtContent, &realCpyFrameNum, textEncodingType, &tmp);
+ /*pExtContent[tmp+1] value should't have encoding value */
+ if (pExtContent[tmp] == 0x00 || pExtContent[tmp] == 0xFF || pExtContent[tmp] == 0xFE) {
+ textEncodingType = __id3tag_get_text_encoding_v223(pExtContent, &realCpyFrameNum, textEncodingType, &tmp);
- debug_msg(RELEASE, "tmp(%d) textEncodingType(%d), realCpyFrameNum(%d)\n", tmp, textEncodingType, realCpyFrameNum);
+ debug_msg(RELEASE, "tmp(%d) textEncodingType(%d), realCpyFrameNum(%d)\n", tmp, textEncodingType, realCpyFrameNum);
- __id3tag_parse_SYLT(pInfo, pExtContent, realCpyFrameNum, charset_array[textEncodingType], textEncodingType, tmp);
- } else {
- debug_msg(RELEASE, "failed to get Synchronised lyrics Info tmp(%d), purelyFramelen - encodingOffSet(%lu)\n", tmp, purelyFramelen - encodingOffSet);
- pInfo->syncLyricsNum = 0;
- }
+ __id3tag_parse_SYLT(pInfo, pExtContent, realCpyFrameNum, charset_array[textEncodingType], textEncodingType, tmp);
} else {
- debug_msg(RELEASE, "Synchronised lyrics too small to parse realCpyFrameNum(%d)\n", realCpyFrameNum);
+ debug_msg(RELEASE, "failed to get Synchronised lyrics Info tmp(%d), purelyFramelen - encodingOffSet(%lu)\n", tmp, purelyFramelen - encodingOffSet);
pInfo->syncLyricsNum = 0;
}
- tmp = 0;
-
- //debug_msg(RELEASE, "pInfo->pSyncLyrics returned = (%s), pInfo->syncLyricsNum(%d)\n", pInfo->pSyncLyrics, pInfo->syncLyricsNum);
- debug_msg(RELEASE, "pInfo->syncLyricsNum(%d)\n", pInfo->syncLyricsNum);
- pInfo->tagV2Info.bSyncLyricsMarked = true;
- } else if (strncmp((char *)CompTmp, "USLT", 4) == 0 && pInfo->tagV2Info.bUnsyncLyricsMarked == false) {
- char *lang_info = strndup((char *)pExtContent, 3);
-
- if (realCpyFrameNum > 3) {
- realCpyFrameNum -= 3;
- tmp = 3;
-
- /*find start of lyrics */
- while (1) {
- if (pExtContent[tmp] == 0x00) {
- if (pExtContent[tmp + 1] == 0x00) {
- realCpyFrameNum -= 2;
- tmp += 2;
- }
- break;
- } else {
- realCpyFrameNum--;
- tmp++;
+ } else {
+ debug_msg(RELEASE, "Synchronised lyrics too small to parse realCpyFrameNum(%d)\n", realCpyFrameNum);
+ pInfo->syncLyricsNum = 0;
+ }
+ tmp = 0;
+
+ //debug_msg(RELEASE, "pInfo->pSyncLyrics returned = (%s), pInfo->syncLyricsNum(%d)\n", pInfo->pSyncLyrics, pInfo->syncLyricsNum);
+ debug_msg(RELEASE, "pInfo->syncLyricsNum(%d)\n", pInfo->syncLyricsNum);
+ pInfo->tagV2Info.bSyncLyricsMarked = true;
+ } else if (strncmp((char *)CompTmp, "USLT", 4) == 0 && pInfo->tagV2Info.bUnsyncLyricsMarked == false) {
+ char *lang_info = strndup((char *)pExtContent, 3);
+
+ if (realCpyFrameNum > 3) {
+ realCpyFrameNum -= 3;
+ tmp = 3;
+
+ /*find start of lyrics */
+ while (1) {
+ if (pExtContent[tmp] == 0x00) {
+ if (pExtContent[tmp + 1] == 0x00) {
+ realCpyFrameNum -= 2;
+ tmp += 2;
}
+ break;
+ } else {
+ realCpyFrameNum--;
+ tmp++;
}
+ }
- /*pExtContent[tmp+1] value should't have encoding value */
- debug_msg(RELEASE, "tpExtContent[%d] %x\n", tmp, pExtContent[tmp]);
-
- if (pExtContent[tmp] == 0x00 || pExtContent[tmp] == 0xFF || pExtContent[tmp] == 0xFE) {
- textEncodingType = __id3tag_get_text_encoding_v223(pExtContent, &realCpyFrameNum, textEncodingType, &tmp);
+ /*pExtContent[tmp+1] value should't have encoding value */
+ debug_msg(RELEASE, "tpExtContent[%d] %x\n", tmp, pExtContent[tmp]);
- char *char_set = NULL;
+ if (pExtContent[tmp] == 0x00 || pExtContent[tmp] == 0xFF || pExtContent[tmp] == 0xFE) {
+ textEncodingType = __id3tag_get_text_encoding_v223(pExtContent, &realCpyFrameNum, textEncodingType, &tmp);
- debug_msg(RELEASE, "tmp(%d) textEncodingType(%d), realCpyFrameNum(%d)\n", tmp, textEncodingType, realCpyFrameNum);
+ char *char_set = NULL;
- if (textEncodingType == AV_ID3V2_ISO_8859) {
- if (lang_info != NULL && !g_ascii_strcasecmp(lang_info, "KOR")) {
- char_set = strdup("EUC-KR");
- } else {
- char_set = mmfile_get_charset((const char *)&pExtContent[tmp]);
- }
- mmfile_free(lang_info);
- }
+ debug_msg(RELEASE, "tmp(%d) textEncodingType(%d), realCpyFrameNum(%d)\n", tmp, textEncodingType, realCpyFrameNum);
- if (char_set == NULL) {
- pInfo->pUnsyncLyrics = mmfile_string_convert((const char *)&pExtContent[tmp], realCpyFrameNum, "UTF-8", charset_array[textEncodingType], NULL, (unsigned int *)&pInfo->unsynclyricsLen);
+ if (textEncodingType == AV_ID3V2_ISO_8859) {
+ if (lang_info != NULL && !g_ascii_strcasecmp(lang_info, "KOR")) {
+ char_set = strdup("EUC-KR");
} else {
- pInfo->pUnsyncLyrics = mmfile_string_convert((const char *)&pExtContent[tmp], realCpyFrameNum, "UTF-8", char_set, NULL, (unsigned int *)&pInfo->unsynclyricsLen);
- mmfile_free(char_set);
+ char_set = mmfile_get_charset((const char *)&pExtContent[tmp]);
}
+ mmfile_free(lang_info);
+ }
+
+ if (char_set == NULL) {
+ pInfo->pUnsyncLyrics = mmfile_string_convert((const char *)&pExtContent[tmp], realCpyFrameNum, "UTF-8", charset_array[textEncodingType], NULL, (unsigned int *)&pInfo->unsynclyricsLen);
} else {
- debug_msg(RELEASE, "failed to get Unsynchronised lyrics Info tmp(%d), purelyFramelen - encodingOffSet(%lu)\n", tmp, purelyFramelen - encodingOffSet);
- pInfo->unsynclyricsLen = 0;
+ pInfo->pUnsyncLyrics = mmfile_string_convert((const char *)&pExtContent[tmp], realCpyFrameNum, "UTF-8", char_set, NULL, (unsigned int *)&pInfo->unsynclyricsLen);
+ mmfile_free(char_set);
}
} else {
- debug_msg(RELEASE, "Unsynchronised lyrics too small to parse realCpyFrameNum(%d)\n", realCpyFrameNum);
+ debug_msg(RELEASE, "failed to get Unsynchronised lyrics Info tmp(%d), purelyFramelen - encodingOffSet(%lu)\n", tmp, purelyFramelen - encodingOffSet);
pInfo->unsynclyricsLen = 0;
}
- tmp = 0;
-
- debug_msg(RELEASE, "pInfo->pUnsyncLyrics returned = (%s), pInfo->unsynclyricsLen(%d)\n", pInfo->pUnsyncLyrics, pInfo->unsynclyricsLen);
- pInfo->tagV2Info.bUnsyncLyricsMarked = true;
- mmfile_free(lang_info);
} else {
- __parse_tag_info(pInfo, CompTmp, (const char *)pExtContent, realCpyFrameNum, charset_array[textEncodingType]);
+ debug_msg(RELEASE, "Unsynchronised lyrics too small to parse realCpyFrameNum(%d)\n", realCpyFrameNum);
+ pInfo->unsynclyricsLen = 0;
}
- }
+ tmp = 0;
- } else {
- debug_msg(RELEASE, "All of the pExtContent Values are NULL\n");
+ debug_msg(RELEASE, "pInfo->pUnsyncLyrics returned = (%s), pInfo->unsynclyricsLen(%d)\n", pInfo->pUnsyncLyrics, pInfo->unsynclyricsLen);
+ pInfo->tagV2Info.bUnsyncLyricsMarked = true;
+ mmfile_free(lang_info);
+ } else {
+ __parse_tag_info(pInfo, CompTmp, (const char *)pExtContent, realCpyFrameNum, charset_array[textEncodingType]);
+ }
}
- } else {
- curPos += purelyFramelen;
- if (purelyFramelen != 0)
- needToloopv2taglen = MP3_TAGv2_23_TXT_HEADER_LEN;
- debug_msg(RELEASE, "This Frame's size is Zero! purelyFramelen(%lu)\n", purelyFramelen);
+ } else {
+ debug_msg(RELEASE, "All of the pExtContent Values are NULL\n");
}
+ }
- mmfile_free(pExtContent);
- memset(CompTmp, 0, 4);
+ mmfile_free(pExtContent);
+ memset(CompTmp, 0, 4);
- if (curPos < taglen)
- needToloopv2taglen -= oneFrameLen;
- else
- needToloopv2taglen = MP3_TAGv2_23_TXT_HEADER_LEN;
+ if (curPos >= taglen)
+ break;
- oneFrameLen = 0;
- encodingOffSet = 0;
- realCpyFrameNum = 0;
- textEncodingType = 0;
- purelyFramelen = 0;
+ needToloopv2taglen -= oneFrameLen;
+
+ oneFrameLen = 0;
+ encodingOffSet = 0;
+ realCpyFrameNum = 0;
+ textEncodingType = 0;
+ purelyFramelen = 0;
- }
}
release_characterset_array(charset_array);
}
}
- if (needToloopv2taglen - MP3_TAGv2_23_TXT_HEADER_LEN > MP3_TAGv2_23_TXT_HEADER_LEN) {
- while (needToloopv2taglen > MP3_TAGv2_23_TXT_HEADER_LEN) {
- if ((buffer[curPos] < '0' || buffer[curPos] > 'Z') || (buffer[curPos + 1] < '0' || buffer[curPos + 1] > 'Z')
- || (buffer[curPos + 2] < '0' || buffer[curPos + 2] > 'Z') || (buffer[curPos + 3] < '0' || buffer[curPos + 3] > 'Z'))
- break;
-
- memcpy(CompTmp, &buffer[curPos], 4);
-
- CompTmp[4] = 0;
- oneFrameLen = MP3_TAGv2_23_TXT_HEADER_LEN;
- oneFrameLen += (unsigned long)buffer[4 + curPos] << 21 | (unsigned long)buffer[5 + curPos] << 14
- | (unsigned long)buffer[6 + curPos] << 7 | (unsigned long)buffer[7 + curPos];
- if (oneFrameLen > taglen - curPos)
- break;
-
- purelyFramelen = oneFrameLen - MP3_TAGv2_23_TXT_HEADER_LEN;
- curPos += MP3_TAGv2_23_TXT_HEADER_LEN;
+ while (needToloopv2taglen > MP3_TAGv2_23_TXT_HEADER_LEN) {
+ if ((buffer[curPos] < '0' || buffer[curPos] > 'Z') || (buffer[curPos + 1] < '0' || buffer[curPos + 1] > 'Z')
+ || (buffer[curPos + 2] < '0' || buffer[curPos + 2] > 'Z') || (buffer[curPos + 3] < '0' || buffer[curPos + 3] > 'Z'))
+ break;
- debug_msg(RELEASE, "-----------------------------------------------------------------------------------\n");
+ memcpy(CompTmp, &buffer[curPos], 4);
- if (oneFrameLen > MP3_TAGv2_23_TXT_HEADER_LEN && purelyFramelen <= taglen - curPos) {
- curPos += purelyFramelen;
+ CompTmp[4] = 0;
+ oneFrameLen = MP3_TAGv2_23_TXT_HEADER_LEN;
+ oneFrameLen += (unsigned long)buffer[4 + curPos] << 21 | (unsigned long)buffer[5 + curPos] << 14
+ | (unsigned long)buffer[6 + curPos] << 7 | (unsigned long)buffer[7 + curPos];
+ if (oneFrameLen > taglen - curPos)
+ break;
- /*in case of UTF 16 encoding */
- /*buffer+(curPos-purelyFramelen) data should '0x01' but in order to expansion, we don't accurately check the value. */
- if (IS_ENCODEDBY_UTF16(buffer + (curPos - purelyFramelen))) {
- encodingOffSet = 2;
- textEncodingType = AV_ID3V2_UTF16;
- } else if (IS_ENCODEDBY_UTF16_R(buffer + (curPos - purelyFramelen))) {
- encodingOffSet = 2;
- textEncodingType = AV_ID3V2_UTF16_BE;
- } else if (IS_ENCODEDBY_UTF16(buffer + (curPos - purelyFramelen + 1))) {
- encodingOffSet = 3;
- textEncodingType = AV_ID3V2_UTF16;
- } else if (IS_ENCODEDBY_UTF16_R(buffer + (curPos - purelyFramelen + 1))) {
- encodingOffSet = 3;
+ purelyFramelen = oneFrameLen - MP3_TAGv2_23_TXT_HEADER_LEN;
+ curPos += oneFrameLen;
+
+ debug_msg(RELEASE, "-----------------------------------------------------------------------------------\n");
+
+ if (purelyFramelen > 0) {
+ /*in case of UTF 16 encoding */
+ /*buffer+(curPos-purelyFramelen) data should '0x01' but in order to expansion, we don't accurately check the value. */
+ if (IS_ENCODEDBY_UTF16(buffer + (curPos - purelyFramelen))) {
+ encodingOffSet = 2;
+ textEncodingType = AV_ID3V2_UTF16;
+ } else if (IS_ENCODEDBY_UTF16_R(buffer + (curPos - purelyFramelen))) {
+ encodingOffSet = 2;
+ textEncodingType = AV_ID3V2_UTF16_BE;
+ } else if (IS_ENCODEDBY_UTF16(buffer + (curPos - purelyFramelen + 1))) {
+ encodingOffSet = 3;
+ textEncodingType = AV_ID3V2_UTF16;
+ } else if (IS_ENCODEDBY_UTF16_R(buffer + (curPos - purelyFramelen + 1))) {
+ encodingOffSet = 3;
+ textEncodingType = AV_ID3V2_UTF16_BE;
+ } else {
+ /*in case of UTF-16 BE encoding */
+ if (buffer[curPos - purelyFramelen] == 0x02) {
+ encodingOffSet = 1;
+ while ((buffer[curPos - purelyFramelen + encodingOffSet] == '\0') && (encodingOffSet < purelyFramelen))
+ encodingOffSet++;/*null skip! */
textEncodingType = AV_ID3V2_UTF16_BE;
- } else {
- /*in case of UTF-16 BE encoding */
- if (buffer[curPos - purelyFramelen] == 0x02) {
- encodingOffSet = 1;
- while ((buffer[curPos - purelyFramelen + encodingOffSet] == '\0') && (encodingOffSet < purelyFramelen))
- encodingOffSet++;/*null skip! */
- textEncodingType = AV_ID3V2_UTF16_BE;
- }
- /*in case of UTF8 encoding */
- else if (buffer[curPos - purelyFramelen] == 0x03) {
- encodingOffSet = 1;
- while ((buffer[curPos - purelyFramelen + encodingOffSet] == '\0') && (encodingOffSet < purelyFramelen))
- encodingOffSet++;/*null skip! */
- textEncodingType = AV_ID3V2_UTF8;
- }
- /*in case of ISO-8859-1 encoding */
- else {
- /*buffer+(curPos-purelyFramelen) data should 0x00 but in order to expansion, we don't accurately check the value. */
- encodingOffSet = 1;
- while ((buffer[curPos - purelyFramelen + encodingOffSet] < 0x20) && (encodingOffSet < purelyFramelen))
- encodingOffSet++;/*less than 0x20 value skip! */
- textEncodingType = AV_ID3V2_ISO_8859;
- }
}
+ /*in case of UTF8 encoding */
+ else if (buffer[curPos - purelyFramelen] == 0x03) {
+ encodingOffSet = 1;
+ while ((buffer[curPos - purelyFramelen + encodingOffSet] == '\0') && (encodingOffSet < purelyFramelen))
+ encodingOffSet++;/*null skip! */
+ textEncodingType = AV_ID3V2_UTF8;
+ }
+ /*in case of ISO-8859-1 encoding */
+ else {
+ /*buffer+(curPos-purelyFramelen) data should 0x00 but in order to expansion, we don't accurately check the value. */
+ encodingOffSet = 1;
+ while ((buffer[curPos - purelyFramelen + encodingOffSet] < 0x20) && (encodingOffSet < purelyFramelen))
+ encodingOffSet++;/*less than 0x20 value skip! */
+ textEncodingType = AV_ID3V2_ISO_8859;
+ }
+ }
- mmfile_free(pExtContent);
-
- if (encodingOffSet < purelyFramelen) {
- realCpyFrameNum = purelyFramelen - encodingOffSet;
- pExtContent = mmfile_malloc(realCpyFrameNum + 3);
+ mmfile_free(pExtContent);
- if (pExtContent == NULL) {
- debug_error(DEBUG, "out of memoryu for id3tag parse\n");
- continue;
- }
+ if (encodingOffSet < purelyFramelen) {
+ realCpyFrameNum = purelyFramelen - encodingOffSet;
+ pExtContent = mmfile_malloc(realCpyFrameNum + 3);
- memset(pExtContent, '\0', realCpyFrameNum + 3);
+ if (pExtContent == NULL) {
+ debug_error(DEBUG, "out of memoryu for id3tag parse\n");
+ continue;
+ }
- if (textEncodingType != AV_ID3V2_UTF16 && textEncodingType != AV_ID3V2_UTF16_BE) {
- if (CompTmp[0] == 'T' || (strcmp(CompTmp, "APIC") == 0)) {
- debug_msg(RELEASE, "get the new text ecoding type\n");
- textEncodingType = buffer[curPos - purelyFramelen + encodingOffSet - 1];
- }
- }
+ memset(pExtContent, '\0', realCpyFrameNum + 3);
- if (textEncodingType > AV_ID3V2_MAX) {
- debug_msg(DEBUG, "WRONG ENCOIDNG TYPE [%d], FRAME[%s]\n", textEncodingType, (char *)CompTmp);
- continue;
+ if (textEncodingType != AV_ID3V2_UTF16 && textEncodingType != AV_ID3V2_UTF16_BE) {
+ if (CompTmp[0] == 'T' || (strcmp(CompTmp, "APIC") == 0)) {
+ debug_msg(RELEASE, "get the new text ecoding type\n");
+ textEncodingType = buffer[curPos - purelyFramelen + encodingOffSet - 1];
}
+ }
- memcpy(pExtContent, &buffer[curPos - purelyFramelen + encodingOffSet], purelyFramelen - encodingOffSet);
+ if (textEncodingType > AV_ID3V2_MAX) {
+ debug_msg(DEBUG, "WRONG ENCOIDNG TYPE [%d], FRAME[%s]\n", textEncodingType, (char *)CompTmp);
+ continue;
+ }
- if (realCpyFrameNum > 0) {
- if (strncmp((char *)CompTmp, "COMM", 4) == 0 && pInfo->tagV2Info.bDescriptionMarked == false) {
- if (realCpyFrameNum > 3) {
- realCpyFrameNum -= 3;
- tmp = 3;
+ memcpy(pExtContent, &buffer[curPos - purelyFramelen + encodingOffSet], purelyFramelen - encodingOffSet);
- textEncodingType = __id3tag_get_text_encoding_v224(pExtContent, &realCpyFrameNum, textEncodingType, &tmp);
- debug_msg(RELEASE, "tmp(%d) textEncodingType(%d), realCpyFrameNum(%d)\n", tmp, textEncodingType, realCpyFrameNum);
+ if (realCpyFrameNum > 0) {
+ if (strncmp((char *)CompTmp, "COMM", 4) == 0 && pInfo->tagV2Info.bDescriptionMarked == false) {
+ if (realCpyFrameNum > 3) {
+ realCpyFrameNum -= 3;
+ tmp = 3;
- pInfo->pComment = mmfile_string_convert((const char *)&pExtContent[tmp], realCpyFrameNum, "UTF-8", charset_array[textEncodingType], NULL, (unsigned int *)&pInfo->commentLen);
- } else {
- debug_msg(RELEASE, "Description info too small to parse realCpyFrameNum(%d)\n", realCpyFrameNum);
- }
+ textEncodingType = __id3tag_get_text_encoding_v224(pExtContent, &realCpyFrameNum, textEncodingType, &tmp);
+ debug_msg(RELEASE, "tmp(%d) textEncodingType(%d), realCpyFrameNum(%d)\n", tmp, textEncodingType, realCpyFrameNum);
- tmp = 0;
-
- debug_msg(RELEASE, "pInfo->pComment returned = (%s), pInfo->commentLen(%d)\n", pInfo->pComment, pInfo->commentLen);
- pInfo->tagV2Info.bDescriptionMarked = true;
- } else if (strncmp((char *)CompTmp, "SYLT", 4) == 0 && pInfo->tagV2Info.bSyncLyricsMarked == false) {
- if (realCpyFrameNum > 5) {
- realCpyFrameNum -= 5;
- tmp = 5;
+ pInfo->pComment = mmfile_string_convert((const char *)&pExtContent[tmp], realCpyFrameNum, "UTF-8", charset_array[textEncodingType], NULL, (unsigned int *)&pInfo->commentLen);
+ } else {
+ debug_msg(RELEASE, "Description info too small to parse realCpyFrameNum(%d)\n", realCpyFrameNum);
+ }
- textEncodingType = __id3tag_get_text_encoding_v224(pExtContent, &realCpyFrameNum, textEncodingType, &tmp);
- debug_msg(RELEASE, "tmp(%d) textEncodingType(%d), realCpyFrameNum(%d)\n", tmp, textEncodingType, realCpyFrameNum);
+ tmp = 0;
- __id3tag_parse_SYLT(pInfo, pExtContent, realCpyFrameNum, charset_array[textEncodingType], textEncodingType, tmp);
- } else {
- debug_msg(RELEASE, "SyncLyrics info too small to parse realCpyFrameNum(%d)\n", realCpyFrameNum);
- }
+ debug_msg(RELEASE, "pInfo->pComment returned = (%s), pInfo->commentLen(%d)\n", pInfo->pComment, pInfo->commentLen);
+ pInfo->tagV2Info.bDescriptionMarked = true;
+ } else if (strncmp((char *)CompTmp, "SYLT", 4) == 0 && pInfo->tagV2Info.bSyncLyricsMarked == false) {
+ if (realCpyFrameNum > 5) {
+ realCpyFrameNum -= 5;
+ tmp = 5;
- tmp = 0;
- pInfo->tagV2Info.bSyncLyricsMarked = true;
- } else if (strncmp((char *)CompTmp, "USLT", 4) == 0 && pInfo->tagV2Info.bUnsyncLyricsMarked == false) {
- if (realCpyFrameNum > 3) {
- realCpyFrameNum -= 3;
- tmp = 3;
+ textEncodingType = __id3tag_get_text_encoding_v224(pExtContent, &realCpyFrameNum, textEncodingType, &tmp);
+ debug_msg(RELEASE, "tmp(%d) textEncodingType(%d), realCpyFrameNum(%d)\n", tmp, textEncodingType, realCpyFrameNum);
- textEncodingType = __id3tag_get_text_encoding_v224(pExtContent, &realCpyFrameNum, textEncodingType, &tmp);
- debug_msg(RELEASE, "tmp(%d) textEncodingType(%d), realCpyFrameNum(%d)\n", tmp, textEncodingType, realCpyFrameNum);
+ __id3tag_parse_SYLT(pInfo, pExtContent, realCpyFrameNum, charset_array[textEncodingType], textEncodingType, tmp);
+ } else {
+ debug_msg(RELEASE, "SyncLyrics info too small to parse realCpyFrameNum(%d)\n", realCpyFrameNum);
+ }
- pInfo->pUnsyncLyrics = mmfile_string_convert((const char *)&pExtContent[tmp], realCpyFrameNum, "UTF-8", charset_array[textEncodingType], NULL, (unsigned int *)&pInfo->unsynclyricsLen);
- } else {
- debug_msg(RELEASE, "Description info too small to parse realCpyFrameNum(%d)\n", realCpyFrameNum);
- }
+ tmp = 0;
+ pInfo->tagV2Info.bSyncLyricsMarked = true;
+ } else if (strncmp((char *)CompTmp, "USLT", 4) == 0 && pInfo->tagV2Info.bUnsyncLyricsMarked == false) {
+ if (realCpyFrameNum > 3) {
+ realCpyFrameNum -= 3;
+ tmp = 3;
- tmp = 0;
+ textEncodingType = __id3tag_get_text_encoding_v224(pExtContent, &realCpyFrameNum, textEncodingType, &tmp);
+ debug_msg(RELEASE, "tmp(%d) textEncodingType(%d), realCpyFrameNum(%d)\n", tmp, textEncodingType, realCpyFrameNum);
- debug_msg(RELEASE, "pInfo->pUnsyncLyrics returned = (%s), pInfo->unsynclyricsLen(%d)\n", pInfo->pUnsyncLyrics, pInfo->unsynclyricsLen);
- pInfo->tagV2Info.bDescriptionMarked = true;
+ pInfo->pUnsyncLyrics = mmfile_string_convert((const char *)&pExtContent[tmp], realCpyFrameNum, "UTF-8", charset_array[textEncodingType], NULL, (unsigned int *)&pInfo->unsynclyricsLen);
} else {
- __parse_tag_info(pInfo, CompTmp, (const char *)pExtContent, realCpyFrameNum, charset_array[textEncodingType]);
+ debug_msg(RELEASE, "Description info too small to parse realCpyFrameNum(%d)\n", realCpyFrameNum);
}
- }
- } else {
- debug_msg(RELEASE, "mmf_file_id3tag_parse_v224: All of the pExtContent Values are NULL\n");
+ tmp = 0;
+
+ debug_msg(RELEASE, "pInfo->pUnsyncLyrics returned = (%s), pInfo->unsynclyricsLen(%d)\n", pInfo->pUnsyncLyrics, pInfo->unsynclyricsLen);
+ pInfo->tagV2Info.bDescriptionMarked = true;
+ } else {
+ __parse_tag_info(pInfo, CompTmp, (const char *)pExtContent, realCpyFrameNum, charset_array[textEncodingType]);
+ }
}
} else {
- curPos += purelyFramelen;
- if (purelyFramelen != 0)
- needToloopv2taglen = MP3_TAGv2_23_TXT_HEADER_LEN;
+ debug_msg(RELEASE, "mmf_file_id3tag_parse_v224: All of the pExtContent Values are NULL\n");
}
- mmfile_free(pExtContent);
- memset(CompTmp, 0, 4);
- if (curPos < taglen)
- needToloopv2taglen -= oneFrameLen;
- else
- needToloopv2taglen = MP3_TAGv2_23_TXT_HEADER_LEN;
+ }
- oneFrameLen = 0;
- encodingOffSet = 0;
- realCpyFrameNum = 0;
- textEncodingType = 0;
- purelyFramelen = 0;
+ mmfile_free(pExtContent);
+ memset(CompTmp, 0, 4);
+
+ if (curPos >= taglen)
+ break;
+
+ needToloopv2taglen -= oneFrameLen;
+
+ oneFrameLen = 0;
+ encodingOffSet = 0;
+ realCpyFrameNum = 0;
+ textEncodingType = 0;
+ purelyFramelen = 0;
- }
}
release_characterset_array(charset_array);