d3d11: Initialize debug categories of non-GstElement implementation in plugin init

That's the way to expose debug category to --gst-debug-help
This commit is contained in:
Seungha Yang 2019-12-05 00:53:40 +09:00 committed by GStreamer Merge Bot
parent 71befc477f
commit 199caccc41
4 changed files with 14 additions and 51 deletions

View file

@ -29,7 +29,7 @@
#endif
GST_DEBUG_CATEGORY_STATIC (GST_CAT_CONTEXT);
GST_DEBUG_CATEGORY_STATIC (gst_d3d11_device_debug);
GST_DEBUG_CATEGORY_EXTERN (gst_d3d11_device_debug);
#define GST_CAT_DEFAULT gst_d3d11_device_debug
#ifdef HAVE_D3D11SDKLAYER_H
@ -178,8 +178,6 @@ gst_d3d11_device_class_init (GstD3D11DeviceClass * klass)
"Human readable device description", NULL,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
GST_DEBUG_CATEGORY_INIT (gst_d3d11_device_debug,
"d3d11device", 0, "d3d11 device");
GST_DEBUG_CATEGORY_GET (GST_CAT_CONTEXT, "GST_CONTEXT");
}
@ -542,13 +540,6 @@ gst_d3d11_device_new (guint adapter)
{
GstD3D11Device *device = NULL;
GstD3D11DevicePrivate *priv;
static volatile gsize _init = 0;
if (g_once_init_enter (&_init)) {
GST_DEBUG_CATEGORY_INIT (gst_d3d11_device_debug, "d3d11device", 0,
"d3d11 device");
g_once_init_leave (&_init, 1);
}
device = g_object_new (GST_TYPE_D3D11_DEVICE, "adapter", adapter, NULL);

View file

@ -26,27 +26,8 @@
#include "gstd3d11device.h"
#include "gstd3d11memory.h"
#ifndef GST_DISABLE_GST_DEBUG
#define GST_CAT_DEFAULT ensure_debug_category()
static GstDebugCategory *
ensure_debug_category (void)
{
static gsize cat_gonce = 0;
if (g_once_init_enter (&cat_gonce)) {
gsize cat_done;
cat_done = (gsize) _gst_debug_category_new ("d3d11format", 0,
"Direct3D11 Format");
g_once_init_leave (&cat_gonce, cat_done);
}
return (GstDebugCategory *) cat_gonce;
}
#else
#define ensure_debug_category() /* NOOP */
#endif /* GST_DISABLE_GST_DEBUG */
GST_DEBUG_CATEGORY_EXTERN (gst_d3d11_format_debug);
#define GST_CAT_DEFAULT gst_d3d11_format_debug
/* Following formats were introduced since Windows 8
* DXGI_FORMAT_AYUV

View file

@ -27,22 +27,9 @@
#include <windows.h>
#include <versionhelpers.h>
GST_DEBUG_CATEGORY_STATIC (gst_d3d11_utils_debug);
GST_DEBUG_CATEGORY_STATIC (GST_CAT_CONTEXT);
static GstDebugCategory *
_init_d3d11_utils_debug (void)
{
static volatile gsize _init = 0;
if (g_once_init_enter (&_init)) {
GST_DEBUG_CATEGORY_INIT (gst_d3d11_utils_debug, "d3d11utils", 0,
"Direct3D11 Utilities");
g_once_init_leave (&_init, 1);
}
return gst_d3d11_utils_debug;
}
GST_DEBUG_CATEGORY_EXTERN (gst_d3d11_utils_debug);
#define GST_CAT_DEFAULT gst_d3d11_utils_debug
static void
_init_context_debug (void)
@ -55,8 +42,6 @@ _init_context_debug (void)
}
}
#define GST_CAT_DEFAULT _init_d3d11_utils_debug()
/**
* gst_d3d11_handle_set_context:
* @element: a #GstElement
@ -79,7 +64,6 @@ gst_d3d11_handle_set_context (GstElement * element, GstContext * context,
g_return_val_if_fail (GST_IS_ELEMENT (element), FALSE);
g_return_val_if_fail (device != NULL, FALSE);
_init_d3d11_utils_debug ();
_init_context_debug ();
if (!context)
@ -153,7 +137,6 @@ gst_d3d11_handle_context_query (GstElement * element, GstQuery * query,
g_return_val_if_fail (GST_IS_ELEMENT (element), FALSE);
g_return_val_if_fail (GST_IS_QUERY (query), FALSE);
_init_d3d11_utils_debug ();
_init_context_debug ();
GST_LOG_OBJECT (element, "handle context query %" GST_PTR_FORMAT, query);
@ -298,7 +281,6 @@ gst_d3d11_ensure_element_data (GstElement * element, gint adapter,
g_return_val_if_fail (element != NULL, FALSE);
g_return_val_if_fail (device != NULL, FALSE);
_init_d3d11_utils_debug ();
_init_context_debug ();
if (*device) {

View file

@ -30,6 +30,9 @@
GST_DEBUG_CATEGORY (gst_d3d11_shader_debug);
GST_DEBUG_CATEGORY (gst_d3d11_colorconverter_debug);
GST_DEBUG_CATEGORY (gst_d3d11_utils_debug);
GST_DEBUG_CATEGORY (gst_d3d11_format_debug);
GST_DEBUG_CATEGORY (gst_d3d11_device_debug);
static gboolean
plugin_init (GstPlugin * plugin)
@ -38,6 +41,12 @@ plugin_init (GstPlugin * plugin)
"d3d11shader", 0, "d3d11shader");
GST_DEBUG_CATEGORY_INIT (gst_d3d11_colorconverter_debug,
"d3d11colorconverter", 0, "d3d11colorconverter");
GST_DEBUG_CATEGORY_INIT (gst_d3d11_utils_debug,
"d3d11utils", 0, "d3d11 utility functions");
GST_DEBUG_CATEGORY_INIT (gst_d3d11_format_debug,
"d3d11format", 0, "d3d11 specific formats");
GST_DEBUG_CATEGORY_INIT (gst_d3d11_device_debug,
"d3d11device", 0, "d3d11 device object");
gst_element_register (plugin,
"d3d11upload", GST_RANK_NONE, GST_TYPE_D3D11_UPLOAD);