Luma -> Alpha with v1.18

amindfv at mailbox.org amindfv at mailbox.org
Tue Jan 11 10:52:09 UTC 2022


On Mon, Jan 10, 2022 at 09:27:01PM -0500, Nicolas Dufresne wrote:
 
> To help a little, alphacombibe is a feature (of type GstElement), it needs
> to be registered in a plugin. Make sure to keep enough of plugin.c so this
> feature is registered. Notice the original plugin is named codecalpha,
> plugins .so files needs to be strictly named, since the entry function are
> deduced from it.
> 

Thank you, this helped me find and correct a few points of confusion.

After quite a lot of struggling, I'm still hitting an issue though. I suspect it might be related to different macros in different versions of GStreamer (the plugin's written for 1.20, while my local version is 1.18).

The error:

    $ make
    gcc -I. -pthread -I/usr/include/gstreamer-1.0 -I/usr/include/orc-0.4 -I/usr/include/gstreamer-1.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -Wall -g -O2 -Wall -c gstplugin.c -fPIC -DPIC -o gstplugin.o
    In file included from gstplugin.c:47:
    gstalphacombine.h:32:1: warning: data definition has no type or storage class
       32 | GST_ELEMENT_REGISTER_DECLARE (alpha_combine);
          | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
    gstalphacombine.h:32:1: warning: type defaults to ‘int’ in declaration of ‘GST_ELEMENT_REGISTER_DECLARE’ [-Wimplicit-int]
    gstalphacombine.h:32:1: warning: parameter names (without types) in function declaration
    gstplugin.c: In function ‘plugin_init’:
    gstplugin.c:73:32: error: ‘alpha_combine’ undeclared (first use in this function)
       73 |   return gst_element_register (alpha_combine, "alphacombine", GST_RANK_NONE, GST_TYPE_ALPHA_COMBINE);
          |                                ^~~~~~~~~~~~~

Below is my full diff from the plugin as defined in the GStreamer monorepo.

As always, any help would be greatly appreciated!

Thanks,
Tom

The diff:

diff --git a/subprojects/gst-plugins-bad/gst/codecalpha/gstalphacombine.c b/subprojects/gst-plugins-bad/gst/codecalpha/gstalphacombine.c
index aeefeb94f8..baee45f44a 100644
--- a/subprojects/gst-plugins-bad/gst/codecalpha/gstalphacombine.c
+++ b/subprojects/gst-plugins-bad/gst/codecalpha/gstalphacombine.c
@@ -46,10 +46,9 @@
 
 #include "gstalphacombine.h"
 
-
-#define SUPPORTED_SINK_FORMATS "{ I420, NV12 }"
-#define SUPPORTED_ALPHA_FORMATS "{ GRAY8, I420, NV12 }"
-#define SUPPORTED_SRC_FORMATS "{ A420, AV12 }"
+#define SUPPORTED_SINK_FORMATS "{ I420 }"
+#define SUPPORTED_ALPHA_FORMATS "{ GRAY8, I420 }"
+#define SUPPORTED_SRC_FORMATS "{ A420 }"
 
 /* *INDENT-OFF* */
 struct {
@@ -69,7 +68,7 @@ struct {
     .sink = GST_VIDEO_FORMAT_I420,
     .alpha = GST_VIDEO_FORMAT_NV12,
     .src = GST_VIDEO_FORMAT_A420
-  }, {
+  }, /* {
     .sink = GST_VIDEO_FORMAT_NV12,
     .alpha = GST_VIDEO_FORMAT_NV12,
     .src = GST_VIDEO_FORMAT_AV12,
@@ -81,7 +80,7 @@ struct {
     .sink = GST_VIDEO_FORMAT_NV12,
     .alpha = GST_VIDEO_FORMAT_I420,
     .src = GST_VIDEO_FORMAT_AV12
-  },
+  }, */
 };
 /* *INDENT-ON* */
 
@@ -117,8 +116,7 @@ G_DEFINE_TYPE_WITH_CODE (GstAlphaCombine, gst_alpha_combine,
     GST_DEBUG_CATEGORY_INIT (alphacombine_debug, "alphacombine", 0,
         "Alpha Combiner"));
 
-GST_ELEMENT_REGISTER_DEFINE (alpha_combine, "alphacombine",
-    GST_RANK_NONE, GST_TYPE_ALPHA_COMBINE);
+GST_ELEMENT_REGISTER_DEFINE (alpha_combine);
 
 static GstStaticPadTemplate gst_alpha_combine_sink_template =
 GST_STATIC_PAD_TEMPLATE ("sink",
diff --git a/subprojects/gst-plugins-bad/gst/codecalpha/gstplugin.c b/subprojects/gst-plugins-bad/gst/codecalpha/gstplugin.c
index ff061c58f9..1fbe127665 100644
--- a/subprojects/gst-plugins-bad/gst/codecalpha/gstplugin.c
+++ b/subprojects/gst-plugins-bad/gst/codecalpha/gstplugin.c
@@ -43,10 +43,10 @@
 
 #include <gst/gst.h>
 
-#include "gstcodecalphademux.h"
+// #include "gstcodecalphademux.h"
 #include "gstalphacombine.h"
-#include "gstvp8alphadecodebin.h"
-#include "gstvp9alphadecodebin.h"
+// #include "gstvp8alphadecodebin.h"
+// #include "gstvp9alphadecodebin.h"
 
 /* When wrapping, use the original rank plus this offset. The ad-hoc rules is
  * that hardware implementation will use PRIMARY+1 or +2 to override the
@@ -59,6 +59,7 @@
 static gboolean
 plugin_init (GstPlugin * plugin)
 {
+/*
   gboolean ret = FALSE;
 
   ret |= GST_ELEMENT_REGISTER (codec_alpha_demux, plugin);
@@ -67,10 +68,21 @@ plugin_init (GstPlugin * plugin)
   ret |= GST_ELEMENT_REGISTER (vp9_alpha_decode_bin, plugin);
 
   return ret;
+*/
+
+  return gst_element_register (alpha_combine, "alphacombine", GST_RANK_NONE, GST_TYPE_ALPHA_COMBINE);
 }
 
+#ifndef PACKAGE
+#define PACKAGE "codecalpha"
+#endif
+
+#ifndef GST_PACKAGE_NAME
+#define GST_PACKAGE_NAME "codecalpha"
+#endif
+
 GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
     GST_VERSION_MINOR,
     codecalpha,
     "CODEC Alpha Utilities",
-    plugin_init, VERSION, "LGPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
+    plugin_init, "1.0.0", "LGPL", GST_PACKAGE_NAME, "http://gstreamer.net/")
\ No newline at end of file



More information about the gstreamer-devel mailing list