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.
18 #ifndef __TIZEN_CONTENT_MEDIA_STORAGE_H__
19 #define __TIZEN_CONTENT_MEDIA_STORAGE_H__
22 #include <media_content_type.h>
27 #endif /* __cplusplus */
30 * @file media_storage.h
31 * @brief This file contains API on main functional operations with external storage that are related to media resources in the media database. \n
32 * Operations include: getting number of storages, cloning and destroying storage, getting storage`s ID, name, path and type.
36 * @addtogroup CAPI_CONTENT_MEDIA_STORAGE_MODULE
41 * @deprecated Deprecated since 5.0.
42 * @brief Gets media storage from database.
43 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
45 * @remarks The @a storage should be released using media_storage_destroy().
47 * @param[in] storage_id The ID of the media storage
48 * @param[out] storage The media storage handle
50 * @return @c 0 on success,
51 * otherwise a negative error value
53 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
54 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
55 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
56 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB Operation failed
57 * @retval #MEDIA_CONTENT_ERROR_DB_BUSY DB Operation busy
59 * @pre This function requires opened connection to content service by media_content_connect().
61 * @see media_content_connect()
63 int media_storage_get_storage_info_from_db(const char *storage_id, media_storage_h *storage) TIZEN_DEPRECATED_API;
66 * @deprecated Deprecated since 5.0. Use @ref CAPI_SYSTEM_STORAGE_MODULE instead.
67 * @brief Gets the count of media storage for the passed @a filter from the media database.
68 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
70 * @param[in] filter The handle to the media filter
71 * @param[out] storage_count The count of storage
73 * @return @c 0 on success,
74 * otherwise a negative error value
76 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
77 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
78 * @retval #MEDIA_CONTENT_ERROR_INVALID_OPERATION Invalid operation
79 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB Operation failed
80 * @retval #MEDIA_CONTENT_ERROR_DB_BUSY DB Operation busy
82 * @pre This function requires opened connection to content service by media_content_connect().
84 * @see media_content_connect()
86 int media_storage_get_storage_count_from_db(filter_h filter, int *storage_count) TIZEN_DEPRECATED_API;
89 * @deprecated Deprecated since 5.0. Use @ref CAPI_SYSTEM_STORAGE_MODULE instead.
90 * @brief Iterates through media storage from the media database.
91 * @details This function gets all media storage handles meeting the given @a filter.
92 * The @a callback function will be invoked for every retrieved media storage.
93 * If @c NULL is passed to the @a filter, then no filtering is applied.
95 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
97 * @param[in] filter The handle to the media filter
98 * @param[in] callback The callback function to be invoked
99 * @param[in] user_data The user data to be passed to the callback function
101 * @return @c 0 on success,
102 * otherwise a negative error value
104 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
105 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
106 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
107 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB Operation failed
108 * @retval #MEDIA_CONTENT_ERROR_DB_BUSY DB Operation busy
110 * @pre This function requires opened connection to content service by media_content_connect().
111 * @post This function invokes media_storage_destroy().
113 * @see media_content_connect()
114 * @see media_storage_destroy()
116 int media_storage_foreach_storage_from_db(filter_h filter, media_storage_cb callback, void *user_data) TIZEN_DEPRECATED_API;
119 * @deprecated Deprecated since 5.0. Use media_info_get_media_count_from_db() instead.
120 * @brief Gets the count of media files for the passed @a filter in the given @a storage_id from the media database.
121 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
123 * @remarks Use media_info_get_media_count_from_db() if you want to search for internal storage.
125 * @param[in] storage_id The ID of the media storage
126 * @param[in] filter The handle to the media filter
127 * @param[out] media_count The count of media storage items
129 * @return @c 0 on success,
130 * otherwise a negative error value
132 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
133 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
134 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB Operation failed
135 * @retval #MEDIA_CONTENT_ERROR_DB_BUSY DB Operation busy
137 * @pre This function requires opened connection to content service by media_content_connect().
139 * @see media_content_connect()
141 int media_storage_get_media_count_from_db(const char *storage_id, filter_h filter, int *media_count) TIZEN_DEPRECATED_API;
144 * @deprecated Deprecated since 5.0. Use media_info_foreach_media_from_db() instead.
145 * @brief Iterates through the media files with an optional @a filter in the given @a storage_id from the media database.
146 * @details This function gets all media files associated with the given storage and
147 * meeting desired filter option and calls @a callback for
148 * every retrieved media item. If @c NULL is passed to the @a filter, no filtering is applied.
150 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
152 * @remarks Do not call updating DB function like media_info_update_to_db() in your callback function,
153 * your callback function is invoked as inline function. \n
154 * So, your callback function is in read state in SQLite. When you are in read state, sometimes you do not update DB. \n
155 * We do not recommend you call updating DB function in callback of foreach function.\n
156 * Use media_info_foreach_media_from_db() if you want to search for internal storage.
158 * @param[in] storage_id The ID of the media storage
159 * @param[in] filter The handle to the media filter
160 * @param[in] callback The callback function to be invoked
161 * @param[in] user_data The user data to be passed to the callback function
163 * @return @c 0 on success,
164 * otherwise a negative error value
166 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
167 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
168 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
169 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB Operation failed
170 * @retval #MEDIA_CONTENT_ERROR_DB_BUSY DB Operation busy
172 * @pre This function requires opened connection to content service by media_content_connect().
173 * @post This function invokes media_info_cb().
175 * @see #media_info_cb
176 * @see media_content_connect()
177 * @see media_filter_create()
179 int media_storage_foreach_media_from_db(const char *storage_id, filter_h filter, media_info_cb callback, void *user_data) TIZEN_DEPRECATED_API;
182 * @deprecated Deprecated since 5.0.
183 * @brief Destroys media storage handle.
184 * @details The function frees all resources related to the media storage handle. This handle
185 * can no longer be used to perform any operations. New media storage handle has to
186 * be created before the next usage.
188 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
190 * @param[in] storage The media storage handle
192 * @return @c 0 on success,
193 * otherwise a negative error value
195 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
196 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
198 * @pre Get copy of media_storage_h handle by calling media_storage_clone().
200 * @see media_storage_clone()
202 int media_storage_destroy(media_storage_h storage) TIZEN_DEPRECATED_API;
205 * @deprecated Deprecated since 5.0.
206 * @brief Clones the media storage handle.
208 * @details This function copies the media storage handle from a source to the destination.
209 * There is no media_storage_create() function. The media_storage_h is created internally and
210 * available through media storage foreach function such as media_storage_foreach_storage_from_db().
211 * To use this handle outside of these foreach functions, use this function.
213 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
215 * @remarks The @a dst should be released using media_storage_destroy().
217 * @param[out] dst The destination handle to the media storage
218 * @param[in] src The source handle to the media storage
220 * @return @c 0 on success,
221 * otherwise a negative error value
223 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
224 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
225 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
227 * @see media_storage_destroy()
228 * @see media_storage_foreach_storage_from_db()
229 * @see media_storage_get_storage_info_from_db()
231 int media_storage_clone(media_storage_h *dst, media_storage_h src) TIZEN_DEPRECATED_API;
234 * @deprecated Deprecated since 5.0.
235 * @brief Gets the storage id of media storage.
236 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
238 * @remarks The @a storage_id should be released using free().
240 * @param[in] storage The media storage handle
241 * @param[out] storage_id The ID of the media storage
243 * @return @c 0 on success,
244 * otherwise a negative error value
246 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
247 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
248 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
250 int media_storage_get_id(media_storage_h storage, char **storage_id) TIZEN_DEPRECATED_API;
253 * @deprecated Deprecated since 5.0. Use @ref CAPI_SYSTEM_STORAGE_MODULE instead.
254 * @brief Gets the storage path of media storage.
255 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
257 * @remarks The @a storage_path should be released using free().
259 * @param[in] storage The media storage handle
260 * @param[out] storage_path The storage path of the media storage
262 * @return @c 0 on success,
263 * otherwise a negative error value
265 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
266 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
267 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
269 int media_storage_get_path(media_storage_h storage, char **storage_path) TIZEN_DEPRECATED_API;
272 * @deprecated Deprecated since 5.0. Use storage_get_type_dev() instead.
273 * @brief Gets the storage type of media storage.
274 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
276 * @param[in] storage The media storage handle
277 * @param[out] storage_type The storage type of the media storage
279 * @return @c 0 on success,
280 * otherwise a negative error value
282 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
283 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
285 int media_storage_get_type(media_storage_h storage, media_content_storage_e *storage_type) TIZEN_DEPRECATED_API;
293 #endif /* __cplusplus */
295 #endif /* __TIZEN_CONTENT_MEDIA_STORAGE_H__ */