2.4 sync 42/44642/6 accepted/tizen/mobile/20150727.011544 accepted/tizen/tv/20150727.011600 accepted/tizen/wearable/20150727.011615 submit/tizen/20150727.002744
authorji.yong.seo <ji.yong.seo@samsung.com>
Fri, 24 Jul 2015 07:25:03 +0000 (16:25 +0900)
committerji.yong.seo <ji.yong.seo@samsung.com>
Fri, 24 Jul 2015 09:43:05 +0000 (18:43 +0900)
Signed-off-by: ji.yong.seo <ji.yong.seo@samsung.com>
Change-Id: I85e38ca8b07fabe2540232f61eaf70b9bcde9b3b

formats/ffmpeg/Makefile.am
formats/ffmpeg/mm_file_format_ffmpeg.c
formats/ffmpeg/mm_file_format_wav.c
formats/ffmpeg/mm_file_formats.c
packaging/libmm-fileinfo.spec
utils/mm_file_util_tag.c

index b921cb5..a2b51a5 100755 (executable)
@@ -37,7 +37,7 @@ libmmfile_formats_la_CFLAGS = -I$(srcdir)/include \
                          $(AVUTIL_CFLAGS) \
                           $(AVCODEC_CFLAGS) \
                           $(SWSCALE_CFLAGS) \
-                         $(AVFORMAT_CFLAGS) 
+                         $(AVFORMAT_CFLAGS)
 
 if USE_TESTMODE
 libmmfile_formats_la_CFLAGS += -D__MMFILE_TEST_MODE__
