[ACR-432] Add for db update notification
[platform/core/api/media-content.git] / include / media_content_internal.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
19 #ifndef __TIZEN_MEDIA_CONTENT_INTERNAL_H__
20 #define __TIZEN_MEDIA_CONTENT_INTERNAL_H__
21
22 #include <media_content_type.h>
23
24 #ifdef __cplusplus
25 extern "C" {
26 #endif /* __cplusplus */
27
28 /**
29  * @internal
30  * @file media_content_internal.h
31  * @brief This file contains API on main functional operations with storage that are related to media resources in the media database. \n
32  *        Operations include: inserting a new storage in media to the media database, removing storage from database, \n
33  */
34
35 /**
36  * @ingroup CAPI_MEDIA_CONTENT_MODULE
37  * @brief Enumeration for a media storage scan status.
38  * @since_tizen 2.4
39  */
40 typedef enum{
41         MEDIA_STORAGE_SCAN_NONE = 0,                            /**< Media Scanner not detect storage yet*/
42         MEDIA_STORAGE_SCAN_PREPARE,                             /**< Media Scanner detect storage but not scanning yet*/
43         MEDIA_STORAGE_SCAN_PROCESSING,                  /**< Media Scanner Start Scanning storage*/
44         MEDIA_STORAGE_SCAN_STOP,                                        /**< Media Scanner Stop Scanning storage. Not scanning items can be exist*/
45         MEDIA_STORAGE_SCAN_DONE,                                        /**< Scanning Done but need to extract metadata*/
46         MEDIA_STORAGE_SCAN_META_PROCESSING,             /**< Scanning Done and start to extract metadata*/
47         MEDIA_STORAGE_SCAN_META_STOP,                   /**< Stop extract metadata*/
48         MEDIA_STORAGE_SCAN_COMPLETE     ,                       /**< Complete scanning*/
49 }media_storage_scan_status_e;
50
51 /**
52 * @internal
53 * @brief Insert media storage to database.
54 * @since_tizen 2.4
55 *
56 * @remarks You must release @a storage using media_storage_destroy().
57 *
58 * @privlevel platform
59 * @privilege %http://tizen.org/privilege/content.write
60 *
61 * @param[in] storage_name The storage name to insert to database
62 * @param[in] storage_path The storage path to insert to database
63 * @param[in] storage_account The storage account to insert to database
64 * @param[in] storage_type The storage type to insert to database
65 * @param[out] storage The media storage handle
66 *
67 * @return @c 0 on success,
68 *           otherwise a negative error value
69 *
70 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
71 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
72 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED                 DB operation failed
73 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
74 *
75 * @see media_storage_delete_from_db()
76 */
77 int media_storage_insert_to_db(const char *storage_name, const char *storage_path, const char *storage_account, media_content_storage_e storage_type, media_storage_h *storage);
78
79 /**
80 * @internal
81 * @brief Deletes the database for media storage.
82 * @since_tizen 2.4
83 *
84 * @privlevel platform
85 * @privilege %http://tizen.org/privilege/content.write
86 *
87 * @param[in] storage_id The storage ID to delete from database
88 *
89 * @return @c 0 on success,
90 *           otherwise a negative error value
91 *
92 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
93 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
94 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED                 DB operation failed
95 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
96 *
97 * @see media_storage_insert_to_db()
98 */
99 int media_storage_delete_from_db(const char *storage_id);
100
101 /**
102  * @brief Gets the storage account of media storage.
103  * @since_tizen 2.4
104  *
105  * @remarks You must release @a storage_account using free().
106  *
107  * @param[in]  storage The media storage handle
108  * @param[out] storage_account  The storage account of the media storage
109  *
110  * @return @c 0 on success,
111  *         otherwise a negative error value
112  *
113  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
114  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
115  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
116  */
117 int media_storage_get_storage_account(media_storage_h storage, char **storage_account);
118
119 /**
120 * @internal
121 * @brief Sets the MIME type of media info handle.
122 * @since_tizen 2.4
123 *
124 * @param[in] media The media info handle
125 * @param[in] mime_type The MIME type of the media info
126 *
127 * @return @c 0 on success,
128 *           otherwise a negative error value
129 *
130 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
131 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
132 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED                 DB operation failed
133 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
134 *
135 * @post media_info_insert_to_db_with_data()
136 */
137 int media_info_set_mime_type(media_info_h media, const char *mime_type);
138
139 /**
140 * @internal
141 * @brief Sets the thumbnail path of media info handle.
142 * @since_tizen 2.4
143 *
144 * @param[in] media The media info handle
145 * @param[in] thumbnail_path The thumbnail path of media info handle
146 *
147 * @return @c 0 on success,
148 *           otherwise a negative error value
149 *
150 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
151 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
152 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED                 DB operation failed
153 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
154 *
155 * @post media_info_insert_to_db_with_data()
156 */
157 int media_info_set_thumbnail_path(media_info_h media, const char *thumbnail_path);
158
159 /**
160 * @internal
161 * @brief Sets the size of media info handle.
162 * @since_tizen 2.4
163 *
164 * @param[in] media The media info handle
165 * @param[in] size The size of media info handle
166 *
167 * @return @c 0 on success,
168 *           otherwise a negative error value
169 *
170 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
171 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
172 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED                 DB operation failed
173 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
174 *
175 * @post media_info_insert_to_db_with_data()
176 */
177 int media_info_set_size(media_info_h media, unsigned long long size);
178
179 /**
180 * @internal
181 * @brief Sets the modified time of media info handle.
182 * @since_tizen 2.4
183 *
184 * @param[in] media The media info handle
185 * @param[in] modified_time The modified time of media info handle
186 *
187 * @return @c 0 on success,
188 *           otherwise a negative error value
189 *
190 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
191 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
192 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED                 DB operation failed
193 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
194 *
195 * @post media_info_insert_to_db_with_data()
196 */
197 int media_info_set_modified_time(media_info_h media, time_t modified_time);
198
199 /**
200 * @internal
201 * @brief Sets the media type of media info handle.
202 * @since_tizen 2.4
203 *
204 * @param[in] media The media info handle
205 * @param[in] type The media type of media info handle
206 *
207 * @return @c 0 on success,
208 *           otherwise a negative error value
209 *
210 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
211 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
212 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED                 DB operation failed
213 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
214 *
215 * @post media_info_insert_to_db_with_data()
216 */
217 int media_info_set_media_type(media_info_h media, media_content_type_e type);
218
219 /**
220 * @internal
221 * @brief Sets the duration of media info handle.
222 * @since_tizen 2.4
223 *
224 * @param[in] media The media info handle
225 * @param[in] duration The duration of media info handle
226 *
227 * @return @c 0 on success,
228 *           otherwise a negative error value
229 *
230 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
231 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
232 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED                 DB operation failed
233 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
234 *
235 * @post media_info_insert_to_db_with_data()
236 */
237 int media_info_set_duration(media_info_h media, int duration);
238
239 /**
240 * @internal
241 * @brief Sets the width of media info handle.
242 * @since_tizen 2.4
243 *
244 * @param[in] media The media info handle
245 * @param[in] width The width of media info handle
246 *
247 * @return @c 0 on success,
248 *           otherwise a negative error value
249 *
250 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
251 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
252 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED                 DB operation failed
253 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
254 *
255 * @post media_info_insert_to_db_with_data()
256 */
257 int media_info_set_width(media_info_h media, int width);
258
259 /**
260 * @internal
261 * @brief Sets the height of media info handle.
262 * @since_tizen 2.4
263 *
264 * @param[in] media The media info handle
265 * @param[in] height The height of media info handle
266 *
267 * @return @c 0 on success,
268 *           otherwise a negative error value
269 *
270 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
271 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
272 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED                 DB operation failed
273 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
274 *
275 * @post media_info_insert_to_db_with_data()
276 */
277 int media_info_set_height(media_info_h media, int height);
278
279 /**
280 * @internal
281 * @brief Sets the storage type of media info handle.
282 * @since_tizen 2.4
283 *
284 * @param[in] media The media info handle
285 * @param[in] storage_type The storage type of media info handle
286 *
287 * @return @c 0 on success,
288 *           otherwise a negative error value
289 *
290 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
291 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
292 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED                 DB operation failed
293 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
294 *
295 * @post media_info_insert_to_db_with_data()
296 */
297 int media_info_set_storage_type(media_info_h media, media_content_storage_e storage_type);
298
299 /**
300 * @internal
301 * @brief Sets the storage type of media info handle.
302 * @since_tizen 2.4
303 *
304 * @param[in] media The media info handle
305 * @param[in] storage_id The storage id of media info handle
306 *
307 * @return @c 0 on success,
308 *           otherwise a negative error value
309 *
310 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
311 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
312 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED                 DB operation failed
313 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
314 *
315 * @post media_info_insert_to_db_with_data()
316 */
317 int media_info_set_storage_id(media_info_h media, const char *storage_id);
318
319 /**
320  * @brief Gets the storage scan status of media storage.
321  * @since_tizen 2.4
322  *
323  * @param[in]  storage The media storage handle
324  * @param[out] scan_status  The storage type of the media storage
325  *
326  * @return @c 0 on success,
327  *         otherwise a negative error value
328  *
329  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
330  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
331  */
332 int media_storage_get_scan_status(const char *storage_uuid, media_storage_scan_status_e *scan_status);
333
334 /**
335  * @brief Subscribes notifications of the media DB change.
336  * @details This function subscribes notifications of the media DB change which are published by the media server or other apps.
337  *          media_content_db_update_cb() function will be called when notification of the media DB change is subscribed.
338  *
339  * @since_tizen 2.4
340  *
341  * @param[in] callback  The callback to be invoked when the scanning is finished
342  * @param[in] user_data The user data to be passed to the callback function
343  *
344  * @return @c 0 on success,
345  *         otherwise a negative error value
346  *
347  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
348  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
349  * @retval #MEDIA_CONTENT_ERROR_INVALID_OPERATION Invalid operation
350  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
351  * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
352  *
353  * @see media_content_db_update_cb()
354  * @see media_content_unset_db_updated_cb_v2()
355  */
356 int media_content_set_db_updated_cb_v2(media_content_noti_h *noti_handle, media_content_db_update_cb callback, void *user_data);
357
358
359 /**
360  * @brief Unsubscribes notifications of the media DB change.
361  * @details This function unsubscribes notifications of the media DB change which are published by the media server or other apps.
362  *
363  * @since_tizen 2.4
364  *
365  * @return @c 0 on success,
366  *         otherwise a negative error value
367  *
368  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
369  * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
370  *
371  * @pre media_content_set_db_updated_cb_v2()
372  *
373  * @see media_content_set_db_updated_cb_v2()
374  */
375 int media_content_unset_db_updated_cb_v2(media_content_noti_h noti_handle);
376
377
378 #ifdef __cplusplus
379 }
380 #endif /* __cplusplus */
381 #endif /*__TIZEN_MEDIA_CONTENT_INTERNAL_H__*/