mmfile_seek(fp, -(_ITUNES_READ_BUF_SZ - 1), SEEK_CUR); /*FIXME: poor search*/
} /*loop*/
- /*ffmpeg extract artist, tracknum, excep cover image. see mov_read_udta_string()*/
+ /*ffmpeg extract artist, tracknum, except cover image. see mov_read_udta_string()*/
#if 0
if (artist_found) {
if (artist_sz > 0) {
tagVersion = id3v2Box.id3v2Data[3];
if (tagVersion > 4) {
- debug_error(DEBUG, "tag vesion is too high");
+ debug_error(DEBUG, "tag version is too high");
goto exception;
}
if (len > 6 || len == 0)
return false;
- /* Check fisrt c */
+ /* Check first c */
if (len == 1) {
if (!g_ascii_isdigit(buffer[0]))
return false;
return true;
}
+static char * __id3tag_get_v110(const char *buf, ssize_t len, const char *locale)
+{
+ char *tmp_str = NULL;
+
+ mm_file_retv_if_fails(buf, NULL);
+ mm_file_retv_if_fails(locale, NULL);
+
+ tmp_str = mmfile_convert_to_utf8(buf, len, locale);
+
+ /* ID3v1 tag need check length or space. */
+ if (tmp_str && (strlen(tmp_str) == 0 || g_ascii_isspace(tmp_str[0])))
+ mmfile_free(tmp_str);
+
+ return tmp_str;
+}
bool mm_file_id3tag_parse_v110(AvFileContentInfo *pInfo, unsigned char *buffer)
{
debug_msg(RELEASE, "ID3tag v110--------------------------------------------------------------");
if (!pInfo->tagInfo[AV_ID3TAG_TITLE].value) {
- pInfo->tagInfo[AV_ID3TAG_TITLE].value = mmfile_convert_to_utf8((const char *)&buffer[3], MP3_ID3_TITLE_LENGTH, locale);
+ pInfo->tagInfo[AV_ID3TAG_TITLE].value = __id3tag_get_v110((const char *)&buffer[3], MP3_ID3_TITLE_LENGTH, locale);
debug_msg(RELEASE, "pInfo->pTitle returned =(%s)", pInfo->tagInfo[AV_ID3TAG_TITLE].value);
}
if (!pInfo->tagInfo[AV_ID3TAG_ARTIST].value) {
- pInfo->tagInfo[AV_ID3TAG_ARTIST].value = mmfile_convert_to_utf8((const char *)&buffer[33], MP3_ID3_ARTIST_LENGTH, locale);
+ pInfo->tagInfo[AV_ID3TAG_ARTIST].value = __id3tag_get_v110((const char *)&buffer[33], MP3_ID3_ARTIST_LENGTH, locale);
debug_msg(RELEASE, "pInfo->pArtist returned =(%s)", pInfo->tagInfo[AV_ID3TAG_ARTIST].value);
}
if (!pInfo->tagInfo[AV_ID3TAG_ALBUM].value) {
- pInfo->tagInfo[AV_ID3TAG_ALBUM].value = mmfile_convert_to_utf8((const char *)&buffer[63], MP3_ID3_ALBUM_LENGTH, locale);
+ pInfo->tagInfo[AV_ID3TAG_ALBUM].value = __id3tag_get_v110((const char *)&buffer[63], MP3_ID3_ALBUM_LENGTH, locale);
debug_msg(RELEASE, "pInfo->pAlbum returned =(%s)", pInfo->tagInfo[AV_ID3TAG_ALBUM].value);
}
if (!pInfo->tagInfo[AV_ID3TAG_YEAR].value) {
- pInfo->tagInfo[AV_ID3TAG_YEAR].value = mmfile_convert_to_utf8((const char *)&buffer[93], MP3_ID3_YEAR_LENGTH, locale);
+ pInfo->tagInfo[AV_ID3TAG_YEAR].value = __id3tag_get_v110((const char *)&buffer[93], MP3_ID3_YEAR_LENGTH, locale);
debug_msg(RELEASE, "pInfo->pYear returned =(%s)", pInfo->tagInfo[AV_ID3TAG_YEAR].value);
}
if (!pInfo->tagInfo[AV_ID3TAG_COMMENT].value) {
- pInfo->tagInfo[AV_ID3TAG_COMMENT].value = mmfile_convert_to_utf8((const char *)&buffer[97], MP3_ID3_DESCRIPTION_LENGTH, locale);
+ pInfo->tagInfo[AV_ID3TAG_COMMENT].value = __id3tag_get_v110((const char *)&buffer[97], MP3_ID3_DESCRIPTION_LENGTH, locale);
+
debug_msg(RELEASE, "pInfo->pComment returned =(%s)", pInfo->tagInfo[AV_ID3TAG_COMMENT].value);
}
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");
+ debug_msg(RELEASE, "get the new text encoding type");
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");
+ debug_msg(RELEASE, "get the new text encoding type");
textEncodingType = buffer[curPos - purelyFramelen + encodingOffSet - 1];
}
}