#include <dlfcn.h>
/* exported MM header files */
-#include <mm_types.h>
-#include <mm_error.h>
#include <mm_file.h>
/* internal MM header files */
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
mmfile_codec_close(codecContext);
}
- return MM_ERROR_NONE;
+ return FILEINFO_ERROR_NONE;
warning:
formatContext->commandType = MM_FILE_CONTENTS;
if (codecContext) {
mmfile_codec_close(codecContext);
}
- return MM_ERROR_NONE;
+ return FILEINFO_ERROR_NONE;
exception:
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;
}
mmfile_format_close(formatContext);
}
- return MM_ERROR_NONE;
+ return FILEINFO_ERROR_NONE;
exception:
mmfile_format_close(formatContext);
}
- return MM_ERROR_FILE_INTERNAL;
+ return FILEINFO_ERROR_FILE_INTERNAL;
}
*/
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 */
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);
}
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;
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
#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;
#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;
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;
/* 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;
}
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
ret = _is_file_exist(filename);
if (!ret) {
- ret = MM_ERROR_FILE_NOT_FOUND;
+ ret = FILEINFO_ERROR_FILE_NOT_FOUND;
goto END;
}
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);
{
void *artwork = NULL;
GList *synclyrics_list = NULL;
- int ret = MM_ERROR_NONE;
+ int ret = FILEINFO_ERROR_NONE;
#ifdef __MMFILE_TEST_MODE__
debug_fenter();
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);
/* 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;
}
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
ret = _is_file_exist(filename);
if (!ret) {
- ret = MM_ERROR_FILE_NOT_FOUND;
+ ret = FILEINFO_ERROR_FILE_NOT_FOUND;
goto END;
}
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);
/* 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__
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
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");
/* 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__
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
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");
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();
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);
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__
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
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) {
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;
}
}
ret = _is_file_exist(filename);
if (!ret) {
- ret = MM_ERROR_FILE_NOT_FOUND;
+ ret = FILEINFO_ERROR_FILE_NOT_FOUND;
goto END;
}
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);
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;
}
}
ret = _is_file_exist(filename);
if (!ret) {
- ret = MM_ERROR_FILE_NOT_FOUND;
+ ret = FILEINFO_ERROR_FILE_NOT_FOUND;
goto END;
}
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);
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__
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
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__
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
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;
}
}
ret = _is_file_exist(filename);
if (!ret) {
- ret = MM_ERROR_FILE_NOT_FOUND;
+ ret = FILEINFO_ERROR_FILE_NOT_FOUND;
goto END;
}
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");