index 26da22f..1bf9faf 100755 (executable)
@@ -371,7 +371,7 @@ int mmfile_format_read_stream_ffmpg(MMFileFormatContext *formatContext)
 #ifdef __MMFILE_FFMPEG_V085__
                if (pFormatCtx->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
 #else
-               if ( pFormatCtx->streams[i]->codec->codec_type == AV_CODEC_TYPE_VIDEO) {
+               if (pFormatCtx->streams[i]->codec->codec_type == AV_CODEC_TYPE_VIDEO) {
 #endif
                        if (formatContext->videoStreamId == -1) {
                                videoStream = mmfile_malloc(sizeof(MMFileFormatStream));
@@ -425,7 +425,7 @@ int mmfile_format_read_stream_ffmpg(MMFileFormatContext *formatContext)
 #ifdef __MMFILE_FFMPEG_V085__
                else if (pFormatCtx->streams[i]->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
 #else
-               else if ( pFormatCtx->streams[i]->codec->codec_type == AV_CODEC_TYPE_AUDIO ) {
+               else if (pFormatCtx->streams[i]->codec->codec_type == AV_CODEC_TYPE_AUDIO) {
 #endif
                        if (formatContext->audioStreamId == -1) {
                                audioStream = mmfile_malloc(sizeof(MMFileFormatStream));
@@ -929,7 +929,6 @@ int mmfile_format_close_ffmpg(MMFileFormatContext *formatContext)
 #endif
                        formatContext->privateFormatData = NULL;
                }
-
        }
 
        return MMFILE_FORMAT_SUCCESS;
@@ -1082,8 +1081,8 @@ static void _dump_av_packet(AVPacket *pkt)
        debug_msg(" flags: 0x%08X, %s\n", pkt->flags, (pkt->flags & PKT_FLAG_KEY) ? "Keyframe" : "_");
 #endif
        debug_msg(" duration: %d\n", pkt->duration);
-       debug_msg(" destruct: %p\n", pkt->destruct);
-       debug_msg(" priv: %p\n", pkt->priv);
+       /*debug_msg(" destruct: %p\n", pkt->destruct);*/
+       /*debug_msg(" priv: %p\n", pkt->priv);*/
        debug_msg(" pos: %lld\n", pkt->pos);
        debug_msg(" convergence_duration: %lld\n", pkt->convergence_duration);
        debug_msg("-------------------------------\n");
@@ -1363,9 +1362,11 @@ static int ConvertVideoCodecEnum(int AVVideoCodecID)
                case AV_CODEC_ID_RV40:  /* RealVideo 4 */
                        ret_codecid = MM_VIDEO_CODEC_REAL;
                        break;
+#ifdef __MMFILE_LIBAV_VERSION__
                case AV_CODEC_ID_HEVC:
                        ret_codecid = MM_VIDEO_CODEC_MPEG4;
                        break;
+#endif
                default:
                        ret_codecid = MM_VIDEO_CODEC_NONE;
                        break;
index 2b13fe3..8bbfe8e 100755 (executable)
@@ -55,7 +55,7 @@
 #ifdef __MMFILE_TEST_MODE__
 typedef struct {
        short   codec;          /**< WAVE form Registration Number*/
-       char    *name;          /**< WAVE form wFormatTag ID*/
+       const char      *name;          /**< WAVE form wFormatTag ID*/
 } MMF_FILE_WAVE_CODEC_NAME;
 
 MMF_FILE_WAVE_CODEC_NAME g_audio_cdc_tbl[] = {
@@ -371,7 +371,7 @@ int mmfile_format_close_wav(MMFileFormatContext *formatContext)
 }
 
 #ifdef __MMFILE_TEST_MODE__
-static char *
+static const char *
 _dump_codec_name(short codec)
 {
        int sz = sizeof(g_audio_cdc_tbl) / sizeof(MMF_FILE_WAVE_CODEC_NAME);
index 0d1e29d..a19284c 100755 (executable)
@@ -819,7 +819,7 @@ PROBE_PROPER_FILE_TYPE:
                        case MM_FILE_FORMAT_3GP:
                        case MM_FILE_FORMAT_MP4: {
                                if (skip_index == MM_FILE_FORMAT_QT || skip_index == MM_FILE_FORMAT_3GP || skip_index == MM_FILE_FORMAT_MP4)
-                                       goto FILE_FORMAT_FAIL;
+                                       break;
 
                                if (MMFileFormatIsValidMP4(fp, NULL)) {
                                        *formatEnum = MM_FILE_FORMAT_3GP;
@@ -833,7 +833,7 @@ PROBE_PROPER_FILE_TYPE:
                        case MM_FILE_FORMAT_WMA:
                        case MM_FILE_FORMAT_WMV: {
                                if (skip_index == MM_FILE_FORMAT_ASF || skip_index == MM_FILE_FORMAT_WMA || skip_index == MM_FILE_FORMAT_WMV)
-                                       goto FILE_FORMAT_FAIL;
+                                       break;
 
                                if (MMFileFormatIsValidASF(fp, NULL)) {
                                        *formatEnum = MM_FILE_FORMAT_ASF;
@@ -846,7 +846,7 @@ PROBE_PROPER_FILE_TYPE:
                        case MM_FILE_FORMAT_DIVX:
                        case MM_FILE_FORMAT_AVI: {
                                if (skip_index == MM_FILE_FORMAT_DIVX || skip_index == MM_FILE_FORMAT_AVI)
-                                       goto FILE_FORMAT_FAIL;
+                                       break;
 
                                if (MMFileFormatIsValidAVI(fp, NULL)) {
                                        *formatEnum = MM_FILE_FORMAT_AVI;
@@ -1008,7 +1008,6 @@ PROBE_PROPER_FILE_TYPE:
                        case MM_FILE_FORMAT_JPG:
                        default: {
                                debug_error("error: invaild format enum[%d]\n", index);
-                               goto FILE_FORMAT_FAIL;
                                break;
                        }
                }
index 0034c92..cac15d7 100755 (executable)
@@ -1,6 +1,6 @@
 Name:      libmm-fileinfo
 Summary:    Media Fileinfo
-Version:    0.6.34
+Version:    0.6.35
 Release:    0
 Group:      System/Libraries
 License:    Apache-2.0
index 835977a..1e82db4 100755 (executable)
@@ -1695,7 +1695,7 @@ bool mm_file_id3tag_parse_v222(AvFileContentInfo *pInfo, unsigned char *buffer)
        unsigned long v2numOfFrames = 0;
        unsigned long curPos = 0;
        char CompTmp[4];
-       char *pExtContent = NULL;
+       unsigned char *pExtContent = NULL;
        unsigned long purelyFramelen = 0;
        unsigned int encodingOffSet = 0;
        int inx = 0, realCpyFrameNum = 0,
@@ -1758,6 +1758,12 @@ bool mm_file_id3tag_parse_v222(AvFileContentInfo *pInfo, unsigned char *buffer)
                                if (encodingOffSet < purelyFramelen) {
                                        realCpyFrameNum = purelyFramelen - encodingOffSet;
                                        pExtContent = mmfile_malloc(realCpyFrameNum + 3);
+
+                                       if (pExtContent == NULL) {
+                                               debug_error("out of memory for pExtContent\n");
+                                               continue;
+                                       }
+
                                        memset(pExtContent, '\0', realCpyFrameNum + 3);
 
                                        memcpy(pExtContent, &buffer[curPos - purelyFramelen + encodingOffSet], purelyFramelen - encodingOffSet);
@@ -1976,8 +1982,8 @@ bool mm_file_id3tag_parse_v222(AvFileContentInfo *pInfo, unsigned char *buffer)
                                                                int cur_pos = 0;
                                                                int dis_len = 0;
                                                                int new_dis_len = 0;
-                                                               char jpg_sign[3] = {0xff, 0xd8, 0xff};
-                                                               char png_sign[8] = {0x80, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a};
+                                                               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) {
@@ -2687,8 +2693,8 @@ bool mm_file_id3tag_parse_v223(AvFileContentInfo *pInfo, unsigned char *buffer)
                                                                        int cur_pos = 0;
                                                                        int dis_len = 0;
                                                                        int new_dis_len = 0;
-                                                                       char jpg_sign[3] = {0xff, 0xd8, 0xff};
-                                                                       char png_sign[8] = {0x80, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a};
+                                                                       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) {
@@ -3243,12 +3249,17 @@ bool mm_file_id3tag_parse_v224(AvFileContentInfo *pInfo, unsigned char *buffer)
 
                                                                if (textEncodingType == AV_ID3V2_UTF8) {
                                                                        pInfo->pUnsyncLyrics = mmfile_malloc(realCpyFrameNum + 2); /*Ignore NULL char for UTF16 */
-                                                                       memset(pInfo->pUnsyncLyrics, 0, (realCpyFrameNum + 2));
-                                                                       memcpy(pInfo->pUnsyncLyrics, pExtContent + tmp, realCpyFrameNum);
-                                                                       pInfo->pUnsyncLyrics[realCpyFrameNum] = '\0';
-                                                                       /*string copy with '\0'*/
-                                                                       pInfo->unsynclyricsLen = realCpyFrameNum;
-                                                                       _STRNCPY_EX(pInfo->pUnsyncLyrics, pExtContent, pInfo->unsynclyricsLen);
+
+                                                                       if (pInfo->pUnsyncLyrics != NULL) {
+                                                                               memset(pInfo->pUnsyncLyrics, 0, (realCpyFrameNum + 2));
+                                                                               memcpy(pInfo->pUnsyncLyrics, pExtContent + tmp, realCpyFrameNum);
+                                                                               pInfo->pUnsyncLyrics[realCpyFrameNum] = '\0';
+                                                                               /*string copy with '\0'*/
+                                                                               pInfo->unsynclyricsLen = realCpyFrameNum;
+                                                                               _STRNCPY_EX(pInfo->pUnsyncLyrics, pExtContent, pInfo->unsynclyricsLen);
+                                                                       } else {
+                                                                               debug_error("out of memoryu for SyncLyrics\n");
+                                                                       }
                                                                } else {
                                                                        pInfo->pUnsyncLyrics = mmfile_string_convert((const char *)&pExtContent[tmp], realCpyFrameNum, "UTF-8", charset_array[textEncodingType], NULL, (unsigned int *)&pInfo->unsynclyricsLen);
                                                                }
@@ -3477,8 +3488,8 @@ bool mm_file_id3tag_parse_v224(AvFileContentInfo *pInfo, unsigned char *buffer)
                                                                        int cur_pos = 0;
                                                                        int dis_len = 0;
                                                                        int new_dis_len = 0;
-                                                                       char jpg_sign[3] = {0xff, 0xd8, 0xff};
-                                                                       char png_sign[8] = {0x80, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a};
+                                                                       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) {