Change folder_id to row id instead of uuid
[platform/core/api/media-content.git] / include_product / media_storage.h
1 /*
2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3 *
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
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
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.
15 */
16
17
18 #ifndef __TIZEN_CONTENT_MEDIA_STORAGE_H__
19 #define __TIZEN_CONTENT_MEDIA_STORAGE_H__
20
21
22 #include <media_content_type.h>
23
24
25 #ifdef __cplusplus
26 extern "C" {
27 #endif /* __cplusplus */
28
29 /**
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.
33  */
34
35 /**
36  * @addtogroup CAPI_CONTENT_MEDIA_STORAGE_MODULE
37  * @{
38  */
39
40 /**
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
44 *
45 * @remarks The @a storage should be released using media_storage_destroy().
46 *
47 * @param[in] storage_id The ID of the media storage
48 * @param[out] storage The media storage handle
49 *
50 * @return @c 0 on success,
51 *           otherwise a negative error value
52 *
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
58 *
59 * @pre This function requires opened connection to content service by media_content_connect().
60 *
61 * @see media_content_connect()
62 */
63 int media_storage_get_storage_info_from_db(const char *storage_id, media_storage_h *storage) TIZEN_DEPRECATED_API;
64
65 /**
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
69 *
70 * @param[in] filter The handle to the media filter
71 * @param[out] storage_count The count of storage
72 *
73 * @return @c 0 on success,
74 *           otherwise a negative error value
75 *
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
81 *
82 * @pre This function requires opened connection to content service by media_content_connect().
83 *
84 * @see media_content_connect()
85 */
86 int media_storage_get_storage_count_from_db(filter_h filter, int *storage_count) TIZEN_DEPRECATED_API;
87
88 /**
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.
94  *
95  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
96  *
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
100  *
101  * @return @c 0 on success,
102  *         otherwise a negative error value
103  *
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
109  *
110  * @pre  This function requires opened connection to content service by media_content_connect().
111  * @post This function invokes media_storage_destroy().
112  *
113  * @see media_content_connect()
114  * @see media_storage_destroy()
115  */
116 int media_storage_foreach_storage_from_db(filter_h filter, media_storage_cb callback, void *user_data) TIZEN_DEPRECATED_API;
117
118 /**
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
122  *
123  * @remarks Use media_info_get_media_count_from_db() if you want to search for internal storage.
124  *
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
128  *
129  * @return @c 0 on success,
130  *         otherwise a negative error value
131  *
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
136  *
137  * @pre This function requires opened connection to content service by media_content_connect().
138  *
139  * @see media_content_connect()
140  */
141 int media_storage_get_media_count_from_db(const char *storage_id, filter_h filter, int *media_count) TIZEN_DEPRECATED_API;
142
143 /**
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.
149  *
150  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
151  *
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.
157  *
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
162  *
163  * @return @c 0 on success,
164  *         otherwise a negative error value
165  *
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
171  *
172  * @pre  This function requires opened connection to content service by media_content_connect().
173  * @post This function invokes media_info_cb().
174  *
175  * @see #media_info_cb
176  * @see media_content_connect()
177  * @see media_filter_create()
178  */
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;
180
181 /**
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.
187  *
188  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
189  *
190  * @param[in] storage The media storage handle
191  *
192  * @return @c 0 on success,
193  *         otherwise a negative error value
194  *
195  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
196  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
197  *
198  * @pre Get copy of media_storage_h handle by calling media_storage_clone().
199  *
200  * @see media_storage_clone()
201  */
202 int media_storage_destroy(media_storage_h storage) TIZEN_DEPRECATED_API;
203
204 /**
205  * @deprecated Deprecated since 5.0.
206  * @brief Clones the media storage handle.
207  *
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.
212  *
213  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
214  *
215  * @remarks The @a dst should be released using media_storage_destroy().
216  *
217  * @param[out] dst The destination handle to the media storage
218  * @param[in] src The source handle to the media storage
219  *
220  * @return @c 0 on success,
221  *         otherwise a negative error value
222  *
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
226  *
227  * @see media_storage_destroy()
228  * @see media_storage_foreach_storage_from_db()
229  * @see media_storage_get_storage_info_from_db()
230  */
231 int media_storage_clone(media_storage_h *dst, media_storage_h src) TIZEN_DEPRECATED_API;
232
233 /**
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
237  *
238  * @remarks The @a storage_id should be released using free().
239  *
240  * @param[in] storage The media storage handle
241  * @param[out] storage_id The ID of the media storage
242  *
243  * @return @c 0 on success,
244  *         otherwise a negative error value
245  *
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
249  */
250 int media_storage_get_id(media_storage_h storage, char **storage_id) TIZEN_DEPRECATED_API;
251
252 /**
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
256  *
257  * @remarks The @a storage_path should be released using free().
258  *
259  * @param[in] storage The media storage handle
260  * @param[out] storage_path The storage path of the media storage
261  *
262  * @return @c 0 on success,
263  *         otherwise a negative error value
264  *
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
268  */
269 int media_storage_get_path(media_storage_h storage, char **storage_path) TIZEN_DEPRECATED_API;
270
271 /**
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
275  *
276  * @param[in] storage The media storage handle
277  * @param[out] storage_type The storage type of the media storage
278  *
279  * @return @c 0 on success,
280  *         otherwise a negative error value
281  *
282  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
283  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
284  */
285 int media_storage_get_type(media_storage_h storage, media_content_storage_e *storage_type) TIZEN_DEPRECATED_API;
286
287 /**
288  * @}
289  */
290
291 #ifdef __cplusplus
292 }
293 #endif /* __cplusplus */
294
295 #endif /* __TIZEN_CONTENT_MEDIA_STORAGE_H__ */