char *temp_text = NULL;
if (!formatContext || !fp || !basic_header) {
- debug_error(DEBUG, "invalid param\n");
+ debug_error(DEBUG, "invalid param");
return MMFILE_UTIL_FAIL;
}
readed = mmfile_read(fp, (unsigned char *)&texttag, MMFILE_3GP_TEXT_TAGBOX_LEN);
if (readed != MMFILE_3GP_TEXT_TAGBOX_LEN) {
- debug_error(DEBUG, "read text tag header fail\n");
+ debug_error(DEBUG, "read text tag header fail");
ret = MMFILE_UTIL_FAIL;
goto exception;
}
if (textBytes <= 1) { /* there exist only 00(null) */
- debug_error(DEBUG, "Text is NULL\n");
+ debug_error(DEBUG, "Text is NULL");
goto exception;
}
readed = mmfile_read(fp, (unsigned char *)texttag.text, textBytes);
if (readed != textBytes) {
- debug_error(DEBUG, "read text fail\n");
+ debug_error(DEBUG, "read text fail");
ret = MMFILE_UTIL_FAIL;
goto exception;
}
/* check BOM char */
if ((texttag.text[0] == 0xFE) && (texttag.text[1] == 0xFF)) {
/* this char is UTF-16 */
- unsigned int bytes_written = 0;
- temp_text = mmfile_string_convert((const char *)&texttag.text[2], readed - 2, "UTF-8", "UTF-16", NULL, (unsigned int *)&bytes_written);
+ temp_text = mmfile_convert_to_utf8((const char *)&texttag.text[2], readed - 2, MMFILE_CODESET_UTF16);
} else {
temp_text = g_strdup((const char *)texttag.text);
}
break;
}
default: {
- debug_warning(DEBUG, "Not supported Text Tag type[%d]\n", eTag);
+ debug_warning(DEBUG, "Not supported Text Tag type[%d]", eTag);
break;
}
}
char temp_year[MAX_YEAR_BUFFER] = {0, };
if (!formatContext || !fp || !basic_header) {
- debug_error(DEBUG, "invalid param\n");
+ debug_error(DEBUG, "invalid param");
return MMFILE_UTIL_FAIL;
}
readed = mmfile_read(fp, (unsigned char *)&yearbox, MMFILE_3GP_YEAR_TAGBOX_LEN);
if (readed != MMFILE_3GP_YEAR_TAGBOX_LEN) {
- debug_error(DEBUG, "read yeartag header fail\n");
+ debug_error(DEBUG, "read yeartag header fail");
goto exception;
}
MMFILE_3GP_ALBUM_TAGBOX albumbox = {0, };
if (!formatContext || !fp || !basic_header) {
- debug_error(DEBUG, "invalid param\n");
+ debug_error(DEBUG, "invalid param");
return MMFILE_UTIL_FAIL;
}
readed = mmfile_read(fp, (unsigned char *)&albumbox, MMFILE_3GP_ALBUM_TAGBOX_LEN);
if (readed != MMFILE_3GP_ALBUM_TAGBOX_LEN) {
- debug_error(DEBUG, "read albumtag header fail\n");
+ debug_error(DEBUG, "read albumtag header fail");
goto exception;
}
albumTitleLen = basic_header->size - MMFILE_MP4_BASIC_BOX_HEADER_LEN - MMFILE_3GP_ALBUM_TAGBOX_LEN - 1; /* 1: track number */
if (albumTitleLen > 1) { /* there exist only 00(null) */
- debug_msg(RELEASE, "albumTitleLen=%d\n", albumTitleLen);
+ debug_msg(RELEASE, "albumTitleLen=%d", albumTitleLen);
albumbox.albumtile = g_malloc0(albumTitleLen + 1); /* 1: for null char */
readed = mmfile_read(fp, (unsigned char *)albumbox.albumtile, albumTitleLen);
if (readed != albumTitleLen) {
- debug_error(DEBUG, "read album title fail\n");
+ debug_error(DEBUG, "read album title fail");
goto exception;
}
trackFlags = 0;
readed = mmfile_read(fp, (unsigned char *)&(albumbox.albumtile[albumTitleLen]), 1);
if (readed != 1) {
- debug_error(DEBUG, "read album title fail\n");
+ debug_error(DEBUG, "read album title fail");
goto exception;
}
albumbox.albumtile[albumTitleLen] = '\0';
/* check BOM char */
if ((albumbox.albumtile[0] == 0xFE) && (albumbox.albumtile[1] == 0xFF)) {
/* this char is UTF-16 */
- unsigned int bytes_written = 0;
- temp_text = mmfile_string_convert((const char *)&albumbox.albumtile[2], readed - 2, "UTF-8", "UTF-16", NULL, (unsigned int *)&bytes_written);
+ temp_text = mmfile_convert_to_utf8((const char *)&albumbox.albumtile[2], readed - 2, MMFILE_CODESET_UTF16);
} else {
temp_text = g_strdup((const char *)albumbox.albumtile);
}
else
mmfile_free(temp_text);
- debug_msg(RELEASE, "formatContext->album=%s, strlen=%zu\n", formatContext->album, strlen(formatContext->album));
+ debug_msg(RELEASE, "formatContext->album=%s, strlen=%zu", formatContext->album, strlen(formatContext->album));
}
if (trackFlags) {
readed = mmfile_read(fp, (unsigned char *)&albumbox.trackNumber, 1);
if (readed != 1) {
- debug_error(DEBUG, "read track number fail\n");
+ debug_error(DEBUG, "read track number fail");
goto exception;
}
MMFILE_3GP_RATING_TAGBOX ratingTag = {0, };
if (!formatContext || !fp || !basic_header) {
- debug_error(DEBUG, "invalid param\n");
+ debug_error(DEBUG, "invalid param");
return MMFILE_UTIL_FAIL;
}
readed = mmfile_read(fp, (unsigned char *)&ratingTag, MMFILE_3GP_RATING_TAGBOX_LEN);
if (readed != MMFILE_3GP_RATING_TAGBOX_LEN) {
- debug_error(DEBUG, "read rating tag header fail\n");
+ debug_error(DEBUG, "read rating tag header fail");
goto exception;
}
ratinginfoLen = basic_header->size - MMFILE_MP4_BASIC_BOX_HEADER_LEN - MMFILE_3GP_RATING_TAGBOX_LEN;
if (ratinginfoLen == 1) {
- debug_error(DEBUG, "Rating Text is NULL\n");
+ debug_error(DEBUG, "Rating Text is NULL");
goto exception;
}
readed = mmfile_read(fp, (unsigned char *)ratingTag.ratingInfo, ratinginfoLen);
if (readed != ratinginfoLen) {
- debug_error(DEBUG, "read rating info string fail\n");
+ debug_error(DEBUG, "read rating info string fail");
goto exception;
}
/* check BOM char */
if ((ratingTag.ratingInfo[0] == 0xFE) && (ratingTag.ratingInfo[1] == 0xFF)) {
/* this char is UTF-16 */
- unsigned int bytes_written = 0;
- temp_text = mmfile_string_convert((const char *)&ratingTag.ratingInfo[2], readed - 2, "UTF-8", "UTF-16", NULL, (unsigned int *)&bytes_written);
+ temp_text = mmfile_convert_to_utf8((const char *)&ratingTag.ratingInfo[2], readed - 2, MMFILE_CODESET_UTF16);
} else {
temp_text = g_strdup((const char *)ratingTag.ratingInfo);
}
MMFILE_3GP_CLASSIFICATION_TAGBOX classTag = {0, };
if (!formatContext || !fp || !basic_header) {
- debug_error(DEBUG, "invalid param\n");
+ debug_error(DEBUG, "invalid param");
return MMFILE_UTIL_FAIL;
}
readed = mmfile_read(fp, (unsigned char *)&classTag, MMFILE_3GP_CLASS_TAGBOX_LEN);
if (readed != MMFILE_3GP_CLASS_TAGBOX_LEN) {
- debug_error(DEBUG, "read classification tag header fail\n");
+ debug_error(DEBUG, "read classification tag header fail");
goto exception;
}
classinfoLen = basic_header->size - MMFILE_MP4_BASIC_BOX_HEADER_LEN - MMFILE_3GP_CLASS_TAGBOX_LEN;
if (classinfoLen == 1) {
- debug_error(DEBUG, "Classification Text is NULL\n");
+ debug_error(DEBUG, "Classification Text is NULL");
goto exception;
}
readed = mmfile_read(fp, (unsigned char *)classTag.classificationInfo, classinfoLen);
if (readed != classinfoLen) {
- debug_error(DEBUG, "read class info string fail\n");
+ debug_error(DEBUG, "read class info string fail");
goto exception;
}
/* check BOM char */
if ((classTag.classificationInfo[0] == 0xFE) && (classTag.classificationInfo[1] == 0xFF)) {
/* this char is UTF-16 */
- unsigned int bytes_written = 0;
- temp_text = mmfile_string_convert((const char *)&classTag.classificationInfo[2], readed - 2, "UTF-8", "UTF-16", NULL, (unsigned int *)&bytes_written);
+ temp_text = mmfile_convert_to_utf8((const char *)&classTag.classificationInfo[2], readed - 2, MMFILE_CODESET_UTF16);
} else {
temp_text = g_strdup((const char *)classTag.classificationInfo);
}
unsigned char *buffer = NULL;
unsigned char *p = NULL;
int pos = 0;
- unsigned int bytes_written = 0;
unsigned int name_sz = 0;
unsigned int astro_sz = 0;
if (!formatContext || !fp || !basic_header) {
- debug_error(DEBUG, "invalid param\n");
+ debug_error(DEBUG, "invalid param");
return MMFILE_UTIL_FAIL;
}
readed = mmfile_read(fp, (unsigned char *)&lociTag, 6); /*6 = version + flag + pad + language */
if (readed != 6) {
- debug_error(DEBUG, "read location tag header fail\n");
+ debug_error(DEBUG, "read location tag header fail");
goto exception;
}
/*buffer len = name + role + ... + additional notes length */
bufferLen = basic_header->size - MMFILE_MP4_BASIC_BOX_HEADER_LEN - 6;
if (bufferLen < 1) {
- debug_error(DEBUG, "too small buffer\n");
+ debug_error(DEBUG, "too small buffer");
goto exception;
}
readed = mmfile_read(fp, (unsigned char *)buffer, bufferLen);
if (readed != bufferLen) {
- debug_error(DEBUG, "read location tag fail\n");
+ debug_error(DEBUG, "read location tag fail");
goto exception;
}
p = buffer;
pos = _get_char_position(p, '\0', readed - (1 + 4 + 4 + 4 + 2));
if (pos >= 0) {
if (p[0] == 0xFE && p[1] == 0xFF) {
- lociTag.name = (unsigned char *)mmfile_string_convert((const char *)(p + 2), pos - 2, "UTF-8", "UTF-16", NULL, (unsigned int *)&bytes_written);
+ lociTag.name = (unsigned char *)mmfile_convert_to_utf8((const char *)(p + 2), pos - 2, MMFILE_CODESET_UTF16);
} else {
lociTag.name = (unsigned char *)g_strdup((const char *)p);
}
lociTag.role = *p;
p++;
- debug_msg(RELEASE, "long: 0x%02X 0x%02X 0x%02X 0x%02X \n", *(p + 0), *(p + 1), *(p + 2), *(p + 3));
- debug_msg(RELEASE, "lati: 0x%02X 0x%02X 0x%02X 0x%02X \n", *(p + 4), *(p + 5), *(p + 6), *(p + 7));
- debug_msg(RELEASE, "alti: 0x%02X 0x%02X 0x%02X 0x%02X \n", *(p + 8), *(p + 9), *(p + 10), *(p + 11));
+ debug_msg(RELEASE, "long: 0x%02X 0x%02X 0x%02X 0x%02X ", *(p + 0), *(p + 1), *(p + 2), *(p + 3));
+ debug_msg(RELEASE, "lati: 0x%02X 0x%02X 0x%02X 0x%02X ", *(p + 4), *(p + 5), *(p + 6), *(p + 7));
+ debug_msg(RELEASE, "alti: 0x%02X 0x%02X 0x%02X 0x%02X ", *(p + 8), *(p + 9), *(p + 10), *(p + 11));
ilong = mmfile_io_be_uint32(*(unsigned int *)p);
ilati = mmfile_io_be_uint32(*(unsigned int *)(p + 4));
pos = _get_char_position(p, '\0', readed - (name_sz + 1 + 4 + 4 + 4 + 1));
if (pos >= 0) {
if (p[0] == 0xFE && p[1] == 0xFF) {
- lociTag.astronomical_body = (unsigned char *)mmfile_string_convert((const char *)(p + 2), pos - 2, "UTF-8", "UTF-16", NULL, (unsigned int *)&bytes_written);
+ lociTag.astronomical_body = (unsigned char *)mmfile_convert_to_utf8((const char *)(p + 2), pos - 2, MMFILE_CODESET_UTF16);
} else {
lociTag.astronomical_body = (unsigned char *)g_strdup((const char *)p);
}
pos = _get_char_position(p, '\0', readed - (name_sz + 1 + 4 + 4 + 4 + astro_sz));
if (pos >= 0) {
if (p[0] == 0xFE && p[1] == 0xFF) {
- lociTag.additional_notes = (unsigned char *)mmfile_string_convert((const char *)(p + 2), pos - 2, "UTF-8", "UTF-16", NULL, (unsigned int *)&bytes_written);
+ lociTag.additional_notes = (unsigned char *)mmfile_convert_to_utf8((const char *)(p + 2), pos - 2, MMFILE_CODESET_UTF16);
} else {
lociTag.additional_notes = (unsigned char *)g_strdup((const char *)p);
}
goto exception;
}
- debug_msg(RELEASE, "** Location Information **\n");
- debug_msg(RELEASE, "Name : %s\n", lociTag.name);
- debug_msg(RELEASE, "Role : %d (0: shooting, 1: real, 2: fictional, other: reserved)\n", lociTag.role);
- debug_msg(RELEASE, "Longitude : %16.16f\n", lociTag.longitude);
- debug_msg(RELEASE, "Latitude : %16.16f\n", lociTag.latitude);
- debug_msg(RELEASE, "Altitude : %16.16f\n", lociTag.altitude);
- debug_msg(RELEASE, "Astronomical body: %s\n", lociTag.astronomical_body);
- debug_msg(RELEASE, "Additional notes : %s\n", lociTag.additional_notes);
+ debug_msg(RELEASE, "** Location Information **");
+ debug_msg(RELEASE, "Name : %s", lociTag.name);
+ debug_msg(RELEASE, "Role : %d (0: shooting, 1: real, 2: fictional, other: reserved)", lociTag.role);
+ debug_msg(RELEASE, "Longitude : %16.16f", lociTag.longitude);
+ debug_msg(RELEASE, "Latitude : %16.16f", lociTag.latitude);
+ debug_msg(RELEASE, "Altitude : %16.16f", lociTag.altitude);
+ debug_msg(RELEASE, "Astronomical body: %s", lociTag.astronomical_body);
+ debug_msg(RELEASE, "Additional notes : %s", lociTag.additional_notes);
formatContext->longitude = lociTag.longitude;
formatContext->latitude = lociTag.latitude;
int readed = 0;
if (!formatContext || !fp || !basic_header) {
- debug_error(DEBUG, "invalid param\n");
+ debug_error(DEBUG, "invalid param");
return MMFILE_UTIL_FAIL;
}
readed = mmfile_read(fp, (unsigned char *)&smtaTag, sizeof(MMFILE_M4A_SMTA_TAGBOX));
if (readed != sizeof(MMFILE_M4A_SMTA_TAGBOX)) {
- debug_error(DEBUG, "read smta tag header fail\n");
+ debug_error(DEBUG, "read smta tag header fail");
goto exception;
}
static int GetSA3DInfoFromMP4ATagBox(MMFileFormatContext *formatContext, MMFileIOHandle *fp, MMFILE_MP4_BASIC_BOX_HEADER *basic_header)
{
if (!formatContext || !fp || !basic_header) {
- debug_error(DEBUG, "invalid param\n");
+ debug_error(DEBUG, "invalid param");
return MMFILE_UTIL_FAIL;
}
readed = mmfile_read(fp, buffer, basic_header->size);
if (readed != (int)basic_header->size) {
- debug_error(DEBUG, "read mp4a box failed\n");
+ debug_error(DEBUG, "read mp4a box failed");
goto exception;
}
for (i = 0; i + 3 < basic_header->size; ++i)
if (buffer[i] == 'S' && buffer[i + 1] == 'A' && buffer[i + 2] == '3' && buffer[i + 3] == 'D') {
- debug_warning(DEBUG, "SA3D data found at offset %d bytes\n", i);
+ debug_warning(DEBUG, "SA3D data found at offset %d bytes", i);
is_SA3D_present = true;
break;
}
readed = mmfile_read(fp, (unsigned char *)&sa3dTag, sizeof(MMFILE_MP4A_SA3D_TAGBOX));
if (readed != sizeof(MMFILE_MP4A_SA3D_TAGBOX)) {
- debug_error(DEBUG, "read SA3D tag header fail\n");
+ debug_error(DEBUG, "read SA3D tag header fail");
goto exception;
}
debug_msg(RELEASE, "sa3dTag.channel_map[%d] = %d", i, sa3dTag.channel_map[i]);
if (sa3dTag.version != RFC_AMBISONIC_SA3DBOX_VERSION_SUPPORTED) {
- debug_error(DEBUG, "SA3D tag box version is unsupported\n");
+ debug_error(DEBUG, "SA3D tag box version is unsupported");
goto exception;
} else {
if (sa3dTag.ambisonic_type == RFC_AMBISONIC_TYPE_PERIPHONIC)
(sa3dTag.channel_map[3] == 2))
formatContext->ambisonicFormat = MMFILE_AMBISONIC_FORMAT_AMB;
} else {
- debug_error(DEBUG, "Incorrect metadata: ambisonic order and channels number do not correspond\n");
+ debug_error(DEBUG, "Incorrect metadata: ambisonic order and channels number do not correspond");
goto exception;
}
(sa3dTag.channel_map[8] == 4))
formatContext->ambisonicFormat = MMFILE_AMBISONIC_FORMAT_AMB;
} else {
- debug_error(DEBUG, "Incorrect metadata: ambisonic order and channels number do not correspond\n");
+ debug_error(DEBUG, "Incorrect metadata: ambisonic order and channels number do not correspond");
goto exception;
}
(sa3dTag.channel_map[15] == 9))
formatContext->ambisonicFormat = MMFILE_AMBISONIC_FORMAT_AMB;
} else {
- debug_error(DEBUG, "Incorrect metadata: ambisonic order and channels number do not correspond\n");
+ debug_error(DEBUG, "Incorrect metadata: ambisonic order and channels number do not correspond");
goto exception;
}
}
default: {
- debug_warning(DEBUG, "Ambisonic order or format is not supported: ambix or amb formats up to 3rd order were expected.\n");
+ debug_warning(DEBUG, "Ambisonic order or format is not supported: ambix or amb formats up to 3rd order were expected.");
goto exception;
break;
}
readed = mmfile_read(fp, (unsigned char *)&stereo_mode, sizeof(uint8_t));
if (readed != sizeof(uint8_t)) {
- debug_error(DEBUG, "read st3d tag header fail\n");
+ debug_error(DEBUG, "read st3d tag header fail");
return MMFILE_UTIL_FAIL;
}
mmfile_seek(fp, start_offset, SEEK_SET);
readed = mmfile_read(fp, (unsigned char *)formatContext->metadataSourceV2, box_size);
if (readed != box_size) {
- debug_error(DEBUG, "read svhd tag header fail\n");
+ debug_error(DEBUG, "read svhd tag header fail");
if (formatContext->metadataSourceV2)
free(formatContext->metadataSourceV2);
return MMFILE_UTIL_FAIL;
readed = mmfile_read(fp, (unsigned char *)&proj_data, sizeof(proj_box_data));
if (readed != sizeof(proj_box_data)) {
- debug_error(DEBUG, "read of proj box failed\n");
+ debug_error(DEBUG, "read of proj box failed");
return MMFILE_UTIL_FAIL;
}
formatContext->projTypeV2 = mmfile_io_be_uint32(proj_data.proj_type);
- debug_error(DEBUG, "formatContext->projTypeV2 = %d\n", formatContext->projTypeV2);
- debug_error(DEBUG, "proj_data.version = %d\n", proj_data.version);
- debug_error(DEBUG, "proj_data.flags = %d\n", ((uint32_t)proj_data.flags[0] << 16) +
+ debug_error(DEBUG, "formatContext->projTypeV2 = %d", formatContext->projTypeV2);
+ debug_error(DEBUG, "proj_data.version = %d", proj_data.version);
+ debug_error(DEBUG, "proj_data.flags = %d", ((uint32_t)proj_data.flags[0] << 16) +
((uint32_t)proj_data.flags[1] << 8) + (uint32_t)proj_data.flags[2]);
mmfile_seek(fp, sizeof(proj_box_data), SEEK_CUR);
readed = mmfile_read(fp, (unsigned char *)&prhd_data, sizeof(prhd_box_data));
if (readed != sizeof(prhd_box_data)) {
- debug_error(DEBUG, "read of prhd box failed\n");
+ debug_error(DEBUG, "read of prhd box failed");
return MMFILE_UTIL_FAIL;
}
formatContext->posePitchV2 = mmfile_io_be_uint32(prhd_data.projection_pose_pitch);
formatContext->poseRollV2 = mmfile_io_be_uint32(prhd_data.projection_pose_roll);
- debug_error(DEBUG, "formatContext->poseYawV2 = %d\n", formatContext->poseYawV2);
- debug_error(DEBUG, "formatContext->posePitchV2 = %d\n", formatContext->posePitchV2);
- debug_error(DEBUG, "formatContext->poseRollV2 = %d\n", formatContext->poseRollV2);
+ debug_error(DEBUG, "formatContext->poseYawV2 = %d", formatContext->poseYawV2);
+ debug_error(DEBUG, "formatContext->posePitchV2 = %d", formatContext->posePitchV2);
+ debug_error(DEBUG, "formatContext->poseRollV2 = %d", formatContext->poseRollV2);
if (formatContext->projTypeV2 == PROJECTION_TYPE_EQUI) {
debug_msg(RELEASE, "Projection type is Equirectangular");
mmfile_seek(fp, 8, SEEK_CUR); /* 8 = 4 (for size) + 4 (fourcc) */
readed = mmfile_read(fp, (unsigned char *)&equi_data, sizeof(equi_box_data));
if (readed != sizeof(equi_box_data)) {
- debug_error(DEBUG, "read of equi box failed\n");
+ debug_error(DEBUG, "read of equi box failed");
return MMFILE_UTIL_FAIL;
}
formatContext->equiBoundsLeftV2 = mmfile_io_be_uint32(equi_data.projection_bounds_left);
formatContext->equiBoundsRightV2 = mmfile_io_be_uint32(equi_data.projection_bounds_right);
- debug_error(DEBUG, "formatContext->equiBoundsTopV2 = %d\n", formatContext->equiBoundsTopV2);
- debug_error(DEBUG, "formatContext->equiBoundsBottomV2 = %d\n", formatContext->equiBoundsBottomV2);
- debug_error(DEBUG, "formatContext->equiBoundsLeftV2 = %d\n", formatContext->equiBoundsLeftV2);
- debug_error(DEBUG, "formatContext->equiBoundsRightV2 = %d\n", formatContext->equiBoundsRightV2);
+ debug_error(DEBUG, "formatContext->equiBoundsTopV2 = %d", formatContext->equiBoundsTopV2);
+ debug_error(DEBUG, "formatContext->equiBoundsBottomV2 = %d", formatContext->equiBoundsBottomV2);
+ debug_error(DEBUG, "formatContext->equiBoundsLeftV2 = %d", formatContext->equiBoundsLeftV2);
+ debug_error(DEBUG, "formatContext->equiBoundsRightV2 = %d", formatContext->equiBoundsRightV2);
} else if (formatContext->projTypeV2 == PROJECTION_TYPE_CBMP) {
debug_msg(RELEASE, "Projection type is Cubemap");
mmfile_seek(fp, 8, SEEK_CUR); /* 8 = 4 (for size) + 4 (fourcc) */
readed = mmfile_read(fp, (unsigned char *)&cbmp_data, sizeof(cbmp_box_data));
if (readed != sizeof(cbmp_box_data)) {
- debug_error(DEBUG, "read of cbmp box failed\n");
+ debug_error(DEBUG, "read of cbmp box failed");
return MMFILE_UTIL_FAIL;
}
formatContext->cbmpLayoutV2 = mmfile_io_be_uint32(cbmp_data.layout);
formatContext->cbmpPaddingV2 = mmfile_io_be_uint32(cbmp_data.padding);
- debug_error(DEBUG, "formatContext->cbmpLayoutV2 = %d\n", formatContext->cbmpLayoutV2);
- debug_error(DEBUG, "formatContext->cbmpPaddingV2 = %d\n", formatContext->cbmpPaddingV2);
+ debug_error(DEBUG, "formatContext->cbmpLayoutV2 = %d", formatContext->cbmpLayoutV2);
+ debug_error(DEBUG, "formatContext->cbmpPaddingV2 = %d", formatContext->cbmpPaddingV2);
} else {
debug_msg(RELEASE, "Projection type is %d (unknown)", proj_data.proj_type);
static int GetVideoV2MetadataFromAvc1TagBox(MMFileFormatContext *formatContext, MMFileIOHandle *fp, MMFILE_MP4_BASIC_BOX_HEADER *basic_header)
{
if (!formatContext || !fp || !basic_header) {
- debug_error(DEBUG, "invalid param\n");
+ debug_error(DEBUG, "invalid param");
return MMFILE_UTIL_FAIL;
}
readed = mmfile_read(fp, buffer, basic_header->size);
if (readed != (int)basic_header->size) {
- debug_error(DEBUG, "read st3d box failed\n");
+ debug_error(DEBUG, "read st3d box failed");
goto exception;
}
for (i = 0; i + 3 < basic_header->size; ++i) {
if ((buffer[i] == 's' && buffer[i + 1] == 't' && buffer[i + 2] == '3' && buffer[i + 3] == 'd') && (formatContext->stereoModeV2 == INVALID_UINT_VALUE)) {
- debug_warning(DEBUG, "st3d data found at offset %lld\n", basic_header->start_offset + i);
+ debug_warning(DEBUG, "st3d data found at offset %lld", basic_header->start_offset + i);
ParseSt3dData(formatContext, fp, basic_header->start_offset + i + 4);
debug_msg(RELEASE, "formatContext->stereoModeV2 = %d", formatContext->stereoModeV2);
}
if (buffer[i] == 's' && buffer[i + 1] == 'v' && buffer[i + 2] == '3' && buffer[i + 3] == 'd') {
- debug_warning(DEBUG, "sv3d data found at offset %lld\n", basic_header->start_offset + i);
+ debug_warning(DEBUG, "sv3d data found at offset %lld", basic_header->start_offset + i);
formatContext->isSpherical = true;
}
if (buffer[i] == 's' && buffer[i + 1] == 'v' && buffer[i + 2] == 'h' && buffer[i + 3] == 'd') {
- debug_warning(DEBUG, "svhd data found at offset %lld\n", basic_header->start_offset + i);
+ debug_warning(DEBUG, "svhd data found at offset %lld", basic_header->start_offset + i);
ParseSvhdData(formatContext, fp, basic_header->start_offset + i + 4, mmfile_io_be_uint32(*((uint32_t*)(buffer - 4 + i))));
debug_msg(RELEASE, "formatContext->metadataSourceV2 = %s (length = %zu)", formatContext->metadataSourceV2, strlen(formatContext->metadataSourceV2));
}
if (buffer[i] == 'p' && buffer[i + 1] == 'r' && buffer[i + 2] == 'o' && buffer[i + 3] == 'j') {
- debug_warning(DEBUG, "proj data found at offset %lld\n", basic_header->start_offset + i);
+ debug_warning(DEBUG, "proj data found at offset %lld", basic_header->start_offset + i);
ParseProjData(formatContext, fp, basic_header->start_offset + i + 4);
}
}
int readed = 0;
if (!formatContext || !fp || !basic_header) {
- debug_error(DEBUG, "invalid param\n");
+ debug_error(DEBUG, "invalid param");
return MMFILE_UTIL_FAIL;
}
readed = mmfile_read(fp, (unsigned char *)&value, sizeof(unsigned int));
if (readed != sizeof(unsigned int)) {
- debug_error(DEBUG, "read cdis tag header fail\n");
+ debug_error(DEBUG, "read cdis tag header fail");
goto exception;
}
/* meta box */
readed = mmfile_read(fp, (unsigned char *)&meta_version, 4);
if (readed != 4) {
- debug_error(DEBUG, "read meta box version\n");
+ debug_error(DEBUG, "read meta box version");
goto exception;
}
/* hdlr box */
readed = mmfile_read(fp, (unsigned char *)&hdlrBoxHeader, MMFILE_MP4_BASIC_BOX_HEADER_LEN);
if (readed != MMFILE_MP4_BASIC_BOX_HEADER_LEN) {
- debug_error(DEBUG, "read hdlr box header\n");
+ debug_error(DEBUG, "read hdlr box header");
goto exception;
}
if (hdlrBoxHeader.type != FOURCC('h', 'd', 'l', 'r')) {
- debug_warning(DEBUG, "meta type is not hdlr\n");
+ debug_warning(DEBUG, "meta type is not hdlr");
goto exception;
}
readed = mmfile_read(fp, (unsigned char *)&hdlrBox, MMFILE_3GP_HANDLER_BOX_LEN);
if (readed != MMFILE_3GP_HANDLER_BOX_LEN) {
- debug_error(DEBUG, "read hdlr box\n");
+ debug_error(DEBUG, "read hdlr box");
goto exception;
}
* check tag type (ID3v2 or iTunes)
*/
if (hdlrBox.handler_type == FOURCC('I', 'D', '3', '2')) {
- debug_msg(RELEASE, "ID3v2 tag detected.\n");
+ debug_msg(RELEASE, "ID3v2 tag detected.");
id3_meta = 1;
#ifdef ENABLE_ITUNES_META
} else if (hdlrBox.handler_type == FOURCC('m', 'd', 'i', 'r') &&
mmfile_io_le_uint32(hdlrBox.reserved[0]) == FOURCC('a', 'p', 'p', 'l')) {
- debug_msg(RELEASE, "Apple iTunes tag detected by mdir.\n");
+ debug_msg(RELEASE, "Apple iTunes tag detected by mdir.");
#ifdef ENABLE_ITUNES_META
iTunes_meta = 1;
#endif
} else {
- debug_warning(DEBUG, "unknown meta type. 4CC:[%c%c%c%c]\n", ((char *)&hdlrBox.handler_type)[0],
+ debug_warning(DEBUG, "unknown meta type. 4CC:[%c%c%c%c]", ((char *)&hdlrBox.handler_type)[0],
((char *)&hdlrBox.handler_type)[1],
((char *)&hdlrBox.handler_type)[2],
((char *)&hdlrBox.handler_type)[3]);
readed = mmfile_read(fp, read_buf, buf_size); /* to find 'ilst' */
if (readed != buf_size) {
- debug_error(DEBUG, "read fail [%d]\n", readed);
+ debug_error(DEBUG, "read fail [%d]", readed);
goto exception;
}
if (read_buf[0] == 'i' && read_buf[1] == 'l' && read_buf[2] == 's' && read_buf[3] == 't') {
- debug_msg(RELEASE, "Apple iTunes tag detected by ilst.\n");
+ debug_msg(RELEASE, "Apple iTunes tag detected by ilst.");
iTunes_meta = 1;
}
}
artist_offset = mmfile_tell(fp);
artist_sz = mmfile_io_be_uint32(*(int *)(read_buf + 4)) - 16; /* atom len(4)+data(4)+atom verion(1)+flag(3)+null(4) = 16 */
- debug_msg(RELEASE, "----------------------------------- artist found, offset=[%lld], size=[%d]\n", artist_offset, artist_sz);
+ debug_msg(RELEASE, "----------------------------------- artist found, offset=[%lld], size=[%d]", artist_offset, artist_sz);
}
/**
track_found = 1;
track_offset = mmfile_tell(fp);
- debug_msg(RELEASE, "----------------------------------- Track found, offset=[%lld]\n", track_offset);
+ debug_msg(RELEASE, "----------------------------------- Track found, offset=[%lld]", track_offset);
}
/**
genre_found = 1;
genre_offset = mmfile_tell(fp);
- debug_msg(RELEASE, "----------------------------------- genre found, offset=[%lld]\n", genre_offset);
+ debug_msg(RELEASE, "----------------------------------- genre found, offset=[%lld]", genre_offset);
}
#endif
cover_offset = mmfile_tell(fp);
- debug_msg(RELEASE, "----------------------------------- cover_found found, offset=[%lld]\n", cover_offset);
+ debug_msg(RELEASE, "----------------------------------- cover_found found, offset=[%lld]", cover_offset);
}
mmfile_seek(fp, -(_ITUNES_READ_BUF_SZ - 1), SEEK_CUR); /*FIXME: poor search*/
mmfile_seek(fp, artist_offset, SEEK_SET);
if (formatContext->artist) {
- debug_msg(RELEASE, "----------------------------------- previous artist was [%s] \n", formatContext->artist);
+ debug_msg(RELEASE, "----------------------------------- previous artist was [%s] ", formatContext->artist);
free(formatContext->artist);
}
- debug_msg(RELEASE, "----------------------------------- new artist will be allocated with size (len+1) [%d] \n", artist_sz + 1);
+ debug_msg(RELEASE, "----------------------------------- new artist will be allocated with size (len+1) [%d] ", artist_sz + 1);
formatContext->artist = g_malloc0(artist_sz + 1);
if (formatContext->artist) {
readed = mmfile_read(fp, (unsigned char *)formatContext->artist, artist_sz);
formatContext->artist[artist_sz] = '\0';
- debug_msg(RELEASE, "----------------------------------- new artist is [%s] \n", formatContext->artist);
+ debug_msg(RELEASE, "----------------------------------- new artist is [%s] ", formatContext->artist);
if (readed != artist_sz) {
- debug_error(DEBUG, "failed to read. ret = %d, in = %d\n", readed, artist_sz);
+ debug_error(DEBUG, "failed to read. ret = %d, in = %d", readed, artist_sz);
mmfile_free(formatContext->artist);
}
}
mmfile_seek(fp, track_offset, SEEK_SET);
readed = mmfile_read(fp, read_buf, _ITUNES_TRACK_NUM_SZ);
if (readed != _ITUNES_TRACK_NUM_SZ) {
- debug_error(DEBUG, "failed to read. ret = %d, in = %d\n", readed, _ITUNES_TRACK_NUM_SZ);
+ debug_error(DEBUG, "failed to read. ret = %d, in = %d", readed, _ITUNES_TRACK_NUM_SZ);
} else {
track_num = mmfile_io_be_uint32(*(int *)read_buf);
if (!formatContext->tagTrackNum) {
mmfile_seek(fp, genre_offset, SEEK_SET);
readed = mmfile_read(fp, read_buf, _ITUNES_GENRE_NUM_SZ);
if (readed != _ITUNES_GENRE_NUM_SZ) {
- debug_error(DEBUG, "failed to read. ret = %d, in = %d\n", readed, _ITUNES_GENRE_NUM_SZ);
+ debug_error(DEBUG, "failed to read. ret = %d, in = %d", readed, _ITUNES_GENRE_NUM_SZ);
} else {
genre_index = mmfile_io_be_uint16(*(int *)read_buf);
- debug_msg(RELEASE, "genre index=[%d] \n", genre_index);
+ debug_msg(RELEASE, "genre index=[%d] ", genre_index);
if (genre_index > 0 && genre_index < GENRE_COUNT) {
if (!formatContext->genre) {
memset(read_buf, 0x00, _ITUNES_READ_BUF_SZ);
snprintf((char *)read_buf, sizeof(read_buf), "%s", MpegAudio_Genre[genre_index - 1]);
- debug_msg(RELEASE, "genre string=[%s] \n", read_buf);
+ debug_msg(RELEASE, "genre string=[%s] ", read_buf);
formatContext->genre = g_strdup((const char *)read_buf);
}
}
if (formatContext->artwork) {
readed = mmfile_read(fp, formatContext->artwork, cover_sz);
if (readed != cover_sz) {
- debug_error(DEBUG, "failed to read. ret = %d, in = %d\n", readed, cover_sz);
+ debug_error(DEBUG, "failed to read. ret = %d, in = %d", readed, cover_sz);
mmfile_free(formatContext->artwork);
formatContext->artworkSize = 0;
mmfile_free(formatContext->artworkMime);
/* id3 tag box */
readed = mmfile_read(fp, (unsigned char *)&id3v2BoxHeader, MMFILE_MP4_BASIC_BOX_HEADER_LEN);
if (readed != MMFILE_MP4_BASIC_BOX_HEADER_LEN) {
- debug_error(DEBUG, "read id3v2 box header\n");
+ debug_error(DEBUG, "read id3v2 box header");
goto exception;
}
id3v2BoxHeader.type = mmfile_io_le_uint32(id3v2BoxHeader.type);
if (id3v2BoxHeader.type != FOURCC('I', 'D', '3', '2')) {
- debug_warning(DEBUG, "meta type is not id3v2\n");
+ debug_warning(DEBUG, "meta type is not id3v2");
goto exception;
}
readed = mmfile_read(fp, (unsigned char *)&id3v2Box, MMFILE_3GP_ID3V2_BOX_LEN);
if (readed != MMFILE_3GP_ID3V2_BOX_LEN) {
- debug_error(DEBUG, "read id3v2 box\n");
+ debug_error(DEBUG, "read id3v2 box");
goto exception;
}
readed = mmfile_read(fp, (unsigned char *)id3v2Box.id3v2Data, id3v2Len);
if (readed != id3v2Len) {
- debug_error(DEBUG, "read id3tag data error\n");
+ debug_error(DEBUG, "read id3tag data error");
goto exception;
}
/* check id3v2 */
if (!IS_ID3V2_TAG(id3v2Box.id3v2Data)) {
- debug_error(DEBUG, "it is not id3tag\n");
+ debug_error(DEBUG, "it is not id3tag");
goto exception;
}
if (id3v2Box.id3v2Data[3] == 0xFF || id3v2Box.id3v2Data[4] == 0xFF ||
id3v2Box.id3v2Data[6] >= 0x80 || id3v2Box.id3v2Data[7] >= 0x80 ||
id3v2Box.id3v2Data[8] >= 0x80 || id3v2Box.id3v2Data[9] >= 0x80) {
- debug_error(DEBUG, "it is not valid id3tag\n");
+ debug_error(DEBUG, "it is not valid id3tag");
goto exception;
}
tagVersion = id3v2Box.id3v2Data[3];
if (tagVersion > 4) {
- debug_error(DEBUG, "tag vesion is too high\n");
+ debug_error(DEBUG, "tag vesion is too high");
goto exception;
}
}
case 1:
default: {
- debug_error(DEBUG, "tag vesion is not support\n");
+ debug_error(DEBUG, "tag vesion is not support");
versionCheck = false;
break;
}
}
if (versionCheck == false) {
- debug_error(DEBUG, "tag parsing is fail\n");
+ debug_error(DEBUG, "tag parsing is fail");
goto exception;
}
int value_length = 0;
if (!xml_str || !param_name || !strstr(xml_str, param_name)) {
- debug_error(DEBUG, "error: incorrect or non-existing parameter\n");
+ debug_error(DEBUG, "error: incorrect or non-existing parameter");
return MMFILE_UTIL_FAIL;
}
value_end = strchr(value_start, '<');
if (!value_end) {
- debug_error(DEBUG, "error: incorrect XML\n");
+ debug_error(DEBUG, "error: incorrect XML");
return MMFILE_UTIL_FAIL;
}
i++;
while (i < value_length) {
if (value_start[i] < '0' || value_start[i] > '9') {
- debug_error(DEBUG, "error: incorrect value, integer was expected\n");
+ debug_error(DEBUG, "error: incorrect value, integer was expected");
return MMFILE_UTIL_FAIL;
}
i++;
}
if (value_length >= value_length_max || value_length < 1) {
- debug_error(DEBUG, "error: empty XML value or incorrect range\n");
+ debug_error(DEBUG, "error: empty XML value or incorrect range");
return MMFILE_UTIL_FAIL;
}
*value = strtol(init_view_ret, &endptr, 10);
if (endptr == init_view_ret) {
- debug_error(DEBUG, "error: no digits were found\n");
+ debug_error(DEBUG, "error: no digits were found");
return MMFILE_UTIL_FAIL;
}
int value_length = 0;
if (!xml_str || !param_name || !strstr(xml_str, param_name)) {
- debug_error(DEBUG, "error: incorrect or non-existing parameter\n");
+ debug_error(DEBUG, "error: incorrect or non-existing parameter");
return MMFILE_UTIL_FAIL;
}
value_end = strchr(value_start, '<');
if (!value_end) {
- debug_error(DEBUG, "error: incorrect XML\n");
+ debug_error(DEBUG, "error: incorrect XML");
return MMFILE_UTIL_FAIL;
}
value_length--;
if (value_length >= value_length_max || value_length < 1) {
- debug_error(DEBUG, "error: empty XML value or incorrect range\n");
+ debug_error(DEBUG, "error: empty XML value or incorrect range");
return MMFILE_UTIL_FAIL;
}
*value = (char*)calloc(value_length, sizeof(char));
if (*value == NULL) {
- debug_error(DEBUG, "error: calloc failed\n");
+ debug_error(DEBUG, "error: calloc failed");
return MMFILE_UTIL_FAIL;
}
strncpy(*value, value_start, value_length);
int value_length = 0;
if (!xml_str || !param_name || !strstr(xml_str, param_name)) {
- debug_error(DEBUG, "error: incorrect or non-existing parameter\n");
+ debug_error(DEBUG, "error: incorrect or non-existing parameter");
return MMFILE_UTIL_FAIL;
}
value_length--;
if (value_length < 1) {
- debug_error(DEBUG, "error: empty XML value or incorrect range\n");
+ debug_error(DEBUG, "error: empty XML value or incorrect range");
return MMFILE_UTIL_FAIL;
}
ret = mmfile_open(&fp, formatContext->uriFileName, MMFILE_RDONLY);
if (ret == MMFILE_UTIL_FAIL) {
- debug_error(DEBUG, "error: mmfile_open\n");
+ debug_error(DEBUG, "error: mmfile_open");
goto exit;
}
file_size = mmfile_seek(fp, 0, SEEK_END);
if (file_size == MMFILE_UTIL_FAIL) {
- debug_error(DEBUG, "mmfile operation failed\n");
+ debug_error(DEBUG, "mmfile operation failed");
goto exit;
}
probe_size = (file_size > probe_size) ? probe_size : file_size;
buffer = (unsigned char *)malloc(probe_size * sizeof(unsigned char));
if (!buffer) {
- debug_error(DEBUG, "malloc failed\n");
+ debug_error(DEBUG, "malloc failed");
goto exit;
}
ret = mmfile_seek(fp, 0, SEEK_SET);
if (ret == MMFILE_UTIL_FAIL) {
- debug_error(DEBUG, "mmfile operation failed\n");
+ debug_error(DEBUG, "mmfile operation failed");
goto exit;
}
ret = mmfile_read(fp, buffer, probe_size * sizeof(unsigned char));
if (ret == MMFILE_UTIL_FAIL) {
- debug_error(DEBUG, "mmfile operation failed\n");
+ debug_error(DEBUG, "mmfile operation failed");
goto exit;
}
for (i = 0; i + 3 < probe_size; ++i) {
if (*(unsigned int *)(buffer + i) == FOURCC('e', 'q', 'u', 'i') ||
*(unsigned int *)(buffer + i) == FOURCC('c', 'b', 'm', 'p')) {
- debug_msg(DEBUG, "projection data found at offset %d bytes\n", i);
+ debug_msg(DEBUG, "projection data found at offset %d bytes", i);
break;
}
}
if (i + 3 == probe_size) {
- debug_msg(DEBUG, "projection info wasn't found\n");
+ debug_msg(DEBUG, "projection info wasn't found");
ret = MMFILE_UTIL_SUCCESS;
goto exit;
}
if ((i - (int)sizeof(MMFILE_WEBM_PROJ_V2_BOX)) < 0) {
- debug_error(DEBUG, "error: invalid supposed projection info location\n");
+ debug_error(DEBUG, "error: invalid supposed projection info location");
ret = MMFILE_UTIL_FAIL;
goto exit;
}
ret = mmfile_seek(fp, i - sizeof(MMFILE_WEBM_PROJ_V2_BOX), SEEK_SET);
if (ret == MMFILE_UTIL_FAIL) {
- debug_error(DEBUG, "error: failed to seek to the supposed projection info location\n");
+ debug_error(DEBUG, "error: failed to seek to the supposed projection info location");
goto exit;
}
ret = mmfile_read(fp, (unsigned char *)&v2box, sizeof(MMFILE_WEBM_PROJ_V2_BOX));
if (ret == MMFILE_UTIL_FAIL) {
- debug_error(DEBUG, "mmfile operation failed\n");
+ debug_error(DEBUG, "mmfile operation failed");
goto exit;
}
if (v2box.proj_type_box_value == PROJECTION_TYPE_EQUI) {
- debug_msg(DEBUG, "Equirectangular projection is used\n");
+ debug_msg(DEBUG, "Equirectangular projection is used");
ret = mmfile_read(fp, (unsigned char *)&equi, sizeof(MMFILE_WEBM_EQUI_PROJ_V2_BOX));
if (ret == MMFILE_UTIL_FAIL) {
- debug_error(DEBUG, "error: failed to read equirectangular element\n");
+ debug_error(DEBUG, "error: failed to read equirectangular element");
goto exit;
}
if (strncmp((char *)equi.proj_priv_box_name, "equi", 4) == 0) {
formatContext->equiBoundsLeftV2 = mmfile_io_be_uint32(equi.equi_projection_bounds_left);
formatContext->equiBoundsRightV2 = mmfile_io_be_uint32(equi.equi_projection_bounds_right);
} else {
- debug_error(DEBUG, "error: failed to read equirectangular element\n");
+ debug_error(DEBUG, "error: failed to read equirectangular element");
ret = MMFILE_UTIL_SUCCESS;
goto exit;
}
}
if (v2box.proj_type_box_value == PROJECTION_TYPE_CBMP) {
- debug_msg(DEBUG, "Cubemap projection is used\n");
+ debug_msg(DEBUG, "Cubemap projection is used");
ret = mmfile_read(fp, (unsigned char *)&cbmp, sizeof(MMFILE_WEBM_CBMP_PROJ_V2_BOX));
if (ret == MMFILE_UTIL_FAIL) {
- debug_error(DEBUG, "error: failed to read cubemap element\n");
+ debug_error(DEBUG, "error: failed to read cubemap element");
goto exit;
}
if (strncmp((char *)cbmp.proj_priv_box_name, "cbmp", 4) == 0) {
formatContext->cbmpLayoutV2 = mmfile_io_be_uint32(cbmp.cbmp_projection_layout);
formatContext->cbmpPaddingV2 = mmfile_io_be_uint32(cbmp.cbmp_projection_padding);
} else {
- debug_error(DEBUG, "error: failed to read cubemap element\n");
+ debug_error(DEBUG, "error: failed to read cubemap element");
ret = MMFILE_UTIL_FAIL;
goto exit;
}
ret = mmfile_read(fp, (unsigned char *)&pose, sizeof(MMFILE_WEBM_POSE_ELEMENT_V2_BOX));
if (ret == MMFILE_UTIL_FAIL) {
- debug_error(DEBUG, "error: failed to read pose info\n");
+ debug_error(DEBUG, "error: failed to read pose info");
goto exit;
}
if (pose.pose_yaw_element_id == POSE_YAW_ELEMENT_ID) {
formatContext->poseYawV2 = (uint)mmfile_io_be_float32(pose.pose_yaw_element_value);
} else {
- debug_error(DEBUG, "error: failed to pose yaw element\n");
+ debug_error(DEBUG, "error: failed to pose yaw element");
ret = MMFILE_UTIL_FAIL;
goto exit;
}
if (pose.pose_pitch_element_id == POSE_PITCH_ELEMENT_ID) {
formatContext->posePitchV2 = (uint)mmfile_io_be_float32(pose.pose_pitch_element_value);
} else {
- debug_error(DEBUG, "error: failed to pose pitch element\n");
+ debug_error(DEBUG, "error: failed to pose pitch element");
ret = MMFILE_UTIL_FAIL;
goto exit;
}
if (pose.pose_roll_element_id == POSE_ROLL_ELEMENT_ID) {
formatContext->poseRollV2 = (uint)mmfile_io_be_float32(pose.pose_roll_element_value);
} else {
- debug_error(DEBUG, "error: failed to pose roll element\n");
+ debug_error(DEBUG, "error: failed to pose roll element");
ret = MMFILE_UTIL_FAIL;
goto exit;
}
ret = mmfile_open(&fp, formatContext->uriFileName, MMFILE_RDONLY);
if (ret == MMFILE_UTIL_FAIL) {
- debug_error(DEBUG, "error: mmfile_open\n");
+ debug_error(DEBUG, "error: mmfile_open");
goto exit;
}
basic_header.type = mmfile_io_le_uint32(basic_header.type);
if (basic_header.size == 0) {
- debug_warning(DEBUG, "header is invalid.\n");
+ debug_warning(DEBUG, "header is invalid.");
basic_header.size = readed;
basic_header.type = 0;
chunk_size = basic_header.size;
switch (basic_header.type) {
case FOURCC('m', 'o', 'o', 'v'): {
- debug_msg(RELEASE, "MPEG4: [moov] SIZE: [%lld]Byte\n", chunk_size);
+ debug_msg(RELEASE, "MPEG4: [moov] SIZE: [%lld]Byte", chunk_size);
moov_end = basic_header.start_offset + chunk_size;
break;
}
case FOURCC('u', 'd', 't', 'a'): {
- debug_msg(RELEASE, "MPEG4: [udat] SIZE: [%lld]Byte\n", chunk_size);
+ debug_msg(RELEASE, "MPEG4: [udat] SIZE: [%lld]Byte", chunk_size);
break;
}
/*/////////////////////////////////////////////////////////////// */
/* Extracting Tag Data // */
/*/////////////////////////////////////////////////////////////// */
case FOURCC('t', 'i', 't', 'l'): {
- debug_msg(RELEASE, "MPEG4: [titl] SIZE: [%lld]Byte\n", chunk_size);
+ debug_msg(RELEASE, "MPEG4: [titl] SIZE: [%lld]Byte", chunk_size);
GetStringFromTextTagBox(formatContext, fp, &basic_header, eMMFILE_3GP_TAG_TITLE);
break;
}
case FOURCC('d', 's', 'c', 'p'): {
- debug_msg(RELEASE, "MPEG4: [dscp] SIZE: [%lld]Byte\n", chunk_size);
+ debug_msg(RELEASE, "MPEG4: [dscp] SIZE: [%lld]Byte", chunk_size);
GetStringFromTextTagBox(formatContext, fp, &basic_header, eMMFILE_3GP_TAG_CAPTION);
break;
}
case FOURCC('c', 'p', 'r', 't'): {
- debug_msg(RELEASE, "MPEG4: [cprt] SIZE: [%lld]Byte\n", chunk_size);
+ debug_msg(RELEASE, "MPEG4: [cprt] SIZE: [%lld]Byte", chunk_size);
GetStringFromTextTagBox(formatContext, fp, &basic_header, eMMFILE_3GP_TAG_COPYRIGHT);
break;
}
case FOURCC('p', 'e', 'r', 'f'): {
- debug_msg(RELEASE, "MPEG4: [perf] SIZE: [%lld]Byte\n", chunk_size);
+ debug_msg(RELEASE, "MPEG4: [perf] SIZE: [%lld]Byte", chunk_size);
GetStringFromTextTagBox(formatContext, fp, &basic_header, eMMFILE_3GP_TAG_PERFORMER);
break;
}
case FOURCC('a', 'u', 't', 'h'): {
- debug_msg(RELEASE, "MPEG4: [auth] SIZE: [%lld]Byte\n", chunk_size);
+ debug_msg(RELEASE, "MPEG4: [auth] SIZE: [%lld]Byte", chunk_size);
GetStringFromTextTagBox(formatContext, fp, &basic_header, eMMFILE_3GP_TAG_AUTHOR);
break;
}
case FOURCC('g', 'n', 'r', 'e'): {
- debug_msg(RELEASE, "MPEG4: [gnre] SIZE: [%lld]Byte\n", chunk_size);
+ debug_msg(RELEASE, "MPEG4: [gnre] SIZE: [%lld]Byte", chunk_size);
GetStringFromTextTagBox(formatContext, fp, &basic_header, eMMFILE_3GP_TAG_GENRE);
break;
}
case FOURCC('a', 'l', 'b', 'm'): {
- debug_msg(RELEASE, "MPEG4: [albm] SIZE: [%lld]Byte\n", chunk_size);
+ debug_msg(RELEASE, "MPEG4: [albm] SIZE: [%lld]Byte", chunk_size);
GetAlbumFromAlbumTagBox(formatContext, fp, &basic_header);
break;
}
case FOURCC('y', 'r', 'r', 'c'): {
- debug_msg(RELEASE, "MPEG4: [yrrc] SIZE: [%lld]Byte\n", chunk_size);
+ debug_msg(RELEASE, "MPEG4: [yrrc] SIZE: [%lld]Byte", chunk_size);
GetYearFromYearTagBox(formatContext, fp, &basic_header);
break;
}
case FOURCC('r', 't', 'n', 'g'): {
- debug_msg(RELEASE, "MPEG4: [rtng] SIZE: [%lld]Byte\n", chunk_size);
+ debug_msg(RELEASE, "MPEG4: [rtng] SIZE: [%lld]Byte", chunk_size);
GetRatingFromRatingTagBox(formatContext, fp, &basic_header); /* not use */
break;
}
case FOURCC('c', 'l', 's', 'f'): {
- debug_msg(RELEASE, "MPEG4: [clsf] SIZE: [%lld]Byte\n", chunk_size);
+ debug_msg(RELEASE, "MPEG4: [clsf] SIZE: [%lld]Byte", chunk_size);
GetClassficationFromClsfTagBox(formatContext, fp, &basic_header);
break;
}
case FOURCC('k', 'y', 'w', 'd'): {
- debug_msg(RELEASE, "MPEG4: [kywd] SIZE: [%lld]Byte\n", chunk_size);
+ debug_msg(RELEASE, "MPEG4: [kywd] SIZE: [%lld]Byte", chunk_size);
ret = mmfile_seek(fp, basic_header.start_offset + chunk_size, SEEK_SET);
break;
}
case FOURCC('l', 'o', 'c', 'i'): {
- debug_msg(RELEASE, "MPEG4: [loci] SIZE: [%lld]Byte\n", chunk_size);
+ debug_msg(RELEASE, "MPEG4: [loci] SIZE: [%lld]Byte", chunk_size);
GetLocationFromLociTagBox(formatContext, fp, &basic_header);
break;
}
/* Check smta in user data field (moov) to be compatible with android */
case FOURCC('s', 'm', 't', 'a'): {
- debug_msg(RELEASE, "MPEG4: [smta] SIZE: [%lld]Byte\n", chunk_size);
+ debug_msg(RELEASE, "MPEG4: [smta] SIZE: [%lld]Byte", chunk_size);
GetSAUTInfoFromSMTATagBox(formatContext, fp, &basic_header);
break;
}
/* Check cdis in user data field (moov) to be compatible with android */
case FOURCC('c', 'd', 'i', 's'): {
- debug_msg(RELEASE, "MPEG4: [smta] SIZE: [%lld]Byte\n", chunk_size);
+ debug_msg(RELEASE, "MPEG4: [smta] SIZE: [%lld]Byte", chunk_size);
GetValueFromCDISTagBox(formatContext, fp, &basic_header);
break;
}
/* Extracting ID3 Tag Data // */
/*/////////////////////////////////////////////////////////////// */
case FOURCC('m', 'e', 't', 'a'): {
- debug_msg(RELEASE, "MPEG4: [meta] SIZE: [%lld]Byte\n", chunk_size);
+ debug_msg(RELEASE, "MPEG4: [meta] SIZE: [%lld]Byte", chunk_size);
GetTagFromMetaBox(formatContext, fp, &basic_header);
break;
}
case FOURCC('t', 'r', 'a', 'k'): {
- debug_msg(RELEASE, "MPEG4: [trak] SIZE: [%lld]Byte\n", chunk_size);
+ debug_msg(RELEASE, "MPEG4: [trak] SIZE: [%lld]Byte", chunk_size);
break;
}
case FOURCC('u', 'u', 'i', 'd'): {
unsigned long uuid[4] = {0, };
- debug_msg(RELEASE, "MPEG4: [uuid] SIZE: [%lld]Byte\n", chunk_size);
+ debug_msg(RELEASE, "MPEG4: [uuid] SIZE: [%lld]Byte", chunk_size);
mmfile_read(fp, (unsigned char *)uuid, sizeof(uuid));
}
#endif
- debug_msg(RELEASE, "Extracting tags from UUID XML string %s\n", str);
+ debug_msg(RELEASE, "Extracting tags from UUID XML string %s", str);
ParseSpatialVideoMetadataFromXMLString(str, formatContext);
}
break;
}
case FOURCC('m', 'd', 'i', 'a'): {
- debug_msg(RELEASE, "MPEG4: [mdia] SIZE: [%lld]Byte\n", chunk_size);
+ debug_msg(RELEASE, "MPEG4: [mdia] SIZE: [%lld]Byte", chunk_size);
break;
}
case FOURCC('m', 'i', 'n', 'f'): {
- debug_msg(RELEASE, "MPEG4: [minf] SIZE: [%lld]Byte\n", chunk_size);
+ debug_msg(RELEASE, "MPEG4: [minf] SIZE: [%lld]Byte", chunk_size);
break;
}
case FOURCC('s', 't', 'b', 'l'): {
- debug_msg(RELEASE, "MPEG4: [stbl] SIZE: [%lld]Byte\n", chunk_size);
+ debug_msg(RELEASE, "MPEG4: [stbl] SIZE: [%lld]Byte", chunk_size);
break;
}
case FOURCC('s', 't', 's', 'd'): {
- debug_msg(RELEASE, "MPEG4: [stsd] SIZE: [%lld]Byte\n", chunk_size);
+ debug_msg(RELEASE, "MPEG4: [stsd] SIZE: [%lld]Byte", chunk_size);
break;
}
case FOURCC('m', 'p', '4', 'a'): {
- debug_msg(RELEASE, "MPEG4: [mp4a] SIZE: [%lld]Byte\n", chunk_size);
+ debug_msg(RELEASE, "MPEG4: [mp4a] SIZE: [%lld]Byte", chunk_size);
GetSA3DInfoFromMP4ATagBox(formatContext, fp, &basic_header);
ret = mmfile_seek(fp, basic_header.start_offset + chunk_size, SEEK_SET);
break;
}
case FOURCC('a', 'v', 'c', '1'): {
- debug_msg(RELEASE, "MPEG4: [avc1] SIZE: [%lld]Byte (offset: %lld)\n", chunk_size, basic_header.start_offset);
+ debug_msg(RELEASE, "MPEG4: [avc1] SIZE: [%lld]Byte (offset: %lld)", chunk_size, basic_header.start_offset);
GetVideoV2MetadataFromAvc1TagBox(formatContext, fp, &basic_header);
break;
}
default: {
- debug_msg(RELEASE, "4CC: Not Support [%c%c%c%c]. So skip it. Size [%lld Byte]\n",
+ debug_msg(RELEASE, "4CC: Not Support [%c%c%c%c]. So skip it. Size [%lld Byte]",
((char *)&basic_header.type)[0], ((char *)&basic_header.type)[1],
((char *)&basic_header.type)[2], ((char *)&basic_header.type)[3], chunk_size);
ret = mmfile_seek(fp, basic_header.start_offset + chunk_size, SEEK_SET);
}
if (ret == MMFILE_UTIL_FAIL) {
- debug_error(DEBUG, "mmfile operation is error\n");
+ debug_error(DEBUG, "mmfile operation is error");
ret = -1;
goto exit;
}
return ret;
}
-static char *get_string(const char *buf, int buf_size, int *bytes_written)
+static bool __get_genre_num(const char *buffer, int *si)
{
- int i = 0, c = 0;
- char *q = NULL;
- char str[512] = {0, };
-
- q = str;
- for (i = 0; i < buf_size; i++) {
- c = buf[i];
- if (c == '\0')
- break;
- if ((q - str) >= (int)sizeof(str) - 1)
- break;
- *q++ = c;
- }
- *q = '\0';
+ int len = strlen(buffer);
+ char *tmp_genre = NULL;
- if (strlen(str) > 0) {
- *bytes_written = strlen(str);
- return strdup(str);
- } else {
- *bytes_written = 0;
- return NULL;
- }
-}
+ /* Genre format: (###), ### */
+ if (len > 6 || len == 0)
+ return false;
-char *rtrimN(char *pStr)
-{
- int pos = 0;
- pos = strlen(pStr) - 1;
- for (; pos >= 0; pos--) {
- if (pStr[pos] == 0x20) {
- pStr[pos] = 0x00;
- } else {
- break;
- }
+ /* Check fisrt c */
+ if (len == 1) {
+ if (!g_ascii_isdigit(buffer[0]))
+ return false;
+ } else {
+ if (!g_ascii_isdigit(buffer[1]))
+ return false;
}
- return strdup(pStr);
-}
-
-bool safe_atoi(char *buffer, int *si)
+ /* Remove bind () if exist */
+ tmp_genre = g_strdup(buffer);
+ if (g_str_has_prefix(tmp_genre, "(") && g_str_has_suffix(tmp_genre, ")"))
+ tmp_genre[0] = '0';
-{
- char *end;
- errno = 0;
-
- const long sl = strtol(buffer, &end, 10);
+ *si = atoi(tmp_genre);
+ g_free(tmp_genre);
- if (end == buffer) {
- debug_error(RELEASE, "not a decimal number");
- return false;
- } else if ('\0' != *end) {
- debug_error(RELEASE, "extra characters at end of input: %s", end);
- return false;
- } else if ((LONG_MIN == sl || LONG_MAX == sl) && (ERANGE == errno)) {
- debug_error(RELEASE, "out of range of type long");
- return false;
- } else if (sl > INT_MAX) {
- debug_error(RELEASE, "greater than INT_MAX");
- return false;
- } else if (sl < INT_MIN) {
- debug_error(RELEASE, "less than INT_MIN");
- return false;
- } else {
- *si = (int)sl;
- }
return true;
}
(*charset_array)[AV_ID3V2_UTF16] = strdup("UCS2");
(*charset_array)[AV_ID3V2_UTF16_BE] = strdup("UTF16-BE");
- (*charset_array)[AV_ID3V2_UTF8] = strdup("UTF-8");
+ (*charset_array)[AV_ID3V2_UTF8] = strdup(MMFILE_CODESET_UTF8);
return true;
}
{
int i=0;
- for(i = 0; i < AV_ID3TAG_MAX; i++) {
- pInfo->tagInfo[i].length = 0;
+ for(i = 0; i < AV_ID3TAG_MAX; i++)
pInfo->tagInfo[i].value = NULL;
- pInfo->tagInfo[i].marked = false;
- }
pInfo->imageInfo.bURLInfo = false;
pInfo->imageInfo.pImageBuf = NULL;
pInfo->imageInfo.imageLen = 0;
}
-static void _mm_file_id3tag_add_bracket_at_genre(char **genre, int genre_len)
-{
- int int_genre = -1;
-
- if (!genre || !(*genre) || genre_len <= 0)
- return;
-
- if (!safe_atoi(*genre, &int_genre)) {
- debug_log(RELEASE, "genre information is not integer [%s]", *genre);
- return;
- }
-
- debug_msg(RELEASE, "genre information is integer [%d]", int_genre);
-
- /* if the value is not kinds of genre, exit */
- if (int_genre < 0 || int_genre >= GENRE_COUNT)
- return;
-
- /* Change int to string with bracket like "(123)"
- * mm_file_id3tag_restore_content_info convert it to string
- */
- mmfile_free(*genre);
- *genre = g_strdup_printf("(%d)", int_genre);
-}
-
static void __id3tag_skip_newline(unsigned char *pTagVal, int *nTagLen, int *offset)
{
/* skip newline in text encoding of ID3 tag frame */
*offset += 3;
return AV_ID3V2_UTF16_BE;
} else {
- debug_msg(RELEASE, "id3tag never get here!!\n");
+ debug_msg(RELEASE, "id3tag never get here!!");
return nTextEnc; /* default bypass */
}
} else {
*offset += 2;
return AV_ID3V2_UTF16;
} else {
- debug_msg(RELEASE, "id3tag never get here!!\n");
+ debug_msg(RELEASE, "id3tag never get here!!");
return nTextEnc; /* default bypass */
}
} else if (nTextEnc == AV_ID3V2_UTF8) {
GList *synclyrics_info_list = NULL;
if (nTagLen < MMFILE_SYNC_LYRIC_INFO_MIN_LEN) {
- debug_msg(RELEASE, "failed to get Synchronised lyrics Info realCpyFramNum(%d)\n", nTagLen);
- pInfo->tagInfo[AV_ID3TAG_SYNCLYRICS].length = 0;
+ debug_msg(RELEASE, "failed to get Synchronised lyrics Info realCpyFramNum(%d)", nTagLen);
return;
}
if ((textEncodingType == AV_ID3V2_UTF16) || (textEncodingType == AV_ID3V2_UTF16_BE)) {
- debug_warning(DEBUG, "[%d] not implemented\n", textEncodingType);
+ debug_warning(DEBUG, "[%d] not implemented", textEncodingType);
return;
}
if (textEncodingType == AV_ID3V2_UTF8)
synclyrics_info->lyric_info = g_memdup(pTagVal + copy_start_pos, copy_len + 1);
else
- synclyrics_info->lyric_info = mmfile_string_convert((const char *)&pTagVal[copy_start_pos], copy_len, "UTF-8", pCharSet, NULL, NULL);
+ synclyrics_info->lyric_info = mmfile_convert_to_utf8((const char *)&pTagVal[copy_start_pos], copy_len, pCharSet);
synclyrics_info->time_info = (unsigned long)pTagVal[offset + idx + 1] << 24 | (unsigned long)pTagVal[offset + idx + 2] << 16 | (unsigned long)pTagVal[offset + idx + 3] << 8 | (unsigned long)pTagVal[offset + idx + 4];
idx += 4;
}
pInfo->pSyncLyrics = synclyrics_info_list;
- pInfo->tagInfo[AV_ID3TAG_SYNCLYRICS].length = g_list_length(pInfo->pSyncLyrics);
}
static bool __id3tag_parse_PIC_format(AvFileContentInfo *pInfo, unsigned char *pTagVal, int *offset)
/* get the mime type of Attached PICture, it is text string */
if (pTagVal[*offset] == '\0') {
- debug_msg(RELEASE, "The picture format of PIC is not included\n");
+ debug_msg(RELEASE, "The picture format of PIC is not included");
return false;
}
if (pTagVal[*offset] == '\0') {
pInfo->imageInfo.imgMimetypeLen = 0;
- debug_msg(RELEASE, "The MIME type of APIC is not included\n");
+ debug_msg(RELEASE, "The MIME type of APIC is not included");
return false;
}
}
if ((pTagVal[*offset] != '\0') || (nTagLen <= *offset)) {
- debug_msg(RELEASE, "pTagVal[offset](%d) mimetype is not NULL terminated! realCpyFrameNum - offset(%d)\n",
+ debug_msg(RELEASE, "pTagVal[offset](%d) mimetype is not NULL terminated! realCpyFrameNum - offset(%d)",
pTagVal[*offset], nTagLen - *offset);
return true;
}
(*offset)++;/* end of MIME('\0', 1byte) */
- debug_msg(RELEASE, "after scaning Mime type offset(%d) value!\n", *offset);
+ debug_msg(RELEASE, "after scaning Mime type offset(%d) value!", *offset);
return true;
}
if (pTagVal[*offset] < MP3_ID3V2_PICTURE_TYPE_MAX)
pInfo->imageInfo.pictureType = pTagVal[*offset];
else
- debug_msg(RELEASE, "APIC image has invalid picture type(0x%x)\n", pTagVal[*offset]);
+ debug_msg(RELEASE, "APIC image has invalid picture type(0x%x)", pTagVal[*offset]);
(*offset)++;/* PictureType(1byte) */
- debug_msg(RELEASE, "after scaning PictureType(%d) offset(%d) value!\n", pInfo->imageInfo.pictureType, *offset);
+ debug_msg(RELEASE, "after scaning PictureType(%d) offset(%d) value!", pInfo->imageInfo.pictureType, *offset);
}
static void __id3tag_parse_APIC_desc(AvFileContentInfo *pInfo, unsigned char *pTagVal, int nTagLen, const char *pCharSet, int *offset)
int idx = 0;
unsigned int tag_len = 0;
- unsigned int desc_len = 0;
char *tmp_desc = NULL;
if (pTagVal[*offset] == 0x0) {
- pInfo->imageInfo.imgDesLen = 0;
- debug_msg(RELEASE, "The description of APIC is not included!!!\n");
+ debug_msg(RELEASE, "The description of APIC is not included!!!");
return;
}
while (1) {
if (pTagVal[*offset + idx] == '\0') {
if (nTagLen < (*offset + idx)) {
- debug_error(DEBUG, "End of APIC Tag %d %d %d\n", nTagLen, *offset, idx);
+ debug_error(DEBUG, "End of APIC Tag %d %d %d", nTagLen, *offset, idx);
break;
}
/* check end of image description */
tmp_desc = g_memdup(pTagVal + *offset, tag_len);
/* convert description */
- pInfo->imageInfo.imageDescription = mmfile_string_convert(tmp_desc, tag_len, "UTF-8", pCharSet, NULL, &desc_len);
- pInfo->imageInfo.imgDesLen = (int)desc_len;
+ pInfo->imageInfo.imageDescription = mmfile_convert_to_utf8(tmp_desc, tag_len, pCharSet);
mmfile_free(tmp_desc);
- debug_msg(RELEASE, "new_desc %s(%d)\n", pInfo->imageInfo.imageDescription, pInfo->imageInfo.imgDesLen);
+ debug_msg(RELEASE, "new_desc %s", pInfo->imageInfo.imageDescription);
*offset += idx;
if ((pTagVal[*offset] != '\0') || (nTagLen <= *offset)) {
- debug_msg(RELEASE, "pTagVal[offset](%d) description is not NULL terminated! realCpyFrameNum - offset(%d)\n",
+ debug_msg(RELEASE, "pTagVal[offset](%d) description is not NULL terminated! realCpyFrameNum - offset(%d)",
pTagVal[*offset], nTagLen - *offset);
return;
}
(*offset)++;
}
- debug_msg(RELEASE, "after scaning APIC description offset(%d) value!\n", *offset);
+ debug_msg(RELEASE, "after scaning APIC description offset(%d) value!", *offset);
if (nTagLen <= *offset) {
- debug_msg(RELEASE, "No APIC image!! realCpyFrameNum(%d) - offset(%d)\n", nTagLen, *offset);
+ debug_msg(RELEASE, "No APIC image!! realCpyFrameNum(%d) - offset(%d)", nTagLen, *offset);
return;
}
debug_fenter(RELEASE);
if (!__id3tag_parse_PIC_format(pInfo, pTagVal, &offset)) {
- debug_msg(RELEASE, "PIC is not valid\n");
+ debug_msg(RELEASE, "PIC is not valid");
return false;
}
debug_fenter(RELEASE);
if (!__id3tag_parse_APIC_mimetype(pInfo, pTagVal, nTagLen, &offset)) {
- debug_msg(RELEASE, "APIC is not valid\n");
+ debug_msg(RELEASE, "APIC is not valid");
return false;
}
bool mm_file_id3tag_parse_v110(AvFileContentInfo *pInfo, unsigned char *buffer)
{
const char *locale = MMFileUtilGetLocale();
- char *pFullStr = NULL;
- debug_msg(RELEASE, "ID3tag v110--------------------------------------------------------------\n");
+ debug_msg(RELEASE, "ID3tag v110--------------------------------------------------------------");
- 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->tagInfo[AV_ID3TAG_TITLE].value = rtrimN(pFullStr);
- free(pFullStr);
- }
+ 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);
- debug_msg(RELEASE, "pInfo->pTitle returned =(%s), pInfo->titleLen(%d)\n", pInfo->tagInfo[AV_ID3TAG_TITLE].value, pInfo->tagInfo[AV_ID3TAG_TITLE].length);
+ debug_msg(RELEASE, "pInfo->pTitle returned =(%s)", pInfo->tagInfo[AV_ID3TAG_TITLE].value);
}
- 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->tagInfo[AV_ID3TAG_ARTIST].value = rtrimN(pFullStr);
- free(pFullStr);
- }
+ 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);
- debug_msg(RELEASE, "pInfo->pArtist returned =(%s), pInfo->artistLen(%d)\n", pInfo->tagInfo[AV_ID3TAG_ARTIST].value, pInfo->tagInfo[AV_ID3TAG_ARTIST].length);
+ debug_msg(RELEASE, "pInfo->pArtist returned =(%s)", pInfo->tagInfo[AV_ID3TAG_ARTIST].value);
}
- 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->tagInfo[AV_ID3TAG_ALBUM].value = rtrimN(pFullStr);
- free(pFullStr);
- }
+ 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);
- debug_msg(RELEASE, "pInfo->pAlbum returned =(%s), pInfo->albumLen(%d)\n", pInfo->tagInfo[AV_ID3TAG_ALBUM].value, pInfo->tagInfo[AV_ID3TAG_ALBUM].length);
+ debug_msg(RELEASE, "pInfo->pAlbum returned =(%s)", pInfo->tagInfo[AV_ID3TAG_ALBUM].value);
}
- if (pInfo->tagInfo[AV_ID3TAG_YEAR].marked == false) {
-
- 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->tagInfo[AV_ID3TAG_YEAR].value, pInfo->tagInfo[AV_ID3TAG_YEAR].length);
+ 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);
- 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);
- }
+ debug_msg(RELEASE, "pInfo->pYear returned =(%s)", pInfo->tagInfo[AV_ID3TAG_YEAR].value);
}
- 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->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->tagInfo[AV_ID3TAG_COMMENT].value) {
+ pInfo->tagInfo[AV_ID3TAG_COMMENT].value = mmfile_convert_to_utf8((const char *)&buffer[97], MP3_ID3_DESCRIPTION_LENGTH, locale);
+ debug_msg(RELEASE, "pInfo->pComment returned =(%s)", pInfo->tagInfo[AV_ID3TAG_COMMENT].value);
}
- if (pInfo->tagInfo[AV_ID3TAG_TRACKNUM].marked == false) {
+ if (!pInfo->tagInfo[AV_ID3TAG_TRACKNUM].value) {
pInfo->tagInfo[AV_ID3TAG_TRACKNUM].value = g_malloc0(ID3TAG_V110_TRACK_NUM_DIGIT);
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->tagInfo[AV_ID3TAG_TRACKNUM].value, pInfo->tagInfo[AV_ID3TAG_TRACKNUM].length);
+ debug_msg(RELEASE, "pInfo->pTrackNum returned =(%s)", pInfo->tagInfo[AV_ID3TAG_TRACKNUM].value);
}
- if (pInfo->tagInfo[AV_ID3TAG_GENRE].marked == false) {
- pInfo->genre = buffer[127];
- debug_msg(RELEASE, "pInfo->genre returned genre number (%d)\n", pInfo->genre);
- }
+ /*ID3V2 genre is stored in pInfo->tagInfo[AV_ID3TAG_GENRE].value */
+ /*pInfo->genre is used when ID3V2 genre is invalid, or empty. */
+ pInfo->genre = buffer[127];
+ debug_msg(RELEASE, "pInfo->genre returned genre number (%d)", pInfo->genre);
return true;
}
}
}
- debug_msg(RELEASE, "(%s) This Frame ID currently not Supports!!\n", tag);
+ debug_msg(RELEASE, "(%s) This Frame ID currently not Supports!!", tag);
return AV_ID3TAG_MAX;
}
}
}
- debug_msg(RELEASE, "(%s) This Frame ID currently not Supports!!\n", tag);
+ debug_msg(RELEASE, "(%s) This Frame ID currently not Supports!!", tag);
return AV_ID3TAG_MAX;
}
needToloopv2taglen = taglen - MP3_TAGv2_HEADER_LEN;
curPos = MP3_TAGv2_HEADER_LEN;
- debug_msg(RELEASE, "ID3tag v222--------------------------------------------------------------\n");
+ debug_msg(RELEASE, "ID3tag v222--------------------------------------------------------------");
while (needToloopv2taglen > MP3_TAGv2_22_TXT_HEADER_LEN) {
if ((buffer[curPos] < '0' || buffer[curPos] > 'Z') || (buffer[curPos + 1] < '0' || buffer[curPos + 1] > 'Z')
curPos += oneFrameLen;
tag_id = __get_tag_info_v222(CompTmp);
- if (tag_id != AV_ID3TAG_MAX && !pInfo->tagInfo[tag_id].marked && purelyFramelen > 0) {
+ if (tag_id != AV_ID3TAG_MAX && !pInfo->tagInfo[tag_id].value && purelyFramelen > 0) {
if (buffer[curPos - purelyFramelen] == 0x00) {
encodingOffSet = 1;
textEncodingType = AV_ID3V2_ISO_8859;
encodingOffSet++;
if (purelyFramelen - encodingOffSet <= 0) {
- debug_warning(DEBUG, "warning: wrong frame length\n");
+ debug_warning(DEBUG, "warning: wrong frame length");
continue;
}
/*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->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;
+ pInfo->tagInfo[tag_id].value = mmfile_convert_to_utf8((const char *)pExtContent, realCpyFrameNum, charset_array[textEncodingType]);
} else {
- debug_msg(RELEASE, "mmf_file_id3tag_parse_v222: failed to get Comment Info tmp(%d), purelyFramelen - encodingOffSet(%lu)\n", tmp, purelyFramelen - encodingOffSet);
+ debug_msg(RELEASE, "mmf_file_id3tag_parse_v222: failed to get Comment: tmp(%d), purelyFramelen - encodingOffSet(%lu)", tmp, purelyFramelen - encodingOffSet);
}
} 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: Description info too small to parse realCpyFrameNum(%d)", realCpyFrameNum);
}
break;
if (pExtContent[tmp] > 0x20 && (pExtContent[tmp - 1] == 0x00 || pExtContent[tmp - 1] == 0x01)) {
textEncodingType = __id3tag_get_text_encoding_v222(pExtContent, tmp);
- 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;
+ pInfo->tagInfo[tag_id].value = mmfile_convert_to_utf8((const char *)pExtContent, realCpyFrameNum, charset_array[textEncodingType]);
} else {
- debug_msg(RELEASE, "mmf_file_id3tag_parse_v222: failed to get URL Info tmp(%d), purelyFramelen - encodingOffSet(%lu)\n", tmp, purelyFramelen - encodingOffSet);
+ debug_msg(RELEASE, "mmf_file_id3tag_parse_v222: failed to get URL Info tmp(%d), purelyFramelen - encodingOffSet(%lu)", tmp, purelyFramelen - encodingOffSet);
}
} 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: URL info too small to parse realCpyFrameNum(%d)", realCpyFrameNum);
}
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;
+ if (realCpyFrameNum <= 2000000)
+ _mm_file_id3tag_parse_PIC(pInfo, pExtContent, realCpyFrameNum, (const char*)charset_array[textEncodingType]);
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);
+ pInfo->tagInfo[tag_id].value = mmfile_convert_to_utf8((const char *)pExtContent, realCpyFrameNum, charset_array[textEncodingType]);
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);
+ debug_msg(RELEASE, "[%d] returned = (%s)", tag_id, pInfo->tagInfo[tag_id].value);
}
mmfile_free(pExtContent);
needToloopv2taglen = taglen - MP3_TAGv2_HEADER_LEN;
curPos = MP3_TAGv2_HEADER_LEN;
- debug_msg(RELEASE, "ID3tag v223--------------------------------------------------------------\n");
+ debug_msg(RELEASE, "ID3tag v223--------------------------------------------------------------");
/* check Extended Header */
if (buffer[5] & 0x40) {
/* if extended header exists, skip it*/
int extendedHeaderLen = (unsigned long)buffer[10] << 21 | (unsigned long)buffer[11] << 14 | (unsigned long)buffer[12] << 7 | (unsigned long)buffer[13];
- debug_msg(RELEASE, "--------------- extendedHeaderLen = %d\n", extendedHeaderLen);
+ debug_msg(RELEASE, "--------------- extendedHeaderLen = %d", extendedHeaderLen);
if (extendedHeaderLen > (int)(taglen - curPos)) {
- debug_error(DEBUG, "extended header too long.\n");
+ debug_error(DEBUG, "extended header too long.");
} else {
curPos += extendedHeaderLen;
curPos += 4;
oneFrameLen += (unsigned long)buffer[4 + curPos] << 24 | (unsigned long)buffer[5 + curPos] << 16
| (unsigned long)buffer[6 + curPos] << 8 | (unsigned long)buffer[7 + curPos];
- debug_msg(RELEASE, "----------------------------------------------------------------------------------------------------\n");
+ debug_msg(RELEASE, "----------------------------------------------------------------------------------------------------");
if (oneFrameLen > taglen - curPos)
break;
curPos += oneFrameLen;
tag_id = __get_tag_info_v223(CompTmp);
- if (tag_id != AV_ID3TAG_MAX && !pInfo->tagInfo[tag_id].marked && purelyFramelen > 0) {
+ if (tag_id != AV_ID3TAG_MAX && !pInfo->tagInfo[tag_id].value && 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);
+ debug_msg(RELEASE, "this text string(%s) encoded by UTF16 encodingOffSet(%d)", 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);
+ debug_msg(RELEASE, "this text string(%s) encoded by UTF16 encodingOffSet(%d)", 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);
+ debug_msg(RELEASE, "this text string(%s) encoded by UTF16 encodingOffSet(%d)", 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);
+ debug_msg(RELEASE, "this text string(%s) encoded by UTF16 encodingOffSet(%d)", CompTmp, encodingOffSet);
textEncodingType = AV_ID3V2_UTF16_BE;
} else {
if (buffer[curPos - purelyFramelen + encodingOffSet] == 0x00) {
- debug_msg(RELEASE, "encodingOffset will be set to 1\n");
+ debug_msg(RELEASE, "encodingOffset will be set to 1");
encodingOffSet = 1;
} else {
- debug_msg(RELEASE, "Finding encodingOffset\n");
+ debug_msg(RELEASE, "Finding 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);
+ debug_msg(RELEASE, "this text string(%s) encoded by ISO-8859-1 encodingOffSet(%d)", CompTmp, encodingOffSet);
}
mmfile_free(pExtContent);
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");
+ debug_msg(RELEASE, "get the new text ecoding type");
textEncodingType = buffer[curPos - purelyFramelen + encodingOffSet - 1];
}
}
if (textEncodingType > AV_ID3V2_MAX) {
- debug_msg(DEBUG, "WRONG ENCOIDNG TYPE [%d], FRAME[%s]\n", textEncodingType, (char *)CompTmp);
+ debug_msg(DEBUG, "WRONG ENCOIDNG TYPE [%d], FRAME[%s]", textEncodingType, (char *)CompTmp);
continue;
}
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->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;
+ debug_msg(RELEASE, "tmp(%d) textEncodingType(%d), realCpyFrameNum(%d)", tmp, textEncodingType, realCpyFrameNum);
+ pInfo->tagInfo[tag_id].value = mmfile_convert_to_utf8((const char *)&pExtContent[tmp], realCpyFrameNum, charset_array[textEncodingType]);
} else {
- debug_msg(RELEASE, "failed to get Comment Info tmp(%d), purelyFramelen - encodingOffSet(%lu)\n", tmp, purelyFramelen - encodingOffSet);
+ debug_msg(RELEASE, "failed to get Comment: tmp(%d), purelyFramelen - encodingOffSet(%lu)", tmp, purelyFramelen - encodingOffSet);
}
} else {
- debug_msg(RELEASE, "Description info too small to parse realCpyFrameNum(%d)\n", realCpyFrameNum);
+ debug_msg(RELEASE, "Description info too small to parse realCpyFrameNum(%d)", realCpyFrameNum);
}
break;
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)", 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);
+ debug_msg(RELEASE, "failed to get Synchronised lyrics Info tmp(%d), purelyFramelen - encodingOffSet(%lu)", tmp, purelyFramelen - encodingOffSet);
}
} else {
- debug_msg(RELEASE, "Synchronised lyrics too small to parse realCpyFrameNum(%d)\n", realCpyFrameNum);
+ debug_msg(RELEASE, "Synchronised lyrics too small to parse realCpyFrameNum(%d)", realCpyFrameNum);
}
break;
}
/*pExtContent[tmp+1] value should't have encoding value */
- debug_msg(RELEASE, "tpExtContent[%d] %x\n", tmp, pExtContent[tmp]);
+ debug_msg(RELEASE, "tpExtContent[%d] %x", tmp, pExtContent[tmp]);
if (pExtContent[tmp] == 0x00 || pExtContent[tmp] == 0xFF || pExtContent[tmp] == 0xFE) {
textEncodingType = __id3tag_get_text_encoding_v223(pExtContent, &realCpyFrameNum, textEncodingType, &tmp);
char *char_set = NULL;
- debug_msg(RELEASE, "tmp(%d) textEncodingType(%d), realCpyFrameNum(%d)\n", tmp, textEncodingType, realCpyFrameNum);
+ debug_msg(RELEASE, "tmp(%d) textEncodingType(%d), realCpyFrameNum(%d)", tmp, textEncodingType, realCpyFrameNum);
if (textEncodingType == AV_ID3V2_ISO_8859) {
if (lang_info != NULL && !g_ascii_strcasecmp(lang_info, "KOR")) {
}
if (char_set == NULL) {
- 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].value = mmfile_convert_to_utf8((const char *)&pExtContent[tmp], realCpyFrameNum, charset_array[textEncodingType]);
} else {
- 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);
+ pInfo->tagInfo[tag_id].value = mmfile_convert_to_utf8((const char *)&pExtContent[tmp], realCpyFrameNum, char_set);
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);
+ debug_msg(RELEASE, "failed to get Unsynchronised lyrics Info tmp(%d), purelyFramelen - encodingOffSet(%lu)", tmp, purelyFramelen - encodingOffSet);
}
} else {
- debug_msg(RELEASE, "Unsynchronised lyrics too small to parse realCpyFrameNum(%d)\n", realCpyFrameNum);
+ debug_msg(RELEASE, "Unsynchronised lyrics too small to parse realCpyFrameNum(%d)", realCpyFrameNum);
}
mmfile_free(lang_info);
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;
+ if (realCpyFrameNum <= 2000000)
+ _mm_file_id3tag_parse_APIC(pInfo, (unsigned char *)pExtContent, realCpyFrameNum, charset_array[textEncodingType]);
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;
+ pInfo->tagInfo[tag_id].value = mmfile_convert_to_utf8((const char *)pExtContent, realCpyFrameNum, charset_array[textEncodingType]);
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);
+ debug_msg(RELEASE, "[%d] returned = (%s)", tag_id, pInfo->tagInfo[tag_id].value);
}
} else {
- debug_msg(RELEASE, "All of the pExtContent Values are NULL\n");
+ debug_msg(RELEASE, "All of the pExtContent Values are NULL");
}
}
needToloopv2taglen = taglen - MP3_TAGv2_HEADER_LEN;
curPos = MP3_TAGv2_HEADER_LEN;
- debug_msg(RELEASE, "ID3tag v224--------------------------------------------------------------\n");
+ debug_msg(RELEASE, "ID3tag v224--------------------------------------------------------------");
/* check Extended Header */
if (buffer[5] & 0x40) {
/* if extended header exists, skip it*/
int extendedHeaderLen = (unsigned long)buffer[10] << 21 | (unsigned long)buffer[11] << 14 | (unsigned long)buffer[12] << 7 | (unsigned long)buffer[13];
- debug_msg(RELEASE, "--------------- extendedHeaderLen = %d\n", extendedHeaderLen);
+ debug_msg(RELEASE, "--------------- extendedHeaderLen = %d", extendedHeaderLen);
if (extendedHeaderLen > (int)(taglen - curPos)) {
- debug_error(DEBUG, "extended header too long.\n");
+ debug_error(DEBUG, "extended header too long.");
} else {
curPos += extendedHeaderLen;
}
purelyFramelen = oneFrameLen - MP3_TAGv2_23_TXT_HEADER_LEN;
curPos += oneFrameLen;
- debug_msg(RELEASE, "-----------------------------------------------------------------------------------\n");
+ debug_msg(RELEASE, "-----------------------------------------------------------------------------------");
tag_id = __get_tag_info_v223(CompTmp);
- if (tag_id != AV_ID3TAG_MAX && !pInfo->tagInfo[tag_id].marked && purelyFramelen > 0) {
+ if (tag_id != AV_ID3TAG_MAX && !pInfo->tagInfo[tag_id].value && 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))) {
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");
+ debug_msg(RELEASE, "get the new text ecoding type");
textEncodingType = buffer[curPos - purelyFramelen + encodingOffSet - 1];
}
}
if (textEncodingType > AV_ID3V2_MAX) {
- debug_msg(DEBUG, "WRONG ENCOIDNG TYPE [%d], FRAME[%s]\n", textEncodingType, (char *)CompTmp);
+ debug_msg(DEBUG, "WRONG ENCOIDNG TYPE [%d], FRAME[%s]", textEncodingType, (char *)CompTmp);
continue;
}
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);
+ debug_msg(RELEASE, "tmp(%d) textEncodingType(%d), realCpyFrameNum(%d)", tmp, textEncodingType, realCpyFrameNum);
- 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;
+ pInfo->tagInfo[tag_id].value = mmfile_convert_to_utf8((const char *)&pExtContent[tmp], realCpyFrameNum, charset_array[textEncodingType]);
} else {
- debug_msg(RELEASE, "Description info too small to parse realCpyFrameNum(%d)\n", realCpyFrameNum);
+ debug_msg(RELEASE, "Description info too small to parse realCpyFrameNum(%d)", realCpyFrameNum);
}
break;
tmp = 5;
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, "tmp(%d) textEncodingType(%d), realCpyFrameNum(%d)", 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);
+ debug_msg(RELEASE, "SyncLyrics info too small to parse realCpyFrameNum(%d)", realCpyFrameNum);
}
break;
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);
+ debug_msg(RELEASE, "tmp(%d) textEncodingType(%d), realCpyFrameNum(%d)", tmp, textEncodingType, realCpyFrameNum);
- 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;
+ pInfo->tagInfo[tag_id].value = mmfile_convert_to_utf8((const char *)&pExtContent[tmp], realCpyFrameNum, charset_array[textEncodingType]);
} else {
- debug_msg(RELEASE, "Description info too small to parse realCpyFrameNum(%d)\n", realCpyFrameNum);
+ debug_msg(RELEASE, "Description info too small to parse realCpyFrameNum(%d)", realCpyFrameNum);
}
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;
+ if (realCpyFrameNum <= 2000000)
+ _mm_file_id3tag_parse_APIC(pInfo, (unsigned char *)pExtContent, realCpyFrameNum, charset_array[textEncodingType]);
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;
+ pInfo->tagInfo[tag_id].value = mmfile_convert_to_utf8((const char *)pExtContent, realCpyFrameNum, charset_array[textEncodingType]);
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);
+ debug_msg(RELEASE, "[%d] returned = (%s)", tag_id, pInfo->tagInfo[tag_id].value);
}
} else {
- debug_msg(RELEASE, "mmf_file_id3tag_parse_v224: All of the pExtContent Values are NULL\n");
+ debug_msg(RELEASE, "mmf_file_id3tag_parse_v224: All of the pExtContent Values are NULL");
}
}
void mm_file_id3tag_restore_content_info(AvFileContentInfo *pInfo)
{
- char *mpegAudioGenre = NULL/*, *tmpGenreForV1Tag = NULL*/;
- bool bAdditionGenre = false /*, bMpegAudioFrame = false*/;
- int mpegAudioFileLen = 0, idv2IntGenre = GENRE_COUNT - 1/*, tmpinx = 0, tmpinx2=0*/;
+ int genre_id = 0;
/* for Genre Info */
- 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->tagInfo[AV_ID3TAG_GENRE].value = g_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 {
- 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->tagInfo[AV_ID3TAG_GENRE].value)
- mpegAudioGenre = g_strdup(pInfo->tagInfo[AV_ID3TAG_GENRE].value);
- else
- pInfo->tagInfo[AV_ID3TAG_GENRE].length = 0;
-
- mmfile_free(pInfo->tagInfo[AV_ID3TAG_GENRE].value);
-
- /*tmpinx = 0;*/
- if (!mpegAudioGenre)
+ if (pInfo->tagInfo[AV_ID3TAG_GENRE].value) {
+ /* Check integer */
+ if (!__get_genre_num(pInfo->tagInfo[AV_ID3TAG_GENRE].value, &genre_id)) {
+ debug_log(RELEASE, "genre information is not integer [%s]", pInfo->tagInfo[AV_ID3TAG_GENRE].value);
return;
-
- /**
- *Genre number
- * (XXX) XXX is 0 - 148
- */
- 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->tagInfo[AV_ID3TAG_GENRE].length - 2; mpegAudioFileLen++) {
- if (mpegAudioGenre[mpegAudioFileLen] < '0' || mpegAudioGenre[mpegAudioFileLen] > '9') {
- bAdditionGenre = false;
- break;
- }
- }
}
- if (bAdditionGenre == true) {
- idv2IntGenre = atoi(mpegAudioGenre + 1);
+ /* If integer, check genre code. */
+ /* If out of range, set UNKNOWN */
+ if (genre_id < 0 || genre_id >= GENRE_COUNT)
+ genre_id = GENRE_COUNT - 1;
- if (idv2IntGenre > GENRE_COUNT - 1 || idv2IntGenre < 0)
- idv2IntGenre = GENRE_COUNT - 1;
-
- pInfo->tagInfo[AV_ID3TAG_GENRE].value = g_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, "genre information is integer [%d]", genre_id);
- 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.
- */
+ g_free(pInfo->tagInfo[AV_ID3TAG_GENRE].value);
+ pInfo->tagInfo[AV_ID3TAG_GENRE].value = g_strdup(MpegAudio_Genre[genre_id]);
+ } else {
+ /* No genre in ID3V2.. So check V1 */
+ if (pInfo->bV1tagFound == true) {
+ debug_msg(RELEASE, "Genre: %d", pInfo->genre);
- /* Give space for NULL character. Hence added "+1" */
- pInfo->tagInfo[AV_ID3TAG_GENRE].value = g_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");
+ /* If out of range, set UNKNOWN */
+ if (pInfo->genre > GENRE_COUNT - 1)
+ pInfo->genre = GENRE_COUNT - 1;
- 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);
+ pInfo->tagInfo[AV_ID3TAG_GENRE].value = g_strdup(MpegAudio_Genre[pInfo->genre]);
} else {
- debug_msg(RELEASE, "Failed to \"(...)\" value to genre = %s\n", pInfo->tagInfo[AV_ID3TAG_GENRE].value);
+ debug_msg(RELEASE, "Genre was not Found.");
}
- mmfile_free(mpegAudioGenre);
}
-
}
void mm_file_free_synclyrics_list(GList *synclyrics_list)