}
if (pInfo->tagV2Info.tagVersion == 0x02) {
- if (!mm_file_id3tag_parse_v222(pInfo, buf))
- pInfo->tagV2Info.tagLen = 0;
+ mm_file_id3tag_parse_v222(pInfo, buf);
} else if (pInfo->tagV2Info.tagVersion == 0x03) {
- if (!mm_file_id3tag_parse_v223(pInfo, buf))
- pInfo->tagV2Info.tagLen = 0;
+ mm_file_id3tag_parse_v223(pInfo, buf);
} else if (pInfo->tagV2Info.tagVersion == 0x04) {
- if (!mm_file_id3tag_parse_v224(pInfo, buf)) /* currently 2.4 ver pased by 2.3 routine */
- pInfo->tagV2Info.tagLen = 0;
+ mm_file_id3tag_parse_v224(pInfo, buf); /* currently 2.4 ver pased by 2.3 routine */
} else {
debug_msg(RELEASE, "Invalid tag version(%d)\n", pInfo->tagV2Info.tagVersion);
}
debug_msg(RELEASE, "pInfo->fileLen(%lld)\n", pInfo->fileLen);
/* read file to get ID3v2 */
- if (pInfo->fileLen > (long long)pInfo->tagV2Info.tagLen) {
- buf = mmfile_malloc(pInfo->tagV2Info.tagLen);
- if (!buf) {
- debug_error(DEBUG, "malloc failed.\n");
- goto EXCEPTION;
- }
+ if (pInfo->fileLen <= (long long)pInfo->tagV2Info.tagLen)
+ pInfo->tagV2Info.tagLen = pInfo->fileLen;
- if (mmfile_read(hFile, buf, pInfo->tagV2Info.tagLen) <= 0) {
- mmfile_free(buf);
- goto EXCEPTION;
- }
- } else {
- buf = mmfile_malloc(pInfo->fileLen);
- if (buf == NULL) {
- goto EXCEPTION;
- }
+ debug_msg(RELEASE, "buf size(%d)\n", pInfo->tagV2Info.tagLen);
- if (mmfile_read(hFile, buf, pInfo->fileLen) <= 0) {
- mmfile_free(buf);
- goto EXCEPTION;
- }
- pInfo->tagV2Info.tagLen = pInfo->fileLen;
+ buf = mmfile_malloc(pInfo->tagV2Info.tagLen);
+ if (!buf) {
+ debug_error(DEBUG, "malloc failed.\n");
+ goto EXCEPTION;
+ }
+
+ if (mmfile_read(hFile, buf, pInfo->tagV2Info.tagLen) <= 0) {
+ mmfile_free(buf);
+ goto EXCEPTION;
}
/* Is this needed? */
goto EXCEPTION;
}
- if (pInfo->fileLen < pInfo->tagV2Info.tagLen)
- pInfo->tagV2Info.tagLen = 0;
-
if (mmfile_seek(hFile, 0L, SEEK_SET) < 0)
goto EXCEPTION;
goto EXCEPTION;
bufLen = _AV_MP3_HEADER_POSITION_MAX;
- buf = mmfile_malloc(bufLen);
- if (buf == NULL) {
- debug_error(DEBUG, "malloc failed.\n");
- goto EXCEPTION;
- }
-
- if (mmfile_read(hFile, buf, bufLen) <= 0) {
- mmfile_free(buf);
- goto EXCEPTION;
- }
} else if (pInfo->fileLen - (long long)pInfo->tagV2Info.tagLen > 0) {
if (mmfile_seek(hFile, pInfo->tagV2Info.tagLen, SEEK_SET) < 0)
goto EXCEPTION;
bufLen = pInfo->fileLen - (long long)pInfo->tagV2Info.tagLen;
- buf = mmfile_malloc(bufLen);
- if (buf == NULL) {
- goto EXCEPTION;
- }
-
- if (mmfile_read(hFile, buf, bufLen) <= 0) {
- mmfile_free(buf);
- goto EXCEPTION;
- }
} else {
+ /* if taglen is invlaid, check whole file to get MP3 info */
+ pInfo->tagV2Info.tagLen = 0;
bufLen = pInfo->fileLen;
- buf = mmfile_malloc(pInfo->fileLen);
- if (buf == NULL) {
- goto EXCEPTION;
- }
+ }
- if (mmfile_read(hFile, buf, bufLen) <= 0) {
- mmfile_free(buf);
- goto EXCEPTION;
- }
+ debug_msg(RELEASE, "buf size(%lu)\n", bufLen);
+
+ buf = mmfile_malloc(bufLen);
+ if (!buf) {
+ goto EXCEPTION;
+ }
+
+ if (mmfile_read(hFile, buf, bufLen) <= 0) {
+ mmfile_free(buf);
+ goto EXCEPTION;
}
/* Is this needed? */