vorbis: 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-base/-/merge_requests/1029>
This commit is contained in:
Stéphane Cerveau 2020-12-11 17:56:13 +01:00 committed by GStreamer Marge Bot
parent 5e728ee5b5
commit 2a8adec5f2
9 changed files with 110 additions and 43 deletions

View file

@ -21,22 +21,21 @@
#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,

View file

@ -21,49 +21,19 @@
#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;
gboolean ret = FALSE;
if (!gst_element_register (plugin, "vorbisdec", GST_RANK_PRIMARY,
gst_vorbis_dec_get_type ()))
return FALSE;
ret |= GST_ELEMENT_REGISTER (vorbisenc, plugin);
ret |= GST_ELEMENT_REGISTER (vorbisdec, plugin);
ret |= GST_ELEMENT_REGISTER (vorbisparse, plugin);
ret |= GST_ELEMENT_REGISTER (vorbistag, plugin);
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");
gst_tag_register_musicbrainz_tags ();
return TRUE;
return ret;
}
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,

View file

@ -44,6 +44,7 @@
#include <gst/audio/audio.h>
#include <gst/tag/tag.h>
#include "gstvorbiselements.h"
#include "gstvorbiscommon.h"
#ifndef TREMOR
@ -69,6 +70,11 @@ GST_STATIC_PAD_TEMPLATE ("sink",
#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);

View file

@ -0,0 +1,43 @@
/* 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);
}
}

View file

@ -0,0 +1,38 @@
/*
* 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__ */

View file

@ -52,6 +52,7 @@
#include <gst/audio/audio.h>
#include "gstvorbisenc.h"
#include "gstvorbiselements.h"
#include "gstvorbiscommon.h"
GST_DEBUG_CATEGORY_EXTERN (vorbisenc_debug);
@ -108,6 +109,8 @@ static void gst_vorbis_enc_flush (GstAudioEncoder * vorbisenc);
#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)

View file

@ -53,6 +53,7 @@
# include "config.h"
#endif
#include "gstvorbiselements.h"
#include "gstvorbisparse.h"
GST_DEBUG_CATEGORY_EXTERN (vorbisparse_debug);
@ -74,6 +75,8 @@ GST_STATIC_PAD_TEMPLATE ("src",
#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);

View file

@ -55,6 +55,7 @@
#include <vorbis/codec.h>
#include "gstvorbiselements.h"
#include "gstvorbistag.h"
@ -67,6 +68,8 @@ static GstFlowReturn gst_vorbis_tag_parse_packet (GstVorbisParse * parse,
#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)

View file

@ -1,5 +1,6 @@
vorbis_sources = [
'gstvorbis.c',
'gstvorbiselement.c',
'gstvorbisdec.c',
'gstvorbisdeclib.c',
'gstvorbisenc.c',
@ -10,6 +11,7 @@ vorbis_sources = [
vorbisidec_sources = [
'gstivorbisdec.c',
'gstvorbiselement.c',
'gstvorbisdec.c',
'gstvorbisdeclib.c',
'gstvorbiscommon.c',