92234012aa8dbaa76127aac67ab014a81d8be009
[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 2.3
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_PERMISSION_DENIED Permission denied
58  *
59  * @pre This function requires opened connection to content service by media_content_connect().
60  *
61  * @see media_content_connect()
62  * @see media_bookmark_delete_from_db()
63  */
64 int media_bookmark_insert_to_db(const char *media_id, time_t time, const char *thumbnail_path);
65
66 /**
67  * @brief Removes a media bookmark from the media database.
68  * @since_tizen 2.3
69  *
70  * @privlevel public
71  * @privilege %http://tizen.org/privilege/content.write
72  *
73  * @param[in] bookmark_id The ID of media bookmark
74  *
75  * @return @c 0 on success,
76  *         otherwise a negative error value
77  *
78  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
79  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
80  * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
81  *
82  * @pre This function requires opened connection to content service by media_content_connect().
83  *
84  * @see media_content_connect()
85  * @see media_bookmark_insert_to_db()
86  */
87 int media_bookmark_delete_from_db(int bookmark_id);
88
89 /**
90  * @brief Gets the number of bookmarks with an optional filter from the media database.
91  * @since_tizen 2.3
92  *
93  * @param[in]  filter         The handle to the media filter
94  * @param[out] bookmark_count The count of the media bookmark
95  *
96  * @return @c 0 on success,
97  *         otherwise a negative error value
98  *
99  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
100  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
101  * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
102  *
103  * @pre This function requires opened connection to content service by media_content_connect().
104  *
105  * @see media_content_connect()
106  */
107 int media_bookmark_get_bookmark_count_from_db(filter_h filter, int *bookmark_count);
108
109 /**
110  * @brief Clones a media bookmark.
111  * @details This function copies the media bookmark handle from a source to destination. There is no media_bookmark_create() function.
112  *          The media_bookmark_h is created internally and available through media bookmark foreach function such as media_info_foreach_bookmark_from_db().
113  *          To use this handle outside of these foreach functions, use this function.
114  *
115  * @since_tizen 2.3
116  *
117  * @remarks The destination handle must be released using media_bookmark_destroy().
118  *
119  * @param[out] dst The destination handle to media bookmark
120  * @param[in]  src The source handle to media bookmark
121  *
122  * @return @c 0 on success,
123  *         otherwise a negative error value
124  *
125  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
126  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
127  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
128  * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
129  *
130  * @see media_bookmark_destroy()
131  * @see media_info_foreach_bookmark_from_db()
132  */
133 int media_bookmark_clone(media_bookmark_h *dst, media_bookmark_h src);
134
135 /**
136  * @brief Destroys a media bookmark.
137  * @details This function frees all the resources related to the bookmark handle. This handle
138  *          no longer can be used to perform any operation. A new handle has to
139  *          be created before the next use.
140  *
141  * @since_tizen 2.3
142  *
143  * @param[in] bookmark The handle to media bookmark
144  *
145  * @return @c 0 on success,
146  *         otherwise a negative error value
147  *
148  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
149  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
150  * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
151  *
152  * @pre Get copy of bookmark handle by calling media_bookmark_clone().
153  *
154  * @see media_bookmark_clone()
155  */
156 int media_bookmark_destroy(media_bookmark_h bookmark);
157
158 /**
159  * @brief Gets the bookmark ID.
160  * @since_tizen 2.3
161  *
162  * @param[in]  bookmark    The handle to media bookmark
163  * @param[out] bookmark_id The media bookmark ID
164  *
165  * @return @c 0 on success,
166  *         otherwise a negative error value
167  *
168  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
169  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
170  * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
171  */
172 int media_bookmark_get_bookmark_id(media_bookmark_h bookmark, int *bookmark_id);
173
174 /**
175  * @brief Gets the bookmark time marked parameter.
176  * @details This function returns time offset in milliseconds from beginning of the movie on which bookmark
177  *          was placed.
178  *
179  * @since_tizen 2.3
180  *
181  * @param[in]  bookmark    The handle to media bookmark
182  * @param[out] marked_time The bookmark time offset (in milliseconds)
183  *
184  * @return @c 0 on success,
185  *         otherwise a negative error value
186  *
187  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
188  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
189  * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
190  */
191 int media_bookmark_get_marked_time(media_bookmark_h bookmark, time_t *marked_time);
192
193 /**
194  * @brief Gets the media bookmark thumbnail.
195  * @since_tizen 2.3
196  *
197  * @remarks You must release @a path using free().
198  *
199  * @param[in]  bookmark The handle to media bookmark
200  * @param[out] path     The thumbnail path of media bookmark
201  *
202  * @return @c 0 on success,
203  *         otherwise a negative error value
204  *
205  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
206  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
207  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
208  * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
209  */
210 int media_bookmark_get_thumbnail_path(media_bookmark_h bookmark, char **path);
211
212
213 /**
214  * @}
215  */
216
217 #ifdef __cplusplus
218 }
219 #endif /* __cplusplus */
220 #endif /*__TIZEN_MEDIA_BOOKMARK_H__*/