#include "mtp_list.h"
#include "ptp_datacodes.h"
#include "mtp_fs.h"
-#include "mtp_media_info.h"
#define FIXED_LENGTH_MEMBERS_SIZE \
(4 * sizeof(mtp_uint16) + 11 * sizeof(mtp_uint32))
mtp_char *file_path;
ptp_array_t child_array; /* Include all the renferences */
slist_t propval_list; /* Object Properties implemented */
+ mtp_char *media_id; /* Tizen Media Content variable */
} mtp_obj_t;
mtp_bool _entity_get_file_times(mtp_obj_t *obj, ptp_time_string_t *create_tm,
#include <media_content.h>
#include "mtp_config.h"
#include "mtp_datatype.h"
+#include "mtp_object.h"
#define MEDIA_PATH_COND "MEDIA_PATH="
#define MEDIA_PATH_COND_LEN 13 /* MEDIA_PATH="" */
mtp_bool _util_get_video_meta_from_extractor(const mtp_char *filepath,
comp_video_meta_t *video_data);
void _util_flush_db(void);
-void _util_delete_file_from_db(const mtp_char *filepath);
-void _util_add_file_to_db(const mtp_char *filepath);
+void _util_delete_file_from_db(const mtp_char *media_id);
+void _util_add_file_to_db(mtp_obj_t *obj, mtp_char *filepath);
void _util_scan_folder_contents_in_db(const mtp_char *filepath);
void _util_free_common_meta(common_meta_t *metadata);
void _util_free_video_meta(video_meta_t *video);
Name: mtp-responder
Summary: Media Transfer Protocol daemon (responder)
-Version: 0.0.14
+Version: 0.0.15
Release: 1
Group: Network & Connectivity/Other
License: Apache-2.0
#include "mtp_support.h"
#include "mtp_util.h"
#include "mtp_device.h"
+#include "mtp_media_info.h"
extern mtp_bool g_is_full_enum;
_entity_dealloc_mtp_obj(child_obj);
continue;
}
- _util_delete_file_from_db(child_obj->file_path);
+ _util_delete_file_from_db(child_obj->media_id);
if (_entity_set_object_file_path(child_obj, dest_child_path,
CHAR_TYPE) == FALSE) {
g_free(node);
}
+ if (obj->media_id != NULL)
+ free(obj->media_id);
+
g_free(obj->file_path);
g_free(obj);
obj = NULL;
node = node->link;
temp = _util_delete_node(&(store->obj_list), obj);
g_free(temp);
- _util_delete_file_from_db(obj->file_path);
+ _util_delete_file_from_db(obj->media_id);
_entity_dealloc_mtp_obj(obj);
} else {
node = node->link;
temp = _util_delete_node(&(store->obj_list), obj);
g_free(temp);
- _util_delete_file_from_db(obj->file_path);
+ _util_delete_file_from_db(obj->media_id);
_entity_dealloc_mtp_obj(obj);
} else {
switch (response) {
return MTP_ERROR_GENERAL;
}
- _util_delete_file_from_db(obj->file_path);
+ _util_delete_file_from_db(obj->media_id);
_entity_set_object_file_path(obj, dst_fpath, CHAR_TYPE);
- _util_add_file_to_db(obj->file_path);
+ _util_add_file_to_db(obj, obj->file_path);
}
if (obj->obj_info->h_parent != PTP_OBJECTHANDLE_ROOT) {
if (new_obj->obj_info->obj_fmt == PTP_FMT_ASSOCIATION)
_util_scan_folder_contents_in_db(new_obj->file_path);
else
- _util_add_file_to_db(new_obj->file_path);
+ _util_add_file_to_db(new_obj, new_obj->file_path);
return MTP_ERROR_NONE;
}
if (new_obj->obj_info->obj_fmt == PTP_FMT_ASSOCIATION) {
_util_scan_folder_contents_in_db(new_obj->file_path);
} else {
- _util_add_file_to_db(new_obj->file_path);
+ _util_add_file_to_db(new_obj, new_obj->file_path);
}
return MTP_ERROR_NONE;
}
#endif /* MTP_SUPPORT_SET_PROTECTION */
- _util_add_file_to_db(obj->file_path);
+ _util_add_file_to_db(obj, obj->file_path);
#ifndef MTP_USE_RUNTIME_GETOBJECTPROPVALUE
if (updatePropertyValuesMtpObject(obj) == FALSE) {
_util_scan_folder_contents_in_db(orig_fpath);
_util_scan_folder_contents_in_db(dest_fpath);
} else {
- _util_delete_file_from_db(orig_fpath);
- _util_add_file_to_db(dest_fpath);
-
+ _util_delete_file_from_db(obj->media_id);
+ _util_add_file_to_db(obj, dest_fpath);
}
/* Finally assign new handle and update full path */
void _util_flush_db(void)
{
- _util_add_file_to_db(NULL);
+ _util_add_file_to_db(NULL, NULL);
_util_delete_file_from_db(NULL);
}
-void _util_delete_file_from_db(const mtp_char *filepath)
+void _util_delete_file_from_db(const mtp_char *media_id)
{
int ret;
- ret_if(NULL == filepath);
+ ret_if(NULL == media_id);
- ret = media_info_delete_from_db(filepath);
+ ERR("delete media_id is %s", media_id);
+ ret = media_info_delete_from_db(media_id);
if (MEDIA_CONTENT_ERROR_NONE != ret)
ERR("media_info_delete_from_db() Fail(%d)", ret);
return;
}
-void _util_add_file_to_db(const mtp_char *filepath)
+void _util_add_file_to_db(mtp_obj_t *obj, mtp_char *filepath)
{
mtp_int32 ret;
media_info_h info = NULL;
if (MEDIA_CONTENT_ERROR_NONE != ret)
ERR("media_info_insert_to_db() Fail(%d)", ret);
+ if (obj->media_id != NULL) {
+ free(obj->media_id);
+ obj->media_id = NULL;
+ }
+
+ ret = media_info_get_media_id(info, &obj->media_id);
+
+ ERR("add media_id is %s", obj->media_id);
+ if (MEDIA_CONTENT_ERROR_NONE != ret)
+ ERR("media_info_get_media_id() Fail(%d)", ret);
+
if (info)
media_info_destroy(info);