videocrop: Resurrect logging category.
authorVíctor Manuel Jáquez Leal <vjaquez@igalia.com>
Wed, 11 Aug 2021 12:52:52 +0000 (14:52 +0200)
committerVíctor Manuel Jáquez Leal <vjaquez@igalia.com>
Wed, 11 Aug 2021 14:09:06 +0000 (16:09 +0200)
Fix for a regression from commit 8f1384c9. That commit moved the debug
category definition, as static, into a gstvideocropelement.c, but that
category was used as default, in gstvideocrop.c, so it was never used
at logging, so the debug selector never showed the logs for
videocrop.

This patch move back the category definition into gstvideocrop.c and
leaving the function videocrop_element_init() as a noop.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/1049>

gst/videocrop/gstaspectratiocrop.c
gst/videocrop/gstaspectratiocrop.h
gst/videocrop/gstvideocrop.c
gst/videocrop/gstvideocrop.h
gst/videocrop/gstvideocropelement.c [deleted file]
gst/videocrop/gstvideocropelements.h [deleted file]
gst/videocrop/gstvideocropplugin.c
gst/videocrop/meson.build

index 9df2e5e..6aa6597 100644 (file)
@@ -42,7 +42,6 @@
 #include <gst/video/video.h>
 
 #include "gstvideocrop.h"
-#include "gstvideocropelements.h"
 #include "gstaspectratiocrop.h"
 /* include private header which contains the supported formats */
 #include "gstvideocrop-private.h"
@@ -75,8 +74,8 @@ static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
 
 #define gst_aspect_ratio_crop_parent_class parent_class
 G_DEFINE_TYPE (GstAspectRatioCrop, gst_aspect_ratio_crop, GST_TYPE_BIN);
-GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (aspectratiocrop, "aspectratiocrop",
-    GST_RANK_NONE, GST_TYPE_ASPECT_RATIO_CROP, videocrop_element_init (plugin));
+GST_ELEMENT_REGISTER_DEFINE (aspectratiocrop, "aspectratiocrop", GST_RANK_NONE,
+    GST_TYPE_ASPECT_RATIO_CROP);
 
 static void gst_aspect_ratio_crop_set_property (GObject * object, guint prop_id,
     const GValue * value, GParamSpec * pspec);
index 9cb2ef7..2fcec99 100644 (file)
@@ -35,6 +35,8 @@ G_BEGIN_DECLS
 #define GST_IS_ASPECT_RATIO_CROP_CLASS(klass) \
   (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_ASPECT_RATIO_CROP))
 
+GST_ELEMENT_REGISTER_DECLARE (aspectratiocrop);
+
 typedef struct _GstAspectRatioCrop GstAspectRatioCrop;
 typedef struct _GstAspectRatioCropClass GstAspectRatioCropClass;
 
index 1a61487..cc3175f 100644 (file)
 #include <gst/video/video.h>
 
 #include "gstvideocrop.h"
-#include "gstvideocropelements.h"
 #include "gstaspectratiocrop.h"
 /* include private header which contains the supported formats */
 #include "gstvideocrop-private.h"
 
 #include <string.h>
 
+GST_DEBUG_CATEGORY_STATIC (videocrop_debug);
+#define GST_CAT_DEFAULT videocrop_debug
 
 enum
 {
@@ -92,8 +93,8 @@ static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
 
 #define gst_video_crop_parent_class parent_class
 G_DEFINE_TYPE (GstVideoCrop, gst_video_crop, GST_TYPE_VIDEO_FILTER);
-GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (videocrop, "videocrop", GST_RANK_NONE,
-    GST_TYPE_VIDEO_CROP, videocrop_element_init (plugin));
+GST_ELEMENT_REGISTER_DEFINE (videocrop, "videocrop", GST_RANK_NONE,
+    GST_TYPE_VIDEO_CROP);
 
 static void gst_video_crop_set_property (GObject * object, guint prop_id,
     const GValue * value, GParamSpec * pspec);
@@ -231,6 +232,8 @@ gst_video_crop_class_init (GstVideoCropClass * klass)
 static void
 gst_video_crop_init (GstVideoCrop * vcrop)
 {
+  GST_DEBUG_CATEGORY_INIT (videocrop_debug, "videocrop", 0, "videocrop");
+
   vcrop->crop_right = 0;
   vcrop->crop_left = 0;
   vcrop->crop_top = 0;
index 528bf18..6a05fb2 100644 (file)
@@ -33,7 +33,10 @@ G_BEGIN_DECLS
   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_VIDEO_CROP))
 #define GST_IS_VIDEO_CROP_CLASS(klass) \
   (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_VIDEO_CROP))
