mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
encoding-target: Allow using name and targets from serialized file
We used to only care about the name of the files even if the name is defined in the encoding target serialized file. That commit also allows user to define several names for a single target file (using a ';' between the names) which allows us to have a target for youtube that is called 'youtube;yt' or a target for 'ogg;ogv;oga' file extension.
This commit is contained in:
parent
2c9db14d03
commit
85979f996d
1 changed files with 30 additions and 0 deletions
|
@ -179,6 +179,10 @@ validate_name (const gchar * name)
|
|||
/* if an hyphen, continue */
|
||||
if (name[i] == '-')
|
||||
continue;
|
||||
/* if an ';', continue (list delimiter) */
|
||||
if (name[i] == ';') {
|
||||
continue;
|
||||
}
|
||||
/* remaining should only be ascii letters */
|
||||
if (!g_ascii_isalpha (name[i]))
|
||||
return FALSE;
|
||||
|
@ -862,6 +866,32 @@ gst_encoding_target_load (const gchar * name, const gchar * category,
|
|||
g_free (tldir);
|
||||
}
|
||||
|
||||
if (!target) {
|
||||
GList *tmp, *targets = gst_encoding_list_all_targets (NULL);
|
||||
|
||||
for (tmp = targets; tmp; tmp = tmp->next) {
|
||||
gint i;
|
||||
GstEncodingTarget *tmptarget = tmp->data;
|
||||
gchar **names = g_strsplit (tmptarget->name, ";", -1);
|
||||
|
||||
for (i = 0; names[i]; i++) {
|
||||
if (!g_strcmp0 (names[i], lname) && (!category ||
|
||||
!g_strcmp0 (tmptarget->category, category))) {
|
||||
target = gst_object_ref (tmptarget);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
g_strfreev (names);
|
||||
|
||||
if (target)
|
||||
break;
|
||||
}
|
||||
|
||||
g_list_free_full (targets, gst_object_unref);
|
||||
}
|
||||
|
||||
|
||||
done:
|
||||
g_free (lfilename);
|
||||
g_free (lname);
|
||||
|
|
Loading…
Reference in a new issue