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);
56 int media_info_get_stitched_engine(media_info_h media, int *type_360);
58 * @brief Gets the content's played position parameter.
59 * @details Function returns content's elapsed playback position parameter as period
60 * starting from the beginning of the track.
62 * @param[in] media The handle to media info
63 * @param[out] played_position The elapsed time of the content
64 * @return 0 on success, otherwise a negative error value.
65 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
66 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
68 int media_info_get_played_position(media_info_h media, int *played_position);
70 * @brief Gets the provider to media info.
72 * @remarks @a modified_month should be released with free() by you.
74 * @param[in] media The handle to media info
75 * @param[out] category The modified month of media info
76 * @return 0 on success, otherwise a negative error value.
77 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
78 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
79 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
82 int media_info_get_modified_month(media_info_h media, char **modified_month);
85 * @brief Gets the played count to content meta handle.
87 * @param[in] media The handle to media info
88 * @param[out] played_count The played count of content
89 * @return 0 on success, otherwise a negative error value.
90 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
91 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
93 int media_info_get_played_count(media_info_h media, int *played_count);
96 * @brief Sets the played count to content meta handle.
98 * @param[in] media The handle to media info
99 * @param[in] played_count The played count of content
100 * @return 0 on success, otherwise a negative error value.
101 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
102 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
103 * @post media_info_update_to_db()
105 int media_info_set_played_count(media_info_h media, int played_count);
108 * @brief Sets the played position to content meta handle.
110 * @param[in] media The handle to media info
111 * @param[in] played_position The played position of content
112 * @return 0 on success, otherwise a negative error value.
113 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
114 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
115 * @post media_info_update_to_db()
117 int media_info_set_played_position(media_info_h media, int played_position);
120 * @brief Gets the content's played time parameter.
121 * @details Function returns content's elapsed playback time parameter as period
122 * starting from the beginning of the track.
124 * @param[in] media The handle to the media info
125 * @param[out] played_time The elapsed time of the content
127 * @return 0 on success,
128 * otherwise a negative error value
130 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
131 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
133 int media_info_get_played_time(media_info_h media, time_t *played_time);
136 * @brief Sets the played time to content meta handle.
137 * @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.
139 * @param[in] media The handle to the media info
141 * @return 0 on success,
142 * otherwise a negative error value
144 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
145 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
147 * @post media_info_update_to_db()
149 int media_info_set_played_time(media_info_h media);
152 int media_info_get_media_info_by_path_from_db(const char* path, media_info_h* media);
155 /********** media_folder **********/
156 int media_folder_get_scan_status(const char *storage_uuid, char* path, media_folder_scan_status_e *scan_status);
157 int media_folder_reset_scan_status(const char *storage_uuid, const char* path);
160 * @brief Sets the folder name.
161 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
163 * @param[in] folder The handle to the media folder
164 * @param[in] name The name of the media folder
166 * @return @c 0 on success,
167 * otherwise a negative error value
169 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
170 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
171 * @retval #MEDIA_CONTENT_ERROR_INVALID_OPERATION Invalid operation
172 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
174 int media_folder_set_name(media_folder_h folder, const char *name);
177 * @brief Updates the media folder to the media database.
179 * @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
182 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
185 * @privilege %http://tizen.org/privilege/content.write
187 * @param[in] folder The handle to the media folder
189 * @return @c 0 on success,
190 * otherwise a negative error value
192 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
193 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
194 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
195 * @retval #MEDIA_CONTENT_ERROR_INVALID_OPERATION Invalid operation
196 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB Operation failed
197 * @retval #MEDIA_CONTENT_ERROR_DB_BUSY DB Operation busy
198 * @retval #MEDIA_CONTENT_ERROR_NETWORK Network fail
199 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
201 * @pre This function requires opened connection to content service by media_content_connect().
203 * @see media_content_connect()
204 * @see media_folder_destroy()
206 int media_folder_update_to_db(media_folder_h folder);
209 * @brief insert media folder into database by folder path
212 * @param[in] folder path
214 * @return @c 0 on success,
215 * otherwise a negative error value
217 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
218 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
220 int media_folder_insert_to_db(const char *path);
222 /********** media_group **********/
225 * @brief Iterates through the media group with optional @a filter from the media database.
226 * @details This function gets the names and counts of media group meeting the given filter.
227 * The callback function will be invoked for every retrieved media group.
228 * If NULL is passed to the filter, no filtering is applied.
230 * @param[in] filter The handle to media filter
231 * @param[in] group The type of media group
232 * @param[in] callback The callback function to invoke
233 * @param[in] user_data The user data to be passed to the callback function
234 * @return 0 on success, otherwise a negative error value.
235 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
236 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
237 * @pre This function requires opened connection to content service by media_content_connect().
238 * @post This function invokes media_group_cb().
239 * @see #media_group_and_count_cb
240 * @see media_content_connect()
241 * @see media_filter_create()
243 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);
246 /********** media_storage **********/
249 * @brief Gets the storage scan status of media storage.
252 * @param[in] storage The media storage handle
253 * @param[out] scan_status The storage type of the media storage
255 * @return @c 0 on success,
256 * otherwise a negative error value
258 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
259 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
261 int media_storage_get_scan_status(const char *storage_uuid, media_storage_scan_status_e *scan_status);
264 * @brief Iterates through media storage from the media database.
265 * @details This function gets all media storage handles meeting the given @a filter.
266 * The @a callback function will be invoked for every retrieved media storage.
267 * If @c NULL is passed to the @a filter, then no filtering is applied.
269 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
271 * @param[in] filter The handle to the media filter
272 * @param[in] callback The callback function to be invoked
273 * @param[in] user_data The user data to be passed to the callback function
275 * @return @c 0 on success,
276 * otherwise a negative error value
278 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
279 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
280 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
281 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB Operation failed
282 * @retval #MEDIA_CONTENT_ERROR_DB_BUSY DB Operation busy
284 * @pre This function requires opened connection to content service by media_content_connect().
285 * @post This function invokes media_storage_destroy().
287 * @see media_content_connect()
288 * @see media_storage_destroy()
290 int media_storage_foreach_storage_from_db(filter_h filter, media_storage_cb callback, void *user_data);
293 * @brief Destroys media storage handle.
294 * @details The function frees all resources related to the media storage handle. This handle
295 * can no longer be used to perform any operations. New media storage handle has to
296 * be created before the next usage.
298 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
300 * @param[in] storage The media storage handle
302 * @return @c 0 on success,
303 * otherwise a negative error value
305 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
306 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
308 * @pre Get copy of media_storage_h handle by calling media_storage_clone().
310 * @see media_storage_clone()
312 int media_storage_destroy(media_storage_h storage);
315 * @brief Clones the media storage handle.
317 * @details This function copies the media storage handle from a source to the destination.
318 * There is no media_storage_create() function. The media_storage_h is created internally and
319 * available through media storage foreach function such as media_storage_foreach_storage_from_db().
320 * To use this handle outside of these foreach functions, use this function.
322 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
324 * @remarks The @a dst should be released using media_storage_destroy().
326 * @param[out] dst The destination handle to the media storage
327 * @param[in] src The source handle to the media storage
329 * @return @c 0 on success,
330 * otherwise a negative error value
332 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
333 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
334 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
336 * @see media_storage_destroy()
337 * @see media_storage_foreach_storage_from_db()
338 * @see media_storage_get_storage_info_from_db()
340 int media_storage_clone(media_storage_h *dst, media_storage_h src);
343 * @brief Gets the storage id of media storage.
344 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
346 * @remarks The @a storage_id should be released using free().
348 * @param[in] storage The media storage handle
349 * @param[out] storage_id The ID of the media storage
351 * @return @c 0 on success,
352 * otherwise a negative error value
354 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
355 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
356 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
358 int media_storage_get_id(media_storage_h storage, char **storage_id);
361 * @brief Gets the storage path of media storage.
362 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
364 * @remarks The @a storage_path should be released using free().
366 * @param[in] storage The media storage handle
367 * @param[out] storage_path The storage path of the media storage
369 * @return @c 0 on success,
370 * otherwise a negative error value
372 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
373 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
374 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
376 int media_storage_get_path(media_storage_h storage, char **storage_path);
379 #endif /* __cplusplus */
381 #endif /* __TIZEN_MEDIA_CONTENT_PRODUCT_H__ */