mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-22 16:26:39 +00:00
meta: Add API to register metas in two steps
And also remove the specific registration APIs for serializable meta. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5830>
This commit is contained in:
parent
2a9c4e3270
commit
f5d5f2cf1a
7 changed files with 218 additions and 176 deletions
153
girs/Gst-1.0.gir
153
girs/Gst-1.0.gir
|
@ -26040,48 +26040,6 @@ transform function.</doc>
|
|||
</parameter>
|
||||
</parameters>
|
||||
</function>
|
||||
<function name="register_serializable" c:identifier="gst_meta_register_serializable" version="1.24" introspectable="0">
|
||||
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstmeta.c">Same as gst_meta_register() but also set serialize/deserialize functions.</doc>
|
||||
<source-position filename="../subprojects/gstreamer/gst/gstmeta.h"/>
|
||||
<return-value transfer-ownership="none">
|
||||
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstmeta.c">a #GstMetaInfo that can be used to access metadata.</doc>
|
||||
<type name="MetaInfo" c:type="const GstMetaInfo*"/>
|
||||
</return-value>
|
||||
<parameters>
|
||||
<parameter name="api" transfer-ownership="none">
|
||||
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstmeta.c">the type of the #GstMeta API</doc>
|
||||
<type name="GType" c:type="GType"/>
|
||||
</parameter>
|
||||
<parameter name="impl" transfer-ownership="none">
|
||||
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstmeta.c">the name of the #GstMeta implementation</doc>
|
||||
<type name="utf8" c:type="const gchar*"/>
|
||||
</parameter>
|
||||
<parameter name="size" transfer-ownership="none">
|
||||
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstmeta.c">the size of the #GstMeta structure</doc>
|
||||
<type name="gsize" c:type="gsize"/>
|
||||
</parameter>
|
||||
<parameter name="init_func" transfer-ownership="none">
|
||||
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstmeta.c">a #GstMetaInitFunction</doc>
|
||||
<type name="MetaInitFunction" c:type="GstMetaInitFunction"/>
|
||||
</parameter>
|
||||
<parameter name="free_func" transfer-ownership="none">
|
||||
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstmeta.c">a #GstMetaFreeFunction</doc>
|
||||
<type name="MetaFreeFunction" c:type="GstMetaFreeFunction"/>
|
||||
</parameter>
|
||||
<parameter name="transform_func" transfer-ownership="none">
|
||||
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstmeta.c">a #GstMetaTransformFunction</doc>
|
||||
<type name="MetaTransformFunction" c:type="GstMetaTransformFunction"/>
|
||||
</parameter>
|
||||
<parameter name="serialize_func" transfer-ownership="none">
|
||||
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstmeta.c">a #GstMetaSerializeFunction</doc>
|
||||
<type name="MetaSerializeFunction" c:type="GstMetaSerializeFunction"/>
|
||||
</parameter>
|
||||
<parameter name="deserialize_func" transfer-ownership="none">
|
||||
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstmeta.c">a #GstMetaDeserializeFunction</doc>
|
||||
<type name="MetaDeserializeFunction" c:type="GstMetaDeserializeFunction"/>
|
||||
</parameter>
|
||||
</parameters>
|
||||
</function>
|
||||
</record>
|
||||
<callback name="MetaClearFunction" c:type="GstMetaClearFunction" version="1.24">
|
||||
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstmeta.h">Clears the content of the meta. This will be called by the GstBufferPool
|
||||
|
@ -26223,6 +26181,75 @@ pooled metas.</doc>
|
|||
</instance-parameter>
|
||||
</parameters>
|
||||
</method>
|
||||
<method name="register" c:identifier="gst_meta_info_register" version="1.24">
|
||||
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstmeta.c">Registers a new meta.
|
||||
|
||||
Use the structure returned by gst_meta_info_new(), it consumes it and the
|
||||
structure shouldnt be used after. The one returned by the function can be
|
||||
kept.</doc>
|
||||
<source-position filename="../subprojects/gstreamer/gst/gstmeta.h"/>
|
||||
<return-value transfer-ownership="none">
|
||||
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstmeta.c">the registered meta</doc>
|
||||
<type name="MetaInfo" c:type="const GstMetaInfo*"/>
|
||||
</return-value>
|
||||
<parameters>
|
||||
<instance-parameter name="info" transfer-ownership="full">
|
||||
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstmeta.c">a new #GstMetaInfo created by gst_meta_info_new()</doc>
|
||||
<type name="MetaInfo" c:type="GstMetaInfo*"/>
|
||||
</instance-parameter>
|
||||
</parameters>
|
||||
</method>
|
||||
<function name="new" c:identifier="gst_meta_info_new" version="1.24" introspectable="0">
|
||||
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstmeta.c">Creates a new structure that needs to be filled before being
|
||||
registered. This structure should filled and then registered with
|
||||
gst_meta_info_register().
|
||||
|
||||
Example:
|
||||
```c
|
||||
const GstMetaInfo *
|
||||
gst_my_meta_get_info (void)
|
||||
{
|
||||
static const GstMetaInfo *meta_info = NULL;
|
||||
|
||||
if (g_once_init_enter ((GstMetaInfo **) & meta_info)) {
|
||||
GstMetaInfo *info = gst_meta_info_new (
|
||||
gst_my_meta_api_get_type (),
|
||||
"GstMyMeta",
|
||||
sizeof (GstMyMeta));
|
||||
const GstMetaInfo *meta = NULL;
|
||||
|
||||
info->init_func = my_meta_init;
|
||||
info->free_func = my_meta_free;
|
||||
info->transform_func = my_meta_transform;
|
||||
info->serialize_func = my_meta_serialize;
|
||||
info->deserialize_func = my_meta_deserialize;
|
||||
meta = gst_meta_info_register (info);
|
||||
g_once_init_leave ((GstMetaInfo **) & meta_info, (GstMetaInfo *) meta);
|
||||
}
|
||||
|
||||
return meta_info;
|
||||
}
|
||||
```</doc>
|
||||
<source-position filename="../subprojects/gstreamer/gst/gstmeta.h"/>
|
||||
<return-value>
|
||||
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstmeta.c">a new #GstMetaInfo that needs to be filled</doc>
|
||||
<type name="MetaInfo" c:type="GstMetaInfo*"/>
|
||||
</return-value>
|
||||
<parameters>
|
||||
<parameter name="api" transfer-ownership="none">
|
||||
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstmeta.c">the type of the #GstMeta API</doc>
|
||||
<type name="GType" c:type="GType"/>
|
||||
</parameter>
|
||||
<parameter name="impl" transfer-ownership="none">
|
||||
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstmeta.c">the name of the #GstMeta implementation</doc>
|
||||
<type name="utf8" c:type="const gchar*"/>
|
||||
</parameter>
|
||||
<parameter name="size" transfer-ownership="none">
|
||||
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstmeta.c">the size of the #GstMeta structure</doc>
|
||||
<type name="gsize" c:type="gsize"/>
|
||||
</parameter>
|
||||
</parameters>
|
||||
</function>
|
||||
</record>
|
||||
<callback name="MetaInitFunction" c:type="GstMetaInitFunction">
|
||||
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstmeta.h">Function called when @meta is initialized in @buffer.</doc>
|
||||
|
@ -52327,48 +52354,6 @@ transform function.</doc>
|
|||
</parameter>
|
||||
</parameters>
|
||||
</function>
|
||||
<function name="meta_register_serializable" c:identifier="gst_meta_register_serializable" moved-to="Meta.register_serializable" version="1.24" introspectable="0">
|
||||
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstmeta.c">Same as gst_meta_register() but also set serialize/deserialize functions.</doc>
|
||||
<source-position filename="../subprojects/gstreamer/gst/gstmeta.h"/>
|
||||
<return-value transfer-ownership="none">
|
||||
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstmeta.c">a #GstMetaInfo that can be used to access metadata.</doc>
|
||||
<type name="MetaInfo" c:type="const GstMetaInfo*"/>
|
||||
</return-value>
|
||||
<parameters>
|
||||
<parameter name="api" transfer-ownership="none">
|
||||
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstmeta.c">the type of the #GstMeta API</doc>
|
||||
<type name="GType" c:type="GType"/>
|
||||
</parameter>
|
||||
<parameter name="impl" transfer-ownership="none">
|
||||
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstmeta.c">the name of the #GstMeta implementation</doc>
|
||||
<type name="utf8" c:type="const gchar*"/>
|
||||
</parameter>
|
||||
<parameter name="size" transfer-ownership="none">
|
||||
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstmeta.c">the size of the #GstMeta structure</doc>
|
||||
<type name="gsize" c:type="gsize"/>
|
||||
</parameter>
|
||||
<parameter name="init_func" transfer-ownership="none">
|
||||
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstmeta.c">a #GstMetaInitFunction</doc>
|
||||
<type name="MetaInitFunction" c:type="GstMetaInitFunction"/>
|
||||
</parameter>
|
||||
<parameter name="free_func" transfer-ownership="none">
|
||||
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstmeta.c">a #GstMetaFreeFunction</doc>
|
||||
<type name="MetaFreeFunction" c:type="GstMetaFreeFunction"/>
|
||||
</parameter>
|
||||
<parameter name="transform_func" transfer-ownership="none">
|
||||
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstmeta.c">a #GstMetaTransformFunction</doc>
|
||||
<type name="MetaTransformFunction" c:type="GstMetaTransformFunction"/>
|
||||
</parameter>
|
||||
<parameter name="serialize_func" transfer-ownership="none">
|
||||
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstmeta.c">a #GstMetaSerializeFunction</doc>
|
||||
<type name="MetaSerializeFunction" c:type="GstMetaSerializeFunction"/>
|
||||
</parameter>
|
||||
<parameter name="deserialize_func" transfer-ownership="none">
|
||||
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstmeta.c">a #GstMetaDeserializeFunction</doc>
|
||||
<type name="MetaDeserializeFunction" c:type="GstMetaDeserializeFunction"/>
|
||||
</parameter>
|
||||
</parameters>
|
||||
</function>
|
||||
<function name="mini_object_replace" c:identifier="gst_mini_object_replace" moved-to="MiniObject.replace">
|
||||
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstminiobject.c">Atomically modifies a pointer to point to a new mini-object.
|
||||
The reference count of @olddata is decreased and the reference count of
|
||||
|
|
|
@ -371,14 +371,14 @@ gst_analytics_relation_meta_get_info (void)
|
|||
{
|
||||
static const GstMetaInfo *info = NULL;
|
||||
if (g_once_init_enter ((GstMetaInfo **) & info)) {
|
||||
GstMetaInfo *meta = (GstMetaInfo *)
|
||||
gst_meta_register (GST_ANALYTICS_RELATION_META_API_TYPE,
|
||||
GstMetaInfo *meta = gst_meta_info_new (GST_ANALYTICS_RELATION_META_API_TYPE,
|
||||
"GstAnalyticsRelationMeta",
|
||||
sizeof (GstAnalyticsRelationMeta),
|
||||
gst_analytics_relation_meta_init,
|
||||
gst_analytics_relation_meta_free,
|
||||
gst_analytics_relation_meta_transform);
|
||||
sizeof (GstAnalyticsRelationMeta));
|
||||
meta->init_func = gst_analytics_relation_meta_init;
|
||||
meta->free_func = gst_analytics_relation_meta_free;
|
||||
meta->transform_func = gst_analytics_relation_meta_transform;
|
||||
meta->clear_func = gst_analytics_relation_meta_clear;
|
||||
meta = (GstMetaInfo *) gst_meta_info_register (meta);
|
||||
g_once_init_leave ((GstMetaInfo **) & info, (GstMetaInfo *) meta);
|
||||
}
|
||||
return info;
|
||||
|
|
|
@ -588,14 +588,16 @@ gst_audio_meta_get_info (void)
|
|||
static const GstMetaInfo *audio_meta_info = NULL;
|
||||
|
||||
if (g_once_init_enter ((GstMetaInfo **) & audio_meta_info)) {
|
||||
const GstMetaInfo *meta =
|
||||
gst_meta_register_serializable (GST_AUDIO_META_API_TYPE,
|
||||
"GstAudioMeta", sizeof (GstAudioMeta),
|
||||
gst_audio_meta_init,
|
||||
gst_audio_meta_free,
|
||||
gst_audio_meta_transform,
|
||||
gst_audio_meta_serialize,
|
||||
gst_audio_meta_deserialize);
|
||||
GstMetaInfo *info = gst_meta_info_new (GST_AUDIO_META_API_TYPE,
|
||||
"GstAudioMeta", sizeof (GstAudioMeta));
|
||||
|
||||
info->init_func = gst_audio_meta_init;
|
||||
info->free_func = gst_audio_meta_free;
|
||||
info->transform_func = gst_audio_meta_transform;
|
||||
info->serialize_func = gst_audio_meta_serialize;
|
||||
info->deserialize_func = gst_audio_meta_deserialize;
|
||||
const GstMetaInfo *meta = gst_meta_info_register (info);
|
||||
|
||||
g_once_init_leave ((GstMetaInfo **) & audio_meta_info,
|
||||
(GstMetaInfo *) meta);
|
||||
}
|
||||
|
|
|
@ -252,11 +252,14 @@ gst_video_meta_get_info (void)
|
|||
static const GstMetaInfo *video_meta_info = NULL;
|
||||
|
||||
if (g_once_init_enter ((GstMetaInfo **) & video_meta_info)) {
|
||||
const GstMetaInfo *meta =
|
||||
gst_meta_register_serializable (GST_VIDEO_META_API_TYPE, "GstVideoMeta",
|
||||
sizeof (GstVideoMeta), (GstMetaInitFunction) gst_video_meta_init,
|
||||
(GstMetaFreeFunction) NULL, gst_video_meta_transform,
|
||||
video_meta_serialize, video_meta_deserialize);
|
||||
GstMetaInfo *info = gst_meta_info_new (GST_VIDEO_META_API_TYPE,
|
||||
"GstVideoMeta",
|
||||
sizeof (GstVideoMeta));
|
||||
info->init_func = gst_video_meta_init;
|
||||
info->transform_func = gst_video_meta_transform;
|
||||
info->serialize_func = video_meta_serialize;
|
||||
info->deserialize_func = video_meta_deserialize;
|
||||
const GstMetaInfo *meta = gst_meta_info_register (info);
|
||||
g_once_init_leave ((GstMetaInfo **) & video_meta_info,
|
||||
(GstMetaInfo *) meta);
|
||||
}
|
||||
|
|
|
@ -2918,16 +2918,17 @@ gst_reference_timestamp_meta_get_info (void)
|
|||
static const GstMetaInfo *meta_info = NULL;
|
||||
|
||||
if (g_once_init_enter ((GstMetaInfo **) & meta_info)) {
|
||||
const GstMetaInfo *meta =
|
||||
gst_meta_register_serializable
|
||||
(gst_reference_timestamp_meta_api_get_type (),
|
||||
const GstMetaInfo *meta = NULL;
|
||||
GstMetaInfo *info =
|
||||
gst_meta_info_new (gst_reference_timestamp_meta_api_get_type (),
|
||||
"GstReferenceTimestampMeta",
|
||||
sizeof (GstReferenceTimestampMeta),
|
||||
(GstMetaInitFunction) _gst_reference_timestamp_meta_init,
|
||||
(GstMetaFreeFunction) _gst_reference_timestamp_meta_free,
|
||||
_gst_reference_timestamp_meta_transform,
|
||||
timestamp_meta_serialize,
|
||||
timestamp_meta_deserialize);
|
||||
sizeof (GstReferenceTimestampMeta));
|
||||
info->init_func = (GstMetaInitFunction) _gst_reference_timestamp_meta_init;
|
||||
info->free_func = (GstMetaFreeFunction) _gst_reference_timestamp_meta_free;
|
||||
info->transform_func = _gst_reference_timestamp_meta_transform;
|
||||
info->serialize_func = timestamp_meta_serialize;
|
||||
info->deserialize_func = timestamp_meta_deserialize;
|
||||
meta = gst_meta_info_register (info);
|
||||
g_once_init_leave ((GstMetaInfo **) & meta_info, (GstMetaInfo *) meta);
|
||||
}
|
||||
|
||||
|
|
|
@ -301,8 +301,9 @@ gst_meta_register_custom (const gchar * name, const gchar ** tags,
|
|||
{
|
||||
gchar *api_name = g_strdup_printf ("%s-api", name);
|
||||
GType api;
|
||||
GstMetaInfoImpl *info;
|
||||
GstMetaInfo *ret = NULL;
|
||||
GstMetaInfo *info;
|
||||
GstMetaInfoImpl *impl;
|
||||
const GstMetaInfo *ret = NULL;
|
||||
|
||||
g_return_val_if_fail (tags != NULL, NULL);
|
||||
g_return_val_if_fail (name != NULL, NULL);
|
||||
|
@ -312,20 +313,24 @@ gst_meta_register_custom (const gchar * name, const gchar ** tags,
|
|||
if (api == G_TYPE_INVALID)
|
||||
goto done;
|
||||
|
||||
info = (GstMetaInfoImpl *) gst_meta_register_serializable (api, name,
|
||||
sizeof (GstCustomMeta),
|
||||
custom_init_func, custom_free_func, custom_transform_func,
|
||||
custom_serialize_func, custom_deserialize_func);
|
||||
|
||||
if (!info)
|
||||
info = gst_meta_info_new (api, name, sizeof (GstCustomMeta));
|
||||
if (info == NULL)
|
||||
goto done;
|
||||
|
||||
info->is_custom = TRUE;
|
||||
info->custom_transform_func = transform_func;
|
||||
info->custom_transform_user_data = user_data;
|
||||
info->custom_transform_destroy_notify = destroy_data;
|
||||
impl = (GstMetaInfoImpl *) info;
|
||||
|
||||
ret = (GstMetaInfo *) info;
|
||||
info->init_func = custom_init_func;
|
||||
info->free_func = custom_free_func;
|
||||
info->transform_func = custom_transform_func;
|
||||
info->serialize_func = custom_serialize_func;
|
||||
info->deserialize_func = custom_deserialize_func;
|
||||
|
||||
impl->is_custom = TRUE;
|
||||
impl->custom_transform_func = transform_func;
|
||||
impl->custom_transform_user_data = user_data;
|
||||
impl->custom_transform_destroy_notify = destroy_data;
|
||||
|
||||
ret = gst_meta_info_register (info);
|
||||
|
||||
done:
|
||||
return ret;
|
||||
|
@ -411,27 +416,14 @@ gst_meta_register_internal (GType api, const gchar * impl, gsize size,
|
|||
GstMetaDeserializeFunction deserialize_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);
|
||||
|
||||
if (init_func == NULL)
|
||||
g_critical ("Registering meta implementation '%s' without init function",
|
||||
impl);
|
||||
|
||||
/* first try to register the implementation name. It's possible
|
||||
* that this fails because it was already registered. Don't warn,
|
||||
* glib did this for us already. */
|
||||
type = g_pointer_type_register_static (impl);
|
||||
if (type == G_TYPE_INVALID)
|
||||
info = gst_meta_info_new (api, impl, size);
|
||||
if (info == NULL)
|
||||
return NULL;
|
||||
|
||||
info = (GstMetaInfo *) g_new0 (GstMetaInfoImpl, 1);
|
||||
info->api = api;
|
||||
info->type = type;
|
||||
info->size = size;
|
||||
info->init_func = init_func;
|
||||
info->free_func = free_func;
|
||||
info->transform_func = transform_func;
|
||||
|
@ -439,16 +431,7 @@ gst_meta_register_internal (GType api, const gchar * impl, gsize size,
|
|||
info->deserialize_func = deserialize_func;
|
||||
((GstMetaInfoImpl *) info)->is_custom = FALSE;
|
||||
|
||||
GST_CAT_DEBUG (GST_CAT_META,
|
||||
"register \"%s\" implementing \"%s\" of size %" G_GSIZE_FORMAT, impl,
|
||||
g_type_name (api), size);
|
||||
|
||||
g_rw_lock_writer_lock (&lock);
|
||||
g_hash_table_insert (metainfo, (gpointer) g_intern_string (impl),
|
||||
(gpointer) info);
|
||||
g_rw_lock_writer_unlock (&lock);
|
||||
|
||||
return info;
|
||||
return gst_meta_info_register (info);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -478,33 +461,103 @@ gst_meta_register (GType api, const gchar * impl, gsize size,
|
|||
}
|
||||
|
||||
/**
|
||||
* gst_meta_register_serializable: (skip):
|
||||
* @api: the type of the #GstMeta API
|
||||
* gst_meta_info_new:
|
||||
* @api: the type of the #GstMeta API
|
||||
* @impl: the name of the #GstMeta implementation
|
||||
* @size: the size of the #GstMeta structure
|
||||
* @init_func: a #GstMetaInitFunction
|
||||
* @free_func: a #GstMetaFreeFunction
|
||||
* @transform_func: a #GstMetaTransformFunction
|
||||
* @serialize_func: a #GstMetaSerializeFunction
|
||||
* @deserialize_func: a #GstMetaDeserializeFunction
|
||||
*
|
||||
* Same as gst_meta_register() but also set serialize/deserialize functions.
|
||||
* Creates a new structure that needs to be filled before being
|
||||
* registered. This structure should filled and then registered with
|
||||
* gst_meta_info_register().
|
||||
*
|
||||
* Returns: (transfer none): a #GstMetaInfo that can be used to access metadata.
|
||||
* Example:
|
||||
* ```c
|
||||
* const GstMetaInfo *
|
||||
* gst_my_meta_get_info (void)
|
||||
* {
|
||||
* static const GstMetaInfo *meta_info = NULL;
|
||||
*
|
||||
* if (g_once_init_enter ((GstMetaInfo **) & meta_info)) {
|
||||
* GstMetaInfo *info = gst_meta_info_new (
|
||||
* gst_my_meta_api_get_type (),
|
||||
* "GstMyMeta",
|
||||
* sizeof (GstMyMeta));
|
||||
* const GstMetaInfo *meta = NULL;
|
||||
*
|
||||
* info->init_func = my_meta_init;
|
||||
* info->free_func = my_meta_free;
|
||||
* info->transform_func = my_meta_transform;
|
||||
* info->serialize_func = my_meta_serialize;
|
||||
* info->deserialize_func = my_meta_deserialize;
|
||||
* meta = gst_meta_info_register (info);
|
||||
* g_once_init_leave ((GstMetaInfo **) & meta_info, (GstMetaInfo *) meta);
|
||||
* }
|
||||
*
|
||||
* return meta_info;
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* Returns: a new #GstMetaInfo that needs to be filled
|
||||
*
|
||||
* Since: 1.24
|
||||
*/
|
||||
const GstMetaInfo *
|
||||
gst_meta_register_serializable (GType api, const gchar * impl, gsize size,
|
||||
GstMetaInitFunction init_func, GstMetaFreeFunction free_func,
|
||||
GstMetaTransformFunction transform_func,
|
||||
GstMetaSerializeFunction serialize_func,
|
||||
GstMetaDeserializeFunction deserialize_func)
|
||||
|
||||
GstMetaInfo *
|
||||
gst_meta_info_new (GType api, const gchar * impl, gsize size)
|
||||
{
|
||||
g_return_val_if_fail (serialize_func != NULL, NULL);
|
||||
g_return_val_if_fail (deserialize_func != NULL, NULL);
|
||||
return gst_meta_register_internal (api, impl, size, init_func, free_func,
|
||||
transform_func, serialize_func, deserialize_func);
|
||||
GType type;
|
||||
GstMetaInfo *info;
|
||||
|
||||
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. Don't warn,
|
||||
* glib did this for us already. */
|
||||
type = g_pointer_type_register_static (impl);
|
||||
|
||||
info = (GstMetaInfo *) g_new0 (GstMetaInfoImpl, 1);
|
||||
info->api = api;
|
||||
info->type = type;
|
||||
info->size = size;
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_meta_info_register:
|
||||
* @info: (transfer full): a new #GstMetaInfo created by gst_meta_info_new()
|
||||
*
|
||||
* Registers a new meta.
|
||||
*
|
||||
* Use the structure returned by gst_meta_info_new(), it consumes it and the
|
||||
* structure shouldnt be used after. The one returned by the function can be
|
||||
* kept.
|
||||
*
|
||||
* Returns: (transfer none): the registered meta
|
||||
*
|
||||
* Since: 1.24
|
||||
*/
|
||||
|
||||
const GstMetaInfo *
|
||||
gst_meta_info_register (GstMetaInfo * info)
|
||||
{
|
||||
if (info->type == G_TYPE_INVALID) {
|
||||
g_free (info);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
GST_CAT_DEBUG (GST_CAT_META,
|
||||
"register \"%s\" implementing \"%s\" of size %" G_GSIZE_FORMAT,
|
||||
g_type_name (info->type), g_type_name (info->api), info->size);
|
||||
|
||||
g_rw_lock_writer_lock (&lock);
|
||||
g_hash_table_insert (metainfo,
|
||||
(gpointer) g_intern_string (g_type_name (info->type)), (gpointer) info);
|
||||
g_rw_lock_writer_unlock (&lock);
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -367,13 +367,11 @@ const GstMetaInfo * gst_meta_register (GType api, const gchar *impl,
|
|||
GstMetaTransformFunction transform_func);
|
||||
|
||||
GST_API
|
||||
const GstMetaInfo * gst_meta_register_serializable (GType api, const gchar *impl,
|
||||
gsize size,
|
||||
GstMetaInitFunction init_func,
|
||||
GstMetaFreeFunction free_func,
|
||||
GstMetaTransformFunction transform_func,
|
||||
GstMetaSerializeFunction serialize_func,
|
||||
GstMetaDeserializeFunction deserialize_func);
|
||||
GstMetaInfo * gst_meta_info_new (GType api,
|
||||
const gchar *impl,
|
||||
gsize size);
|
||||
GST_API
|
||||
const GstMetaInfo * gst_meta_info_register (GstMetaInfo *info);
|
||||
|
||||
GST_API
|
||||
const GstMetaInfo * gst_meta_register_custom (const gchar *name, const gchar **tags,
|
||||
|
|
Loading…
Reference in a new issue