MM_FILE_INVALID,
};
-enum {
+typedef enum {
MM_FILE_PARSE_TYPE_SIMPLE, /*parse audio/video track num only*/
MM_FILE_PARSE_TYPE_NORMAL, /*parse infomation without thumbnail*/
MM_FILE_PARSE_TYPE_ALL, /*parse all infomation*/
MM_FILE_PARSE_TYPE_SAFE, /*parse infomation without both thumbnail and stream full-searching*/
-};
+} MMFILE_PARSE_TYPE;
typedef struct {
int type;
return ret;
}
-EXPORT_API
-int mm_file_create_content_attrs(MMHandleType *contents_attrs, const char *filename)
+static int __create_content_attrs(MMHandleType *contents_attrs, const char *filename, MMFILE_PARSE_TYPE parse_type)
{
MMHandleType attrs = NULL;
MMFileSourceType src = {0, };
}
- parse.type = MM_FILE_PARSE_TYPE_ALL;
+ parse.type = parse_type;
ret = _get_contents_info(attrs, &src, &parse);
if (ret != FILEINFO_ERROR_NONE) {
mm_attrs_free(attrs);
return ret;
}
+EXPORT_API
+int mm_file_create_content_attrs(MMHandleType *contents_attrs, const char *filename)
+{
+ return __create_content_attrs(contents_attrs, filename, MM_FILE_PARSE_TYPE_ALL);
+}
EXPORT_API
int mm_file_create_tag_attrs_from_memory(MMHandleType *tag_attrs, const void *data, unsigned int size, int format)
EXPORT_API
int mm_file_create_content_attrs_simple(MMHandleType *contents_attrs, const char *filename)
{
- MMHandleType attrs = NULL;
- MMFileSourceType src = {0, };
- MMFILE_PARSE_INFO parse = {0, };
- int ret = 0;
-
- debug_fenter(RELEASE);
-
-#ifdef __MMFILE_DYN_LOADING__
- MMFILE_FUNC_HANDLE func_handle;
-
- ret = _load_dynamic_functions(&func_handle);
- if (ret == 0) {
- debug_error(DEBUG, "load library error\n");
- return FILEINFO_ERROR_FILE_INTERNAL;
- }
-#endif
- if (filename == NULL) {
- ret = FILEINFO_ERROR_INVALID_ARGUMENT;
- goto END;
- } else {
- if (strlen(filename) == 0) {
- ret = FILEINFO_ERROR_INVALID_ARGUMENT;
- goto END;
- }
- }
-
- /*set source file infomation*/
- MM_FILE_SET_MEDIA_FILE_SRC(src, filename);
-
- ret = _is_file_exist(filename);
- if (ret != FILEINFO_ERROR_NONE) {
- goto END;
- }
-
- /*set attrs*/
- ret = mm_attrs_new(g_content_attrs, ARRAY_SIZE(g_content_attrs), "content", NULL, NULL, &attrs);
- if (ret) {
- debug_error(DEBUG, "attribute internal error.\n");
- ret = FILEINFO_ERROR_FILE_INTERNAL;
- goto END;
- }
-
- parse.type = MM_FILE_PARSE_TYPE_NORMAL;
- ret = _get_contents_info(attrs, &src, &parse);
- if (ret != FILEINFO_ERROR_NONE) {
- mm_attrs_free(attrs);
- attrs = NULL;
- debug_error(DEBUG, "failed to get contents: %s\n", filename);
- }
-
- *contents_attrs = attrs;
-
-END:
-#ifdef __MMFILE_DYN_LOADING__
- _unload_dynamic_functions(&func_handle);
-#endif
-
- debug_fleave(RELEASE);
-
- return ret;
+ return __create_content_attrs(contents_attrs, filename, MM_FILE_PARSE_TYPE_NORMAL);
}
EXPORT_API
int mm_file_create_content_attrs_safe(MMHandleType *contents_attrs, const char *filename)
{
- MMHandleType attrs = NULL;
- MMFileSourceType src = {0, };
- MMFILE_PARSE_INFO parse = {0, };
- int ret = 0;
-
- debug_fenter(RELEASE);
-
-#ifdef __MMFILE_DYN_LOADING__
- MMFILE_FUNC_HANDLE func_handle;
-
- ret = _load_dynamic_functions(&func_handle);
- if (ret == 0) {
- debug_error(DEBUG, "load library error\n");
- return FILEINFO_ERROR_FILE_INTERNAL;
- }
-#endif
- if (filename == NULL) {
- ret = FILEINFO_ERROR_INVALID_ARGUMENT;
- goto END;
- } else {
- if (strlen(filename) == 0) {
- ret = FILEINFO_ERROR_INVALID_ARGUMENT;
- goto END;
- }
- }
-
- /*set source file infomation*/
- MM_FILE_SET_MEDIA_FILE_SRC(src, filename);
-
- ret = _is_file_exist(filename);
- if (ret != FILEINFO_ERROR_NONE) {
- goto END;
- }
-
- /*set attrs*/
- ret = mm_attrs_new(g_content_attrs, ARRAY_SIZE(g_content_attrs), "content", NULL, NULL, &attrs);
- if (ret) {
- debug_error(DEBUG, "attribute internal error.\n");
- ret = FILEINFO_ERROR_FILE_INTERNAL;
- goto END;
- }
-
- parse.type = MM_FILE_PARSE_TYPE_SAFE;
- ret = _get_contents_info(attrs, &src, &parse);
- if (ret != FILEINFO_ERROR_NONE) {
- mm_attrs_free(attrs);
- attrs = NULL;
- debug_error(DEBUG, "failed to get contents: %s\n", filename);
- }
-
- *contents_attrs = attrs;
-
-END:
-#ifdef __MMFILE_DYN_LOADING__
- _unload_dynamic_functions(&func_handle);
-#endif
-
- debug_fleave(RELEASE);
-
- return ret;
+ return __create_content_attrs(contents_attrs, filename, MM_FILE_PARSE_TYPE_SAFE);
}
EXPORT_API