Remove dependency with libmm-common. 68/48968/5 accepted/tizen/mobile/20151103.105437 accepted/tizen/tv/20151103.105450 accepted/tizen/wearable/20151103.105501 submit/tizen/20151103.053124 submit/tizen/20151103.065424
authorji.yong.seo <ji.yong.seo@samsung.com>
Fri, 2 Oct 2015 09:19:35 +0000 (18:19 +0900)
committerji.yong.seo <ji.yong.seo@samsung.com>
Thu, 15 Oct 2015 07:04:31 +0000 (16:04 +0900)
Change-Id: Ia79020ede78ee6f16729d3983b6d1b44f1da1cd9
Signed-off-by: ji.yong.seo <ji.yong.seo@samsung.com>
13 files changed:
Makefile.am
codecs/ffmpeg/mm_file_codec_dummy.c
formats/ffmpeg/mm_file_format_aac.c
formats/ffmpeg/mm_file_format_amr.c
formats/ffmpeg/mm_file_format_dummy.c
formats/ffmpeg/mm_file_format_midi.c
formats/ffmpeg/mm_file_format_wav.c
include/mm_file.h
include/mm_file_error.h [new file with mode: 0755]
mm_file.c
packaging/libmm-fileinfo.spec
tests/mm_file_test.c
utils/mm_file_util_validity.c

index 2ecc9df..fb6be07 100755 (executable)
@@ -4,7 +4,7 @@ SUBDIRS = utils \
          codecs \
          formats \
          . \
-         tests 
+         tests
 
 lib_LTLIBRARIES = libmmffile.la
 
@@ -12,24 +12,25 @@ noinst_HEADERS = include/mm_file_codecs.h \
                 include/mm_file_formats.h \
                 include/mm_file_format_frame.h
 
-libmmffile_la_SOURCES = mm_file.c 
+libmmffile_la_SOURCES = mm_file.c
 
 includelibmmffiledir = $(includedir)/mmf
-includelibmmffile_HEADERS = include/mm_file.h 
-                       
+includelibmmffile_HEADERS = include/mm_file.h \
+                                                       include/mm_file_error.h
+
 libmmffile_la_CFLAGS = -I$(srcdir)/include \
                       $(MMCOMMON_CFLAGS) \
                       -I$(srcdir)/utils/include \
                       -D_LARGEFILE64_SOURCE \
-                      -D_FILE_OFFSET_BITS=64 
+                      -D_FILE_OFFSET_BITS=64
 
 if USE_TESTMODE
 libmmffile_la_CFLAGS += -D__MMFILE_TEST_MODE__
 endif
 
-libmmffile_la_DEPENDENCIES = $(top_builddir)/utils/libmmfile_utils.la 
-                  
-                 
+libmmffile_la_DEPENDENCIES = $(top_builddir)/utils/libmmfile_utils.la
+
+
 libmmffile_la_LIBADD = $(top_builddir)/utils/libmmfile_utils.la \
                        -ldl \
                       $(MMCOMMON_LIBS)
index e03c960..10b6ee6 100755 (executable)
@@ -22,8 +22,7 @@
 #include <string.h>    /*memcmp*/
 #include <stdlib.h>    /*malloc*/
 
-#include <mm_error.h>
-
+#include "mm_file_error.h"
 #include "mm_file_debug.h"
 
 #include "mm_file_codec_private.h"
index bf7f60a..200b418 100755 (executable)
@@ -23,8 +23,6 @@
 #include <string.h>    /*memcmp*/
 #include <stdlib.h>    /*malloc*/
 
-#include <mm_error.h>
-
 #include "mm_file_debug.h"
 #include "mm_file_utils.h"
 #include "mm_file_format_private.h"
index 7edca53..0f8fce2 100755 (executable)
@@ -24,9 +24,7 @@
 #include <stdlib.h>    /*malloc*/
 
 
-#include <mm_error.h>
 #include "mm_file_debug.h"
-
 #include "mm_file_utils.h"
 #include "mm_file_format_private.h"
 #include "mm_file_format_amr.h"
index 9ecd927..7e2fae9 100755 (executable)
 #include <string.h>    /*memcmp*/
 #include <stdlib.h>    /*malloc*/
 
-#include <mm_error.h>
-
 #include "mm_file_debug.h"
-
 #include "mm_file_format_private.h"
 #include "mm_file_format_dummy.h"
 
index 08f0a2b..3197b2d 100755 (executable)
@@ -22,7 +22,6 @@
 #include <string.h>    /*memcmp*/
 #include <stdio.h>
 #include <stdlib.h>    /*malloc*/
-#include <mm_error.h>
 
 #include "mm_file_debug.h"
 #include "mm_file_utils.h"
index 8bbfe8e..3c239a9 100755 (executable)
@@ -22,9 +22,7 @@
 #include <string.h>
 #include <stdlib.h>    /*malloc*/
 
-#include <mm_error.h>
 #include "mm_file_debug.h"
-
 #include "mm_file_utils.h"
 #include "mm_file_format_private.h"
 #include "mm_file_format_wav.h"
index c7f8771..34e8752 100755 (executable)
@@ -35,6 +35,7 @@
 #include <glib.h>
 
 #include <mm_types.h>
