2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 #ifndef __TIZEN_MEDIA_CONTENT_INTERNAL_H__
20 #define __TIZEN_MEDIA_CONTENT_INTERNAL_H__
22 #include <media_content_type.h>
26 #endif /* __cplusplus */
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
37 * @brief Insert media storage to database.
38 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
40 * @remarks You must release @a storage using media_storage_destroy().
43 * @privilege %http://tizen.org/privilege/content.write
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
51 * @return @c 0 on success,
52 * otherwise a negative error value
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
59 * @see media_storage_delete_from_db()
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);
65 * @brief Deletes the database for media storage.
66 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
69 * @privilege %http://tizen.org/privilege/content.write
71 * @param[in] storage_id The storage ID to delete from database
73 * @return @c 0 on success,
74 * otherwise a negative error value
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
81 * @see media_storage_insert_to_db()
83 int media_storage_delete_from_db(const char *storage_id);
86 * @brief Gets the storage account of media storage.
87 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
89 * @remarks You must release @a storage_account using free().
91 * @param[in] storage The media storage handle
92 * @param[out] storage_account The storage account of the media storage
94 * @return @c 0 on success,
95 * otherwise a negative error value
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
101 int media_storage_get_storage_account(media_storage_h storage, char **storage_account);
105 * @brief Sets the MIME type of media info handle.
106 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
108 * @param[in] media The media info handle
109 * @param[in] mime_type The MIME type of the media info
111 * @return @c 0 on success,
112 * otherwise a negative error value
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
119 * @post media_info_insert_to_db_with_data()
121 int media_info_set_mime_type(media_info_h media, const char *mime_type);
125 * @brief Sets the thumbnail path of media info handle.
126 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
128 * @param[in] media The media info handle
129 * @param[in] thumbnail_path The thumbnail path of media info handle
131 * @return @c 0 on success,
132 * otherwise a negative error value
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
139 * @post media_info_insert_to_db_with_data()
141 int media_info_set_thumbnail_path(media_info_h media, const char *thumbnail_path);
145 * @brief Sets the size of media info handle.
146 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
148 * @param[in] media The media info handle
149 * @param[in] size The size of media info handle
151 * @return @c 0 on success,
152 * otherwise a negative error value
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
159 * @post media_info_insert_to_db_with_data()
161 int media_info_set_size(media_info_h media, unsigned long long size);
165 * @brief Sets the modified time of media info handle.
166 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
168 * @param[in] media The media info handle
169 * @param[in] modified_time The modified time of media info handle
171 * @return @c 0 on success,
172 * otherwise a negative error value
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
179 * @post media_info_insert_to_db_with_data()
181 int media_info_set_modified_time(media_info_h media, time_t modified_time);
185 * @brief Sets the media type of media info handle.
186 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
188 * @param[in] media The media info handle
189 * @param[in] type The media type of media info handle
191 * @return @c 0 on success,
192 * otherwise a negative error value
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
199 * @post media_info_insert_to_db_with_data()
201 int media_info_set_media_type(media_info_h media, media_content_type_e type);
205 * @brief Sets the duration of media info handle.
206 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
208 * @param[in] media The media info handle
209 * @param[in] duration The duration of media info handle
211 * @return @c 0 on success,
212 * otherwise a negative error value
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
219 * @post media_info_insert_to_db_with_data()
221 int media_info_set_duration(media_info_h media, int duration);
225 * @brief Sets the width of media info handle.
226 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
228 * @param[in] media The media info handle
229 * @param[in] width The width of media info handle
231 * @return @c 0 on success,
232 * otherwise a negative error value
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
239 * @post media_info_insert_to_db_with_data()
241 int media_info_set_width(media_info_h media, int width);
245 * @brief Sets the height of media info handle.
246 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
248 * @param[in] media The media info handle
249 * @param[in] height The height of media info handle
251 * @return @c 0 on success,
252 * otherwise a negative error value
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
259 * @post media_info_insert_to_db_with_data()
261 int media_info_set_height(media_info_h media, int height);
265 * @brief Sets the storage type of media info handle.
266 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
268 * @param[in] media The media info handle
269 * @param[in] storage_type The storage type of media info handle
271 * @return @c 0 on success,
272 * otherwise a negative error value
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
279 * @post media_info_insert_to_db_with_data()
281 int media_info_set_storage_type(media_info_h media, media_content_storage_e storage_type);
285 * @brief Sets the storage type of media info handle.
286 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
288 * @param[in] media The media info handle
289 * @param[in] storage_id The storage id of media info handle
291 * @return @c 0 on success,
292 * otherwise a negative error value
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
299 * @post media_info_insert_to_db_with_data()
301 int media_info_set_storage_id(media_info_h media, const char *storage_id);
304 * @brief Gets the storage scan status of media storage.
305 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
307 * @param[in] storage The media storage handle
308 * @param[out] scan_status The storage type of the media storage
310 * @return @c 0 on success,
311 * otherwise a negative error value
313 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
314 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
316 int media_storage_get_scan_status(const char *storage_uuid, media_storage_scan_status_e *scan_status);
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.
323 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
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
328 * @return @c 0 on success,
329 * otherwise a negative error value
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
337 * @see media_content_db_update_cb()
338 * @see media_content_unset_db_updated_cb_v2()
340 int media_content_set_db_updated_cb_v2(media_content_noti_h *noti_handle, media_content_db_update_cb callback, void *user_data);
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.
347 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
349 * @return @c 0 on success,
350 * otherwise a negative error value
352 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
353 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
355 * @pre media_content_set_db_updated_cb_v2()
357 * @see media_content_set_db_updated_cb_v2()
359 int media_content_unset_db_updated_cb_v2(media_content_noti_h noti_handle);
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;
367 typedef void (*media_scan_completed_cb_v2)(media_content_error_e error, media_content_complete_phase_e complete_phase, void * user_data);
369 typedef struct _media_content_scan_cb_data_v2 {
370 media_scan_completed_cb_v2 callback;
372 } media_content_scan_cb_data_v2;
374 int media_content_scan_folder_v2(const char *path, bool is_recursive, media_scan_completed_cb_v2 callback, void *user_data);
376 #ifdef _USE_SENIOR_MODE
377 int media_info_insert_to_db_with_contact_data(const char *path, const char* contact, const char* app_data, media_info_h *info);
378 int media_info_delete_contact_from_db(const char* contact, const char* storage_id);
379 int media_info_get_media_info_by_path_from_db(const char* path, media_info_h* media);
380 int media_info_delete_item(const char *media_id);
381 int media_info_get_contact(media_info_h media, char **contact);
382 int media_info_get_app_data(media_info_h media, char **app_data);
383 int media_info_set_contact(media_info_h media, const char *contact);
384 int media_info_set_app_data(media_info_h media, const char *app_data);
387 #define PVR_DURATION "PVR_DURATION"
388 #define PVR_TIME_ZONE "PVR_TIME_ZONE"
389 #define PVR_PTC "PVR_PTC"
390 #define PVR_MAJOR "PVR_MAJOR"
391 #define PVR_MINOR "PVR_MINOR"
392 #define PVR_CHANNEL_TYPE "PVR_CHANNEL_TYPE"
393 #define PVR_CHANNEL_NAME "PVR_CHANNEL_NAME"
394 #define PVR_CHANNEL_NUM "PVR_CHANNEL_NUM"
395 #define PVR_PROGRAM_TITLE "PVR_PROGRAM_TITLE"
396 #define PVR_PROGRAM_NUM "PVR_PROGRAM_NUM"
397 #define PVR_PROGRAM_CRID "PVR_PROGRAM_CRID"
398 #define PVR_GUIDANCE "PVR_GUIDANCE"
399 #define PVR_SYNOPSIS "PVR_SYNOPSIS"
400 #define PVR_GENRE "PVR_GENRE"
401 #define PVR_LANGUAGE "PVR_LANGUAGE"
402 #define PVR_EMBARGO_TIME "PVR_EMBARGO_TIME"
403 #define PVR_EXPIRY_TIME "PVR_EXPIRY_TIME"
404 #define PVR_START_TIME "PVR_START_TIME"
405 #define PVR_PROGRAM_START_TIME "PVR_PROGRAM_START_TIME"
406 #define PVR_PROGRAM_END_TIME "PVR_PROGRAM_END_TIME"
407 #define PVR_PROGRAM_DATE "PVR_PROGRAM_DATE"
408 #define PVR_PARENTAL_RATING "PVR_PARENTAL_RATING"
409 #define PVR_TIMER_RECORD "PVR_TIMER_RECORD"
410 #define PVR_SERIES_RECORD "PVR_SERIES_RECORD"
411 #define PVR_HD "PVR_HD"
412 #define PVR_SUBTITLE "PVR_SUBTITLE"
413 #define PVR_TTX "PVR_TTX"
414 #define PVR_AD "PVR_AD"
415 #define PVR_HARDOF_HEARINGRADIO "PVR_HARDOF_HEARINGRADIO"
416 #define PVR_DATA_SERVICE "PVR_DATA_SERVICE"
417 #define PVR_CONTENT_LOCK "PVR_CONTENT_LOCK"
418 #define PVR_CONTENT_WATCH "PVR_CONTENT_WATCH"
419 #define PVR_CONTENT_HAS_AUDIO_ONLY "PVR_CONTENT_HAS_AUDIO_ONLY"
420 #define PVR_CONTENT_IS_LOCAL_RECORD "PVR_CONTENT_IS_LOCAL_RECORD"
421 #define PVR_CONTENT_RESOLUTION "PVR_CONTENT_RESOLUTION"
422 #define PVR_CONTENT_ASPECTRATIO "PVR_CONTENT_ASPECTRATIO"
423 #define PVR_MODIFIED_MONTH "PVR_MODIFIED_MONTH"
424 #define PVR_MODIFIED_DATE "PVR_MODIFIED_DATE"
425 #define PVR_SPORTS_TYPE "PVR_SPORTS_TYPE"
426 #define PVR_GUIDANCE_LENGTH "PVR_GUIDANCE_LENGTH"
427 #define PVR_TVMODE "PVR_TVMODE"
428 #define PVR_PLAY_COUNT "PVR_PLAY_COUNT"
429 #define PVR_PRIVATE_DATA "PVR_PRIVATE_DATA"
430 #define UHD_CONTENT_TITLE "UHD_CONTENT_TITLE"
431 #define UHD_RELEASE_DATE "UHD_RELEASE_DATE"
432 #define UHD_SUB_TYPE "UHD_SUB_TYPE"
433 #define UHD_FILE_NAME "UHD_FILE_NAME"
434 #define UHD_FOLDER_ID "UHD_FOLDER_ID"
435 #define UHD_PLAYED_COUNT "UHD_PLAYED_COUNT"
437 typedef void *media_pvr_h;
438 typedef void *media_uhd_h;
439 typedef bool (*media_pvr_cb)(media_pvr_h pvr, void *user_data);
440 typedef bool (*media_uhd_cb)(media_uhd_h uhd, void *user_data);
444 #endif /* __cplusplus */
445 #endif /*__TIZEN_MEDIA_CONTENT_INTERNAL_H__*/