[ACR] Remove error types that is not returned
[platform/core/api/media-content.git] / include / media_bookmark.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_BOOKMARK_H__
20 #define __TIZEN_MEDIA_BOOKMARK_H__
21
22 #include <media_content_type.h>
23
24 #ifdef __cplusplus
25 extern "C" {
26 #endif /* __cplusplus */
27
28 /**
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.
33  */
34
35 /**
36  * @addtogroup CAPI_CONTENT_MEDIA_BOOKMARK_MODULE
37  * @{
38  */
39
40 /**
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
43  *
44  * @privlevel public
45  * @privilege %http://tizen.org/privilege/content.write
46  *
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.
51  *
52  * @return @c 0 on success,
53  *         otherwise a negative error value
54  *
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
62  *
63  * @pre This function requires opened connection to content service by media_content_connect().
64  *
65  * @see media_content_connect()
66  * @see media_bookmark_delete_from_db()
67  */
68 int media_bookmark_insert_to_db(const char *media_id, time_t time, const char *thumbnail_path);
69
70 /**
71  * @brief Removes a media bookmark from the media database.
72  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
73  *
74  * @privlevel public
75  * @privilege %http://tizen.org/privilege/content.write
76  *
77  * @param[in] bookmark_id The ID of media bookmark
78  *
79  * @return @c 0 on success,
80  *         otherwise a negative error value
81  *
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
89  *
90  * @pre This function requires opened connection to content service by media_content_connect().
91  *
92  * @see media_content_connect()
93  * @see media_bookmark_insert_to_db()
94  */
95 int media_bookmark_delete_from_db(int bookmark_id);
96
97 /**
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
100  *
101  * @param[in]  filter         The handle to the media filter
102  * @param[out] bookmark_count The count of the media bookmark
103  *
104  * @return @c 0 on success,
105  *         otherwise a negative error value
106  *
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
111  * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
112  *
113  * @pre This function requires opened connection to content service by media_content_connect().
114  *
115  * @see media_content_connect()
116  */
117 int media_bookmark_get_bookmark_count_from_db(filter_h filter, int *bookmark_count);
118
119 /**
120  * @brief Clones a media bookmark.
121  * @details This function copies the media bookmark handle from a source to destination. There is no media_bookmark_create() function.
122  *          The media_bookmark_h is created internally and available through media bookmark foreach function such as media_info_foreach_bookmark_from_db().
123  *          To use this handle outside of these foreach functions, use this function.
124  *
125  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
126  *
127  * @remarks The destination handle must be released using media_bookmark_destroy().
128  *
129  * @param[out] dst The destination handle to media bookmark
130  * @param[in]  src The source handle to media bookmark
131  *
132  * @return @c 0 on success,
133  *         otherwise a negative error value
134  *
135  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
136  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
137  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
138  *
139  * @see media_bookmark_destroy()
140  * @see media_info_foreach_bookmark_from_db()
141  */
142 int media_bookmark_clone(media_bookmark_h *dst, media_bookmark_h src);
143
144 /**
145  * @brief Destroys a media bookmark.
146  * @details This function frees all the resources related to the bookmark handle. This handle
147  *          no longer can be used to perform any operation. A new handle has to
148  *          be created before the next use.
149  *
150  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
151  *
152  * @param[in] bookmark The handle to media bookmark
153  *
154  * @return @c 0 on success,
155  *         otherwise a negative error value
156  *
157  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
158  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
159  *
160  * @pre Get copy of bookmark handle by calling media_bookmark_clone().
161  *
162  * @see media_bookmark_clone()
163  */
164 int media_bookmark_destroy(media_bookmark_h bookmark);
165
166 /**
167  * @brief Gets the bookmark ID.
168  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
169  *
170  * @param[in]  bookmark    The handle to media bookmark
171  * @param[out] bookmark_id The media bookmark ID
172  *
173  * @return @c 0 on success,
174  *         otherwise a negative error value
175  *
176  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
177  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
178  */
179 int media_bookmark_get_bookmark_id(media_bookmark_h bookmark, int *bookmark_id);
180
181 /**
182  * @brief Gets the bookmark time marked parameter.
183  * @details This function returns time offset in seconds from beginning of the movie on which bookmark
184  *          was placed.
185  *
186  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
187  *
188  * @param[in]  bookmark    The handle to media bookmark
189  * @param[out] marked_time The bookmark time offset (in seconds)
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  */
197 int media_bookmark_get_marked_time(media_bookmark_h bookmark, time_t *marked_time);
198
199 /**
200  * @brief Gets the media bookmark thumbnail.
201  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
202  *
203  * @remarks You must release @a path using free().
204  *
205  * @param[in]  bookmark The handle to media bookmark
206  * @param[out] path     The thumbnail path of media bookmark
207  *
208  * @return @c 0 on success,
209  *         otherwise a negative error value
210  *
211  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
212  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
213  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
214  */
215 int media_bookmark_get_thumbnail_path(media_bookmark_h bookmark, char **path);
216
217 /**
218  * @brief Gets the media bookmark name which user set.
219  * @since_tizen 4.0
220  *
221  * @remarks You must release @a name using free().
222  *
223  * @param[in] bookmark The handle to media bookmark
224  * @param[out] name     The name of media bookmark. If name was not set, empty string is returned.
225  *                               If User set bookmark name to NULL, name will be empty string also.
226  *
227  * @return @c 0 on success,
228  *         otherwise a negative error value
229  *
230  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
231  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
232  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
233  */
234 int media_bookmark_get_name(media_bookmark_h bookmark, char **name);
235
236 /**
237  * @brief Sets the media bookmark name.
238  * @since_tizen 4.0
239  *
240  * @param[in] bookmark The handle to media bookmark
241  * @param[in] name     The name of media bookmark. Can be NULL, empty or non-empty string.
242  *
243  * @return @c 0 on success,
244  *         otherwise a negative error value
245  *
246  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
247  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
248  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
249  *
250  * @post media_bookmark_update_to_db()
251  */
252 int media_bookmark_set_name(media_bookmark_h bookmark, const char *name);
253
254 /**
255  * @brief Updates bookmark information to the media database.
256  * @details The function updates the given bookmark meta in the media database. \n
257  *          The function should be called after any change in bookmark attributes, to be updated to the media database. \n
258  *          For example, after using media_bookmark_set_name() for setting the name of the bookmark, \n
259  *          the media_bookmark_update_to_db() function should be called so as to update the given bookmark attributes in the media database.
260  * @since_tizen 4.0
261  *
262  * @privlevel public
263  * @privilege %http://tizen.org/privilege/content.write
264  *
265  * @remarks Do not call this function in callback function of foreach function like media_info_foreach_bookmark_from_db().
266  * @param[in] bookmark The handle to media bookmark
267  *
268  * @return @c 0 on success,
269  *         otherwise a negative error value
270  *
271  * @retval #MEDIA_CONTENT_ERROR_NONE                                    Successful
272  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER       Invalid parameter
273  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY           Out of memory
274  * @retval #MEDIA_CONTENT_ERROR_INVALID_OPERATION       Invalid operation
275  * @retval #MEDIA_CONTENT_ERROR_DB_FAILED                               DB Operation failed
276  * @retval #MEDIA_CONTENT_ERROR_DB_BUSY                         DB Operation busy
277  * @retval #MEDIA_CONTENT_ERROR_NETWORK                         Network fail
278  * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED       Permission denied when Application has no privilege
279  *
280  * @pre This function requires opened connection to content service by media_content_connect().
281  *
282  * @see media_content_connect()
283  * @see media_bookmark_set_name()
284  */
285 int media_bookmark_update_to_db(media_bookmark_h bookmark);
286
287 /**
288  * @}
289  */
290
291 #ifdef __cplusplus
292 }
293 #endif /* __cplusplus */
294 #endif /*__TIZEN_MEDIA_BOOKMARK_H__*/