move one product API
[platform/core/api/media-content.git] / include_product / 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 @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
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 @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
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 @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
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 Sets the MIME type of media info handle.
106 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
107 *
108 * @param[in] media The media info handle
109 * @param[in] mime_type The MIME type of the media info
110 *
111 * @return @c 0 on success,
112 *           otherwise a negative error value
113 *
114 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
115 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
116 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED                 DB operation failed
117 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
118 *
119 * @post media_info_insert_to_db_with_data()
120 */
121 int media_info_set_mime_type(media_info_h media, const char *mime_type);
122
123 /**
124 * @internal
125 * @brief Sets the thumbnail path of media info handle.
126 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
127 *
128 * @param[in] media The media info handle
129 * @param[in] thumbnail_path The thumbnail path of media info handle
130 *
131 * @return @c 0 on success,
132 *           otherwise a negative error value
133 *
134 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
135 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
136 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED                 DB operation failed
137 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
138 *
139 * @post media_info_insert_to_db_with_data()
140 */
141 int media_info_set_thumbnail_path(media_info_h media, const char *thumbnail_path);
142
143 /**
144 * @internal
145 * @brief Sets the size of media info handle.
146 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
147 *
148 * @param[in] media The media info handle
149 * @param[in] size The size of media info handle
150 *
151 * @return @c 0 on success,
152 *           otherwise a negative error value
153 *
154 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
155 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
156 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED                 DB operation failed
157 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
158 *
159 * @post media_info_insert_to_db_with_data()
160 */
161 int media_info_set_size(media_info_h media, unsigned long long size);
162
163 /**
164 * @internal
165 * @brief Sets the modified time of media info handle.
166 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
167 *
168 * @param[in] media The media info handle
169 * @param[in] modified_time The modified time of media info handle
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_modified_time(media_info_h media, time_t modified_time);
182
183 /**
184 * @internal
185 * @brief Sets the media type of media info handle.
186 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
187 *
188 * @param[in] media The media info handle
189 * @param[in] type The media type of media info handle
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_media_type(media_info_h media, media_content_type_e type);
202
203 /**
204 * @internal
205 * @brief Sets the duration of media info handle.
206 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
207 *
208 * @param[in] media The media info handle
209 * @param[in] duration The duration 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_duration(media_info_h media, int duration);
222
223 /**
224 * @internal
225 * @brief Sets the width of media info handle.
226 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
227 *
228 * @param[in] media The media info handle
229 * @param[in] width The width 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_width(media_info_h media, int width);
242
243 /**
244 * @internal
245 * @brief Sets the height of media info handle.
246 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
247 *
248 * @param[in] media The media info handle
249 * @param[in] height The height 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_height(media_info_h media, int height);
262
263 /**
264 * @internal
265 * @brief Sets the storage type of media info handle.
266 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
267 *
268 * @param[in] media The media info handle
269 * @param[in] storage_type The storage type 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_storage_type(media_info_h media, media_content_storage_e storage_type);
282
283 /**
284 * @internal
285 * @brief Sets the storage type of media info handle.
286 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
287 *
288 * @param[in] media The media info handle
289 * @param[in] storage_id The storage id 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_storage_id(media_info_h media, const char *storage_id);
302
303 /**
304  * @brief Gets the storage scan status of media storage.
305  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
306  *
307  * @param[in]  storage The media storage handle
308  * @param[out] scan_status  The storage type of the media storage
309  *
310  * @return @c 0 on success,
311  *         otherwise a negative error value
312  *
313  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
314  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
315  */
316 int media_storage_get_scan_status(const char *storage_uuid, media_storage_scan_status_e *scan_status);
317
318 /**
319  * @brief Subscribes notifications of the media DB change.
320  * @details This function subscribes notifications of the media DB change which are published by the media server or other apps.
321  *          media_content_db_update_cb() function will be called when notification of the media DB change is subscribed.
322  *
323  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
324  *
325  * @param[in] callback  The callback to be invoked when the scanning is finished
326  * @param[in] user_data The user data to be passed to the callback function
327  *
328  * @return @c 0 on success,
329  *         otherwise a negative error value
330  *
331  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
332  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
333  * @retval #MEDIA_CONTENT_ERROR_INVALID_OPERATION Invalid operation
334  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
335  * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
336  *
337  * @see media_content_db_update_cb()
338  * @see media_content_unset_db_updated_cb_v2()
339  */
340 int media_content_set_db_updated_cb_v2(media_content_noti_h *noti_handle, media_content_db_update_cb callback, void *user_data);
341
342
343 /**
344  * @brief Unsubscribes notifications of the media DB change.
345  * @details This function unsubscribes notifications of the media DB change which are published by the media server or other apps.
346  *
347  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
348  *
349  * @return @c 0 on success,
350  *         otherwise a negative error value
351  *
352  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
353  * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
354  *
355  * @pre media_content_set_db_updated_cb_v2()
356  *
357  * @see media_content_set_db_updated_cb_v2()
358  */
359 int media_content_unset_db_updated_cb_v2(media_content_noti_h noti_handle);
360
361 typedef enum {
362         MEDIA_CONTENT_SCAN_PARTIAL_COMPLETE             = 2,
363         MEDIA_CONTENT_SCAN_COMPLETE                     = 3,
364         MEDIA_CONTENT_EXTRACT_COMPLETE          = 4,
365 } media_content_complete_phase_e;
366
367 typedef void (*media_scan_completed_cb_v2)(media_content_error_e error, media_content_complete_phase_e complete_phase, void * user_data);
368
369 typedef struct _media_content_scan_cb_data_v2 {
370         media_scan_completed_cb_v2 callback;
371         void *user_data;
372 } media_content_scan_cb_data_v2;
373
374 int media_content_scan_folder_v2(const char *path, bool is_recursive, media_scan_completed_cb_v2 callback, void *user_data);
375
376 int media_info_get_media_info_by_path_from_db(const char* path, media_info_h* media);
377
378 #ifdef _USE_SENIOR_MODE
379 int media_info_insert_to_db_with_contact_data(const char *path, const char* contact, const char* app_data, media_info_h *info);
380 int media_info_delete_contact_from_db(const char* contact, const char* storage_id);
381 int media_info_delete_item(const char *media_id);
382 int media_info_get_contact(media_info_h media, char **contact);
383 int media_info_get_app_data(media_info_h media, char **app_data);
384 int media_info_set_contact(media_info_h media, const char *contact);
385 int media_info_set_app_data(media_info_h media, const char *app_data);
386 #endif
387
388 #define PVR_DURATION                            "PVR_DURATION"
389 #define PVR_TIME_ZONE                           "PVR_TIME_ZONE"
390 #define PVR_PTC                                         "PVR_PTC"
391 #define PVR_MAJOR                                       "PVR_MAJOR"
392 #define PVR_MINOR                                       "PVR_MINOR"
393 #define PVR_CHANNEL_TYPE                        "PVR_CHANNEL_TYPE"
394 #define PVR_CHANNEL_NAME                        "PVR_CHANNEL_NAME"
395 #define PVR_CHANNEL_NUM                         "PVR_CHANNEL_NUM"
396 #define PVR_PROGRAM_TITLE                       "PVR_PROGRAM_TITLE"
397 #define PVR_PROGRAM_NUM                 "PVR_PROGRAM_NUM"
398 #define PVR_PROGRAM_CRID                        "PVR_PROGRAM_CRID"
399 #define PVR_GUIDANCE                            "PVR_GUIDANCE"
400 #define PVR_SYNOPSIS                            "PVR_SYNOPSIS"
401 #define PVR_GENRE                                       "PVR_GENRE"
402 #define PVR_LANGUAGE                            "PVR_LANGUAGE"
403 #define PVR_EMBARGO_TIME                        "PVR_EMBARGO_TIME"
404 #define PVR_EXPIRY_TIME                         "PVR_EXPIRY_TIME"
405 #define PVR_START_TIME                          "PVR_START_TIME"
406 #define PVR_PROGRAM_START_TIME  "PVR_PROGRAM_START_TIME"
407 #define PVR_PROGRAM_END_TIME            "PVR_PROGRAM_END_TIME"
408 #define PVR_PROGRAM_DATE                        "PVR_PROGRAM_DATE"
409 #define PVR_PARENTAL_RATING             "PVR_PARENTAL_RATING"
410 #define PVR_TIMER_RECORD                        "PVR_TIMER_RECORD"
411 #define PVR_SERIES_RECORD                       "PVR_SERIES_RECORD"
412 #define PVR_HD                                          "PVR_HD"
413 #define PVR_SUBTITLE                            "PVR_SUBTITLE"
414 #define PVR_TTX                                         "PVR_TTX"
415 #define PVR_AD                                          "PVR_AD"
416 #define PVR_HARDOF_HEARINGRADIO "PVR_HARDOF_HEARINGRADIO"
417 #define PVR_DATA_SERVICE                        "PVR_DATA_SERVICE"
418 #define PVR_CONTENT_LOCK                        "PVR_CONTENT_LOCK"
419 #define PVR_CONTENT_WATCH               "PVR_CONTENT_WATCH"
420 #define PVR_CONTENT_HAS_AUDIO_ONLY      "PVR_CONTENT_HAS_AUDIO_ONLY"
421 #define PVR_CONTENT_IS_LOCAL_RECORD     "PVR_CONTENT_IS_LOCAL_RECORD"
422 #define PVR_CONTENT_RESOLUTION          "PVR_CONTENT_RESOLUTION"
423 #define PVR_CONTENT_ASPECTRATIO         "PVR_CONTENT_ASPECTRATIO"
424 #define PVR_MODIFIED_MONTH              "PVR_MODIFIED_MONTH"
425 #define PVR_MODIFIED_DATE               "PVR_MODIFIED_DATE"
426 #define PVR_SPORTS_TYPE                 "PVR_SPORTS_TYPE"
427 #define PVR_GUIDANCE_LENGTH             "PVR_GUIDANCE_LENGTH"
428 #define PVR_TVMODE                                      "PVR_TVMODE"
429 #define PVR_PLAY_COUNT                          "PVR_PLAY_COUNT"
430 #define PVR_PRIVATE_DATA                        "PVR_PRIVATE_DATA"
431 #define UHD_CONTENT_TITLE               "UHD_CONTENT_TITLE"
432 #define UHD_RELEASE_DATE                "UHD_RELEASE_DATE"
433 #define UHD_SUB_TYPE                    "UHD_SUB_TYPE"
434 #define UHD_FILE_NAME                   "UHD_FILE_NAME"
435 #define UHD_FOLDER_ID                   "UHD_FOLDER_ID"
436 #define UHD_PLAYED_COUNT                "UHD_PLAYED_COUNT"
437
438 typedef void *media_pvr_h;
439 typedef void *media_uhd_h;
440 typedef bool (*media_pvr_cb)(media_pvr_h pvr, void *user_data);
441 typedef bool (*media_uhd_cb)(media_uhd_h uhd, void *user_data);
442
443 #ifdef __cplusplus
444 }
445 #endif /* __cplusplus */
446 #endif /*__TIZEN_MEDIA_CONTENT_INTERNAL_H__*/