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_FILTER_H__
20 #define __TIZEN_CONTENT_MEDIA_FILTER_H__
22 #include <media_content_type.h>
27 #endif /* __cplusplus */
30 * @file media_filter.h
31 * @brief This file contains the media filter API and related operation with filters. \n
32 * The functions include: creating and destroying media filter handles that are used to get the filtered information, \n
33 * making free all resources related to the filter handle, limiting number of items returned, setting conditions for the filter, \n
34 * setting and getting media filter's content order and ordering keyword either descending or ascending.
38 * @addtogroup CAPI_CONTENT_MEDIA_FILTER_MODULE
43 * @brief Creates a media filter handle.
44 * @details This function creates a media filter handle. The handle can be
45 * used to get the filtered information based on filter properties i.e. offset, count, condition for searching and order.
47 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
49 * @remarks The @a filter should be released using media_info_filter_destroy().
51 * @param[out] filter The handle to the media filter
53 * @return @c 0 on success,
54 * otherwise a negative error value
56 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
57 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
58 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
60 * @see media_filter_destroy()
62 int media_filter_create(filter_h *filter);
65 * @brief Destroys a media filter handle.
66 * @details The function frees all resources related to the media filter handle. The filter
67 * handle no longer can be used to perform any operations. A new filter handle
68 * has to be created before the next usage.
70 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
72 * @param[in] filter The handle to the media filter
74 * @return @c 0 on success,
75 * otherwise a negative error value
77 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
78 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
80 * @see media_filter_create()
82 int media_filter_destroy(filter_h filter);
85 * @brief Sets the media filter offset and count.
86 * @details This function sets the @a offset and @a count for the given filter used to limit number of items returned.
87 * For example, if you set the @a offset as @c 10 and @a count as @c 5, then only searched data from @c 10 to @c 14 will be returned when the filter is used with foreach functions.
89 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
91 * @param[in] filter The handle to the media filter
92 * @param[in] offset The start position of the given media filter (Starting from zero)
93 * @param[in] count The number of items to be searched with respect to the offset
95 * @return @c 0 on success,
96 * otherwise a negative error value
98 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
99 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
101 * @see media_filter_create()
102 * @see media_filter_destroy()
104 int media_filter_set_offset(filter_h filter, int offset, int count);
107 * @brief Sets the @a condition for the given @a filter.
108 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
110 * @param[in] filter The handle to the media filter
111 * @param[in] condition The condition which is used WHERE clause on a query
112 * @param[in] collate_type The collate type for comparing two strings
114 * @return @c 0 on success,
115 * otherwise a negative error value
117 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
118 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
119 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
121 * @see media_filter_create()
122 * @see media_filter_destroy()
124 int media_filter_set_condition(filter_h filter, const char *condition, media_content_collation_e collate_type);
127 * @brief Sets the media filter content @a order_type and @a order_keyword i.e. either descending or ascending.
128 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
130 * @remarks If @a order_type set to #MEDIA_CONTENT_ORDER_OTHER, media_filter sorts by referring only to the value of @a order_keyword. \n
131 * Therefore, @a order_keyword must include collation type and order type. \n
132 * e.g. MEDIA_DISPLAY_NAME COLLATE NOCASE DESC, MEDIA_MODIFIED_TIME DESC
134 * @param[in] filter The handle to the media filter
135 * @param[in] order_type The search order type
136 * @param[in] order_keyword The search order keyword
137 * @param[in] collate_type The collate type for comparing two strings
139 * @return @c 0 on success,
140 * otherwise a negative error value
142 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
143 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
145 * @see media_filter_create()
146 * @see media_filter_destroy()
148 int media_filter_set_order(filter_h filter, media_content_order_e order_type, const char *order_keyword, media_content_collation_e collate_type);
151 * @deprecated Deprecated since 5.0. Use media_filter_set_condition() with MEDIA_PATH keyword instead. \n
152 * See @ref CAPI_SYSTEM_STORAGE_MODULE for information about file system paths.
154 * @brief Sets the @a storage_id for the given @a filter.
155 * @details You can use this function when you want to search items only in the specific storage
157 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
159 * @param[in] filter The handle to the media filter
160 * @param[in] storage_id The ID of the media storage
162 * @return @c 0 on success,
163 * otherwise a negative error value
165 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
166 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
167 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
169 * @see media_filter_create()
170 * @see media_filter_destroy()
172 int media_filter_set_storage(filter_h filter, const char *storage_id) TIZEN_DEPRECATED_API;
175 * @brief Gets the @a offset and @a count for the given @a filter used to limit the number of items returned.
176 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
178 * @param[in] filter The handle to the media filter
179 * @param[out] offset The start position of the given media filter (Starting from zero)
180 * @param[out] count The number of items to be searched with respect to the offset
182 * @return @c 0 on success,
183 * otherwise a negative error value
185 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
186 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
188 * @see media_filter_create()
189 * @see media_filter_destroy()
191 int media_filter_get_offset(filter_h filter, int *offset, int *count);
194 * @brief Gets the @a condition for the given @a filter.
195 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
197 * @remarks The @a condition should be released using free().
199 * @param[in] filter The handle to the media filter
200 * @param[out] condition The condition which is used WHERE clause on a query
201 * @param[out] collate_type The collate type for comparing two strings
203 * @return @c 0 on success,
204 * otherwise a negative error value
206 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
207 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
208 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
210 * @see media_filter_create()
211 * @see media_filter_destroy()
213 int media_filter_get_condition(filter_h filter, char **condition, media_content_collation_e *collate_type);
216 * @brief Gets the media filter's content @a order_type and @a order_keyword i.e. either descending or ascending.
217 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
219 * @remarks The @a order_keyword should be released using free().
221 * @param[in] filter The handle to the media filter
222 * @param[out] order_type The search order type
223 * @param[out] order_keyword The search order keyword
224 * @param[out] collate_type The collate type for comparing two strings
226 * @return @c 0 on success,
227 * otherwise a negative error value
229 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
230 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
232 * @see media_filter_create()
233 * @see media_filter_destroy()
235 int media_filter_get_order(filter_h filter, media_content_order_e *order_type, char **order_keyword, media_content_collation_e *collate_type);
238 * @deprecated Deprecated since 5.0.
239 * @brief Gets the @a storage_id for given @a filter.
240 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
242 * @remarks The @a storage_id should be released using free().
244 * @param[in] filter The handle to the media filter
245 * @param[out] storage_id The ID of the media storage
247 * @return @c 0 on success,
248 * otherwise a negative error value
250 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
251 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
253 * @see media_filter_create()
254 * @see media_filter_destroy()
256 int media_filter_get_storage(filter_h filter, char **storage_id) TIZEN_DEPRECATED_API;
264 #endif /* __cplusplus */
266 #endif /* __TIZEN_CONTENT_MEDIA_FILTER_H__ */