vorbis: avoid duplicate symbols

Use TREMOR define to avoid duplicate symbols
of ivodebis and vorbis plugins when
static linking GStreamer.

Rearrange debug category init.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1116>
This commit is contained in:
Stéphane Cerveau 2021-04-21 10:27:10 +02:00
parent e785560687
commit 74346080ba
6 changed files with 30 additions and 36 deletions

View file

@ -23,19 +23,10 @@
#include "gstvorbiselements.h"
GST_DEBUG_CATEGORY (ivorbisdec_debug);
static gboolean
plugin_init (GstPlugin * plugin)
{
gboolean ret = FALSE;
GST_DEBUG_CATEGORY_INIT (ivorbisdec_debug, "ivorbisdec", 0,
"vorbis decoding element (integer decoder)");
ret |= GST_ELEMENT_REGISTER (ivorbisdec, plugin);
return ret;
return GST_ELEMENT_REGISTER (ivorbisdec, plugin);
}
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,

View file

@ -48,10 +48,10 @@
#include "gstvorbiscommon.h"
#ifndef TREMOR
GST_DEBUG_CATEGORY_EXTERN (vorbisdec_debug);
GST_DEBUG_CATEGORY_STATIC (vorbisdec_debug);
#define GST_CAT_DEFAULT vorbisdec_debug
#else
GST_DEBUG_CATEGORY_EXTERN (ivorbisdec_debug);
GST_DEBUG_CATEGORY_STATIC (ivorbisdec_debug);
#define GST_CAT_DEFAULT ivorbisdec_debug
#endif
@ -70,11 +70,19 @@ GST_STATIC_PAD_TEMPLATE ("sink",
#define gst_vorbis_dec_parent_class parent_class
G_DEFINE_TYPE (GstVorbisDec, gst_vorbis_dec, GST_TYPE_AUDIO_DECODER);
#ifndef TREMOR
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);
GST_RANK_PRIMARY, GST_TYPE_VORBIS_DEC,
GST_DEBUG_CATEGORY_INIT (vorbisdec_debug, "vorbisdec", 0,
"vorbis decoding element");
vorbis_element_init (plugin));
#else
GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (ivorbisdec, "ivorbisdec",
GST_RANK_SECONDARY, GST_TYPE_VORBIS_DEC,
GST_DEBUG_CATEGORY_INIT (ivorbisdec_debug, "ivorbisdec", 0,
"vorbis decoding element (integer decoder)");
vorbis_element_init (plugin));
#endif
static void vorbis_dec_finalize (GObject * object);

View file

@ -26,10 +26,6 @@
#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)
@ -39,15 +35,6 @@ vorbis_element_init (GstPlugin * plugin)
if (g_once_init_enter (&res)) {
gst_tag_register_musicbrainz_tags ();
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");
g_once_init_leave (&res, TRUE);
}
}

View file

@ -55,7 +55,7 @@
#include "gstvorbiselements.h"
#include "gstvorbiscommon.h"
GST_DEBUG_CATEGORY_EXTERN (vorbisenc_debug);
GST_DEBUG_CATEGORY_STATIC (vorbisenc_debug);
#define GST_CAT_DEFAULT vorbisenc_debug
static GstStaticPadTemplate vorbis_enc_src_factory =
@ -110,7 +110,10 @@ static void gst_vorbis_enc_flush (GstAudioEncoder * vorbisenc);
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));
GST_RANK_PRIMARY, GST_TYPE_VORBISENC,
GST_DEBUG_CATEGORY_INIT (vorbisenc_debug, "vorbisenc", 0,
"vorbis encoding element");
vorbis_element_init (plugin));
static void
gst_vorbis_enc_class_init (GstVorbisEncClass * klass)

View file

@ -56,7 +56,7 @@
#include "gstvorbiselements.h"
#include "gstvorbisparse.h"
GST_DEBUG_CATEGORY_EXTERN (vorbisparse_debug);
GST_DEBUG_CATEGORY_STATIC (vorbisparse_debug);
#define GST_CAT_DEFAULT vorbisparse_debug
static GstStaticPadTemplate vorbis_parse_sink_factory =
@ -76,7 +76,10 @@ 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));
GST_RANK_NONE, GST_TYPE_VORBIS_PARSE,
GST_DEBUG_CATEGORY_INIT (vorbisparse_debug, "vorbisparse", 0,
"vorbis parsing element");
vorbis_element_init (plugin));
static GstFlowReturn vorbis_parse_chain (GstPad * pad, GstObject * parent,
GstBuffer * buffer);

View file

@ -59,8 +59,8 @@
#include "gstvorbistag.h"
GST_DEBUG_CATEGORY_EXTERN (vorbisparse_debug);
#define GST_CAT_DEFAULT vorbisparse_debug
GST_DEBUG_CATEGORY_STATIC (vorbistag_debug);
#define GST_CAT_DEFAULT vorbistag_debug
static GstFlowReturn gst_vorbis_tag_parse_packet (GstVorbisParse * parse,
GstBuffer * buffer);
@ -69,7 +69,9 @@ static GstFlowReturn gst_vorbis_tag_parse_packet (GstVorbisParse * parse,
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));
GST_RANK_NONE, GST_TYPE_VORBIS_TAG,
GST_DEBUG_CATEGORY_INIT (vorbistag_debug, "vorbistag", 0,
"vorbis tagging element"); vorbis_element_init (plugin));
static void
gst_vorbis_tag_class_init (GstVorbisTagClass * klass)