meta info: threadsafe registration using g_once

This commit is contained in:
Michael Smith 2012-10-03 10:51:45 -07:00
parent b10829d6c8
commit b04b1b5089
3 changed files with 8 additions and 4 deletions

View file

@ -759,6 +759,8 @@ gst_deinterleave_process (GstDeinterleave * self, GstBuffer * buf)
if (!pads_pushed)
ret = GST_FLOW_NOT_LINKED;
GST_DEBUG_OBJECT (self, "Pushed on %d pads", pads_pushed);
done:
gst_buffer_unmap (buf, &read_info);
gst_buffer_unref (buf);

View file

@ -75,11 +75,12 @@ gst_v4l2_meta_get_info (void)
{
static const GstMetaInfo *meta_info = NULL;
if (meta_info == NULL) {
meta_info =
if (g_once_init_enter (&meta_info)) {
const GstMetaInfo *meta =
gst_meta_register (gst_v4l2_meta_api_get_type (), "GstV4l2Meta",
sizeof (GstV4l2Meta), (GstMetaInitFunction) NULL,
(GstMetaFreeFunction) NULL, (GstMetaTransformFunction) NULL);
g_once_init_leave (&meta_info, meta);
}
return meta_info;
}

View file

@ -41,11 +41,12 @@ gst_meta_ximage_get_info (void)
{
static const GstMetaInfo *meta_ximage_info = NULL;
if (meta_ximage_info == NULL) {
meta_ximage_info =
if (g_once_init_enter (&meta_ximage_info)) {
const GstMetaInfo *meta =
gst_meta_register (gst_meta_ximage_api_get_type (), "GstMetaXImageSrc",
sizeof (GstMetaXImage), (GstMetaInitFunction) NULL,
(GstMetaFreeFunction) NULL, (GstMetaTransformFunction) NULL);
g_once_init_leave (&meta_ximage_info, meta);
}
return meta_ximage_info;
}