+#include "mm_file_error.h"
 
 /**
        @addtogroup FILEINFO
diff --git a/include/mm_file_error.h b/include/mm_file_error.h
new file mode 100755 (executable)
index 0000000..d745fa7
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * libmm-fileinfo
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Haejeong Kim <backto.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef __MM_FILE_ERROR_H__
+#define __MM_FILE_ERROR_H__
+
+#ifdef __cplusplus
+        extern "C" {
+#endif
+
+#define FILEINFO_ERROR_NONE                                    0       /**< No Error */
+#define FILEINFO_ERROR_INVALID_ARGUMENT                -1      /**< Invalid argument */
+#define FILEINFO_ERROR_FILE_NOT_FOUND          -2      /**< Cannot find file */
+#define FILEINFO_ERROR_ATTR_NOT_EXIST          -3      /**< Attribute doesn't exist. */
+#define FILEINFO_ERROR_FILE_INTERNAL           -4      /**< Internal error */
+
+#ifdef __cplusplus
+        }
+#endif
+
+#endif /* __MM_FILE_ERROR_H__ */
index 59ea6c2..c60a2f3 100755 (executable)
--- a/mm_file.c
+++ b/mm_file.c
@@ -26,8 +26,6 @@
 #include <dlfcn.h>
 
 /* exported MM header files */
-#include <mm_types.h>
-#include <mm_error.h>
 #include <mm_file.h>
 
 /* internal MM header files */
