mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
encoding-target: Auto convert loading target name to lowercase
We *only* support lowercase encoding target names so we can just handle user to use uper case ones converting them.
This commit is contained in:
parent
bff04a1396
commit
2c9db14d03
1 changed files with 13 additions and 6 deletions
|
@ -792,7 +792,9 @@ gst_encoding_target_subload (gchar * path, const gchar * category,
|
|||
|
||||
/**
|
||||
* gst_encoding_target_load:
|
||||
* @name: the name of the #GstEncodingTarget to load.
|
||||
* @name: the name of the #GstEncodingTarget to load (automatically
|
||||
* converted to lower case internally as capital letters are not
|
||||
* valid for target names).
|
||||
* @category: (allow-none): the name of the target category, like
|
||||
* #GST_ENCODING_CATEGORY_DEVICE. Can be %NULL
|
||||
* @error: If an error occured, this field will be filled in.
|
||||
|
@ -810,19 +812,23 @@ gst_encoding_target_load (const gchar * name, const gchar * category,
|
|||
GError ** error)
|
||||
{
|
||||
gint i;
|
||||
gchar *lfilename, *tldir, **encoding_target_dirs;
|
||||
gchar *p, *lname, *lfilename, *tldir, **encoding_target_dirs;
|
||||
const gchar *envvar;
|
||||
GstEncodingTarget *target = NULL;
|
||||
|
||||
g_return_val_if_fail (name != NULL, NULL);
|
||||
|
||||
if (!validate_name (name))
|
||||
p = lname = g_str_to_ascii (name, NULL);
|
||||
for (; *p; ++p)
|
||||
*p = g_ascii_tolower (*p);
|
||||
|
||||
if (!validate_name (lname))
|
||||
goto invalid_name;
|
||||
|
||||
if (category && !validate_name (category))
|
||||
goto invalid_category;
|
||||
|
||||
lfilename = g_strdup_printf ("%s" GST_ENCODING_TARGET_SUFFIX, name);
|
||||
lfilename = g_strdup_printf ("%s" GST_ENCODING_TARGET_SUFFIX, lname);
|
||||
|
||||
envvar = g_getenv ("GST_ENCODING_TARGET_PATH");
|
||||
if (envvar) {
|
||||
|
@ -858,18 +864,19 @@ gst_encoding_target_load (const gchar * name, const gchar * category,
|
|||
|
||||
done:
|
||||
g_free (lfilename);
|
||||
g_free (lname);
|
||||
|
||||
return target;
|
||||
|
||||
invalid_name:
|
||||
{
|
||||
GST_ERROR ("Invalid name for encoding target : '%s'", name);
|
||||
return NULL;
|
||||
goto done;
|
||||
}
|
||||
invalid_category:
|
||||
{
|
||||
GST_ERROR ("Invalid name for encoding category : '%s'", category);
|
||||
return NULL;
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue