mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-28 20:05:38 +00:00
meta: handle multiple implementation registration
First check that we can actually register the implementation before making a GstMetaInfo. If we can't register we would otherwise end up with an undefined type and an invalid GstMetaInfo. It's possible that type registration fails because another metadata with the same implementation name was already registered.
This commit is contained in:
parent
cc43752c3c
commit
10c8586902
1 changed files with 7 additions and 1 deletions
|
@ -142,14 +142,20 @@ gst_meta_register (GType api, const gchar * impl, gsize size,
|
|||
GstMetaTransformFunction transform_func)
|
||||
{
|
||||
GstMetaInfo *info;
|
||||
GType type;
|
||||
|
||||
g_return_val_if_fail (api != 0, NULL);
|
||||
g_return_val_if_fail (impl != NULL, NULL);
|
||||
g_return_val_if_fail (size != 0, NULL);
|
||||
|
||||
/* first try to register the implementation name. It's possible
|
||||
* that this fails because it was already registered. */
|
||||
type = g_pointer_type_register_static (impl);
|
||||
g_return_val_if_fail (type != 0, NULL);
|
||||
|
||||
info = g_slice_new (GstMetaInfo);
|
||||
info->api = api;
|
||||
info->type = g_pointer_type_register_static (impl);
|
||||
info->type = type;
|
||||
info->size = size;
|
||||
info->init_func = init_func;
|
||||
info->free_func = free_func;
|
||||
|
|
Loading…
Reference in a new issue