rawparse: allow per feature registration
authorStéphane Cerveau <scerveau@collabora.com>
Tue, 1 Dec 2020 14:14:00 +0000 (15:14 +0100)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Tue, 16 Mar 2021 17:58:59 +0000 (17:58 +0000)
Split plugin into features including
dynamic types which can be indiviually
registered during a static build.

More details here:

https://gitlab.freedesktop.org/gstreamer/gst-build/-/merge_requests/199
https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/661

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

gst/rawparse/gstrawaudioparse.c
gst/rawparse/gstrawparseelements.h [new file with mode: 0644]
gst/rawparse/gstrawvideoparse.c
gst/rawparse/gstunalignedaudioparse.c
gst/rawparse/gstunalignedvideoparse.c
gst/rawparse/plugin.c

index 5ed592f..4817341 100644 (file)
@@ -77,6 +77,7 @@
 #define GLIB_DISABLE_DEPRECATION_WARNINGS
 
 #include <string.h>
+#include "gstrawparseelements.h"
 #include "gstrawaudioparse.h"
 #include "unalignedaudio.h"
 
@@ -122,6 +123,8 @@ GST_STATIC_PAD_TEMPLATE ("src",
 
 #define gst_raw_audio_parse_parent_class parent_class
 G_DEFINE_TYPE (GstRawAudioParse, gst_raw_audio_parse, GST_TYPE_RAW_BASE_PARSE);
+GST_ELEMENT_REGISTER_DEFINE (rawaudioparse, "rawaudioparse",
+    GST_RANK_NONE, GST_TYPE_RAW_AUDIO_PARSE);
 
 static void gst_raw_audio_parse_set_property (GObject * object, guint prop_id,
     GValue const *value, GParamSpec * pspec);
diff --git a/gst/rawparse/gstrawparseelements.h b/gst/rawparse/gstrawparseelements.h
new file mode 100644 (file)
index 0000000..89da23e
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) <2020> The GStreamer Contributors.
+ *
+ * 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_RAWPARSE_ELEMENTS_H__
+#define __GST_RAWPARSE_ELEMENTS_H__
+
+#ifdef HAVE_CONFIG_H
+#  include "config.h"
+#endif
+
+#include <gst/gst.h>
+
+G_BEGIN_DECLS
+
+GST_ELEMENT_REGISTER_DECLARE (unalignedaudioparse);
+GST_ELEMENT_REGISTER_DECLARE (unalignedvideoparse);
+GST_ELEMENT_REGISTER_DECLARE (rawaudioparse);
+GST_ELEMENT_REGISTER_DECLARE (rawvideoparse);
+
+G_END_DECLS
+
+#endif /* __GST_RAWPARSE_ELEMENTS_H__ */
index 2b77f05..066dd2a 100644 (file)
@@ -75,6 +75,7 @@
 #endif
 
 #include <string.h>
+#include "gstrawparseelements.h"
 #include "gstrawvideoparse.h"
 #include "unalignedvideo.h"
 
@@ -127,6 +128,8 @@ GST_STATIC_PAD_TEMPLATE ("src",
 
 #define gst_raw_video_parse_parent_class parent_class
 G_DEFINE_TYPE (GstRawVideoParse, gst_raw_video_parse, GST_TYPE_RAW_BASE_PARSE);
+GST_ELEMENT_REGISTER_DEFINE (rawvideoparse, "rawvideoparse",
+    GST_RANK_NONE, GST_TYPE_RAW_VIDEO_PARSE);
 
 static void gst_raw_video_parse_set_property (GObject * object, guint prop_id,
     GValue const *value, GParamSpec * pspec);
index 9c57232..12bfe43 100644 (file)
@@ -24,6 +24,7 @@
 #include <gst/gst.h>
 #include <gst/audio/audio.h>
 #include "gstunalignedaudioparse.h"
+#include "gstrawparseelements.h"
 #include "unalignedaudio.h"
 
 GST_DEBUG_CATEGORY (unaligned_audio_parse_debug);
@@ -51,6 +52,8 @@ GST_STATIC_PAD_TEMPLATE ("src",
     );
 
 G_DEFINE_TYPE (GstUnalignedAudioParse, gst_unaligned_audio_parse, GST_TYPE_BIN);
+GST_ELEMENT_REGISTER_DEFINE (unalignedaudioparse,
+    "unalignedaudioparse", GST_RANK_MARGINAL, GST_TYPE_UNALIGNED_AUDIO_PARSE);
 
 static void
 gst_unaligned_audio_parse_class_init (GstUnalignedAudioParseClass * klass)
index 7135f26..cb1e37d 100644 (file)
@@ -24,6 +24,7 @@
 #include <gst/gst.h>
 #include <gst/video/video.h>
 #include "gstunalignedvideoparse.h"
+#include "gstrawparseelements.h"
 #include "unalignedvideo.h"
 
 GST_DEBUG_CATEGORY (unaligned_video_parse_debug);
@@ -50,6 +51,8 @@ GST_STATIC_PAD_TEMPLATE ("src",
     );
 
 G_DEFINE_TYPE (GstUnalignedVideoParse, gst_unaligned_video_parse, GST_TYPE_BIN);
+GST_ELEMENT_REGISTER_DEFINE (unalignedvideoparse,
+    "unalignedvideoparse", GST_RANK_MARGINAL, GST_TYPE_UNALIGNED_VIDEO_PARSE);
 
 static void
 gst_unaligned_video_parse_class_init (GstUnalignedVideoParseClass * klass)
index 5cc561e..6dd1bb9 100644 (file)
@@ -1,26 +1,38 @@
+/*
+ * Copyright (C) <2016> Carlos Rafael Giani <dv at pseudoterminal dot org>
+ *
+ * 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.
+ */
+
 #ifdef HAVE_CONFIG_H
 #  include "config.h"
 #endif
 
 #include <gst/gst.h>
-#include "gstrawaudioparse.h"
-#include "gstrawvideoparse.h"
-#include "gstunalignedaudioparse.h"
-#include "gstunalignedvideoparse.h"
+
+#include "gstrawparseelements.h"
 
 static gboolean
 plugin_init (GstPlugin * plugin)
 {
-  gboolean ret = TRUE;
+  gboolean ret = FALSE;
 
-  ret &= gst_element_register (plugin, "unalignedaudioparse", GST_RANK_MARGINAL,
-      gst_unaligned_audio_parse_get_type ());
-  ret &= gst_element_register (plugin, "unalignedvideoparse", GST_RANK_MARGINAL,
-      gst_unaligned_video_parse_get_type ());
-  ret &= gst_element_register (plugin, "rawaudioparse", GST_RANK_NONE,
-      gst_raw_audio_parse_get_type ());
-  ret &= gst_element_register (plugin, "rawvideoparse", GST_RANK_NONE,
-      gst_raw_video_parse_get_type ());
+  ret |= GST_ELEMENT_REGISTER (unalignedaudioparse, plugin);
+  ret |= GST_ELEMENT_REGISTER (unalignedvideoparse, plugin);
+  ret |= GST_ELEMENT_REGISTER (rawaudioparse, plugin);
+  ret |= GST_ELEMENT_REGISTER (rawvideoparse, plugin);
 
   return ret;
 }