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_CONTENT_MEDIA_BOOKMARK_H__
20 #define __TIZEN_CONTENT_MEDIA_BOOKMARK_H__
22 #include <media_content_type.h>
26 #endif /* __cplusplus */
29 * @file media_bookmark.h
30 * @brief This file contains API on main functional operations with bookmarks that are related to media resources in the media database. \n
31 * Operations include: inserting a new bookmark in media to the media database, removing bookmark from database, \n
32 * getting number of bookmarks, cloning and destroying bookmark, getting bookmark`s ID, time marked parameter and thumbnail.
36 * @addtogroup CAPI_CONTENT_MEDIA_BOOKMARK_MODULE
41 * @brief Inserts a new bookmark in media on the specified time offset to the media database.
42 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
45 * @privilege %http://tizen.org/privilege/content.write
47 * @param[in] media_id The media ID
48 * @param[in] time The bookmark time offset (in seconds)
49 * @param[in] thumbnail_path The thumbnail path of video bookmark\ n
50 * If the media type is audio, then thumbnail is null.
52 * @return @c 0 on success,
53 * otherwise a negative error value
55 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
56 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
57 * @retval #MEDIA_CONTENT_ERROR_INVALID_OPERATION Invalid operation
58 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB Operation failed
59 * @retval #MEDIA_CONTENT_ERROR_DB_BUSY DB Operation busy
60 * @retval #MEDIA_CONTENT_ERROR_NETWORK Network fail
61 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
63 * @pre This function requires opened connection to content service by media_content_connect().
65 * @see media_content_connect()
66 * @see media_bookmark_delete_from_db()
68 int media_bookmark_insert_to_db(const char *media_id, time_t time, const char *thumbnail_path);
71 * @brief Removes a media bookmark from the media database.
72 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
75 * @privilege %http://tizen.org/privilege/content.write
77 * @param[in] bookmark_id The ID of the media bookmark
79 * @return @c 0 on success,
80 * otherwise a negative error value
82 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
83 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
84 * @retval #MEDIA_CONTENT_ERROR_INVALID_OPERATION Invalid operation
85 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB Operation failed
86 * @retval #MEDIA_CONTENT_ERROR_DB_BUSY DB Operation busy
87 * @retval #MEDIA_CONTENT_ERROR_NETWORK Network fail
88 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
90 * @pre This function requires opened connection to content service by media_content_connect().
92 * @see media_content_connect()
93 * @see media_bookmark_insert_to_db()
95 int media_bookmark_delete_from_db(int bookmark_id);
98 * @brief Gets the number of bookmarks with an optional filter from the media database.
99 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
101 * @param[in] filter The handle to the media filter
102 * @param[out] bookmark_count The count of the media bookmark
104 * @return @c 0 on success,
105 * otherwise a negative error value
107 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
108 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
109 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB Operation failed
110 * @retval #MEDIA_CONTENT_ERROR_DB_BUSY DB Operation busy
112 * @pre This function requires opened connection to content service by media_content_connect().
114 * @see media_content_connect()
116 int media_bookmark_get_bookmark_count_from_db(filter_h filter, int *bookmark_count);
119 * @brief Iterates through the bookmarks with an optional filter from the media database.
120 * @details This function gets all bookmarks associated with the given filter and calls @a callback for every retrieved media bookmark.
121 * If @c NULL is passed to the @a filter, then no filtering is applied.
124 * @param[in] filter The handle to the media filter
125 * @param[in] callback The callback function to be invoked
126 * @param[in] user_data The user data to be passed to the callback function
128 * @return @c 0 on success,
129 * otherwise a negative error value
131 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
132 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
133 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
134 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB Operation failed
135 * @retval #MEDIA_CONTENT_ERROR_DB_BUSY DB Operation busy
137 * @pre This function requires opened connection to content service by media_content_connect().
138 * @post This function invokes media_bookmark_cb().
140 * @see media_content_connect()
141 * @see media_bookmark_cb()
142 * @see media_filter_create()
144 int media_bookmark_foreach_bookmark_from_db(filter_h filter, media_bookmark_cb callback, void *user_data);
147 * @brief Clones a media bookmark.
148 * @details This function copies the media bookmark handle from a source to destination. There is no media_bookmark_create() function.
149 * The media_bookmark_h is created internally and available through media bookmark foreach function such as media_info_foreach_bookmark_from_db().
150 * To use this handle outside of these foreach functions, use this function.
152 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
154 * @remarks The @a dst should be released using media_bookmark_destroy().
156 * @param[out] dst The destination handle to the media bookmark
157 * @param[in] src The source handle to the media bookmark
159 * @return @c 0 on success,
160 * otherwise a negative error value
162 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
163 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
164 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
166 * @see media_bookmark_destroy()
167 * @see media_info_foreach_bookmark_from_db()
169 int media_bookmark_clone(media_bookmark_h *dst, media_bookmark_h src);
172 * @brief Destroys a media bookmark.
173 * @details This function frees all the resources related to the bookmark handle. This handle
174 * no longer can be used to perform any operation. A new handle has to
175 * be created before the next use.
177 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
179 * @param[in] bookmark The handle to the media bookmark
181 * @return @c 0 on success,
182 * otherwise a negative error value
184 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
185 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
187 * @pre Get copy of bookmark handle by calling media_bookmark_clone().
189 * @see media_bookmark_clone()
191 int media_bookmark_destroy(media_bookmark_h bookmark);
194 * @brief Gets the bookmark ID.
195 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
197 * @param[in] bookmark The handle to the media bookmark
198 * @param[out] bookmark_id The ID of the media bookmark
200 * @return @c 0 on success,
201 * otherwise a negative error value
203 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
204 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
206 int media_bookmark_get_bookmark_id(media_bookmark_h bookmark, int *bookmark_id);
209 * @brief Gets the bookmark time marked parameter.
210 * @details This function returns time offset in seconds from beginning of the movie on which bookmark
213 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
215 * @param[in] bookmark The handle to the media bookmark
216 * @param[out] marked_time The bookmark time offset (in seconds)
218 * @return @c 0 on success,
219 * otherwise a negative error value
221 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
222 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
224 int media_bookmark_get_marked_time(media_bookmark_h bookmark, time_t *marked_time);
227 * @brief Gets the media bookmark thumbnail.
228 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
230 * @remarks The @a path should be released using free().
232 * @param[in] bookmark The handle to the media bookmark
233 * @param[out] path The thumbnail path of media bookmark
235 * @return @c 0 on success,
236 * otherwise a negative error value
238 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
239 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
240 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
242 int media_bookmark_get_thumbnail_path(media_bookmark_h bookmark, char **path);
245 * @brief Gets the media bookmark name which user set.
248 * @remarks The @a name should be released using free().
250 * @param[in] bookmark The handle to the media bookmark
251 * @param[out] name The name of media bookmark. If name was not set, empty string is returned.
252 * If User set bookmark name to NULL, name will be empty string also.
254 * @return @c 0 on success,
255 * otherwise a negative error value
257 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
258 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
259 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
261 int media_bookmark_get_name(media_bookmark_h bookmark, char **name);
264 * @brief Sets the media bookmark name.
267 * @param[in] bookmark The handle to the media bookmark
268 * @param[in] name The name of media bookmark. Can be NULL, empty or non-empty string.
270 * @return @c 0 on success,
271 * otherwise a negative error value
273 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
274 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
275 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
277 * @post media_bookmark_update_to_db()
279 int media_bookmark_set_name(media_bookmark_h bookmark, const char *name);
282 * @brief Updates bookmark information to the media database.
283 * @details The function updates the given bookmark meta in the media database. \n
284 * The function should be called after any change in bookmark attributes, to be updated to the media database. \n
285 * For example, after using media_bookmark_set_name() for setting the name of the bookmark, \n
286 * the media_bookmark_update_to_db() function should be called so as to update the given bookmark attributes in the media database.
290 * @privilege %http://tizen.org/privilege/content.write
292 * @remarks Do not call this function in callback function of foreach function like media_info_foreach_bookmark_from_db().
293 * @param[in] bookmark The handle to the media bookmark
295 * @return @c 0 on success,
296 * otherwise a negative error value
298 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
299 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
300 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
301 * @retval #MEDIA_CONTENT_ERROR_INVALID_OPERATION Invalid operation
302 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB Operation failed
303 * @retval #MEDIA_CONTENT_ERROR_DB_BUSY DB Operation busy
304 * @retval #MEDIA_CONTENT_ERROR_NETWORK Network fail
305 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied when Application has no privilege
307 * @pre This function requires opened connection to content service by media_content_connect().
309 * @see media_content_connect()
310 * @see media_bookmark_set_name()
312 int media_bookmark_update_to_db(media_bookmark_h bookmark);
320 #endif /* __cplusplus */
321 #endif /*__TIZEN_CONTENT_MEDIA_BOOKMARK_H__*/