#include <config.h>
#endif
-#include "gstopusdec.h"
-#include "gstopusenc.h"
-
-#include <gst/tag/tag.h>
+#include "gstopuselements.h"
static gboolean
plugin_init (GstPlugin * plugin)
{
+ gboolean ret = FALSE;
- if (!gst_element_register (plugin, "opusenc", GST_RANK_PRIMARY,
- GST_TYPE_OPUS_ENC))
- return FALSE;
-
- if (!gst_element_register (plugin, "opusdec", GST_RANK_PRIMARY,
- GST_TYPE_OPUS_DEC))
- return FALSE;
-
- gst_tag_register_musicbrainz_tags ();
+ ret |= GST_ELEMENT_REGISTER (opusenc, plugin);
+ ret |= GST_ELEMENT_REGISTER (opusdec, plugin);
- return TRUE;
+ return ret;
}
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
#include <math.h>
#include <string.h>
#include <stdio.h>
+#include "gstopuselements.h"
#include "gstopusheader.h"
#include "gstopuscommon.h"
#include "gstopusdec.h"
);
G_DEFINE_TYPE (GstOpusDec, gst_opus_dec, GST_TYPE_AUDIO_DECODER);
+GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (opusdec, "opusdec",
+ GST_RANK_PRIMARY, GST_TYPE_OPUS_DEC, opus_element_init (plugin));
#define DB_TO_LINEAR(x) pow (10., (x) / 20.)
--- /dev/null
+/* GStreamer
+ * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
+ * Copyright (C) <2008> Sebastian Dröge <sebastian.droege@collabora.co.uk>
+ * 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.
+ */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "gstopuselements.h"
+
+#include <gst/tag/tag.h>
+
+void
+opus_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);
+ }
+}
--- /dev/null
+/*
+ * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
+ * Copyright (C) <2008> Sebastian Dröge <sebastian.droege@collabora.co.uk>
+ * 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_OPUS_ELEMENTS_H__
+#define __GST_OPUS_ELEMENTS_H__
+
+#include <gst/gst.h>
+
+G_BEGIN_DECLS
+
+
+G_GNUC_INTERNAL void opus_element_init (GstPlugin * plugin);
+
+GST_ELEMENT_REGISTER_DECLARE (opusenc);
+GST_ELEMENT_REGISTER_DECLARE (opusdec);
+
+G_END_DECLS
+
+#endif /* __GST_OPUS_ELEMENTS_H__ */
#include <gst/pbutils/pbutils.h>
#include <gst/tag/tag.h>
#include <gst/glib-compat-private.h>
+
+#include "gstopuselements.h"
#include "gstopusheader.h"
#include "gstopuscommon.h"
#include "gstopusenc.h"
G_DEFINE_TYPE_WITH_CODE (GstOpusEnc, gst_opus_enc, GST_TYPE_AUDIO_ENCODER,
G_IMPLEMENT_INTERFACE (GST_TYPE_TAG_SETTER, NULL);
G_IMPLEMENT_INTERFACE (GST_TYPE_PRESET, NULL));
+GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (opusenc, "opusenc",
+ GST_RANK_PRIMARY, GST_TYPE_OPUS_ENC, opus_element_init (plugin));
static void
gst_opus_enc_set_tags (GstOpusEnc * enc)
opus_sources = [
'gstopus.c',
+ 'gstopuselement.c',
'gstopuscommon.c',
'gstopusdec.c',
'gstopusenc.c',