@@ -391,12 +389,12 @@ _get_contents_info(mmf_attrs_t *attrs, MMFileSourceType *src, MMFILE_PARSE_INFO
        int ret = 0;
 
        if (!src || !parse)
-               return MM_ERROR_FILE_INTERNAL;
+               return FILEINFO_ERROR_FILE_INTERNAL;
 
        ret = mmfile_format_open(&formatContext, src);
        if (MMFILE_FORMAT_FAIL == ret || formatContext == NULL) {
                debug_error("error: mmfile_format_open\n");
-               ret = MM_ERROR_FILE_INTERNAL;
+               ret = FILEINFO_ERROR_FILE_INTERNAL;
                goto exception;
        }
 
@@ -406,7 +404,7 @@ _get_contents_info(mmf_attrs_t *attrs, MMFileSourceType *src, MMFILE_PARSE_INFO
                ret = mmfile_format_read_stream(formatContext);
                if (MMFILE_FORMAT_FAIL == ret) {
                        debug_error("error: mmfile_format_read_stream\n");
-                       ret = MM_ERROR_FILE_INTERNAL;
+                       ret = FILEINFO_ERROR_FILE_INTERNAL;
                        goto exception;
                }
 
@@ -434,7 +432,7 @@ _get_contents_info(mmf_attrs_t *attrs, MMFileSourceType *src, MMFILE_PARSE_INFO
                                ret = mmfile_format_read_frame(formatContext, timestamp, &frameContext);
                                if (MMFILE_FORMAT_FAIL == ret) {
                                        debug_error("error: mmfile_format_read_frame\n");
-                                       ret = MM_ERROR_FILE_INTERNAL;
+                                       ret = FILEINFO_ERROR_FILE_INTERNAL;
                                        goto warning;
                                }
 
@@ -450,14 +448,14 @@ _get_contents_info(mmf_attrs_t *attrs, MMFileSourceType *src, MMFILE_PARSE_INFO
                                        ret = mmfile_codec_open(&codecContext, MMFILE_VIDEO_DECODE, videoStream->codecId, &codecFrame);
                                        if (MMFILE_FORMAT_FAIL == ret) {
                                                debug_error("error: mmfile_codec_open\n");
-                                               ret = MM_ERROR_FILE_INTERNAL;
+                                               ret = FILEINFO_ERROR_FILE_INTERNAL;
                                                goto warning;
                                        }
 
                                        ret = mmfile_codec_decode(codecContext, &decodedFrame);
                                        if (MMFILE_FORMAT_FAIL == ret) {
                                                debug_error("error: mmfile_codec_decode\n");
-                                               ret = MM_ERROR_FILE_INTERNAL;
+                                               ret = FILEINFO_ERROR_FILE_INTERNAL;
                                                goto warning;
                                        }
 
@@ -465,7 +463,7 @@ _get_contents_info(mmf_attrs_t *attrs, MMFileSourceType *src, MMFILE_PARSE_INFO
                                        formatContext->thumbNail = mmfile_malloc(sizeof(MMFileFormatFrame));
                                        if (NULL == formatContext->thumbNail) {
                                                debug_error("error: mmfile_malloc\n");
-                                               ret = MM_ERROR_FILE_INTERNAL;
+                                               ret = FILEINFO_ERROR_FILE_INTERNAL;
                                                goto warning;
                                        }
 
@@ -479,7 +477,7 @@ _get_contents_info(mmf_attrs_t *attrs, MMFileSourceType *src, MMFILE_PARSE_INFO
                                        formatContext->thumbNail = mmfile_malloc(sizeof(MMFileFormatFrame));
                                        if (NULL == formatContext->thumbNail) {
                                                debug_error("error: mmfile_format_read_frame\n");
-                                               ret = MM_ERROR_FILE_INTERNAL;
+                                               ret = FILEINFO_ERROR_FILE_INTERNAL;
                                                goto warning;
                                        }
 
@@ -539,7 +537,7 @@ _get_contents_info(mmf_attrs_t *attrs, MMFileSourceType *src, MMFILE_PARSE_INFO
                mmfile_codec_close(codecContext);
        }
 
-       return MM_ERROR_NONE;
+       return FILEINFO_ERROR_NONE;
 
 warning:
        formatContext->commandType = MM_FILE_CONTENTS;
@@ -581,7 +579,7 @@ warning:
        if (codecContext)   {
                mmfile_codec_close(codecContext);
        }
-       return MM_ERROR_NONE;
+       return FILEINFO_ERROR_NONE;
 
 
 exception:
@@ -631,14 +629,14 @@ _get_tag_info(mmf_attrs_t *attrs, MMFileSourceType *src)
        ret = mmfile_format_open(&formatContext, src);
        if (MMFILE_FORMAT_FAIL == ret || formatContext == NULL) {
                debug_error("error: mmfile_format_open\n");
-               ret = MM_ERROR_FILE_INTERNAL;
+               ret = FILEINFO_ERROR_FILE_INTERNAL;
                goto exception;
        }
 
        ret = mmfile_format_read_tag(formatContext);
        if (MMFILE_FORMAT_FAIL == ret) {
                debug_warning("reading tag is fail\n");
-               ret = MM_ERROR_FILE_INTERNAL;
+               ret = FILEINFO_ERROR_FILE_INTERNAL;
                goto exception;
        }
 
@@ -650,7 +648,7 @@ _get_tag_info(mmf_attrs_t *attrs, MMFileSourceType *src)
                mmfile_format_close(formatContext);
        }
 
-       return MM_ERROR_NONE;
+       return FILEINFO_ERROR_NONE;
 
 
 exception:
@@ -658,7 +656,7 @@ exception:
                mmfile_format_close(formatContext);
        }
 
-       return MM_ERROR_FILE_INTERNAL;
+       return FILEINFO_ERROR_FILE_INTERNAL;
 }
 
 
@@ -667,17 +665,17 @@ exception:
  */
 int mm_file_get_attrs(MMHandleType attrs, char **err_attr_name, const char *first_attribute_name, ...)
 {
-       int ret = MM_ERROR_NONE;
+       int ret = FILEINFO_ERROR_NONE;
        va_list var_args;
 
        if (!attrs) {
                debug_error("Invalid arguments [attrs 0]\n");
-               return MM_ERROR_INVALID_ARGUMENT;
+               return FILEINFO_ERROR_INVALID_ARGUMENT;
        }
 
        if (first_attribute_name == NULL) {
                debug_error("Invalid arguments [first_attribute_name null]\n");
-               return MM_ERROR_INVALID_ARGUMENT;
+               return FILEINFO_ERROR_INVALID_ARGUMENT;
        }
 
        /* get requested attributes */
@@ -685,7 +683,7 @@ int mm_file_get_attrs(MMHandleType attrs, char **err_attr_name, const char *firs
        ret = mm_attrs_get_valist(attrs, err_attr_name, first_attribute_name, var_args);
        va_end(var_args);
 
-       if (ret != MM_ERROR_NONE) {
+       if (ret != FILEINFO_ERROR_NONE) {
                if (err_attr_name) {
                        debug_error("failed to get %s\n", *err_attr_name);
                }
@@ -696,7 +694,7 @@ int mm_file_get_attrs(MMHandleType attrs, char **err_attr_name, const char *firs
 
 int mm_file_get_synclyrics_info(MMHandleType tag_attrs, int index, unsigned long *time_info, char **lyrics)
 {
-       int ret = MM_ERROR_NONE;
+       int ret = FILEINFO_ERROR_NONE;
        AvSynclyricsInfo *sync_lyric_item = NULL;
        GList *synclyrics_list = NULL;
 
@@ -706,11 +704,11 @@ int mm_file_get_synclyrics_info(MMHandleType tag_attrs, int index, unsigned long
 
        if ((mmf_attrs_t *)tag_attrs == NULL) {
                debug_error("invalid handle");
-               return MM_ERROR_INVALID_ARGUMENT;
+               return FILEINFO_ERROR_INVALID_ARGUMENT;
        }
 
        ret = mm_attrs_get_data_by_name(tag_attrs, MM_FILE_TAG_SYNCLYRICS, (void **)&synclyrics_list);
-       if (ret != MM_ERROR_NONE) {
+       if (ret != FILEINFO_ERROR_NONE) {
 #ifdef __MMFILE_TEST_MODE__
                debug_warning("get data fail");
 #endif
@@ -725,7 +723,7 @@ int mm_file_get_synclyrics_info(MMHandleType tag_attrs, int index, unsigned long
 #ifdef __MMFILE_TEST_MODE__
                        debug_warning("synclyric item is NULL");
 #endif
-                       return MM_ERROR_COMMON_ATTR_NOT_EXIST;
+                       return FILEINFO_ERROR_ATTR_NOT_EXIST;
                }
 
                *time_info = sync_lyric_item->time_info;
@@ -735,7 +733,7 @@ int mm_file_get_synclyrics_info(MMHandleType tag_attrs, int index, unsigned long
 #ifdef __MMFILE_TEST_MODE__
                debug_warning("synclyrics_list is NULL");
 #endif
-               return MM_ERROR_COMMON_ATTR_NOT_EXIST;
+               return FILEINFO_ERROR_ATTR_NOT_EXIST;
        }
 
        return ret;
@@ -744,7 +742,7 @@ int mm_file_get_synclyrics_info(MMHandleType tag_attrs, int index, unsigned long
 
 int mm_file_create_tag_attrs(MMHandleType *tag_attrs, const char *filename)
 {
-       int ret = MM_ERROR_NONE;
+       int ret = FILEINFO_ERROR_NONE;
        mmf_attrs_t *attrs = NULL;
        MMFileSourceType src;
 
@@ -755,15 +753,15 @@ int mm_file_create_tag_attrs(MMHandleType *tag_attrs, const char *filename)
        /* Check argument here */
        if (tag_attrs == NULL) {
                debug_error("Invalid arguments [tag null]\n");
-               return MM_ERROR_INVALID_ARGUMENT;
+               return FILEINFO_ERROR_INVALID_ARGUMENT;
        }
        if (filename == NULL) {
                debug_error("Invalid arguments [filename null]\n");
-               return MM_ERROR_INVALID_ARGUMENT;
+               return FILEINFO_ERROR_INVALID_ARGUMENT;
        }
        if (strlen(filename) == 0)      {
                debug_error("Invalid arguments [filename size 0]\n");
-               return MM_ERROR_INVALID_ARGUMENT;
+               return FILEINFO_ERROR_INVALID_ARGUMENT;
        }
 
 
@@ -773,7 +771,7 @@ int mm_file_create_tag_attrs(MMHandleType *tag_attrs, const char *filename)
        ret = _load_dynamic_functions(&func_handle);
        if (ret == 0) {
                debug_error("load library error\n");
-               return MM_ERROR_FILE_INTERNAL;
+               return FILEINFO_ERROR_FILE_INTERNAL;
        }
 #endif
 
@@ -782,7 +780,7 @@ int mm_file_create_tag_attrs(MMHandleType *tag_attrs, const char *filename)
 
        ret = _is_file_exist(filename);
        if (!ret) {
-               ret = MM_ERROR_FILE_NOT_FOUND;
+               ret = FILEINFO_ERROR_FILE_NOT_FOUND;
                goto END;
        }
 
@@ -790,12 +788,12 @@ int mm_file_create_tag_attrs(MMHandleType *tag_attrs, const char *filename)
        attrs = (mmf_attrs_t *) mmf_attrs_new_from_data("tag", g_tag_attrs, ARRAY_SIZE(g_tag_attrs), NULL, NULL);
        if (!attrs) {
                debug_error("attribute internal error.\n");
-               ret = MM_ERROR_FILE_INTERNAL;
+               ret = FILEINFO_ERROR_FILE_INTERNAL;
                goto END;
        }
 
        ret = _get_tag_info(attrs, &src);
-       if (ret != MM_ERROR_NONE) {
+       if (ret != FILEINFO_ERROR_NONE) {
                mmf_attrs_free((MMHandleType)attrs);
                attrs = NULL;
                debug_error("failed to get tag: %s\n", filename);
@@ -821,7 +819,7 @@ int mm_file_destroy_tag_attrs(MMHandleType tag_attrs)
 {
        void *artwork = NULL;
        GList *synclyrics_list = NULL;
-       int ret = MM_ERROR_NONE;
+       int ret = FILEINFO_ERROR_NONE;
 
 #ifdef __MMFILE_TEST_MODE__
        debug_fenter();
@@ -829,7 +827,7 @@ int mm_file_destroy_tag_attrs(MMHandleType tag_attrs)
 
        if ((mmf_attrs_t *)tag_attrs == NULL) {
                debug_error("invalid handle.\n");
-               return MM_ERROR_INVALID_ARGUMENT;
+               return FILEINFO_ERROR_INVALID_ARGUMENT;
        }
 
        ret = mm_attrs_get_data_by_name(tag_attrs, MM_FILE_TAG_ARTWORK, &artwork);
@@ -868,15 +866,15 @@ int mm_file_create_content_attrs(MMHandleType *contents_attrs, const char *filen
        /* Check argument here */
        if (contents_attrs == NULL) {
                debug_error("Invalid arguments [contents null]\n");
-               return MM_ERROR_INVALID_ARGUMENT;
+               return FILEINFO_ERROR_INVALID_ARGUMENT;
        }
        if (filename == NULL) {
                debug_error("Invalid arguments [filename null]\n");
-               return MM_ERROR_INVALID_ARGUMENT;
+               return FILEINFO_ERROR_INVALID_ARGUMENT;
        }
        if (strlen(filename) == 0)      {
                debug_error("Invalid arguments [filename size 0]\n");
-               return MM_ERROR_INVALID_ARGUMENT;
+               return FILEINFO_ERROR_INVALID_ARGUMENT;
        }
 
 
@@ -891,7 +889,7 @@ int mm_file_create_content_attrs(MMHandleType *contents_attrs, const char *filen
        ret = _load_dynamic_functions(&func_handle);
        if (ret == 0) {
                debug_error("load library error\n");
-               return MM_ERROR_FILE_INTERNAL;
+               return FILEINFO_ERROR_FILE_INTERNAL;
        }
 
 #ifdef CHECK_TIME
@@ -905,7 +903,7 @@ int mm_file_create_content_attrs(MMHandleType *contents_attrs, const char *filen
 
        ret = _is_file_exist(filename);
        if (!ret) {
-               ret = MM_ERROR_FILE_NOT_FOUND;
+               ret = FILEINFO_ERROR_FILE_NOT_FOUND;
                goto END;
        }
 
@@ -913,14 +911,14 @@ int mm_file_create_content_attrs(MMHandleType *contents_attrs, const char *filen
        attrs = (mmf_attrs_t *) mmf_attrs_new_from_data("content", g_content_attrs, ARRAY_SIZE(g_content_attrs), NULL, NULL);
        if (!attrs) {
                debug_error("attribute internal error.\n");
-               ret = MM_ERROR_FILE_INTERNAL;
+               ret = FILEINFO_ERROR_FILE_INTERNAL;
                goto END;
        }
 
 
        parse.type = MM_FILE_PARSE_TYPE_ALL;
        ret = _get_contents_info(attrs, &src, &parse);
-       if (ret != MM_ERROR_NONE) {
+       if (ret != FILEINFO_ERROR_NONE) {
                mmf_attrs_free((MMHandleType)attrs);
                attrs = NULL;
                debug_error("failed to get contents: %s\n", filename);
@@ -967,7 +965,7 @@ int mm_file_create_tag_attrs_from_memory(MMHandleType *tag_attrs, const void *da
        /* Check argument here */
        if (tag_attrs == NULL || data == NULL) {
                debug_error("Invalid arguments\n");
-               return MM_ERROR_INVALID_ARGUMENT;
+               return FILEINFO_ERROR_INVALID_ARGUMENT;
        }
 
 #ifdef __MMFILE_DYN_LOADING__
@@ -976,7 +974,7 @@ int mm_file_create_tag_attrs_from_memory(MMHandleType *tag_attrs, const void *da
        ret = _load_dynamic_functions(&func_handle);
        if (ret == 0) {
                debug_error("load library error\n");
-               return MM_ERROR_FILE_INTERNAL;
+               return FILEINFO_ERROR_FILE_INTERNAL;
        }
 #endif
 
@@ -986,13 +984,13 @@ int mm_file_create_tag_attrs_from_memory(MMHandleType *tag_attrs, const void *da
        attrs = (mmf_attrs_t *) mmf_attrs_new_from_data("tag", g_tag_attrs, ARRAY_SIZE(g_tag_attrs), NULL, NULL);
        if (!attrs) {
                debug_error("attribute internal error.\n");
-               ret = MM_ERROR_FILE_INTERNAL;
+               ret = FILEINFO_ERROR_FILE_INTERNAL;
                goto END;
        }
 
        /*parse.type = MM_FILE_PARSE_TYPE_ALL;*/
        ret = _get_tag_info(attrs, &src);
-       if (ret != MM_ERROR_NONE) {
+       if (ret != FILEINFO_ERROR_NONE) {
                mmf_attrs_free((MMHandleType)attrs);
                attrs = NULL;
                debug_error("failed to get tag");
@@ -1028,7 +1026,7 @@ int mm_file_create_content_attrs_from_memory(MMHandleType *contents_attrs, const
        /* Check argument here */
        if (contents_attrs == NULL || data == NULL) {
                debug_error("Invalid arguments\n");
-               return MM_ERROR_INVALID_ARGUMENT;
+               return FILEINFO_ERROR_INVALID_ARGUMENT;
        }
 
 #ifdef __MMFILE_DYN_LOADING__
@@ -1037,7 +1035,7 @@ int mm_file_create_content_attrs_from_memory(MMHandleType *contents_attrs, const
        ret = _load_dynamic_functions(&func_handle);
        if (ret == 0) {
                debug_error("load library error\n");
-               return MM_ERROR_FILE_INTERNAL;
+               return FILEINFO_ERROR_FILE_INTERNAL;
        }
 #endif
 
@@ -1047,13 +1045,13 @@ int mm_file_create_content_attrs_from_memory(MMHandleType *contents_attrs, const
        attrs = (mmf_attrs_t *) mmf_attrs_new_from_data("content", g_content_attrs, ARRAY_SIZE(g_content_attrs), NULL, NULL);
        if (!attrs) {
                debug_error("attribute internal error.\n");
-               ret = MM_ERROR_FILE_INTERNAL;
+               ret = FILEINFO_ERROR_FILE_INTERNAL;
                goto END;
        }
 
        parse.type = MM_FILE_PARSE_TYPE_ALL;
        ret = _get_contents_info(attrs, &src, &parse);
-       if (ret != MM_ERROR_NONE) {
+       if (ret != FILEINFO_ERROR_NONE) {
                mmf_attrs_free((MMHandleType)attrs);
                attrs = NULL;
                debug_error("failed to get contents");
@@ -1078,7 +1076,7 @@ EXPORT_API
 int mm_file_destroy_content_attrs(MMHandleType contents_attrs)
 {
        void *thumbnail = NULL;
-       int ret = MM_ERROR_NONE;
+       int ret = FILEINFO_ERROR_NONE;
 
 #ifdef __MMFILE_TEST_MODE__
        debug_fenter();
@@ -1086,7 +1084,7 @@ int mm_file_destroy_content_attrs(MMHandleType contents_attrs)
 
        if ((mmf_attrs_t *)contents_attrs == NULL) {
                debug_error("invalid handle.\n");
-               return MM_ERROR_INVALID_ARGUMENT;
+               return FILEINFO_ERROR_INVALID_ARGUMENT;
        }
 
        ret = mm_attrs_get_data_by_name(contents_attrs, MM_FILE_CONTENT_VIDEO_THUMBNAIL, &thumbnail);
@@ -1118,7 +1116,7 @@ int mm_file_get_stream_info(const char *filename, int *audio_stream_num, int *vi
 
        if (filename == NULL || strlen(filename) == 0 || audio_stream_num == NULL || video_stream_num == NULL) {
                debug_error("Invalid arguments\n");
-               return MM_ERROR_INVALID_ARGUMENT;
+               return FILEINFO_ERROR_INVALID_ARGUMENT;
        }
 
 #ifdef __MMFILE_DYN_LOADING__
@@ -1127,7 +1125,7 @@ int mm_file_get_stream_info(const char *filename, int *audio_stream_num, int *vi
        ret = _load_dynamic_functions(&func_handle);
        if (ret == 0) {
                debug_error("load library error\n");
-               return MM_ERROR_FILE_INTERNAL;
+               return FILEINFO_ERROR_FILE_INTERNAL;
        }
 #endif
 
@@ -1136,13 +1134,13 @@ int mm_file_get_stream_info(const char *filename, int *audio_stream_num, int *vi
 
        ret = _is_file_exist(filename);
        if (!ret) {
-               ret = MM_ERROR_FILE_NOT_FOUND;
+               ret = FILEINFO_ERROR_FILE_NOT_FOUND;
                goto END;
        }
 
        parse.type = MM_FILE_PARSE_TYPE_SIMPLE;
        ret = _get_contents_info(NULL, &src, &parse);
-       if (ret != MM_ERROR_NONE) {
+       if (ret != FILEINFO_ERROR_NONE) {
                debug_error("failed to get stream info: %s\n", filename);
        } else {
                if (parse.audio_track_num == 0 && parse.video_track_num == 0) {
@@ -1186,15 +1184,15 @@ int mm_file_create_content_attrs_simple(MMHandleType *contents_attrs, const char
        ret = _load_dynamic_functions(&func_handle);
        if (ret == 0) {
                debug_error("load library error\n");
-               return MM_ERROR_FILE_INTERNAL;
+               return FILEINFO_ERROR_FILE_INTERNAL;
        }
 #endif
        if (filename == NULL) {
-               ret =  MM_ERROR_INVALID_ARGUMENT;
+               ret =  FILEINFO_ERROR_INVALID_ARGUMENT;
                goto END;
        } else {
                if (strlen(filename) == 0) {
-                       ret =  MM_ERROR_INVALID_ARGUMENT;
+                       ret =  FILEINFO_ERROR_INVALID_ARGUMENT;
                        goto END;
                }
        }
@@ -1204,7 +1202,7 @@ int mm_file_create_content_attrs_simple(MMHandleType *contents_attrs, const char
 
        ret = _is_file_exist(filename);
        if (!ret) {
-               ret = MM_ERROR_FILE_NOT_FOUND;
+               ret = FILEINFO_ERROR_FILE_NOT_FOUND;
                goto END;
        }
 
@@ -1212,13 +1210,13 @@ int mm_file_create_content_attrs_simple(MMHandleType *contents_attrs, const char
        attrs = (mmf_attrs_t *) mmf_attrs_new_from_data("content", g_content_attrs, ARRAY_SIZE(g_content_attrs), NULL, NULL);
        if (!attrs) {
                debug_error("attribute internal error.\n");
-               ret = MM_ERROR_FILE_INTERNAL;
+               ret = FILEINFO_ERROR_FILE_INTERNAL;
                goto END;
        }
 
        parse.type = MM_FILE_PARSE_TYPE_NORMAL;
        ret = _get_contents_info(attrs, &src, &parse);
-       if (ret != MM_ERROR_NONE) {
+       if (ret != FILEINFO_ERROR_NONE) {
                mmf_attrs_free((MMHandleType)attrs);
                attrs = NULL;
                debug_error("failed to get contents: %s\n", filename);
@@ -1256,15 +1254,15 @@ int mm_file_create_content_attrs_safe(MMHandleType *contents_attrs, const char *
        ret = _load_dynamic_functions(&func_handle);
        if (ret == 0) {
                debug_error("load library error\n");
-               return MM_ERROR_FILE_INTERNAL;
+               return FILEINFO_ERROR_FILE_INTERNAL;
        }
 #endif
        if (filename == NULL) {
-               ret = MM_ERROR_INVALID_ARGUMENT;
+               ret = FILEINFO_ERROR_INVALID_ARGUMENT;
                goto END;
        } else {
                if (strlen(filename) == 0) {
-                       ret = MM_ERROR_INVALID_ARGUMENT;
+                       ret = FILEINFO_ERROR_INVALID_ARGUMENT;
                        goto END;
                }
        }
@@ -1274,7 +1272,7 @@ int mm_file_create_content_attrs_safe(MMHandleType *contents_attrs, const char *
 
        ret = _is_file_exist(filename);
        if (!ret) {
-               ret = MM_ERROR_FILE_NOT_FOUND;
+               ret = FILEINFO_ERROR_FILE_NOT_FOUND;
                goto END;
        }
 
@@ -1282,13 +1280,13 @@ int mm_file_create_content_attrs_safe(MMHandleType *contents_attrs, const char *
        attrs = (mmf_attrs_t *) mmf_attrs_new_from_data("content", g_content_attrs, ARRAY_SIZE(g_content_attrs), NULL, NULL);
        if (!attrs) {
                debug_error("attribute internal error.\n");
-               ret = MM_ERROR_FILE_INTERNAL;
+               ret = FILEINFO_ERROR_FILE_INTERNAL;
                goto END;
        }
 
        parse.type = MM_FILE_PARSE_TYPE_SAFE;
        ret = _get_contents_info(attrs, &src, &parse);
-       if (ret != MM_ERROR_NONE) {
+       if (ret != FILEINFO_ERROR_NONE) {
                mmf_attrs_free((MMHandleType)attrs);
                attrs = NULL;
                debug_error("failed to get contents: %s\n", filename);
@@ -1316,7 +1314,7 @@ int mm_file_get_video_frame(const char *path, double timestamp, bool is_accurate
 
        if (path == NULL) {
                debug_error("Invalid arguments [Path is Null]\n");
-               return MM_ERROR_INVALID_ARGUMENT;
+               return FILEINFO_ERROR_INVALID_ARGUMENT;
        }
 
 #ifdef __MMFILE_DYN_LOADING__
@@ -1346,12 +1344,12 @@ int mm_file_get_video_frame(const char *path, double timestamp, bool is_accurate
 
        if (formatFuncHandle) dlclose(formatFuncHandle);
 
-       return MM_ERROR_NONE;
+       return FILEINFO_ERROR_NONE;
 
 exception:
        if (formatFuncHandle) dlclose(formatFuncHandle);
 
-       return MM_ERROR_FILE_INTERNAL;
+       return FILEINFO_ERROR_FILE_INTERNAL;
 }
 
 EXPORT_API
@@ -1362,12 +1360,12 @@ int mm_file_get_video_frame_from_memory(const void *data, unsigned int datasize,
 
        if (data == NULL) {
                debug_error("Invalid arguments [data is Null]\n");
-               return MM_ERROR_INVALID_ARGUMENT;
+               return FILEINFO_ERROR_INVALID_ARGUMENT;
        }
 
        if (datasize == 0) {
                debug_error("Invalid arguments [datasize is zero]\n");
-               return MM_ERROR_INVALID_ARGUMENT;
+               return FILEINFO_ERROR_INVALID_ARGUMENT;
        }
 
 #ifdef __MMFILE_DYN_LOADING__
@@ -1397,12 +1395,12 @@ int mm_file_get_video_frame_from_memory(const void *data, unsigned int datasize,
 
        if (formatFuncHandle) dlclose(formatFuncHandle);
 
-       return MM_ERROR_NONE;
+       return FILEINFO_ERROR_NONE;
 
 exception:
        if (formatFuncHandle) dlclose(formatFuncHandle);
 
-       return MM_ERROR_FILE_INTERNAL;
+       return FILEINFO_ERROR_FILE_INTERNAL;
 }
 
 EXPORT_API
@@ -1419,15 +1417,15 @@ int mm_file_check_uhqa(const char *filename, bool *is_uhqa)
        ret = _load_dynamic_functions(&func_handle);
        if (ret == 0) {
                debug_error("load library error\n");
-               return MM_ERROR_FILE_INTERNAL;
+               return FILEINFO_ERROR_FILE_INTERNAL;
        }
 #endif
        if (filename == NULL) {
-               ret = MM_ERROR_INVALID_ARGUMENT;
+               ret = FILEINFO_ERROR_INVALID_ARGUMENT;
                goto END;
        } else {
                if (strlen(filename) == 0) {
-                       ret = MM_ERROR_INVALID_ARGUMENT;
+                       ret = FILEINFO_ERROR_INVALID_ARGUMENT;
                        goto END;
                }
        }
@@ -1437,7 +1435,7 @@ int mm_file_check_uhqa(const char *filename, bool *is_uhqa)
 
        ret = _is_file_exist(filename);
        if (!ret) {
-               ret = MM_ERROR_FILE_NOT_FOUND;
+               ret = FILEINFO_ERROR_FILE_NOT_FOUND;
                goto END;
        }
 
@@ -1445,13 +1443,13 @@ int mm_file_check_uhqa(const char *filename, bool *is_uhqa)
        attrs = (mmf_attrs_t *) mmf_attrs_new_from_data("content", g_content_attrs, ARRAY_SIZE(g_content_attrs), NULL, NULL);
        if (!attrs) {
                debug_error("attribute internal error.\n");
-               ret = MM_ERROR_FILE_INTERNAL;
+               ret = FILEINFO_ERROR_FILE_INTERNAL;
                goto END;
        }
 
        parse.type = MM_FILE_PARSE_TYPE_NORMAL;
        ret = _get_contents_info(attrs, &src, &parse);
-       if (ret == MM_ERROR_NONE) {
+       if (ret == FILEINFO_ERROR_NONE) {
                *is_uhqa = parse.is_uhqa;
        } else {
                debug_error("_get_contents_info failed\n");
index d571c0d..f194fe2 100755 (executable)
@@ -69,5 +69,5 @@ CFLAGS="${CFLAGS} -D_MM_PROJECT_FLOATER -DEXPORT_API=\"__attribute__((visibility
 %files devel
 %manifest %{name}.manifest
 %{_includedir}/mmf/mm_file.h
+%{_includedir}/mmf/mm_file_error.h
 %{_libdir}/pkgconfig/mm-fileinfo.pc
-
index 7cff226..a3ff6f2 100755 (executable)
@@ -30,8 +30,6 @@
 #include <unistd.h>
 
 #include <mm_file.h>
-#include <mm_error.h>
-
 #include "mm_file_traverse.h"
 
 #define MM_TIME_CHECK_START \
@@ -216,7 +214,7 @@ static int mmfile_get_file_infomation(void *data, void *user_data, bool file_tes
        printf("Extracting information for [%s] \n", filename);
        /* get track info */
        ret = mm_file_get_stream_info(filename, &audio_track_num, &video_track_num);
-       if (ret == MM_ERROR_NONE) {
+       if (ret == FILEINFO_ERROR_NONE) {
                printf("# audio=%d, video=%d\n", audio_track_num, video_track_num);
        } else {
                printf("Failed to mm_file_get_stream_info() error=[%x]\n", ret);
@@ -234,14 +232,14 @@ static int mmfile_get_file_infomation(void *data, void *user_data, bool file_tes
                ret = mm_file_create_content_attrs_from_memory(&content_attrs, buffer, file_size, MM_FILE_FORMAT_3GP);
        }
 
-       if (ret == MM_ERROR_NONE && content_attrs) {
+       if (ret == FILEINFO_ERROR_NONE && content_attrs) {
                ContentContext_t ccontent;
                memset(&ccontent, 0, sizeof(ContentContext_t));
 
                ret = mm_file_get_attrs(content_attrs, &err_attr_name, MM_FILE_CONTENT_DURATION, &ccontent.duration, NULL);
                printf("# duration: %d\n", ccontent.duration);
 
-               if (ret != MM_ERROR_NONE && err_attr_name) {
+               if (ret != FILEINFO_ERROR_NONE && err_attr_name) {
                        printf("failed to get %s\n", err_attr_name);
                        free(err_attr_name);
                        err_attr_name = NULL;
@@ -259,7 +257,7 @@ static int mmfile_get_file_infomation(void *data, void *user_data, bool file_tes
                                                MM_FILE_CONTENT_AUDIO_BITPERSAMPLE, &ccontent.audio_bitpersample,
                                                NULL);
 
-                       if (ret != MM_ERROR_NONE) {
+                       if (ret != FILEINFO_ERROR_NONE) {
                                printf("failed to get audio attrs\n");
                        } else {
                                printf("[Audio] ----------------------------------------- \n");
@@ -286,7 +284,7 @@ static int mmfile_get_file_infomation(void *data, void *user_data, bool file_tes
                                                MM_FILE_CONTENT_VIDEO_THUMBNAIL, &ccontent.thumbnail.value.p_val, &ccontent.thumbnail.len,
                                                NULL);
 
-                       if (ret != MM_ERROR_NONE) {
+                       if (ret != FILEINFO_ERROR_NONE) {
                                printf("failed to get video attrs\n");
                        } else {
                                printf("[Video] ----------------------------------------- \n");
@@ -317,7 +315,7 @@ static int mmfile_get_file_infomation(void *data, void *user_data, bool file_tes
                ret = mm_file_create_tag_attrs_from_memory(&tag_attrs, buffer, file_size, MM_FILE_FORMAT_3GP);
        }
 
-       if (ret == MM_ERROR_NONE && tag_attrs) {
+       if (ret == FILEINFO_ERROR_NONE && tag_attrs) {
                TagContext_t ctag;
                memset(&ctag, 0, sizeof(TagContext_t));
                /* get attributes of tag  */
@@ -348,7 +346,7 @@ static int mmfile_get_file_infomation(void *data, void *user_data, bool file_tes
                                        MM_FILE_TAG_SYNCLYRICS_NUM, &ctag.synclyrics_size.value.i_val,
                                        MM_FILE_TAG_ROTATE, &ctag.rotate.value.s_val, &ctag.rotate.len,
                                        NULL);
-               if (ret != MM_ERROR_NONE &&  err_attr_name) {
+               if (ret != FILEINFO_ERROR_NONE &&  err_attr_name) {
                        printf("failed to get %s attrs\n", err_attr_name);
                        free(err_attr_name);
                        err_attr_name = NULL;
@@ -398,7 +396,7 @@ static int mmfile_get_file_infomation(void *data, void *user_data, bool file_tes
 
                        for (idx = 0; idx < ctag.synclyrics_size.value.i_val; idx++) {
                                ret = mm_file_get_synclyrics_info(tag_attrs, idx, &time_info, &lyrics_info);
-                               if (ret == MM_ERROR_NONE) {
+                               if (ret == FILEINFO_ERROR_NONE) {
                                        printf("[%2d][%6ld][%s]\n", idx, time_info, lyrics_info);
                                } else {
                                        printf("Error when get lyrics\n");
@@ -409,7 +407,7 @@ static int mmfile_get_file_infomation(void *data, void *user_data, bool file_tes
 
                /* release tag */
                ret = mm_file_destroy_tag_attrs(tag_attrs);
-               if (ret != MM_ERROR_NONE) {
+               if (ret != FILEINFO_ERROR_NONE) {
                        printf("Error mm_file_destroy_tag_attrs: %d", ret);
                        if (msg_tmp_fp) {
                                fclose(msg_tmp_fp);
index 3248cd3..dce47e1 100755 (executable)
@@ -21,7 +21,6 @@
 
 #include <string.h>    /*memcmp*/
 #include <stdlib.h>    /*malloc*/
-#include <mm_error.h>
 #include "mm_file_debug.h"
 #include "mm_file_utils.h"