*/
static bool __get_tag_info(char *filename, AvFileContentInfo *pInfo)
{
- MMFileIOHandle *hFile;
- unsigned char *buf = NULL;
- unsigned char tagBuf[MP3TAGINFO_SIZE + TAGV1_SEEK_GAP] = {0, };
- int tagHeaderPos = 0;
+ MMFileIOHandle *hFile;
+ unsigned char *buf = NULL;
+ unsigned char tag_v1[MP3TAGINFO_SIZE + TAGV1_SEEK_GAP] = {0, };
+ unsigned char check_tag_v2[MP3_TAGv2_HEADER_LEN] = {0, };
+ int tagHeaderPos = 0;
debug_fenter(RELEASE);
}
/* read file to check ID3v2 header */
- if (mmfile_read(hFile, tagBuf, MP3_TAGv2_HEADER_LEN) != MP3_TAGv2_HEADER_LEN) {
+ if (mmfile_read(hFile, check_tag_v2, MP3_TAGv2_HEADER_LEN) != MP3_TAGv2_HEADER_LEN) {
debug_error(DEBUG, "ID3v2 check fail!");
goto EXCEPTION;
}
/* check ID3v2 header */
- __AvGetID3v2Header(tagBuf, MP3_TAGv2_HEADER_LEN, &pInfo->tagV2Info);
+ __AvGetID3v2Header(check_tag_v2, MP3_TAGv2_HEADER_LEN, &pInfo->tagV2Info);
if (mmfile_seek(hFile, 0L, SEEK_SET) < 0)
goto EXCEPTION;
goto EXCEPTION;
pInfo->bV1tagFound = false;
- memset(tagBuf, 0x00, MP3TAGINFO_SIZE + TAGV1_SEEK_GAP);
- /* read with TAG(ID3v1) length */
- if (mmfile_read(hFile, tagBuf, MP3TAGINFO_SIZE + TAGV1_SEEK_GAP) != MP3TAGINFO_SIZE + TAGV1_SEEK_GAP)
+ /* read ID3v1 */
+ if (mmfile_read(hFile, tag_v1, MP3TAGINFO_SIZE + TAGV1_SEEK_GAP) != MP3TAGINFO_SIZE + TAGV1_SEEK_GAP)
goto EXCEPTION;
- /* check and get TAG(ID3v1) information */
- if (__AvGetID3v1Header(tagBuf, MP3TAGINFO_SIZE + TAGV1_SEEK_GAP, &tagHeaderPos)) {
+ /* check and get ID3v1 information */
+ if (__AvGetID3v1Header(tag_v1, MP3TAGINFO_SIZE + TAGV1_SEEK_GAP, &tagHeaderPos)) {
pInfo->bV1tagFound = true;
if (tagHeaderPos == TAGV1_SEEK_GAP) {
- if (!mm_file_id3tag_parse_v110(pInfo, tagBuf + tagHeaderPos))
+ if (!mm_file_id3tag_parse_v110(pInfo, tag_v1 + tagHeaderPos))
debug_msg(RELEASE, "mm_file_id3tag_parse_v110 fails");
}
}
MMFileIOHandle *hFile;
unsigned long frameSamples = 0;
AvTagVer2AdditionalData tagInfo = { 0, };
- unsigned char header[MP3_FORMAT_HEADER_LEN] = {0, };
+ unsigned char check_v1[TAGV1_SEEK_GAP + 5] = {0, };
+ unsigned char check_v2[MP3_TAGv2_HEADER_LEN] = {0, };
debug_fenter(RELEASE);
while (pInfo->tagV2Info.tagLen < pInfo->fileLen - MP3_TAGv2_HEADER_LEN) {
mmfile_seek(hFile, pInfo->tagV2Info.tagLen, SEEK_SET);
- if (mmfile_read(hFile, header, MP3_TAGv2_HEADER_LEN) != MP3_TAGv2_HEADER_LEN)
+ if (mmfile_read(hFile, check_v2, MP3_TAGv2_HEADER_LEN) != MP3_TAGv2_HEADER_LEN)
goto EXCEPTION;
- if (!__AvGetID3v2Header(header, MP3_TAGv2_HEADER_LEN, &tagInfo))
+ if (!__AvGetID3v2Header(check_v2, MP3_TAGv2_HEADER_LEN, &tagInfo))
break;
/* Some contents may have multiple id3 tags */
goto EXCEPTION;
pInfo->bV1tagFound = false;
- /* Reuse header for check if ID3v1 tag exists */
- memset(header, 0x00, TAGV1_SEEK_GAP + 5);
- if (mmfile_read(hFile, header, TAGV1_SEEK_GAP + 5) != TAGV1_SEEK_GAP + 5)
+ if (mmfile_read(hFile, check_v1, TAGV1_SEEK_GAP + 5) != TAGV1_SEEK_GAP + 5)
goto EXCEPTION;
mmfile_close(hFile);
/* Check if id3v1 tag exists for duration calculation. */
- if (__AvGetID3v1Header(header, TAGV1_SEEK_GAP + 5, NULL))
+ if (__AvGetID3v1Header(check_v1, TAGV1_SEEK_GAP + 5, NULL))
pInfo->bV1tagFound = true;
/* get MP3 duration */