Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Stéphane Cerveau committed Apr 21, 2021
1 parent e785560 commit 7434608
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 36 deletions.
11 changes: 1 addition & 10 deletions ext/vorbis/gstivorbisdec.c
Expand Up @@ -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,
Expand Down
20 changes: 14 additions & 6 deletions ext/vorbis/gstvorbisdec.c
Expand Up @@ -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

Expand All @@ -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);

Expand Down
13 changes: 0 additions & 13 deletions ext/vorbis/gstvorbiselement.c
Expand Up @@ -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)
Expand All @@ -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);
}
}
7 changes: 5 additions & 2 deletions ext/vorbis/gstvorbisenc.c
Expand Up @@ -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 =
Expand Down Expand Up @@ -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)
Expand Down
7 changes: 5 additions & 2 deletions ext/vorbis/gstvorbisparse.c
Expand Up @@ -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 =
Expand All @@ -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);
Expand Down
8 changes: 5 additions & 3 deletions ext/vorbis/gstvorbistag.c
Expand Up @@ -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);
Expand All @@ -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)
Expand Down

0 comments on commit 7434608

Please sign in to comment.