+
+int media_filter_set_condition_v2(filter_h filter, const char *condition)
+{
+ int ret = MEDIA_CONTENT_ERROR_NONE;
+ filter_s *_filter = (filter_s*)filter;
+
+ if ((_filter != NULL) && STRING_VALID(condition)) {
+ _filter->is_full_condition = true;
+
+ if (STRING_VALID(_filter->condition))
+ SAFE_FREE(_filter->condition);
+
+ char new_condition[MAX_QUERY_SIZE] = {0, };
+ memset(new_condition, 0, sizeof(new_condition));
+ ret = _media_content_replace_path_in_condition(condition, new_condition, TRUE);
+ media_content_retvm_if(!STRING_VALID(new_condition), MEDIA_CONTENT_ERROR_INVALID_OPERATION, "path replacement failed");
+
+ _filter->condition = strdup(new_condition);
+ media_content_retvm_if(_filter->condition == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, "OUT_OF_MEMORY");
+
+ media_content_sec_debug("Condition string : %s", _filter->condition);
+ } else {
+ media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+ }
+
+ return ret;
+}
+
+int media_filter_get_condition_v2(filter_h filter, char **condition)
+{
+ int ret = MEDIA_CONTENT_ERROR_NONE;
+ filter_s *_filter = (filter_s*)filter;
+
+ if (_filter) {
+ if (STRING_VALID(_filter->condition) && _filter->is_full_condition == true) {
+ char new_condition[MAX_QUERY_SIZE] = {0, };
+ memset(new_condition, 0, sizeof(new_condition));
+ ret = _media_content_replace_path_in_condition(_filter->condition, new_condition, FALSE);
+ media_content_retvm_if(!STRING_VALID(new_condition), MEDIA_CONTENT_ERROR_INVALID_OPERATION, "path replacement failed");
+
+ *condition = strdup(new_condition);
+ media_content_retvm_if(*condition == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, "OUT_OF_MEMORY");
+ } else {
+ *condition = NULL;
+ }
+ } else {
+ media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+ }
+
+ return ret;
+}
+
+int media_filter_set_order_v2(filter_h filter, const char *order)
+{
+ int ret = MEDIA_CONTENT_ERROR_NONE;
+ filter_s *_filter = (filter_s*)filter;
+
+ if ((_filter != NULL) && STRING_VALID(order)) {
+ _filter->is_full_order = true;
+
+ SAFE_FREE(_filter->order_keyword);
+
+ _filter->order_keyword = strdup(order);
+ media_content_retvm_if(_filter->order_keyword == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, "OUT_OF_MEMORY");
+ } else {
+ media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+ }
+
+ return ret;
+}
+
+int media_filter_get_order_v2(filter_h filter, char **order)
+{
+ int ret = MEDIA_CONTENT_ERROR_NONE;
+ filter_s *_filter = (filter_s*)filter;
+
+ if (_filter) {
+ if (STRING_VALID(_filter->order_keyword) && _filter->is_full_order == true) {
+ *order = strdup(_filter->order_keyword);
+ media_content_retvm_if(*order == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, "OUT_OF_MEMORY");
+ } else {
+ *order = NULL;
+ }
+ } else {
+ media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+ }
+
+ return ret;
+}
+