1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
|
/*
* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef __TIZEN_MEDIA_FOLDER_H__
#define __TIZEN_MEDIA_FOLDER_H__
#include <media_content_type.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/**
* @addtogroup CAPI_CONTENT_MEDIA_FOLDER_MODULE
* @{
*/
/**
* @brief Gets the number of folder for the passed @a filter from the media database.
*
* @param[in] filter The handle to filter. \n To allow searching over different content types, you should use @a filter_h.
* @param[out] folder_count The count of media folder
* @return 0 on success, otherwise a negative error value.
* @retval #MEDIA_CONTENT_ERROR_NONE Successful
* @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB operation failed
* @pre This function requires opened connection to content service by media_content_connect().
* @see media_content_connect()
*
*/
int media_folder_get_folder_count_from_db(filter_h filter, int *folder_count);
/**
* @brief Iterates through available media folders with optional @a filter from the media database.
* @details This function gets media folder handles meeting the given
* @a filter. The @a callback function will be invoked for every retrieved
* folder. If NULL is passed to the @a filter, no filtering is applied.
*
* @param[in] filter The handle to media folder filter
* @param[in] callback The callback function to invoke
* @param[in] user_data The user data to be passed to the callback function
* @return return 0 on success, otherwise a negative error value.
* @retval #MEDIA_CONTENT_ERROR_NONE Successful
* @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
* @pre This function requires opened connection to content service by media_content_connect().
* @pre A filter handle has to be created by calling media_folder_filter_create()
* @post This function invokes media_folder_cb()
* @see media_content_connect()
* @see #media_folder_cb
* @see media_filter_create()
*/
int media_folder_foreach_folder_from_db(filter_h filter, media_folder_cb callback, void *user_data);
/**
* @brief Gets the number of media files for the passed @a filter in the given @a folder from the media database.
*
* @param[in] folder_id The ID of media folder
* @param[in] filter The filter of media content
* @param[out] media_count The count of media folder items
* @return 0 on success, otherwise a negative error value.
* @retval #MEDIA_CONTENT_ERROR_NONE Successful
* @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB operation failed
* @pre This function requires opened connection to content service by media_content_connect().
* @see media_content_connect()
*
*/
int media_folder_get_media_count_from_db(const char *folder_id, filter_h filter, int *media_count);
/**
* @brief Iterates through the media files with optional @a filter in the given @a folder from the media database.
* @details This function gets all media files associated with the given folder and
* meeting desired filter option and calls registered callback function for
* every retrieved media item. If NULL is passed to the @a filter, no filtering is applied.
*
* @param[in] folder_id The ID of media folder
* @param[in] filter The handle to media info filter
* @param[in] callback The callback function to invoke
* @param[in] user_data The user data to be passed to the callback function
* @return 0 on success, otherwise a negative error value.
* @retval #MEDIA_CONTENT_ERROR_NONE Successful
* @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
* @pre This function requires opened connection to content service by media_content_connect().
* @post This function invokes media_info_cb()
* @see #media_info_cb
* @see media_content_connect()
* @see media_folder_filter_create()
*/
int media_folder_foreach_media_from_db(const char *folder_id, filter_h filter, media_info_cb callback, void *user_data);
/**
* @brief Clones the media folder.
* @details This function copies the media folder handle from a source to
* destination. There is no media_folder_create() function. The media_folder_h is created internally and available through
* media folder foreach function such as media_folder_foreach_folder_from_db(). To use this handle outside of these foreach functions,
* use this function.
* @remark The destination handle must be released with media_folder_destroy() by you.
* @param[out] dst A destination handle to media folder
* @param[in] src The source handle to media folder
* @return 0 on success, otherwise a negative error value.
* @retval #MEDIA_CONTENT_ERROR_NONE Successful
* @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
* @see media_folder_destroy()
* @see media_folder_foreach_folder_from_db()
*/
int media_folder_clone(media_folder_h *dst, media_folder_h src);
/**
* @brief Destroys the media folder.
* @details The function frees all resources related to the folder handle. This handle
* no longer can be used to perform any operation. A new handle has to
* be created before the next use.
*
* @param[in] folder The handle to media folder
* @return 0 on success, otherwise a negative error value.
* @retval #MEDIA_CONTENT_ERROR_NONE Successful
* @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
* @pre A copy of the media folder handle created by calling media_folder_clone()
* @see media_folder_clone()
*/
int media_folder_destroy(media_folder_h folder);
/**
* @brief Gets media folder's ID.
*
* @remarks @a folder_id must be released with free() by you.
*
* @param [in] folder The handle to media folder
* @param [out] folder_id The ID of media folder
* @return 0 on success, otherwise a negative error value.
* @retval #MEDIA_CONTENT_ERROR_NONE Successful
* @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
*/
int media_folder_get_folder_id(media_folder_h folder, char **folder_id);
/**
* @brief Gets the absolute path to the folder.
*
* @remarks @a path must be released with free() by you.
*
* @param[in] folder The handle to media folder
* @param[out] path The path of the media folder
* @return 0 on success, otherwise a negative error value.
* @retval #MEDIA_CONTENT_ERROR_NONE Successful
* @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
*
*/
int media_folder_get_path(media_folder_h folder, char **path);
/**
* @brief Gets the folder name.
*
* @remarks @a folder_name must be released with free() by you.
*
* @param[in] folder The handle to media folder
* @param[out] folder_name The name of the media folder
* @return 0 on success, otherwise a negative error value.
* @retval #MEDIA_CONTENT_ERROR_NONE Successful
* @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
*
*/
int media_folder_get_name(media_folder_h folder, char **folder_name);
/**
* @brief Gets the modified date of the folder.
*
* @param[in] folder The handle to media folder
* @param[out] date The modified date of folder
* @return 0 on success, otherwise a negative error value.
* @retval #MEDIA_CONTENT_ERROR_NONE Successful
* @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
*
*/
int media_folder_get_modified_time(media_folder_h folder, time_t *date);
/**
* @brief Gets the folder storage type.
*
* @param[in] folder The handle to media folder
* @param[out] storage_type The storage type of the media folder
* @return 0 on success, otherwise a negative error value.
* @retval #MEDIA_CONTENT_ERROR_NONE Successful
* @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
*
*/
int media_folder_get_storage_type(media_folder_h folder, media_content_storage_e *storage_type);
/**
* @brief Gets the media folder from the media database.
*
* @details This function creates a new media folder handle from the media database by the given folder_id.
* media folder will be created, which is filled with folder information.
*
* @remarks @a folder must be released with media_folder_destroy() by you.
*
* @param[in] folder_id The ID of media folder
* @param[out] folder The media folder handle associated with the folder ID
* @return 0 on success, otherwise a negative error value.
* @retval #MEDIA_CONTENT_ERROR_NONE Successful
* @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
* @pre This function requires opened connection to content service by media_content_connect().
* @see media_content_connect()
* @see media_folder_destroy()
*
*/
int media_folder_get_folder_from_db(const char *folder_id, media_folder_h *folder);
/**
* @brief Updates the media folder to the media database.
*
* @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
* database. For example, after using media_folder_set_name() for setting the name of the folder, media_folder_update_to_db() function should be called so as to update
* the given folder attibutes in the media database.
*
* @param[in] folder The handle to media folder
* @return 0 on success, otherwise a negative error value.
* @retval #MEDIA_CONTENT_ERROR_NONE Successful
* @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
* @pre This function requires opened connection to content service by media_content_connect().
* @see media_content_connect()
* @see media_folder_destroy()
* @see media_folder_set_name()
*
*/
int media_folder_update_to_db(media_folder_h folder);
/**
* @brief Sets the folder name.
*
* @param[in] folder The handle to media folder
* @param[in] name The name of the media folder
* @return 0 on success, otherwise a negative error value.
* @retval #MEDIA_CONTENT_ERROR_NONE Successful
* @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
* @post media_folder_update_to_db()
*
*/
int media_folder_set_name(media_folder_h folder, const char *name);
/**
* @}
*/
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __TIZEN_MEDIA_FOLDER_H__ */
|