2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #include <media_info_private.h>
21 int media_storage_get_scan_status(const char *storage_uuid, media_storage_scan_status_e *scan_status)
23 int ret = MEDIA_CONTENT_ERROR_NONE;
24 media_svc_scan_status_type_e status = MEDIA_STORAGE_SCAN_NONE;
26 content_retip_if_fail(STRING_VALID(storage_uuid));
27 content_retip_if_fail(scan_status);
29 ret = media_svc_get_storage_scan_status(_content_get_db_handle(), storage_uuid, &status);
30 if (ret != MS_MEDIA_ERR_NONE) {
31 content_error("media_svc_get_storage_scan_status failed");
32 return _content_error_capi(ret);
35 *scan_status = status;
40 int media_storage_foreach_storage_from_db(filter_h filter, media_storage_cb callback, void *user_data)
42 int ret = MEDIA_CONTENT_ERROR_NONE;
44 content_retip_if_fail(callback);
45 g_mutex_lock(_content_get_db_mutex());
46 ret = _media_db_get_storage(filter, callback, user_data);
47 g_mutex_unlock(_content_get_db_mutex());
52 int media_storage_destroy(media_storage_h storage)
54 media_storage_s *_storage = (media_storage_s*)storage;
56 content_retip_if_fail(storage);
58 g_free(_storage->storage_id);
59 g_free(_storage->storage_path);
62 return MEDIA_CONTENT_ERROR_NONE;
65 int media_storage_clone(media_storage_h *dst, media_storage_h src)
67 media_storage_s *_src = (media_storage_s*)src;
69 content_retip_if_fail(dst);
70 content_retip_if_fail(src);
72 media_storage_s *_dst = g_new0(media_storage_s, 1);
74 _dst->storage_id = g_strdup(_src->storage_id);
75 _dst->storage_path = g_strdup(_src->storage_path);
76 _dst->storage_type = _src->storage_type;
78 *dst = (media_storage_h)_dst;
80 return MEDIA_CONTENT_ERROR_NONE;
83 int media_storage_get_id(media_storage_h storage, char **storage_id)
85 media_storage_s *_storage = (media_storage_s*)storage;
87 content_retip_if_fail(storage);
88 content_retip_if_fail(storage_id);
90 *storage_id = g_strdup(_storage->storage_id);
92 return MEDIA_CONTENT_ERROR_NONE;
95 int media_storage_get_path(media_storage_h storage, char **storage_path)
97 media_storage_s *_storage = (media_storage_s*)storage;
99 content_retip_if_fail(storage);
100 content_retip_if_fail(storage_path);
102 *storage_path = g_strdup(_storage->storage_path);
104 return MEDIA_CONTENT_ERROR_NONE;