Commit 224b2994 authored by Ghislain MARY's avatar Ghislain MARY
Browse files

Add ms_tags_list_contains_tag() function.

parent fdc8e0a4
......@@ -163,6 +163,7 @@ MS2_PUBLIC MSList *ms_list_copy(const MSList *list);
MS2_PUBLIC MSList *ms_list_copy_with_data(const MSList *list, void *(*copyfunc)(void *));
MS2_PUBLIC char * ms_tags_list_as_string(const MSList *list);
MS2_PUBLIC bool_t ms_tags_list_contains_tag(const MSList *list, const char *tag);
#undef MIN
#define MIN(a,b) ((a)>(b) ? (b) : (a))
......
......@@ -289,6 +289,17 @@ char * ms_tags_list_as_string(const MSList *list) {
return tags_str;
}
bool_t ms_tags_list_contains_tag(const MSList *list, const char *tag) {
MSList *elem = list;
while (elem != NULL) {
char *tag_from_list = (char *)elem->data;
if (strcasecmp(tag, tag_from_list) == 0)
return TRUE;
elem = elem->next;
}
return FALSE;
}
int ms_load_plugins(const char *dir){
return ms_factory_load_plugins(ms_factory_get_fallback(),dir);
}
......
......@@ -93,23 +93,12 @@ static void add_video_preset_configuration(MSVideoPreset *preset, const char *ta
preset->configs = ms_list_append(preset->configs, vpc);
}
static bool_t tag_in_list(const char *tag, MSList *tags_list) {
MSList *elem = tags_list;
while (elem != NULL) {
char *tag_from_list = (char *)elem->data;
if (strcasecmp(tag, tag_from_list) == 0)
return TRUE;
elem = elem->next;
}
return FALSE;
}
static int video_preset_configuration_match(MSVideoPresetConfiguration *vpc, MSList *platform_tags, MSList *codec_tags) {
MSList *elem = vpc->tags;
int nb = 0;
while (elem != NULL) {
char *tag = (char *)elem->data;
if (!tag_in_list(tag, platform_tags) && !tag_in_list(tag, codec_tags))
if (!ms_tags_list_contains_tag(platform_tags, tag) && !ms_tags_list_contains_tag(codec_tags, tag))
return 0;
nb++;
elem = elem->next;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment