47a30fe891ae3a300d1a2ad7851de35fb5979e76
[platform/core/api/media-content.git] / include_product / media_content_product.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 #ifndef __TIZEN_MEDIA_CONTENT_PRODUCT_H__
18 #define __TIZEN_MEDIA_CONTENT_PRODUCT_H__
19
20 #include <media_content_type_product.h>
21 #include <media_pvr.h>
22 #include <media_uhd.h>
23
24 #ifdef __cplusplus
25 extern "C" {
26 #endif /* __cplusplus */
27
28 /********** media_content **********/
29
30 int media_content_scan_folder_v2(const char *path, bool is_recursive, media_scan_completed_cb_v2 callback, void *user_data);
31
32
33 /********** media_info **********/
34
35 /**
36  * @brief Gets the extract_flag of media info.
37  * @since_tizen 2.3
38  *
39  * @remarks You must release @a title using free().
40  *
41  * @param[in] media         The media info handle
42  * @param[out] extract_flag  The extract_flag of the media info
43  *
44  * @return @c 0 on success,
45  *         otherwise a negative error value
46  *
47  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
48  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
49  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
50  * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
51  */
52 int media_info_get_extract_flag(media_info_h media, int *extract_flag);
53 int media_info_get_stitched_state(media_info_h media, int *type_360);
54 int media_info_get_stitched_engine(media_info_h media, int *type_360);
55 /**
56  * @brief Gets the content's played position parameter.
57  * @details Function returns content's elapsed playback position parameter as period
58  * starting from the beginning of the track.
59  *
60  * @param[in] media The handle to media info
61  * @param[out] played_position The elapsed time of the content
62  * @return 0 on success, otherwise a negative error value.
63  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
64  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
65  */
66 int media_info_get_played_position(media_info_h media, int *played_position);
67 /**
68  * @brief Gets the provider to media info.
69  *
70  * @remarks @a modified_month should be released with free() by you.
71  *
72  * @param[in] media The handle to media info
73  * @param[out] category The modified month of media info
74  * @return 0 on success, otherwise a negative error value.
75  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
76  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
77  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
78  *
79  */
80 int media_info_get_modified_month(media_info_h media, char **modified_month);
81
82 /**
83  * @brief Gets the played count to content meta handle.
84  *
85  * @param[in] media The handle to media info
86  * @param[out] played_count The played count of content
87  * @return 0 on success, otherwise a negative error value.
88  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
89  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
90  */
91 int media_info_get_played_count(media_info_h media, int *played_count);
92
93 /**
94  * @brief Sets the played count to content meta handle.
95  *
96  * @param[in] media The handle to media info
97  * @param[in] played_count The played count of content
98  * @return 0 on success, otherwise a negative error value.
99  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
100  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
101  * @post media_info_update_to_db()
102  */
103 int media_info_set_played_count(media_info_h media, int played_count);
104
105 /**
106  * @brief Sets the played position to content meta handle.
107  *
108  * @param[in] media The handle to media info
109  * @param[in] played_position The played position of content
110  * @return 0 on success, otherwise a negative error value.
111  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
112  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
113  * @post media_info_update_to_db()
114  */
115 int media_info_set_played_position(media_info_h media, int played_position);
116
117 /**
118  * @brief Gets the content's played time parameter.
119  * @details Function returns content's elapsed playback time parameter as period
120  *          starting from the beginning of the track.
121  *
122  * @param[in] media The handle to the media info
123  * @param[out] played_time The elapsed time of the content
124  *
125  * @return 0 on success,
126  *         otherwise a negative error value
127  *
128  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
129  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
130  */
131 int media_info_get_played_time(media_info_h media, time_t *played_time);
132
133 /**
134  * @brief Sets the played time to content meta handle.
135  * @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.
136  *
137  * @param[in] media The handle to the media info
138  *
139  * @return 0 on success,
140  *         otherwise a negative error value
141  *
142  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
143  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
144  *
145  * @post media_info_update_to_db()
146  */
147 int media_info_set_played_time(media_info_h media);
148
149
150 int media_info_get_media_info_by_path_from_db(const char* path, media_info_h* media);
151
152
153 /********** media_folder **********/
154 int media_folder_get_scan_status(const char *storage_uuid, char* path, media_folder_scan_status_e *scan_status);
155 int media_folder_reset_scan_status(const char *storage_uuid, const char* path);
156
157 /**
158  * @brief Sets the folder name.
159  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
160  *
161  * @param[in] folder The handle to the media folder
162  * @param[in] name The name of the media folder
163  *
164  * @return @c 0 on success,
165  *         otherwise a negative error value
166  *
167  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
168  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
169  * @retval #MEDIA_CONTENT_ERROR_INVALID_OPERATION Invalid operation
170  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
171  */
172 int media_folder_set_name(media_folder_h folder, const char *name);
173
174 /**
175  * @brief Updates the media folder to the media database.
176  *
177  * @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
178  *          database.
179  *
180  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
181  *
182  * @privlevel public
183  * @privilege %http://tizen.org/privilege/content.write
184  *
185  * @param[in] folder The handle to the media folder
186  *
187  * @return @c 0 on success,
188  *         otherwise a negative error value
189  *
190  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
191  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
192  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
193  * @retval #MEDIA_CONTENT_ERROR_INVALID_OPERATION Invalid operation
194  * @retval #MEDIA_CONTENT_ERROR_DB_FAILED         DB Operation failed
195  * @retval #MEDIA_CONTENT_ERROR_DB_BUSY           DB Operation busy
196  * @retval #MEDIA_CONTENT_ERROR_NETWORK           Network fail
197  * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
198  *
199  * @pre This function requires opened connection to content service by media_content_connect().
200  *
201  * @see media_content_connect()
202  * @see media_folder_destroy()
203  */
204 int media_folder_update_to_db(media_folder_h folder);
205
206 /**
207  * @brief insert media folder into database by folder path
208  * @since_tizen 4.0
209  *
210  * @param[in] folder path
211  *
212  * @return @c 0 on success,
213  *         otherwise a negative error value
214  *
215  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
216  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
217  */
218 int media_folder_insert_to_db(const char *path);
219
220 /********** media_group **********/
221
222  /**
223  * @brief Iterates through the media group with optional @a filter from the media database.
224  * @details This function gets the names and counts of media group meeting the given filter.
225  * The callback function will be invoked for every retrieved media group.
226  * If NULL is passed to the filter, no filtering is applied.
227  *
228  * @param[in] filter The handle to media filter
229  * @param[in] group The type of media group
230  * @param[in] callback The callback function to invoke
231  * @param[in] user_data The user data to be passed to the callback function
232  * @return 0 on success, otherwise a negative error value.
233  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
234  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
235  * @pre This function requires opened connection to content service by media_content_connect().
236  * @post This function invokes media_group_cb().
237  * @see #media_group_and_count_cb
238  * @see media_content_connect()
239  * @see media_filter_create()
240  */
241 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);
242
243
244 /********** media_storage **********/
245
246 /**
247  * @brief Gets the storage scan status of media storage.
248  * @since_tizen 2.4
249  *
250  * @param[in] storage The media storage handle
251  * @param[out] scan_status  The storage type of the media storage
252  *
253  * @return @c 0 on success,
254  *         otherwise a negative error value
255  *
256  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
257  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
258  */
259 int media_storage_get_scan_status(const char *storage_uuid, media_storage_scan_status_e *scan_status);
260
261
262 #ifdef __cplusplus
263 }
264 #endif /* __cplusplus */
265
266 #endif /* __TIZEN_MEDIA_CONTENT_PRODUCT_H__ */