#include "config.h"
#endif
-#include "gstvorbisdec.h"
+#include "gstvorbiselements.h"
GST_DEBUG_CATEGORY (ivorbisdec_debug);
static gboolean
plugin_init (GstPlugin * plugin)
{
-
- if (!gst_element_register (plugin, "ivorbisdec", GST_RANK_SECONDARY,
- gst_vorbis_dec_get_type ()))
- return FALSE;
+ gboolean ret = FALSE;
GST_DEBUG_CATEGORY_INIT (ivorbisdec_debug, "ivorbisdec", 0,
"vorbis decoding element (integer decoder)");
- return TRUE;
+ ret |= GST_ELEMENT_REGISTER (ivorbisdec, plugin);
+
+ return ret;
}
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
#include "config.h"
#endif
-#include "gst/tag/tag.h"
-
-#include "gstvorbisenc.h"
-#include "gstvorbisdec.h"
-#include "gstvorbisparse.h"
-#include "gstvorbistag.h"
-
-GST_DEBUG_CATEGORY (vorbisenc_debug);
-GST_DEBUG_CATEGORY (vorbisdec_debug);
-GST_DEBUG_CATEGORY (vorbisparse_debug);
-GST_DEBUG_CATEGORY (vorbistag_debug);
+#include "gstvorbiselements.h"
static gboolean
plugin_init (GstPlugin * plugin)
{
- if (!gst_element_register (plugin, "vorbisenc", GST_RANK_PRIMARY,
- GST_TYPE_VORBISENC))
- return FALSE;
-
- if (!gst_element_register (plugin, "vorbisdec", GST_RANK_PRIMARY,
- gst_vorbis_dec_get_type ()))
- return FALSE;
-
- if (!gst_element_register (plugin, "vorbisparse", GST_RANK_NONE,
- gst_vorbis_parse_get_type ()))
- return FALSE;
-
- if (!gst_element_register (plugin, "vorbistag", GST_RANK_NONE,
- gst_vorbis_tag_get_type ()))
- return FALSE;
-
- GST_DEBUG_CATEGORY_INIT (vorbisenc_debug, "vorbisenc", 0,
- "vorbis encoding element");
- GST_DEBUG_CATEGORY_INIT (vorbisdec_debug, "vorbisdec", 0,
- "vorbis decoding element");
- GST_DEBUG_CATEGORY_INIT (vorbisparse_debug, "vorbisparse", 0,
- "vorbis parsing element");
- GST_DEBUG_CATEGORY_INIT (vorbistag_debug, "vorbistag", 0,
- "vorbis tagging element");
+ gboolean ret = FALSE;
- gst_tag_register_musicbrainz_tags ();
+ ret |= GST_ELEMENT_REGISTER (vorbisenc, plugin);
+ ret |= GST_ELEMENT_REGISTER (vorbisdec, plugin);
+ ret |= GST_ELEMENT_REGISTER (vorbisparse, plugin);
+ ret |= GST_ELEMENT_REGISTER (vorbistag, plugin);
- return TRUE;
+ return ret;
}
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
#include <gst/audio/audio.h>
#include <gst/tag/tag.h>
+#include "gstvorbiselements.h"
#include "gstvorbiscommon.h"
#ifndef TREMOR
#define gst_vorbis_dec_parent_class parent_class
G_DEFINE_TYPE (GstVorbisDec, gst_vorbis_dec, GST_TYPE_AUDIO_DECODER);
+GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (vorbisdec, "vorbisdec",
+ GST_RANK_PRIMARY, GST_TYPE_VORBIS_DEC, vorbis_element_init (plugin));
+
+GST_ELEMENT_REGISTER_DEFINE (ivorbisdec, "ivorbisdec",
+ GST_RANK_SECONDARY, GST_TYPE_VORBIS_DEC);
static void vorbis_dec_finalize (GObject * object);
--- /dev/null
+/* GStreamer
+ * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd.
+ * @Author: Stéphane Cerveau <scerveau@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 "gstvorbiselements.h"
+#include "gst/tag/tag.h"
+
+GST_DEBUG_CATEGORY (vorbisenc_debug);
+GST_DEBUG_CATEGORY (vorbisdec_debug);
+GST_DEBUG_CATEGORY (vorbisparse_debug);
+GST_DEBUG_CATEGORY (vorbistag_debug);
+
+void
+vorbis_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) 2020 Huawei Technologies Co., Ltd.
+ * @Author: Stéphane Cerveau <scerveau@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_VORBIS_ELEMENTS_H__
+#define __GST_VORBIS_ELEMENTS_H__
+
+#include <gst/gst.h>
+
+G_BEGIN_DECLS
+
+G_GNUC_INTERNAL void vorbis_element_init (GstPlugin * plugin);
+
+GST_ELEMENT_REGISTER_DECLARE (vorbisenc);
+GST_ELEMENT_REGISTER_DECLARE (vorbisdec);
+GST_ELEMENT_REGISTER_DECLARE (vorbisparse);
+GST_ELEMENT_REGISTER_DECLARE (vorbistag);
+GST_ELEMENT_REGISTER_DECLARE (ivorbisdec);
+
+G_END_DECLS
+
+#endif /* __GST_VORBIS_ELEMENTS_H__ */
#include <gst/audio/audio.h>
#include "gstvorbisenc.h"
+#include "gstvorbiselements.h"
#include "gstvorbiscommon.h"
GST_DEBUG_CATEGORY_EXTERN (vorbisenc_debug);
#define gst_vorbis_enc_parent_class parent_class
G_DEFINE_TYPE_WITH_CODE (GstVorbisEnc, gst_vorbis_enc,
GST_TYPE_AUDIO_ENCODER, G_IMPLEMENT_INTERFACE (GST_TYPE_TAG_SETTER, NULL));
+GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (vorbisenc, "vorbisenc",
+ GST_RANK_PRIMARY, GST_TYPE_VORBISENC, vorbis_element_init (plugin));
static void
gst_vorbis_enc_class_init (GstVorbisEncClass * klass)
# include "config.h"
#endif
+#include "gstvorbiselements.h"
#include "gstvorbisparse.h"
GST_DEBUG_CATEGORY_EXTERN (vorbisparse_debug);
#define gst_vorbis_parse_parent_class parent_class
G_DEFINE_TYPE (GstVorbisParse, gst_vorbis_parse, GST_TYPE_ELEMENT);
+GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (vorbisparse, "vorbisparse",
+ GST_RANK_NONE, GST_TYPE_VORBIS_PARSE, vorbis_element_init (plugin));
static GstFlowReturn vorbis_parse_chain (GstPad * pad, GstObject * parent,
GstBuffer * buffer);
#include <vorbis/codec.h>
+#include "gstvorbiselements.h"
#include "gstvorbistag.h"
#define gst_vorbis_tag_parent_class parent_class
G_DEFINE_TYPE_WITH_CODE (GstVorbisTag, gst_vorbis_tag,
GST_TYPE_VORBIS_PARSE, G_IMPLEMENT_INTERFACE (GST_TYPE_TAG_SETTER, NULL));
+GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (vorbistag, "vorbistag",
+ GST_RANK_NONE, GST_TYPE_VORBIS_TAG, vorbis_element_init (plugin));
static void
gst_vorbis_tag_class_init (GstVorbisTagClass * klass)
vorbis_sources = [
'gstvorbis.c',
+ 'gstvorbiselement.c',
'gstvorbisdec.c',
'gstvorbisdeclib.c',
'gstvorbisenc.c',
vorbisidec_sources = [
'gstivorbisdec.c',
+ 'gstvorbiselement.c',
'gstvorbisdec.c',
'gstvorbisdeclib.c',
'gstvorbiscommon.c',