static unsigned char gTagJPEGHeader[] = {0xff, 0xd8, 0xff };
static unsigned char gTagPNGHeader[] = {0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a };
+typedef struct _mmfileid3taginfo {
+ char name[4];
+ unsigned int int_name;
+ AvID3TagList tag;
+} MMFILE_ID3TAG_INFO;
+
+#define ID3TAG_NUM_V22 16
+#define ID3TAG_NUM_V23 21
+
+MMFILE_ID3TAG_INFO tag_info_v22[ID3TAG_NUM_V22] = {
+ {"TT2", 21170, AV_ID3TAG_TITLE},
+ {"TP1", 21041, AV_ID3TAG_ARTIST},
+ {"TP2", 21042, AV_ID3TAG_ALBUM_ARTIST},
+ {"TP3", 21043, AV_ID3TAG_CONDUCTOR},
+ {"TAL", 20588, AV_ID3TAG_ALBUM},
+ {"TYE", 21349, AV_ID3TAG_YEAR},
+ {"COM", 3629, AV_ID3TAG_COMMENT},
+ {"TCO", 20655, AV_ID3TAG_GENRE},
+ {"TRK", 21131, AV_ID3TAG_TRACKNUM},
+ {"PIC", 16739, AV_ID3TAG_PICTURE},
+ {"TEN", 20718, AV_ID3TAG_ENCBY},
+ {"WXX", 24408, AV_ID3TAG_URL},
+ {"TCR", 20658, AV_ID3TAG_COPYRIGHT},
+ {"TOA", 21025, AV_ID3TAG_ORIGIN_ARTIST},
+ {"TCM", 20653, AV_ID3TAG_COMPOSER},
+ {"TRD", 21124, AV_ID3TAG_RECDATE},
+};
+
+MMFILE_ID3TAG_INFO tag_info_v23[ID3TAG_NUM_V23] = {
+ {"TIT2", 665266, AV_ID3TAG_TITLE},
+ {"TPE1", 671953, AV_ID3TAG_ARTIST},
+ {"TPE2", 671954, AV_ID3TAG_ALBUM_ARTIST},
+ {"TPE3", 671955, AV_ID3TAG_CONDUCTOR},
+ {"TALB", 656834, AV_ID3TAG_ALBUM},
+ {"TYER", 681202, AV_ID3TAG_YEAR},
+ {"COMM", 114157, AV_ID3TAG_COMMENT},
+ {"TCON", 658990, AV_ID3TAG_GENRE},
+ {"TRCK", 673963, AV_ID3TAG_TRACKNUM},
+ {"APIC", 49507, AV_ID3TAG_PICTURE},
+ {"TENC", 660995, AV_ID3TAG_ENCBY},
+ {"WXXX", 779096, AV_ID3TAG_URL},
+ {"TCOP", 658992, AV_ID3TAG_COPYRIGHT},
+ {"TOPE", 671301, AV_ID3TAG_ORIGIN_ARTIST},
+ {"TCOM", 658989, AV_ID3TAG_COMPOSER},
+ {"TDRA", 660097, AV_ID3TAG_RECDATE}, /*Recdate for 2.3*/
+ {"USLT", 708052, AV_ID3TAG_UNSYNCLYRICS},
+ {"SYLT", 648660, AV_ID3TAG_SYNCLYRICS},
+ {"TPOS", 672307, AV_ID3TAG_PART_OF_SET},
+ {"TIT1", 665265, AV_ID3TAG_CONTENT_GROUP}, /*Content Group for 2.4*/
+ {"TDRC", 660099, AV_ID3TAG_RECDATE}, /*Recdate for 2.4*/
+};
+
static int GetJunkCounterLimit(void);
static int GetStringFromTextTagBox(MMFileFormatContext *formatContext, MMFileIOHandle *fp, MMFILE_MP4_BASIC_BOX_HEADER *basic_header, eMMFILE_3GP_TEXT_TAG eTag)
goto exception;
}
- formatContext->title = mmfile_strdup((const char *)tagInfo.pTitle);
- formatContext->artist = mmfile_strdup((const char *)tagInfo.pArtist);
- formatContext->copyright = mmfile_strdup((const char *)tagInfo.pCopyright);
- formatContext->comment = mmfile_strdup((const char *)tagInfo.pComment);
- formatContext->album = mmfile_strdup((const char *)tagInfo.pAlbum);
- formatContext->album_artist = mmfile_strdup((const char *)tagInfo.pAlbum_Artist);
- formatContext->year = mmfile_strdup((const char *)tagInfo.pYear);
- formatContext->genre = mmfile_strdup((const char *)tagInfo.pGenre);
- formatContext->tagTrackNum = mmfile_strdup((const char *)tagInfo.pTrackNum);
- formatContext->composer = mmfile_strdup((const char *)tagInfo.pComposer);
- formatContext->classification = mmfile_strdup((const char *)tagInfo.pContentGroup);
- formatContext->conductor = mmfile_strdup((const char *)tagInfo.pConductor);
+ formatContext->title = mmfile_strdup((const char *)tagInfo.tagInfo[AV_ID3TAG_TITLE].value);
+ formatContext->artist = mmfile_strdup((const char *)tagInfo.tagInfo[AV_ID3TAG_ARTIST].value);
+ formatContext->copyright = mmfile_strdup((const char *)tagInfo.tagInfo[AV_ID3TAG_COPYRIGHT].value);
+ formatContext->comment = mmfile_strdup((const char *)tagInfo.tagInfo[AV_ID3TAG_COMMENT].value);
+ formatContext->album = mmfile_strdup((const char *)tagInfo.tagInfo[AV_ID3TAG_ALBUM].value);
+ formatContext->album_artist = mmfile_strdup((const char *)tagInfo.tagInfo[AV_ID3TAG_ALBUM_ARTIST].value);
+ formatContext->year = mmfile_strdup((const char *)tagInfo.tagInfo[AV_ID3TAG_YEAR].value);
+ formatContext->genre = mmfile_strdup((const char *)tagInfo.tagInfo[AV_ID3TAG_GENRE].value);
+ formatContext->tagTrackNum = mmfile_strdup((const char *)tagInfo.tagInfo[AV_ID3TAG_TRACKNUM].value);
+ formatContext->composer = mmfile_strdup((const char *)tagInfo.tagInfo[AV_ID3TAG_COMPOSER].value);
+ formatContext->classification = mmfile_strdup((const char *)tagInfo.tagInfo[AV_ID3TAG_CONTENT_GROUP].value);
+ formatContext->conductor = mmfile_strdup((const char *)tagInfo.tagInfo[AV_ID3TAG_CONDUCTOR].value);
formatContext->artwork = mmfile_malloc(tagInfo.imageInfo.imageLen);
if ((tagInfo.imageInfo.imageLen > 0) && formatContext->artwork) {
static void init_content_info(AvFileContentInfo *pInfo)
{
- pInfo->tagV2Info.bTitleMarked = false;
- pInfo->tagV2Info.bArtistMarked = false;
- pInfo->tagV2Info.bAlbumMarked = false;
- pInfo->tagV2Info.bAlbum_ArtistMarked = false;
- pInfo->tagV2Info.bYearMarked = false;
- pInfo->tagV2Info.bDescriptionMarked = false;
- pInfo->tagV2Info.bGenreMarked = false;
- pInfo->tagV2Info.bTrackNumMarked = false;
- pInfo->tagV2Info.bEncByMarked = false;
- pInfo->tagV2Info.bURLMarked = false;
- pInfo->tagV2Info.bCopyRightMarked = false;
- pInfo->tagV2Info.bOriginArtistMarked = false;
- pInfo->tagV2Info.bComposerMarked = false;
- pInfo->tagV2Info.bImageMarked = false;
-
- pInfo->tagV2Info.bRecDateMarked = false;
- pInfo->tagV2Info.bContentGroupMarked = false;
-
- pInfo->tagV2Info.bUnsyncLyricsMarked = false;
- pInfo->tagV2Info.bSyncLyricsMarked = false;
- pInfo->tagV2Info.bConductorMarked = false;
+ int i=0;
+
+ for(i = 0; i < AV_ID3TAG_MAX; i++) {
+ pInfo->tagInfo[i].length = 0;
+ pInfo->tagInfo[i].value = NULL;
+ pInfo->tagInfo[i].marked = false;
+ }
pInfo->imageInfo.bURLInfo = false;
pInfo->imageInfo.pImageBuf = NULL;
if (nTagLen < MMFILE_SYNC_LYRIC_INFO_MIN_LEN) {
debug_msg(RELEASE, "failed to get Synchronised lyrics Info realCpyFramNum(%d)\n", nTagLen);
- pInfo->syncLyricsNum = 0;
+ pInfo->tagInfo[AV_ID3TAG_SYNCLYRICS].length = 0;
return;
}
}
pInfo->pSyncLyrics = synclyrics_info_list;
- pInfo->syncLyricsNum = g_list_length(pInfo->pSyncLyrics);
+ pInfo->tagInfo[AV_ID3TAG_SYNCLYRICS].length = g_list_length(pInfo->pSyncLyrics);
}
static bool __id3tag_parse_PIC_format(AvFileContentInfo *pInfo, unsigned char *pTagVal, int *offset)
pInfo->imageInfo.bURLInfo = true;
}
-static void _mm_file_id3tag_parse_PIC(AvFileContentInfo *pInfo, unsigned char *pTagVal, int nTagLen, const char *pCharSet)
+static bool _mm_file_id3tag_parse_PIC(AvFileContentInfo *pInfo, unsigned char *pTagVal, int nTagLen, const char *pCharSet)
{
/* current position to read pTagVal */
int offset = 0;
debug_fenter(RELEASE);
- if (!__id3tag_parse_PIC_format(pInfo, pTagVal, &offset))
+ if (!__id3tag_parse_PIC_format(pInfo, pTagVal, &offset)) {
debug_msg(RELEASE, "PIC is not valid\n");
+ return false;
+ }
__id3tag_parse_APIC_pictype(pInfo, pTagVal, &offset);
__id3tag_parse_APIC_desc(pInfo, pTagVal, nTagLen, pCharSet, &offset);
__id3tag_parse_APIC_picture(pInfo, pTagVal, nTagLen, &offset);
debug_fleave(RELEASE);
+
+ return true;
}
static bool _mm_file_id3tag_parse_APIC(AvFileContentInfo *pInfo, unsigned char *pTagVal, int nTagLen, const char *pCharSet)
debug_msg(RELEASE, "ID3tag v110--------------------------------------------------------------\n");
- if (pInfo->tagV2Info.bTitleMarked == false) {
- pFullStr = mmfile_string_convert((const char *)&buffer[3], MP3_ID3_TITLE_LENGTH, "UTF-8", locale, NULL, (unsigned int *)&pInfo->titleLen);
+ if (pInfo->tagInfo[AV_ID3TAG_TITLE].marked == false) {
+ pFullStr = mmfile_string_convert((const char *)&buffer[3], MP3_ID3_TITLE_LENGTH, "UTF-8", locale, NULL, (unsigned int *)&pInfo->tagInfo[AV_ID3TAG_TITLE].length);
if (pFullStr != NULL) {
- pInfo->pTitle = rtrimN(pFullStr);
+ pInfo->tagInfo[AV_ID3TAG_TITLE].value = rtrimN(pFullStr);
free(pFullStr);
}
- debug_msg(RELEASE, "pInfo->pTitle returned =(%s), pInfo->titleLen(%d)\n", pInfo->pTitle, pInfo->titleLen);
+ debug_msg(RELEASE, "pInfo->pTitle returned =(%s), pInfo->titleLen(%d)\n", pInfo->tagInfo[AV_ID3TAG_TITLE].value, pInfo->tagInfo[AV_ID3TAG_TITLE].length);
}
- if (pInfo->tagV2Info.bArtistMarked == false) {
- pFullStr = mmfile_string_convert((const char *)&buffer[33], MP3_ID3_ARTIST_LENGTH, "UTF-8", locale, NULL, (unsigned int *)&pInfo->artistLen);
+ if (pInfo->tagInfo[AV_ID3TAG_ARTIST].marked == false) {
+ pFullStr = mmfile_string_convert((const char *)&buffer[33], MP3_ID3_ARTIST_LENGTH, "UTF-8", locale, NULL, (unsigned int *)&pInfo->tagInfo[AV_ID3TAG_ARTIST].length);
if (pFullStr != NULL) {
- pInfo->pArtist = rtrimN(pFullStr);
+ pInfo->tagInfo[AV_ID3TAG_ARTIST].value = rtrimN(pFullStr);
free(pFullStr);
}
- debug_msg(RELEASE, "pInfo->pArtist returned =(%s), pInfo->artistLen(%d)\n", pInfo->pArtist, pInfo->artistLen);
+ debug_msg(RELEASE, "pInfo->pArtist returned =(%s), pInfo->artistLen(%d)\n", pInfo->tagInfo[AV_ID3TAG_ARTIST].value, pInfo->tagInfo[AV_ID3TAG_ARTIST].length);
}
- if (pInfo->tagV2Info.bAlbumMarked == false) {
- pFullStr = mmfile_string_convert((const char *)&buffer[63], MP3_ID3_ALBUM_LENGTH, "UTF-8", locale, NULL, (unsigned int *)&pInfo->albumLen);
+ if (pInfo->tagInfo[AV_ID3TAG_ALBUM].marked == false) {
+ pFullStr = mmfile_string_convert((const char *)&buffer[63], MP3_ID3_ALBUM_LENGTH, "UTF-8", locale, NULL, (unsigned int *)&pInfo->tagInfo[AV_ID3TAG_ALBUM].length);
if (pFullStr != NULL) {
- pInfo->pAlbum = rtrimN(pFullStr);
+ pInfo->tagInfo[AV_ID3TAG_ALBUM].value = rtrimN(pFullStr);
free(pFullStr);
}
- debug_msg(RELEASE, "pInfo->pAlbum returned =(%s), pInfo->albumLen(%d)\n", pInfo->pAlbum, pInfo->albumLen);
+ debug_msg(RELEASE, "pInfo->pAlbum returned =(%s), pInfo->albumLen(%d)\n", pInfo->tagInfo[AV_ID3TAG_ALBUM].value, pInfo->tagInfo[AV_ID3TAG_ALBUM].length);
}
- if (pInfo->tagV2Info.bYearMarked == false) {
+ if (pInfo->tagInfo[AV_ID3TAG_YEAR].marked == false) {
- pInfo->pYear = mmfile_string_convert((const char *)&buffer[93], MP3_ID3_YEAR_LENGTH, "UTF-8", locale, NULL, (unsigned int *)&pInfo->yearLen);
+ pInfo->tagInfo[AV_ID3TAG_YEAR].value = mmfile_string_convert((const char *)&buffer[93], MP3_ID3_YEAR_LENGTH, "UTF-8", locale, NULL, (unsigned int *)&pInfo->tagInfo[AV_ID3TAG_YEAR].length);
- debug_msg(RELEASE, "pInfo->pYear returned =(%s), pInfo->yearLen(%d)\n", pInfo->pYear, pInfo->yearLen);
+ debug_msg(RELEASE, "pInfo->pYear returned =(%s), pInfo->yearLen(%d)\n", pInfo->tagInfo[AV_ID3TAG_YEAR].value, pInfo->tagInfo[AV_ID3TAG_YEAR].length);
- if (pInfo->pYear == NULL) { /*Use same logic with ffmpeg*/
- pInfo->pYear = get_string((const char *)&buffer[93], MP3_ID3_YEAR_LENGTH, (int *)&pInfo->yearLen);
- debug_msg(RELEASE, "pInfo->pYear returned =(%s), pInfo->yearLen(%d)\n", pInfo->pYear, pInfo->yearLen);
+ if (pInfo->tagInfo[AV_ID3TAG_YEAR].value == NULL) { /*Use same logic with ffmpeg*/
+ pInfo->tagInfo[AV_ID3TAG_YEAR].value = get_string((const char *)&buffer[93], MP3_ID3_YEAR_LENGTH, (int *)&pInfo->tagInfo[AV_ID3TAG_YEAR].length);
+ debug_msg(RELEASE, "pInfo->pYear returned =(%s), pInfo->yearLen(%d)\n", pInfo->tagInfo[AV_ID3TAG_YEAR].value, pInfo->tagInfo[AV_ID3TAG_YEAR].length);
}
}
- if (pInfo->tagV2Info.bDescriptionMarked == false) {
- pInfo->pComment = mmfile_string_convert((const char *)&buffer[97], MP3_ID3_DESCRIPTION_LENGTH, "UTF-8", locale, NULL, (unsigned int *)&pInfo->commentLen);
- debug_msg(RELEASE, "pInfo->pComment returned =(%s), pInfo->commentLen(%d)\n", pInfo->pComment, pInfo->commentLen);
+ if (pInfo->tagInfo[AV_ID3TAG_COMMENT].marked == false) {
+ pInfo->tagInfo[AV_ID3TAG_COMMENT].value = mmfile_string_convert((const char *)&buffer[97], MP3_ID3_DESCRIPTION_LENGTH, "UTF-8", locale, NULL, (unsigned int *)&pInfo->tagInfo[AV_ID3TAG_COMMENT].length);
+ debug_msg(RELEASE, "pInfo->pComment returned =(%s), pInfo->commentLen(%d)\n", pInfo->tagInfo[AV_ID3TAG_COMMENT].value, pInfo->tagInfo[AV_ID3TAG_COMMENT].length);
- if (pInfo->pComment == NULL) { /*Use same logic with ffmpeg*/
- pInfo->pComment = get_string((const char *)&buffer[97], MP3_ID3_DESCRIPTION_LENGTH, (int *)&pInfo->commentLen);
- debug_msg(RELEASE, "pInfo->pComment returned =(%s), pInfo->commentLen(%d)\n", pInfo->pComment, pInfo->commentLen);
+ if (pInfo->tagInfo[AV_ID3TAG_COMMENT].value == NULL) { /*Use same logic with ffmpeg*/
+ pInfo->tagInfo[AV_ID3TAG_COMMENT].value = get_string((const char *)&buffer[97], MP3_ID3_DESCRIPTION_LENGTH, (int *)&pInfo->tagInfo[AV_ID3TAG_COMMENT]);
+ debug_msg(RELEASE, "pInfo->pComment returned =(%s), pInfo->commentLen(%d)\n", pInfo->tagInfo[AV_ID3TAG_COMMENT].value, pInfo->tagInfo[AV_ID3TAG_COMMENT].length);
}
}
- if (pInfo->tagV2Info.bTrackNumMarked == false) {
- pInfo->pTrackNum = mmfile_malloc(ID3TAG_V110_TRACK_NUM_DIGIT);
- if (pInfo->pTrackNum != NULL) {
- pInfo->pTrackNum[ID3TAG_V110_TRACK_NUM_DIGIT - 1] = 0;
- snprintf(pInfo->pTrackNum, ID3TAG_V110_TRACK_NUM_DIGIT, "%04d", (int)buffer[126]);
- pInfo->tracknumLen = strlen(pInfo->pTrackNum);
+ if (pInfo->tagInfo[AV_ID3TAG_TRACKNUM].marked == false) {
+ pInfo->tagInfo[AV_ID3TAG_TRACKNUM].value = mmfile_malloc(ID3TAG_V110_TRACK_NUM_DIGIT);
+ if (pInfo->tagInfo[AV_ID3TAG_TRACKNUM].value != NULL) {
+ pInfo->tagInfo[AV_ID3TAG_TRACKNUM].value[ID3TAG_V110_TRACK_NUM_DIGIT - 1] = 0;
+ snprintf(pInfo->tagInfo[AV_ID3TAG_TRACKNUM].value, ID3TAG_V110_TRACK_NUM_DIGIT, "%04d", (int)buffer[126]);
+ pInfo->tagInfo[AV_ID3TAG_TRACKNUM].length = strlen(pInfo->tagInfo[AV_ID3TAG_TRACKNUM].value);
- debug_msg(RELEASE, "pInfo->pTrackNum returned =(%s), pInfo->tracknumLen(%d)\n", pInfo->pTrackNum, pInfo->tracknumLen);
+ debug_msg(RELEASE, "pInfo->pTrackNum returned =(%s), pInfo->tracknumLen(%d)\n", pInfo->tagInfo[AV_ID3TAG_TRACKNUM].value, pInfo->tagInfo[AV_ID3TAG_TRACKNUM].length);
}
}
- if (pInfo->tagV2Info.bGenreMarked == false) {
+ if (pInfo->tagInfo[AV_ID3TAG_GENRE].marked == false) {
pInfo->genre = buffer[127];
debug_msg(RELEASE, "pInfo->genre returned genre number (%d)\n", pInfo->genre);
}
return true;
}
+static AvID3TagList __get_tag_info_v222(const char *tag)
+{
+ unsigned int n = 0;
+ int i = 0;
+
+ while (i < 2) {
+ n += tag[i++] - 'A' + 1;
+ n <<= 5;
+ }
+ n += tag[2]; //num, char mixted
+
+ for (i = 0; i < ID3TAG_NUM_V22; i++) {
+ if (n == tag_info_v22[i].int_name) {
+ return tag_info_v22[i].tag;
+ }
+ }
+
+ debug_msg(RELEASE, "(%s) This Frame ID currently not Supports!!\n", tag);
+
+ return AV_ID3TAG_MAX;
+}
+
+static AvID3TagList __get_tag_info_v223(const char *tag)
+{
+ unsigned int n = 0;
+ int i = 0;
+
+ while (i < 3) {
+ n += tag[i++] - 'A' + 1;
+ n <<= 5;
+ }
+ n += tag[3]; //num, char mixted
+
+ for (i = 0; i < ID3TAG_NUM_V23; i++) {
+ if (n == tag_info_v23[i].int_name) {
+ return tag_info_v23[i].tag;
+ }
+ }
+
+ debug_msg(RELEASE, "(%s) This Frame ID currently not Supports!!\n", tag);
+
+ return AV_ID3TAG_MAX;
+}
+
EXPORT_API
bool mm_file_id3tag_parse_v222(AvFileContentInfo *pInfo, unsigned char *buffer)
{
unsigned long purelyFramelen = 0;
unsigned int encodingOffSet = 0;
int realCpyFrameNum = 0, tmp = 0;
-
int textEncodingType = 0;
-
char **charset_array = NULL;
+ AvID3TagList tag_id = AV_ID3TAG_MAX;
make_characterset_array(&charset_array);
purelyFramelen = oneFrameLen - MP3_TAGv2_22_TXT_HEADER_LEN;
curPos += oneFrameLen;
- if (purelyFramelen > 0) {
+ tag_id = __get_tag_info_v222(CompTmp);
+ if (tag_id != AV_ID3TAG_MAX && !pInfo->tagInfo[tag_id].marked && purelyFramelen > 0) {
if (buffer[curPos - purelyFramelen] == 0x00) {
encodingOffSet = 1;
textEncodingType = AV_ID3V2_ISO_8859;
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) {
+ switch (tag_id) {
+ case AV_ID3TAG_COMMENT:
/*skip language data! */
if (realCpyFrameNum > 4) {
realCpyFrameNum -= 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;
+ pInfo->tagInfo[tag_id].value = mmfile_string_convert((const char *)pExtContent, realCpyFrameNum, "UTF-8", charset_array[textEncodingType], NULL, (unsigned int *)&pInfo->tagInfo[tag_id].length);
+ pInfo->tagInfo[tag_id].marked = true;
} else {
debug_msg(RELEASE, "mmf_file_id3tag_parse_v222: failed to get Comment 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) {
+ break;
+
+ case AV_ID3TAG_URL:
if (realCpyFrameNum > 4) {
/*skip language data! */
realCpyFrameNum -= 4;
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;
+ pInfo->tagInfo[tag_id].value = mmfile_string_convert((const char *)pExtContent, realCpyFrameNum, "UTF-8", charset_array[textEncodingType], NULL, (unsigned int *)&pInfo->tagInfo[tag_id].length);
+ pInfo->tagInfo[tag_id].marked = 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: 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;
+ break;
+
+
+ case AV_ID3TAG_PICTURE:
+ if ((realCpyFrameNum <= 2000000) && _mm_file_id3tag_parse_PIC(pInfo, pExtContent, realCpyFrameNum, (const char*)charset_array[textEncodingType]))
+ pInfo->tagInfo[tag_id].marked = true;
+ break;
+
+ default:
+ pInfo->tagInfo[tag_id].value = mmfile_string_convert((const char *)pExtContent, realCpyFrameNum, "UTF-8", charset_array[textEncodingType], NULL, (unsigned int *)&pInfo->tagInfo[tag_id].length);
+ pInfo->tagInfo[tag_id].marked = true;
+
+ if (tag_id == AV_ID3TAG_GENRE)
+ _mm_file_id3tag_add_bracket_at_genre(&pInfo->tagInfo[tag_id].value, pInfo->tagInfo[tag_id].length);
+ break;
}
+
+ if (pInfo->tagInfo[tag_id].value)
+ debug_msg(RELEASE, "[%d] returned = (%s), len = (%d)\n", tag_id, pInfo->tagInfo[tag_id].value, pInfo->tagInfo[tag_id].length);
}
}
}
}
-static void __parse_tag_info(AvFileContentInfo *pInfo, const char *CompTmp, const char *pExtContent, unsigned int realCpyFrameNum, const char *from_codeset)
-{
- if (!pInfo) {
- debug_error(DEBUG, "Invalid pInfo");
- return;
- }
-
- if (!CompTmp) {
- debug_error(DEBUG, "Invalid tag info");
- return;
- }
-
- if (!from_codeset) {
- debug_error(DEBUG, "Invalid from_codeset");
- return;
- }
-
- debug_msg(DEBUG, "text encoding %s \n", from_codeset);
-
- if (strncmp((char *)CompTmp, "TIT2", 4) == 0 && pInfo->tagV2Info.bTitleMarked == false) {
- pInfo->pTitle = mmfile_string_convert((const char *)pExtContent, realCpyFrameNum, "UTF-8", from_codeset, 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, "TPE1", 4) == 0 && pInfo->tagV2Info.bArtistMarked == false) {
- pInfo->pArtist = mmfile_string_convert((const char *)pExtContent, realCpyFrameNum, "UTF-8", from_codeset, 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, "TPE2", 4) == 0 && pInfo->tagV2Info.bAlbum_ArtistMarked == false) {
- pInfo->pAlbum_Artist = mmfile_string_convert((const char *)pExtContent, realCpyFrameNum, "UTF-8", from_codeset, 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, "TPE3", 4) == 0 && pInfo->tagV2Info.bConductorMarked == false) {
- pInfo->pConductor = mmfile_string_convert((const char *)pExtContent, realCpyFrameNum, "UTF-8", from_codeset, 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, "TALB", 4) == 0 && pInfo->tagV2Info.bAlbumMarked == false) {
- pInfo->pAlbum = mmfile_string_convert((const char *)pExtContent, realCpyFrameNum, "UTF-8", from_codeset, 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, "TYER", 4) == 0 && pInfo->tagV2Info.bYearMarked == false) {
- pInfo->pYear = mmfile_string_convert((const char *)pExtContent, realCpyFrameNum, "UTF-8", from_codeset, 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, "TCON", 4) == 0 && pInfo->tagV2Info.bGenreMarked == false) {
- pInfo->pGenre = mmfile_string_convert((const char *)pExtContent, realCpyFrameNum, "UTF-8", from_codeset, 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, "TRCK", 4) == 0 && pInfo->tagV2Info.bTrackNumMarked == false) {
- pInfo->pTrackNum = mmfile_string_convert((const char *)pExtContent, realCpyFrameNum, "UTF-8", from_codeset, 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, "TPOS", 4) == 0 && pInfo->tagV2Info.bPartOfASetMarked == false) {
- pInfo->pPartOfASet = mmfile_string_convert((const char*)pExtContent, realCpyFrameNum, "UTF-8", from_codeset, NULL, (unsigned int*)&pInfo->partofsetLen);
- debug_msg(RELEASE, "pInfo->pPartOfASet returned = (%s), pInfo->partofsetLen(%d)\n", pInfo->pPartOfASet, pInfo->partofsetLen);
- pInfo->tagV2Info.bPartOfASetMarked = true;
- } else if (strncmp((char *)CompTmp, "TENC", 4) == 0 && pInfo->tagV2Info.bEncByMarked == false) {
- pInfo->pEncBy = mmfile_string_convert((char *)pExtContent, realCpyFrameNum, "UTF-8", from_codeset, 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, "WXXX", 4) == 0 && pInfo->tagV2Info.bURLMarked == false) {
- pInfo->pURL = mmfile_string_convert((const char *)pExtContent, realCpyFrameNum, "UTF-8", from_codeset, 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 if (strncmp((char *)CompTmp, "TCOP", 4) == 0 && pInfo->tagV2Info.bCopyRightMarked == false) {
- pInfo->pCopyright = mmfile_string_convert((const char *)pExtContent, realCpyFrameNum, "UTF-8", from_codeset, 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, "TOPE", 4) == 0 && pInfo->tagV2Info.bOriginArtistMarked == false) {
- pInfo->pOriginArtist = mmfile_string_convert((const char *)pExtContent, realCpyFrameNum, "UTF-8", from_codeset, 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, "TCOM", 4) == 0 && pInfo->tagV2Info.bComposerMarked == false) {
- pInfo->pComposer = mmfile_string_convert((const char *)pExtContent, realCpyFrameNum, "UTF-8", from_codeset, NULL, (unsigned int *)&pInfo->composerLen);
- debug_msg(RELEASE, "pInfo->pComposer returned = (%s), pInfo->composerLen(%d)\n", pInfo->pComposer, pInfo->composerLen);
- pInfo->tagV2Info.bComposerMarked = true;
- } else if (strncmp((char *)CompTmp, "TRDA", 4) == 0 && pInfo->tagV2Info.bRecDateMarked == false) {
- pInfo->pRecDate = mmfile_string_convert((const char *)pExtContent, realCpyFrameNum, "UTF-8", from_codeset, 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, "APIC", 4) == 0 && pInfo->tagV2Info.bImageMarked == false && realCpyFrameNum <= 2000000) {
- if (_mm_file_id3tag_parse_APIC(pInfo, (unsigned char *)pExtContent, realCpyFrameNum, from_codeset))
- pInfo->tagV2Info.bImageMarked = true;
- }
- /*TDRC and TIT1 is for 2.4*/
- else if (strncmp((char *)CompTmp, "TDRC", 4) == 0 && pInfo->tagV2Info.bRecDateMarked == false) { /*TYER(year) and TRDA are replaced by the TDRC */
- pInfo->pRecDate = mmfile_string_convert((const char *)pExtContent, realCpyFrameNum, "UTF-8", from_codeset, 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, "TIT1", 4) == 0 && pInfo->tagV2Info.bContentGroupMarked == false) {
- pInfo->pContentGroup = mmfile_string_convert((const char *)pExtContent, realCpyFrameNum, "UTF-8", from_codeset, NULL, (unsigned int *)&pInfo->contentGroupLen);
- debug_msg(RELEASE, "pInfo->pContentGroup returned = (%s), pInfo->contentGroupLen(%d)\n", pInfo->pContentGroup, pInfo->contentGroupLen);
- pInfo->tagV2Info.bContentGroupMarked = true;
- } else {
- debug_msg(RELEASE, "CompTmp(%s) This Frame ID currently not Supports!!\n", CompTmp);
- }
-}
-
EXPORT_API
bool mm_file_id3tag_parse_v223(AvFileContentInfo *pInfo, unsigned char *buffer)
{
int realCpyFrameNum = 0, tmp = 0;
unsigned int textEncodingType = 0;
char **charset_array = NULL;
+ AvID3TagList tag_id = AV_ID3TAG_MAX;
+ char *lang_info = NULL;
make_characterset_array(&charset_array);
purelyFramelen = oneFrameLen - MP3_TAGv2_23_TXT_HEADER_LEN;
curPos += oneFrameLen;
- if (purelyFramelen > 0) {
+ tag_id = __get_tag_info_v223(CompTmp);
+ if (tag_id != AV_ID3TAG_MAX && !pInfo->tagInfo[tag_id].marked && 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);
memcpy(pExtContent, &buffer[curPos - purelyFramelen + encodingOffSet], purelyFramelen - encodingOffSet);
if (realCpyFrameNum > 0) {
- if (strncmp((char *)CompTmp, "COMM", 4) == 0 && pInfo->tagV2Info.bDescriptionMarked == false) {
+ switch (tag_id) {
+ case AV_ID3TAG_COMMENT:
if (realCpyFrameNum > 3) {
realCpyFrameNum -= 3;
tmp = 3;
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);
+ pInfo->tagInfo[tag_id].value = mmfile_string_convert((const char *)&pExtContent[tmp], realCpyFrameNum, "UTF-8", charset_array[textEncodingType], NULL, (unsigned int *)&pInfo->tagInfo[tag_id].length);
+ pInfo->tagInfo[tag_id].marked= true;
} else {
debug_msg(RELEASE, "failed to get Comment Info tmp(%d), purelyFramelen - encodingOffSet(%lu)\n", tmp, purelyFramelen - encodingOffSet);
- pInfo->commentLen = 0;
}
} else {
debug_msg(RELEASE, "Description info too small to parse realCpyFrameNum(%d)\n", realCpyFrameNum);
- pInfo->commentLen = 0;
}
- tmp = 0;
+ break;
- 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) {
+ case AV_ID3TAG_SYNCLYRICS:
if (realCpyFrameNum > 5) {
realCpyFrameNum -= 5;
tmp = 5;
debug_msg(RELEASE, "tmp(%d) textEncodingType(%d), realCpyFrameNum(%d)\n", tmp, textEncodingType, realCpyFrameNum);
__id3tag_parse_SYLT(pInfo, pExtContent, realCpyFrameNum, charset_array[textEncodingType], textEncodingType, tmp);
+ pInfo->tagInfo[tag_id].marked= true;
} else {
debug_msg(RELEASE, "failed to get Synchronised lyrics Info tmp(%d), purelyFramelen - encodingOffSet(%lu)\n", tmp, purelyFramelen - encodingOffSet);
- pInfo->syncLyricsNum = 0;
}
} else {
debug_msg(RELEASE, "Synchronised lyrics too small to parse realCpyFrameNum(%d)\n", realCpyFrameNum);
- pInfo->syncLyricsNum = 0;
}
- tmp = 0;
+ break;
- //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);
+ case AV_ID3TAG_UNSYNCLYRICS:
+ lang_info = strndup((char *)pExtContent, 3);
if (realCpyFrameNum > 3) {
realCpyFrameNum -= 3;
}
if (char_set == NULL) {
- pInfo->pUnsyncLyrics = mmfile_string_convert((const char *)&pExtContent[tmp], realCpyFrameNum, "UTF-8", charset_array[textEncodingType], NULL, (unsigned int *)&pInfo->unsynclyricsLen);
+ pInfo->tagInfo[tag_id].value = mmfile_string_convert((const char *)&pExtContent[tmp], realCpyFrameNum, "UTF-8", charset_array[textEncodingType], NULL, (unsigned int *)&pInfo->tagInfo[tag_id].length);
} else {
- pInfo->pUnsyncLyrics = mmfile_string_convert((const char *)&pExtContent[tmp], realCpyFrameNum, "UTF-8", char_set, NULL, (unsigned int *)&pInfo->unsynclyricsLen);
+ pInfo->tagInfo[tag_id].value = mmfile_string_convert((const char *)&pExtContent[tmp], realCpyFrameNum, "UTF-8", char_set, NULL, (unsigned int *)&pInfo->tagInfo[tag_id].length);
mmfile_free(char_set);
}
+ pInfo->tagInfo[tag_id].marked= true;
} else {
debug_msg(RELEASE, "failed to get Unsynchronised lyrics Info tmp(%d), purelyFramelen - encodingOffSet(%lu)\n", tmp, purelyFramelen - encodingOffSet);
- pInfo->unsynclyricsLen = 0;
}
} else {
debug_msg(RELEASE, "Unsynchronised lyrics too small to parse realCpyFrameNum(%d)\n", realCpyFrameNum);
- 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]);
+ break;
+
+ case AV_ID3TAG_PICTURE:
+ if ((realCpyFrameNum <= 2000000) && _mm_file_id3tag_parse_APIC(pInfo, (unsigned char *)pExtContent, realCpyFrameNum, charset_array[textEncodingType]))
+ pInfo->tagInfo[tag_id].marked= true;
+ break;
+
+ default:
+ pInfo->tagInfo[tag_id].value = mmfile_string_convert((const char *)pExtContent, realCpyFrameNum, "UTF-8", charset_array[textEncodingType], NULL, (unsigned int *)&pInfo->tagInfo[tag_id].length);
+ pInfo->tagInfo[tag_id].marked= true;
+ break;
}
+
+ if (pInfo->tagInfo[tag_id].value)
+ debug_msg(RELEASE, "[%d] returned = (%s), len = (%d)\n", tag_id, pInfo->tagInfo[tag_id].value, pInfo->tagInfo[tag_id].length);
}
} else {
int realCpyFrameNum = 0, tmp = 0;
unsigned int textEncodingType = 0;
char **charset_array = NULL;
+ AvID3TagList tag_id = AV_ID3TAG_MAX;
make_characterset_array(&charset_array);
debug_msg(RELEASE, "-----------------------------------------------------------------------------------\n");
- if (purelyFramelen > 0) {
+ tag_id = __get_tag_info_v223(CompTmp);
+ if (tag_id != AV_ID3TAG_MAX && !pInfo->tagInfo[tag_id].marked && 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))) {
memcpy(pExtContent, &buffer[curPos - purelyFramelen + encodingOffSet], purelyFramelen - encodingOffSet);
if (realCpyFrameNum > 0) {
- if (strncmp((char *)CompTmp, "COMM", 4) == 0 && pInfo->tagV2Info.bDescriptionMarked == false) {
+ switch (tag_id) {
+ case AV_ID3TAG_COMMENT:
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);
- pInfo->pComment = mmfile_string_convert((const char *)&pExtContent[tmp], realCpyFrameNum, "UTF-8", charset_array[textEncodingType], NULL, (unsigned int *)&pInfo->commentLen);
+ pInfo->tagInfo[tag_id].value = mmfile_string_convert((const char *)&pExtContent[tmp], realCpyFrameNum, "UTF-8", charset_array[textEncodingType], NULL, (unsigned int *)&pInfo->tagInfo[tag_id].length);
+ pInfo->tagInfo[tag_id].marked= true;
} else {
debug_msg(RELEASE, "Description info too small to parse realCpyFrameNum(%d)\n", realCpyFrameNum);
}
+ break;
- 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) {
+ case AV_ID3TAG_SYNCLYRICS:
if (realCpyFrameNum > 5) {
realCpyFrameNum -= 5;
tmp = 5;
debug_msg(RELEASE, "tmp(%d) textEncodingType(%d), realCpyFrameNum(%d)\n", tmp, textEncodingType, realCpyFrameNum);
__id3tag_parse_SYLT(pInfo, pExtContent, realCpyFrameNum, charset_array[textEncodingType], textEncodingType, tmp);
+ pInfo->tagInfo[tag_id].marked= true;
} else {
debug_msg(RELEASE, "SyncLyrics info too small to parse realCpyFrameNum(%d)\n", realCpyFrameNum);
}
+ break;
- tmp = 0;
- pInfo->tagV2Info.bSyncLyricsMarked = true;
- } else if (strncmp((char *)CompTmp, "USLT", 4) == 0 && pInfo->tagV2Info.bUnsyncLyricsMarked == false) {
+ case AV_ID3TAG_UNSYNCLYRICS:
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);
- pInfo->pUnsyncLyrics = mmfile_string_convert((const char *)&pExtContent[tmp], realCpyFrameNum, "UTF-8", charset_array[textEncodingType], NULL, (unsigned int *)&pInfo->unsynclyricsLen);
+ pInfo->tagInfo[tag_id].value = mmfile_string_convert((const char *)&pExtContent[tmp], realCpyFrameNum, "UTF-8", charset_array[textEncodingType], NULL, (unsigned int *)&pInfo->tagInfo[tag_id].length);
+ pInfo->tagInfo[tag_id].marked= true;
} else {
debug_msg(RELEASE, "Description info too small to parse realCpyFrameNum(%d)\n", realCpyFrameNum);
}
+ break;
- tmp = 0;
+ case AV_ID3TAG_PICTURE:
+ if ((realCpyFrameNum <= 2000000) && _mm_file_id3tag_parse_APIC(pInfo, (unsigned char *)pExtContent, realCpyFrameNum, charset_array[textEncodingType]))
+ pInfo->tagInfo[tag_id].marked= true;
+ break;
- 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]);
+ default:
+ pInfo->tagInfo[tag_id].value = mmfile_string_convert((const char *)pExtContent, realCpyFrameNum, "UTF-8", charset_array[textEncodingType], NULL, (unsigned int *)&pInfo->tagInfo[tag_id].length);
+ pInfo->tagInfo[tag_id].marked= true;
+ break;
}
+
+ if (pInfo->tagInfo[tag_id].value)
+ debug_msg(RELEASE, "[%d] returned = (%s), len = (%d)\n", tag_id, pInfo->tagInfo[tag_id].value, pInfo->tagInfo[tag_id].length);
}
} else {
int mpegAudioFileLen = 0, idv2IntGenre = GENRE_COUNT - 1/*, tmpinx = 0, tmpinx2=0*/;
/* for Genre Info */
- if (pInfo->tagV2Info.bGenreMarked == false) {
+ if (pInfo->tagInfo[AV_ID3TAG_GENRE].marked == false) {
if (pInfo->bV1tagFound == true) {
debug_msg(RELEASE, "Genre: %d\n", pInfo->genre);
if (pInfo->genre > GENRE_COUNT - 1)
pInfo->genre = GENRE_COUNT - 1;
- pInfo->pGenre = mmfile_strdup(MpegAudio_Genre[pInfo->genre]);
- if (pInfo->pGenre)
- pInfo->genreLen = strlen(pInfo->pGenre);
+ pInfo->tagInfo[AV_ID3TAG_GENRE].value = mmfile_strdup(MpegAudio_Genre[pInfo->genre]);
+ if (pInfo->tagInfo[AV_ID3TAG_GENRE].value)
+ pInfo->tagInfo[AV_ID3TAG_GENRE].length = strlen(pInfo->tagInfo[AV_ID3TAG_GENRE].value);
else
debug_error(RELEASE, "Genre: memory allocation failed.\n");
} else {
debug_msg(RELEASE, "Genre was not Found.\n");
}
- } else if (pInfo->tagV2Info.bGenreMarked == true) {
- debug_msg(RELEASE, "pInfo->genreLen size is Zero Or not UTF16 code! genreLen[%d] genre[%s]\n", pInfo->genreLen, pInfo->pGenre);
+ } else {
+ debug_msg(RELEASE, "genre size is Zero Or not UTF16 code! genreLen[%d] genre[%s]\n", pInfo->tagInfo[AV_ID3TAG_GENRE].length, pInfo->tagInfo[AV_ID3TAG_GENRE].value);
- if (pInfo->pGenre)
- mpegAudioGenre = mmfile_strdup(pInfo->pGenre);
+ if (pInfo->tagInfo[AV_ID3TAG_GENRE].value)
+ mpegAudioGenre = mmfile_strdup(pInfo->tagInfo[AV_ID3TAG_GENRE].value);
else
- pInfo->genreLen = 0;
+ pInfo->tagInfo[AV_ID3TAG_GENRE].length = 0;
- mmfile_free(pInfo->pGenre);
+ mmfile_free(pInfo->tagInfo[AV_ID3TAG_GENRE].value);
/*tmpinx = 0;*/
if (!mpegAudioGenre)
*Genre number
* (XXX) XXX is 0 - 148
*/
- pInfo->genreLen = strlen(mpegAudioGenre);
- if (pInfo->genreLen >= 3 &&
- mpegAudioGenre[0] == '(' && mpegAudioGenre[pInfo->genreLen - 1] == ')') {
+ pInfo->tagInfo[AV_ID3TAG_GENRE].length = strlen(mpegAudioGenre);
+ if (pInfo->tagInfo[AV_ID3TAG_GENRE].length >= 3 &&
+ mpegAudioGenre[0] == '(' && mpegAudioGenre[pInfo->tagInfo[AV_ID3TAG_GENRE].length - 1] == ')') {
bAdditionGenre = true;
- for (mpegAudioFileLen = 1; mpegAudioFileLen <= pInfo->genreLen - 2; mpegAudioFileLen++) {
+ for (mpegAudioFileLen = 1; mpegAudioFileLen <= pInfo->tagInfo[AV_ID3TAG_GENRE].length - 2; mpegAudioFileLen++) {
if (mpegAudioGenre[mpegAudioFileLen] < '0' || mpegAudioGenre[mpegAudioFileLen] > '9') {
bAdditionGenre = false;
break;
if (idv2IntGenre > GENRE_COUNT - 1 || idv2IntGenre < 0)
idv2IntGenre = GENRE_COUNT - 1;
- pInfo->pGenre = mmfile_strdup(MpegAudio_Genre[idv2IntGenre]);
- if (pInfo->pGenre)
- pInfo->genreLen = strlen(pInfo->pGenre);
+ pInfo->tagInfo[AV_ID3TAG_GENRE].value = mmfile_strdup(MpegAudio_Genre[idv2IntGenre]);
+ if (pInfo->tagInfo[AV_ID3TAG_GENRE].value)
+ pInfo->tagInfo[AV_ID3TAG_GENRE].length = strlen(pInfo->tagInfo[AV_ID3TAG_GENRE].value);
else
debug_error(RELEASE, "Genre: memory allocation failed.\n");
- debug_msg(RELEASE, "pInfo->pGenre = %s\n", pInfo->pGenre);
- } else if (bAdditionGenre == false && pInfo->genreLen > 0) {
+ debug_msg(RELEASE, "pInfo->tagInfo[AV_ID3TAG_GENRE].value = %s\n", pInfo->tagInfo[AV_ID3TAG_GENRE].value);
+ } else if (bAdditionGenre == false && pInfo->tagInfo[AV_ID3TAG_GENRE].length > 0) {
/**
* Genre string.
*/
/* Give space for NULL character. Hence added "+1" */
- pInfo->pGenre = mmfile_strdup(mpegAudioGenre);
- if (pInfo->pGenre)
- pInfo->genreLen = strlen(pInfo->pGenre);
+ pInfo->tagInfo[AV_ID3TAG_GENRE].value = mmfile_strdup(mpegAudioGenre);
+ if (pInfo->tagInfo[AV_ID3TAG_GENRE].value)
+ pInfo->tagInfo[AV_ID3TAG_GENRE].length = strlen(pInfo->tagInfo[AV_ID3TAG_GENRE].value);
else
debug_error(RELEASE, "Genre: memory allocation failed.\n");
- debug_msg(RELEASE, "pInfo->pGenre = %s, pInfo->genreLen = %d\n", pInfo->pGenre, pInfo->genreLen);
+ debug_msg(RELEASE, "pInfo->tagInfo[AV_ID3TAG_GENRE].value = %s, pInfo->tagInfo[AV_ID3TAG_GENRE].length = %d\n", pInfo->tagInfo[AV_ID3TAG_GENRE].value, pInfo->tagInfo[AV_ID3TAG_GENRE].length);
} else {
- debug_msg(RELEASE, "Failed to \"(...)\" value to genre = %s\n", pInfo->pGenre);
+ debug_msg(RELEASE, "Failed to \"(...)\" value to genre = %s\n", pInfo->tagInfo[AV_ID3TAG_GENRE].value);
}
mmfile_free(mpegAudioGenre);
}