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.
17 #ifndef __TIZEN_MEDIA_CONTENT_PRODUCT_H__
18 #define __TIZEN_MEDIA_CONTENT_PRODUCT_H__
20 #include <media_content_type_product.h>
21 #include <media_pvr.h>
22 #include <media_uhd.h>
26 #endif /* __cplusplus */
28 /********** media_content **********/
30 int media_content_scan_folder_v2(const char *path, bool is_recursive, media_scan_completed_cb_v2 callback, void *user_data);
33 /********** media_info **********/
35 int media_info_delete_from_db(const char *media_id);
38 * @brief Gets the extract_flag of media info.
41 * @remarks You must release @a title using free().
43 * @param[in] media The media info handle
44 * @param[out] extract_flag The extract_flag of the media info
46 * @return @c 0 on success,
47 * otherwise a negative error value
49 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
50 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
51 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
52 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
54 int media_info_get_extract_flag(media_info_h media, int *extract_flag);
55 int media_info_get_stitched_state(media_info_h media, int *type_360);
57 * @brief Gets the content's played position parameter.
58 * @details Function returns content's elapsed playback position parameter as period
59 * starting from the beginning of the track.
61 * @param[in] media The handle to media info
62 * @param[out] played_position The elapsed time of the content
63 * @return 0 on success, otherwise a negative error value.
64 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
65 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
67 int media_info_get_played_position(media_info_h media, int *played_position);
70 * @brief Gets the played count to content meta handle.
72 * @param[in] media The handle to media info
73 * @param[out] played_count The played count of content
74 * @return 0 on success, otherwise a negative error value.
75 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
76 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
78 int media_info_get_played_count(media_info_h media, int *played_count);
81 * @brief Sets the played count to content meta handle.
83 * @param[in] media The handle to media info
84 * @param[in] played_count The played count of content
85 * @return 0 on success, otherwise a negative error value.
86 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
87 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
88 * @post media_info_update_to_db()
90 int media_info_set_played_count(media_info_h media, int played_count);
93 * @brief Sets the played position to content meta handle.
95 * @param[in] media The handle to media info
96 * @param[in] played_position The played position of content
97 * @return 0 on success, otherwise a negative error value.
98 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
99 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
100 * @post media_info_update_to_db()
102 int media_info_set_played_position(media_info_h media, int played_position);
105 * @brief Gets the content's played time parameter.
106 * @details Function returns content's elapsed playback time parameter as period
107 * starting from the beginning of the track.
109 * @param[in] media The handle to the media info
110 * @param[out] played_time The elapsed time of the content
112 * @return 0 on success,
113 * otherwise a negative error value
115 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
116 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
118 int media_info_get_played_time(media_info_h media, time_t *played_time);
121 * @brief Sets the played time to content meta handle.
122 * @details You can set the latest played(opened) time of the content file. the latest played time to be set the current time on the system.
124 * @param[in] media The handle to the media info
126 * @return 0 on success,
127 * otherwise a negative error value
129 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
130 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
132 * @post media_info_update_to_db()
134 int media_info_set_played_time(media_info_h media);
137 int media_info_get_media_info_by_path_from_db(const char* path, media_info_h* media);
140 /********** media_folder **********/
141 int media_folder_get_scan_status(const char *storage_uuid, char* path, media_folder_scan_status_e *scan_status);
142 int media_folder_reset_scan_status(const char *storage_uuid, const char* path);
145 * @brief Sets the folder name.
148 * @param[in] folder The handle to the media folder
149 * @param[in] name The name of the media folder
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_INVALID_OPERATION Invalid operation
157 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
159 int media_folder_set_name(media_folder_h folder, const char *name);
162 * @brief Updates the media folder to the media database.
164 * @details The function updates the given media folder in the media database. The function should be called after any change in folder attributes, to be updated to the media
170 * @privilege %http://tizen.org/privilege/content.write
172 * @param[in] folder The handle to the media folder
174 * @return @c 0 on success,
175 * otherwise a negative error value
177 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
178 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
179 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
180 * @retval #MEDIA_CONTENT_ERROR_INVALID_OPERATION Invalid operation
181 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB Operation failed
182 * @retval #MEDIA_CONTENT_ERROR_DB_BUSY DB Operation busy
183 * @retval #MEDIA_CONTENT_ERROR_NETWORK Network fail
184 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
186 * @pre This function requires opened connection to content service by media_content_connect().
188 * @see media_content_connect()
189 * @see media_folder_destroy()
191 int media_folder_update_to_db(media_folder_h folder);
193 /********** media_group **********/
196 * @brief Iterates through the media group with optional @a filter from the media database.
197 * @details This function gets the names and counts of media group meeting the given filter.
198 * The callback function will be invoked for every retrieved media group.
199 * If NULL is passed to the filter, no filtering is applied.
201 * @param[in] filter The handle to media filter
202 * @param[in] group The type of media group
203 * @param[in] callback The callback function to invoke
204 * @param[in] user_data The user data to be passed to the callback function
205 * @return 0 on success, otherwise a negative error value.
206 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
207 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
208 * @pre This function requires opened connection to content service by media_content_connect().
209 * @post This function invokes media_group_cb().
210 * @see #media_group_and_count_cb
211 * @see media_content_connect()
212 * @see media_filter_create()
214 int media_group_foreach_group_and_count_from_db(filter_h filter, media_group_e group, media_group_and_count_cb callback, void *user_data);
217 /********** media_storage **********/
220 * @brief Gets the storage scan status of media storage.
223 * @param[in] storage The media storage handle
224 * @param[out] scan_status The storage type of the media storage
226 * @return @c 0 on success,
227 * otherwise a negative error value
229 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
230 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
232 int media_storage_get_scan_status(const char *storage_uuid, media_storage_scan_status_e *scan_status);
235 * @brief Iterates through media storage from the media database.
236 * @details This function gets all media storage handles meeting the given @a filter.
237 * The @a callback function will be invoked for every retrieved media storage.
238 * If @c NULL is passed to the @a filter, then no filtering is applied.
242 * @param[in] filter The handle to the media filter
243 * @param[in] callback The callback function to be invoked
244 * @param[in] user_data The user data to be passed to the callback function
246 * @return @c 0 on success,
247 * otherwise a negative error value
249 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
250 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
251 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
252 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB Operation failed
253 * @retval #MEDIA_CONTENT_ERROR_DB_BUSY DB Operation busy
255 * @pre This function requires opened connection to content service by media_content_connect().
256 * @post This function invokes media_storage_destroy().
258 * @see media_content_connect()
259 * @see media_storage_destroy()
261 int media_storage_foreach_storage_from_db(filter_h filter, media_storage_cb callback, void *user_data);
264 * @brief Destroys media storage handle.
265 * @details The function frees all resources related to the media storage handle. This handle
266 * can no longer be used to perform any operations. New media storage handle has to
267 * be created before the next usage.
271 * @param[in] storage The media storage handle
273 * @return @c 0 on success,
274 * otherwise a negative error value
276 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
277 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
279 * @pre Get copy of media_storage_h handle by calling media_storage_clone().
281 * @see media_storage_clone()
283 int media_storage_destroy(media_storage_h storage);
286 * @brief Clones the media storage handle.
288 * @details This function copies the media storage handle from a source to the destination.
289 * There is no media_storage_create() function. The media_storage_h is created internally and
290 * available through media storage foreach function such as media_storage_foreach_storage_from_db().
291 * To use this handle outside of these foreach functions, use this function.
295 * @remarks The @a dst should be released using media_storage_destroy().
297 * @param[out] dst The destination handle to the media storage
298 * @param[in] src The source handle to the media storage
300 * @return @c 0 on success,
301 * otherwise a negative error value
303 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
304 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
305 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
307 * @see media_storage_destroy()
308 * @see media_storage_foreach_storage_from_db()
309 * @see media_storage_get_storage_info_from_db()
311 int media_storage_clone(media_storage_h *dst, media_storage_h src);
314 * @brief Gets the storage id of media storage.
317 * @remarks The @a storage_id should be released using free().
319 * @param[in] storage The media storage handle
320 * @param[out] storage_id The ID of the media storage
322 * @return @c 0 on success,
323 * otherwise a negative error value
325 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
326 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
327 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
329 int media_storage_get_id(media_storage_h storage, char **storage_id);
332 * @brief Gets the storage path of media storage.
335 * @remarks The @a storage_path should be released using free().
337 * @param[in] storage The media storage handle
338 * @param[out] storage_path The storage path of the media storage
340 * @return @c 0 on success,
341 * otherwise a negative error value
343 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
344 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
345 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
347 int media_storage_get_path(media_storage_h storage, char **storage_path);
350 #endif /* __cplusplus */
352 #endif /* __TIZEN_MEDIA_CONTENT_PRODUCT_H__ */