[TNEF-7080] Change PNG checker for album art of ID3 tag 11/71711/3 accepted/tizen/common/20160609.145215 accepted/tizen/ivi/20160609.091736 accepted/tizen/mobile/20160609.091955 accepted/tizen/tv/20160609.091605 accepted/tizen/wearable/20160609.091710 submit/tizen/20160609.040222
authorJiyong Min <jiyong.min@samsung.com>
Thu, 26 May 2016 23:34:30 +0000 (08:34 +0900)
committerJiyong Min <jiyong.min@samsung.com>
Thu, 2 Jun 2016 02:42:28 +0000 (19:42 -0700)
Change-Id: I5c012185bd614081dd36a33aec5cdf1f23cb9705
Signed-off-by: Jiyong Min <jiyong.min@samsung.com>
utils/mm_file_util_tag.c

index 06b1a5f..2ca3440 100755 (executable)
@@ -166,6 +166,8 @@ static const char *MpegAudio_Genre[GENRE_COUNT] = {"Blues", "Classic Rock", "Cou
                                                                                                "Contemporary", "Christian Rock", "Merengue", "Salsa", "Thrash Metal", "Anime", "JPop", "Synthpop", "Unknown"
                                                                                                };
 
+static unsigned char gTagJPEGHeader[] = {0xff, 0xd8, 0xff };
+static unsigned char gTagPNGHeader[] = {0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a };
 
 static int GetStringFromTextTagBox(MMFileFormatContext *formatContext, MMFileIOHandle *fp, MMFILE_MP4_BASIC_BOX_HEADER *basic_header, eMMFILE_3GP_TEXT_TAG eTag)
 {
@@ -2010,8 +2012,6 @@ bool mm_file_id3tag_parse_v222(AvFileContentInfo *pInfo, unsigned char *buffer)
                                                                int cur_pos = 0;
                                                                int dis_len = 0;
                                                                int new_dis_len = 0;
-                                                               unsigned char jpg_sign[3] = {0xff, 0xd8, 0xff};
-                                                               unsigned char png_sign[8] = {0x80, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a};
                                                                char *tmp_desc = NULL;
 
                                                                while (1) {
@@ -2021,8 +2021,8 @@ bool mm_file_id3tag_parse_v222(AvFileContentInfo *pInfo, unsigned char *buffer)
                                                                                        break;
                                                                                }
                                                                                /*check end of image description*/
-                                                                               if ((pExtContent[imgstartOffset + cur_pos + 1] == jpg_sign[0]) ||
-                                                                                   (pExtContent[imgstartOffset + cur_pos + 1] == png_sign[0])) {
+                                                                               if ((pExtContent[imgstartOffset + cur_pos + 1] == gTagJPEGHeader[0]) ||
+                                                                                   (pExtContent[imgstartOffset + cur_pos + 1] == gTagPNGHeader[0])) {
 #ifdef __MMFILE_TEST_MODE__
                                                                                        debug_msg("length of description (%d)", cur_pos);
 #endif
@@ -2725,8 +2725,6 @@ bool mm_file_id3tag_parse_v223(AvFileContentInfo *pInfo, unsigned char *buffer)
                                                                        int cur_pos = 0;
                                                                        int dis_len = 0;
                                                                        int new_dis_len = 0;
-                                                                       unsigned char jpg_sign[3] = {0xff, 0xd8, 0xff};
-                                                                       unsigned char png_sign[8] = {0x80, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a};
                                                                        char *tmp_desc = NULL;
 
                                                                        while (1) {
@@ -2736,8 +2734,8 @@ bool mm_file_id3tag_parse_v223(AvFileContentInfo *pInfo, unsigned char *buffer)
                                                                                                break;
                                                                                        }
                                                                                        /*check end of image description*/
-                                                                                       if ((pExtContent[imgstartOffset + cur_pos + 1] == jpg_sign[0]) ||
-                                                                                           (pExtContent[imgstartOffset + cur_pos + 1] == png_sign[0])) {
+                                                                                       if ((pExtContent[imgstartOffset + cur_pos + 1] == gTagJPEGHeader[0]) ||
+                                                                                           (pExtContent[imgstartOffset + cur_pos + 1] == gTagPNGHeader[0])) {
 #ifdef __MMFILE_TEST_MODE__
                                                                                                debug_msg("length of description (%d)", cur_pos);
 #endif
@@ -3530,8 +3528,6 @@ bool mm_file_id3tag_parse_v224(AvFileContentInfo *pInfo, unsigned char *buffer)
                                                                        int cur_pos = 0;
                                                                        int dis_len = 0;
                                                                        int new_dis_len = 0;
-                                                                       unsigned char jpg_sign[3] = {0xff, 0xd8, 0xff};
-                                                                       unsigned char png_sign[8] = {0x80, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a};
                                                                        char *tmp_desc = NULL;
 
                                                                        while (1) {
@@ -3541,8 +3537,8 @@ bool mm_file_id3tag_parse_v224(AvFileContentInfo *pInfo, unsigned char *buffer)
                                                                                                break;
                                                                                        }
                                                                                        /*check end of image description*/
-                                                                                       if ((pExtContent[imgstartOffset + cur_pos + 1] == jpg_sign[0]) ||
-                                                                                           (pExtContent[imgstartOffset + cur_pos + 1] == png_sign[0])) {
+                                                                                       if ((pExtContent[imgstartOffset + cur_pos + 1] == gTagJPEGHeader[0]) ||
+                                                                                           (pExtContent[imgstartOffset + cur_pos + 1] == gTagPNGHeader[0])) {
 #ifdef __MMFILE_TEST_MODE__
                                                                                                debug_msg("length of description (%d)", cur_pos);
 #endif