-    typedef enum
+
+GST_ELEMENT_REGISTER_DECLARE (videocrop);
+
+typedef enum
 {
   /* RGB (+ variants), ARGB (+ variants), AYUV, GRAY */
   VIDEO_CROP_PIXEL_FORMAT_PACKED_SIMPLE = 0,
diff --git a/gst/videocrop/gstvideocropelement.c b/gst/videocrop/gstvideocropelement.c
deleted file mode 100644 (file)
index db1a1cb..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-/* GStreamer video frame cropping
- * Copyright (C) 2006 Tim-Philipp Müller <tim centricular net>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-/**
- * SECTION:element-videocrop
- * @title: videocrop
- * @see_also: #GstVideoBox
- *
- * This element crops video frames, meaning it can remove parts of the
- * picture on the left, right, top or bottom of the picture and output
- * a smaller picture than the input picture, with the unwanted parts at the
- * border removed.
- *
- * The videocrop element is similar to the videobox element, but its main
- * goal is to support a multitude of formats as efficiently as possible.
- * Unlike videbox, it cannot add borders to the picture and unlike videbox
- * it will always output images in exactly the same format as the input image.
- *
- * If there is nothing to crop, the element will operate in pass-through mode.
- *
- * Note that no special efforts are made to handle chroma-subsampled formats
- * in the case of odd-valued cropping and compensate for sub-unit chroma plane
- * shifts for such formats in the case where the #GstVideoCrop:left or
- * #GstVideoCrop:top property is set to an odd number. This doesn't matter for
- * most use cases, but it might matter for yours.
- *
- * ## Example launch line
- * |[
- * gst-launch-1.0 -v videotestsrc ! videocrop top=42 left=1 right=4 bottom=0 ! ximagesink
- * ]|
- *
- */
-
-/* TODO:
- *  - for packed formats, we could avoid memcpy() in case crop_left
- *    and crop_right are 0 and just create a sub-buffer of the input
- *    buffer
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/gst.h>
-#include <gst/video/video.h>
-
-#include "gstvideocropelements.h"
-
-GST_DEBUG_CATEGORY_STATIC (videocrop_debug);
-#define GST_CAT_DEFAULT videocrop_debug
-
-void
-videocrop_element_init (GstPlugin * plugin)
-{
-  static gsize res = FALSE;
-  if (g_once_init_enter (&res)) {
-    GST_DEBUG_CATEGORY_INIT (videocrop_debug, "videocrop", 0, "videocrop");
-    g_once_init_leave (&res, TRUE);
-  }
-}
diff --git a/gst/videocrop/gstvideocropelements.h b/gst/videocrop/gstvideocropelements.h
deleted file mode 100644 (file)
index 42b4081..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/* GStreamer video frame cropping
- * Copyright (C) 2006 Tim-Philipp Müller <tim centricular net>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef __GST_VIDEO_CROP_ELEMENTS_H__
-#define __GST_VIDEO_CROP_ELEMENTS_H__
-
-#include <gst/video/gstvideofilter.h>
-
-G_BEGIN_DECLS
-
-void videocrop_element_init (GstPlugin * plugin);
-
-GST_ELEMENT_REGISTER_DECLARE (aspectratiocrop);
-GST_ELEMENT_REGISTER_DECLARE (videocrop);
-
-G_END_DECLS
-
-#endif /* __GST_VIDEO_CROP_ELEMENTS_H__ */
index e10ae10..8502fca 100644 (file)
@@ -22,7 +22,8 @@
 #include "config.h"
 #endif
 
-#include "gstvideocropelements.h"
+#include "gstaspectratiocrop.h"
+#include "gstvideocrop.h"
 
 static gboolean
 plugin_init (GstPlugin * plugin)
index fd6b67a..439c901 100644 (file)
@@ -1,5 +1,5 @@
 gstvideocrop = library('gstvideocrop',
-  'gstvideocrop.c', 'gstaspectratiocrop.c','gstvideocropelement.c', 'gstvideocropplugin.c',
+  'gstvideocrop.c', 'gstaspectratiocrop.c', 'gstvideocropplugin.c',
   c_args : gst_plugins_good_args,
   include_directories : [configinc, libsinc],
   dependencies : [gst_dep, gstbase_dep, gstvideo_dep],