summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorStéphane Cerveau <scerveau@collabora.com>2021-02-12 17:26:36 +0100
committerStéphane Cerveau <scerveau@collabora.com>2021-03-29 12:45:22 +0200
commita047a1144bf59c7affea5f164c80c816913d45a0 (patch)
tree52f7e39fb688776b92d0de46eb469098b691d92b /ext
parent6cbba1e4700cf05b9893c5eea9396bc153c1211f (diff)
downloadgstreamer-plugins-good-a047a1144bf59c7affea5f164c80c816913d45a0.tar.gz
taglib: allow per feature registration
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-good/-/merge_requests/876>
Diffstat (limited to 'ext')
-rw-r--r--ext/taglib/gstapev2mux.cc5
-rw-r--r--ext/taglib/gstid3v2mux.cc5
-rw-r--r--ext/taglib/gsttaglibelement.c38
-rw-r--r--ext/taglib/gsttaglibelements.h34
-rw-r--r--ext/taglib/gsttaglibplugin.c14
-rw-r--r--ext/taglib/meson.build1
6 files changed, 88 insertions, 9 deletions
diff --git a/ext/taglib/gstapev2mux.cc b/ext/taglib/gstapev2mux.cc
index 8a145d845..8cb61bd67 100644
--- a/ext/taglib/gstapev2mux.cc
+++ b/ext/taglib/gstapev2mux.cc
@@ -46,6 +46,7 @@
#include <config.h>
#endif
+#include "gsttaglibelements.h"
#include "gstapev2mux.h"
#include <string.h>
@@ -69,6 +70,10 @@ static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
GST_STATIC_CAPS ("ANY"));
G_DEFINE_TYPE (GstApev2Mux, gst_apev2_mux, GST_TYPE_TAG_MUX);
+#define _do_init \
+ taglib_element_init (plugin);
+GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (apev2mux, "apev2mux",
+ GST_RANK_NONE, GST_TYPE_APEV2_MUX, _do_init);
static GstBuffer *gst_apev2_mux_render_start_tag (GstTagMux * mux,
const GstTagList * taglist);
diff --git a/ext/taglib/gstid3v2mux.cc b/ext/taglib/gstid3v2mux.cc
index bc0427c4e..487a6cfac 100644
--- a/ext/taglib/gstid3v2mux.cc
+++ b/ext/taglib/gstid3v2mux.cc
@@ -47,6 +47,7 @@
#include <config.h>
#endif
+#include "gsttaglibelements.h"
#include "gstid3v2mux.h"
#include <string.h>
@@ -77,6 +78,10 @@ static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
GST_STATIC_CAPS ("ANY"));
G_DEFINE_TYPE (GstId3v2Mux, gst_id3v2_mux, GST_TYPE_TAG_MUX);
+#define _do_init \
+ taglib_element_init (plugin);
+GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (id3v2mux, "id3v2mux",
+ GST_RANK_NONE, GST_TYPE_ID3V2_MUX, _do_init);
static GstBuffer *gst_id3v2_mux_render_tag (GstTagMux * mux,
const GstTagList * taglist);
diff --git a/ext/taglib/gsttaglibelement.c b/ext/taglib/gsttaglibelement.c
new file mode 100644
index 000000000..ffb658dff
--- /dev/null
+++ b/ext/taglib/gsttaglibelement.c
@@ -0,0 +1,38 @@
+/* GStreamer taglib-based muxer base class
+ * Copyright (C) 2006 Christophe Fergeau <teuf@gnome.org>
+ * Copyright (C) 2006 Tim-Philipp Müller <tim centricular net>
+ * Copyright (C) 2006 Sebastian Dröge <slomo@circular-chaos.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 "gsttaglibelements.h"
+
+#include <gst/tag/tag.h>
+
+void
+taglib_element_init (GstPlugin * plugin)
+{
+ static gsize res = FALSE;
+ if (g_once_init_enter (&res)) {
+ gst_tag_register_musicbrainz_tags ();
+ g_once_init_leave (&res, TRUE);
+ }
+}
diff --git a/ext/taglib/gsttaglibelements.h b/ext/taglib/gsttaglibelements.h
new file mode 100644
index 000000000..b0f322632
--- /dev/null
+++ b/ext/taglib/gsttaglibelements.h
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd.
+ * @Author: Julian Bouzas <julian.bouzas@collabora.com>
+ *
+ * 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_TAGLIB_ELEMENTS_H__
+#define __GST_TAGLIB_ELEMENTS_H__
+
+#include <gst/gst.h>
+
+G_BEGIN_DECLS
+
+void taglib_element_init (GstPlugin * plugin);
+
+GST_ELEMENT_REGISTER_DECLARE (id3v2mux);
+GST_ELEMENT_REGISTER_DECLARE (apev2mux);
+
+G_END_DECLS
+
+#endif /* __GST_TAGLIB_ELEMENTS_H__ */
diff --git a/ext/taglib/gsttaglibplugin.c b/ext/taglib/gsttaglibplugin.c
index dce6bf6d1..bfb799103 100644
--- a/ext/taglib/gsttaglibplugin.c
+++ b/ext/taglib/gsttaglibplugin.c
@@ -23,23 +23,19 @@
#include <config.h>
#endif
-#include "gstapev2mux.h"
-#include "gstid3v2mux.h"
+#include "gsttaglibelements.h"
#include <gst/tag/tag.h>
static gboolean
plugin_init (GstPlugin * plugin)
{
- if (!gst_element_register (plugin, "id3v2mux", GST_RANK_NONE,
- GST_TYPE_ID3V2_MUX) ||
- !gst_element_register (plugin, "apev2mux", GST_RANK_NONE,
- GST_TYPE_APEV2_MUX))
- return FALSE;
+ gboolean ret = FALSE;
- gst_tag_register_musicbrainz_tags ();
+ ret |= GST_ELEMENT_REGISTER (id3v2mux, plugin);
+ ret |= GST_ELEMENT_REGISTER (apev2mux, plugin);
- return TRUE;
+ return ret;
}
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
diff --git a/ext/taglib/meson.build b/ext/taglib/meson.build
index dcea2c58e..18f705753 100644
--- a/ext/taglib/meson.build
+++ b/ext/taglib/meson.build
@@ -1,6 +1,7 @@
taglib_sources = [
'gstapev2mux.cc',
'gstid3v2mux.cc',
+ 'gsttaglibelement.c',
'gsttaglibplugin.c',
]