mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-09-03 02:33:53 +00:00
use gtype to get the enum value for the nick
This commit is contained in:
parent
770a16f5ce
commit
f64bc157bc
1 changed files with 13 additions and 5 deletions
|
@ -200,11 +200,19 @@ GESTimelineTransition *
|
||||||
ges_timeline_transition_new_for_nick (gchar * nick)
|
ges_timeline_transition_new_for_nick (gchar * nick)
|
||||||
{
|
{
|
||||||
GEnumValue *value;
|
GEnumValue *value;
|
||||||
|
GEnumClass *klass;
|
||||||
|
GESTimelineTransition *ret = NULL;
|
||||||
|
|
||||||
for (value = &transition_types[0]; value->value_name; value++)
|
klass = G_ENUM_CLASS (g_type_class_ref (GES_VIDEO_TRANSITION_TYPE_TYPE));
|
||||||
if (!strcmp (nick, value->value_nick))
|
if (!klass)
|
||||||
return g_object_new (GES_TYPE_TIMELINE_TRANSITION, "vtype",
|
return NULL;
|
||||||
(gint) value->value, NULL);
|
|
||||||
|
|
||||||
return NULL;
|
value = g_enum_get_value_by_nick (klass, nick);
|
||||||
|
if (value) {
|
||||||
|
ret = g_object_new (GES_TYPE_TIMELINE_TRANSITION, "vtype",
|
||||||
|
(gint) value->value, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
g_type_class_unref (klass);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue