Modify external storage scan
[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 Creates the media info handle.
122 * @since_tizen 2.4
123 *
124 * @remarks You must release @a media using media_info_destroy().
125 *
126 * @param[out] media The media info handle
127 *
128 * @return @c 0 on success,
129 *           otherwise a negative error value
130 *
131 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
132 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
133 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED                 DB operation failed
134 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
135 *
136 * @see media_info_destroy()
137 */
138 int media_info_create_handle(media_info_h *media);
139
140 /**
141 * @internal
142 * @brief Inserts media info to database with media info data.
143 * @since_tizen 2.4
144 *
145 * @remarks You must release @a info using media_info_destroy().
146 *
147 * @privlevel platform
148 * @privilege %http://tizen.org/privilege/content.write
149 *
150 * @param[in] media The media info handle
151 * @param[out] info The media info handle to get data from database
152 *
153 * @return @c 0 on success,
154 *           otherwise a negative error value
155 *
156 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
157 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
158 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED                 DB operation failed
159 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
160 */
161 int media_info_insert_to_db_with_data(media_info_h media, media_info_h *info);
162
163 /**
164 * @internal
165 * @brief Sets the path of media info handle.
166 * @since_tizen 2.4
167 *
168 * @param[in] media The media info handle
169 * @param[in] path The path of the media info
170 *
171 * @return @c 0 on success,
172 *           otherwise a negative error value
173 *
174 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
175 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
176 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED                 DB operation failed
177 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
178 *
179 * @post media_info_insert_to_db_with_data()
180 */
181 int media_info_set_path(media_info_h media, const char *path);
182
183 /**
184 * @internal
185 * @brief Sets the MIME type of media info handle.
186 * @since_tizen 2.4
187 *
188 * @param[in] media The media info handle
189 * @param[in] mime_type The MIME type of the media info
190 *
191 * @return @c 0 on success,
192 *           otherwise a negative error value
193 *
194 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
195 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
196 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED                 DB operation failed
197 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
198 *
199 * @post media_info_insert_to_db_with_data()
200 */
201 int media_info_set_mime_type(media_info_h media, const char *mime_type);
202
203 /**
204 * @internal
205 * @brief Sets the title of media info handle.
206 * @since_tizen 2.4
207 *
208 * @param[in] media The media info handle
209 * @param[in] title The title of media info handle
210 *
211 * @return @c 0 on success,
212 *           otherwise a negative error value
213 *
214 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
215 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
216 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED                 DB operation failed
217 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
218 *
219 * @post media_info_insert_to_db_with_data()
220 */
221 int media_info_set_title(media_info_h media, const char *title);
222
223 /**
224 * @internal
225 * @brief Sets the album of media info handle.
226 * @since_tizen 2.4
227 *
228 * @param[in] media The media info handle
229 * @param[in] album The album of media info handle
230 *
231 * @return @c 0 on success,
232 *           otherwise a negative error value
233 *
234 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
235 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
236 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED                 DB operation failed
237 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
238 *
239 * @post media_info_insert_to_db_with_data()
240 */
241 int media_info_set_album(media_info_h media, const char *album);
242
243 /**
244 * @internal
245 * @brief Sets the artist of media info handle.
246 * @since_tizen 2.4
247 *
248 * @param[in] media The media info handle
249 * @param[in] artist The artist of media info handle
250 *
251 * @return @c 0 on success,
252 *           otherwise a negative error value
253 *
254 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
255 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
256 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED                 DB operation failed
257 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
258 *
259 * @post media_info_insert_to_db_with_data()
260 */
261 int media_info_set_artist(media_info_h media, const char *artist);
262
263 /**
264 * @internal
265 * @brief Sets the genre of media info handle.
266 * @since_tizen 2.4
267 *
268 * @param[in] media The media info handle
269 * @param[in] genre The genre of media info handle
270 *
271 * @return @c 0 on success,
272 *           otherwise a negative error value
273 *
274 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
275 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
276 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED                 DB operation failed
277 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
278 *
279 * @post media_info_insert_to_db_with_data()
280 */
281 int media_info_set_genre(media_info_h media, const char *genre);
282
283 /**
284 * @internal
285 * @brief Sets the recorded date of media info handle.
286 * @since_tizen 2.4
287 *
288 * @param[in] media The media info handle
289 * @param[in] recorded_date The recorded date of media info handle
290 *
291 * @return @c 0 on success,
292 *           otherwise a negative error value
293 *
294 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
295 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
296 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED                 DB operation failed
297 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
298 *
299 * @post media_info_insert_to_db_with_data()
300 */
301 int media_info_set_recorded_date(media_info_h media, const char *recorded_date);
302
303 /**
304 * @internal
305 * @brief Sets the thumbnail path of media info handle.
306 * @since_tizen 2.4
307 *
308 * @param[in] media The media info handle
309 * @param[in] thumbnail_path The thumbnail path of media info handle
310 *
311 * @return @c 0 on success,
312 *           otherwise a negative error value
313 *
314 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
315 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
316 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED                 DB operation failed
317 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
318 *
319 * @post media_info_insert_to_db_with_data()
320 */
321 int media_info_set_thumbnail_path(media_info_h media, const char *thumbnail_path);
322
323 /**
324 * @internal
325 * @brief Sets the size of media info handle.
326 * @since_tizen 2.4
327 *
328 * @param[in] media The media info handle
329 * @param[in] size The size of media info handle
330 *
331 * @return @c 0 on success,
332 *           otherwise a negative error value
333 *
334 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
335 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
336 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED                 DB operation failed
337 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
338 *
339 * @post media_info_insert_to_db_with_data()
340 */
341 int media_info_set_size(media_info_h media, unsigned long long size);
342
343 /**
344 * @internal
345 * @brief Sets the modified time of media info handle.
346 * @since_tizen 2.4
347 *
348 * @param[in] media The media info handle
349 * @param[in] modified_time The modified time of media info handle
350 *
351 * @return @c 0 on success,
352 *           otherwise a negative error value
353 *
354 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
355 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
356 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED                 DB operation failed
357 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
358 *
359 * @post media_info_insert_to_db_with_data()
360 */
361 int media_info_set_modified_time(media_info_h media, time_t modified_time);
362
363 /**
364 * @internal
365 * @brief Sets the media type of media info handle.
366 * @since_tizen 2.4
367 *
368 * @param[in] media The media info handle
369 * @param[in] type The media type of media info handle
370 *
371 * @return @c 0 on success,
372 *           otherwise a negative error value
373 *
374 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
375 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
376 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED                 DB operation failed
377 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
378 *
379 * @post media_info_insert_to_db_with_data()
380 */
381 int media_info_set_media_type(media_info_h media, media_content_type_e type);
382
383 /**
384 * @internal
385 * @brief Sets the duration of media info handle.
386 * @since_tizen 2.4
387 *
388 * @param[in] media The media info handle
389 * @param[in] duration The duration of media info handle
390 *
391 * @return @c 0 on success,
392 *           otherwise a negative error value
393 *
394 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
395 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
396 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED                 DB operation failed
397 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
398 *
399 * @post media_info_insert_to_db_with_data()
400 */
401 int media_info_set_duration(media_info_h media, int duration);
402
403 /**
404 * @internal
405 * @brief Sets the width of media info handle.
406 * @since_tizen 2.4
407 *
408 * @param[in] media The media info handle
409 * @param[in] width The width of media info handle
410 *
411 * @return @c 0 on success,
412 *           otherwise a negative error value
413 *
414 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
415 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
416 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED                 DB operation failed
417 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
418 *
419 * @post media_info_insert_to_db_with_data()
420 */
421 int media_info_set_width(media_info_h media, int width);
422
423 /**
424 * @internal
425 * @brief Sets the height of media info handle.
426 * @since_tizen 2.4
427 *
428 * @param[in] media The media info handle
429 * @param[in] height The height of media info handle
430 *
431 * @return @c 0 on success,
432 *           otherwise a negative error value
433 *
434 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
435 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
436 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED                 DB operation failed
437 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
438 *
439 * @post media_info_insert_to_db_with_data()
440 */
441 int media_info_set_height(media_info_h media, int height);
442
443 /**
444 * @internal
445 * @brief Sets the storage type of media info handle.
446 * @since_tizen 2.4
447 *
448 * @param[in] media The media info handle
449 * @param[in] storage_type The storage type of media info handle
450 *
451 * @return @c 0 on success,
452 *           otherwise a negative error value
453 *
454 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
455 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
456 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED                 DB operation failed
457 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
458 *
459 * @post media_info_insert_to_db_with_data()
460 */
461 int media_info_set_storage_type(media_info_h media, media_content_storage_e storage_type);
462
463 /**
464 * @internal
465 * @brief Sets the storage type of media info handle.
466 * @since_tizen 2.4
467 *
468 * @param[in] media The media info handle
469 * @param[in] storage_id The storage id of media info handle
470 *
471 * @return @c 0 on success,
472 *           otherwise a negative error value
473 *
474 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
475 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
476 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED                 DB operation failed
477 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
478 *
479 * @post media_info_insert_to_db_with_data()
480 */
481 int media_info_set_storage_id(media_info_h media, const char *storage_id);
482
483 /**
484  * @brief Gets the storage scan status of media storage.
485  * @since_tizen 2.4
486  *
487  * @param[in]  storage The media storage handle
488  * @param[out] scan_status  The storage type of the media storage
489  *
490  * @return @c 0 on success,
491  *         otherwise a negative error value
492  *
493  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
494  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
495  */
496 int media_storage_get_scan_status(const char *storage_uuid, media_storage_scan_status_e *scan_status);
497
498 #ifdef __cplusplus
499 }
500 #endif /* __cplusplus */
501 #endif /*__TIZEN_MEDIA_CONTENT_INTERNAL_H__*/