Add storage API.
[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 * @internal
37 * @brief Insert media storage to database.
38 * @since_tizen 2.4
39 *
40 * @remarks You must release @a storage using media_storage_destroy().
41 *
42 * @privlevel platform
43 * @privilege %http://tizen.org/privilege/content.write
44 *
45 * @param[in] storage_name The storage name to insert to database
46 * @param[in] storage_path The storage path to insert to database
47 * @param[in] storage_account The storage account to insert to database
48 * @param[in] storage_type The storage type to insert to database
49 * @param[out] storage The media storage handle
50 *
51 * @return @c 0 on success,
52 *           otherwise a negative error value
53 *
54 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
55 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
56 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED                 DB operation failed
57 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
58 *
59 * @see media_storage_delete_from_db()
60 */
61 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);
62
63 /**
64 * @internal
65 * @brief Deletes the database for media storage.
66 * @since_tizen 2.4
67 *
68 * @privlevel platform
69 * @privilege %http://tizen.org/privilege/content.write
70 *
71 * @param[in] storage_id The storage ID to delete from database
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_DB_FAILED                 DB operation failed
79 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
80 *
81 * @see media_storage_insert_to_db()
82 */
83 int media_storage_delete_from_db(const char *storage_id);
84
85 /**
86  * @brief Gets the storage account of media storage.
87  * @since_tizen 2.4
88  *
89  * @remarks You must release @a storage_account using free().
90  *
91  * @param[in]  storage The media storage handle
92  * @param[out] storage_account  The storage account of the media storage
93  *
94  * @return @c 0 on success,
95  *         otherwise a negative error value
96  *
97  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
98  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
99  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
100  */
101 int media_storage_get_storage_account(media_storage_h storage, char **storage_account);
102
103 /**
104 * @internal
105 * @brief Creates the media info handle.
106 * @since_tizen 2.4
107 *
108 * @remarks You must release @a media using media_info_destroy().
109 *
110 * @param[out] media The media info handle
111 *
112 * @return @c 0 on success,
113 *           otherwise a negative error value
114 *
115 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
116 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
117 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED                 DB operation failed
118 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
119 *
120 * @see media_info_destroy()
121 */
122 int media_info_create_handle(media_info_h *media);
123
124 /**
125 * @internal
126 * @brief Inserts media info to database with media info data.
127 * @since_tizen 2.4
128 *
129 * @remarks You must release @a info using media_info_destroy().
130 *
131 * @privlevel platform
132 * @privilege %http://tizen.org/privilege/content.write
133 *
134 * @param[in] media The media info handle
135 * @param[out] info The media info handle to get data from database
136 *
137 * @return @c 0 on success,
138 *           otherwise a negative error value
139 *
140 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
141 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
142 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED                 DB operation failed
143 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
144 */
145 int media_info_insert_to_db_with_data(media_info_h media, media_info_h *info);
146
147 /**
148 * @internal
149 * @brief Sets the path of media info handle.
150 * @since_tizen 2.4
151 *
152 * @param[in] media The media info handle
153 * @param[in] path The path of the media info
154 *
155 * @return @c 0 on success,
156 *           otherwise a negative error value
157 *
158 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
159 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
160 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED                 DB operation failed
161 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
162 *
163 * @post media_info_insert_to_db_with_data()
164 */
165 int media_info_set_path(media_info_h media, const char *path);
166
167 /**
168 * @internal
169 * @brief Sets the MIME type of media info handle.
170 * @since_tizen 2.4
171 *
172 * @param[in] media The media info handle
173 * @param[in] mime_type The MIME type of the media info
174 *
175 * @return @c 0 on success,
176 *           otherwise a negative error value
177 *
178 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
179 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
180 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED                 DB operation failed
181 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
182 *
183 * @post media_info_insert_to_db_with_data()
184 */
185 int media_info_set_mime_type(media_info_h media, const char *mime_type);
186
187 /**
188 * @internal
189 * @brief Sets the title of media info handle.
190 * @since_tizen 2.4
191 *
192 * @param[in] media The media info handle
193 * @param[in] title The title of media info handle
194 *
195 * @return @c 0 on success,
196 *           otherwise a negative error value
197 *
198 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
199 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
200 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED                 DB operation failed
201 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
202 *
203 * @post media_info_insert_to_db_with_data()
204 */
205 int media_info_set_title(media_info_h media, const char *title);
206
207 /**
208 * @internal
209 * @brief Sets the album of media info handle.
210 * @since_tizen 2.4
211 *
212 * @param[in] media The media info handle
213 * @param[in] album The album of media info handle
214 *
215 * @return @c 0 on success,
216 *           otherwise a negative error value
217 *
218 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
219 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
220 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED                 DB operation failed
221 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
222 *
223 * @post media_info_insert_to_db_with_data()
224 */
225 int media_info_set_album(media_info_h media, const char *album);
226
227 /**
228 * @internal
229 * @brief Sets the artist of media info handle.
230 * @since_tizen 2.4
231 *
232 * @param[in] media The media info handle
233 * @param[in] artist The artist of media info handle
234 *
235 * @return @c 0 on success,
236 *           otherwise a negative error value
237 *
238 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
239 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
240 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED                 DB operation failed
241 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
242 *
243 * @post media_info_insert_to_db_with_data()
244 */
245 int media_info_set_artist(media_info_h media, const char *artist);
246
247 /**
248 * @internal
249 * @brief Sets the genre of media info handle.
250 * @since_tizen 2.4
251 *
252 * @param[in] media The media info handle
253 * @param[in] genre The genre of media info handle
254 *
255 * @return @c 0 on success,
256 *           otherwise a negative error value
257 *
258 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
259 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
260 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED                 DB operation failed
261 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
262 *
263 * @post media_info_insert_to_db_with_data()
264 */
265 int media_info_set_genre(media_info_h media, const char *genre);
266
267 /**
268 * @internal
269 * @brief Sets the recorded date of media info handle.
270 * @since_tizen 2.4
271 *
272 * @param[in] media The media info handle
273 * @param[in] recorded_date The recorded date of media info handle
274 *
275 * @return @c 0 on success,
276 *           otherwise a negative error value
277 *
278 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
279 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
280 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED                 DB operation failed
281 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
282 *
283 * @post media_info_insert_to_db_with_data()
284 */
285 int media_info_set_recorded_date(media_info_h media, const char *recorded_date);
286
287 /**
288 * @internal
289 * @brief Sets the thumbnail path of media info handle.
290 * @since_tizen 2.4
291 *
292 * @param[in] media The media info handle
293 * @param[in] thumbnail_path The thumbnail path of media info handle
294 *
295 * @return @c 0 on success,
296 *           otherwise a negative error value
297 *
298 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
299 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
300 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED                 DB operation failed
301 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
302 *
303 * @post media_info_insert_to_db_with_data()
304 */
305 int media_info_set_thumbnail_path(media_info_h media, const char *thumbnail_path);
306
307 /**
308 * @internal
309 * @brief Sets the size of media info handle.
310 * @since_tizen 2.4
311 *
312 * @param[in] media The media info handle
313 * @param[in] size The size of media info handle
314 *
315 * @return @c 0 on success,
316 *           otherwise a negative error value
317 *
318 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
319 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
320 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED                 DB operation failed
321 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
322 *
323 * @post media_info_insert_to_db_with_data()
324 */
325 int media_info_set_size(media_info_h media, unsigned long long size);
326
327 /**
328 * @internal
329 * @brief Sets the modified time of media info handle.
330 * @since_tizen 2.4
331 *
332 * @param[in] media The media info handle
333 * @param[in] modified_time The modified time of media info handle
334 *
335 * @return @c 0 on success,
336 *           otherwise a negative error value
337 *
338 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
339 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
340 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED                 DB operation failed
341 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
342 *
343 * @post media_info_insert_to_db_with_data()
344 */
345 int media_info_set_modified_time(media_info_h media, time_t modified_time);
346
347 /**
348 * @internal
349 * @brief Sets the media type of media info handle.
350 * @since_tizen 2.4
351 *
352 * @param[in] media The media info handle
353 * @param[in] type The media type of media info handle
354 *
355 * @return @c 0 on success,
356 *           otherwise a negative error value
357 *
358 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
359 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
360 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED                 DB operation failed
361 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
362 *
363 * @post media_info_insert_to_db_with_data()
364 */
365 int media_info_set_media_type(media_info_h media, media_content_type_e type);
366
367 /**
368 * @internal
369 * @brief Sets the duration of media info handle.
370 * @since_tizen 2.4
371 *
372 * @param[in] media The media info handle
373 * @param[in] duration The duration of media info handle
374 *
375 * @return @c 0 on success,
376 *           otherwise a negative error value
377 *
378 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
379 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
380 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED                 DB operation failed
381 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
382 *
383 * @post media_info_insert_to_db_with_data()
384 */
385 int media_info_set_duration(media_info_h media, int duration);
386
387 /**
388 * @internal
389 * @brief Sets the width of media info handle.
390 * @since_tizen 2.4
391 *
392 * @param[in] media The media info handle
393 * @param[in] width The width of media info handle
394 *
395 * @return @c 0 on success,
396 *           otherwise a negative error value
397 *
398 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
399 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
400 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED                 DB operation failed
401 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
402 *
403 * @post media_info_insert_to_db_with_data()
404 */
405 int media_info_set_width(media_info_h media, int width);
406
407 /**
408 * @internal
409 * @brief Sets the height of media info handle.
410 * @since_tizen 2.4
411 *
412 * @param[in] media The media info handle
413 * @param[in] height The height of media info handle
414 *
415 * @return @c 0 on success,
416 *           otherwise a negative error value
417 *
418 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
419 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
420 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED                 DB operation failed
421 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
422 *
423 * @post media_info_insert_to_db_with_data()
424 */
425 int media_info_set_height(media_info_h media, int height);
426
427 /**
428 * @internal
429 * @brief Sets the storage type of media info handle.
430 * @since_tizen 2.4
431 *
432 * @param[in] media The media info handle
433 * @param[in] storage_type The storage type of media info handle
434 *
435 * @return @c 0 on success,
436 *           otherwise a negative error value
437 *
438 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
439 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
440 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED                 DB operation failed
441 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
442 *
443 * @post media_info_insert_to_db_with_data()
444 */
445 int media_info_set_storage_type(media_info_h media, media_content_storage_e storage_type);
446
447 /**
448 * @internal
449 * @brief Sets the storage type of media info handle.
450 * @since_tizen 2.4
451 *
452 * @param[in] media The media info handle
453 * @param[in] storage_id The storage id of media info handle
454 *
455 * @return @c 0 on success,
456 *           otherwise a negative error value
457 *
458 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
459 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
460 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED                 DB operation failed
461 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
462 *
463 * @post media_info_insert_to_db_with_data()
464 */
465 int media_info_set_storage_id(media_info_h media, const char *storage_id);
466
467 #ifdef __cplusplus
468 }
469 #endif /* __cplusplus */
470 #endif /*__TIZEN_MEDIA_CONTENT_INTERNAL_H__*/