From ea9b837b079244b2cb4b1905cb4664e9f966b20a Mon Sep 17 00:00:00 2001
From: Philippe Normand <philn@igalia.com>
Date: Sun, 14 May 2023 13:33:05 +0100
Subject: [PATCH] video: convertframe: Add a debug category

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4629>
---
 .../gst-libs/gst/video/convertframe.c         | 22 +++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/subprojects/gst-plugins-base/gst-libs/gst/video/convertframe.c b/subprojects/gst-plugins-base/gst-libs/gst/video/convertframe.c
index 64d6a45815..fd14c6b4f4 100644
--- a/subprojects/gst-plugins-base/gst-libs/gst/video/convertframe.c
+++ b/subprojects/gst-plugins-base/gst-libs/gst/video/convertframe.c
@@ -28,6 +28,28 @@
 #include <gst/gl/gstglmemory.h>
 #endif
 
+#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 ("video-frame-converter", 0,
+        "video-frame-converter object");
+
+    g_once_init_leave (&cat_gonce, cat_done);
+  }
+
+  return (GstDebugCategory *) cat_gonce;
+}
+#else
+#define ensure_debug_category() /* NOOP */
+#endif /* GST_DISABLE_GST_DEBUG */
+
 static gboolean
 caps_are_raw (const GstCaps * caps)
 {