Commit 37f05e32 authored by Guillaume Desmottes's avatar Guillaume Desmottes 🐐 Committed by Sebastian Dröge

videosink: ensure the debug category is always initialized

gst_video_sink_center_rect() can be called without a GstVideoSink
having been instantiated so we can't relly on the video sink
class_init function to init the category.

Fix a warning when running:
GST_CHECKS=test_video_center_rect GST_DEBUG=6 G_DEBUG=fatal_warnings make libs/video.check-norepeat

https://bugzilla.gnome.org/show_bug.cgi?id=766510
parent bb015bad
......@@ -40,6 +40,8 @@
#include "gstvideosink.h"
G_DEFINE_TYPE (GstVideoSink, gst_video_sink, GST_TYPE_BASE_SINK);
enum
{
PROP_SHOW_PREROLL_FRAME = 1
......@@ -52,8 +54,25 @@ struct _GstVideoSinkPrivate
gboolean show_preroll_frame; /* ATOMIC */
};
GST_DEBUG_CATEGORY_STATIC (video_sink_debug);
#define GST_CAT_DEFAULT video_sink_debug
#ifndef GST_DISABLE_GST_DEBUG
#define GST_CAT_DEFAULT gst_video_sink_ensure_debug_category()
static GstDebugCategory *
gst_video_sink_ensure_debug_category (void)
{
static gsize cat_gonce = 0;
if (g_once_init_enter (&cat_gonce)) {
GstDebugCategory *cat = NULL;
GST_DEBUG_CATEGORY_INIT (cat, "videosink", 0, "GstVideoSink");
g_once_init_leave (&cat_gonce, (gsize) cat);
}
return (GstDebugCategory *) cat_gonce;
}
#endif /* GST_DISABLE_GST_DEBUG */
static GstBaseSinkClass *parent_class = NULL;
......@@ -163,12 +182,6 @@ gst_video_sink_class_init (GstVideoSinkClass * klass)
g_type_class_add_private (klass, sizeof (GstVideoSinkPrivate));
}
static void
gst_video_sink_base_init (gpointer g_class)
{
GST_DEBUG_CATEGORY_INIT (video_sink_debug, "videosink", 0, "GstVideoSink");
}
static GstFlowReturn
gst_video_sink_show_preroll_frame (GstBaseSink * bsink, GstBuffer * buf)
{
......@@ -257,30 +270,3 @@ gst_video_sink_get_property (GObject * object, guint prop_id,
break;
}
}
/* Public methods */
GType
gst_video_sink_get_type (void)
{
static GType videosink_type = 0;
if (!videosink_type) {
static const GTypeInfo videosink_info = {
sizeof (GstVideoSinkClass),
gst_video_sink_base_init,
NULL,
(GClassInitFunc) gst_video_sink_class_init,
NULL,
NULL,
sizeof (GstVideoSink),
0,
(GInstanceInitFunc) gst_video_sink_init,
};
videosink_type = g_type_register_static (GST_TYPE_BASE_SINK,
"GstVideoSink", &videosink_info, 0);
}
return videosink_type;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment