#include <media_info_private.h>
+#include <media_util_private.h>
#include <vconf.h>
static const char *media_token[] = {
char *str;
} token_t;
-
-#define MAX_LEFT_VALUE 512
-#define SPACE_LEN 1
-#define SPACE " "
#define UNKNOWN_TYPE 1000
#define STRING_TYPE 100
static void __filter_attribute_free_value(gpointer key, gpointer value, gpointer user_data)
{
- SAFE_FREE(key);
- SAFE_FREE(value);
+ SAFE_G_FREE(key);
+ SAFE_G_FREE(value);
}
static char *__media_filter_replace_attr(attribute_h attr, char *name)
media_content_retvm_if(_attr == NULL, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "invalid attr");
if (STRING_VALID(user_attr) && STRING_VALID(platform_attr)) {
- _user = strdup(user_attr);
+ _user = g_strdup(user_attr);
media_content_retvm_if(_user == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, "OUT_OF_MEMORY");
- _platform = strdup(platform_attr);
+ _platform = g_strdup(platform_attr);
if (_platform == NULL) {
- SAFE_FREE(_user);
+ SAFE_G_FREE(_user);
media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
}
return ret;
}
-int _media_filter_attribute_generate(attribute_h attr, char *condition, media_content_collation_e collate_type, char **generated_condition)
+int _media_filter_attribute_generate(attribute_h attr, filter_h filter, char **generated_condition)
{
unsigned int idx = 0;
GList *token_list = NULL;
- int size = 0;
int ret = MEDIA_CONTENT_ERROR_NONE;
- int total_str_size = 0;
token_t *token;
+ filter_s *_filter = NULL;
+ char tmp_condition[MAX_QUERY_SIZE] = {0, };
- media_content_retvm_if(condition == NULL, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "invalid condition");
- media_content_retvm_if(generated_condition == NULL, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "invalid generated_condition");
media_content_retvm_if(attr == NULL, MEDIA_CONTENT_ERROR_DB_FAILED, "DB field mapping table doesn't exist. Check db connection");
+ media_content_retvm_if(filter == NULL, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "invalid filter");
+ media_content_retvm_if(generated_condition == NULL, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "invalid generated_condition");
- if (__tokenize(&token_list, condition) < 0) {
+ _filter = (filter_s*)filter;
+
+ media_content_retvm_if(_filter->condition == NULL, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "invalid condition");
+ media_content_retvm_if(_filter->condition_collate_type < MEDIA_CONTENT_COLLATE_DEFAULT ||
+ _filter->condition_collate_type > MEDIA_CONTENT_COLLATE_LOCALIZED, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "invalid condition collate");
+
+ if (__tokenize(&token_list, _filter->condition) < 0) {
media_content_error("INVALID_PARAMETER(0x%08x):Invalid the condition", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
}
for (idx = 0; idx < g_list_length(token_list); idx++) {
token = (token_t*)g_list_nth_data(token_list, idx);
- if (token->type == UNKNOWN_TYPE) {
+ if ((token != NULL) && (token->type == UNKNOWN_TYPE)) {
char *replace_str = __media_filter_replace_attr(attr, token->str);
if (STRING_VALID(replace_str)) {
SAFE_FREE(token->str);
token->str = replace_str;
+ } else {
+ SAFE_FREE(replace_str);
}
}
-
- total_str_size += strlen(token->str)+1;
- /* media_content_debug("[%d][type:%d]:%s", idx, token->type, token->str); */
}
/* make the statment */
- size = total_str_size + COLLATE_STR_SIZE + 1;
- *generated_condition = (char*)calloc(size, sizeof(char));
+ memset(tmp_condition, 0, sizeof(tmp_condition));
+ SAFE_STRLCAT(tmp_condition, QUERY_KEYWORD_OPEN_BRACKET, sizeof(tmp_condition));
for (idx = 0; idx < g_list_length(token_list); idx++) {
token = (token_t*)g_list_nth_data(token_list, idx);
if ((token != NULL) && STRING_VALID(token->str)) {
- SAFE_STRLCAT(*generated_condition, token->str, size);
- SAFE_STRLCAT(*generated_condition, SPACE, size);
+ SAFE_STRLCAT(tmp_condition, token->str, sizeof(tmp_condition));
+ SAFE_STRLCAT(tmp_condition, QUERY_KEYWORD_SPACE, sizeof(tmp_condition));
SAFE_FREE(token->str);
SAFE_FREE(token);
}
}
- if (collate_type == MEDIA_CONTENT_COLLATE_NOCASE || collate_type == MEDIA_CONTENT_COLLATE_RTRIM || collate_type == MEDIA_CONTENT_COLLATE_LOCALIZED) {
- SAFE_STRLCAT(*generated_condition, "COLLATE ", size);
- SAFE_STRLCAT(*generated_condition, __get_collate_str(collate_type), size);
- SAFE_STRLCAT(*generated_condition, SPACE, size);
+ /* Process for filter v1 */
+ if (_filter->is_full_condition == false && _filter->condition_collate_type != MEDIA_CONTENT_COLLATE_DEFAULT) {
+ SAFE_STRLCAT(tmp_condition, QUERY_KEYWORD_COLLATE, sizeof(tmp_condition));
+ SAFE_STRLCAT(tmp_condition, __get_collate_str(_filter->condition_collate_type), sizeof(tmp_condition));
+ SAFE_STRLCAT(tmp_condition, QUERY_KEYWORD_SPACE, sizeof(tmp_condition));
}
- /* media_content_debug("statement : %s(%d) (total:%d)", *generated_condition, strlen(*generated_condition), total_str_size); */
- media_content_sec_debug("Condition : %s", *generated_condition);
+ SAFE_STRLCAT(tmp_condition, QUERY_KEYWORD_BRACKET, sizeof(tmp_condition));
- /* if(*generated_condition != NULL)
- res = 1; */
+ if (STRING_VALID(tmp_condition))
+ *generated_condition = g_strdup(tmp_condition);
+ else
+ *generated_condition = NULL;
- if (token_list != NULL)
+ media_content_sec_debug("Condition : %s", *generated_condition);
+
+ if (token_list != NULL) {
g_list_free(token_list);
+ token_list = NULL;
+ }
return ret;
}
{
int ret = MEDIA_CONTENT_ERROR_NONE;
filter_s *_filter = NULL;
- char option_query[DEFAULT_QUERY_SIZE] = {0, };
- char condition[DEFAULT_QUERY_SIZE] = {0, };
- int size = 0;
+ char query[DEFAULT_QUERY_SIZE] = {0, };
+ char option[DEFAULT_QUERY_SIZE] = {0, };
media_content_retvm_if(attr == NULL, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "invalid attr");
media_content_retvm_if(filter == NULL, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "invalid filter");
_filter = (filter_s*)filter;
- memset(option_query, 0x00, sizeof(option_query));
+ memset(query, 0x00, sizeof(query));
/* Order by*/
- if (STRING_VALID(_filter->order_keyword) && ((_filter->order_type == MEDIA_CONTENT_ORDER_ASC) || (_filter->order_type == MEDIA_CONTENT_ORDER_DESC))) {
- unsigned int idx = 0;
- int total_str_size = 0;
- GList *token_list = NULL;
- token_t *token;
- char *attr_str;
+ if (STRING_VALID(_filter->order_keyword)) {
+ if ((_filter->order_type == MEDIA_CONTENT_ORDER_ASC) || (_filter->order_type == MEDIA_CONTENT_ORDER_DESC)) {
+ unsigned int idx = 0;
+ GList *token_list = NULL;
+ token_t *token;
+ char *attr_str;
+
+ if (__tokenize_attribute(&token_list, _filter->order_keyword) < 0) {
+ media_content_error("INVALID_PARAMETER(0x%08x):Invalid the condition", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+ return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+ }
+
+ for (idx = 0; idx < g_list_length(token_list); idx++) {
+ token = (token_t*)g_list_nth_data(token_list, idx);
+
+ if ((token != NULL) && (token->type == UNKNOWN_TYPE)) {
+ char *replace_str = __media_filter_replace_attr(attr, token->str);
+ if (STRING_VALID(replace_str)) {
+ attr_str = (char*)calloc(strlen(replace_str) + COLLATE_STR_SIZE + 1, sizeof(char));
+ if (attr_str == NULL) {
+ media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+ SAFE_FREE(replace_str);
+ continue;
+ }
+
+ if (_filter->order_collate_type == MEDIA_CONTENT_COLLATE_NOCASE || _filter->order_collate_type == MEDIA_CONTENT_COLLATE_RTRIM || _filter->order_collate_type == MEDIA_CONTENT_COLLATE_LOCALIZED)
+ snprintf(attr_str, strlen(replace_str) + COLLATE_STR_SIZE + 1, "%s COLLATE %s %s", replace_str, __get_collate_str(_filter->order_collate_type), __get_order_str(_filter->order_type));
+ else
+ snprintf(attr_str, strlen(replace_str) + COLLATE_STR_SIZE + 1, "%s %s", replace_str, __get_order_str(_filter->order_type));
+
+ SAFE_FREE(token->str);
+ token->str = attr_str;
+ SAFE_FREE(replace_str);
+ } else {
+ media_content_error("There is no matched db field for %s", token->str);
+ SAFE_FREE(replace_str);
+ }
+ }
+ }
+
+ /* make the statment */
+ SAFE_STRLCAT(query, QUERY_KEYWORD_ORDER_BY, sizeof(query));
+
+ for (idx = 0; idx < g_list_length(token_list); idx++) {
+ token = (token_t*)g_list_nth_data(token_list, idx);
+
+ if ((token != NULL) && STRING_VALID(token->str)) {
+ SAFE_STRLCAT(query, token->str, sizeof(query));
+ SAFE_STRLCAT(query, QUERY_KEYWORD_SPACE, sizeof(query));
+
+ SAFE_FREE(token->str);
+ SAFE_FREE(token);
+ }
+ }
+
+ if (token_list != NULL) {
+ g_list_free(token_list);
+ token_list = NULL;
+ }
+ } else {
+ SAFE_STRLCAT(query, _filter->order_keyword, sizeof(query));
+ }
+ }
+
+ /* offset */
+ SAFE_STRLCAT(query, QUERY_KEYWORD_SPACE, sizeof(query));
+
+ memset(option, 0, sizeof(option));
+ snprintf(option, sizeof(option), "%s %d, %d", QUERY_KEYWORD_LIMIT, _filter->offset, _filter->count);
+ SAFE_STRLCAT(query, option, sizeof(query));
+
+ if (STRING_VALID(query)) {
+ *generated_option = g_strdup(query);
+ media_content_sec_debug("Option : %s", *generated_option);
+ } else {
+ *generated_option = NULL;
+ }
+
+ return ret;
+}
+
+int _media_filter_attribute_option_generate_with_full_query(attribute_h attr, filter_h filter, char **generated_option)
+{
+ unsigned int idx = 0;
+ GList *token_list = NULL;
+ int ret = MEDIA_CONTENT_ERROR_NONE;
+ token_t *token = NULL;
+ filter_s * _filter = NULL;
+ char query[DEFAULT_QUERY_SIZE] = {0, };
+ char option[DEFAULT_QUERY_SIZE] = {0, };
+
+ media_content_retvm_if(attr == NULL, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "invalid attr");
+ media_content_retvm_if(filter == NULL, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "invalid filter");
+ media_content_retvm_if(generated_option == NULL, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "invalid generated_option");
+
+ _filter = (filter_s*)filter;
+
+ memset(query, 0, sizeof(query));
+
+ /* Order by*/
+ if (STRING_VALID(_filter->order_keyword)) {
if (__tokenize_attribute(&token_list, _filter->order_keyword) < 0) {
- media_content_error("INVALID_PARAMETER(0x%08x):Invalid the condition", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+ media_content_error("INVALID_PARAMETER(0x%08x):Invalid the order", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
}
for (idx = 0; idx < g_list_length(token_list); idx++) {
token = (token_t*)g_list_nth_data(token_list, idx);
- if (token->type == UNKNOWN_TYPE) {
+ if ((token != NULL) && (token->type == UNKNOWN_TYPE)) {
char *replace_str = __media_filter_replace_attr(attr, token->str);
if (STRING_VALID(replace_str)) {
- attr_str = (char*)calloc(strlen(replace_str) + COLLATE_STR_SIZE + 1, sizeof(char));
- if (attr_str == NULL) {
- media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
- SAFE_FREE(replace_str);
- continue;
- }
-
- if (_filter->order_collate_type == MEDIA_CONTENT_COLLATE_NOCASE || _filter->order_collate_type == MEDIA_CONTENT_COLLATE_RTRIM || _filter->order_collate_type == MEDIA_CONTENT_COLLATE_LOCALIZED)
- snprintf(attr_str, strlen(replace_str) + COLLATE_STR_SIZE + 1, "%s COLLATE %s %s", replace_str, __get_collate_str(_filter->order_collate_type), __get_order_str(_filter->order_type));
- else
- snprintf(attr_str, strlen(replace_str) + COLLATE_STR_SIZE + 1, "%s %s", replace_str, __get_order_str(_filter->order_type));
-
SAFE_FREE(token->str);
- token->str = attr_str;
- SAFE_FREE(replace_str);
+ token->str = replace_str;
} else {
- media_content_error("There is no matched db field for %s", token->str);
+ SAFE_FREE(replace_str);
}
}
-
- total_str_size += strlen(token->str) + 1;
- /* media_content_debug("[%d][type:%d]:%s", idx, token->type, token->str); */
}
/* make the statment */
- char *generated_condition = NULL;
- size = total_str_size + COLLATE_STR_SIZE + 1;
- generated_condition = (char*)calloc(size, sizeof(char));
+ SAFE_STRLCAT(query, QUERY_KEYWORD_ORDER_BY, sizeof(query));
for (idx = 0; idx < g_list_length(token_list); idx++) {
token = (token_t*)g_list_nth_data(token_list, idx);
if ((token != NULL) && STRING_VALID(token->str)) {
- /* media_content_debug("[%d] %s", idx, token->str); */
- SAFE_STRLCAT(generated_condition, token->str, size);
- SAFE_STRLCAT(generated_condition, SPACE, size);
+ SAFE_STRLCAT(query, token->str, sizeof(query));
+ SAFE_STRLCAT(query, QUERY_KEYWORD_SPACE, sizeof(query));
SAFE_FREE(token->str);
SAFE_FREE(token);
}
}
- snprintf(condition, sizeof(condition), "ORDER BY %s", generated_condition);
- SAFE_STRLCAT(option_query, condition, sizeof(option_query));
-
- if (token_list != NULL)
+ if (token_list != NULL) {
g_list_free(token_list);
-
- SAFE_FREE(generated_condition);
+ token_list = NULL;
+ }
}
/* offset */
- SAFE_STRLCAT(option_query, SPACE, sizeof(option_query));
- snprintf(condition, sizeof(condition), "LIMIT %d, %d", _filter->offset, _filter->count);
- SAFE_STRLCAT(option_query, condition, sizeof(option_query));
+ SAFE_STRLCAT(query, QUERY_KEYWORD_SPACE, sizeof(query));
- if (STRING_VALID(option_query))
- *generated_option = strdup(option_query);
- else
+ memset(option, 0, sizeof(option));
+ snprintf(option, sizeof(option), "%s %d, %d", QUERY_KEYWORD_LIMIT, _filter->offset, _filter->count);
+ SAFE_STRLCAT(query, option, sizeof(query));
+
+ if (STRING_VALID(query)) {
+ *generated_option = g_strdup(query);
+ media_content_sec_debug("Option : %s", *generated_option);
+ } else {
*generated_option = NULL;
+ }
return ret;
}
+
int media_filter_create(filter_h *filter)
{
int ret = MEDIA_CONTENT_ERROR_NONE;
_filter->order_collate_type = MEDIA_CONTENT_COLLATE_DEFAULT;
_filter->offset = -1;
_filter->count = -1;
+ _filter->is_full_condition = false;
+ _filter->is_full_order = false;
*filter = (filter_h)_filter;
if ((_filter != NULL) && STRING_VALID(condition)
&& ((collate_type >= MEDIA_CONTENT_COLLATE_DEFAULT) && (collate_type <= MEDIA_CONTENT_COLLATE_LOCALIZED))) {
+
+ _filter->is_full_condition = false;
+
if (STRING_VALID(_filter->condition))
SAFE_FREE(_filter->condition);
- _filter->condition = strdup(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);
if ((_filter != NULL) && STRING_VALID(order_keyword)
&& ((order_type == MEDIA_CONTENT_ORDER_ASC) || (order_type == MEDIA_CONTENT_ORDER_DESC))
&& ((collate_type >= MEDIA_CONTENT_COLLATE_DEFAULT) && (collate_type <= MEDIA_CONTENT_COLLATE_LOCALIZED))) {
+
+ _filter->is_full_order = false;
+
SAFE_FREE(_filter->order_keyword);
- if (STRING_VALID(order_keyword)) {
- _filter->order_keyword = strdup(order_keyword);
- media_content_retvm_if(_filter->order_keyword == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, "OUT_OF_MEMORY");
+ _filter->order_keyword = strdup(order_keyword);
+ media_content_retvm_if(_filter->order_keyword == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, "OUT_OF_MEMORY");
- _filter->order_type = order_type;
- _filter->order_collate_type = collate_type;
- } else {
- media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
+ _filter->order_type = order_type;
+ _filter->order_collate_type = collate_type;
} else {
media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
int media_filter_set_storage(filter_h filter, const char *storage_id)
{
int ret = MEDIA_CONTENT_ERROR_NONE;
+ media_content_warn("DEPRECATION WARNING: media_filter_set_storage() is deprecated and will be removed from next release. Use media_filter_set_condition() with MEDIA_PATH keyword instead.");
filter_s *_filter = (filter_s*)filter;
if ((_filter != NULL) && STRING_VALID(storage_id)) {
filter_s *_filter = (filter_s*)filter;
if (_filter) {
- if (STRING_VALID(_filter->condition)) {
- *condition = strdup(_filter->condition);
+ if (STRING_VALID(_filter->condition) && _filter->is_full_condition == false) {
+ 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;
filter_s *_filter = (filter_s*)filter;
if (_filter) {
- if (STRING_VALID(_filter->order_keyword)) {
+ if (STRING_VALID(_filter->order_keyword) && _filter->is_full_order == false) {
*order_keyword = strdup(_filter->order_keyword);
media_content_retvm_if(*order_keyword == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, "OUT_OF_MEMORY");
} else {
int media_filter_get_storage(filter_h filter, char **storage_id)
{
int ret = MEDIA_CONTENT_ERROR_NONE;
+ media_content_warn("DEPRECATION WARNING: media_filter_get_storage() is deprecated and will be removed from next release.");
filter_s *_filter = (filter_s*)filter;
if (_filter) {
return ret;
}
+
+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;
+}
+