}
}
+static bool __id3tag_parse_PIC_format(AvFileContentInfo *pInfo, unsigned char *pTagVal, int *offset)
+{
+ unsigned int idx = 0;
+
+ /* 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");
+ return false;
+ }
+
+ /* init ext variable */
+ memset(pInfo->imageInfo.imageExt, 0, sizeof(pInfo->imageInfo.imageExt));
+ /* get ext */
+ while ((idx < MP3_ID3_IMAGE_EXT_MAX_LENGTH - 1) && (pTagVal[idx] != '\0')) {
+ pInfo->imageInfo.imageExt[idx] = pTagVal[idx];
+ idx++;
+ }
+
+ *offset += idx;
+
+ return true;
+}
+
+static bool __id3tag_parse_APIC_mimetype(AvFileContentInfo *pInfo, unsigned char *pTagVal, int nTagLen, int *offset)
+{
+ unsigned int idx = 0;
+ const char *MIME_PRFIX = "image/";
+
+ /* get the mime type of Attached PICture, it is text string */
+
+ if (pTagVal[*offset] == '\0') {
+ pInfo->imageInfo.imgMimetypeLen = 0;
+ debug_msg(RELEASE, "The MIME type of APIC is not included\n");
+ return false;
+ }
+
+ /* init mimetype variable */
+ memset(pInfo->imageInfo.imageMIMEType, 0, sizeof(pInfo->imageInfo.imageMIMEType));
+ /* get mimetype */
+ while ((idx < MP3_ID3_IMAGE_MIME_TYPE_MAX_LENGTH - 1) && (pTagVal[idx] != '\0')) {
+ pInfo->imageInfo.imageMIMEType[idx] = pTagVal[idx];
+ idx++;
+ }
+ pInfo->imageInfo.imgMimetypeLen = idx;
+
+ *offset += idx;
+
+ if (strncmp(pInfo->imageInfo.imageMIMEType, MIME_PRFIX, strlen(MIME_PRFIX)) != 0) {
+ pInfo->imageInfo.imgMimetypeLen = 0;
+ debug_error(DEBUG, "MIME type(%s) is not image", pInfo->imageInfo.imageMIMEType);
+ return false;
+ }
+
+ if ((pTagVal[*offset] != '\0') || (nTagLen <= *offset)) {
+ debug_msg(RELEASE, "pTagVal[offset](%d) mimetype is not NULL terminated! realCpyFrameNum - offset(%d)\n",
+ pTagVal[*offset], nTagLen - *offset);
+ return true;
+ }
+
+ (*offset)++;/* end of MIME('\0', 1byte) */
+ debug_msg(RELEASE, "after scaning Mime type offset(%d) value!\n", *offset);
+
+ return true;
+}
+
+static void __id3tag_parse_APIC_pictype(AvFileContentInfo *pInfo, unsigned char *pTagVal, int *offset)
+{
+ /* get the picture type of Attached PICture, it is 1byte(0xff) */
+
+ if (pTagVal[*offset] < AV_ID3V2_PICTURE_TYPE_MAX)
+ pInfo->imageInfo.pictureType = pTagVal[*offset];
+ else
+ debug_msg(RELEASE, "APIC image has invalid picture type(0x%x)\n", pTagVal[*offset]);
+
+ (*offset)++;/* PictureType(1byte) */
+ debug_msg(RELEASE, "after scaning PictureType(%d) offset(%d) value!\n", pInfo->imageInfo.pictureType, *offset);
+}
+
+static void __id3tag_parse_APIC_desc(AvFileContentInfo *pInfo, unsigned char *pTagVal, int nTagLen, const char *pCharSet, int *offset)
+{
+ /* get the description of Attached PICture, it is text string */
+
+ 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");
+ 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);
+ break;
+ }
+ /* check end of image description */
+ if ((pTagVal[*offset + idx + 1] == gTagJPEGHeader[0]) ||
+ (pTagVal[*offset + idx + 1] == gTagPNGHeader[0])) {
+ debug_msg(RELEASE, "length of description (%d)", idx);
+ break;
+ }
+ }
+ idx++;
+ }
+
+ tag_len = idx + 1; /* length of description + '\0' */
+
+ tmp_desc = mmfile_calloc(1, sizeof(char) * tag_len);
+ if (tmp_desc) {
+ memcpy(tmp_desc, 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;
+ mmfile_free(tmp_desc);
+ debug_msg(RELEASE, "new_desc %s(%d)\n", pInfo->imageInfo.imageDescription, pInfo->imageInfo.imgDesLen);
+ }
+
+ *offset += idx;
+ if ((pTagVal[*offset] != '\0') || (nTagLen <= *offset)) {
+ debug_msg(RELEASE, "pTagVal[offset](%d) description is not NULL terminated! realCpyFrameNum - offset(%d)\n",
+ pTagVal[*offset], nTagLen - *offset);
+ return;
+ }
+ (*offset)++; /* end of desceription(1byte) */
+}
+
+static void __id3tag_parse_APIC_picture(AvFileContentInfo *pInfo, unsigned char *pTagVal, int nTagLen, int *offset)
+{
+ /* get the picture of Attached PICture, it is binary data */
+
+ /* some content has useless '\0' in front of picture data */
+ while (pTagVal[*offset] == '\0') {
+ (*offset)++;
+ }
+
+ debug_msg(RELEASE, "after scaning APIC description offset(%d) value!\n", *offset);
+
+ if (nTagLen <= *offset) {
+ debug_msg(RELEASE, "No APIC image!! realCpyFrameNum(%d) - offset(%d)\n", nTagLen, *offset);
+ return;
+ }
+
+ pInfo->imageInfo.imageLen = nTagLen - *offset;
+ pInfo->imageInfo.pImageBuf = mmfile_malloc(pInfo->imageInfo.imageLen + 1);
+
+ if (pInfo->imageInfo.pImageBuf) {
+ memcpy(pInfo->imageInfo.pImageBuf, pTagVal + *offset, pInfo->imageInfo.imageLen);
+ pInfo->imageInfo.pImageBuf[pInfo->imageInfo.imageLen] = 0;
+ }
+
+ /* if mimetype is "-->", image date has an URL */
+ if (IS_INCLUDE_URL(pInfo->imageInfo.imageMIMEType))
+ pInfo->imageInfo.bURLInfo = true;
+}
+
+static bool _mm_file_id3tag_parse_PIC(AvFileContentInfo *pInfo, unsigned char *pTagVal, int nTagLen, const char *pCharSet)
+{
+ /* current position to read pTagVal */
+ int offset = 0;
+
+ debug_fenter(RELEASE);
+
+ if (!__id3tag_parse_PIC_format(pInfo, pTagVal, &offset)) {
+ debug_msg(RELEASE, "PIC is not valid\n");
+ return false;
+ }
+
+ __id3tag_parse_APIC_pictype(pInfo, pTagVal, &offset);
+ __id3tag_parse_APIC_desc(pInfo, pTagVal, nTagLen, pCharSet, &offset);
+ __id3tag_parse_APIC_picture(pInfo, pTagVal, nTagLen, &offset);
+
+ debug_fleave(RELEASE);
+
+ return true;
+}
+
+static bool _mm_file_id3tag_parse_APIC(AvFileContentInfo *pInfo, unsigned char *pTagVal, int nTagLen, const char *pCharSet)
+{
+ int offset = 0;
+
+ debug_fenter(RELEASE);
+
+ if (!__id3tag_parse_APIC_mimetype(pInfo, pTagVal, nTagLen, &offset)) {
+ debug_msg(RELEASE, "APIC is not valid\n");
+ return false;
+ }
+
+ __id3tag_parse_APIC_pictype(pInfo, pTagVal, &offset);
+ __id3tag_parse_APIC_desc(pInfo, pTagVal, nTagLen, pCharSet, &offset);
+ __id3tag_parse_APIC_picture(pInfo, pTagVal, nTagLen, &offset);
+
+ debug_fleave(RELEASE);
+
+ return true;
+}
+
EXPORT_API
bool mm_file_id3tag_parse_v110(AvFileContentInfo *pInfo, unsigned char *buffer)
{
unsigned char *pExtContent = NULL;
unsigned long purelyFramelen = 0;
unsigned int encodingOffSet = 0;
- int inx = 0, realCpyFrameNum = 0,
- /*checkImgMimeTypeMax = 0, */checkImgExtMax = 0,
- imgstartOffset = 0, tmp = 0;
+ int realCpyFrameNum = 0, tmp = 0;
int textEncodingType = 0;
debug_msg(RELEASE, "pInfo->pRecDate returned = (%s), pInfo->recdateLen(%d)\n", pInfo->pRecDate, pInfo->recdateLen);
pInfo->tagV2Info.bRecDateMarked = true;
} else if (strncmp((char *)CompTmp, "PIC", 3) == 0 && pInfo->tagV2Info.bImageMarked == false && realCpyFrameNum <= 2000000) {
- if (pExtContent[0] != 0) {
- for (inx = 0; inx < MP3_ID3_IMAGE_EXT_MAX_LENGTH; inx++)
- pInfo->imageInfo.imageExt[inx] = '\0';/*ini mimetype variable */
-
- while ((checkImgExtMax < MP3_ID3_IMAGE_EXT_MAX_LENGTH - 1) && pExtContent[checkImgExtMax] != '\0') {
- pInfo->imageInfo.imageExt[checkImgExtMax] = pExtContent[checkImgExtMax];
- checkImgExtMax++;
- }
- } else {
- debug_msg(RELEASE, "mmf_file_id3tag_parse_v222: PIC image's not included to image Extention\n");
- }
-
- imgstartOffset += checkImgExtMax;
-
- if (pExtContent[imgstartOffset] < AV_ID3V2_PICTURE_TYPE_MAX) {
- pInfo->imageInfo.pictureType = pExtContent[imgstartOffset];
- }
- imgstartOffset++;/*PictureType(1byte) */
-
- if (pExtContent[imgstartOffset] != 0x0) {
- int cur_pos = 0;
- int dis_len = 0;
- int new_dis_len = 0;
- char *tmp_desc = NULL;
-
- while (1) {
- if (pExtContent[imgstartOffset + cur_pos] == '\0') {
- if (realCpyFrameNum < imgstartOffset + cur_pos) {
- debug_error(DEBUG, "End of APIC Tag %d %d %d\n", realCpyFrameNum, imgstartOffset, cur_pos);
- break;
- }
- /*check end of image description*/
- if ((pExtContent[imgstartOffset + cur_pos + 1] == gTagJPEGHeader[0]) ||
- (pExtContent[imgstartOffset + cur_pos + 1] == gTagPNGHeader[0])) {
- debug_msg(RELEASE, "length of description (%d)", cur_pos);
- break;
- }
- }
- cur_pos++;
- }
-
- dis_len = cur_pos + 1;
-
- tmp_desc = mmfile_malloc(sizeof(char) * dis_len);
-
- if (tmp_desc != NULL) {
- memcpy(tmp_desc, pExtContent + imgstartOffset, dis_len);
-
- /*convert description*/
- pInfo->imageInfo.imageDescription = mmfile_string_convert(tmp_desc, dis_len, "UTF-8", charset_array[textEncodingType], NULL, (unsigned int *)&new_dis_len);
- mmfile_free(tmp_desc);
- debug_msg(RELEASE, "new_desc %s(%d)\n", pInfo->imageInfo.imageDescription, new_dis_len);
- pInfo->imageInfo.imgDesLen = new_dis_len; /**/
- }
-
- imgstartOffset += cur_pos;
- } else {
- pInfo->imageInfo.imgDesLen = 0;
- }
-
- if ((pExtContent[imgstartOffset] == '\0') && (realCpyFrameNum - imgstartOffset > 0)) {
- imgstartOffset++; /* endofDesceriptionType(1byte) */
-
- while (pExtContent[imgstartOffset] == '\0') { /*some content has useless '\0' in front of picture data */
- imgstartOffset++;
- }
-
- debug_msg(RELEASE, "after scaning imgDescription imgstartOffset(%d) value!\n", imgstartOffset);
-
- if (realCpyFrameNum - imgstartOffset > 0) {
- pInfo->imageInfo.imageLen = realCpyFrameNum - imgstartOffset;
- pInfo->imageInfo.pImageBuf = mmfile_malloc(pInfo->imageInfo.imageLen + 1);
-
- if (pInfo->imageInfo.pImageBuf != NULL) {
- memcpy(pInfo->imageInfo.pImageBuf, pExtContent + imgstartOffset, pInfo->imageInfo.imageLen);
- pInfo->imageInfo.pImageBuf[pInfo->imageInfo.imageLen] = 0;
- }
-
- if (IS_INCLUDE_URL(pInfo->imageInfo.imageMIMEType))
- pInfo->imageInfo.bURLInfo = true; /*if mimetype is "-->", image date has an URL */
- } else {
- debug_msg(RELEASE, "No APIC image!! realCpyFrameNum(%d) - imgstartOffset(%d)\n", realCpyFrameNum, imgstartOffset);
- }
- }
-
- /*checkImgMimeTypeMax = 0;*/
- checkImgExtMax = 0;
- inx = 0;
- imgstartOffset = 0;
+ debug_msg(DEBUG, "text encoding %d \n", textEncodingType);
+ if (!_mm_file_id3tag_parse_PIC(pInfo, pExtContent, realCpyFrameNum, (const char*)charset_array[textEncodingType]))
+ continue;
pInfo->tagV2Info.bImageMarked = true;
-
}
}
unsigned char *pExtContent = NULL;
unsigned long purelyFramelen = 0;
unsigned int encodingOffSet = 0;
- int inx = 0, realCpyFrameNum = 0, checkImgMimeTypeMax = 0, imgstartOffset = 0, tmp = 0;
+ int realCpyFrameNum = 0, tmp = 0;
unsigned int textEncodingType = 0;
char **charset_array = NULL;
- const char *MIME_PRFIX = "image/";
make_characterset_array(&charset_array);
pInfo->tagV2Info.bRecDateMarked = true;
} else if (strncmp((char *)CompTmp, "APIC", 4) == 0 && pInfo->tagV2Info.bImageMarked == false && realCpyFrameNum <= 2000000) {
debug_msg(DEBUG, "text encoding %d \n", textEncodingType);
-
- if (pExtContent[0] != '\0') {
- for (inx = 0; inx < MP3_ID3_IMAGE_MIME_TYPE_MAX_LENGTH - 1; inx++)
- pInfo->imageInfo.imageMIMEType[inx] = '\0';/*ini mimetype variable */
-
- while ((checkImgMimeTypeMax < MP3_ID3_IMAGE_MIME_TYPE_MAX_LENGTH - 1) && pExtContent[checkImgMimeTypeMax] != '\0') {
- pInfo->imageInfo.imageMIMEType[checkImgMimeTypeMax] = pExtContent[checkImgMimeTypeMax];
- checkImgMimeTypeMax++;
- }
- pInfo->imageInfo.imgMimetypeLen = checkImgMimeTypeMax;
- } else {
- pInfo->imageInfo.imgMimetypeLen = 0;
- debug_msg(RELEASE, "APIC image's not included to MIME type\n");
- }
-
- imgstartOffset += checkImgMimeTypeMax;
-
- if (strncmp(pInfo->imageInfo.imageMIMEType, MIME_PRFIX, strlen(MIME_PRFIX)) != 0) {
- pInfo->imageInfo.imgMimetypeLen = 0;
- debug_error(DEBUG, "APIC NOT VALID");
+ if (!_mm_file_id3tag_parse_APIC(pInfo, pExtContent, realCpyFrameNum, (const char*)charset_array[textEncodingType]))
continue;
- }
-
- if ((pExtContent[imgstartOffset] == '\0') && (realCpyFrameNum - imgstartOffset > 0)) {
- imgstartOffset++;/*endofMIME(1byte) */
- debug_msg(RELEASE, "after scaning Mime type imgstartOffset(%d) value!\n", imgstartOffset);
-
- if (pExtContent[imgstartOffset] < AV_ID3V2_PICTURE_TYPE_MAX) {
- pInfo->imageInfo.pictureType = pExtContent[imgstartOffset];
- } else {
- debug_msg(RELEASE, "APIC image has invalid picture type(0x%x)\n", pExtContent[imgstartOffset]);
- }
- imgstartOffset++;/*PictureType(1byte) */
- debug_msg(RELEASE, "after scaning PictureType imgstartOffset(%d) value!\n", imgstartOffset);
-
- if (pExtContent[imgstartOffset] != 0x0) {
- int cur_pos = 0;
- int dis_len = 0;
- int new_dis_len = 0;
- char *tmp_desc = NULL;
-
- while (1) {
- if (pExtContent[imgstartOffset + cur_pos] == '\0') {
- if (realCpyFrameNum < imgstartOffset + cur_pos) {
- debug_error(DEBUG, "End of APIC Tag %d %d %d\n", realCpyFrameNum, imgstartOffset, cur_pos);
- break;
- }
- /*check end of image description*/
- if ((pExtContent[imgstartOffset + cur_pos + 1] == gTagJPEGHeader[0]) ||
- (pExtContent[imgstartOffset + cur_pos + 1] == gTagPNGHeader[0])) {
- debug_msg(RELEASE, "length of description (%d)", cur_pos);
- break;
- }
- }
- cur_pos++;
- }
-
- dis_len = cur_pos + 1;
-
- tmp_desc = mmfile_malloc(sizeof(char) * dis_len);
- if (tmp_desc != NULL) {
- memcpy(tmp_desc, pExtContent + imgstartOffset, dis_len);
-
- /*convert description*/
- pInfo->imageInfo.imageDescription = mmfile_string_convert(tmp_desc, dis_len, "UTF-8", charset_array[textEncodingType], NULL, (unsigned int *)&new_dis_len);
- debug_msg(RELEASE, "new_desc %s(%d)\n", pInfo->imageInfo.imageDescription, new_dis_len);
- mmfile_free(tmp_desc);
-
- pInfo->imageInfo.imgDesLen = new_dis_len; /**/
- }
-
- imgstartOffset += cur_pos;
- } else {
- pInfo->imageInfo.imgDesLen = 0;
- debug_msg(RELEASE, "APIC image's not included to Description!!!\n");
- }
-
- if ((pExtContent[imgstartOffset] == '\0') && (realCpyFrameNum - imgstartOffset > 0)) {
- imgstartOffset++; /* endofDesceriptionType(1byte) */
-
- while (pExtContent[imgstartOffset] == '\0') { /*some content has useless '\0' in front of picture data */
- imgstartOffset++;
- }
-
- debug_msg(RELEASE, "after scaning imgDescription imgstartOffset(%d) value!\n", imgstartOffset);
-
- if (realCpyFrameNum - imgstartOffset > 0) {
- pInfo->imageInfo.imageLen = realCpyFrameNum - imgstartOffset;
- pInfo->imageInfo.pImageBuf = mmfile_malloc(pInfo->imageInfo.imageLen + 1);
-
- if (pInfo->imageInfo.pImageBuf != NULL) {
- memcpy(pInfo->imageInfo.pImageBuf, pExtContent + imgstartOffset, pInfo->imageInfo.imageLen);
- pInfo->imageInfo.pImageBuf[pInfo->imageInfo.imageLen] = 0;
- }
-
- if (IS_INCLUDE_URL(pInfo->imageInfo.imageMIMEType))
- pInfo->imageInfo.bURLInfo = true; /*if mimetype is "-->", image date has an URL */
- } else {
- debug_msg(RELEASE, "No APIC image!! realCpyFrameNum(%d) - imgstartOffset(%d)\n", realCpyFrameNum, imgstartOffset);
- }
- debug_msg(RELEASE, "pInfo->imageInfo.imageLen(%d), imgstartOffset(%d)!\n", pInfo->imageInfo.imageLen, imgstartOffset);
- } else {
- debug_msg(RELEASE, "pExtContent[imgstartOffset](%d) value should setted NULL value for end of description! realCpyFrameNum - imgstartOffset(%d)\n",
- pExtContent[imgstartOffset], realCpyFrameNum - imgstartOffset);
- }
- } else {
- debug_msg(RELEASE, "pExtContent[imgstartOffset](%d) value should setted NULL value for end of mimetype! realCpyFrameNum - imgstartOffset(%d)\n",
- pExtContent[imgstartOffset], realCpyFrameNum - imgstartOffset);
- }
-
- checkImgMimeTypeMax = 0;
- inx = 0;
- imgstartOffset = 0;
pInfo->tagV2Info.bImageMarked = true;
-
} else {
debug_msg(RELEASE, "CompTmp(%s) This Frame ID currently not Supports!!\n", CompTmp);
}
unsigned char *pExtContent = NULL;
unsigned long purelyFramelen = 0;
unsigned int encodingOffSet = 0;
- int inx = 0, realCpyFrameNum = 0, checkImgMimeTypeMax = 0, imgstartOffset = 0, tmp = 0;
+ int realCpyFrameNum = 0, tmp = 0;
unsigned int textEncodingType = 0;
char **charset_array = NULL;
- const char *MIME_PRFIX = "image/";
make_characterset_array(&charset_array);
debug_msg(RELEASE, "pInfo->pContentGroup returned = (%s), pInfo->contentGroupLen(%d)\n", pInfo->pContentGroup, pInfo->contentGroupLen);
pInfo->tagV2Info.bContentGroupMarked = true;
} else if (strncmp((char *)CompTmp, "APIC", 4) == 0 && pInfo->tagV2Info.bImageMarked == false && realCpyFrameNum <= 2000000) {
- if (pExtContent[0] != '\0') {
- for (inx = 0; inx < MP3_ID3_IMAGE_MIME_TYPE_MAX_LENGTH - 1; inx++)
- pInfo->imageInfo.imageMIMEType[inx] = '\0';/*ini mimetype variable */
-
- while ((checkImgMimeTypeMax < MP3_ID3_IMAGE_MIME_TYPE_MAX_LENGTH - 1) && pExtContent[checkImgMimeTypeMax] != '\0') {
- pInfo->imageInfo.imageMIMEType[checkImgMimeTypeMax] = pExtContent[checkImgMimeTypeMax];
- checkImgMimeTypeMax++;
- }
- pInfo->imageInfo.imgMimetypeLen = checkImgMimeTypeMax;
- } else {
- pInfo->imageInfo.imgMimetypeLen = 0;
- }
-
- imgstartOffset += checkImgMimeTypeMax;
-
- if (strncmp(pInfo->imageInfo.imageMIMEType, MIME_PRFIX, strlen(MIME_PRFIX)) != 0) {
- pInfo->imageInfo.imgMimetypeLen = 0;
- debug_error(DEBUG, "APIC NOT VALID");
+ debug_msg(DEBUG, "text encoding %d \n", textEncodingType);
+ if (!_mm_file_id3tag_parse_APIC(pInfo, pExtContent, realCpyFrameNum, (const char*)charset_array[textEncodingType]))
continue;
- }
-
- if ((pExtContent[imgstartOffset] == '\0') && (realCpyFrameNum - imgstartOffset > 0)) {
- imgstartOffset++;/*endofMIME(1byte) */
-
- if (pExtContent[imgstartOffset] < AV_ID3V2_PICTURE_TYPE_MAX) {
- pInfo->imageInfo.pictureType = pExtContent[imgstartOffset];
- }
- imgstartOffset++;/*PictureType(1byte) */
-
- if (pExtContent[imgstartOffset] != 0x0) {
- int cur_pos = 0;
- int dis_len = 0;
- int new_dis_len = 0;
- char *tmp_desc = NULL;
-
- while (1) {
- if (pExtContent[imgstartOffset + cur_pos] == '\0') {
- if (realCpyFrameNum < imgstartOffset + cur_pos) {
- debug_error(DEBUG, "End of APIC Tag %d %d %d\n", realCpyFrameNum, imgstartOffset, cur_pos);
- break;
- }
- /*check end of image description*/
- if ((pExtContent[imgstartOffset + cur_pos + 1] == gTagJPEGHeader[0]) ||
- (pExtContent[imgstartOffset + cur_pos + 1] == gTagPNGHeader[0])) {
- debug_msg(RELEASE, "length of description (%d)", cur_pos);
- break;
- }
- }
- cur_pos++;
- }
-
- dis_len = cur_pos + 1;
-
- tmp_desc = mmfile_malloc(sizeof(char) * dis_len);
-
- if (tmp_desc != NULL) {
- memcpy(tmp_desc, pExtContent + imgstartOffset, dis_len);
- debug_msg(DEBUG, "tmp_desc %s\n", tmp_desc);
-
- /*convert description*/
- pInfo->imageInfo.imageDescription = mmfile_string_convert(tmp_desc, dis_len, "UTF-8", charset_array[textEncodingType], NULL, (unsigned int *)&new_dis_len);
- debug_msg(DEBUG, "new_desc %s(%d)\n", pInfo->imageInfo.imageDescription, new_dis_len);
- mmfile_free(tmp_desc);
-
- pInfo->imageInfo.imgDesLen = new_dis_len; /**/
- }
-
- imgstartOffset += cur_pos;
- } else {
- pInfo->imageInfo.imgDesLen = 0;
- }
-
- if ((pExtContent[imgstartOffset] == '\0') && (realCpyFrameNum - imgstartOffset > 0)) {
- imgstartOffset++; /* endofDesceriptionType(1byte) */
-
- while (pExtContent[imgstartOffset] == '\0') { /*some content has useless '\0' in front of picture data */
- imgstartOffset++;
- }
-
- debug_msg(RELEASE, "after scaning imgDescription imgstartOffset(%d) value!\n", imgstartOffset);
-
- if (realCpyFrameNum - imgstartOffset > 0) {
- pInfo->imageInfo.imageLen = realCpyFrameNum - imgstartOffset;
- pInfo->imageInfo.pImageBuf = mmfile_malloc(pInfo->imageInfo.imageLen + 1);
-
- if (pInfo->imageInfo.pImageBuf != NULL) {
- memcpy(pInfo->imageInfo.pImageBuf, pExtContent + imgstartOffset, pInfo->imageInfo.imageLen);
- pInfo->imageInfo.pImageBuf[pInfo->imageInfo.imageLen] = 0;
- }
-
- if (IS_INCLUDE_URL(pInfo->imageInfo.imageMIMEType))
- pInfo->imageInfo.bURLInfo = true; /*if mimetype is "-->", image date has an URL */
- } else {
- debug_msg(RELEASE, "No APIC image!! realCpyFrameNum(%d) - imgstartOffset(%d)\n", realCpyFrameNum, imgstartOffset);
- }
- }
- }
-
- checkImgMimeTypeMax = 0;
- inx = 0;
- imgstartOffset = 0;
pInfo->tagV2Info.bImageMarked = true;
} else {
debug_msg(RELEASE, "CompTmp(%s) This Frame ID currently not Supports!!\n", CompTmp);