From 891be511057dbcdf1f38740e55cbd376c4b25894 Mon Sep 17 00:00:00 2001 From: =?utf8?q?St=C3=A9phane=20Cerveau?= Date: Thu, 25 Feb 2021 15:22:15 +0100 Subject: [PATCH] gst-plugins: 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: --- gst/accurip/gstaccurip.c | 15 +++- gst/accurip/gstaccurip.h | 2 + gst/adpcmdec/adpcmdec.c | 14 +-- gst/adpcmenc/adpcmenc.c | 14 +-- gst/aiff/aiff.c | 33 +------- gst/aiff/aiffelements.h | 35 ++++++++ gst/aiff/aiffmux.c | 6 +- gst/aiff/aiffparse.c | 6 +- gst/aiff/gstaiffelement.c | 50 +++++++++++ gst/aiff/meson.build | 2 +- gst/asfmux/gstasf.c | 17 ++-- gst/asfmux/gstasfmux.c | 9 +- gst/asfmux/gstasfmux.h | 2 +- gst/asfmux/gstasfparse.c | 9 +- gst/asfmux/gstasfparse.h | 2 +- gst/asfmux/gstrtpasfpay.c | 9 +- gst/asfmux/gstrtpasfpay.h | 3 +- gst/audiobuffersplit/gstaudiobuffersplit.c | 14 ++- gst/audiobuffersplit/gstaudiobuffersplit.h | 1 + gst/audiofxbad/gstaudiochannelmix.c | 2 + gst/audiofxbad/gstaudiochannelmix.h | 2 + gst/audiofxbad/gstaudiofxbad.c | 3 +- gst/audiolatency/gstaudiolatency.c | 12 +-- gst/audiolatency/gstaudiolatency.h | 2 + gst/audiomixmatrix/gstaudiomixmatrix.c | 5 +- gst/audiomixmatrix/gstaudiomixmatrix.h | 2 + gst/audiovisualizers/gstspacescope.c | 15 ++-- gst/audiovisualizers/gstspacescope.h | 3 +- gst/audiovisualizers/gstspectrascope.c | 16 ++-- gst/audiovisualizers/gstspectrascope.h | 3 +- gst/audiovisualizers/gstsynaescope.c | 15 ++-- gst/audiovisualizers/gstsynaescope.h | 3 +- gst/audiovisualizers/gstwavescope.c | 15 ++-- gst/audiovisualizers/gstwavescope.h | 3 +- gst/audiovisualizers/plugin.c | 13 +-- gst/autoconvert/gstautoconvert.c | 2 + gst/autoconvert/gstautoconvert.h | 1 + gst/autoconvert/gstautovideoconvert.c | 2 + gst/autoconvert/gstautovideoconvert.h | 1 + gst/autoconvert/plugin.c | 9 +- gst/bayer/gstbayer.c | 14 ++- gst/bayer/gstbayer2rgb.c | 3 + gst/bayer/gstbayerelements.h | 33 ++++++++ gst/bayer/gstrgb2bayer.c | 3 + gst/camerabin2/gstcamerabin2.c | 14 ++- gst/camerabin2/gstcamerabin2.h | 2 +- gst/camerabin2/gstplugin.c | 13 ++- gst/camerabin2/gstviewfinderbin.c | 14 ++- gst/camerabin2/gstviewfinderbin.h | 2 +- gst/camerabin2/gstwrappercamerabinsrc.c | 9 +- gst/camerabin2/gstwrappercamerabinsrc.h | 2 +- gst/coloreffects/gstchromahold.c | 2 + gst/coloreffects/gstchromahold.h | 1 + gst/coloreffects/gstcoloreffects.c | 2 + gst/coloreffects/gstcoloreffects.h | 1 + gst/coloreffects/gstplugin.c | 23 +---- gst/debugutils/debugutilsbad.c | 50 ++++------- gst/debugutils/fpsdisplaysink.c | 4 + gst/debugutils/gstchecksumsink.c | 3 + gst/debugutils/gstchopmydata.c | 3 + gst/debugutils/gstclockselect.c | 3 + gst/debugutils/gstcompare.c | 3 + gst/debugutils/gstdebugspy.c | 3 + gst/debugutils/gstdebugutilsbadelements.h | 43 ++++++++++ gst/debugutils/gsterrorignore.c | 3 + gst/debugutils/gstfakeaudiosink.c | 3 + gst/debugutils/gstfakevideosink.c | 3 + gst/debugutils/gsttestsrcbin.c | 4 + gst/debugutils/gstwatchdog.c | 3 + gst/dvbsubenc/gstdvbsubenc.c | 14 ++- gst/dvbsubenc/gstdvbsubenc.h | 1 + gst/dvbsuboverlay/gstdvbsuboverlay.c | 11 +-- gst/dvbsuboverlay/gstdvbsuboverlay.h | 1 + gst/dvdspu/gstdvdspu.c | 11 ++- gst/dvdspu/gstdvdspu.h | 1 + gst/faceoverlay/gstfaceoverlay.c | 13 +-- gst/faceoverlay/gstfaceoverlay.h | 1 + gst/festival/gstfestival.c | 18 ++-- gst/festival/gstfestival.h | 1 + gst/fieldanalysis/gstfieldanalysis.c | 14 +-- gst/fieldanalysis/gstfieldanalysis.h | 1 + gst/freeverb/gstfreeverb.c | 5 +- gst/freeverb/gstfreeverb.h | 1 + gst/gaudieffects/gstburn.c | 21 ++--- gst/gaudieffects/gstburn.h | 1 + gst/gaudieffects/gstchromium.c | 23 ++--- gst/gaudieffects/gstchromium.h | 1 + gst/gaudieffects/gstdilate.c | 16 +--- gst/gaudieffects/gstdilate.h | 1 + gst/gaudieffects/gstdodge.c | 15 +--- gst/gaudieffects/gstdodge.h | 1 + gst/gaudieffects/gstexclusion.c | 17 +--- gst/gaudieffects/gstexclusion.h | 1 + gst/gaudieffects/gstgaussblur.c | 18 +--- gst/gaudieffects/gstgaussblur.h | 1 + gst/gaudieffects/gstplugin.c | 25 ++++-- gst/gaudieffects/gstplugin.h | 63 -------------- gst/gaudieffects/gstsolarize.c | 17 +--- gst/gaudieffects/gstsolarize.h | 1 + gst/gdp/gstgdp.c | 14 ++- gst/gdp/gstgdpdepay.c | 13 +-- gst/gdp/gstgdpdepay.h | 2 - gst/gdp/gstgdpelement.c | 37 ++++++++ gst/gdp/gstgdpelements.h | 35 ++++++++ gst/gdp/gstgdppay.c | 12 +-- gst/gdp/gstgdppay.h | 2 - gst/gdp/meson.build | 1 + gst/geometrictransform/gstbulge.c | 11 +-- gst/geometrictransform/gstbulge.h | 2 +- gst/geometrictransform/gstcircle.c | 12 +-- gst/geometrictransform/gstcircle.h | 2 +- gst/geometrictransform/gstdiffuse.c | 12 +-- gst/geometrictransform/gstdiffuse.h | 2 +- gst/geometrictransform/gstfisheye.c | 12 +-- gst/geometrictransform/gstfisheye.h | 2 +- gst/geometrictransform/gstkaleidoscope.c | 14 +-- gst/geometrictransform/gstkaleidoscope.h | 2 +- gst/geometrictransform/gstmarble.c | 13 +-- gst/geometrictransform/gstmarble.h | 2 +- gst/geometrictransform/gstmirror.c | 12 +-- gst/geometrictransform/gstmirror.h | 2 +- gst/geometrictransform/gstperspective.c | 14 +-- gst/geometrictransform/gstperspective.h | 2 +- gst/geometrictransform/gstpinch.c | 11 +-- gst/geometrictransform/gstpinch.h | 2 +- gst/geometrictransform/gstrotate.c | 12 +-- gst/geometrictransform/gstrotate.h | 2 +- gst/geometrictransform/gstsphere.c | 12 +-- gst/geometrictransform/gstsphere.h | 2 +- gst/geometrictransform/gstsquare.c | 12 +-- gst/geometrictransform/gstsquare.h | 2 +- gst/geometrictransform/gststretch.c | 12 +-- gst/geometrictransform/gststretch.h | 2 +- gst/geometrictransform/gsttunnel.c | 12 +-- gst/geometrictransform/gsttunnel.h | 2 +- gst/geometrictransform/gsttwirl.c | 11 +-- gst/geometrictransform/gsttwirl.h | 2 +- gst/geometrictransform/gstwaterripple.c | 14 +-- gst/geometrictransform/gstwaterripple.h | 2 +- gst/geometrictransform/plugin.c | 69 +++++---------- gst/id3tag/gstid3mux.c | 18 ++-- gst/id3tag/gstid3mux.h | 2 +- gst/inter/gstinter.c | 22 ++--- gst/inter/gstinteraudiosink.c | 2 + gst/inter/gstinteraudiosink.h | 1 + gst/inter/gstinteraudiosrc.c | 2 + gst/inter/gstinteraudiosrc.h | 2 +- gst/inter/gstintersubsink.c | 2 + gst/inter/gstintersubsink.h | 1 + gst/inter/gstintersubsrc.c | 2 + gst/inter/gstintersubsrc.h | 1 + gst/inter/gstintervideosink.c | 2 + gst/inter/gstintervideosink.h | 1 + gst/inter/gstintervideosrc.c | 2 + gst/inter/gstintervideosrc.h | 1 + gst/interlace/gstinterlace.c | 12 +-- gst/ivfparse/gstivfparse.c | 11 +-- gst/ivfparse/gstivfparse.h | 1 + gst/ivtc/gstcombdetect.c | 2 + gst/ivtc/gstcombdetect.h | 2 + gst/ivtc/gstivtc.c | 6 +- gst/ivtc/gstivtc.h | 2 + gst/jp2kdecimator/gstjp2kdecimator.c | 13 ++- gst/jp2kdecimator/gstjp2kdecimator.h | 1 + gst/jpegformat/gstjifmux.c | 2 + gst/jpegformat/gstjifmux.h | 2 + gst/jpegformat/gstjpegformat.c | 12 ++- gst/jpegformat/gstjpegparse.c | 2 + gst/jpegformat/gstjpegparse.h | 2 + gst/librfb/gstrfbsrc.c | 4 +- gst/librfb/gstrfbsrc.h | 1 + gst/midi/midi.c | 12 +-- gst/midi/midiparse.c | 2 + gst/midi/midiparse.h | 1 + gst/mpegdemux/gstmpegdemux.c | 7 ++ gst/mpegdemux/gstmpegdemux.h | 1 + gst/mpegdemux/plugin.c | 11 +-- gst/mpegpsmux/mpegpsmux.c | 13 +-- gst/mpegpsmux/mpegpsmux.h | 1 + gst/mpegtsdemux/gsttsdemux.c | 14 ++- gst/mpegtsdemux/mpegtsbase.c | 3 + gst/mpegtsdemux/mpegtsparse.c | 15 ++-- gst/mpegtsdemux/mpegtsparse.h | 3 +- gst/mpegtsdemux/tsdemux.c | 17 ++-- gst/mpegtsdemux/tsdemux.h | 3 +- gst/mpegtsmux/gstatscmux.c | 2 + gst/mpegtsmux/gstatscmux.h | 1 + gst/mpegtsmux/gstbasetsmux.c | 3 +- gst/mpegtsmux/gstmpegtsmux.c | 4 +- gst/mpegtsmux/gstmpegtsmux.h | 1 + gst/mpegtsmux/gstmpegtsmuxplugin.c | 15 ++-- gst/mxf/gstmxfelement.c | 82 ++++++++++++++++++ gst/mxf/gstmxfelements.h | 36 ++++++++ gst/mxf/meson.build | 1 + gst/mxf/mxf.c | 59 ++----------- gst/mxf/mxfdemux.c | 3 + gst/mxf/mxfmux.c | 3 + gst/netsim/gstnetsim.c | 5 +- gst/netsim/gstnetsim.h | 1 + gst/onvif/gstrtponvif.c | 12 ++- gst/onvif/gstrtponvifparse.c | 2 + gst/onvif/gstrtponvifparse.h | 1 + gst/onvif/gstrtponviftimestamp.c | 2 + gst/onvif/gstrtponviftimestamp.h | 1 + gst/pcapparse/gstirtspparse.c | 2 + gst/pcapparse/gstirtspparse.h | 1 + gst/pcapparse/gstpcapparse.c | 2 + gst/pcapparse/gstpcapparse.h | 1 + gst/pcapparse/plugin.c | 8 +- gst/pnm/gstpnm.c | 15 ++-- gst/pnm/gstpnmdec.c | 2 + gst/pnm/gstpnmdec.h | 2 +- gst/pnm/gstpnmenc.c | 5 +- gst/pnm/gstpnmenc.h | 1 + gst/proxy/gstproxy.c | 9 +- gst/proxy/gstproxysink.c | 2 + gst/proxy/gstproxysink.h | 1 + gst/proxy/gstproxysrc.c | 2 + gst/proxy/gstproxysrc.h | 1 + gst/rawparse/gstaudioparse.c | 2 + gst/rawparse/gstaudioparse.h | 1 + gst/rawparse/gstvideoparse.c | 2 + gst/rawparse/gstvideoparse.h | 1 + gst/rawparse/plugin.c | 8 +- gst/removesilence/gstremovesilence.c | 5 +- gst/removesilence/gstremovesilence.h | 1 + gst/rist/gstrist.c | 93 ++++++++++++++++++++ gst/rist/gstrist.h | 7 +- gst/rist/gstristplugin.c | 99 +++------------------- gst/rist/gstristrtpdeext.c | 2 + gst/rist/gstristrtpext.c | 3 +- gst/rist/gstristrtxreceive.c | 2 + gst/rist/gstristrtxsend.c | 2 + gst/rist/gstristsink.c | 2 + gst/rist/gstristsrc.c | 2 + gst/rist/gstroundrobin.c | 2 + gst/rist/gstroundrobin.h | 1 + gst/rist/meson.build | 1 + gst/rtmp2/gstrtmp2.c | 16 ++-- gst/rtmp2/gstrtmp2element.c | 41 +++++++++ gst/rtmp2/gstrtmp2elements.h | 36 ++++++++ gst/rtmp2/gstrtmp2sink.c | 3 + gst/rtmp2/gstrtmp2src.c | 3 + gst/rtmp2/meson.build | 1 + gst/rtp/gstrtpsink.c | 2 + gst/rtp/gstrtpsink.h | 1 + gst/rtp/gstrtpsrc.c | 2 + gst/rtp/gstrtpsrc.h | 1 + gst/rtp/plugin.c | 8 +- gst/sdp/gstsdpdemux.c | 2 + gst/sdp/gstsdpdemux.h | 1 + gst/sdp/gstsdpelem.c | 11 ++- gst/sdp/gstsdpsrc.c | 1 + gst/sdp/gstsdpsrc.h | 1 + gst/segmentclip/gstaudiosegmentclip.c | 2 + gst/segmentclip/gstaudiosegmentclip.h | 1 + gst/segmentclip/gstvideosegmentclip.c | 2 + gst/segmentclip/gstvideosegmentclip.h | 1 + gst/segmentclip/plugin.c | 11 ++- gst/siren/gstsiren.c | 11 ++- gst/siren/gstsirendec.c | 9 +- gst/siren/gstsirendec.h | 3 +- gst/siren/gstsirenenc.c | 10 +-- gst/siren/gstsirenenc.h | 3 +- gst/smooth/gstsmooth.c | 4 +- gst/smooth/gstsmooth.h | 2 +- gst/speed/gstspeed.c | 8 +- gst/speed/gstspeed.h | 1 + gst/subenc/gstsrtenc.c | 1 + gst/subenc/gstsrtenc.h | 1 + gst/subenc/gstsubenc.c | 9 +- gst/subenc/gstwebvttenc.c | 2 + gst/subenc/gstwebvttenc.h | 1 + gst/switchbin/gstswitchbin.c | 2 + gst/switchbin/gstswitchbin.h | 2 +- gst/switchbin/plugin.c | 7 +- gst/timecode/gstavwait.c | 1 + gst/timecode/gstavwait.h | 1 + gst/timecode/gsttimecodestamper.c | 2 + gst/timecode/gsttimecodestamper.h | 1 + gst/timecode/plugin.c | 9 +- gst/transcode/gsttranscodebin.c | 33 ++------ gst/transcode/gsttranscodeelement.c | 46 ++++++++++ gst/transcode/gsttranscodeelements.h | 33 ++++++++ gst/transcode/gsttranscodeplugin.c | 43 ++++++++++ gst/transcode/gsturitranscodebin.c | 6 +- gst/transcode/meson.build | 2 + gst/videofilters/gstscenechange.c | 2 + gst/videofilters/gstscenechange.h | 1 + gst/videofilters/gstvideodiff.c | 2 + gst/videofilters/gstvideodiff.h | 1 + gst/videofilters/gstvideofiltersbad.c | 12 ++- gst/videofilters/gstzebrastripe.c | 2 + gst/videofilters/gstzebrastripe.h | 1 + .../gstvideoframe-audiolevel.c | 5 +- .../gstvideoframe-audiolevel.h | 1 + gst/videoparsers/gstav1parse.c | 3 + gst/videoparsers/gstdiracparse.c | 3 + gst/videoparsers/gsth263parse.c | 4 + gst/videoparsers/gsth264parse.c | 4 + gst/videoparsers/gsth265parse.c | 4 + gst/videoparsers/gstjpeg2000parse.c | 4 + gst/videoparsers/gstmpeg4videoparse.c | 4 + gst/videoparsers/gstmpegvideoparse.c | 4 + gst/videoparsers/gstpngparse.c | 3 + gst/videoparsers/gstvc1parse.c | 3 + gst/videoparsers/gstvideoparserselement.c | 39 +++++++++ gst/videoparsers/gstvideoparserselements.h | 46 ++++++++++ gst/videoparsers/gstvp9parse.c | 3 + gst/videoparsers/meson.build | 1 + gst/videoparsers/plugin.c | 52 +++--------- gst/videosignal/gstsimplevideomark.c | 2 + gst/videosignal/gstsimplevideomark.h | 2 + gst/videosignal/gstsimplevideomarkdetect.c | 2 + gst/videosignal/gstsimplevideomarkdetect.h | 2 + gst/videosignal/gstvideoanalyse.c | 2 + gst/videosignal/gstvideoanalyse.h | 2 + gst/videosignal/gstvideosignal.c | 16 ++-- gst/vmnc/vmncdec.c | 7 +- gst/vmnc/vmncdec.h | 2 +- gst/y4m/gsty4mdec.c | 13 +-- gst/y4m/gsty4mdec.h | 1 + 322 files changed, 1584 insertions(+), 1200 deletions(-) create mode 100644 gst/aiff/aiffelements.h create mode 100644 gst/aiff/gstaiffelement.c create mode 100644 gst/bayer/gstbayerelements.h create mode 100644 gst/debugutils/gstdebugutilsbadelements.h delete mode 100644 gst/gaudieffects/gstplugin.h create mode 100644 gst/gdp/gstgdpelement.c create mode 100644 gst/gdp/gstgdpelements.h create mode 100644 gst/mxf/gstmxfelement.c create mode 100644 gst/mxf/gstmxfelements.h create mode 100644 gst/rist/gstrist.c create mode 100644 gst/rtmp2/gstrtmp2element.c create mode 100644 gst/rtmp2/gstrtmp2elements.h create mode 100644 gst/transcode/gsttranscodeelement.c create mode 100644 gst/transcode/gsttranscodeelements.h create mode 100644 gst/transcode/gsttranscodeplugin.c create mode 100644 gst/videoparsers/gstvideoparserselement.c create mode 100644 gst/videoparsers/gstvideoparserselements.h diff --git a/gst/accurip/gstaccurip.c b/gst/accurip/gstaccurip.c index e69c3f4..efc2995 100644 --- a/gst/accurip/gstaccurip.c +++ b/gst/accurip/gstaccurip.c @@ -72,8 +72,6 @@ enum PROP_LAST_TRACK }; -#define parent_class gst_accurip_parent_class -G_DEFINE_TYPE (GstAccurip, gst_accurip, GST_TYPE_AUDIO_FILTER); @@ -86,6 +84,11 @@ static GstFlowReturn gst_accurip_transform_ip (GstBaseTransform * trans, GstBuffer * buf); static gboolean gst_accurip_sink_event (GstBaseTransform * trans, GstEvent * event); +static gboolean accurip_element_init (GstPlugin * plugin); + +#define parent_class gst_accurip_parent_class +G_DEFINE_TYPE (GstAccurip, gst_accurip, GST_TYPE_AUDIO_FILTER); +GST_ELEMENT_REGISTER_DEFINE_CUSTOM (accurip, accurip_element_init); static void gst_accurip_class_init (GstAccuripClass * klass) @@ -342,7 +345,7 @@ gst_accurip_get_property (GObject * object, guint prop_id, } static gboolean -plugin_init (GstPlugin * plugin) +accurip_element_init (GstPlugin * plugin) { gboolean ret; @@ -362,6 +365,12 @@ plugin_init (GstPlugin * plugin) return ret; } +static gboolean +plugin_init (GstPlugin * plugin) +{ + return GST_ELEMENT_REGISTER (accurip, plugin); +} + GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, GST_VERSION_MINOR, accurip, diff --git a/gst/accurip/gstaccurip.h b/gst/accurip/gstaccurip.h index e9ecba5..88cc101 100644 --- a/gst/accurip/gstaccurip.h +++ b/gst/accurip/gstaccurip.h @@ -80,6 +80,8 @@ struct _GstAccuripClass GType gst_accurip_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (accurip); + G_END_DECLS #endif /* __GST_ACCURIP_H__ */ diff --git a/gst/adpcmdec/adpcmdec.c b/gst/adpcmdec/adpcmdec.c index 3cfa820..fb25ca5 100644 --- a/gst/adpcmdec/adpcmdec.c +++ b/gst/adpcmdec/adpcmdec.c @@ -81,7 +81,12 @@ typedef struct _ADPCMDec } ADPCMDec; GType adpcmdec_get_type (void); -G_DEFINE_TYPE (ADPCMDec, adpcmdec, GST_TYPE_AUDIO_DECODER); +GST_ELEMENT_REGISTER_DECLARE (adpcmdec); +G_DEFINE_TYPE_WITH_CODE (ADPCMDec, adpcmdec, GST_TYPE_AUDIO_DECODER, + GST_DEBUG_CATEGORY_INIT (adpcmdec_debug, "adpcmdec", 0, "ADPCM Decoders"); + ); +GST_ELEMENT_REGISTER_DEFINE (adpcmdec, "adpcmdec", GST_RANK_PRIMARY, + GST_TYPE_ADPCM_DEC); static gboolean adpcmdec_set_format (GstAudioDecoder * bdec, GstCaps * in_caps) @@ -485,12 +490,7 @@ adpcmdec_class_init (ADPCMDecClass * klass) static gboolean plugin_init (GstPlugin * plugin) { - GST_DEBUG_CATEGORY_INIT (adpcmdec_debug, "adpcmdec", 0, "ADPCM Decoders"); - if (!gst_element_register (plugin, "adpcmdec", GST_RANK_PRIMARY, - GST_TYPE_ADPCM_DEC)) { - return FALSE; - } - return TRUE; + return GST_ELEMENT_REGISTER (adpcmdec, plugin); } GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, GST_VERSION_MINOR, adpcmdec, diff --git a/gst/adpcmenc/adpcmenc.c b/gst/adpcmenc/adpcmenc.c index 52962e4..027029c 100644 --- a/gst/adpcmenc/adpcmenc.c +++ b/gst/adpcmenc/adpcmenc.c @@ -132,7 +132,12 @@ typedef struct _ADPCMEnc } ADPCMEnc; GType adpcmenc_get_type (void); -G_DEFINE_TYPE (ADPCMEnc, adpcmenc, GST_TYPE_AUDIO_ENCODER); +GST_ELEMENT_REGISTER_DECLARE (adpcmenc); +G_DEFINE_TYPE_WITH_CODE (ADPCMEnc, adpcmenc, GST_TYPE_AUDIO_ENCODER, + GST_DEBUG_CATEGORY_INIT (adpcmenc_debug, "adpcmenc", 0, "ADPCM Encoders"); + ); +GST_ELEMENT_REGISTER_DEFINE (adpcmenc, "adpcmenc", GST_RANK_PRIMARY, + GST_TYPE_ADPCM_ENC); static gboolean adpcmenc_setup (ADPCMEnc * enc) @@ -470,12 +475,7 @@ adpcmenc_class_init (ADPCMEncClass * klass) static gboolean plugin_init (GstPlugin * plugin) { - GST_DEBUG_CATEGORY_INIT (adpcmenc_debug, "adpcmenc", 0, "ADPCM Encoders"); - if (!gst_element_register (plugin, "adpcmenc", GST_RANK_PRIMARY, - GST_TYPE_ADPCM_ENC)) { - return FALSE; - } - return TRUE; + return GST_ELEMENT_REGISTER (adpcmenc, plugin); } GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, GST_VERSION_MINOR, adpcmenc, diff --git a/gst/aiff/aiff.c b/gst/aiff/aiff.c index 8c41203..5fabbd4 100644 --- a/gst/aiff/aiff.c +++ b/gst/aiff/aiff.c @@ -22,41 +22,16 @@ #include "config.h" #endif -#include +#include "aiffelements.h" -#include - -#include "aiffparse.h" -#include "aiffmux.h" - -GST_DEBUG_CATEGORY_STATIC (aiff_debug); -#define GST_CAT_DEFAULT (aiff_debug) - -GST_DEBUG_CATEGORY_EXTERN (aiffparse_debug); -GST_DEBUG_CATEGORY_EXTERN (aiffmux_debug); static gboolean plugin_init (GstPlugin * plugin) { - gboolean ret; - - GST_DEBUG_CATEGORY_INIT (aiff_debug, "aiff", 0, "AIFF plugin"); - GST_DEBUG_CATEGORY_INIT (aiffparse_debug, "aiffparse", 0, "AIFF parser"); - GST_DEBUG_CATEGORY_INIT (aiffmux_debug, "aiffmux", 0, "AIFF muxer"); - -#ifdef ENABLE_NLS - GST_DEBUG ("binding text domain %s to locale dir %s", GETTEXT_PACKAGE, - LOCALEDIR); - bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); - bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); -#endif - - ret = gst_element_register (plugin, "aiffparse", GST_RANK_PRIMARY, - GST_TYPE_AIFF_PARSE); - ret &= gst_element_register (plugin, "aiffmux", GST_RANK_PRIMARY, - GST_TYPE_AIFF_MUX); + gboolean ret = FALSE; - gst_tag_register_musicbrainz_tags (); + ret |= GST_ELEMENT_REGISTER (aiffparse, plugin); + ret |= GST_ELEMENT_REGISTER (aiffmux, plugin); return ret; } diff --git a/gst/aiff/aiffelements.h b/gst/aiff/aiffelements.h new file mode 100644 index 0000000..69b4b51 --- /dev/null +++ b/gst/aiff/aiffelements.h @@ -0,0 +1,35 @@ +/* GStreamer + * Copyright (C) <2020> The GStreamer Contributors. + * + * 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_AIFF_ELEMENTS_H__ +#define __GST_AIFF_ELEMENTS_H__ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include + +G_GNUC_INTERNAL void aiff_element_init (GstPlugin * plugin); + +GST_ELEMENT_REGISTER_DECLARE (aiffmux); +GST_ELEMENT_REGISTER_DECLARE (aiffparse); + +#endif /* __GST_AIFF_ELEMENTS_H__ */ diff --git a/gst/aiff/aiffmux.c b/gst/aiff/aiffmux.c index 96cac95..04cec5b 100644 --- a/gst/aiff/aiffmux.c +++ b/gst/aiff/aiffmux.c @@ -57,6 +57,7 @@ #include #include +#include "aiffelements.h" #include "aiffmux.h" GST_DEBUG_CATEGORY (aiffmux_debug); @@ -77,7 +78,10 @@ static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src", ); #define gst_aiff_mux_parent_class parent_class -G_DEFINE_TYPE (GstAiffMux, gst_aiff_mux, GST_TYPE_ELEMENT); +G_DEFINE_TYPE_WITH_CODE (GstAiffMux, gst_aiff_mux, GST_TYPE_ELEMENT, + GST_DEBUG_CATEGORY_INIT (aiffmux_debug, "aiffmux", 0, "AIFF muxer")); +GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (aiffmux, "aiffmux", GST_RANK_PRIMARY, + GST_TYPE_AIFF_MUX, aiff_element_init (plugin)); static GstStateChangeReturn gst_aiff_mux_change_state (GstElement * element, GstStateChange transition) diff --git a/gst/aiff/aiffparse.c b/gst/aiff/aiffparse.c index db85a97..e155431 100644 --- a/gst/aiff/aiffparse.c +++ b/gst/aiff/aiffparse.c @@ -52,6 +52,7 @@ #include #include +#include "aiffelements.h" #include "aiffparse.h" #include #include @@ -104,7 +105,10 @@ GST_STATIC_PAD_TEMPLATE ("src", #define MAX_BUFFER_SIZE 4096 #define gst_aiff_parse_parent_class parent_class -G_DEFINE_TYPE (GstAiffParse, gst_aiff_parse, GST_TYPE_ELEMENT); +G_DEFINE_TYPE_WITH_CODE (GstAiffParse, gst_aiff_parse, GST_TYPE_ELEMENT, + GST_DEBUG_CATEGORY_INIT (aiffparse_debug, "aiffparse", 0, "AIFF parser")); +GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (aiffparse, "aiffparse", GST_RANK_PRIMARY, + GST_TYPE_AIFF_PARSE, aiff_element_init (plugin)); static void gst_aiff_parse_class_init (GstAiffParseClass * klass) diff --git a/gst/aiff/gstaiffelement.c b/gst/aiff/gstaiffelement.c new file mode 100644 index 0000000..3d2f91b --- /dev/null +++ b/gst/aiff/gstaiffelement.c @@ -0,0 +1,50 @@ +/* -*- Mode: C; tab-width: 2; indent-tabs-mode: t; c-basic-offset: 2 -*- */ +/* GStreamer AIFF plugin initialisation + * Copyright (C) <2008> Pioneers of the Inevitable + * + * 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 + +#include + +#include "aiffelements.h" + + +GST_DEBUG_CATEGORY_STATIC (aiff_debug); +#define GST_CAT_DEFAULT (aiff_debug) + +void +aiff_element_init (GstPlugin * plugin) +{ + static gsize res = FALSE; + if (g_once_init_enter (&res)) { + GST_DEBUG_CATEGORY_INIT (aiff_debug, "aiff", 0, "AIFF plugin"); +#ifdef ENABLE_NLS + GST_DEBUG ("binding text domain %s to locale dir %s", GETTEXT_PACKAGE, + LOCALEDIR); + bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); + bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); +#endif + gst_tag_register_musicbrainz_tags (); + g_once_init_leave (&res, TRUE); + } +} diff --git a/gst/aiff/meson.build b/gst/aiff/meson.build index a2221b4..cc5ebd3 100644 --- a/gst/aiff/meson.build +++ b/gst/aiff/meson.build @@ -1,5 +1,5 @@ aiff_sources = [ - 'aiff.c', 'aiffmux.c', 'aiffparse.c', + 'aiff.c', 'aiffmux.c', 'aiffparse.c', 'gstaiffelement.c' ] gstaiff = library('gstaiff', diff --git a/gst/asfmux/gstasf.c b/gst/asfmux/gstasf.c index 1a00fb4..eb81165 100644 --- a/gst/asfmux/gstasf.c +++ b/gst/asfmux/gstasf.c @@ -32,16 +32,13 @@ static gboolean plugin_init (GstPlugin * plugin) { - if (!gst_asf_mux_plugin_init (plugin)) { - return FALSE; - } - if (!gst_rtp_asf_pay_plugin_init (plugin)) { - return FALSE; - } - if (!gst_asf_parse_plugin_init (plugin)) { - return FALSE; - } - return TRUE; + gboolean ret = FALSE; + + ret |= GST_ELEMENT_REGISTER (asfmux, plugin); + ret |= GST_ELEMENT_REGISTER (rtpasfpay, plugin); + ret |= GST_ELEMENT_REGISTER (asfparse, plugin); + + return ret; } GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, diff --git a/gst/asfmux/gstasfmux.c b/gst/asfmux/gstasfmux.c index 1e79c39..0ab4660 100644 --- a/gst/asfmux/gstasfmux.c +++ b/gst/asfmux/gstasfmux.c @@ -173,6 +173,8 @@ static GstElementClass *parent_class = NULL; G_DEFINE_TYPE_WITH_CODE (GstAsfMux, gst_asf_mux, GST_TYPE_ELEMENT, G_IMPLEMENT_INTERFACE (GST_TYPE_TAG_SETTER, NULL)); +GST_ELEMENT_REGISTER_DEFINE (asfmux, "asfmux", + GST_RANK_PRIMARY, GST_TYPE_ASF_MUX); static void gst_asf_mux_reset (GstAsfMux * asfmux) @@ -2455,10 +2457,3 @@ gst_asf_mux_change_state (GstElement * element, GstStateChange transition) done: return ret; } - -gboolean -gst_asf_mux_plugin_init (GstPlugin * plugin) -{ - return gst_element_register (plugin, "asfmux", - GST_RANK_PRIMARY, GST_TYPE_ASF_MUX); -} diff --git a/gst/asfmux/gstasfmux.h b/gst/asfmux/gstasfmux.h index f5ebb07..7418284 100644 --- a/gst/asfmux/gstasfmux.h +++ b/gst/asfmux/gstasfmux.h @@ -152,7 +152,7 @@ struct _GstAsfMuxClass }; GType gst_asf_mux_get_type (void); -gboolean gst_asf_mux_plugin_init (GstPlugin * plugin); +GST_ELEMENT_REGISTER_DECLARE (asfmux); G_END_DECLS #endif /* __GST_ASF_MUX_H__ */ diff --git a/gst/asfmux/gstasfparse.c b/gst/asfmux/gstasfparse.c index 6cc75b6..5859c7f 100644 --- a/gst/asfmux/gstasfparse.c +++ b/gst/asfmux/gstasfparse.c @@ -44,6 +44,8 @@ static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink", #define gst_asf_parse_parent_class parent_class G_DEFINE_TYPE (GstAsfParse, gst_asf_parse, GST_TYPE_BASE_PARSE); +GST_ELEMENT_REGISTER_DEFINE (asfparse, "asfparse", + GST_RANK_NONE, GST_TYPE_ASF_PARSE); static gboolean gst_asf_parse_start (GstBaseParse * parse) @@ -416,10 +418,3 @@ gst_asf_parse_init (GstAsfParse * asfparse) asfparse->asfinfo = gst_asf_file_info_new (); asfparse->packetinfo = g_new0 (GstAsfPacketInfo, 1); } - -gboolean -gst_asf_parse_plugin_init (GstPlugin * plugin) -{ - return gst_element_register (plugin, "asfparse", - GST_RANK_NONE, GST_TYPE_ASF_PARSE); -} diff --git a/gst/asfmux/gstasfparse.h b/gst/asfmux/gstasfparse.h index f01dd26..3bd91e8 100644 --- a/gst/asfmux/gstasfparse.h +++ b/gst/asfmux/gstasfparse.h @@ -71,7 +71,7 @@ struct _GstAsfParseClass { }; GType gst_asf_parse_get_type(void); -gboolean gst_asf_parse_plugin_init (GstPlugin * plugin); +GST_ELEMENT_REGISTER_DECLARE (asfparse); G_END_DECLS diff --git a/gst/asfmux/gstrtpasfpay.c b/gst/asfmux/gstrtpasfpay.c index 9b1e032..ad0b206 100644 --- a/gst/asfmux/gstrtpasfpay.c +++ b/gst/asfmux/gstrtpasfpay.c @@ -57,6 +57,8 @@ gst_rtp_asf_pay_set_caps (GstRTPBasePayload * rtppay, GstCaps * caps); #define gst_rtp_asf_pay_parent_class parent_class G_DEFINE_TYPE (GstRtpAsfPay, gst_rtp_asf_pay, GST_TYPE_RTP_BASE_PAYLOAD); +GST_ELEMENT_REGISTER_DEFINE (rtpasfpay, "rtpasfpay", + GST_RANK_NONE, GST_TYPE_RTP_ASF_PAY); static void gst_rtp_asf_pay_init (GstRtpAsfPay * rtpasfpay) @@ -460,10 +462,3 @@ gst_rtp_asf_pay_handle_buffer (GstRTPBasePayload * rtppay, GstBuffer * buffer) gst_buffer_unref (buffer); return GST_FLOW_OK; } - -gboolean -gst_rtp_asf_pay_plugin_init (GstPlugin * plugin) -{ - return gst_element_register (plugin, "rtpasfpay", - GST_RANK_NONE, GST_TYPE_RTP_ASF_PAY); -} diff --git a/gst/asfmux/gstrtpasfpay.h b/gst/asfmux/gstrtpasfpay.h index da990c2..bd2e9e9 100644 --- a/gst/asfmux/gstrtpasfpay.h +++ b/gst/asfmux/gstrtpasfpay.h @@ -81,7 +81,8 @@ struct _GstRtpAsfPayClass }; GType gst_rtp_asf_pay_get_type (void); -gboolean gst_rtp_asf_pay_plugin_init (GstPlugin * plugin); + +GST_ELEMENT_REGISTER_DECLARE (rtpasfpay); G_END_DECLS #endif /* __GST_RTP_ASF_PAY_H__ */ diff --git a/gst/audiobuffersplit/gstaudiobuffersplit.c b/gst/audiobuffersplit/gstaudiobuffersplit.c index 911c598..e1ea507 100644 --- a/gst/audiobuffersplit/gstaudiobuffersplit.c +++ b/gst/audiobuffersplit/gstaudiobuffersplit.c @@ -63,7 +63,11 @@ enum #define DEFAULT_MAX_SILENCE_TIME (0) #define parent_class gst_audio_buffer_split_parent_class -G_DEFINE_TYPE (GstAudioBufferSplit, gst_audio_buffer_split, GST_TYPE_ELEMENT); +G_DEFINE_TYPE_WITH_CODE (GstAudioBufferSplit, gst_audio_buffer_split, + GST_TYPE_ELEMENT, GST_DEBUG_CATEGORY_INIT (gst_audio_buffer_split_debug, + "audiobuffersplit", 0, "Audio buffer splitter");); +GST_ELEMENT_REGISTER_DEFINE (audiobuffersplit, "audiobuffersplit", + GST_RANK_NONE, GST_TYPE_AUDIO_BUFFER_SPLIT); static GstFlowReturn gst_audio_buffer_split_sink_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer); @@ -923,13 +927,7 @@ gst_audio_buffer_split_src_query (GstPad * pad, static gboolean plugin_init (GstPlugin * plugin) { - GST_DEBUG_CATEGORY_INIT (gst_audio_buffer_split_debug, "audiobuffersplit", - 0, "Audio buffer splitter"); - - gst_element_register (plugin, "audiobuffersplit", GST_RANK_NONE, - GST_TYPE_AUDIO_BUFFER_SPLIT); - - return TRUE; + return GST_ELEMENT_REGISTER (audiobuffersplit, plugin); } GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, diff --git a/gst/audiobuffersplit/gstaudiobuffersplit.h b/gst/audiobuffersplit/gstaudiobuffersplit.h index 31fda86..021f6b2 100644 --- a/gst/audiobuffersplit/gstaudiobuffersplit.h +++ b/gst/audiobuffersplit/gstaudiobuffersplit.h @@ -74,6 +74,7 @@ struct _GstAudioBufferSplitClass { }; GType gst_audio_buffer_split_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (audiobuffersplit); G_END_DECLS diff --git a/gst/audiofxbad/gstaudiochannelmix.c b/gst/audiofxbad/gstaudiochannelmix.c index c65a5c4..49190d4 100644 --- a/gst/audiofxbad/gstaudiochannelmix.c +++ b/gst/audiofxbad/gstaudiochannelmix.c @@ -91,6 +91,8 @@ G_DEFINE_TYPE_WITH_CODE (GstAudioChannelMix, gst_audio_channel_mix, GST_TYPE_AUDIO_FILTER, GST_DEBUG_CATEGORY_INIT (gst_audio_channel_mix_debug_category, "audiochannelmix", 0, "debug category for audiochannelmix element")); +GST_ELEMENT_REGISTER_DEFINE (audiochannelmix, "audiochannelmix", GST_RANK_NONE, + GST_TYPE_AUDIO_CHANNEL_MIX); static void gst_audio_channel_mix_class_init (GstAudioChannelMixClass * klass) diff --git a/gst/audiofxbad/gstaudiochannelmix.h b/gst/audiofxbad/gstaudiochannelmix.h index cc2faba..dc8b08c 100644 --- a/gst/audiofxbad/gstaudiochannelmix.h +++ b/gst/audiofxbad/gstaudiochannelmix.h @@ -50,6 +50,8 @@ struct _GstAudioChannelMixClass GType gst_audio_channel_mix_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (audiochannelmix); + G_END_DECLS #endif diff --git a/gst/audiofxbad/gstaudiofxbad.c b/gst/audiofxbad/gstaudiofxbad.c index c0d900f..29141e0 100644 --- a/gst/audiofxbad/gstaudiofxbad.c +++ b/gst/audiofxbad/gstaudiofxbad.c @@ -26,8 +26,7 @@ static gboolean plugin_init (GstPlugin * plugin) { - return gst_element_register (plugin, "audiochannelmix", GST_RANK_NONE, - GST_TYPE_AUDIO_CHANNEL_MIX); + return GST_ELEMENT_REGISTER (audiochannelmix, plugin); } GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, diff --git a/gst/audiolatency/gstaudiolatency.c b/gst/audiolatency/gstaudiolatency.c index 7e6ec42..4ae5bfa 100644 --- a/gst/audiolatency/gstaudiolatency.c +++ b/gst/audiolatency/gstaudiolatency.c @@ -79,7 +79,11 @@ static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink", ); #define gst_audiolatency_parent_class parent_class -G_DEFINE_TYPE (GstAudioLatency, gst_audiolatency, GST_TYPE_BIN); +G_DEFINE_TYPE_WITH_CODE (GstAudioLatency, gst_audiolatency, GST_TYPE_BIN, + GST_DEBUG_CATEGORY_INIT (gst_audiolatency_debug, "audiolatency", 0, + "audiolatency");); +GST_ELEMENT_REGISTER_DEFINE (audiolatency, "audiolatency", GST_RANK_PRIMARY, + GST_TYPE_AUDIOLATENCY); #define DEFAULT_PRINT_LATENCY FALSE enum @@ -422,11 +426,7 @@ out: static gboolean plugin_init (GstPlugin * plugin) { - GST_DEBUG_CATEGORY_INIT (gst_audiolatency_debug, "audiolatency", 0, - "audiolatency"); - - return gst_element_register (plugin, "audiolatency", GST_RANK_PRIMARY, - GST_TYPE_AUDIOLATENCY); + return GST_ELEMENT_REGISTER (audiolatency, plugin); } GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, diff --git a/gst/audiolatency/gstaudiolatency.h b/gst/audiolatency/gstaudiolatency.h index 22cc427..414b833 100644 --- a/gst/audiolatency/gstaudiolatency.h +++ b/gst/audiolatency/gstaudiolatency.h @@ -65,5 +65,7 @@ struct _GstAudioLatencyClass GType gst_audiolatency_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (audiolatency); + G_END_DECLS #endif /* __GST_AUDIOLATENCY_H__ */ diff --git a/gst/audiomixmatrix/gstaudiomixmatrix.c b/gst/audiomixmatrix/gstaudiomixmatrix.c index 77b5c92..0d1c9b3 100644 --- a/gst/audiomixmatrix/gstaudiomixmatrix.c +++ b/gst/audiomixmatrix/gstaudiomixmatrix.c @@ -150,6 +150,8 @@ static GstStateChangeReturn gst_audio_mix_matrix_change_state (GstElement * G_DEFINE_TYPE (GstAudioMixMatrix, gst_audio_mix_matrix, GST_TYPE_BASE_TRANSFORM); +GST_ELEMENT_REGISTER_DEFINE (audiomixmatrix, "audiomixmatrix", GST_RANK_NONE, + GST_TYPE_AUDIO_MIX_MATRIX); static void gst_audio_mix_matrix_class_init (GstAudioMixMatrixClass * klass) @@ -743,8 +745,7 @@ beach: static gboolean plugin_init (GstPlugin * plugin) { - return gst_element_register (plugin, "audiomixmatrix", GST_RANK_NONE, - GST_TYPE_AUDIO_MIX_MATRIX); + return GST_ELEMENT_REGISTER (audiomixmatrix, plugin); } GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, diff --git a/gst/audiomixmatrix/gstaudiomixmatrix.h b/gst/audiomixmatrix/gstaudiomixmatrix.h index 5321954..dcd3456 100644 --- a/gst/audiomixmatrix/gstaudiomixmatrix.h +++ b/gst/audiomixmatrix/gstaudiomixmatrix.h @@ -72,6 +72,8 @@ struct _GstAudioMixMatrixClass GType gst_audio_mix_matrix_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (audiomixmatrix); + GType gst_audio_mix_matrix_mode_get_type (void); G_END_DECLS diff --git a/gst/audiovisualizers/gstspacescope.c b/gst/audiovisualizers/gstspacescope.c index b14f7fc..1cc4b22 100644 --- a/gst/audiovisualizers/gstspacescope.c +++ b/gst/audiovisualizers/gstspacescope.c @@ -120,7 +120,11 @@ static gboolean gst_space_scope_render (GstAudioVisualizer * scope, GstBuffer * audio, GstVideoFrame * video); -G_DEFINE_TYPE (GstSpaceScope, gst_space_scope, GST_TYPE_AUDIO_VISUALIZER); +G_DEFINE_TYPE_WITH_CODE (GstSpaceScope, gst_space_scope, + GST_TYPE_AUDIO_VISUALIZER, GST_DEBUG_CATEGORY_INIT (space_scope_debug, + "spacescope", 0, "spacescope");); +GST_ELEMENT_REGISTER_DEFINE (spacescope, "spacescope", GST_RANK_NONE, + GST_TYPE_SPACE_SCOPE); static void gst_space_scope_class_init (GstSpaceScopeClass * g_class) @@ -445,12 +449,3 @@ gst_space_scope_render (GstAudioVisualizer * base, GstBuffer * audio, gst_buffer_unmap (audio, &amap); return TRUE; } - -gboolean -gst_space_scope_plugin_init (GstPlugin * plugin) -{ - GST_DEBUG_CATEGORY_INIT (space_scope_debug, "spacescope", 0, "spacescope"); - - return gst_element_register (plugin, "spacescope", GST_RANK_NONE, - GST_TYPE_SPACE_SCOPE); -} diff --git a/gst/audiovisualizers/gstspacescope.h b/gst/audiovisualizers/gstspacescope.h index 10659fe..76e59ad 100644 --- a/gst/audiovisualizers/gstspacescope.h +++ b/gst/audiovisualizers/gstspacescope.h @@ -56,7 +56,8 @@ struct _GstSpaceScopeClass }; GType gst_space_scope_get_type (void); -gboolean gst_space_scope_plugin_init (GstPlugin * plugin); + +GST_ELEMENT_REGISTER_DECLARE (spacescope); G_END_DECLS #endif /* __GST_SPACE_SCOPE_H__ */ diff --git a/gst/audiovisualizers/gstspectrascope.c b/gst/audiovisualizers/gstspectrascope.c index 5ba73ba..06077f1 100644 --- a/gst/audiovisualizers/gstspectrascope.c +++ b/gst/audiovisualizers/gstspectrascope.c @@ -75,7 +75,11 @@ static gboolean gst_spectra_scope_render (GstAudioVisualizer * scope, GstBuffer * audio, GstVideoFrame * video); -G_DEFINE_TYPE (GstSpectraScope, gst_spectra_scope, GST_TYPE_AUDIO_VISUALIZER); +G_DEFINE_TYPE_WITH_CODE (GstSpectraScope, gst_spectra_scope, + GST_TYPE_AUDIO_VISUALIZER, GST_DEBUG_CATEGORY_INIT (spectra_scope_debug, + "spectrascope", 0, "spectrascope");); +GST_ELEMENT_REGISTER_DEFINE (spectrascope, "spectrascope", GST_RANK_NONE, + GST_TYPE_SPECTRA_SCOPE); static void gst_spectra_scope_class_init (GstSpectraScopeClass * g_class) @@ -228,13 +232,3 @@ gst_spectra_scope_render (GstAudioVisualizer * bscope, GstBuffer * audio, gst_buffer_unmap (audio, &amap); return TRUE; } - -gboolean -gst_spectra_scope_plugin_init (GstPlugin * plugin) -{ - GST_DEBUG_CATEGORY_INIT (spectra_scope_debug, "spectrascope", 0, - "spectrascope"); - - return gst_element_register (plugin, "spectrascope", GST_RANK_NONE, - GST_TYPE_SPECTRA_SCOPE); -} diff --git a/gst/audiovisualizers/gstspectrascope.h b/gst/audiovisualizers/gstspectrascope.h index d063734..d316652 100644 --- a/gst/audiovisualizers/gstspectrascope.h +++ b/gst/audiovisualizers/gstspectrascope.h @@ -48,7 +48,8 @@ struct _GstSpectraScopeClass }; GType gst_spectra_scope_get_type (void); -gboolean gst_spectra_scope_plugin_init (GstPlugin * plugin); + +GST_ELEMENT_REGISTER_DECLARE (spectrascope); G_END_DECLS #endif /* __GST_SPECTRA_SCOPE_H__ */ diff --git a/gst/audiovisualizers/gstsynaescope.c b/gst/audiovisualizers/gstsynaescope.c index 1e2be05..bd92d58 100644 --- a/gst/audiovisualizers/gstsynaescope.c +++ b/gst/audiovisualizers/gstsynaescope.c @@ -73,7 +73,11 @@ static gboolean gst_synae_scope_render (GstAudioVisualizer * scope, GstBuffer * audio, GstVideoFrame * video); -G_DEFINE_TYPE (GstSynaeScope, gst_synae_scope, GST_TYPE_AUDIO_VISUALIZER); +G_DEFINE_TYPE_WITH_CODE (GstSynaeScope, gst_synae_scope, + GST_TYPE_AUDIO_VISUALIZER, GST_DEBUG_CATEGORY_INIT (synae_scope_debug, + "synaescope", 0, "synaescope");); +GST_ELEMENT_REGISTER_DEFINE (synaescope, "synaescope", GST_RANK_NONE, + GST_TYPE_SYNAE_SCOPE); static void gst_synae_scope_class_init (GstSynaeScopeClass * g_class) @@ -309,12 +313,3 @@ gst_synae_scope_render (GstAudioVisualizer * bscope, GstBuffer * audio, return TRUE; } - -gboolean -gst_synae_scope_plugin_init (GstPlugin * plugin) -{ - GST_DEBUG_CATEGORY_INIT (synae_scope_debug, "synaescope", 0, "synaescope"); - - return gst_element_register (plugin, "synaescope", GST_RANK_NONE, - GST_TYPE_SYNAE_SCOPE); -} diff --git a/gst/audiovisualizers/gstsynaescope.h b/gst/audiovisualizers/gstsynaescope.h index f6ec264..fa3ba06 100644 --- a/gst/audiovisualizers/gstsynaescope.h +++ b/gst/audiovisualizers/gstsynaescope.h @@ -52,7 +52,8 @@ struct _GstSynaeScopeClass }; GType gst_synae_scope_get_type (void); -gboolean gst_synae_scope_plugin_init (GstPlugin * plugin); + +GST_ELEMENT_REGISTER_DECLARE (synaescope); G_END_DECLS #endif /* __GST_SYNAE_SCOPE_H__ */ diff --git a/gst/audiovisualizers/gstwavescope.c b/gst/audiovisualizers/gstwavescope.c index f584b69..91a935b 100644 --- a/gst/audiovisualizers/gstwavescope.c +++ b/gst/audiovisualizers/gstwavescope.c @@ -122,7 +122,11 @@ static gboolean gst_wave_scope_render (GstAudioVisualizer * base, GstBuffer * audio, GstVideoFrame * video); #define gst_wave_scope_parent_class parent_class -G_DEFINE_TYPE (GstWaveScope, gst_wave_scope, GST_TYPE_AUDIO_VISUALIZER); +G_DEFINE_TYPE_WITH_CODE (GstWaveScope, gst_wave_scope, + GST_TYPE_AUDIO_VISUALIZER, GST_DEBUG_CATEGORY_INIT (wave_scope_debug, + "wavescope", 0, "wavescope");); +GST_ELEMENT_REGISTER_DEFINE (wavescope, "wavescope", GST_RANK_NONE, + GST_TYPE_WAVE_SCOPE); static void gst_wave_scope_class_init (GstWaveScopeClass * g_class) @@ -422,12 +426,3 @@ gst_wave_scope_render (GstAudioVisualizer * base, GstBuffer * audio, return TRUE; } - -gboolean -gst_wave_scope_plugin_init (GstPlugin * plugin) -{ - GST_DEBUG_CATEGORY_INIT (wave_scope_debug, "wavescope", 0, "wavescope"); - - return gst_element_register (plugin, "wavescope", GST_RANK_NONE, - GST_TYPE_WAVE_SCOPE); -} diff --git a/gst/audiovisualizers/gstwavescope.h b/gst/audiovisualizers/gstwavescope.h index f367f88..d3b112f 100644 --- a/gst/audiovisualizers/gstwavescope.h +++ b/gst/audiovisualizers/gstwavescope.h @@ -53,7 +53,8 @@ struct _GstWaveScopeClass }; GType gst_wave_scope_get_type (void); -gboolean gst_wave_scope_plugin_init (GstPlugin * plugin); + +GST_ELEMENT_REGISTER_DECLARE (wavescope); G_END_DECLS #endif /* __GST_WAVE_SCOPE_H__ */ diff --git a/gst/audiovisualizers/plugin.c b/gst/audiovisualizers/plugin.c index b93f491..1bee912 100644 --- a/gst/audiovisualizers/plugin.c +++ b/gst/audiovisualizers/plugin.c @@ -32,13 +32,14 @@ static gboolean plugin_init (GstPlugin * plugin) { - gboolean res = TRUE; + gboolean ret = FALSE; - res &= gst_space_scope_plugin_init (plugin); - res &= gst_spectra_scope_plugin_init (plugin); - res &= gst_synae_scope_plugin_init (plugin); - res &= gst_wave_scope_plugin_init (plugin); - return res; + ret |= GST_ELEMENT_REGISTER (spacescope, plugin); + ret |= GST_ELEMENT_REGISTER (spectrascope, plugin); + ret |= GST_ELEMENT_REGISTER (synaescope, plugin); + ret |= GST_ELEMENT_REGISTER (wavescope, plugin); + + return ret; } GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, diff --git a/gst/autoconvert/gstautoconvert.c b/gst/autoconvert/gstautoconvert.c index 2c2433e..08ad54a 100644 --- a/gst/autoconvert/gstautoconvert.c +++ b/gst/autoconvert/gstautoconvert.c @@ -145,6 +145,8 @@ static GQuark internal_sinkpad_quark = 0; static GQuark parent_quark = 0; G_DEFINE_TYPE (GstAutoConvert, gst_auto_convert, GST_TYPE_BIN); +GST_ELEMENT_REGISTER_DEFINE (autoconvert, "autoconvert", + GST_RANK_NONE, GST_TYPE_AUTO_CONVERT); static void gst_auto_convert_class_init (GstAutoConvertClass * klass) diff --git a/gst/autoconvert/gstautoconvert.h b/gst/autoconvert/gstautoconvert.h index eaa4f02..310dfb02 100644 --- a/gst/autoconvert/gstautoconvert.h +++ b/gst/autoconvert/gstautoconvert.h @@ -61,6 +61,7 @@ struct _GstAutoConvertClass }; GType gst_auto_convert_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (autoconvert); G_END_DECLS #endif /* __GST_AUTO_CONVERT_H__ */ diff --git a/gst/autoconvert/gstautovideoconvert.c b/gst/autoconvert/gstautovideoconvert.c index 5992c78..7481e7d 100644 --- a/gst/autoconvert/gstautovideoconvert.c +++ b/gst/autoconvert/gstautovideoconvert.c @@ -131,6 +131,8 @@ gst_auto_video_convert_update_factory_list (GstAutoVideoConvert * } G_DEFINE_TYPE (GstAutoVideoConvert, gst_auto_video_convert, GST_TYPE_BIN); +GST_ELEMENT_REGISTER_DEFINE (autovideoconvert, "autovideoconvert", + GST_RANK_NONE, GST_TYPE_AUTO_VIDEO_CONVERT); static void gst_auto_video_convert_class_init (GstAutoVideoConvertClass * klass) diff --git a/gst/autoconvert/gstautovideoconvert.h b/gst/autoconvert/gstautovideoconvert.h index b3fe894..8138993 100644 --- a/gst/autoconvert/gstautovideoconvert.h +++ b/gst/autoconvert/gstautovideoconvert.h @@ -50,6 +50,7 @@ struct _GstAutoVideoConvertClass }; GType gst_auto_video_convert_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (autovideoconvert); G_END_DECLS #endif /* __GST_AUTO_VIDEO_CONVERT_H__ */ diff --git a/gst/autoconvert/plugin.c b/gst/autoconvert/plugin.c index 03c05ab..fd6d39c 100644 --- a/gst/autoconvert/plugin.c +++ b/gst/autoconvert/plugin.c @@ -28,13 +28,10 @@ static gboolean plugin_init (GstPlugin * plugin) { - gboolean ret; + gboolean ret = FALSE; - ret = gst_element_register (plugin, "autoconvert", - GST_RANK_NONE, GST_TYPE_AUTO_CONVERT); - - ret &= gst_element_register (plugin, "autovideoconvert", - GST_RANK_NONE, GST_TYPE_AUTO_VIDEO_CONVERT); + ret |= GST_ELEMENT_REGISTER (autoconvert, plugin); + ret |= GST_ELEMENT_REGISTER (autovideoconvert, plugin); return ret; } diff --git a/gst/bayer/gstbayer.c b/gst/bayer/gstbayer.c index 70f54d1..c8042a9 100644 --- a/gst/bayer/gstbayer.c +++ b/gst/bayer/gstbayer.c @@ -23,19 +23,17 @@ #include - -GType gst_bayer2rgb_get_type (void); -GType gst_rgb2bayer_get_type (void); +#include "gstbayerelements.h" static gboolean plugin_init (GstPlugin * plugin) { - gst_element_register (plugin, "bayer2rgb", GST_RANK_NONE, - gst_bayer2rgb_get_type ()); - gst_element_register (plugin, "rgb2bayer", GST_RANK_NONE, - gst_rgb2bayer_get_type ()); + gboolean ret = FALSE; + + ret |= GST_ELEMENT_REGISTER (bayer2rgb, plugin); + ret |= GST_ELEMENT_REGISTER (rgb2bayer, plugin); - return TRUE; + return ret; } GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, diff --git a/gst/bayer/gstbayer2rgb.c b/gst/bayer/gstbayer2rgb.c index e13a5cc..109bab2 100644 --- a/gst/bayer/gstbayer2rgb.c +++ b/gst/bayer/gstbayer2rgb.c @@ -86,6 +86,7 @@ #include #endif +#include "gstbayerelements.h" #include "gstbayerorc.h" #define GST_CAT_DEFAULT gst_bayer2rgb_debug @@ -145,6 +146,8 @@ GType gst_bayer2rgb_get_type (void); #define gst_bayer2rgb_parent_class parent_class G_DEFINE_TYPE (GstBayer2RGB, gst_bayer2rgb, GST_TYPE_BASE_TRANSFORM); +GST_ELEMENT_REGISTER_DEFINE (bayer2rgb, "bayer2rgb", GST_RANK_NONE, + gst_bayer2rgb_get_type ()); static void gst_bayer2rgb_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec); diff --git a/gst/bayer/gstbayerelements.h b/gst/bayer/gstbayerelements.h new file mode 100644 index 0000000..cba9568 --- /dev/null +++ b/gst/bayer/gstbayerelements.h @@ -0,0 +1,33 @@ +/* GStreamer + * Copyright (C) <2020> Julian Bouzas + * + * 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_BAYER_ELEMENT_H__ +#define __GST_BAYER_ELEMENT_H__ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include + +GST_ELEMENT_REGISTER_DECLARE (bayer2rgb); +GST_ELEMENT_REGISTER_DECLARE (rgb2bayer); + +#endif /* __GST_BAYER_ELEMENT_H__ */ diff --git a/gst/bayer/gstrgb2bayer.c b/gst/bayer/gstrgb2bayer.c index 787fe99..8adeb77 100644 --- a/gst/bayer/gstrgb2bayer.c +++ b/gst/bayer/gstrgb2bayer.c @@ -25,6 +25,7 @@ #include #include #include +#include "gstbayerelements.h" #include "gstrgb2bayer.h" #define GST_CAT_DEFAULT gst_rgb2bayer_debug @@ -76,6 +77,8 @@ GST_STATIC_PAD_TEMPLATE ("src", #define gst_rgb2bayer_parent_class parent_class G_DEFINE_TYPE (GstRGB2Bayer, gst_rgb2bayer, GST_TYPE_BASE_TRANSFORM); +GST_ELEMENT_REGISTER_DEFINE (rgb2bayer, "rgb2bayer", GST_RANK_NONE, + gst_rgb2bayer_get_type ()); static void gst_rgb2bayer_class_init (GstRGB2BayerClass * klass) diff --git a/gst/camerabin2/gstcamerabin2.c b/gst/camerabin2/gstcamerabin2.c index 502ed73..6ac5ce4 100644 --- a/gst/camerabin2/gstcamerabin2.c +++ b/gst/camerabin2/gstcamerabin2.c @@ -311,6 +311,11 @@ gst_camera_bin2_get_type (void) return gst_camera_bin_type; } +GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (camerabin, "camerabin", GST_RANK_NONE, + gst_camera_bin2_get_type (), GST_DEBUG_CATEGORY_INIT (gst_camera_bin_debug, + "camerabin", 0, "CameraBin"); + ); + /* GObject class functions */ static void gst_camera_bin_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec); @@ -2390,12 +2395,3 @@ gst_camera_bin_get_property (GObject * object, guint prop_id, break; } } - -gboolean -gst_camera_bin2_plugin_init (GstPlugin * plugin) -{ - GST_DEBUG_CATEGORY_INIT (gst_camera_bin_debug, "camerabin", 0, "CameraBin"); - - return gst_element_register (plugin, "camerabin", GST_RANK_NONE, - gst_camera_bin2_get_type ()); -} diff --git a/gst/camerabin2/gstcamerabin2.h b/gst/camerabin2/gstcamerabin2.h index ba55a7e..f478daa 100644 --- a/gst/camerabin2/gstcamerabin2.h +++ b/gst/camerabin2/gstcamerabin2.h @@ -161,7 +161,7 @@ struct _GstCameraBin2Class }; GType gst_camera_bin2_get_type (void); -gboolean gst_camera_bin2_plugin_init (GstPlugin * plugin); +GST_ELEMENT_REGISTER_DECLARE (camerabin); G_END_DECLS diff --git a/gst/camerabin2/gstplugin.c b/gst/camerabin2/gstplugin.c index 320bb2c..bc0c816 100644 --- a/gst/camerabin2/gstplugin.c +++ b/gst/camerabin2/gstplugin.c @@ -30,14 +30,13 @@ static gboolean plugin_init (GstPlugin * plugin) { - if (!gst_viewfinder_bin_plugin_init (plugin)) - return FALSE; - if (!gst_wrapper_camera_bin_src_plugin_init (plugin)) - return FALSE; - if (!gst_camera_bin2_plugin_init (plugin)) - return FALSE; + gboolean ret = FALSE; - return TRUE; + ret |= GST_ELEMENT_REGISTER (viewfinderbin, plugin); + ret |= GST_ELEMENT_REGISTER (wrappercamerabinsrc, plugin); + ret |= GST_ELEMENT_REGISTER (camerabin, plugin); + + return ret; } GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, diff --git a/gst/camerabin2/gstviewfinderbin.c b/gst/camerabin2/gstviewfinderbin.c index 3a96e89..1c37cef 100644 --- a/gst/camerabin2/gstviewfinderbin.c +++ b/gst/camerabin2/gstviewfinderbin.c @@ -63,6 +63,11 @@ static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink", /* class initialization */ #define gst_viewfinder_bin_parent_class parent_class G_DEFINE_TYPE (GstViewfinderBin, gst_viewfinder_bin, GST_TYPE_BIN); +GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (viewfinderbin, "viewfinderbin", + GST_RANK_NONE, gst_viewfinder_bin_get_type (), + GST_DEBUG_CATEGORY_INIT (gst_viewfinder_bin_debug, "viewfinderbin", 0, + "ViewFinderBin"); + ); static void gst_viewfinder_bin_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * spec); @@ -358,12 +363,3 @@ gst_viewfinder_bin_get_property (GObject * object, guint prop_id, break; } } - -gboolean -gst_viewfinder_bin_plugin_init (GstPlugin * plugin) -{ - GST_DEBUG_CATEGORY_INIT (gst_viewfinder_bin_debug, "viewfinderbin", 0, - "ViewFinderBin"); - return gst_element_register (plugin, "viewfinderbin", GST_RANK_NONE, - gst_viewfinder_bin_get_type ()); -} diff --git a/gst/camerabin2/gstviewfinderbin.h b/gst/camerabin2/gstviewfinderbin.h index 3479120..28845db 100644 --- a/gst/camerabin2/gstviewfinderbin.h +++ b/gst/camerabin2/gstviewfinderbin.h @@ -53,7 +53,7 @@ struct _GstViewfinderBinClass }; GType gst_viewfinder_bin_get_type (void); -gboolean gst_viewfinder_bin_plugin_init (GstPlugin * plugin); +GST_ELEMENT_REGISTER_DECLARE (viewfinderbin); G_END_DECLS diff --git a/gst/camerabin2/gstwrappercamerabinsrc.c b/gst/camerabin2/gstwrappercamerabinsrc.c index 6fd1129..491007e 100644 --- a/gst/camerabin2/gstwrappercamerabinsrc.c +++ b/gst/camerabin2/gstwrappercamerabinsrc.c @@ -52,6 +52,8 @@ GST_DEBUG_CATEGORY (wrapper_camera_bin_src_debug); #define gst_wrapper_camera_bin_src_parent_class parent_class G_DEFINE_TYPE (GstWrapperCameraBinSrc, gst_wrapper_camera_bin_src, GST_TYPE_BASE_CAMERA_SRC); +GST_ELEMENT_REGISTER_DEFINE (wrappercamerabinsrc, "wrappercamerabinsrc", + GST_RANK_NONE, gst_wrapper_camera_bin_src_get_type ()); static GstStaticPadTemplate vfsrc_template = GST_STATIC_PAD_TEMPLATE (GST_BASE_CAMERA_SRC_VIEWFINDER_PAD_NAME, @@ -1169,10 +1171,3 @@ gst_wrapper_camera_bin_src_init (GstWrapperCameraBinSrc * self) self->mode = GST_BASE_CAMERA_SRC_CAST (self)->mode; self->app_vid_filter = NULL; } - -gboolean -gst_wrapper_camera_bin_src_plugin_init (GstPlugin * plugin) -{ - return gst_element_register (plugin, "wrappercamerabinsrc", GST_RANK_NONE, - gst_wrapper_camera_bin_src_get_type ()); -} diff --git a/gst/camerabin2/gstwrappercamerabinsrc.h b/gst/camerabin2/gstwrappercamerabinsrc.h index 90ab0cc..66a6723 100644 --- a/gst/camerabin2/gstwrappercamerabinsrc.h +++ b/gst/camerabin2/gstwrappercamerabinsrc.h @@ -124,7 +124,7 @@ struct _GstWrapperCameraBinSrcClass GstBaseCameraSrcClass parent; }; -gboolean gst_wrapper_camera_bin_src_plugin_init (GstPlugin * plugin); +GST_ELEMENT_REGISTER_DECLARE (wrappercamerabinsrc); G_END_DECLS diff --git a/gst/coloreffects/gstchromahold.c b/gst/coloreffects/gstchromahold.c index 1ddb4c0..06b0001 100644 --- a/gst/coloreffects/gstchromahold.c +++ b/gst/coloreffects/gstchromahold.c @@ -111,6 +111,8 @@ static void gst_chroma_hold_finalize (GObject * object); #define gst_chroma_hold_parent_class parent_class G_DEFINE_TYPE (GstChromaHold, gst_chroma_hold, GST_TYPE_VIDEO_FILTER); +GST_ELEMENT_REGISTER_DEFINE (chromahold, "chromahold", + GST_RANK_NONE, gst_chroma_hold_get_type ()); static void gst_chroma_hold_class_init (GstChromaHoldClass * klass) diff --git a/gst/coloreffects/gstchromahold.h b/gst/coloreffects/gstchromahold.h index ebe74a2..4cfea3d 100644 --- a/gst/coloreffects/gstchromahold.h +++ b/gst/coloreffects/gstchromahold.h @@ -74,6 +74,7 @@ struct _GstChromaHoldClass }; GType gst_chroma_hold_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (chromahold); G_END_DECLS #endif /* __GST_CHROMA_HOLD_H__ */ diff --git a/gst/coloreffects/gstcoloreffects.c b/gst/coloreffects/gstcoloreffects.c index ecbc3fc..68bbb5c 100644 --- a/gst/coloreffects/gstcoloreffects.c +++ b/gst/coloreffects/gstcoloreffects.c @@ -51,6 +51,8 @@ enum #define gst_color_effects_parent_class parent_class G_DEFINE_TYPE (GstColorEffects, gst_color_effects, GST_TYPE_VIDEO_FILTER); +GST_ELEMENT_REGISTER_DEFINE (coloreffects, "coloreffects", + GST_RANK_NONE, gst_color_effects_get_type ()); #define CAPS_STR GST_VIDEO_CAPS_MAKE ("{ " \ "ARGB, BGRA, ABGR, RGBA, xRGB, BGRx, xBGR, RGBx, RGB, BGR, AYUV }") diff --git a/gst/coloreffects/gstcoloreffects.h b/gst/coloreffects/gstcoloreffects.h index 50c9aa0..c35f786 100644 --- a/gst/coloreffects/gstcoloreffects.h +++ b/gst/coloreffects/gstcoloreffects.h @@ -87,6 +87,7 @@ struct _GstColorEffectsClass }; GType gst_color_effects_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (coloreffects); G_END_DECLS #endif /* __GST_COLOR_EFFECTS_H__ */ diff --git a/gst/coloreffects/gstplugin.c b/gst/coloreffects/gstplugin.c index fdd4b55..071d0c5 100644 --- a/gst/coloreffects/gstplugin.c +++ b/gst/coloreffects/gstplugin.c @@ -26,31 +26,16 @@ #include "gstcoloreffects.h" #include "gstchromahold.h" -struct _elements_entry -{ - const gchar *name; - GType (*type) (void); -}; - -static const struct _elements_entry _elements[] = { - {"coloreffects", gst_color_effects_get_type}, - {"chromahold", gst_chroma_hold_get_type}, - {NULL, 0}, -}; static gboolean plugin_init (GstPlugin * plugin) { - gint i = 0; + gboolean ret = FALSE; - while (_elements[i].name) { - if (!gst_element_register (plugin, _elements[i].name, - GST_RANK_NONE, (_elements[i].type) ())) - return FALSE; - i++; - } + ret |= GST_ELEMENT_REGISTER (coloreffects, plugin); + ret |= GST_ELEMENT_REGISTER (chromahold, plugin); - return TRUE; + return ret; } GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, diff --git a/gst/debugutils/debugutilsbad.c b/gst/debugutils/debugutilsbad.c index 51682e9..29376a3 100644 --- a/gst/debugutils/debugutilsbad.c +++ b/gst/debugutils/debugutilsbad.c @@ -23,45 +23,27 @@ #include -GType gst_checksum_sink_get_type (void); -GType fps_display_sink_get_type (void); -GType gst_chop_my_data_get_type (void); -GType gst_compare_get_type (void); -GType gst_debug_spy_get_type (void); -GType gst_error_ignore_get_type (void); -GType gst_watchdog_get_type (void); -GType gst_fake_audio_sink_get_type (void); -GType gst_fake_video_sink_get_type (void); -GType gst_test_src_bin_get_type (void); -GType gst_clock_select_get_type (void); + +#include "gstdebugutilsbadelements.h" static gboolean plugin_init (GstPlugin * plugin) { - gst_element_register (plugin, "checksumsink", GST_RANK_NONE, - gst_checksum_sink_get_type ()); - gst_element_register (plugin, "fpsdisplaysink", GST_RANK_NONE, - fps_display_sink_get_type ()); - gst_element_register (plugin, "chopmydata", GST_RANK_NONE, - gst_chop_my_data_get_type ()); - gst_element_register (plugin, "compare", GST_RANK_NONE, - gst_compare_get_type ()); - gst_element_register (plugin, "debugspy", GST_RANK_NONE, - gst_debug_spy_get_type ()); - gst_element_register (plugin, "watchdog", GST_RANK_NONE, - gst_watchdog_get_type ()); - gst_element_register (plugin, "errorignore", GST_RANK_NONE, - gst_error_ignore_get_type ()); - gst_element_register (plugin, "fakeaudiosink", GST_RANK_NONE, - gst_fake_audio_sink_get_type ()); - gst_element_register (plugin, "fakevideosink", GST_RANK_NONE, - gst_fake_video_sink_get_type ()); - gst_element_register (plugin, "testsrcbin", GST_RANK_NONE, - gst_test_src_bin_get_type ()); - gst_element_register (plugin, "clockselect", GST_RANK_NONE, - gst_clock_select_get_type ()); + gboolean ret = FALSE; + + ret |= GST_ELEMENT_REGISTER (checksumsink, plugin); + ret |= GST_ELEMENT_REGISTER (fpsdisplaysink, plugin); + ret |= GST_ELEMENT_REGISTER (chopmydata, plugin); + ret |= GST_ELEMENT_REGISTER (compare, plugin); + ret |= GST_ELEMENT_REGISTER (debugspy, plugin); + ret |= GST_ELEMENT_REGISTER (watchdog, plugin); + ret |= GST_ELEMENT_REGISTER (errorignore, plugin); + ret |= GST_ELEMENT_REGISTER (fakevideosink, plugin); + ret |= GST_ELEMENT_REGISTER (fakeaudiosink, plugin); + ret |= GST_ELEMENT_REGISTER (testsrcbin, plugin); + ret |= GST_ELEMENT_REGISTER (clockselect, plugin); - return TRUE; + return ret; } GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, diff --git a/gst/debugutils/fpsdisplaysink.c b/gst/debugutils/fpsdisplaysink.c index 90c429e..fd2b974 100644 --- a/gst/debugutils/fpsdisplaysink.c +++ b/gst/debugutils/fpsdisplaysink.c @@ -47,6 +47,7 @@ #include "config.h" #endif +#include "gstdebugutilsbadelements.h" #include "fpsdisplaysink.h" #define DEFAULT_SIGNAL_FPS_MEASUREMENTS FALSE @@ -723,3 +724,6 @@ fps_display_sink_get_type (void) return fps_display_sink_type; } + +GST_ELEMENT_REGISTER_DEFINE (fpsdisplaysink, "fpsdisplaysink", + GST_RANK_NONE, fps_display_sink_get_type ()); diff --git a/gst/debugutils/gstchecksumsink.c b/gst/debugutils/gstchecksumsink.c index 337fba0..37a5d77 100644 --- a/gst/debugutils/gstchecksumsink.c +++ b/gst/debugutils/gstchecksumsink.c @@ -23,6 +23,7 @@ #include #include +#include "gstdebugutilsbadelements.h" #include "gstchecksumsink.h" static void gst_checksum_sink_set_property (GObject * object, guint prop_id, @@ -73,6 +74,8 @@ gst_checksum_sink_hash_get_type (void) #define gst_checksum_sink_parent_class parent_class G_DEFINE_TYPE (GstChecksumSink, gst_checksum_sink, GST_TYPE_BASE_SINK); +GST_ELEMENT_REGISTER_DEFINE (checksumsink, "checksumsink", + GST_RANK_NONE, gst_checksum_sink_get_type ()); static void gst_checksum_sink_class_init (GstChecksumSinkClass * klass) diff --git a/gst/debugutils/gstchopmydata.c b/gst/debugutils/gstchopmydata.c index 2d4c4b4..7689b42 100644 --- a/gst/debugutils/gstchopmydata.c +++ b/gst/debugutils/gstchopmydata.c @@ -45,6 +45,7 @@ #include #include +#include "gstdebugutilsbadelements.h" #include "gstchopmydata.h" /* prototypes */ @@ -95,6 +96,8 @@ GST_STATIC_PAD_TEMPLATE ("src", #define gst_chop_my_data_parent_class parent_class G_DEFINE_TYPE (GstChopMyData, gst_chop_my_data, GST_TYPE_ELEMENT); +GST_ELEMENT_REGISTER_DEFINE (chopmydata, "chopmydata", + GST_RANK_NONE, gst_chop_my_data_get_type ()); static void gst_chop_my_data_class_init (GstChopMyDataClass * klass) diff --git a/gst/debugutils/gstclockselect.c b/gst/debugutils/gstclockselect.c index a8f574b..663228a 100644 --- a/gst/debugutils/gstclockselect.c +++ b/gst/debugutils/gstclockselect.c @@ -39,6 +39,7 @@ #include #include +#include "gstdebugutilsbadelements.h" #include "gstclockselect.h" GST_DEBUG_CATEGORY_STATIC (gst_clock_select_debug_category); @@ -94,6 +95,8 @@ enum G_DEFINE_TYPE_WITH_CODE (GstClockSelect, gst_clock_select, GST_TYPE_PIPELINE, GST_DEBUG_CATEGORY_INIT (gst_clock_select_debug_category, "clockselect", 0, "debug category for clockselect element")); +GST_ELEMENT_REGISTER_DEFINE (clockselect, "clockselect", + GST_RANK_NONE, gst_clock_select_get_type ()); static void gst_clock_select_class_init (GstClockSelectClass * klass) diff --git a/gst/debugutils/gstcompare.c b/gst/debugutils/gstcompare.c index 196d79b..31f9ee6 100644 --- a/gst/debugutils/gstcompare.c +++ b/gst/debugutils/gstcompare.c @@ -29,6 +29,7 @@ #include #include +#include "gstdebugutilsbadelements.h" #include "gstcompare.h" GST_DEBUG_CATEGORY_STATIC (compare_debug); @@ -117,6 +118,8 @@ static GstStateChangeReturn gst_compare_change_state (GstElement * element, #define gst_compare_parent_class parent_class G_DEFINE_TYPE (GstCompare, gst_compare, GST_TYPE_ELEMENT); +GST_ELEMENT_REGISTER_DEFINE (compare, "compare", + GST_RANK_NONE, gst_compare_get_type ()); static void gst_compare_finalize (GObject * object) diff --git a/gst/debugutils/gstdebugspy.c b/gst/debugutils/gstdebugspy.c index baacc4b..58f30b9 100644 --- a/gst/debugutils/gstdebugspy.c +++ b/gst/debugutils/gstdebugspy.c @@ -40,6 +40,7 @@ #include +#include "gstdebugutilsbadelements.h" #include "gstdebugspy.h" GST_DEBUG_CATEGORY_STATIC (gst_debug_spy_debug); @@ -96,6 +97,8 @@ static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src", ); G_DEFINE_TYPE (GstDebugSpy, gst_debug_spy, GST_TYPE_BASE_TRANSFORM); +GST_ELEMENT_REGISTER_DEFINE (debugspy, "debugspy", + GST_RANK_NONE, gst_debug_spy_get_type ()); static void gst_debug_spy_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec); diff --git a/gst/debugutils/gstdebugutilsbadelements.h b/gst/debugutils/gstdebugutilsbadelements.h new file mode 100644 index 0000000..71a42cb --- /dev/null +++ b/gst/debugutils/gstdebugutilsbadelements.h @@ -0,0 +1,43 @@ +/* GStreamer + * Copyright (C) <2020> Julian Bouzas + * + * 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_DEBUGUTILSBAD_ELEMENT_H__ +#define __GST_DEBUGUTILSBAD_ELEMENT_H__ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include + +GST_ELEMENT_REGISTER_DECLARE (fpsdisplaysink); +GST_ELEMENT_REGISTER_DECLARE (checksumsink); +GST_ELEMENT_REGISTER_DECLARE (chopmydata); +GST_ELEMENT_REGISTER_DECLARE (clockselect); +GST_ELEMENT_REGISTER_DECLARE (compare); +GST_ELEMENT_REGISTER_DECLARE (debugspy); +GST_ELEMENT_REGISTER_DECLARE (testsrcbin); +GST_ELEMENT_REGISTER_DECLARE (errorignore); +GST_ELEMENT_REGISTER_DECLARE (fakevideosink); +GST_ELEMENT_REGISTER_DECLARE (fakeaudiosink); +GST_ELEMENT_REGISTER_DECLARE (watchdog); + + +#endif /* __GST_DEBUGUTILSBAD_PLUGIN_H__ */ diff --git a/gst/debugutils/gsterrorignore.c b/gst/debugutils/gsterrorignore.c index 768d8f7..f65ca92 100644 --- a/gst/debugutils/gsterrorignore.c +++ b/gst/debugutils/gsterrorignore.c @@ -38,6 +38,7 @@ #include "config.h" #endif +#include "gstdebugutilsbadelements.h" #include "gsterrorignore.h" #define GST_CAT_DEFAULT gst_error_ignore_debug @@ -69,6 +70,8 @@ static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src", #define parent_class gst_error_ignore_parent_class G_DEFINE_TYPE (GstErrorIgnore, gst_error_ignore, GST_TYPE_ELEMENT); +GST_ELEMENT_REGISTER_DEFINE (errorignore, "errorignore", + GST_RANK_NONE, gst_error_ignore_get_type ()); static GstFlowReturn gst_error_ignore_sink_chain (GstPad * pad, GstObject * parent, GstBuffer * inbuf); diff --git a/gst/debugutils/gstfakeaudiosink.c b/gst/debugutils/gstfakeaudiosink.c index 8f8c56b..8955345 100644 --- a/gst/debugutils/gstfakeaudiosink.c +++ b/gst/debugutils/gstfakeaudiosink.c @@ -37,6 +37,7 @@ * Since: 1.20 */ +#include "gstdebugutilsbadelements.h" #include "gstfakeaudiosink.h" #include @@ -57,6 +58,8 @@ static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink", G_DEFINE_TYPE_WITH_CODE (GstFakeAudioSink, gst_fake_audio_sink, GST_TYPE_BIN, G_IMPLEMENT_INTERFACE (GST_TYPE_STREAM_VOLUME, NULL);); +GST_ELEMENT_REGISTER_DEFINE (fakeaudiosink, "fakeaudiosink", + GST_RANK_NONE, gst_fake_audio_sink_get_type ()); /* TODO complete the types and make this an utility */ static void diff --git a/gst/debugutils/gstfakevideosink.c b/gst/debugutils/gstfakevideosink.c index ddb2ae1..c524ccf 100644 --- a/gst/debugutils/gstfakevideosink.c +++ b/gst/debugutils/gstfakevideosink.c @@ -37,6 +37,7 @@ * Since 1.14 */ +#include "gstdebugutilsbadelements.h" #include "gstfakevideosink.h" #include @@ -84,6 +85,8 @@ static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink", GST_VIDEO_FORMATS_ALL))); G_DEFINE_TYPE (GstFakeVideoSink, gst_fake_video_sink, GST_TYPE_BIN); +GST_ELEMENT_REGISTER_DEFINE (fakevideosink, "fakevideosink", + GST_RANK_NONE, gst_fake_video_sink_get_type ()); static gboolean gst_fake_video_sink_query (GstPad * pad, GstObject * parent, GstQuery * query) diff --git a/gst/debugutils/gsttestsrcbin.c b/gst/debugutils/gsttestsrcbin.c index 89e18e8..e97556f 100644 --- a/gst/debugutils/gsttestsrcbin.c +++ b/gst/debugutils/gsttestsrcbin.c @@ -39,6 +39,7 @@ #include #include #include +#include "gstdebugutilsbadelements.h" static GstStaticPadTemplate video_src_template = GST_STATIC_PAD_TEMPLATE ("video_src_%u", @@ -377,6 +378,9 @@ G_DEFINE_TYPE_WITH_CODE (GstTestSrcBin, gst_test_src_bin, GST_TYPE_BIN, G_IMPLEMENT_INTERFACE (GST_TYPE_URI_HANDLER, gst_test_src_bin_uri_handler_init)) /* *INDENT-ON* */ +GST_ELEMENT_REGISTER_DEFINE (testsrcbin, "testsrcbin", + GST_RANK_NONE, gst_test_src_bin_get_type ()); + static void gst_test_src_bin_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec) diff --git a/gst/debugutils/gstwatchdog.c b/gst/debugutils/gstwatchdog.c index a45039a..eb12841 100644 --- a/gst/debugutils/gstwatchdog.c +++ b/gst/debugutils/gstwatchdog.c @@ -46,6 +46,7 @@ #include #include +#include "gstdebugutilsbadelements.h" #include "gstwatchdog.h" GST_DEBUG_CATEGORY_STATIC (gst_watchdog_debug_category); @@ -83,6 +84,8 @@ enum G_DEFINE_TYPE_WITH_CODE (GstWatchdog, gst_watchdog, GST_TYPE_BASE_TRANSFORM, GST_DEBUG_CATEGORY_INIT (gst_watchdog_debug_category, "watchdog", 0, "debug category for watchdog element")); +GST_ELEMENT_REGISTER_DEFINE (watchdog, "watchdog", GST_RANK_NONE, + gst_watchdog_get_type ()); static void gst_watchdog_class_init (GstWatchdogClass * klass) diff --git a/gst/dvbsubenc/gstdvbsubenc.c b/gst/dvbsubenc/gstdvbsubenc.c index bde0954..ab25ae2 100644 --- a/gst/dvbsubenc/gstdvbsubenc.c +++ b/gst/dvbsubenc/gstdvbsubenc.c @@ -51,6 +51,10 @@ enum #define gst_dvb_sub_enc_parent_class parent_class G_DEFINE_TYPE (GstDvbSubEnc, gst_dvb_sub_enc, GST_TYPE_ELEMENT); +GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (dvbsubenc, "dvbsubenc", GST_RANK_NONE, + GST_TYPE_DVB_SUB_ENC, GST_DEBUG_CATEGORY_INIT (gst_dvb_sub_enc_debug, + "dvbsubenc", 0, "DVB subtitle encoder"); + ); static void gst_dvb_sub_enc_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec); @@ -591,15 +595,7 @@ gst_dvb_sub_enc_sink_event (GstPad * pad, GstObject * parent, GstEvent * event) static gboolean plugin_init (GstPlugin * plugin) { - if (!gst_element_register (plugin, "dvbsubenc", GST_RANK_NONE, - GST_TYPE_DVB_SUB_ENC)) { - return FALSE; - } - - GST_DEBUG_CATEGORY_INIT (gst_dvb_sub_enc_debug, "dvbsubenc", 0, - "DVB subtitle encoder"); - - return TRUE; + return GST_ELEMENT_REGISTER (dvbsubenc, plugin); } GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, diff --git a/gst/dvbsubenc/gstdvbsubenc.h b/gst/dvbsubenc/gstdvbsubenc.h index 76d8f5f..507e9f5 100644 --- a/gst/dvbsubenc/gstdvbsubenc.h +++ b/gst/dvbsubenc/gstdvbsubenc.h @@ -64,6 +64,7 @@ struct _GstDvbSubEncClass }; GType gst_dvb_sub_enc_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (dvbsubenc); gboolean gst_dvbsubenc_ayuv_to_ayuv8p (GstVideoFrame * src, GstVideoFrame * dest, int max_colours, guint32 *out_num_colours); diff --git a/gst/dvbsuboverlay/gstdvbsuboverlay.c b/gst/dvbsuboverlay/gstdvbsuboverlay.c index f28590c..d8ac5d6 100644 --- a/gst/dvbsuboverlay/gstdvbsuboverlay.c +++ b/gst/dvbsuboverlay/gstdvbsuboverlay.c @@ -107,6 +107,11 @@ static GstStateChangeReturn gst_dvbsub_overlay_change_state (GstElement * #define gst_dvbsub_overlay_parent_class parent_class G_DEFINE_TYPE (GstDVBSubOverlay, gst_dvbsub_overlay, GST_TYPE_ELEMENT); +GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (dvbsuboverlay, "dvbsuboverlay", + GST_RANK_PRIMARY, GST_TYPE_DVBSUB_OVERLAY, + GST_DEBUG_CATEGORY_INIT (gst_dvbsub_overlay_debug, "dvbsuboverlay", 0, + "DVB subtitle overlay"); + ); static GstCaps *gst_dvbsub_overlay_get_videosink_caps (GstDVBSubOverlay * render, GstPad * pad, GstCaps * filter); @@ -1303,11 +1308,7 @@ gst_dvbsub_overlay_event_text (GstPad * pad, GstObject * parent, static gboolean plugin_init (GstPlugin * plugin) { - GST_DEBUG_CATEGORY_INIT (gst_dvbsub_overlay_debug, "dvbsuboverlay", - 0, "DVB subtitle overlay"); - - return gst_element_register (plugin, "dvbsuboverlay", - GST_RANK_PRIMARY, GST_TYPE_DVBSUB_OVERLAY); + return GST_ELEMENT_REGISTER (dvbsuboverlay, plugin); } GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, diff --git a/gst/dvbsuboverlay/gstdvbsuboverlay.h b/gst/dvbsuboverlay/gstdvbsuboverlay.h index aecfa9d..518fe66 100644 --- a/gst/dvbsuboverlay/gstdvbsuboverlay.h +++ b/gst/dvbsuboverlay/gstdvbsuboverlay.h @@ -76,6 +76,7 @@ struct _GstDVBSubOverlayClass }; GType gst_dvbsub_overlay_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (dvbsuboverlay); G_END_DECLS diff --git a/gst/dvdspu/gstdvdspu.c b/gst/dvdspu/gstdvdspu.c index 41c964b..2e049b6 100644 --- a/gst/dvdspu/gstdvdspu.c +++ b/gst/dvdspu/gstdvdspu.c @@ -75,8 +75,11 @@ static GstStaticPadTemplate subpic_sink_factory = GST_STATIC_CAPS ("subpicture/x-dvd; subpicture/x-pgs") ); +static gboolean dvd_spu_element_init (GstPlugin * plugin); + #define gst_dvd_spu_parent_class parent_class G_DEFINE_TYPE (GstDVDSpu, gst_dvd_spu, GST_TYPE_ELEMENT); +GST_ELEMENT_REGISTER_DEFINE_CUSTOM (dvdspu, dvd_spu_element_init); static void gst_dvd_spu_dispose (GObject * object); static void gst_dvd_spu_finalize (GObject * object); @@ -1238,7 +1241,7 @@ gst_dvd_spu_change_state (GstElement * element, GstStateChange transition) } static gboolean -gst_dvd_spu_plugin_init (GstPlugin * plugin) +dvd_spu_element_init (GstPlugin * plugin) { const gchar *env; @@ -1260,6 +1263,12 @@ gst_dvd_spu_plugin_init (GstPlugin * plugin) GST_RANK_PRIMARY, GST_TYPE_DVD_SPU); } +static gboolean +gst_dvd_spu_plugin_init (GstPlugin * plugin) +{ + return GST_ELEMENT_REGISTER (dvdspu, plugin); +} + GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, GST_VERSION_MINOR, dvdspu, diff --git a/gst/dvdspu/gstdvdspu.h b/gst/dvdspu/gstdvdspu.h index aa8ae77..5c8585d 100644 --- a/gst/dvdspu/gstdvdspu.h +++ b/gst/dvdspu/gstdvdspu.h @@ -123,6 +123,7 @@ struct _GstDVDSpuClass { }; GType gst_dvd_spu_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (dvdspu); typedef enum { GST_DVD_SPU_DEBUG_RENDER_RECTANGLE = (1 << 0), diff --git a/gst/faceoverlay/gstfaceoverlay.c b/gst/faceoverlay/gstfaceoverlay.c index 236d483..12dc641 100644 --- a/gst/faceoverlay/gstfaceoverlay.c +++ b/gst/faceoverlay/gstfaceoverlay.c @@ -89,6 +89,11 @@ static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src", #define gst_face_overlay_parent_class parent_class G_DEFINE_TYPE (GstFaceOverlay, gst_face_overlay, GST_TYPE_BIN); +GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (faceoverlay, "faceoverlay", + GST_RANK_NONE, GST_TYPE_FACEOVERLAY, + GST_DEBUG_CATEGORY_INIT (gst_face_overlay_debug, "faceoverlay", 0, + "SVG Face Overlay"); + ); static void gst_face_overlay_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec); @@ -430,13 +435,9 @@ gst_face_overlay_get_property (GObject * object, guint prop_id, } static gboolean -faceoverlay_init (GstPlugin * faceoverlay) +faceoverlay_init (GstPlugin * plugin) { - GST_DEBUG_CATEGORY_INIT (gst_face_overlay_debug, "faceoverlay", - 0, "SVG Face Overlay"); - - return gst_element_register (faceoverlay, "faceoverlay", GST_RANK_NONE, - GST_TYPE_FACEOVERLAY); + return GST_ELEMENT_REGISTER (faceoverlay, plugin); } GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, diff --git a/gst/faceoverlay/gstfaceoverlay.h b/gst/faceoverlay/gstfaceoverlay.h index 810e28a..315861f 100644 --- a/gst/faceoverlay/gstfaceoverlay.h +++ b/gst/faceoverlay/gstfaceoverlay.h @@ -88,6 +88,7 @@ struct _GstFaceOverlayClass }; GType gst_face_overlay_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (faceoverlay); G_END_DECLS diff --git a/gst/festival/gstfestival.c b/gst/festival/gstfestival.c index d1637ab..0876776 100644 --- a/gst/festival/gstfestival.c +++ b/gst/festival/gstfestival.c @@ -150,9 +150,14 @@ enum /*static guint gst_festival_signals[LAST_SIGNAL] = { 0 }; */ -G_DEFINE_TYPE (GstFestival, gst_festival, GST_TYPE_ELEMENT) +G_DEFINE_TYPE (GstFestival, gst_festival, GST_TYPE_ELEMENT); +GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (festival, "festival", GST_RANK_NONE, + GST_TYPE_FESTIVAL, GST_DEBUG_CATEGORY_INIT (festival_debug, "festival", + 0, "Festival text-to-speech synthesizer"); + );; - static void gst_festival_class_init (GstFestivalClass * klass) +static void +gst_festival_class_init (GstFestivalClass * klass) { GObjectClass *gobject_class; GstElementClass *gstelement_class; @@ -524,14 +529,7 @@ gst_festival_src_query (GstPad * pad, GstObject * parent, GstQuery * query) static gboolean plugin_init (GstPlugin * plugin) { - GST_DEBUG_CATEGORY_INIT (festival_debug, "festival", - 0, "Festival text-to-speech synthesizer"); - - if (!gst_element_register (plugin, "festival", GST_RANK_NONE, - GST_TYPE_FESTIVAL)) - return FALSE; - - return TRUE; + return GST_ELEMENT_REGISTER (festival, plugin); } GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, diff --git a/gst/festival/gstfestival.h b/gst/festival/gstfestival.h index 1e43283..24cba5c 100644 --- a/gst/festival/gstfestival.h +++ b/gst/festival/gstfestival.h @@ -116,6 +116,7 @@ struct _GstFestivalClass { }; GType gst_festival_get_type(void); +GST_ELEMENT_REGISTER_DECLARE (festival); #ifdef __cplusplus } diff --git a/gst/fieldanalysis/gstfieldanalysis.c b/gst/fieldanalysis/gstfieldanalysis.c index 644a91e..8e8f719 100644 --- a/gst/fieldanalysis/gstfieldanalysis.c +++ b/gst/fieldanalysis/gstfieldanalysis.c @@ -108,6 +108,12 @@ GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS, GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("{YUY2,UYVY,Y42B,I420,YV12}"))); G_DEFINE_TYPE (GstFieldAnalysis, gst_field_analysis, GST_TYPE_ELEMENT); +GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (fieldanalysis, "fieldanalysis", + GST_RANK_NONE, GST_TYPE_FIELDANALYSIS, + GST_DEBUG_CATEGORY_INIT (gst_field_analysis_debug, "fieldanalysis", 0, + "Video field analysis"); + ); + #define parent_class gst_field_analysis_parent_class static void gst_field_analysis_set_property (GObject * object, guint prop_id, @@ -1840,13 +1846,9 @@ gst_field_analysis_finalize (GObject * object) static gboolean -fieldanalysis_init (GstPlugin * fieldanalysis) +fieldanalysis_init (GstPlugin * plugin) { - GST_DEBUG_CATEGORY_INIT (gst_field_analysis_debug, "fieldanalysis", - 0, "Video field analysis"); - - return gst_element_register (fieldanalysis, "fieldanalysis", GST_RANK_NONE, - GST_TYPE_FIELDANALYSIS); + return GST_ELEMENT_REGISTER (fieldanalysis, plugin); } GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, diff --git a/gst/fieldanalysis/gstfieldanalysis.h b/gst/fieldanalysis/gstfieldanalysis.h index ff68835..6269b8b 100644 --- a/gst/fieldanalysis/gstfieldanalysis.h +++ b/gst/fieldanalysis/gstfieldanalysis.h @@ -143,6 +143,7 @@ struct _GstFieldAnalysisClass }; GType gst_field_analysis_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (fieldanalysis); G_END_DECLS #endif /* __GST_FIELDANALYSIS_H__ */ diff --git a/gst/freeverb/gstfreeverb.c b/gst/freeverb/gstfreeverb.c index 2ea9ee8..59f7271 100644 --- a/gst/freeverb/gstfreeverb.c +++ b/gst/freeverb/gstfreeverb.c @@ -347,6 +347,8 @@ struct _GstFreeverbPrivate G_DEFINE_TYPE_WITH_CODE (GstFreeverb, gst_freeverb, GST_TYPE_BASE_TRANSFORM, G_ADD_PRIVATE (GstFreeverb) G_IMPLEMENT_INTERFACE (GST_TYPE_PRESET, NULL)); +GST_ELEMENT_REGISTER_DEFINE (freeverb, "freeverb", + GST_RANK_NONE, GST_TYPE_FREEVERB); static void freeverb_revmodel_init (GstFreeverb * filter) @@ -928,8 +930,7 @@ gst_freeverb_transform (GstBaseTransform * base, GstBuffer * inbuf, static gboolean plugin_init (GstPlugin * plugin) { - return gst_element_register (plugin, "freeverb", - GST_RANK_NONE, GST_TYPE_FREEVERB); + return GST_ELEMENT_REGISTER (freeverb, plugin); } GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, diff --git a/gst/freeverb/gstfreeverb.h b/gst/freeverb/gstfreeverb.h index ac6f134..320aefa 100644 --- a/gst/freeverb/gstfreeverb.h +++ b/gst/freeverb/gstfreeverb.h @@ -62,6 +62,7 @@ struct _GstFreeverbClass { }; GType gst_freeverb_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (freeverb); G_END_DECLS diff --git a/gst/gaudieffects/gstburn.c b/gst/gaudieffects/gstburn.c index bc5aefb..e009fd2 100644 --- a/gst/gaudieffects/gstburn.c +++ b/gst/gaudieffects/gstburn.c @@ -64,17 +64,19 @@ #include #include -#include "gstplugin.h" #include "gstburn.h" #include "gstgaudieffectsorc.h" -#define gst_burn_parent_class parent_class -G_DEFINE_TYPE (GstBurn, gst_burn, GST_TYPE_VIDEO_FILTER); - GST_DEBUG_CATEGORY_STATIC (gst_burn_debug); #define GST_CAT_DEFAULT gst_burn_debug +#define gst_burn_parent_class parent_class +G_DEFINE_TYPE (GstBurn, gst_burn, GST_TYPE_VIDEO_FILTER); +GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (burn, "burn", GST_RANK_NONE, + GST_TYPE_BURN, GST_DEBUG_CATEGORY_INIT (gst_burn_debug, "burn", 0, + "Template burn")); + #if G_BYTE_ORDER == G_LITTLE_ENDIAN #define CAPS_STR GST_VIDEO_CAPS_MAKE ("{ BGRx, RGBx }") #else @@ -246,14 +248,3 @@ gst_burn_transform_frame (GstVideoFilter * vfilter, return GST_FLOW_OK; } - -/* Entry point to initialize the plug-in. - * Register the element factories and other features. */ -gboolean -gst_burn_plugin_init (GstPlugin * burn) -{ - /* debug category for fltering log messages */ - GST_DEBUG_CATEGORY_INIT (gst_burn_debug, "burn", 0, "Template burn"); - - return gst_element_register (burn, "burn", GST_RANK_NONE, GST_TYPE_BURN); -} diff --git a/gst/gaudieffects/gstburn.h b/gst/gaudieffects/gstburn.h index 5f563f8..e467e8e 100644 --- a/gst/gaudieffects/gstburn.h +++ b/gst/gaudieffects/gstburn.h @@ -81,6 +81,7 @@ struct _GstBurnClass }; GType gst_burn_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (burn); G_END_DECLS diff --git a/gst/gaudieffects/gstchromium.c b/gst/gaudieffects/gstchromium.c index 1a3f366..24c93aa 100644 --- a/gst/gaudieffects/gstchromium.c +++ b/gst/gaudieffects/gstchromium.c @@ -64,15 +64,17 @@ #include #include -#include "gstplugin.h" #include "gstchromium.h" -#define gst_chromium_parent_class parent_class -G_DEFINE_TYPE (GstChromium, gst_chromium, GST_TYPE_VIDEO_FILTER); - GST_DEBUG_CATEGORY_STATIC (gst_chromium_debug); #define GST_CAT_DEFAULT gst_chromium_debug +#define gst_chromium_parent_class parent_class +G_DEFINE_TYPE (GstChromium, gst_chromium, GST_TYPE_VIDEO_FILTER); +GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (chromium, "chromium", GST_RANK_NONE, + GST_TYPE_CHROMIUM, GST_DEBUG_CATEGORY_INIT (gst_chromium_debug, "chromium", + 0, "Template chromium")); + #if G_BYTE_ORDER == G_LITTLE_ENDIAN #define CAPS_STR GST_VIDEO_CAPS_MAKE ("{ BGRx, RGBx }") #else @@ -275,19 +277,6 @@ gst_chromium_transform_frame (GstVideoFilter * vfilter, return GST_FLOW_OK; } -/* Entry point to initialize the plug-in. - * Register the element factories and other features. */ -gboolean -gst_chromium_plugin_init (GstPlugin * chromium) -{ - /* debug category for fltering log messages */ - GST_DEBUG_CATEGORY_INIT (gst_chromium_debug, "chromium", 0, - "Template chromium"); - - return gst_element_register (chromium, "chromium", GST_RANK_NONE, - GST_TYPE_CHROMIUM); -} - /*** Now the image processing work.... ***/ /* Set up the cosine table. */ void diff --git a/gst/gaudieffects/gstchromium.h b/gst/gaudieffects/gstchromium.h index 8c3b4a0..1b8a44c 100644 --- a/gst/gaudieffects/gstchromium.h +++ b/gst/gaudieffects/gstchromium.h @@ -79,6 +79,7 @@ struct _GstChromiumClass }; GType gst_chromium_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (chromium); G_END_DECLS diff --git a/gst/gaudieffects/gstdilate.c b/gst/gaudieffects/gstdilate.c index 2a1e775..aec92b1 100644 --- a/gst/gaudieffects/gstdilate.c +++ b/gst/gaudieffects/gstdilate.c @@ -64,7 +64,6 @@ #include #include -#include "gstplugin.h" #include "gstdilate.h" GST_DEBUG_CATEGORY_STATIC (gst_dilate_debug); @@ -78,6 +77,9 @@ GST_DEBUG_CATEGORY_STATIC (gst_dilate_debug); #define gst_dilate_parent_class parent_class G_DEFINE_TYPE (GstDilate, gst_dilate, GST_TYPE_VIDEO_FILTER); +GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (dilate, "dilate", GST_RANK_NONE, + GST_TYPE_DILATE, GST_DEBUG_CATEGORY_INIT (gst_dilate_debug, "dilate", 0, + "Template dilate")); /* Filter signals and args. */ enum @@ -250,18 +252,6 @@ gst_dilate_transform_frame (GstVideoFilter * vfilter, return GST_FLOW_OK; } -/* Entry point to initialize the plug-in. - * Register the element factories and other features. */ -gboolean -gst_dilate_plugin_init (GstPlugin * dilate) -{ - /* debug category for fltering log messages */ - GST_DEBUG_CATEGORY_INIT (gst_dilate_debug, "dilate", 0, "Template dilate"); - - return gst_element_register (dilate, "dilate", GST_RANK_NONE, - GST_TYPE_DILATE); -} - /*** Now the image processing work.... ***/ /* Return luminance of the color */ diff --git a/gst/gaudieffects/gstdilate.h b/gst/gaudieffects/gstdilate.h index afb0901..c216a35 100644 --- a/gst/gaudieffects/gstdilate.h +++ b/gst/gaudieffects/gstdilate.h @@ -81,6 +81,7 @@ struct _GstDilateClass }; GType gst_dilate_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (dilate); G_END_DECLS diff --git a/gst/gaudieffects/gstdodge.c b/gst/gaudieffects/gstdodge.c index ee2ce7d..db3c251 100644 --- a/gst/gaudieffects/gstdodge.c +++ b/gst/gaudieffects/gstdodge.c @@ -64,7 +64,6 @@ #include #include -#include "gstplugin.h" #include "gstdodge.h" GST_DEBUG_CATEGORY_STATIC (gst_dodge_debug); @@ -78,6 +77,9 @@ GST_DEBUG_CATEGORY_STATIC (gst_dodge_debug); #define gst_dodge_parent_class parent_class G_DEFINE_TYPE (GstDodge, gst_dodge, GST_TYPE_VIDEO_FILTER); +GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (dodge, "dodge", GST_RANK_NONE, + GST_TYPE_DODGE, GST_DEBUG_CATEGORY_INIT (gst_dodge_debug, "dodge", 0, + "Template dodge")); /* Filter signals and args. */ enum @@ -223,17 +225,6 @@ gst_dodge_transform_frame (GstVideoFilter * vfilter, return GST_FLOW_OK; } -/* Entry point to initialize the plug-in. - * Register the element factories and other features. */ -gboolean -gst_dodge_plugin_init (GstPlugin * dodge) -{ - /* debug category for fltering log messages */ - GST_DEBUG_CATEGORY_INIT (gst_dodge_debug, "dodge", 0, "Template dodge"); - - return gst_element_register (dodge, "dodge", GST_RANK_NONE, GST_TYPE_DODGE); -} - /*** Now the image processing work.... ***/ /* Transform processes each frame. */ diff --git a/gst/gaudieffects/gstdodge.h b/gst/gaudieffects/gstdodge.h index 64bf4d0..53e41c5 100644 --- a/gst/gaudieffects/gstdodge.h +++ b/gst/gaudieffects/gstdodge.h @@ -78,6 +78,7 @@ struct _GstDodgeClass }; GType gst_dodge_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (dodge); G_END_DECLS diff --git a/gst/gaudieffects/gstexclusion.c b/gst/gaudieffects/gstexclusion.c index 6c696b6..0fa4658 100644 --- a/gst/gaudieffects/gstexclusion.c +++ b/gst/gaudieffects/gstexclusion.c @@ -64,7 +64,6 @@ #include #include -#include "gstplugin.h" #include "gstexclusion.h" #include @@ -115,6 +114,9 @@ GST_STATIC_PAD_TEMPLATE ("src", #define gst_exclusion_parent_class parent_class G_DEFINE_TYPE (GstExclusion, gst_exclusion, GST_TYPE_VIDEO_FILTER); +GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (exclusion, "exclusion", GST_RANK_NONE, + GST_TYPE_EXCLUSION, GST_DEBUG_CATEGORY_INIT (gst_exclusion_debug, + "exclusion", 0, "Template exclusion")); static void gst_exclusion_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec); @@ -248,19 +250,6 @@ gst_exclusion_transform_frame (GstVideoFilter * vfilter, return GST_FLOW_OK; } -/* Entry point to initialize the plug-in. - * Register the element factories and other features. */ -gboolean -gst_exclusion_plugin_init (GstPlugin * exclusion) -{ - /* debug category for fltering log messages */ - GST_DEBUG_CATEGORY_INIT (gst_exclusion_debug, "exclusion", - 0, "Template exclusion"); - - return gst_element_register (exclusion, "exclusion", GST_RANK_NONE, - GST_TYPE_EXCLUSION); -} - /*** Now the image processing work.... ***/ /* Transform processes each frame. */ diff --git a/gst/gaudieffects/gstexclusion.h b/gst/gaudieffects/gstexclusion.h index b910835..fc15e70 100644 --- a/gst/gaudieffects/gstexclusion.h +++ b/gst/gaudieffects/gstexclusion.h @@ -81,6 +81,7 @@ struct _GstExclusionClass }; GType gst_exclusion_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (exclusion); G_END_DECLS diff --git a/gst/gaudieffects/gstgaussblur.c b/gst/gaudieffects/gstgaussblur.c index dc2d479..1c274c8 100644 --- a/gst/gaudieffects/gstgaussblur.c +++ b/gst/gaudieffects/gstgaussblur.c @@ -66,7 +66,6 @@ #include #include -#include "gstplugin.h" #include "gstgaussblur.h" static void gst_gaussianblur_finalize (GObject * object); @@ -120,7 +119,10 @@ static void gaussian_smooth (GstGaussianBlur * gb, guint8 * image, #define gst_gaussianblur_parent_class parent_class G_DEFINE_TYPE (GstGaussianBlur, gst_gaussianblur, GST_TYPE_VIDEO_FILTER); - +GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (gaussianblur, "gaussianblur", + GST_RANK_NONE, GST_TYPE_GAUSSIANBLUR, + GST_DEBUG_CATEGORY_INIT (gst_gauss_blur_debug, "gaussianblur", 0, + "Gaussian Blur video effect")); #define DEFAULT_SIGMA 1.2 /* Initialize the gaussianblur's class. */ @@ -452,15 +454,3 @@ gst_gaussianblur_get_property (GObject * object, break; } } - -/* Register the element factories and other features. */ -gboolean -gst_gauss_blur_plugin_init (GstPlugin * plugin) -{ - /* debug category for fltering log messages */ - GST_DEBUG_CATEGORY_INIT (gst_gauss_blur_debug, "gaussianblur", - 0, "Gaussian Blur video effect"); - - return gst_element_register (plugin, "gaussianblur", GST_RANK_NONE, - GST_TYPE_GAUSSIANBLUR); -} diff --git a/gst/gaudieffects/gstgaussblur.h b/gst/gaudieffects/gstgaussblur.h index 33cbb02..bd39ee3 100644 --- a/gst/gaudieffects/gstgaussblur.h +++ b/gst/gaudieffects/gstgaussblur.h @@ -81,6 +81,7 @@ struct _GstGaussianBlurClass }; GType gst_gaussianblur_get_type(void); +GST_ELEMENT_REGISTER_DECLARE (gaussianblur); G_END_DECLS diff --git a/gst/gaudieffects/gstplugin.c b/gst/gaudieffects/gstplugin.c index 0bcd011..1f1ceb5 100644 --- a/gst/gaudieffects/gstplugin.c +++ b/gst/gaudieffects/gstplugin.c @@ -49,7 +49,14 @@ #include -#include "gstplugin.h" +#include "gstburn.h" +#include "gstchromium.h" +#include "gstdilate.h" +#include "gstdodge.h" +#include "gstexclusion.h" +#include "gstgaussblur.h" +#include "gstsolarize.h" + /* PACKAGE: this is usually set by autotools depending on some _INIT macro * in configure.ac and then written into and defined in config.h, but we can @@ -63,15 +70,15 @@ static gboolean plugin_init (GstPlugin * plugin) { - gboolean ret = TRUE; + gboolean ret = FALSE; - ret &= gst_burn_plugin_init (plugin); - ret &= gst_chromium_plugin_init (plugin); - ret &= gst_dilate_plugin_init (plugin); - ret &= gst_dodge_plugin_init (plugin); - ret &= gst_exclusion_plugin_init (plugin); - ret &= gst_solarize_plugin_init (plugin); - ret &= gst_gauss_blur_plugin_init (plugin); + ret |= GST_ELEMENT_REGISTER (burn, plugin); + ret |= GST_ELEMENT_REGISTER (chromium, plugin); + ret |= GST_ELEMENT_REGISTER (dilate, plugin); + ret |= GST_ELEMENT_REGISTER (dodge, plugin); + ret |= GST_ELEMENT_REGISTER (exclusion, plugin); + ret |= GST_ELEMENT_REGISTER (solarize, plugin); + ret |= GST_ELEMENT_REGISTER (gaussianblur, plugin); return ret; } diff --git a/gst/gaudieffects/gstplugin.h b/gst/gaudieffects/gstplugin.h deleted file mode 100644 index 5cc4249..0000000 --- a/gst/gaudieffects/gstplugin.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * GStreamer - * Copyright (C) 2005 Thomas Vander Stichele - * Copyright (C) 2005 Ronald S. Bultje - * Copyright (C) 2010 Luis de Bethencourt - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Alternatively, the contents of this file may be used under the - * GNU Lesser General Public License Version 2.1 (the "LGPL"), in - * which case the following provisions apply instead of the ones - * mentioned above: - * - * 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_GAUDI_EFFECTS_H__ -#define __GST_GAUDI_EFFECTS_H__ - -#include - -G_BEGIN_DECLS - -gboolean gst_burn_plugin_init (GstPlugin *plugin); -gboolean gst_chromium_plugin_init (GstPlugin *plugin); -gboolean gst_dilate_plugin_init (GstPlugin *plugin); -gboolean gst_dodge_plugin_init (GstPlugin *plugin); -gboolean gst_exclusion_plugin_init (GstPlugin *plugin); -gboolean gst_gauss_blur_plugin_init (GstPlugin *plugin); -gboolean gst_solarize_plugin_init (GstPlugin *plugin); - -G_END_DECLS - -#endif /* __GST_GAUDI_EFFECTS_H__ */ diff --git a/gst/gaudieffects/gstsolarize.c b/gst/gaudieffects/gstsolarize.c index 23a69d0..00f317d 100644 --- a/gst/gaudieffects/gstsolarize.c +++ b/gst/gaudieffects/gstsolarize.c @@ -64,7 +64,6 @@ #include #include -#include "gstplugin.h" #include "gstsolarize.h" GST_DEBUG_CATEGORY_STATIC (gst_solarize_debug); @@ -117,6 +116,9 @@ GST_STATIC_PAD_TEMPLATE ("src", #define gst_solarize_parent_class parent_class G_DEFINE_TYPE (GstSolarize, gst_solarize, GST_TYPE_VIDEO_FILTER); +GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (solarize, "solarize", GST_RANK_NONE, + GST_TYPE_SOLARIZE, GST_DEBUG_CATEGORY_INIT (gst_solarize_debug, "solarize", + 0, "Template solarize")); static void gst_solarize_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec); @@ -278,19 +280,6 @@ gst_solarize_transform_frame (GstVideoFilter * vfilter, return GST_FLOW_OK; } -/* Entry point to initialize the plug-in. - * Register the element factories and other features. */ -gboolean -gst_solarize_plugin_init (GstPlugin * solarize) -{ - /* debug category for fltering log messages */ - GST_DEBUG_CATEGORY_INIT (gst_solarize_debug, "solarize", - 0, "Template solarize"); - - return gst_element_register (solarize, "solarize", GST_RANK_NONE, - GST_TYPE_SOLARIZE); -} - /*** Now the image processing work.... ***/ /* Transform processes each frame. */ diff --git a/gst/gaudieffects/gstsolarize.h b/gst/gaudieffects/gstsolarize.h index 2390563..e81615e 100644 --- a/gst/gaudieffects/gstsolarize.h +++ b/gst/gaudieffects/gstsolarize.h @@ -81,6 +81,7 @@ struct _GstSolarizeClass }; GType gst_solarize_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (solarize); G_END_DECLS diff --git a/gst/gdp/gstgdp.c b/gst/gdp/gstgdp.c index 4ac3a0f..d35e778 100644 --- a/gst/gdp/gstgdp.c +++ b/gst/gdp/gstgdp.c @@ -23,21 +23,17 @@ #include "dataprotocol.h" -#include "gstgdppay.h" -#include "gstgdpdepay.h" +#include "gstgdpelements.h" static gboolean plugin_init (GstPlugin * plugin) { - gst_dp_init (); + gboolean ret = FALSE; - if (!gst_gdp_depay_plugin_init (plugin)) - return FALSE; + ret |= GST_ELEMENT_REGISTER (gdpdepay, plugin); + ret |= GST_ELEMENT_REGISTER (gdppay, plugin); - if (!gst_gdp_pay_plugin_init (plugin)) - return FALSE; - - return TRUE; + return ret; } GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, GST_VERSION_MINOR, diff --git a/gst/gdp/gstgdpdepay.c b/gst/gdp/gstgdpdepay.c index 750571e..f17960b 100644 --- a/gst/gdp/gstgdpdepay.c +++ b/gst/gdp/gstgdpdepay.c @@ -40,6 +40,7 @@ #include "dataprotocol.h" +#include "gstgdpelements.h" #include "gstgdpdepay.h" enum @@ -69,6 +70,8 @@ GST_DEBUG_CATEGORY_STATIC (gst_gdp_depay_debug); #define gst_gdp_depay_parent_class parent_class G_DEFINE_TYPE_WITH_CODE (GstGDPDepay, gst_gdp_depay, GST_TYPE_ELEMENT, _do_init); +GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (gdpdepay, "gdpdepay", GST_RANK_NONE, + GST_TYPE_GDP_DEPAY, gdp_element_init (plugin)); static gboolean gst_gdp_depay_sink_event (GstPad * pad, GstObject * parent, GstEvent * event); @@ -586,13 +589,3 @@ gst_gdp_depay_decide_allocation (GstGDPDepay * gdpdepay) gst_caps_unref (caps); gst_query_unref (query); } - -gboolean -gst_gdp_depay_plugin_init (GstPlugin * plugin) -{ - if (!gst_element_register (plugin, "gdpdepay", GST_RANK_NONE, - GST_TYPE_GDP_DEPAY)) - return FALSE; - - return TRUE; -} diff --git a/gst/gdp/gstgdpdepay.h b/gst/gdp/gstgdpdepay.h index c21f302..698f9d9 100644 --- a/gst/gdp/gstgdpdepay.h +++ b/gst/gdp/gstgdpdepay.h @@ -78,8 +78,6 @@ struct _GstGDPDepayClass GstElementClass parent_class; }; -gboolean gst_gdp_depay_plugin_init (GstPlugin * plugin); - GType gst_gdp_depay_get_type (void); G_END_DECLS diff --git a/gst/gdp/gstgdpelement.c b/gst/gdp/gstgdpelement.c new file mode 100644 index 0000000..56aaa11 --- /dev/null +++ b/gst/gdp/gstgdpelement.c @@ -0,0 +1,37 @@ +/* GStreamer + * Copyright (C) 2006 Thomas Vander Stichele + * + * 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 +#endif + +#include "dataprotocol.h" +#include "gstgdpelements.h" + + +void +gdp_element_init (GstPlugin * plugin) +{ + static gsize res = FALSE; + + if (g_once_init_enter (&res)) { + gst_dp_init (); + g_once_init_leave (&res, TRUE); + } +} diff --git a/gst/gdp/gstgdpelements.h b/gst/gdp/gstgdpelements.h new file mode 100644 index 0000000..29aed34 --- /dev/null +++ b/gst/gdp/gstgdpelements.h @@ -0,0 +1,35 @@ +/* GStreamer + * Copyright (C) <2020> Julian Bouzas + * + * 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_GDP_ELEMENT_H__ +#define __GST_GDP_ELEMENT_H__ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include + +void gdp_element_init (GstPlugin * plugin); + +GST_ELEMENT_REGISTER_DECLARE (gdppay); +GST_ELEMENT_REGISTER_DECLARE (gdpdepay); + +#endif /* __GST_GDP_ELEMENT_H__ */ diff --git a/gst/gdp/gstgdppay.c b/gst/gdp/gstgdppay.c index 493472f..2f132f8 100644 --- a/gst/gdp/gstgdppay.c +++ b/gst/gdp/gstgdppay.c @@ -39,6 +39,7 @@ #include "dataprotocol.h" +#include "gstgdpelements.h" #include "gstgdppay.h" static GstStaticPadTemplate gdp_pay_sink_template = @@ -71,6 +72,8 @@ enum "GDP payloader"); #define gst_gdp_pay_parent_class parent_class G_DEFINE_TYPE_WITH_CODE (GstGDPPay, gst_gdp_pay, GST_TYPE_ELEMENT, _do_init); +GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (gdppay, "gdppay", GST_RANK_NONE, + GST_TYPE_GDP_PAY, gdp_element_init (plugin)); static void gst_gdp_pay_reset (GstGDPPay * this); @@ -708,12 +711,3 @@ gst_gdp_pay_change_state (GstElement * element, GstStateChange transition) return ret; } - -gboolean -gst_gdp_pay_plugin_init (GstPlugin * plugin) -{ - if (!gst_element_register (plugin, "gdppay", GST_RANK_NONE, GST_TYPE_GDP_PAY)) - return FALSE; - - return TRUE; -} diff --git a/gst/gdp/gstgdppay.h b/gst/gdp/gstgdppay.h index 2e01eb1..0e7b3db 100644 --- a/gst/gdp/gstgdppay.h +++ b/gst/gdp/gstgdppay.h @@ -72,8 +72,6 @@ struct _GstGDPPayClass GstElementClass parent_class; }; -gboolean gst_gdp_pay_plugin_init (GstPlugin * plugin); - GType gst_gdp_pay_get_type (void); G_END_DECLS diff --git a/gst/gdp/meson.build b/gst/gdp/meson.build index d55d65e..b76de92 100644 --- a/gst/gdp/meson.build +++ b/gst/gdp/meson.build @@ -1,5 +1,6 @@ gdp_sources = [ 'dataprotocol.c', + 'gstgdpelement.c', 'gstgdp.c', 'gstgdppay.c', 'gstgdpdepay.c', diff --git a/gst/geometrictransform/gstbulge.c b/gst/geometrictransform/gstbulge.c index 315aa0c..dc5eeba 100644 --- a/gst/geometrictransform/gstbulge.c +++ b/gst/geometrictransform/gstbulge.c @@ -79,6 +79,9 @@ enum #define gst_bulge_parent_class parent_class G_DEFINE_TYPE (GstBulge, gst_bulge, GST_TYPE_CIRCLE_GEOMETRIC_TRANSFORM); +GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (bulge, "bulge", GST_RANK_NONE, + GST_TYPE_BULGE, GST_DEBUG_CATEGORY_INIT (gst_bulge_debug, "bulge", 0, + "bulge")); static void gst_bulge_set_property (GObject * object, guint prop_id, const GValue * value, @@ -208,11 +211,3 @@ gst_bulge_init (GstBulge * filter) filter->zoom = DEFAULT_ZOOM; gt->off_edge_pixels = GST_GT_OFF_EDGES_PIXELS_CLAMP; } - -gboolean -gst_bulge_plugin_init (GstPlugin * plugin) -{ - GST_DEBUG_CATEGORY_INIT (gst_bulge_debug, "bulge", 0, "bulge"); - - return gst_element_register (plugin, "bulge", GST_RANK_NONE, GST_TYPE_BULGE); -} diff --git a/gst/geometrictransform/gstbulge.h b/gst/geometrictransform/gstbulge.h index 452ae0e..dcb2e04 100644 --- a/gst/geometrictransform/gstbulge.h +++ b/gst/geometrictransform/gstbulge.h @@ -78,7 +78,7 @@ struct _GstBulgeClass GType gst_bulge_get_type (void); -gboolean gst_bulge_plugin_init (GstPlugin * plugin); +GST_ELEMENT_REGISTER_DECLARE (bulge); G_END_DECLS #endif /* __GST_BULGE_H__ */ diff --git a/gst/geometrictransform/gstcircle.c b/gst/geometrictransform/gstcircle.c index b326fd0..8e5f48e 100644 --- a/gst/geometrictransform/gstcircle.c +++ b/gst/geometrictransform/gstcircle.c @@ -90,6 +90,9 @@ enum #define gst_circle_parent_class parent_class G_DEFINE_TYPE (GstCircle, gst_circle, GST_TYPE_CIRCLE_GEOMETRIC_TRANSFORM); +GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (circle, "circle", GST_RANK_NONE, + GST_TYPE_CIRCLE, GST_DEBUG_CATEGORY_INIT (gst_circle_debug, "circle", 0, + "circle")); static void gst_circle_set_property (GObject * object, guint prop_id, const GValue * value, @@ -231,12 +234,3 @@ gst_circle_init (GstCircle * filter) filter->spread_angle = DEFAULT_SPREAD_ANGLE; filter->height = DEFAULT_HEIGHT; } - -gboolean -gst_circle_plugin_init (GstPlugin * plugin) -{ - GST_DEBUG_CATEGORY_INIT (gst_circle_debug, "circle", 0, "circle"); - - return gst_element_register (plugin, "circle", GST_RANK_NONE, - GST_TYPE_CIRCLE); -} diff --git a/gst/geometrictransform/gstcircle.h b/gst/geometrictransform/gstcircle.h index 7b278ca..ceeec29 100644 --- a/gst/geometrictransform/gstcircle.h +++ b/gst/geometrictransform/gstcircle.h @@ -82,7 +82,7 @@ struct _GstCircleClass GType gst_circle_get_type (void); -gboolean gst_circle_plugin_init (GstPlugin * plugin); +GST_ELEMENT_REGISTER_DECLARE (circle); G_END_DECLS diff --git a/gst/geometrictransform/gstdiffuse.c b/gst/geometrictransform/gstdiffuse.c index 36e4e62..3be6241 100644 --- a/gst/geometrictransform/gstdiffuse.c +++ b/gst/geometrictransform/gstdiffuse.c @@ -84,6 +84,9 @@ enum #define gst_diffuse_parent_class parent_class G_DEFINE_TYPE (GstDiffuse, gst_diffuse, GST_TYPE_GEOMETRIC_TRANSFORM); +GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (diffuse, "diffuse", GST_RANK_NONE, + GST_TYPE_DIFFUSE, GST_DEBUG_CATEGORY_INIT (gst_diffuse_debug, "diffuse", 0, + "diffuse")); static void gst_diffuse_set_property (GObject * object, guint prop_id, const GValue * value, @@ -226,12 +229,3 @@ gst_diffuse_init (GstDiffuse * filter) gt->off_edge_pixels = GST_GT_OFF_EDGES_PIXELS_CLAMP; filter->scale = DEFAULT_SCALE; } - -gboolean -gst_diffuse_plugin_init (GstPlugin * plugin) -{ - GST_DEBUG_CATEGORY_INIT (gst_diffuse_debug, "diffuse", 0, "diffuse"); - - return gst_element_register (plugin, "diffuse", GST_RANK_NONE, - GST_TYPE_DIFFUSE); -} diff --git a/gst/geometrictransform/gstdiffuse.h b/gst/geometrictransform/gstdiffuse.h index 31ee9cd..a3b6d82 100644 --- a/gst/geometrictransform/gstdiffuse.h +++ b/gst/geometrictransform/gstdiffuse.h @@ -83,7 +83,7 @@ struct _GstDiffuseClass GType gst_diffuse_get_type (void); -gboolean gst_diffuse_plugin_init (GstPlugin * plugin); +GST_ELEMENT_REGISTER_DECLARE (diffuse); G_END_DECLS diff --git a/gst/geometrictransform/gstfisheye.c b/gst/geometrictransform/gstfisheye.c index 7150e38..8d2d0dd 100644 --- a/gst/geometrictransform/gstfisheye.c +++ b/gst/geometrictransform/gstfisheye.c @@ -70,6 +70,9 @@ GST_DEBUG_CATEGORY_STATIC (gst_fisheye_debug); #define gst_fisheye_parent_class parent_class G_DEFINE_TYPE (GstFisheye, gst_fisheye, GST_TYPE_GEOMETRIC_TRANSFORM); +GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (fisheye, "fisheye", GST_RANK_NONE, + GST_TYPE_FISHEYE, GST_DEBUG_CATEGORY_INIT (gst_fisheye_debug, "fisheye", 0, + "fisheye")); static gboolean fisheye_map (GstGeometricTransform * gt, gint x, gint y, gdouble * in_x, @@ -146,12 +149,3 @@ gst_fisheye_init (GstFisheye * filter) gt->off_edge_pixels = GST_GT_OFF_EDGES_PIXELS_CLAMP; } - -gboolean -gst_fisheye_plugin_init (GstPlugin * plugin) -{ - GST_DEBUG_CATEGORY_INIT (gst_fisheye_debug, "fisheye", 0, "fisheye"); - - return gst_element_register (plugin, "fisheye", GST_RANK_NONE, - GST_TYPE_FISHEYE); -} diff --git a/gst/geometrictransform/gstfisheye.h b/gst/geometrictransform/gstfisheye.h index d4d8cbe..41ccddb 100644 --- a/gst/geometrictransform/gstfisheye.h +++ b/gst/geometrictransform/gstfisheye.h @@ -77,7 +77,7 @@ struct _GstFisheyeClass GType gst_fisheye_get_type (void); -gboolean gst_fisheye_plugin_init (GstPlugin * plugin); +GST_ELEMENT_REGISTER_DECLARE (fisheye); G_END_DECLS #endif /* __GST_FISHEYE_H__ */ diff --git a/gst/geometrictransform/gstkaleidoscope.c b/gst/geometrictransform/gstkaleidoscope.c index 00f988f..bed2cf9 100644 --- a/gst/geometrictransform/gstkaleidoscope.c +++ b/gst/geometrictransform/gstkaleidoscope.c @@ -90,6 +90,10 @@ enum #define gst_kaleidoscope_parent_class parent_class G_DEFINE_TYPE (GstKaleidoscope, gst_kaleidoscope, GST_TYPE_CIRCLE_GEOMETRIC_TRANSFORM); +GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (kaleidoscope, "kaleidoscope", + GST_RANK_NONE, GST_TYPE_KALEIDOSCOPE, + GST_DEBUG_CATEGORY_INIT (gst_kaleidoscope_debug, "kaleidoscope", 0, + "kaleidoscope")); static void gst_kaleidoscope_set_property (GObject * object, guint prop_id, @@ -238,13 +242,3 @@ gst_kaleidoscope_init (GstKaleidoscope * filter) filter->angle2 = DEFAULT_ANGLE2; filter->sides = DEFAULT_SIDES; } - -gboolean -gst_kaleidoscope_plugin_init (GstPlugin * plugin) -{ - GST_DEBUG_CATEGORY_INIT (gst_kaleidoscope_debug, "kaleidoscope", 0, - "kaleidoscope"); - - return gst_element_register (plugin, "kaleidoscope", GST_RANK_NONE, - GST_TYPE_KALEIDOSCOPE); -} diff --git a/gst/geometrictransform/gstkaleidoscope.h b/gst/geometrictransform/gstkaleidoscope.h index bbe338c..c4fd003 100644 --- a/gst/geometrictransform/gstkaleidoscope.h +++ b/gst/geometrictransform/gstkaleidoscope.h @@ -82,7 +82,7 @@ struct _GstKaleidoscopeClass GType gst_kaleidoscope_get_type (void); -gboolean gst_kaleidoscope_plugin_init (GstPlugin * plugin); +GST_ELEMENT_REGISTER_DECLARE (kaleidoscope); G_END_DECLS diff --git a/gst/geometrictransform/gstmarble.c b/gst/geometrictransform/gstmarble.c index f508d2a..2987902 100644 --- a/gst/geometrictransform/gstmarble.c +++ b/gst/geometrictransform/gstmarble.c @@ -90,7 +90,9 @@ enum #define gst_marble_parent_class parent_class G_DEFINE_TYPE (GstMarble, gst_marble, GST_TYPE_GEOMETRIC_TRANSFORM); - +GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (marble, "marble", GST_RANK_NONE, + GST_TYPE_MARBLE, GST_DEBUG_CATEGORY_INIT (gst_marble_debug, "marble", 0, + "marble")); static void gst_marble_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec) @@ -282,12 +284,3 @@ gst_marble_init (GstMarble * filter) filter->amount = DEFAULT_AMOUNT; filter->turbulence = DEFAULT_TURBULENCE; } - -gboolean -gst_marble_plugin_init (GstPlugin * plugin) -{ - GST_DEBUG_CATEGORY_INIT (gst_marble_debug, "marble", 0, "marble"); - - return gst_element_register (plugin, "marble", GST_RANK_NONE, - GST_TYPE_MARBLE); -} diff --git a/gst/geometrictransform/gstmarble.h b/gst/geometrictransform/gstmarble.h index 2665775..61cb796 100644 --- a/gst/geometrictransform/gstmarble.h +++ b/gst/geometrictransform/gstmarble.h @@ -88,7 +88,7 @@ struct _GstMarbleClass GType gst_marble_get_type (void); -gboolean gst_marble_plugin_init (GstPlugin * plugin); +GST_ELEMENT_REGISTER_DECLARE (marble); G_END_DECLS diff --git a/gst/geometrictransform/gstmirror.c b/gst/geometrictransform/gstmirror.c index e7b29c1..d59f954 100644 --- a/gst/geometrictransform/gstmirror.c +++ b/gst/geometrictransform/gstmirror.c @@ -78,6 +78,9 @@ enum #define gst_mirror_parent_class parent_class G_DEFINE_TYPE (GstMirror, gst_mirror, GST_TYPE_GEOMETRIC_TRANSFORM); +GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (mirror, "mirror", GST_RANK_NONE, + GST_TYPE_MIRROR, GST_DEBUG_CATEGORY_INIT (gst_mirror_debug, "mirror", 0, + "mirror")); #define GST_TYPE_MIRROR_MODE (gst_mirror_mode_get_type()) static GType @@ -238,12 +241,3 @@ gst_mirror_init (GstMirror * filter) filter->mode = DEFAULT_PROP_MODE; gt->off_edge_pixels = GST_GT_OFF_EDGES_PIXELS_CLAMP; } - -gboolean -gst_mirror_plugin_init (GstPlugin * plugin) -{ - GST_DEBUG_CATEGORY_INIT (gst_mirror_debug, "mirror", 0, "mirror"); - - return gst_element_register (plugin, "mirror", GST_RANK_NONE, - GST_TYPE_MIRROR); -} diff --git a/gst/geometrictransform/gstmirror.h b/gst/geometrictransform/gstmirror.h index 22e6aa5..f534ae5 100644 --- a/gst/geometrictransform/gstmirror.h +++ b/gst/geometrictransform/gstmirror.h @@ -96,7 +96,7 @@ struct _GstMirrorClass GType gst_mirror_get_type (void); -gboolean gst_mirror_plugin_init (GstPlugin * plugin); +GST_ELEMENT_REGISTER_DECLARE (mirror); G_END_DECLS #endif /* __GST_MIRROR_H__ */ diff --git a/gst/geometrictransform/gstperspective.c b/gst/geometrictransform/gstperspective.c index e4da32f..3b7da18 100644 --- a/gst/geometrictransform/gstperspective.c +++ b/gst/geometrictransform/gstperspective.c @@ -88,6 +88,10 @@ enum #define gst_perspective_parent_class parent_class G_DEFINE_TYPE (GstPerspective, gst_perspective, GST_TYPE_GEOMETRIC_TRANSFORM); +GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (perspective, "perspective", + GST_RANK_NONE, GST_TYPE_PERSPECTIVE, + GST_DEBUG_CATEGORY_INIT (gst_perspective_debug, "perspective", 0, + "perspective")); static GValueArray * get_array_from_matrix (GstPerspective * self) @@ -255,13 +259,3 @@ gst_perspective_init (GstPerspective * filter) filter->matrix[7] = 0; filter->matrix[8] = 1; } - -gboolean -gst_perspective_plugin_init (GstPlugin * plugin) -{ - GST_DEBUG_CATEGORY_INIT (gst_perspective_debug, "perspective", 0, - "perspective"); - - return gst_element_register (plugin, "perspective", GST_RANK_NONE, - GST_TYPE_PERSPECTIVE); -} diff --git a/gst/geometrictransform/gstperspective.h b/gst/geometrictransform/gstperspective.h index 03393b7..db70723 100644 --- a/gst/geometrictransform/gstperspective.h +++ b/gst/geometrictransform/gstperspective.h @@ -81,7 +81,7 @@ struct _GstPerspectiveClass GType gst_perspective_get_type (void); -gboolean gst_perspective_plugin_init (GstPlugin * plugin); +GST_ELEMENT_REGISTER_DECLARE (perspective); G_END_DECLS diff --git a/gst/geometrictransform/gstpinch.c b/gst/geometrictransform/gstpinch.c index 798b965..ffc9b2a 100644 --- a/gst/geometrictransform/gstpinch.c +++ b/gst/geometrictransform/gstpinch.c @@ -83,6 +83,9 @@ enum #define gst_pinch_parent_class parent_class G_DEFINE_TYPE (GstPinch, gst_pinch, GST_TYPE_CIRCLE_GEOMETRIC_TRANSFORM); +GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (pinch, "pinch", GST_RANK_NONE, + GST_TYPE_PINCH, GST_DEBUG_CATEGORY_INIT (gst_pinch_debug, "pinch", 0, + "pinch")); static void gst_pinch_set_property (GObject * object, guint prop_id, const GValue * value, @@ -207,11 +210,3 @@ gst_pinch_init (GstPinch * filter) gt->off_edge_pixels = GST_GT_OFF_EDGES_PIXELS_CLAMP; filter->intensity = DEFAULT_INTENSITY; } - -gboolean -gst_pinch_plugin_init (GstPlugin * plugin) -{ - GST_DEBUG_CATEGORY_INIT (gst_pinch_debug, "pinch", 0, "pinch"); - - return gst_element_register (plugin, "pinch", GST_RANK_NONE, GST_TYPE_PINCH); -} diff --git a/gst/geometrictransform/gstpinch.h b/gst/geometrictransform/gstpinch.h index 896a6d6..70d0c75 100644 --- a/gst/geometrictransform/gstpinch.h +++ b/gst/geometrictransform/gstpinch.h @@ -80,7 +80,7 @@ struct _GstPinchClass GType gst_pinch_get_type (void); -gboolean gst_pinch_plugin_init (GstPlugin * plugin); +GST_ELEMENT_REGISTER_DECLARE (pinch); G_END_DECLS diff --git a/gst/geometrictransform/gstrotate.c b/gst/geometrictransform/gstrotate.c index d6f6515..0047e2c 100644 --- a/gst/geometrictransform/gstrotate.c +++ b/gst/geometrictransform/gstrotate.c @@ -84,6 +84,9 @@ enum #define gst_rotate_parent_class parent_class G_DEFINE_TYPE (GstRotate, gst_rotate, GST_TYPE_GEOMETRIC_TRANSFORM); +GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (rotate, "rotate", GST_RANK_NONE, + GST_TYPE_ROTATE, GST_DEBUG_CATEGORY_INIT (gst_rotate_debug, "rotate", 0, + "rotate")); static void gst_rotate_set_property (GObject * object, guint prop_id, const GValue * value, @@ -212,12 +215,3 @@ gst_rotate_init (GstRotate * filter) { filter->angle = DEFAULT_ANGLE; } - -gboolean -gst_rotate_plugin_init (GstPlugin * plugin) -{ - GST_DEBUG_CATEGORY_INIT (gst_rotate_debug, "rotate", 0, "rotate"); - - return gst_element_register (plugin, "rotate", GST_RANK_NONE, - GST_TYPE_ROTATE); -} diff --git a/gst/geometrictransform/gstrotate.h b/gst/geometrictransform/gstrotate.h index ce19d49..d67d091 100644 --- a/gst/geometrictransform/gstrotate.h +++ b/gst/geometrictransform/gstrotate.h @@ -80,7 +80,7 @@ struct _GstRotateClass GType gst_rotate_get_type (void); -gboolean gst_rotate_plugin_init (GstPlugin * plugin); +GST_ELEMENT_REGISTER_DECLARE (rotate); G_END_DECLS diff --git a/gst/geometrictransform/gstsphere.c b/gst/geometrictransform/gstsphere.c index 90947a8..37aae47 100644 --- a/gst/geometrictransform/gstsphere.c +++ b/gst/geometrictransform/gstsphere.c @@ -83,6 +83,9 @@ enum #define gst_sphere_parent_class parent_class G_DEFINE_TYPE (GstSphere, gst_sphere, GST_TYPE_CIRCLE_GEOMETRIC_TRANSFORM); +GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (sphere, "sphere", GST_RANK_NONE, + GST_TYPE_SPHERE, GST_DEBUG_CATEGORY_INIT (gst_sphere_debug, "sphere", 0, + "sphere")); static void gst_sphere_set_property (GObject * object, guint prop_id, const GValue * value, @@ -219,12 +222,3 @@ gst_sphere_init (GstSphere * filter) gt->off_edge_pixels = GST_GT_OFF_EDGES_PIXELS_CLAMP; filter->refraction = DEFAULT_REFRACTION; } - -gboolean -gst_sphere_plugin_init (GstPlugin * plugin) -{ - GST_DEBUG_CATEGORY_INIT (gst_sphere_debug, "sphere", 0, "sphere"); - - return gst_element_register (plugin, "sphere", GST_RANK_NONE, - GST_TYPE_SPHERE); -} diff --git a/gst/geometrictransform/gstsphere.h b/gst/geometrictransform/gstsphere.h index e8028de..6e09e39 100644 --- a/gst/geometrictransform/gstsphere.h +++ b/gst/geometrictransform/gstsphere.h @@ -80,7 +80,7 @@ struct _GstSphereClass GType gst_sphere_get_type (void); -gboolean gst_sphere_plugin_init (GstPlugin * plugin); +GST_ELEMENT_REGISTER_DECLARE (sphere); G_END_DECLS diff --git a/gst/geometrictransform/gstsquare.c b/gst/geometrictransform/gstsquare.c index 14271bd..b276499 100644 --- a/gst/geometrictransform/gstsquare.c +++ b/gst/geometrictransform/gstsquare.c @@ -81,6 +81,9 @@ enum #define gst_square_parent_class parent_class G_DEFINE_TYPE (GstSquare, gst_square, GST_TYPE_GEOMETRIC_TRANSFORM); +GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (square, "square", GST_RANK_NONE, + GST_TYPE_SQUARE, GST_DEBUG_CATEGORY_INIT (gst_square_debug, "square", 0, + "square")); /* GObject vmethod implementations */ @@ -237,12 +240,3 @@ gst_square_init (GstSquare * filter) filter->zoom = DEFAULT_ZOOM; gt->off_edge_pixels = GST_GT_OFF_EDGES_PIXELS_CLAMP; } - -gboolean -gst_square_plugin_init (GstPlugin * plugin) -{ - GST_DEBUG_CATEGORY_INIT (gst_square_debug, "square", 0, "square"); - - return gst_element_register (plugin, "square", GST_RANK_NONE, - GST_TYPE_SQUARE); -} diff --git a/gst/geometrictransform/gstsquare.h b/gst/geometrictransform/gstsquare.h index 62cf173..99d5f52 100644 --- a/gst/geometrictransform/gstsquare.h +++ b/gst/geometrictransform/gstsquare.h @@ -80,7 +80,7 @@ struct _GstSquareClass GType gst_square_get_type (void); -gboolean gst_square_plugin_init (GstPlugin * plugin); +GST_ELEMENT_REGISTER_DECLARE (square); G_END_DECLS #endif /* __GST_SQUARE_H__ */ diff --git a/gst/geometrictransform/gststretch.c b/gst/geometrictransform/gststretch.c index 77086f0..5fe390f 100644 --- a/gst/geometrictransform/gststretch.c +++ b/gst/geometrictransform/gststretch.c @@ -79,6 +79,9 @@ enum #define gst_stretch_parent_class parent_class G_DEFINE_TYPE (GstStretch, gst_stretch, GST_TYPE_CIRCLE_GEOMETRIC_TRANSFORM); +GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (stretch, "stretch", GST_RANK_NONE, + GST_TYPE_STRETCH, GST_DEBUG_CATEGORY_INIT (gst_stretch_debug, "stretch", 0, + "stretch")); static void gst_stretch_set_property (GObject * object, guint prop_id, const GValue * value, @@ -209,12 +212,3 @@ gst_stretch_init (GstStretch * filter) filter->intensity = DEFAULT_INTENSITY; gt->off_edge_pixels = GST_GT_OFF_EDGES_PIXELS_CLAMP; } - -gboolean -gst_stretch_plugin_init (GstPlugin * plugin) -{ - GST_DEBUG_CATEGORY_INIT (gst_stretch_debug, "stretch", 0, "stretch"); - - return gst_element_register (plugin, "stretch", GST_RANK_NONE, - GST_TYPE_STRETCH); -} diff --git a/gst/geometrictransform/gststretch.h b/gst/geometrictransform/gststretch.h index 3f0e9b9..92e46b7 100644 --- a/gst/geometrictransform/gststretch.h +++ b/gst/geometrictransform/gststretch.h @@ -78,7 +78,7 @@ struct _GstStretchClass GType gst_stretch_get_type (void); -gboolean gst_stretch_plugin_init (GstPlugin * plugin); +GST_ELEMENT_REGISTER_DECLARE (stretch); G_END_DECLS #endif /* __GST_STRETCH_H__ */ diff --git a/gst/geometrictransform/gsttunnel.c b/gst/geometrictransform/gsttunnel.c index 2dd9c41..b659c5d 100644 --- a/gst/geometrictransform/gsttunnel.c +++ b/gst/geometrictransform/gsttunnel.c @@ -71,6 +71,9 @@ GST_DEBUG_CATEGORY_STATIC (gst_tunnel_debug); #define gst_tunnel_parent_class parent_class G_DEFINE_TYPE (GstTunnel, gst_tunnel, GST_TYPE_CIRCLE_GEOMETRIC_TRANSFORM); +GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (tunnel, "tunnel", GST_RANK_NONE, + GST_TYPE_TUNNEL, GST_DEBUG_CATEGORY_INIT (gst_tunnel_debug, "tunnel", 0, + "tunnel")); static gboolean tunnel_map (GstGeometricTransform * gt, gint x, gint y, gdouble * in_x, @@ -135,12 +138,3 @@ gst_tunnel_init (GstTunnel * filter) gt->off_edge_pixels = GST_GT_OFF_EDGES_PIXELS_CLAMP; } - -gboolean -gst_tunnel_plugin_init (GstPlugin * plugin) -{ - GST_DEBUG_CATEGORY_INIT (gst_tunnel_debug, "tunnel", 0, "tunnel"); - - return gst_element_register (plugin, "tunnel", GST_RANK_NONE, - GST_TYPE_TUNNEL); -} diff --git a/gst/geometrictransform/gsttunnel.h b/gst/geometrictransform/gsttunnel.h index 28db3af..a37755d 100644 --- a/gst/geometrictransform/gsttunnel.h +++ b/gst/geometrictransform/gsttunnel.h @@ -76,7 +76,7 @@ struct _GstTunnelClass GType gst_tunnel_get_type (void); -gboolean gst_tunnel_plugin_init (GstPlugin * plugin); +GST_ELEMENT_REGISTER_DECLARE (tunnel); G_END_DECLS #endif /* __GST_TUNNEL_H__ */ diff --git a/gst/geometrictransform/gsttwirl.c b/gst/geometrictransform/gsttwirl.c index 54ec46b..f1d94cb 100644 --- a/gst/geometrictransform/gsttwirl.c +++ b/gst/geometrictransform/gsttwirl.c @@ -83,6 +83,9 @@ enum #define gst_twirl_parent_class parent_class G_DEFINE_TYPE (GstTwirl, gst_twirl, GST_TYPE_CIRCLE_GEOMETRIC_TRANSFORM); +GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (twirl, "twirl", GST_RANK_NONE, + GST_TYPE_TWIRL, GST_DEBUG_CATEGORY_INIT (gst_twirl_debug, "twirl", 0, + "twirl")); static void gst_twirl_set_property (GObject * object, guint prop_id, const GValue * value, @@ -198,11 +201,3 @@ gst_twirl_init (GstTwirl * filter) gt->off_edge_pixels = GST_GT_OFF_EDGES_PIXELS_CLAMP; filter->angle = DEFAULT_ANGLE; } - -gboolean -gst_twirl_plugin_init (GstPlugin * plugin) -{ - GST_DEBUG_CATEGORY_INIT (gst_twirl_debug, "twirl", 0, "twirl"); - - return gst_element_register (plugin, "twirl", GST_RANK_NONE, GST_TYPE_TWIRL); -} diff --git a/gst/geometrictransform/gsttwirl.h b/gst/geometrictransform/gsttwirl.h index 9143894..c6abac7 100644 --- a/gst/geometrictransform/gsttwirl.h +++ b/gst/geometrictransform/gsttwirl.h @@ -80,7 +80,7 @@ struct _GstTwirlClass GType gst_twirl_get_type (void); -gboolean gst_twirl_plugin_init (GstPlugin * plugin); +GST_ELEMENT_REGISTER_DECLARE (twirl); G_END_DECLS diff --git a/gst/geometrictransform/gstwaterripple.c b/gst/geometrictransform/gstwaterripple.c index 2d39df9..6524377 100644 --- a/gst/geometrictransform/gstwaterripple.c +++ b/gst/geometrictransform/gstwaterripple.c @@ -88,6 +88,10 @@ enum #define gst_water_ripple_parent_class parent_class G_DEFINE_TYPE (GstWaterRipple, gst_water_ripple, GST_TYPE_CIRCLE_GEOMETRIC_TRANSFORM); +GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (waterripple, "waterripple", + GST_RANK_NONE, GST_TYPE_WATER_RIPPLE, + GST_DEBUG_CATEGORY_INIT (gst_water_ripple_debug, "waterripple", 0, + "waterripple")); static void gst_water_ripple_set_property (GObject * object, guint prop_id, @@ -236,13 +240,3 @@ gst_water_ripple_init (GstWaterRipple * filter) filter->phase = DEFAULT_PHASE; filter->wavelength = DEFAULT_WAVELENGTH; } - -gboolean -gst_water_ripple_plugin_init (GstPlugin * plugin) -{ - GST_DEBUG_CATEGORY_INIT (gst_water_ripple_debug, "waterripple", 0, - "waterripple"); - - return gst_element_register (plugin, "waterripple", GST_RANK_NONE, - GST_TYPE_WATER_RIPPLE); -} diff --git a/gst/geometrictransform/gstwaterripple.h b/gst/geometrictransform/gstwaterripple.h index a2680b5..2dadeb1 100644 --- a/gst/geometrictransform/gstwaterripple.h +++ b/gst/geometrictransform/gstwaterripple.h @@ -82,7 +82,7 @@ struct _GstWaterRippleClass GType gst_water_ripple_get_type (void); -gboolean gst_water_ripple_plugin_init (GstPlugin * plugin); +GST_ELEMENT_REGISTER_DECLARE (waterripple); G_END_DECLS diff --git a/gst/geometrictransform/plugin.c b/gst/geometrictransform/plugin.c index 9622ebb..d353b2a 100644 --- a/gst/geometrictransform/plugin.c +++ b/gst/geometrictransform/plugin.c @@ -41,55 +41,26 @@ static gboolean plugin_init (GstPlugin * plugin) { - if (!gst_circle_plugin_init (plugin)) - return FALSE; - - if (!gst_diffuse_plugin_init (plugin)) - return FALSE; - - if (!gst_kaleidoscope_plugin_init (plugin)) - return FALSE; - - if (!gst_marble_plugin_init (plugin)) - return FALSE; - - if (!gst_pinch_plugin_init (plugin)) - return FALSE; - - if (!gst_rotate_plugin_init (plugin)) - return FALSE; - - if (!gst_sphere_plugin_init (plugin)) - return FALSE; - - if (!gst_twirl_plugin_init (plugin)) - return FALSE; - - if (!gst_water_ripple_plugin_init (plugin)) - return FALSE; - - if (!gst_stretch_plugin_init (plugin)) - return FALSE; - - if (!gst_bulge_plugin_init (plugin)) - return FALSE; - - if (!gst_tunnel_plugin_init (plugin)) - return FALSE; - - if (!gst_square_plugin_init (plugin)) - return FALSE; - - if (!gst_mirror_plugin_init (plugin)) - return FALSE; - - if (!gst_fisheye_plugin_init (plugin)) - return FALSE; - - if (!gst_perspective_plugin_init (plugin)) - return FALSE; - - return TRUE; + gboolean ret = FALSE; + + ret |= GST_ELEMENT_REGISTER (circle, plugin); + ret |= GST_ELEMENT_REGISTER (diffuse, plugin); + ret |= GST_ELEMENT_REGISTER (kaleidoscope, plugin); + ret |= GST_ELEMENT_REGISTER (marble, plugin); + ret |= GST_ELEMENT_REGISTER (pinch, plugin); + ret |= GST_ELEMENT_REGISTER (rotate, plugin); + ret |= GST_ELEMENT_REGISTER (sphere, plugin); + ret |= GST_ELEMENT_REGISTER (twirl, plugin); + ret |= GST_ELEMENT_REGISTER (waterripple, plugin); + ret |= GST_ELEMENT_REGISTER (stretch, plugin); + ret |= GST_ELEMENT_REGISTER (bulge, plugin); + ret |= GST_ELEMENT_REGISTER (tunnel, plugin); + ret |= GST_ELEMENT_REGISTER (square, plugin); + ret |= GST_ELEMENT_REGISTER (mirror, plugin); + ret |= GST_ELEMENT_REGISTER (fisheye, plugin); + ret |= GST_ELEMENT_REGISTER (perspective, plugin); + + return ret; } GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, diff --git a/gst/id3tag/gstid3mux.c b/gst/id3tag/gstid3mux.c index ccb23f9..c5b10c4 100644 --- a/gst/id3tag/gstid3mux.c +++ b/gst/id3tag/gstid3mux.c @@ -81,7 +81,12 @@ static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_ALWAYS, GST_STATIC_CAPS ("application/x-id3")); -G_DEFINE_TYPE (GstId3Mux, gst_id3_mux, GST_TYPE_TAG_MUX); +G_DEFINE_TYPE_WITH_CODE (GstId3Mux, gst_id3_mux, GST_TYPE_TAG_MUX, + GST_DEBUG_CATEGORY_INIT (gst_id3_mux_debug, "id3mux", 0, + "ID3 v1 and v2 tag muxer"); + ); +GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (id3mux, "id3mux", GST_RANK_PRIMARY, + GST_TYPE_ID3_MUX, gst_tag_register_musicbrainz_tags ()); static GstBuffer *gst_id3_mux_render_v2_tag (GstTagMux * mux, const GstTagList * taglist); @@ -211,16 +216,7 @@ gst_id3_mux_render_v1_tag (GstTagMux * mux, const GstTagList * taglist) static gboolean plugin_init (GstPlugin * plugin) { - GST_DEBUG_CATEGORY_INIT (gst_id3_mux_debug, "id3mux", 0, - "ID3 v1 and v2 tag muxer"); - - if (!gst_element_register (plugin, "id3mux", GST_RANK_PRIMARY, - GST_TYPE_ID3_MUX)) - return FALSE; - - gst_tag_register_musicbrainz_tags (); - - return TRUE; + return GST_ELEMENT_REGISTER (id3mux, plugin); } GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, diff --git a/gst/id3tag/gstid3mux.h b/gst/id3tag/gstid3mux.h index 69a2e0f..5017c69 100644 --- a/gst/id3tag/gstid3mux.h +++ b/gst/id3tag/gstid3mux.h @@ -56,7 +56,7 @@ struct _GstId3MuxClass { (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_ID3_MUX)) GType gst_id3_mux_get_type (void); - +GST_ELEMENT_REGISTER_DECLARE (id3mux); G_END_DECLS #endif /* GST_ID3_MUX_H */ diff --git a/gst/inter/gstinter.c b/gst/inter/gstinter.c index e1f88b2..b71b5de 100644 --- a/gst/inter/gstinter.c +++ b/gst/inter/gstinter.c @@ -32,20 +32,16 @@ static gboolean plugin_init (GstPlugin * plugin) { - gst_element_register (plugin, "interaudiosrc", GST_RANK_NONE, - GST_TYPE_INTER_AUDIO_SRC); - gst_element_register (plugin, "interaudiosink", GST_RANK_NONE, - GST_TYPE_INTER_AUDIO_SINK); - gst_element_register (plugin, "intersubsrc", GST_RANK_NONE, - GST_TYPE_INTER_SUB_SRC); - gst_element_register (plugin, "intersubsink", GST_RANK_NONE, - GST_TYPE_INTER_SUB_SINK); - gst_element_register (plugin, "intervideosrc", GST_RANK_NONE, - GST_TYPE_INTER_VIDEO_SRC); - gst_element_register (plugin, "intervideosink", GST_RANK_NONE, - GST_TYPE_INTER_VIDEO_SINK); + gboolean ret = FALSE; - return TRUE; + ret |= GST_ELEMENT_REGISTER (interaudiosrc, plugin); + ret |= GST_ELEMENT_REGISTER (interaudiosink, plugin); + ret |= GST_ELEMENT_REGISTER (intersubsrc, plugin); + ret |= GST_ELEMENT_REGISTER (intersubsink, plugin); + ret |= GST_ELEMENT_REGISTER (intervideosrc, plugin); + ret |= GST_ELEMENT_REGISTER (intervideosink, plugin); + + return ret; } GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, diff --git a/gst/inter/gstinteraudiosink.c b/gst/inter/gstinteraudiosink.c index eaa5b2e..a33fe81 100644 --- a/gst/inter/gstinteraudiosink.c +++ b/gst/inter/gstinteraudiosink.c @@ -89,6 +89,8 @@ GST_STATIC_PAD_TEMPLATE ("sink", /* class initialization */ #define parent_class gst_inter_audio_sink_parent_class G_DEFINE_TYPE (GstInterAudioSink, gst_inter_audio_sink, GST_TYPE_BASE_SINK); +GST_ELEMENT_REGISTER_DEFINE (interaudiosink, "interaudiosink", + GST_RANK_NONE, GST_TYPE_INTER_AUDIO_SINK); static void gst_inter_audio_sink_class_init (GstInterAudioSinkClass * klass) diff --git a/gst/inter/gstinteraudiosink.h b/gst/inter/gstinteraudiosink.h index 8f8c9a2..c6e3482 100644 --- a/gst/inter/gstinteraudiosink.h +++ b/gst/inter/gstinteraudiosink.h @@ -51,6 +51,7 @@ struct _GstInterAudioSinkClass }; GType gst_inter_audio_sink_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (interaudiosink); G_END_DECLS diff --git a/gst/inter/gstinteraudiosrc.c b/gst/inter/gstinteraudiosrc.c index 3190955..f516a58 100644 --- a/gst/inter/gstinteraudiosrc.c +++ b/gst/inter/gstinteraudiosrc.c @@ -95,6 +95,8 @@ GST_STATIC_PAD_TEMPLATE ("src", /* class initialization */ #define parent_class gst_inter_audio_src_parent_class G_DEFINE_TYPE (GstInterAudioSrc, gst_inter_audio_src, GST_TYPE_BASE_SRC); +GST_ELEMENT_REGISTER_DEFINE (interaudiosrc, "interaudiosrc", + GST_RANK_NONE, GST_TYPE_INTER_AUDIO_SRC); static void gst_inter_audio_src_class_init (GstInterAudioSrcClass * klass) diff --git a/gst/inter/gstinteraudiosrc.h b/gst/inter/gstinteraudiosrc.h index 131b2af..e00b406 100644 --- a/gst/inter/gstinteraudiosrc.h +++ b/gst/inter/gstinteraudiosrc.h @@ -54,7 +54,7 @@ struct _GstInterAudioSrcClass }; GType gst_inter_audio_src_get_type (void); - +GST_ELEMENT_REGISTER_DECLARE (interaudiosrc); G_END_DECLS #endif diff --git a/gst/inter/gstintersubsink.c b/gst/inter/gstintersubsink.c index 882a166..d62f7ce 100644 --- a/gst/inter/gstintersubsink.c +++ b/gst/inter/gstintersubsink.c @@ -80,6 +80,8 @@ GST_STATIC_PAD_TEMPLATE ("sink", /* class initialization */ #define parent_class gst_inter_sub_sink_parent_class G_DEFINE_TYPE (GstInterSubSink, gst_inter_sub_sink, GST_TYPE_BASE_SINK); +GST_ELEMENT_REGISTER_DEFINE (intersubsink, "intersubsink", GST_RANK_NONE, + GST_TYPE_INTER_SUB_SINK); static void gst_inter_sub_sink_class_init (GstInterSubSinkClass * klass) diff --git a/gst/inter/gstintersubsink.h b/gst/inter/gstintersubsink.h index 0a53798..81b45a9 100644 --- a/gst/inter/gstintersubsink.h +++ b/gst/inter/gstintersubsink.h @@ -52,6 +52,7 @@ struct _GstInterSubSinkClass }; GType gst_inter_sub_sink_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (intersubsink); G_END_DECLS diff --git a/gst/inter/gstintersubsrc.c b/gst/inter/gstintersubsrc.c index dc42cae..801a962 100644 --- a/gst/inter/gstintersubsrc.c +++ b/gst/inter/gstintersubsrc.c @@ -82,6 +82,8 @@ GST_STATIC_PAD_TEMPLATE ("src", /* class initialization */ #define parent_class gst_inter_sub_src_parent_class G_DEFINE_TYPE (GstInterSubSrc, gst_inter_sub_src, GST_TYPE_BASE_SRC); +GST_ELEMENT_REGISTER_DEFINE (intersubsrc, "intersubsrc", GST_RANK_NONE, + GST_TYPE_INTER_SUB_SRC); static void gst_inter_sub_src_class_init (GstInterSubSrcClass * klass) diff --git a/gst/inter/gstintersubsrc.h b/gst/inter/gstintersubsrc.h index a9d757e..3c62258 100644 --- a/gst/inter/gstintersubsrc.h +++ b/gst/inter/gstintersubsrc.h @@ -51,6 +51,7 @@ struct _GstInterSubSrcClass }; GType gst_inter_sub_src_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (intersubsrc); G_END_DECLS diff --git a/gst/inter/gstintervideosink.c b/gst/inter/gstintervideosink.c index 12a971a..d3dd3bd 100644 --- a/gst/inter/gstintervideosink.c +++ b/gst/inter/gstintervideosink.c @@ -82,6 +82,8 @@ GST_STATIC_PAD_TEMPLATE ("sink", /* class initialization */ G_DEFINE_TYPE (GstInterVideoSink, gst_inter_video_sink, GST_TYPE_VIDEO_SINK); +GST_ELEMENT_REGISTER_DEFINE (intervideosink, "intervideosink", + GST_RANK_NONE, GST_TYPE_INTER_VIDEO_SINK); static void gst_inter_video_sink_class_init (GstInterVideoSinkClass * klass) diff --git a/gst/inter/gstintervideosink.h b/gst/inter/gstintervideosink.h index 096cee2..5b2d280 100644 --- a/gst/inter/gstintervideosink.h +++ b/gst/inter/gstintervideosink.h @@ -50,6 +50,7 @@ struct _GstInterVideoSinkClass }; GType gst_inter_video_sink_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (intervideosink); G_END_DECLS diff --git a/gst/inter/gstintervideosrc.c b/gst/inter/gstintervideosrc.c index 9e607f3..4a4e07d 100644 --- a/gst/inter/gstintervideosrc.c +++ b/gst/inter/gstintervideosrc.c @@ -89,6 +89,8 @@ GST_STATIC_PAD_TEMPLATE ("src", /* class initialization */ #define parent_class gst_inter_video_src_parent_class G_DEFINE_TYPE (GstInterVideoSrc, gst_inter_video_src, GST_TYPE_BASE_SRC); +GST_ELEMENT_REGISTER_DEFINE (intervideosrc, "intervideosrc", + GST_RANK_NONE, GST_TYPE_INTER_VIDEO_SRC); static void gst_inter_video_src_class_init (GstInterVideoSrcClass * klass) diff --git a/gst/inter/gstintervideosrc.h b/gst/inter/gstintervideosrc.h index 0de36f4..89ef344 100644 --- a/gst/inter/gstintervideosrc.h +++ b/gst/inter/gstintervideosrc.h @@ -56,6 +56,7 @@ struct _GstInterVideoSrcClass }; GType gst_inter_video_src_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (intervideosrc); G_END_DECLS diff --git a/gst/interlace/gstinterlace.c b/gst/interlace/gstinterlace.c index ac109af..5c7fc7e 100644 --- a/gst/interlace/gstinterlace.c +++ b/gst/interlace/gstinterlace.c @@ -247,9 +247,13 @@ static GstStateChangeReturn gst_interlace_change_state (GstElement * element, static GstCaps *gst_interlace_caps_double_framerate (GstCaps * caps, gboolean half, gboolean skip_progressive); +GST_ELEMENT_REGISTER_DECLARE (interlace); + #define gst_interlace_parent_class parent_class G_DEFINE_TYPE (GstInterlace, gst_interlace, GST_TYPE_ELEMENT); - +GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (interlace, "interlace", GST_RANK_NONE, + GST_TYPE_INTERLACE, GST_DEBUG_CATEGORY_INIT (gst_interlace_debug, + "interlace", 0, "interlace element")); static void gst_interlace_class_init (GstInterlaceClass * klass) { @@ -1492,11 +1496,7 @@ gst_interlace_change_state (GstElement * element, GstStateChange transition) static gboolean plugin_init (GstPlugin * plugin) { - GST_DEBUG_CATEGORY_INIT (gst_interlace_debug, "interlace", 0, - "interlace element"); - - return gst_element_register (plugin, "interlace", GST_RANK_NONE, - GST_TYPE_INTERLACE); + return GST_ELEMENT_REGISTER (interlace, plugin); } GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, diff --git a/gst/ivfparse/gstivfparse.c b/gst/ivfparse/gstivfparse.c index 34675de..35c0bd5 100644 --- a/gst/ivfparse/gstivfparse.c +++ b/gst/ivfparse/gstivfparse.c @@ -72,6 +72,8 @@ static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src", #define gst_ivf_parse_parent_class parent_class G_DEFINE_TYPE (GstIvfParse, gst_ivf_parse, GST_TYPE_BASE_PARSE); +GST_ELEMENT_REGISTER_DEFINE (ivfparse, "ivfparse", GST_RANK_PRIMARY, + GST_TYPE_IVF_PARSE); static void gst_ivf_parse_finalize (GObject * object); static gboolean gst_ivf_parse_start (GstBaseParse * parse); @@ -397,14 +399,9 @@ gst_ivf_parse_handle_frame (GstBaseParse * parse, /* entry point to initialize the plug-in */ static gboolean -ivfparse_init (GstPlugin * ivfparse) +ivfparse_init (GstPlugin * plugin) { - /* register parser element */ - if (!gst_element_register (ivfparse, "ivfparse", GST_RANK_PRIMARY, - GST_TYPE_IVF_PARSE)) - return FALSE; - - return TRUE; + return GST_ELEMENT_REGISTER (ivfparse, plugin); } /* gstreamer looks for this structure to register plugins */ diff --git a/gst/ivfparse/gstivfparse.h b/gst/ivfparse/gstivfparse.h index 1a72f35..b37a0f8 100644 --- a/gst/ivfparse/gstivfparse.h +++ b/gst/ivfparse/gstivfparse.h @@ -66,6 +66,7 @@ struct _GstIvfParseClass }; GType gst_ivf_parse_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (ivfparse); G_END_DECLS diff --git a/gst/ivtc/gstcombdetect.c b/gst/ivtc/gstcombdetect.c index 87b3f73..2d29fba 100644 --- a/gst/ivtc/gstcombdetect.c +++ b/gst/ivtc/gstcombdetect.c @@ -93,6 +93,8 @@ GST_STATIC_PAD_TEMPLATE ("src", G_DEFINE_TYPE_WITH_CODE (GstCombDetect, gst_comb_detect, GST_TYPE_VIDEO_FILTER, GST_DEBUG_CATEGORY_INIT (gst_comb_detect_debug_category, "combdetect", 0, "debug category for combdetect element")); +GST_ELEMENT_REGISTER_DEFINE (combdetect, "combdetect", GST_RANK_NONE, + GST_TYPE_COMB_DETECT); static void gst_comb_detect_class_init (GstCombDetectClass * klass) diff --git a/gst/ivtc/gstcombdetect.h b/gst/ivtc/gstcombdetect.h index 9b10989..cd59f60 100644 --- a/gst/ivtc/gstcombdetect.h +++ b/gst/ivtc/gstcombdetect.h @@ -48,6 +48,8 @@ struct _GstCombDetectClass GType gst_comb_detect_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (combdetect); + G_END_DECLS #endif diff --git a/gst/ivtc/gstivtc.c b/gst/ivtc/gstivtc.c index 2556eed..c35481e 100644 --- a/gst/ivtc/gstivtc.c +++ b/gst/ivtc/gstivtc.c @@ -110,6 +110,7 @@ GST_STATIC_PAD_TEMPLATE ("src", G_DEFINE_TYPE_WITH_CODE (GstIvtc, gst_ivtc, GST_TYPE_BASE_TRANSFORM, GST_DEBUG_CATEGORY_INIT (gst_ivtc_debug_category, "ivtc", 0, "debug category for ivtc element")); +GST_ELEMENT_REGISTER_DEFINE (ivtc, "ivtc", GST_RANK_NONE, GST_TYPE_IVTC); static void gst_ivtc_class_init (GstIvtcClass * klass) @@ -681,9 +682,8 @@ get_comb_score (GstVideoFrame * top, GstVideoFrame * bottom) static gboolean plugin_init (GstPlugin * plugin) { - gst_element_register (plugin, "ivtc", GST_RANK_NONE, GST_TYPE_IVTC); - gst_element_register (plugin, "combdetect", GST_RANK_NONE, - GST_TYPE_COMB_DETECT); + GST_ELEMENT_REGISTER (ivtc, plugin); + GST_ELEMENT_REGISTER (combdetect, plugin); return TRUE; } diff --git a/gst/ivtc/gstivtc.h b/gst/ivtc/gstivtc.h index bf70760..879a259 100644 --- a/gst/ivtc/gstivtc.h +++ b/gst/ivtc/gstivtc.h @@ -25,6 +25,8 @@ G_BEGIN_DECLS +GST_ELEMENT_REGISTER_DECLARE (ivtc); + #define GST_TYPE_IVTC (gst_ivtc_get_type()) #define GST_IVTC(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_IVTC,GstIvtc)) #define GST_IVTC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_IVTC,GstIvtcClass)) diff --git a/gst/jp2kdecimator/gstjp2kdecimator.c b/gst/jp2kdecimator/gstjp2kdecimator.c index 3688381..532864e 100644 --- a/gst/jp2kdecimator/gstjp2kdecimator.c +++ b/gst/jp2kdecimator/gstjp2kdecimator.c @@ -79,7 +79,10 @@ GST_DEBUG_CATEGORY (gst_jp2k_decimator_debug); #define GST_CAT_DEFAULT gst_jp2k_decimator_debug G_DEFINE_TYPE (GstJP2kDecimator, gst_jp2k_decimator, GST_TYPE_ELEMENT); - +GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (jp2kdecimator, "jp2kdecimator", + GST_RANK_NONE, GST_TYPE_JP2K_DECIMATOR, + GST_DEBUG_CATEGORY_INIT (gst_jp2k_decimator_debug, "jp2kdecimator", 0, + "JPEG2000 decimator")); static void gst_jp2k_decimator_class_init (GstJP2kDecimatorClass * klass) { @@ -258,13 +261,7 @@ gst_jp2k_decimator_sink_chain (GstPad * pad, GstObject * parent, static gboolean plugin_init (GstPlugin * plugin) { - GST_DEBUG_CATEGORY_INIT (gst_jp2k_decimator_debug, "jp2kdecimator", 0, - "JPEG2000 decimator"); - - gst_element_register (plugin, "jp2kdecimator", GST_RANK_NONE, - GST_TYPE_JP2K_DECIMATOR); - - return TRUE; + return GST_ELEMENT_REGISTER (jp2kdecimator, plugin); } GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, diff --git a/gst/jp2kdecimator/gstjp2kdecimator.h b/gst/jp2kdecimator/gstjp2kdecimator.h index f5f3458..7f5a1a9 100644 --- a/gst/jp2kdecimator/gstjp2kdecimator.h +++ b/gst/jp2kdecimator/gstjp2kdecimator.h @@ -51,6 +51,7 @@ struct _GstJP2kDecimatorClass }; GType gst_jp2k_decimator_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (jp2kdecimator); G_END_DECLS diff --git a/gst/jpegformat/gstjifmux.c b/gst/jpegformat/gstjifmux.c index e958f54..79241bb 100644 --- a/gst/jpegformat/gstjifmux.c +++ b/gst/jpegformat/gstjifmux.c @@ -110,6 +110,8 @@ static GstStateChangeReturn gst_jif_mux_change_state (GstElement * element, G_DEFINE_TYPE_WITH_CODE (GstJifMux, gst_jif_mux, GST_TYPE_ELEMENT, G_IMPLEMENT_INTERFACE (GST_TYPE_TAG_SETTER, NULL); G_IMPLEMENT_INTERFACE (GST_TYPE_TAG_XMP_WRITER, NULL)); +GST_ELEMENT_REGISTER_DEFINE (jifmux, "jifmux", GST_RANK_SECONDARY, + GST_TYPE_JIF_MUX); static void gst_jif_mux_class_init (GstJifMuxClass * klass) diff --git a/gst/jpegformat/gstjifmux.h b/gst/jpegformat/gstjifmux.h index 400e64c..96830bb 100644 --- a/gst/jpegformat/gstjifmux.h +++ b/gst/jpegformat/gstjifmux.h @@ -61,6 +61,8 @@ struct _GstJifMuxClass { GType gst_jif_mux_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (jifmux); + G_END_DECLS #endif /* __GST_JFIF_MUX_H__ */ diff --git a/gst/jpegformat/gstjpegformat.c b/gst/jpegformat/gstjpegformat.c index b410466..bc37045 100644 --- a/gst/jpegformat/gstjpegformat.c +++ b/gst/jpegformat/gstjpegformat.c @@ -30,14 +30,12 @@ static gboolean plugin_init (GstPlugin * plugin) { - if (!gst_element_register (plugin, "jpegparse", GST_RANK_NONE, - GST_TYPE_JPEG_PARSE)) - return FALSE; - if (!gst_element_register (plugin, "jifmux", GST_RANK_SECONDARY, - GST_TYPE_JIF_MUX)) - return FALSE; + gboolean ret = FALSE; - return TRUE; + ret |= GST_ELEMENT_REGISTER (jpegparse, plugin); + ret |= GST_ELEMENT_REGISTER (jifmux, plugin); + + return ret; } GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, diff --git a/gst/jpegformat/gstjpegparse.c b/gst/jpegformat/gstjpegparse.c index 244b5a2..f08986f 100644 --- a/gst/jpegformat/gstjpegparse.c +++ b/gst/jpegformat/gstjpegparse.c @@ -89,6 +89,8 @@ static GstFlowReturn gst_jpeg_parse_pre_push_frame (GstBaseParse * bparse, #define gst_jpeg_parse_parent_class parent_class G_DEFINE_TYPE (GstJpegParse, gst_jpeg_parse, GST_TYPE_BASE_PARSE); +GST_ELEMENT_REGISTER_DEFINE (jpegparse, "jpegparse", GST_RANK_NONE, + GST_TYPE_JPEG_PARSE); static void gst_jpeg_parse_class_init (GstJpegParseClass * klass) diff --git a/gst/jpegformat/gstjpegparse.h b/gst/jpegformat/gstjpegparse.h index f809fa3..e777421 100644 --- a/gst/jpegformat/gstjpegparse.h +++ b/gst/jpegformat/gstjpegparse.h @@ -87,6 +87,8 @@ struct _GstJpegParseClass { GType gst_jpeg_parse_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (jpegparse); + G_END_DECLS #endif /* __GST_JPEG_PARSE_H__ */ diff --git a/gst/librfb/gstrfbsrc.c b/gst/librfb/gstrfbsrc.c index 194ee07..cadfda3 100644 --- a/gst/librfb/gstrfbsrc.c +++ b/gst/librfb/gstrfbsrc.c @@ -82,6 +82,7 @@ static GstFlowReturn gst_rfb_src_fill (GstPushSrc * psrc, GstBuffer * outbuf); #define gst_rfb_src_parent_class parent_class G_DEFINE_TYPE (GstRfbSrc, gst_rfb_src, GST_TYPE_PUSH_SRC); +GST_ELEMENT_REGISTER_DEFINE (rfbsrc, "rfbsrc", GST_RANK_NONE, GST_TYPE_RFB_SRC); static void gst_rfb_src_class_init (GstRfbSrcClass * klass) @@ -632,8 +633,7 @@ gst_rfb_src_unlock (GstBaseSrc * bsrc) static gboolean plugin_init (GstPlugin * plugin) { - return gst_element_register (plugin, "rfbsrc", GST_RANK_NONE, - GST_TYPE_RFB_SRC); + return GST_ELEMENT_REGISTER (rfbsrc, plugin); } GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, diff --git a/gst/librfb/gstrfbsrc.h b/gst/librfb/gstrfbsrc.h index 81ebd45..e106549 100644 --- a/gst/librfb/gstrfbsrc.h +++ b/gst/librfb/gstrfbsrc.h @@ -68,6 +68,7 @@ struct _GstRfbSrc }; GType gst_rfb_src_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (rfbsrc); G_END_DECLS #endif diff --git a/gst/midi/midi.c b/gst/midi/midi.c index 6171359..01e9b6d 100644 --- a/gst/midi/midi.c +++ b/gst/midi/midi.c @@ -28,16 +28,9 @@ #include "midiparse.h" -GST_DEBUG_CATEGORY_STATIC (midi_debug); -#define GST_CAT_DEFAULT (midi_debug) - static gboolean plugin_init (GstPlugin * plugin) { - gboolean ret; - - GST_DEBUG_CATEGORY_INIT (midi_debug, "midi", 0, "MIDI plugin"); - #ifdef ENABLE_NLS GST_DEBUG ("binding text domain %s to locale dir %s", GETTEXT_PACKAGE, LOCALEDIR); @@ -45,10 +38,7 @@ plugin_init (GstPlugin * plugin) bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); #endif - ret = gst_element_register (plugin, "midiparse", GST_RANK_PRIMARY, - GST_TYPE_MIDI_PARSE); - - return ret; + return GST_ELEMENT_REGISTER (midiparse, plugin); } GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, diff --git a/gst/midi/midiparse.c b/gst/midi/midiparse.c index dc3c078..1189310 100644 --- a/gst/midi/midiparse.c +++ b/gst/midi/midiparse.c @@ -118,6 +118,8 @@ static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src", #define parent_class gst_midi_parse_parent_class G_DEFINE_TYPE (GstMidiParse, gst_midi_parse, GST_TYPE_ELEMENT); +GST_ELEMENT_REGISTER_DEFINE (midiparse, "midiparse", GST_RANK_PRIMARY, + GST_TYPE_MIDI_PARSE); /* initialize the plugin's class */ static void diff --git a/gst/midi/midiparse.h b/gst/midi/midiparse.h index 5794c37..05b627a 100644 --- a/gst/midi/midiparse.h +++ b/gst/midi/midiparse.h @@ -87,6 +87,7 @@ struct _GstMidiParseClass }; GType gst_midi_parse_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (midiparse); G_END_DECLS diff --git a/gst/mpegdemux/gstmpegdemux.c b/gst/mpegdemux/gstmpegdemux.c index c0de469..bfbe0d9 100644 --- a/gst/mpegdemux/gstmpegdemux.c +++ b/gst/mpegdemux/gstmpegdemux.c @@ -81,6 +81,8 @@ typedef enum GST_DEBUG_CATEGORY_STATIC (gstflupsdemux_debug); #define GST_CAT_DEFAULT (gstflupsdemux_debug) +GST_DEBUG_CATEGORY_EXTERN (mpegpspesfilter_debug); + /* MPEG2Demux signals and args */ enum { @@ -218,6 +220,11 @@ gst_ps_demux_get_type (void) return ps_demux_type; } +GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (mpegpsdemux, "mpegpsdemux", + GST_RANK_PRIMARY, GST_TYPE_PS_DEMUX, + GST_DEBUG_CATEGORY_INIT (mpegpspesfilter_debug, "mpegpspesfilter", 0, + "MPEG-PS PES filter")); + static void gst_ps_demux_base_init (GstPsDemuxClass * klass) { diff --git a/gst/mpegdemux/gstmpegdemux.h b/gst/mpegdemux/gstmpegdemux.h index d43d42a..d11f8c2 100644 --- a/gst/mpegdemux/gstmpegdemux.h +++ b/gst/mpegdemux/gstmpegdemux.h @@ -173,6 +173,7 @@ struct _GstPsDemuxClass }; GType gst_ps_demux_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (mpegpsdemux); G_END_DECLS #endif /* __GST_PS_DEMUX_H__ */ diff --git a/gst/mpegdemux/plugin.c b/gst/mpegdemux/plugin.c index 4d0bca2..0ad2548 100644 --- a/gst/mpegdemux/plugin.c +++ b/gst/mpegdemux/plugin.c @@ -47,19 +47,10 @@ #include "gstmpegdemux.h" -GST_DEBUG_CATEGORY_EXTERN (mpegpspesfilter_debug); - static gboolean plugin_init (GstPlugin * plugin) { - GST_DEBUG_CATEGORY_INIT (mpegpspesfilter_debug, "mpegpspesfilter", 0, - "MPEG-PS PES filter"); - - if (!gst_element_register (plugin, "mpegpsdemux", GST_RANK_PRIMARY, - GST_TYPE_PS_DEMUX)) - return FALSE; - - return TRUE; + return GST_ELEMENT_REGISTER (mpegpsdemux, plugin); } GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, diff --git a/gst/mpegpsmux/mpegpsmux.c b/gst/mpegpsmux/mpegpsmux.c index c7e4cc2..50c6c70 100644 --- a/gst/mpegpsmux/mpegpsmux.c +++ b/gst/mpegpsmux/mpegpsmux.c @@ -108,7 +108,9 @@ static GstStateChangeReturn mpegpsmux_change_state (GstElement * element, #define parent_class mpegpsmux_parent_class G_DEFINE_TYPE (MpegPsMux, mpegpsmux, GST_TYPE_ELEMENT); - +GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (mpegpsmux, "mpegpsmux", GST_RANK_PRIMARY, + mpegpsmux_get_type (), GST_DEBUG_CATEGORY_INIT (mpegpsmux_debug, + "mpegpsmux", 0, "MPEG Program Stream muxer")); static void mpegpsmux_class_init (MpegPsMuxClass * klass) { @@ -774,14 +776,7 @@ mpegpsmux_change_state (GstElement * element, GstStateChange transition) static gboolean plugin_init (GstPlugin * plugin) { - if (!gst_element_register (plugin, "mpegpsmux", GST_RANK_PRIMARY, - mpegpsmux_get_type ())) - return FALSE; - - GST_DEBUG_CATEGORY_INIT (mpegpsmux_debug, "mpegpsmux", 0, - "MPEG Program Stream muxer"); - - return TRUE; + return GST_ELEMENT_REGISTER (mpegpsmux, plugin); } GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, GST_VERSION_MINOR, diff --git a/gst/mpegpsmux/mpegpsmux.h b/gst/mpegpsmux/mpegpsmux.h index c04edf4..e469267 100644 --- a/gst/mpegpsmux/mpegpsmux.h +++ b/gst/mpegpsmux/mpegpsmux.h @@ -113,6 +113,7 @@ struct MpegPsPadData { }; GType mpegpsmux_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (mpegpsmux); #define CLOCK_BASE 9LL #define CLOCK_FREQ (CLOCK_BASE * 10000) diff --git a/gst/mpegtsdemux/gsttsdemux.c b/gst/mpegtsdemux/gsttsdemux.c index af3da38..188bf46 100644 --- a/gst/mpegtsdemux/gsttsdemux.c +++ b/gst/mpegtsdemux/gsttsdemux.c @@ -31,14 +31,12 @@ static gboolean plugin_init (GstPlugin * plugin) { - gst_mpegts_initialize (); - if (!gst_mpegtsbase_plugin_init (plugin)) - return FALSE; - if (!gst_mpegtsparse_plugin_init (plugin)) - return FALSE; - if (!gst_ts_demux_plugin_init (plugin)) - return FALSE; - return TRUE; + gboolean ret = FALSE; + + ret |= GST_ELEMENT_REGISTER (tsparse, plugin); + ret |= GST_ELEMENT_REGISTER (tsdemux, plugin); + + return ret; } GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, diff --git a/gst/mpegtsdemux/mpegtsbase.c b/gst/mpegtsdemux/mpegtsbase.c index bce8e8f..cc567f0 100644 --- a/gst/mpegtsdemux/mpegtsbase.c +++ b/gst/mpegtsdemux/mpegtsbase.c @@ -108,6 +108,9 @@ _extra_init (void) QUARK_PCR_PID = g_quark_from_string ("pcr-pid"); QUARK_STREAMS = g_quark_from_string ("streams"); QUARK_STREAM_TYPE = g_quark_from_string ("stream-type"); + GST_DEBUG_CATEGORY_INIT (mpegts_base_debug, "mpegtsbase", 0, + "MPEG transport stream base class"); + gst_mpegts_initialize (); } #define mpegts_base_parent_class parent_class diff --git a/gst/mpegtsdemux/mpegtsparse.c b/gst/mpegtsdemux/mpegtsparse.c index 7bb928a..76ac55b 100644 --- a/gst/mpegtsdemux/mpegtsparse.c +++ b/gst/mpegtsdemux/mpegtsparse.c @@ -125,6 +125,11 @@ static gboolean push_event (MpegTSBase * base, GstEvent * event); #define mpegts_parse_parent_class parent_class G_DEFINE_TYPE (MpegTSParse2, mpegts_parse, GST_TYPE_MPEGTS_BASE); +GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (tsparse, "tsparse", + GST_RANK_NONE, GST_TYPE_MPEGTS_PARSE, + GST_DEBUG_CATEGORY_INIT (mpegts_parse_debug, "tsparse", 0, + "MPEG transport stream parser")); + static void mpegts_parse_reset (MpegTSBase * base); static GstFlowReturn mpegts_parse_input_done (MpegTSBase * base); static GstFlowReturn @@ -1206,13 +1211,3 @@ mpegts_parse_src_pad_query (GstPad * pad, GstObject * parent, GstQuery * query) } return res; } - -gboolean -gst_mpegtsparse_plugin_init (GstPlugin * plugin) -{ - GST_DEBUG_CATEGORY_INIT (mpegts_parse_debug, "tsparse", 0, - "MPEG transport stream parser"); - - return gst_element_register (plugin, "tsparse", - GST_RANK_NONE, GST_TYPE_MPEGTS_PARSE); -} diff --git a/gst/mpegtsdemux/mpegtsparse.h b/gst/mpegtsdemux/mpegtsparse.h index 6b2aa33..55f2a55 100644 --- a/gst/mpegtsdemux/mpegtsparse.h +++ b/gst/mpegtsdemux/mpegtsparse.h @@ -95,8 +95,7 @@ struct _MpegTSParse2Class { }; G_GNUC_INTERNAL GType mpegts_parse_get_type(void); - -G_GNUC_INTERNAL gboolean gst_mpegtsparse_plugin_init (GstPlugin * plugin); +GST_ELEMENT_REGISTER_DECLARE (tsparse); G_END_DECLS diff --git a/gst/mpegtsdemux/tsdemux.c b/gst/mpegtsdemux/tsdemux.c index 5266576..2f932c9 100644 --- a/gst/mpegtsdemux/tsdemux.c +++ b/gst/mpegtsdemux/tsdemux.c @@ -356,6 +356,12 @@ _extra_init (void) #define gst_ts_demux_parent_class parent_class G_DEFINE_TYPE_WITH_CODE (GstTSDemux, gst_ts_demux, GST_TYPE_MPEGTS_BASE, _extra_init ()); +#define _do_element_init \ + GST_DEBUG_CATEGORY_INIT (ts_demux_debug, "tsdemux", 0, \ + "MPEG transport stream demuxer");\ + init_pes_parser (); +GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (tsdemux, "tsdemux", + GST_RANK_PRIMARY, GST_TYPE_TS_DEMUX, _do_element_init); static void gst_ts_demux_dispose (GObject * object) @@ -3420,14 +3426,3 @@ gst_ts_demux_push (MpegTSBase * base, MpegTSPacketizerPacket * packet, } return res; } - -gboolean -gst_ts_demux_plugin_init (GstPlugin * plugin) -{ - GST_DEBUG_CATEGORY_INIT (ts_demux_debug, "tsdemux", 0, - "MPEG transport stream demuxer"); - init_pes_parser (); - - return gst_element_register (plugin, "tsdemux", - GST_RANK_PRIMARY, GST_TYPE_TS_DEMUX); -} diff --git a/gst/mpegtsdemux/tsdemux.h b/gst/mpegtsdemux/tsdemux.h index 931306a..dd0275a 100644 --- a/gst/mpegtsdemux/tsdemux.h +++ b/gst/mpegtsdemux/tsdemux.h @@ -109,8 +109,7 @@ struct _GstTSDemuxClass }; G_GNUC_INTERNAL GType gst_ts_demux_get_type (void); - -G_GNUC_INTERNAL gboolean gst_ts_demux_plugin_init (GstPlugin * plugin); +GST_ELEMENT_REGISTER_DECLARE (tsdemux); G_END_DECLS #endif /* GST_TS_DEMUX_H */ diff --git a/gst/mpegtsmux/gstatscmux.c b/gst/mpegtsmux/gstatscmux.c index bdd8bf1..9a54fe0 100644 --- a/gst/mpegtsmux/gstatscmux.c +++ b/gst/mpegtsmux/gstatscmux.c @@ -25,6 +25,8 @@ GST_DEBUG_CATEGORY (gst_atsc_mux_debug); #define GST_CAT_DEFAULT gst_atsc_mux_debug G_DEFINE_TYPE (GstATSCMux, gst_atsc_mux, GST_TYPE_BASE_TS_MUX); +GST_ELEMENT_REGISTER_DEFINE (atscmux, "atscmux", GST_RANK_PRIMARY, + gst_atsc_mux_get_type ()); #define parent_class gst_atsc_mux_parent_class #define ATSCMUX_ST_PS_AUDIO_EAC3 0x87 diff --git a/gst/mpegtsmux/gstatscmux.h b/gst/mpegtsmux/gstatscmux.h index e2c6dd8..4101572 100644 --- a/gst/mpegtsmux/gstatscmux.h +++ b/gst/mpegtsmux/gstatscmux.h @@ -40,6 +40,7 @@ struct GstATSCMuxClass { }; GType gst_atsc_mux_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (atscmux); G_END_DECLS diff --git a/gst/mpegtsmux/gstbasetsmux.c b/gst/mpegtsmux/gstbasetsmux.c index 3fe7da4..fd6138a 100644 --- a/gst/mpegtsmux/gstbasetsmux.c +++ b/gst/mpegtsmux/gstbasetsmux.c @@ -236,7 +236,8 @@ typedef struct GstBuffer *buffer; } StreamData; -G_DEFINE_TYPE (GstBaseTsMux, gst_base_ts_mux, GST_TYPE_AGGREGATOR); +G_DEFINE_TYPE_WITH_CODE (GstBaseTsMux, gst_base_ts_mux, GST_TYPE_AGGREGATOR, + gst_mpegts_initialize ()); /* Internals */ diff --git a/gst/mpegtsmux/gstmpegtsmux.c b/gst/mpegtsmux/gstmpegtsmux.c index 1b3638e..1c26f39 100644 --- a/gst/mpegtsmux/gstmpegtsmux.c +++ b/gst/mpegtsmux/gstmpegtsmux.c @@ -152,8 +152,10 @@ GST_STATIC_PAD_TEMPLATE ("src", GST_DEBUG_CATEGORY (gst_mpeg_ts_mux_debug); #define GST_CAT_DEFAULT gst_mpeg_ts_mux_debug -G_DEFINE_TYPE (GstMpegTsMux, gst_mpeg_ts_mux, GST_TYPE_BASE_TS_MUX); #define parent_class gst_mpeg_ts_mux_parent_class +G_DEFINE_TYPE (GstMpegTsMux, gst_mpeg_ts_mux, GST_TYPE_BASE_TS_MUX); +GST_ELEMENT_REGISTER_DEFINE (mpegtsmux, "mpegtsmux", GST_RANK_PRIMARY, + gst_mpeg_ts_mux_get_type ()); /* Internals */ diff --git a/gst/mpegtsmux/gstmpegtsmux.h b/gst/mpegtsmux/gstmpegtsmux.h index bb796b4..fb97405 100644 --- a/gst/mpegtsmux/gstmpegtsmux.h +++ b/gst/mpegtsmux/gstmpegtsmux.h @@ -118,6 +118,7 @@ struct GstMpegTsMuxClass { }; GType gst_mpeg_ts_mux_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (mpegtsmux); G_END_DECLS diff --git a/gst/mpegtsmux/gstmpegtsmuxplugin.c b/gst/mpegtsmux/gstmpegtsmuxplugin.c index aea1bae..22552a8 100644 --- a/gst/mpegtsmux/gstmpegtsmuxplugin.c +++ b/gst/mpegtsmux/gstmpegtsmuxplugin.c @@ -2,23 +2,18 @@ #include "config.h" #endif -#include "gstmpegtsmux.h" #include "gstatscmux.h" +#include "gstmpegtsmux.h" static gboolean plugin_init (GstPlugin * plugin) { - gst_mpegts_initialize (); - - if (!gst_element_register (plugin, "mpegtsmux", GST_RANK_PRIMARY, - gst_mpeg_ts_mux_get_type ())) - return FALSE; + gboolean ret = FALSE; - if (!gst_element_register (plugin, "atscmux", GST_RANK_PRIMARY, - gst_atsc_mux_get_type ())) - return FALSE; + ret |= GST_ELEMENT_REGISTER (mpegtsmux, plugin); + ret |= GST_ELEMENT_REGISTER (atscmux, plugin); - return TRUE; + return ret; } GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, GST_VERSION_MINOR, diff --git a/gst/mxf/gstmxfelement.c b/gst/mxf/gstmxfelement.c new file mode 100644 index 0000000..f2c1166 --- /dev/null +++ b/gst/mxf/gstmxfelement.c @@ -0,0 +1,82 @@ + +/* GStreamer + * Copyright (C) <2008> Sebastian Dröge + * + * 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 +#endif + +#include + +#include "gstmxfelements.h" +#include "mxfquark.h" +#include "mxfdemux.h" +#include "mxfmux.h" +/*#include "mxfdms1.h"*/ +#include "mxfaes-bwf.h" +#include "mxfalaw.h" +#include "mxfd10.h" +#include "mxfdv-dif.h" +#include "mxfjpeg2000.h" +#include "mxfmpeg.h" +#include "mxfup.h" +#include "mxfvc3.h" +#include "mxfprores.h" +#include "mxfvanc.h" + +GST_DEBUG_CATEGORY (mxf_debug); +#define GST_CAT_DEFAULT mxf_debug + +static void +mxf_init (void) +{ + gst_tag_register (GST_TAG_MXF_UMID, GST_TAG_FLAG_META, + G_TYPE_STRING, "UMID", "Unique Material Identifier", NULL); + gst_tag_register (GST_TAG_MXF_STRUCTURE, GST_TAG_FLAG_META, + GST_TYPE_STRUCTURE, "Structure", "Structural metadata of " + "the MXF file", NULL); + gst_tag_register (GST_TAG_MXF_DESCRIPTIVE_METADATA_FRAMEWORK, + GST_TAG_FLAG_META, GST_TYPE_STRUCTURE, "DM Framework", + "Descriptive metadata framework", NULL); +} + +void +mxf_element_init (GstPlugin * plugin) +{ + static gsize res = FALSE; + + if (g_once_init_enter (&res)) { + GST_DEBUG_CATEGORY_INIT (mxf_debug, "mxf", 0, "MXF"); + + mxf_init (); + mxf_quark_initialize (); + mxf_metadata_init_types (); + /* mxf_dms1_initialize (); */ + mxf_aes_bwf_init (); + mxf_alaw_init (); + mxf_d10_init (); + mxf_dv_dif_init (); + mxf_jpeg2000_init (); + mxf_mpeg_init (); + mxf_up_init (); + mxf_vc3_init (); + mxf_prores_init (); + mxf_vanc_init (); + g_once_init_leave (&res, TRUE); + } +} diff --git a/gst/mxf/gstmxfelements.h b/gst/mxf/gstmxfelements.h new file mode 100644 index 0000000..bc2cc57 --- /dev/null +++ b/gst/mxf/gstmxfelements.h @@ -0,0 +1,36 @@ +/* GStreamer + * Copyright (C) 2020 Huawei Technologies Co., Ltd. + * @Author: Stéphane Cerveau + * + * 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_MXF_ELEMENTS_H__ +#define __GST_MXF_ELEMENTS_H__ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include + +void mxf_element_init (GstPlugin * plugin); + +GST_ELEMENT_REGISTER_DECLARE (mxfdemux); +GST_ELEMENT_REGISTER_DECLARE (mxfmux); + +#endif /* __GST_MXF_ELEMENTS_H__ */ diff --git a/gst/mxf/meson.build b/gst/mxf/meson.build index 30980df..db9c419 100644 --- a/gst/mxf/meson.build +++ b/gst/mxf/meson.build @@ -1,5 +1,6 @@ mxf_sources = [ 'mxf.c', + 'gstmxfelement.c', 'mxful.c', 'mxftypes.c', 'mxfmetadata.c', diff --git a/gst/mxf/mxf.c b/gst/mxf/mxf.c index e4f94cb..e3e9fe3 100644 --- a/gst/mxf/mxf.c +++ b/gst/mxf/mxf.c @@ -1,3 +1,4 @@ + /* GStreamer * Copyright (C) <2008> Sebastian Dröge * @@ -20,67 +21,19 @@ #include #endif -#include - -#include "mxfquark.h" -#include "mxfdemux.h" -#include "mxfmux.h" -/*#include "mxfdms1.h"*/ -#include "mxfaes-bwf.h" -#include "mxfalaw.h" -#include "mxfd10.h" -#include "mxfdv-dif.h" -#include "mxfjpeg2000.h" -#include "mxfmpeg.h" -#include "mxfup.h" -#include "mxfvc3.h" -#include "mxfprores.h" -#include "mxfvanc.h" - -GST_DEBUG_CATEGORY (mxf_debug); -#define GST_CAT_DEFAULT mxf_debug +#include "gstmxfelements.h" -static void -mxf_init (void) -{ - gst_tag_register (GST_TAG_MXF_UMID, GST_TAG_FLAG_META, - G_TYPE_STRING, "UMID", "Unique Material Identifier", NULL); - gst_tag_register (GST_TAG_MXF_STRUCTURE, GST_TAG_FLAG_META, - GST_TYPE_STRUCTURE, "Structure", "Structural metadata of " - "the MXF file", NULL); - gst_tag_register (GST_TAG_MXF_DESCRIPTIVE_METADATA_FRAMEWORK, - GST_TAG_FLAG_META, GST_TYPE_STRUCTURE, "DM Framework", - "Descriptive metadata framework", NULL); -} static gboolean plugin_init (GstPlugin * plugin) { - GST_DEBUG_CATEGORY_INIT (mxf_debug, "mxf", 0, "MXF"); - - mxf_init (); - mxf_quark_initialize (); - mxf_metadata_init_types (); -/* mxf_dms1_initialize ();*/ - mxf_aes_bwf_init (); - mxf_alaw_init (); - mxf_d10_init (); - mxf_dv_dif_init (); - mxf_jpeg2000_init (); - mxf_mpeg_init (); - mxf_up_init (); - mxf_vc3_init (); - mxf_prores_init (); - mxf_vanc_init (); + gboolean ret = FALSE; /* mxfmux is disabled for now - it compiles but is completely untested */ - if (!gst_element_register (plugin, "mxfdemux", GST_RANK_PRIMARY, - GST_TYPE_MXF_DEMUX) - || !gst_element_register (plugin, "mxfmux", GST_RANK_PRIMARY, - GST_TYPE_MXF_MUX)) - return FALSE; + ret |= GST_ELEMENT_REGISTER (mxfdemux, plugin); + ret |= GST_ELEMENT_REGISTER (mxfmux, plugin); - return TRUE; + return ret; } GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, diff --git a/gst/mxf/mxfdemux.c b/gst/mxf/mxfdemux.c index f6e5ac0..d34827c 100644 --- a/gst/mxf/mxfdemux.c +++ b/gst/mxf/mxfdemux.c @@ -51,6 +51,7 @@ #include "config.h" #endif +#include "gstmxfelements.h" #include "mxfdemux.h" #include "mxfessence.h" @@ -128,6 +129,8 @@ static gboolean gst_mxf_demux_src_query (GstPad * pad, GstObject * parent, #define gst_mxf_demux_parent_class parent_class G_DEFINE_TYPE (GstMXFDemux, gst_mxf_demux, GST_TYPE_ELEMENT); +GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (mxfdemux, "mxfdemux", GST_RANK_PRIMARY, + GST_TYPE_MXF_DEMUX, mxf_element_init (plugin)); static void gst_mxf_demux_remove_pad (GstMXFDemuxPad * pad, GstMXFDemux * demux) diff --git a/gst/mxf/mxfmux.c b/gst/mxf/mxfmux.c index 1fb9c6f..2eade47 100644 --- a/gst/mxf/mxfmux.c +++ b/gst/mxf/mxfmux.c @@ -37,6 +37,7 @@ #include #include +#include "gstmxfelements.h" #include "mxfmux.h" #ifdef HAVE_SYS_UTSNAME_H @@ -120,6 +121,8 @@ enum #define gst_mxf_mux_parent_class parent_class G_DEFINE_TYPE (GstMXFMux, gst_mxf_mux, GST_TYPE_AGGREGATOR); +GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (mxfmux, "mxfmux", GST_RANK_PRIMARY, + GST_TYPE_MXF_MUX, mxf_element_init (plugin)); static void gst_mxf_mux_finalize (GObject * object); diff --git a/gst/netsim/gstnetsim.c b/gst/netsim/gstnetsim.c index 692b389..c917de3 100644 --- a/gst/netsim/gstnetsim.c +++ b/gst/netsim/gstnetsim.c @@ -93,6 +93,8 @@ GST_STATIC_PAD_TEMPLATE ("src", GST_STATIC_CAPS_ANY); G_DEFINE_TYPE (GstNetSim, gst_net_sim, GST_TYPE_ELEMENT); +GST_ELEMENT_REGISTER_DEFINE (netsim, "netsim", + GST_RANK_MARGINAL, GST_TYPE_NET_SIM); static gboolean gst_net_sim_source_dispatch (GSource * source, @@ -763,8 +765,7 @@ gst_net_sim_class_init (GstNetSimClass * klass) static gboolean gst_net_sim_plugin_init (GstPlugin * plugin) { - return gst_element_register (plugin, "netsim", - GST_RANK_MARGINAL, GST_TYPE_NET_SIM); + return GST_ELEMENT_REGISTER (netsim, plugin); } GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, diff --git a/gst/netsim/gstnetsim.h b/gst/netsim/gstnetsim.h index bfbfa3f..cbd6270 100644 --- a/gst/netsim/gstnetsim.h +++ b/gst/netsim/gstnetsim.h @@ -96,6 +96,7 @@ struct _GstNetSimClass }; GType gst_net_sim_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (netsim); G_END_DECLS diff --git a/gst/onvif/gstrtponvif.c b/gst/onvif/gstrtponvif.c index c674232..3ae7ea8 100644 --- a/gst/onvif/gstrtponvif.c +++ b/gst/onvif/gstrtponvif.c @@ -30,14 +30,12 @@ static gboolean plugin_init (GstPlugin * plugin) { - if (!gst_element_register (plugin, "rtponviftimestamp", GST_RANK_NONE, - GST_TYPE_RTP_ONVIF_TIMESTAMP)) - return FALSE; - if (!gst_element_register (plugin, "rtponvifparse", GST_RANK_NONE, - GST_TYPE_RTP_ONVIF_PARSE)) - return FALSE; + gboolean ret = FALSE; - return TRUE; + ret |= GST_ELEMENT_REGISTER (rtponviftimestamp, plugin); + ret |= GST_ELEMENT_REGISTER (rtponvifparse, plugin); + + return ret; } GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, diff --git a/gst/onvif/gstrtponvifparse.c b/gst/onvif/gstrtponvifparse.c index 8fa0d85..aaae94a 100644 --- a/gst/onvif/gstrtponvifparse.c +++ b/gst/onvif/gstrtponvifparse.c @@ -48,6 +48,8 @@ GST_STATIC_PAD_TEMPLATE ("src", ); G_DEFINE_TYPE (GstRtpOnvifParse, gst_rtp_onvif_parse, GST_TYPE_ELEMENT); +GST_ELEMENT_REGISTER_DEFINE (rtponvifparse, "rtponvifparse", + GST_RANK_NONE, GST_TYPE_RTP_ONVIF_PARSE); static void gst_rtp_onvif_parse_class_init (GstRtpOnvifParseClass * klass) diff --git a/gst/onvif/gstrtponvifparse.h b/gst/onvif/gstrtponvifparse.h index 437b1ab..a5b8d15 100644 --- a/gst/onvif/gstrtponvifparse.h +++ b/gst/onvif/gstrtponvifparse.h @@ -54,6 +54,7 @@ struct _GstRtpOnvifParseClass { }; GType gst_rtp_onvif_parse_get_type(void); +GST_ELEMENT_REGISTER_DECLARE (rtponvifparse); #ifdef __cplusplus } diff --git a/gst/onvif/gstrtponviftimestamp.c b/gst/onvif/gstrtponviftimestamp.c index 1ed5465..c5fb1d4 100644 --- a/gst/onvif/gstrtponviftimestamp.c +++ b/gst/onvif/gstrtponviftimestamp.c @@ -78,6 +78,8 @@ enum /*static guint gst_rtp_onvif_timestamp_signals[LAST_SIGNAL] = { 0 }; */ G_DEFINE_TYPE (GstRtpOnvifTimestamp, gst_rtp_onvif_timestamp, GST_TYPE_ELEMENT); +GST_ELEMENT_REGISTER_DEFINE (rtponviftimestamp, "rtponviftimestamp", + GST_RANK_NONE, GST_TYPE_RTP_ONVIF_TIMESTAMP); static void gst_rtp_onvif_timestamp_get_property (GObject * object, diff --git a/gst/onvif/gstrtponviftimestamp.h b/gst/onvif/gstrtponviftimestamp.h index f093f0e..15a47f8 100644 --- a/gst/onvif/gstrtponviftimestamp.h +++ b/gst/onvif/gstrtponviftimestamp.h @@ -75,6 +75,7 @@ struct _GstRtpOnvifTimestampClass { }; GType gst_rtp_onvif_timestamp_get_type(void); +GST_ELEMENT_REGISTER_DECLARE (rtponviftimestamp); #ifdef __cplusplus } diff --git a/gst/pcapparse/gstirtspparse.c b/gst/pcapparse/gstirtspparse.c index e9ab037..c049845 100644 --- a/gst/pcapparse/gstirtspparse.c +++ b/gst/pcapparse/gstirtspparse.c @@ -80,6 +80,8 @@ static void gst_irtsp_parse_get_property (GObject * object, #define parent_class gst_irtsp_parse_parent_class G_DEFINE_TYPE (GstIRTSPParse, gst_irtsp_parse, GST_TYPE_BASE_PARSE); +GST_ELEMENT_REGISTER_DEFINE (irtspparse, "irtspparse", GST_RANK_NONE, + GST_TYPE_IRTSP_PARSE); static void gst_irtsp_parse_class_init (GstIRTSPParseClass * klass) diff --git a/gst/pcapparse/gstirtspparse.h b/gst/pcapparse/gstirtspparse.h index e3d3b74..1ebbf3e 100644 --- a/gst/pcapparse/gstirtspparse.h +++ b/gst/pcapparse/gstirtspparse.h @@ -76,6 +76,7 @@ struct _GstIRTSPParseClass }; GType gst_irtsp_parse_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (irtspparse); G_END_DECLS #endif /* __GST_IRTSP_PARSE_H__ */ diff --git a/gst/pcapparse/gstpcapparse.c b/gst/pcapparse/gstpcapparse.c index aab2b8a..967e4ca 100644 --- a/gst/pcapparse/gstpcapparse.c +++ b/gst/pcapparse/gstpcapparse.c @@ -107,6 +107,8 @@ static gboolean gst_pcap_sink_event (GstPad * pad, #define parent_class gst_pcap_parse_parent_class G_DEFINE_TYPE (GstPcapParse, gst_pcap_parse, GST_TYPE_ELEMENT); +GST_ELEMENT_REGISTER_DEFINE (pcapparse, "pcapparse", GST_RANK_NONE, + GST_TYPE_PCAP_PARSE); static void gst_pcap_parse_class_init (GstPcapParseClass * klass) diff --git a/gst/pcapparse/gstpcapparse.h b/gst/pcapparse/gstpcapparse.h index 5feb4c6..29e2188 100644 --- a/gst/pcapparse/gstpcapparse.h +++ b/gst/pcapparse/gstpcapparse.h @@ -94,6 +94,7 @@ struct _GstPcapParseClass }; GType gst_pcap_parse_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (pcapparse); G_END_DECLS diff --git a/gst/pcapparse/plugin.c b/gst/pcapparse/plugin.c index 3e6eb38..10f2cb1 100644 --- a/gst/pcapparse/plugin.c +++ b/gst/pcapparse/plugin.c @@ -27,12 +27,10 @@ static gboolean plugin_init (GstPlugin * plugin) { - gboolean ret; + gboolean ret = FALSE; - ret = gst_element_register (plugin, "pcapparse", - GST_RANK_NONE, GST_TYPE_PCAP_PARSE); - ret &= gst_element_register (plugin, "irtspparse", - GST_RANK_NONE, GST_TYPE_IRTSP_PARSE); + ret |= GST_ELEMENT_REGISTER (pcapparse, plugin); + ret |= GST_ELEMENT_REGISTER (irtspparse, plugin); return ret; } diff --git a/gst/pnm/gstpnm.c b/gst/pnm/gstpnm.c index 2b08609..8f3efac 100644 --- a/gst/pnm/gstpnm.c +++ b/gst/pnm/gstpnm.c @@ -23,21 +23,16 @@ #include "gstpnmdec.h" #include "gstpnmenc.h" -#include - -#include static gboolean plugin_init (GstPlugin * plugin) { - if (!gst_element_register (plugin, "pnmdec", GST_RANK_PRIMARY, - GST_TYPE_PNMDEC)) - return FALSE; - if (!gst_element_register (plugin, "pnmenc", GST_RANK_PRIMARY, - GST_TYPE_PNMENC)) - return FALSE; + gboolean ret = FALSE; + + ret |= GST_ELEMENT_REGISTER (pnmdec, plugin); + ret |= GST_ELEMENT_REGISTER (pnmenc, plugin); - return TRUE; + return ret; } GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, GST_VERSION_MINOR, pnm, diff --git a/gst/pnm/gstpnmdec.c b/gst/pnm/gstpnmdec.c index b11a731..d67cba3 100644 --- a/gst/pnm/gstpnmdec.c +++ b/gst/pnm/gstpnmdec.c @@ -56,6 +56,8 @@ static GstFlowReturn gst_pnmdec_parse_ascii (GstPnmdec * s, const guint8 * b, guint bs); G_DEFINE_TYPE (GstPnmdec, gst_pnmdec, GST_TYPE_VIDEO_DECODER); +GST_ELEMENT_REGISTER_DEFINE (pnmdec, "pnmdec", GST_RANK_PRIMARY, + GST_TYPE_PNMDEC); static GstStaticPadTemplate gst_pnmdec_src_pad_template = GST_STATIC_PAD_TEMPLATE ("src", diff --git a/gst/pnm/gstpnmdec.h b/gst/pnm/gstpnmdec.h index b5aac35..7909680 100644 --- a/gst/pnm/gstpnmdec.h +++ b/gst/pnm/gstpnmdec.h @@ -54,7 +54,7 @@ struct _GstPnmdecClass }; GType gst_pnmdec_get_type (void) G_GNUC_CONST; - +GST_ELEMENT_REGISTER_DECLARE (pnmdec); G_END_DECLS #endif /* __GST_PNMDEC_H__ */ diff --git a/gst/pnm/gstpnmenc.c b/gst/pnm/gstpnmenc.c index 7919f5d..c637b74 100644 --- a/gst/pnm/gstpnmenc.c +++ b/gst/pnm/gstpnmenc.c @@ -65,8 +65,11 @@ static GstStaticPadTemplate src_pad_template = GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS, GST_STATIC_CAPS (MIME_ALL)); -G_DEFINE_TYPE (GstPnmenc, gst_pnmenc, GST_TYPE_VIDEO_ENCODER); #define parent_class gst_pnmenc_parent_class +G_DEFINE_TYPE (GstPnmenc, gst_pnmenc, GST_TYPE_VIDEO_ENCODER); +GST_ELEMENT_REGISTER_DEFINE (pnmenc, "pnmenc", GST_RANK_PRIMARY, + GST_TYPE_PNMENC); + static GstFlowReturn gst_pnmenc_handle_frame (GstVideoEncoder * encoder, GstVideoCodecFrame * frame); diff --git a/gst/pnm/gstpnmenc.h b/gst/pnm/gstpnmenc.h index cb7f45b..3dc57b0 100644 --- a/gst/pnm/gstpnmenc.h +++ b/gst/pnm/gstpnmenc.h @@ -51,6 +51,7 @@ struct _GstPnmencClass }; GType gst_pnmenc_get_type (void) G_GNUC_CONST; +GST_ELEMENT_REGISTER_DECLARE (pnmenc); G_END_DECLS diff --git a/gst/proxy/gstproxy.c b/gst/proxy/gstproxy.c index fbe4e5e..74bc86e 100644 --- a/gst/proxy/gstproxy.c +++ b/gst/proxy/gstproxy.c @@ -29,11 +29,12 @@ static gboolean plugin_init (GstPlugin * plugin) { - gst_element_register (plugin, "proxysrc", GST_RANK_NONE, GST_TYPE_PROXY_SRC); - gst_element_register (plugin, "proxysink", GST_RANK_NONE, - GST_TYPE_PROXY_SINK); + gboolean ret = FALSE; - return TRUE; + ret |= GST_ELEMENT_REGISTER (proxysrc, plugin); + ret |= GST_ELEMENT_REGISTER (proxysink, plugin); + + return ret; } GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, diff --git a/gst/proxy/gstproxysink.c b/gst/proxy/gstproxysink.c index f44f8ec..9425dcc 100644 --- a/gst/proxy/gstproxysink.c +++ b/gst/proxy/gstproxysink.c @@ -54,6 +54,8 @@ static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink", /* Unlink proxysrc, we don't contain any elements so our parent is GstElement */ #define parent_class gst_proxy_sink_parent_class G_DEFINE_TYPE (GstProxySink, gst_proxy_sink, GST_TYPE_ELEMENT); +GST_ELEMENT_REGISTER_DEFINE (proxysink, "proxysink", GST_RANK_NONE, + GST_TYPE_PROXY_SINK); static gboolean gst_proxy_sink_sink_query (GstPad * pad, GstObject * parent, GstQuery * query); diff --git a/gst/proxy/gstproxysink.h b/gst/proxy/gstproxysink.h index 9da4b39..9bd382c 100644 --- a/gst/proxy/gstproxysink.h +++ b/gst/proxy/gstproxysink.h @@ -55,6 +55,7 @@ struct _GstProxySinkClass { }; GType gst_proxy_sink_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (proxysink); G_END_DECLS diff --git a/gst/proxy/gstproxysrc.c b/gst/proxy/gstproxysrc.c index c7fb4b6..97fbc12 100644 --- a/gst/proxy/gstproxysrc.c +++ b/gst/proxy/gstproxysrc.c @@ -100,6 +100,8 @@ enum * element */ #define parent_class gst_proxy_src_parent_class G_DEFINE_TYPE (GstProxySrc, gst_proxy_src, GST_TYPE_BIN); +GST_ELEMENT_REGISTER_DEFINE (proxysrc, "proxysrc", GST_RANK_NONE, + GST_TYPE_PROXY_SRC); static gboolean gst_proxy_src_internal_src_query (GstPad * pad, GstObject * parent, GstQuery * query); diff --git a/gst/proxy/gstproxysrc.h b/gst/proxy/gstproxysrc.h index 4f5c302..4e7648c 100644 --- a/gst/proxy/gstproxysrc.h +++ b/gst/proxy/gstproxysrc.h @@ -63,6 +63,7 @@ struct _GstProxySrcClass { }; GType gst_proxy_src_get_type(void); +GST_ELEMENT_REGISTER_DECLARE (proxysrc); G_END_DECLS diff --git a/gst/rawparse/gstaudioparse.c b/gst/rawparse/gstaudioparse.c index 6e4c647..3e73762 100644 --- a/gst/rawparse/gstaudioparse.c +++ b/gst/rawparse/gstaudioparse.c @@ -122,6 +122,8 @@ gst_audio_parse_format_get_type (void) #define gst_audio_parse_parent_class parent_class G_DEFINE_TYPE (GstAudioParse, gst_audio_parse, GST_TYPE_BIN); +GST_ELEMENT_REGISTER_DEFINE (audioparse, "audioparse", GST_RANK_NONE, + gst_audio_parse_get_type ()); static void gst_audio_parse_class_init (GstAudioParseClass * klass) diff --git a/gst/rawparse/gstaudioparse.h b/gst/rawparse/gstaudioparse.h index 41b23d4..22039e7 100644 --- a/gst/rawparse/gstaudioparse.h +++ b/gst/rawparse/gstaudioparse.h @@ -50,5 +50,6 @@ struct _GstAudioParseClass }; GType gst_audio_parse_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (audioparse); #endif /* __GST_AUDIO_PARSE_H__ */ diff --git a/gst/rawparse/gstvideoparse.c b/gst/rawparse/gstvideoparse.c index ee931a9..3594282 100644 --- a/gst/rawparse/gstvideoparse.c +++ b/gst/rawparse/gstvideoparse.c @@ -82,6 +82,8 @@ enum #define gst_video_parse_parent_class parent_class G_DEFINE_TYPE (GstVideoParse, gst_video_parse, GST_TYPE_BIN); +GST_ELEMENT_REGISTER_DEFINE (videoparse, "videoparse", GST_RANK_NONE, + gst_video_parse_get_type ()); static void gst_video_parse_class_init (GstVideoParseClass * klass) diff --git a/gst/rawparse/gstvideoparse.h b/gst/rawparse/gstvideoparse.h index 57b9b68..59391e0 100644 --- a/gst/rawparse/gstvideoparse.h +++ b/gst/rawparse/gstvideoparse.h @@ -51,5 +51,6 @@ struct _GstVideoParseClass }; GType gst_video_parse_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (videoparse); #endif /* __GST_VIDEO_PARSE_H__ */ diff --git a/gst/rawparse/plugin.c b/gst/rawparse/plugin.c index d7de876..0487b50 100644 --- a/gst/rawparse/plugin.c +++ b/gst/rawparse/plugin.c @@ -9,12 +9,10 @@ static gboolean plugin_init (GstPlugin * plugin) { - gboolean ret; + gboolean ret = FALSE; - ret = gst_element_register (plugin, "videoparse", GST_RANK_NONE, - gst_video_parse_get_type ()); - ret &= gst_element_register (plugin, "audioparse", GST_RANK_NONE, - gst_audio_parse_get_type ()); + ret |= GST_ELEMENT_REGISTER (videoparse, plugin); + ret |= GST_ELEMENT_REGISTER (audioparse, plugin); return ret; } diff --git a/gst/removesilence/gstremovesilence.c b/gst/removesilence/gstremovesilence.c index 5529f6a..6822e57 100644 --- a/gst/removesilence/gstremovesilence.c +++ b/gst/removesilence/gstremovesilence.c @@ -104,6 +104,8 @@ static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src", #define gst_remove_silence_parent_class parent_class G_DEFINE_TYPE_WITH_CODE (GstRemoveSilence, gst_remove_silence, GST_TYPE_BASE_TRANSFORM, DEBUG_INIT (0)); +GST_ELEMENT_REGISTER_DEFINE (removesilence, "removesilence", GST_RANK_NONE, + gst_remove_silence_get_type ()); static void gst_remove_silence_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec); @@ -427,8 +429,7 @@ gst_remove_silence_transform_ip (GstBaseTransform * trans, GstBuffer * inbuf) static gboolean plugin_init (GstPlugin * plugin) { - return gst_element_register (plugin, "removesilence", GST_RANK_NONE, - gst_remove_silence_get_type ()); + return GST_ELEMENT_REGISTER (removesilence, plugin); } GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, diff --git a/gst/removesilence/gstremovesilence.h b/gst/removesilence/gstremovesilence.h index f7faf10..2cecb07 100644 --- a/gst/removesilence/gstremovesilence.h +++ b/gst/removesilence/gstremovesilence.h @@ -60,6 +60,7 @@ typedef struct _GstRemoveSilenceClass { } GstRemoveSilenceClass; GType gst_remove_silence_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (removesilence); G_END_DECLS diff --git a/gst/rist/gstrist.c b/gst/rist/gstrist.c new file mode 100644 index 0000000..b393925 --- /dev/null +++ b/gst/rist/gstrist.c @@ -0,0 +1,93 @@ +/* GStreamer RIST plugin + * Copyright (C) 2019 Net Insight AB + * Author: Nicolas Dufresne + * + * 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 "gstrist.h" +#include "gstroundrobin.h" + +/* + * rtp_ext_seq: + * @extseq: (inout): a previous extended seqs + * @seq: a new seq + * + * Update the @extseq field with the extended seq of @seq + * For the first call of the method, @extseq should point to a location + * with a value of -1. + * + * This function is able to handle both forward and backward seqs taking + * into account: + * - seq wraparound making sure that the returned value is properly increased. + * - seq unwraparound making sure that the returned value is properly decreased. + * + * Returns: The extended seq of @seq or 0 if the result can't go anywhere backwards. + * + * NOTE: This is a calque of gst_rtp_buffer_ext_timestamp() but with + * s/32/16/ and s/64/32/ and s/0xffffffff/0xffff/ and s/timestamp/seqnum/. + */ +guint32 +gst_rist_rtp_ext_seq (guint32 * extseqnum, guint16 seqnum) +{ + guint32 result, ext; + + g_return_val_if_fail (extseqnum != NULL, -1); + + ext = *extseqnum; + + if (ext == -1) { + result = seqnum; + } else { + /* pick wraparound counter from previous seqnum and add to new seqnum */ + result = seqnum + (ext & ~(0xffff)); + + /* check for seqnum wraparound */ + if (result < ext) { + guint32 diff = ext - result; + + if (diff > G_MAXINT16) { + /* seqnum went backwards more than allowed, we wrap around and get + * updated extended seqnum. */ + result += (1 << 16); + } + } else { + guint32 diff = result - ext; + + if (diff > G_MAXINT16) { + if (result < (1 << 16)) { + GST_WARNING + ("Cannot unwrap, any wrapping took place yet. Returning 0 without updating extended seqnum."); + return 0; + } else { + /* seqnum went forwards more than allowed, we unwrap around and get + * updated extended seqnum. */ + result -= (1 << 16); + /* We don't want the extended seqnum storage to go back, ever */ + return result; + } + } + } + } + + *extseqnum = result; + + return result; +} diff --git a/gst/rist/gstrist.h b/gst/rist/gstrist.h index 1f74044..b6d3c83 100644 --- a/gst/rist/gstrist.h +++ b/gst/rist/gstrist.h @@ -30,6 +30,7 @@ typedef struct { GstElementClass parent_class; } GstRistRtxReceiveClass; GType gst_rist_rtx_receive_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (ristrtxreceive); #define GST_TYPE_RIST_RTX_SEND (gst_rist_rtx_send_get_type()) #define GST_RIST_RTX_SEND(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RIST_RTX_SEND, GstRistRtxSend)) @@ -38,6 +39,7 @@ typedef struct { GstElementClass parent_class; } GstRistRtxSendClass; GType gst_rist_rtx_send_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (ristrtxsend); #define GST_TYPE_RIST_SRC (gst_rist_src_get_type()) #define GST_RIST_SRC(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RIST_SRC,GstRistSrc)) @@ -46,7 +48,7 @@ typedef struct { GstBinClass parent; } GstRistSrcClass; GType gst_rist_src_get_type (void); - +GST_ELEMENT_REGISTER_DECLARE (ristsrc); #define GST_TYPE_RIST_SINK (gst_rist_sink_get_type()) #define GST_RIST_SINK(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RIST_SINK,GstRistSink)) @@ -55,6 +57,7 @@ typedef struct { GstBinClass parent; } GstRistSinkClass; GType gst_rist_sink_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (ristsink); #define GST_TYPE_RIST_RTP_EXT (gst_rist_rtp_ext_get_type()) #define GST_RIST_RTP_EXT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RIST_RTP_EXT,GstRistRtpExt)) @@ -63,6 +66,7 @@ typedef struct { GstElementClass parent; } GstRistRtpExtClass; GType gst_rist_rtp_ext_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (ristrtpext); #define GST_TYPE_RIST_RTP_DEEXT (gst_rist_rtp_deext_get_type()) #define GST_RIST_RTP_DEEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RIST_RTP_DEEXT,GstRistRtpDeext)) @@ -71,6 +75,7 @@ typedef struct { GstElementClass parent; } GstRistRtpDeextClass; GType gst_rist_rtp_deext_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (ristrtpdeext); guint32 gst_rist_rtp_ext_seq (guint32 * extseqnum, guint16 seqnum); diff --git a/gst/rist/gstristplugin.c b/gst/rist/gstristplugin.c index e068655..ff6fda2 100644 --- a/gst/rist/gstristplugin.c +++ b/gst/rist/gstristplugin.c @@ -25,99 +25,20 @@ #include "gstrist.h" #include "gstroundrobin.h" -/* - * rtp_ext_seq: - * @extseq: (inout): a previous extended seqs - * @seq: a new seq - * - * Update the @extseq field with the extended seq of @seq - * For the first call of the method, @extseq should point to a location - * with a value of -1. - * - * This function is able to handle both forward and backward seqs taking - * into account: - * - seq wraparound making sure that the returned value is properly increased. - * - seq unwraparound making sure that the returned value is properly decreased. - * - * Returns: The extended seq of @seq or 0 if the result can't go anywhere backwards. - * - * NOTE: This is a calque of gst_rtp_buffer_ext_timestamp() but with - * s/32/16/ and s/64/32/ and s/0xffffffff/0xffff/ and s/timestamp/seqnum/. - */ -guint32 -gst_rist_rtp_ext_seq (guint32 * extseqnum, guint16 seqnum) -{ - guint32 result, ext; - - g_return_val_if_fail (extseqnum != NULL, -1); - - ext = *extseqnum; - - if (ext == -1) { - result = seqnum; - } else { - /* pick wraparound counter from previous seqnum and add to new seqnum */ - result = seqnum + (ext & ~(0xffff)); - - /* check for seqnum wraparound */ - if (result < ext) { - guint32 diff = ext - result; - - if (diff > G_MAXINT16) { - /* seqnum went backwards more than allowed, we wrap around and get - * updated extended seqnum. */ - result += (1 << 16); - } - } else { - guint32 diff = result - ext; - - if (diff > G_MAXINT16) { - if (result < (1 << 16)) { - GST_WARNING - ("Cannot unwrap, any wrapping took place yet. Returning 0 without updating extended seqnum."); - return 0; - } else { - /* seqnum went forwards more than allowed, we unwrap around and get - * updated extended seqnum. */ - result -= (1 << 16); - /* We don't want the extended seqnum storage to go back, ever */ - return result; - } - } - } - } - - *extseqnum = result; - - return result; -} - static gboolean plugin_init (GstPlugin * plugin) { - if (!gst_element_register (plugin, "ristsrc", GST_RANK_PRIMARY, - GST_TYPE_RIST_SRC)) - return FALSE; - if (!gst_element_register (plugin, "ristsink", GST_RANK_PRIMARY, - GST_TYPE_RIST_SINK)) - return FALSE; - if (!gst_element_register (plugin, "ristrtxsend", GST_RANK_NONE, - GST_TYPE_RIST_RTX_SEND)) - return FALSE; - if (!gst_element_register (plugin, "ristrtxreceive", GST_RANK_NONE, - GST_TYPE_RIST_RTX_RECEIVE)) - return FALSE; - if (!gst_element_register (plugin, "roundrobin", GST_RANK_NONE, - GST_TYPE_ROUND_ROBIN)) - return FALSE; - if (!gst_element_register (plugin, "ristrtpext", GST_RANK_NONE, - GST_TYPE_RIST_RTP_EXT)) - return FALSE; - if (!gst_element_register (plugin, "ristrtpdeext", GST_RANK_NONE, - GST_TYPE_RIST_RTP_DEEXT)) - return FALSE; + gboolean ret = FALSE; + + ret |= GST_ELEMENT_REGISTER (ristsrc, plugin); + ret |= GST_ELEMENT_REGISTER (ristsink, plugin); + ret |= GST_ELEMENT_REGISTER (ristrtxsend, plugin); + ret |= GST_ELEMENT_REGISTER (ristrtxreceive, plugin); + ret |= GST_ELEMENT_REGISTER (roundrobin, plugin); + ret |= GST_ELEMENT_REGISTER (ristrtpext, plugin); + ret |= GST_ELEMENT_REGISTER (ristrtpdeext, plugin); - return TRUE; + return ret; } GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, diff --git a/gst/rist/gstristrtpdeext.c b/gst/rist/gstristrtpdeext.c index 47d3c2b..7dc2a04 100644 --- a/gst/rist/gstristrtpdeext.c +++ b/gst/rist/gstristrtpdeext.c @@ -76,6 +76,8 @@ struct _GstRistRtpDeext G_DEFINE_TYPE_WITH_CODE (GstRistRtpDeext, gst_rist_rtp_deext, GST_TYPE_ELEMENT, GST_DEBUG_CATEGORY_INIT (gst_rist_rtp_deext_debug, "ristrtpdeext", 0, "RIST RTP De-extension")); +GST_ELEMENT_REGISTER_DEFINE (ristrtpdeext, "ristrtpdeext", GST_RANK_NONE, + GST_TYPE_RIST_RTP_DEEXT); static guint8 bit_count (guint8 value) diff --git a/gst/rist/gstristrtpext.c b/gst/rist/gstristrtpext.c index 42b2993..32e3ea1 100644 --- a/gst/rist/gstristrtpext.c +++ b/gst/rist/gstristrtpext.c @@ -85,7 +85,8 @@ struct _GstRistRtpExt G_DEFINE_TYPE_WITH_CODE (GstRistRtpExt, gst_rist_rtp_ext, GST_TYPE_ELEMENT, GST_DEBUG_CATEGORY_INIT (gst_rist_rtp_ext_debug, "ristrtpext", 0, "RIST RTP Extension")); - +GST_ELEMENT_REGISTER_DEFINE (ristrtpext, "ristrtpext", GST_RANK_NONE, + GST_TYPE_RIST_RTP_EXT); static GstFlowReturn gst_rist_rtp_ext_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer) diff --git a/gst/rist/gstristrtxreceive.c b/gst/rist/gstristrtxreceive.c index fe8a6d5..861835a 100644 --- a/gst/rist/gstristrtxreceive.c +++ b/gst/rist/gstristrtxreceive.c @@ -91,6 +91,8 @@ static void gst_rist_rtx_receive_get_property (GObject * object, guint prop_id, G_DEFINE_TYPE_WITH_CODE (GstRistRtxReceive, gst_rist_rtx_receive, GST_TYPE_ELEMENT, GST_DEBUG_CATEGORY_INIT (gst_rist_rtx_receive_debug, "ristrtxreceive", 0, "RIST retransmission receiver")); +GST_ELEMENT_REGISTER_DEFINE (ristrtxreceive, "ristrtxreceive", + GST_RANK_NONE, GST_TYPE_RIST_RTX_RECEIVE); static void gst_rist_rtx_receive_class_init (GstRistRtxReceiveClass * klass) diff --git a/gst/rist/gstristrtxsend.c b/gst/rist/gstristrtxsend.c index 3c4d404..fc2206a 100644 --- a/gst/rist/gstristrtxsend.c +++ b/gst/rist/gstristrtxsend.c @@ -122,6 +122,8 @@ static void gst_rist_rtx_send_finalize (GObject * object); G_DEFINE_TYPE_WITH_CODE (GstRistRtxSend, gst_rist_rtx_send, GST_TYPE_ELEMENT, GST_DEBUG_CATEGORY_INIT (gst_rist_rtx_send_debug, "ristrtxsend", 0, "RIST retransmission sender")); +GST_ELEMENT_REGISTER_DEFINE (ristrtxsend, "ristrtxsend", GST_RANK_NONE, + GST_TYPE_RIST_RTX_SEND); typedef struct { diff --git a/gst/rist/gstristsink.c b/gst/rist/gstristsink.c index 6622257..1de516d 100644 --- a/gst/rist/gstristsink.c +++ b/gst/rist/gstristsink.c @@ -188,6 +188,8 @@ gst_rist_bonding_method_get_type (void) G_DEFINE_TYPE_WITH_CODE (GstRistSink, gst_rist_sink, GST_TYPE_BIN, GST_DEBUG_CATEGORY_INIT (gst_rist_sink_debug, "ristsink", 0, "RIST Sink")); +GST_ELEMENT_REGISTER_DEFINE (ristsink, "ristsink", GST_RANK_PRIMARY, + GST_TYPE_RIST_SINK); GQuark session_id_quark = 0; diff --git a/gst/rist/gstristsrc.c b/gst/rist/gstristsrc.c index 5e194fc..369be39 100644 --- a/gst/rist/gstristsrc.c +++ b/gst/rist/gstristsrc.c @@ -163,6 +163,8 @@ static void gst_rist_src_uri_init (gpointer g_iface, gpointer iface_data); G_DEFINE_TYPE_WITH_CODE (GstRistSrc, gst_rist_src, GST_TYPE_BIN, G_IMPLEMENT_INTERFACE (GST_TYPE_URI_HANDLER, gst_rist_src_uri_init); GST_DEBUG_CATEGORY_INIT (gst_rist_src_debug, "ristsrc", 0, "RIST Source")); +GST_ELEMENT_REGISTER_DEFINE (ristsrc, "ristsrc", GST_RANK_PRIMARY, + GST_TYPE_RIST_SRC); /* called with bonds lock */ static RistReceiverBond * diff --git a/gst/rist/gstroundrobin.c b/gst/rist/gstroundrobin.c index 2ff8ff3..d899e7e 100644 --- a/gst/rist/gstroundrobin.c +++ b/gst/rist/gstroundrobin.c @@ -53,6 +53,8 @@ struct _GstRoundRobin G_DEFINE_TYPE_WITH_CODE (GstRoundRobin, gst_round_robin, GST_TYPE_ELEMENT, GST_DEBUG_CATEGORY_INIT (gst_round_robin_debug, "roundrobin", 0, "Round Robin")); +GST_ELEMENT_REGISTER_DEFINE (roundrobin, "roundrobin", GST_RANK_NONE, + GST_TYPE_ROUND_ROBIN); static GstFlowReturn gst_round_robin_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer) diff --git a/gst/rist/gstroundrobin.h b/gst/rist/gstroundrobin.h index d1a9180..96fd28c 100644 --- a/gst/rist/gstroundrobin.h +++ b/gst/rist/gstroundrobin.h @@ -30,5 +30,6 @@ typedef struct { GstElementClass parent; } GstRoundRobinClass; GType gst_round_robin_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (roundrobin); #endif diff --git a/gst/rist/meson.build b/gst/rist/meson.build index a7ef8bb..88c9e87 100644 --- a/gst/rist/meson.build +++ b/gst/rist/meson.build @@ -4,6 +4,7 @@ rist_sources = [ 'gstristrtxreceive.c', 'gstristsrc.c', 'gstristsink.c', + 'gstrist.c', 'gstristplugin.c', 'gstristrtpext.c', 'gstristrtpdeext.c' diff --git a/gst/rtmp2/gstrtmp2.c b/gst/rtmp2/gstrtmp2.c index 1be1a3c..3565022 100644 --- a/gst/rtmp2/gstrtmp2.c +++ b/gst/rtmp2/gstrtmp2.c @@ -23,24 +23,18 @@ #include "config.h" #endif -#include "gstrtmp2src.h" -#include "gstrtmp2sink.h" +#include "gstrtmp2elements.h" -#include "rtmp/rtmpclient.h" static gboolean plugin_init (GstPlugin * plugin) { - gst_element_register (plugin, "rtmp2src", GST_RANK_PRIMARY + 1, - GST_TYPE_RTMP2_SRC); - gst_element_register (plugin, "rtmp2sink", GST_RANK_PRIMARY + 1, - GST_TYPE_RTMP2_SINK); + gboolean ret = FALSE; - gst_type_mark_as_plugin_api (GST_TYPE_RTMP_SCHEME, 0); - gst_type_mark_as_plugin_api (GST_TYPE_RTMP_AUTHMOD, 0); - gst_type_mark_as_plugin_api (GST_TYPE_RTMP_STOP_COMMANDS, 0); + ret |= GST_ELEMENT_REGISTER (rtmp2src, plugin); + ret |= GST_ELEMENT_REGISTER (rtmp2sink, plugin); - return TRUE; + return ret; } GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, diff --git a/gst/rtmp2/gstrtmp2element.c b/gst/rtmp2/gstrtmp2element.c new file mode 100644 index 0000000..2a01c06 --- /dev/null +++ b/gst/rtmp2/gstrtmp2element.c @@ -0,0 +1,41 @@ +/* GStreamer + * Copyright (C) 2014 David Schleef + * Copyright (C) 2017 Make.TV, Inc. + * Contact: Jan Alexander Steffens (heftig) + * + * 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 Street, Suite 500, + * Boston, MA 02110-1335, USA. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "gstrtmp2elements.h" + +#include "rtmp/rtmpclient.h" + +void +rtmp2_element_init (GstPlugin * plugin) +{ + static gsize res = FALSE; + + if (g_once_init_enter (&res)) { + gst_type_mark_as_plugin_api (GST_TYPE_RTMP_SCHEME, 0); + gst_type_mark_as_plugin_api (GST_TYPE_RTMP_AUTHMOD, 0); + gst_type_mark_as_plugin_api (GST_TYPE_RTMP_STOP_COMMANDS, 0); + g_once_init_leave (&res, TRUE); + } +} diff --git a/gst/rtmp2/gstrtmp2elements.h b/gst/rtmp2/gstrtmp2elements.h new file mode 100644 index 0000000..be20c16 --- /dev/null +++ b/gst/rtmp2/gstrtmp2elements.h @@ -0,0 +1,36 @@ +/* GStreamer + * Copyright (C) 2020 Huawei Technologies Co., Ltd. + * @Author: Stéphane Cerveau + * + * 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_RTMP2_ELEMENTS_H__ +#define __GST_RTMP2_ELEMENTS_H__ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include + +void rtmp2_element_init (GstPlugin * plugin); + +GST_ELEMENT_REGISTER_DECLARE (rtmp2sink); +GST_ELEMENT_REGISTER_DECLARE (rtmp2src); + +#endif /* __GST_RTMP2_ELEMENTS_H__ */ diff --git a/gst/rtmp2/gstrtmp2sink.c b/gst/rtmp2/gstrtmp2sink.c index 13b4d08..46dbe35 100644 --- a/gst/rtmp2/gstrtmp2sink.c +++ b/gst/rtmp2/gstrtmp2sink.c @@ -38,6 +38,7 @@ #include "config.h" #endif +#include "gstrtmp2elements.h" #include "gstrtmp2sink.h" #include "gstrtmp2locationhandler.h" @@ -167,6 +168,8 @@ G_DEFINE_TYPE_WITH_CODE (GstRtmp2Sink, gst_rtmp2_sink, GST_TYPE_BASE_SINK, G_IMPLEMENT_INTERFACE (GST_TYPE_URI_HANDLER, gst_rtmp2_sink_uri_handler_init); G_IMPLEMENT_INTERFACE (GST_TYPE_RTMP_LOCATION_HANDLER, NULL)); +GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (rtmp2sink, "rtmp2sink", + GST_RANK_PRIMARY + 1, GST_TYPE_RTMP2_SINK, rtmp2_element_init (plugin)); static void gst_rtmp2_sink_class_init (GstRtmp2SinkClass * klass) diff --git a/gst/rtmp2/gstrtmp2src.c b/gst/rtmp2/gstrtmp2src.c index 2df92e4..6cad882 100644 --- a/gst/rtmp2/gstrtmp2src.c +++ b/gst/rtmp2/gstrtmp2src.c @@ -36,6 +36,7 @@ #include "config.h" #endif +#include "gstrtmp2elements.h" #include "gstrtmp2src.h" #include "gstrtmp2locationhandler.h" @@ -157,6 +158,8 @@ G_DEFINE_TYPE_WITH_CODE (GstRtmp2Src, gst_rtmp2_src, GST_TYPE_PUSH_SRC, G_IMPLEMENT_INTERFACE (GST_TYPE_URI_HANDLER, gst_rtmp2_src_uri_handler_init); G_IMPLEMENT_INTERFACE (GST_TYPE_RTMP_LOCATION_HANDLER, NULL)); +GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (rtmp2src, "rtmp2src", + GST_RANK_PRIMARY + 1, GST_TYPE_RTMP2_SRC, rtmp2_element_init (plugin)); static void gst_rtmp2_src_class_init (GstRtmp2SrcClass * klass) diff --git a/gst/rtmp2/meson.build b/gst/rtmp2/meson.build index c67a248..e9cabbd 100644 --- a/gst/rtmp2/meson.build +++ b/gst/rtmp2/meson.build @@ -1,5 +1,6 @@ rtmp2_sources = [ 'gstrtmp2.c', + 'gstrtmp2element.c', 'gstrtmp2locationhandler.c', 'gstrtmp2sink.c', 'gstrtmp2src.c', diff --git a/gst/rtp/gstrtpsink.c b/gst/rtp/gstrtpsink.c index 364b688..c94c6da 100644 --- a/gst/rtp/gstrtpsink.c +++ b/gst/rtp/gstrtpsink.c @@ -81,6 +81,8 @@ static void gst_rtp_sink_uri_handler_init (gpointer g_iface, G_DEFINE_TYPE_WITH_CODE (GstRtpSink, gst_rtp_sink, GST_TYPE_BIN, G_IMPLEMENT_INTERFACE (GST_TYPE_URI_HANDLER, gst_rtp_sink_uri_handler_init); GST_DEBUG_CATEGORY_INIT (gst_rtp_sink_debug, "rtpsink", 0, "RTP Sink")); +GST_ELEMENT_REGISTER_DEFINE (rtpsink, "rtpsink", GST_RANK_PRIMARY + 1, + GST_TYPE_RTP_SINK); #define GST_RTP_SINK_GET_LOCK(obj) (&((GstRtpSink*)(obj))->lock) #define GST_RTP_SINK_LOCK(obj) (g_mutex_lock (GST_RTP_SINK_GET_LOCK(obj))) diff --git a/gst/rtp/gstrtpsink.h b/gst/rtp/gstrtpsink.h index 1af5e0b..bc1f6dc 100644 --- a/gst/rtp/gstrtpsink.h +++ b/gst/rtp/gstrtpsink.h @@ -66,6 +66,7 @@ struct _GstRtpSinkClass }; GType gst_rtp_sink_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (rtpsink); G_END_DECLS #endif /* __GST_RTP_SINK_H__ */ diff --git a/gst/rtp/gstrtpsrc.c b/gst/rtp/gstrtpsrc.c index 6dda142..8ff6f21 100644 --- a/gst/rtp/gstrtpsrc.c +++ b/gst/rtp/gstrtpsrc.c @@ -91,6 +91,8 @@ static void gst_rtp_src_uri_handler_init (gpointer g_iface, G_DEFINE_TYPE_WITH_CODE (GstRtpSrc, gst_rtp_src, GST_TYPE_BIN, G_IMPLEMENT_INTERFACE (GST_TYPE_URI_HANDLER, gst_rtp_src_uri_handler_init); GST_DEBUG_CATEGORY_INIT (gst_rtp_src_debug, "rtpsrc", 0, "RTP Source")); +GST_ELEMENT_REGISTER_DEFINE (rtpsrc, "rtpsrc", GST_RANK_PRIMARY + 1, + GST_TYPE_RTP_SRC); #define GST_RTP_SRC_GET_LOCK(obj) (&((GstRtpSrc*)(obj))->lock) #define GST_RTP_SRC_LOCK(obj) (g_mutex_lock (GST_RTP_SRC_GET_LOCK(obj))) diff --git a/gst/rtp/gstrtpsrc.h b/gst/rtp/gstrtpsrc.h index ad773d9..616fdb1 100644 --- a/gst/rtp/gstrtpsrc.h +++ b/gst/rtp/gstrtpsrc.h @@ -72,6 +72,7 @@ struct _GstRtpSrcClass }; GType gst_rtp_src_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (rtpsrc); G_END_DECLS #endif /* __GST_RTP_SRC_H__ */ diff --git a/gst/rtp/plugin.c b/gst/rtp/plugin.c index 8c1d71f..5b8d467 100644 --- a/gst/rtp/plugin.c +++ b/gst/rtp/plugin.c @@ -9,14 +9,10 @@ static gboolean plugin_init (GstPlugin * plugin) { - gboolean ret = FALSE; - ret |= gst_element_register (plugin, "rtpsrc", - GST_RANK_PRIMARY + 1, GST_TYPE_RTP_SRC); - - ret |= gst_element_register (plugin, "rtpsink", - GST_RANK_PRIMARY + 1, GST_TYPE_RTP_SINK); + ret |= GST_ELEMENT_REGISTER (rtpsrc, plugin); + ret |= GST_ELEMENT_REGISTER (rtpsink, plugin); return ret; } diff --git a/gst/sdp/gstsdpdemux.c b/gst/sdp/gstsdpdemux.c index 1374bbb..1737ed8 100644 --- a/gst/sdp/gstsdpdemux.c +++ b/gst/sdp/gstsdpdemux.c @@ -110,6 +110,8 @@ static GstFlowReturn gst_sdp_demux_sink_chain (GstPad * pad, GstObject * parent, #define gst_sdp_demux_parent_class parent_class G_DEFINE_TYPE (GstSDPDemux, gst_sdp_demux, GST_TYPE_BIN); +GST_ELEMENT_REGISTER_DEFINE (sdpdemux, "sdpdemux", GST_RANK_NONE, + GST_TYPE_SDP_DEMUX); static void gst_sdp_demux_class_init (GstSDPDemuxClass * klass) diff --git a/gst/sdp/gstsdpdemux.h b/gst/sdp/gstsdpdemux.h index 908ac5b..fb8ea44 100644 --- a/gst/sdp/gstsdpdemux.h +++ b/gst/sdp/gstsdpdemux.h @@ -113,6 +113,7 @@ struct _GstSDPDemuxClass { }; GType gst_sdp_demux_get_type(void); +GST_ELEMENT_REGISTER_DECLARE (sdpdemux); G_END_DECLS diff --git a/gst/sdp/gstsdpelem.c b/gst/sdp/gstsdpelem.c index 8a945cd..a9d22fc 100644 --- a/gst/sdp/gstsdpelem.c +++ b/gst/sdp/gstsdpelem.c @@ -27,13 +27,12 @@ static gboolean plugin_init (GstPlugin * plugin) { - if (!gst_element_register (plugin, "sdpdemux", GST_RANK_NONE, - GST_TYPE_SDP_DEMUX)) - return FALSE; - if (!gst_element_register (plugin, "sdpsrc", GST_RANK_NONE, GST_TYPE_SDP_SRC)) - return FALSE; + gboolean ret = FALSE; - return TRUE; + ret |= GST_ELEMENT_REGISTER (sdpdemux, plugin); + ret |= GST_ELEMENT_REGISTER (sdpsrc, plugin); + + return ret; } GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, diff --git a/gst/sdp/gstsdpsrc.c b/gst/sdp/gstsdpsrc.c index 96b483d..184c9bf 100644 --- a/gst/sdp/gstsdpsrc.c +++ b/gst/sdp/gstsdpsrc.c @@ -45,6 +45,7 @@ static void gst_sdp_src_handler_init (gpointer g_iface, gpointer iface_data); #define gst_sdp_src_parent_class parent_class G_DEFINE_TYPE_WITH_CODE (GstSdpSrc, gst_sdp_src, GST_TYPE_BIN, G_IMPLEMENT_INTERFACE (GST_TYPE_URI_HANDLER, gst_sdp_src_handler_init)); +GST_ELEMENT_REGISTER_DEFINE (sdpsrc, "sdpsrc", GST_RANK_NONE, GST_TYPE_SDP_SRC); static void gst_sdp_src_finalize (GObject * object) diff --git a/gst/sdp/gstsdpsrc.h b/gst/sdp/gstsdpsrc.h index 05f2074..955fc5c 100644 --- a/gst/sdp/gstsdpsrc.h +++ b/gst/sdp/gstsdpsrc.h @@ -57,6 +57,7 @@ struct _GstSdpSrcClass }; GType gst_sdp_src_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (sdpsrc); G_END_DECLS #endif /* __GST_SDP_SRC_H__ */ diff --git a/gst/segmentclip/gstaudiosegmentclip.c b/gst/segmentclip/gstaudiosegmentclip.c index 434424a..4c4ca72 100644 --- a/gst/segmentclip/gstaudiosegmentclip.c +++ b/gst/segmentclip/gstaudiosegmentclip.c @@ -45,6 +45,8 @@ GST_DEBUG_CATEGORY_STATIC (gst_audio_segment_clip_debug); G_DEFINE_TYPE (GstAudioSegmentClip, gst_audio_segment_clip, GST_TYPE_SEGMENT_CLIP); +GST_ELEMENT_REGISTER_DEFINE (audiosegmentclip, "audiosegmentclip", + GST_RANK_NONE, GST_TYPE_AUDIO_SEGMENT_CLIP); static void gst_audio_segment_clip_class_init (GstAudioSegmentClipClass * klass) diff --git a/gst/segmentclip/gstaudiosegmentclip.h b/gst/segmentclip/gstaudiosegmentclip.h index 234172e..ccaa9d7 100644 --- a/gst/segmentclip/gstaudiosegmentclip.h +++ b/gst/segmentclip/gstaudiosegmentclip.h @@ -55,6 +55,7 @@ struct _GstAudioSegmentClipClass }; GType gst_audio_segment_clip_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (audiosegmentclip); G_END_DECLS diff --git a/gst/segmentclip/gstvideosegmentclip.c b/gst/segmentclip/gstvideosegmentclip.c index 34ba58b..7057634 100644 --- a/gst/segmentclip/gstvideosegmentclip.c +++ b/gst/segmentclip/gstvideosegmentclip.c @@ -45,6 +45,8 @@ GST_DEBUG_CATEGORY_STATIC (gst_video_segment_clip_debug); G_DEFINE_TYPE (GstVideoSegmentClip, gst_video_segment_clip, GST_TYPE_SEGMENT_CLIP); +GST_ELEMENT_REGISTER_DEFINE (videosegmentclip, "videosegmentclip", + GST_RANK_NONE, GST_TYPE_VIDEO_SEGMENT_CLIP); static void gst_video_segment_clip_class_init (GstVideoSegmentClipClass * klass) diff --git a/gst/segmentclip/gstvideosegmentclip.h b/gst/segmentclip/gstvideosegmentclip.h index f49f2a4..6f321f1 100644 --- a/gst/segmentclip/gstvideosegmentclip.h +++ b/gst/segmentclip/gstvideosegmentclip.h @@ -54,6 +54,7 @@ struct _GstVideoSegmentClipClass }; GType gst_video_segment_clip_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (videosegmentclip); G_END_DECLS diff --git a/gst/segmentclip/plugin.c b/gst/segmentclip/plugin.c index 9f4cbb9..358ec55 100644 --- a/gst/segmentclip/plugin.c +++ b/gst/segmentclip/plugin.c @@ -27,13 +27,12 @@ static gboolean plugin_init (GstPlugin * plugin) { - if (!gst_element_register (plugin, "audiosegmentclip", GST_RANK_NONE, - GST_TYPE_AUDIO_SEGMENT_CLIP) || - !gst_element_register (plugin, "videosegmentclip", GST_RANK_NONE, - GST_TYPE_VIDEO_SEGMENT_CLIP)) - return FALSE; + gboolean ret = FALSE; - return TRUE; + ret |= GST_ELEMENT_REGISTER (audiosegmentclip, plugin); + ret |= GST_ELEMENT_REGISTER (videosegmentclip, plugin); + + return ret; } GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, diff --git a/gst/siren/gstsiren.c b/gst/siren/gstsiren.c index 6fde346..eb8d1d2 100644 --- a/gst/siren/gstsiren.c +++ b/gst/siren/gstsiren.c @@ -24,20 +24,19 @@ #include "config.h" #endif +#include "gstsiren.h" #include "gstsirendec.h" #include "gstsirenenc.h" - static gboolean plugin_init (GstPlugin * plugin) { - if (!gst_siren_dec_plugin_init (plugin)) - return FALSE; + gboolean ret = FALSE; - if (!gst_siren_enc_plugin_init (plugin)) - return FALSE; + ret |= GST_ELEMENT_REGISTER (sirendec, plugin); + ret |= GST_ELEMENT_REGISTER (sirenenc, plugin); - return TRUE; + return ret; } GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, diff --git a/gst/siren/gstsirendec.c b/gst/siren/gstsirendec.c index 045bcd6..3e0baae 100644 --- a/gst/siren/gstsirendec.c +++ b/gst/siren/gstsirendec.c @@ -65,6 +65,8 @@ static GstFlowReturn gst_siren_dec_handle_frame (GstAudioDecoder * dec, G_DEFINE_TYPE (GstSirenDec, gst_siren_dec, GST_TYPE_AUDIO_DECODER); +GST_ELEMENT_REGISTER_DEFINE (sirendec, "sirendec", + GST_RANK_MARGINAL, GST_TYPE_SIREN_DEC); static void gst_siren_dec_class_init (GstSirenDecClass * klass) @@ -248,10 +250,3 @@ decode_error: goto done; } } - -gboolean -gst_siren_dec_plugin_init (GstPlugin * plugin) -{ - return gst_element_register (plugin, "sirendec", - GST_RANK_MARGINAL, GST_TYPE_SIREN_DEC); -} diff --git a/gst/siren/gstsirendec.h b/gst/siren/gstsirendec.h index 27d7c86..3b5ed83 100644 --- a/gst/siren/gstsirendec.h +++ b/gst/siren/gstsirendec.h @@ -60,8 +60,7 @@ struct _GstSirenDecClass }; GType gst_siren_dec_get_type (void); - -gboolean gst_siren_dec_plugin_init (GstPlugin * plugin); +GST_ELEMENT_REGISTER_DECLARE (sirendec); G_END_DECLS diff --git a/gst/siren/gstsirenenc.c b/gst/siren/gstsirenenc.c index b54f29c..2392b93 100644 --- a/gst/siren/gstsirenenc.c +++ b/gst/siren/gstsirenenc.c @@ -62,7 +62,8 @@ static GstFlowReturn gst_siren_enc_handle_frame (GstAudioEncoder * enc, GstBuffer * in_buf); G_DEFINE_TYPE (GstSirenEnc, gst_siren_enc, GST_TYPE_AUDIO_ENCODER); - +GST_ELEMENT_REGISTER_DEFINE (sirenenc, "sirenenc", + GST_RANK_MARGINAL, GST_TYPE_SIREN_ENC); static void gst_siren_enc_class_init (GstSirenEncClass * klass) @@ -228,10 +229,3 @@ encode_error: goto done; } } - -gboolean -gst_siren_enc_plugin_init (GstPlugin * plugin) -{ - return gst_element_register (plugin, "sirenenc", - GST_RANK_MARGINAL, GST_TYPE_SIREN_ENC); -} diff --git a/gst/siren/gstsirenenc.h b/gst/siren/gstsirenenc.h index acfb5e6..3fe1eaa 100644 --- a/gst/siren/gstsirenenc.h +++ b/gst/siren/gstsirenenc.h @@ -60,8 +60,7 @@ struct _GstSirenEncClass }; GType gst_siren_enc_get_type (void); - -gboolean gst_siren_enc_plugin_init (GstPlugin * plugin); +GST_ELEMENT_REGISTER_DECLARE (sirenenc); G_END_DECLS #endif /* __GST_SIREN_ENC_H__ */ diff --git a/gst/smooth/gstsmooth.c b/gst/smooth/gstsmooth.c index 3bc233a..6fab7ac 100644 --- a/gst/smooth/gstsmooth.c +++ b/gst/smooth/gstsmooth.c @@ -64,6 +64,7 @@ static void gst_smooth_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec); G_DEFINE_TYPE (GstSmooth, gst_smooth, GST_TYPE_VIDEO_FILTER); +GST_ELEMENT_REGISTER_DEFINE (smooth, "smooth", GST_RANK_NONE, GST_TYPE_SMOOTH); static void gst_smooth_class_init (GstSmoothClass * klass) @@ -277,8 +278,7 @@ gst_smooth_get_property (GObject * object, guint prop_id, GValue * value, static gboolean plugin_init (GstPlugin * plugin) { - return gst_element_register (plugin, "smooth", - GST_RANK_NONE, GST_TYPE_SMOOTH); + return GST_ELEMENT_REGISTER (smooth, plugin); } GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, diff --git a/gst/smooth/gstsmooth.h b/gst/smooth/gstsmooth.h index 3bec383..13ca1b8 100644 --- a/gst/smooth/gstsmooth.h +++ b/gst/smooth/gstsmooth.h @@ -65,7 +65,7 @@ struct _GstSmoothClass { }; GType gst_smooth_get_type(void); - +GST_ELEMENT_REGISTER_DECLARE (smooth); #ifdef __cplusplus } diff --git a/gst/speed/gstspeed.c b/gst/speed/gstspeed.c index 8d90518..6a536a2 100644 --- a/gst/speed/gstspeed.c +++ b/gst/speed/gstspeed.c @@ -95,6 +95,10 @@ static gboolean speed_src_event (GstPad * pad, GstObject * parent, GstEvent * event); G_DEFINE_TYPE (GstSpeed, gst_speed, GST_TYPE_ELEMENT); +GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (speed, "speed", GST_RANK_NONE, + GST_TYPE_SPEED, GST_DEBUG_CATEGORY_INIT (speed_debug, "speed", 0, + "speed element"); + ); static gboolean speed_setcaps (GstPad * pad, GstCaps * caps) @@ -690,9 +694,7 @@ speed_change_state (GstElement * element, GstStateChange transition) static gboolean plugin_init (GstPlugin * plugin) { - GST_DEBUG_CATEGORY_INIT (speed_debug, "speed", 0, "speed element"); - - return gst_element_register (plugin, "speed", GST_RANK_NONE, GST_TYPE_SPEED); + return GST_ELEMENT_REGISTER (speed, plugin); } GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, diff --git a/gst/speed/gstspeed.h b/gst/speed/gstspeed.h index d3a0658..2485a66 100644 --- a/gst/speed/gstspeed.h +++ b/gst/speed/gstspeed.h @@ -61,6 +61,7 @@ struct _GstSpeedClass { }; GType gst_speed_get_type(void); +GST_ELEMENT_REGISTER_DECLARE (speed); G_END_DECLS diff --git a/gst/subenc/gstsrtenc.c b/gst/subenc/gstsrtenc.c index c16e6ed..e32a70d 100644 --- a/gst/subenc/gstsrtenc.c +++ b/gst/subenc/gstsrtenc.c @@ -57,6 +57,7 @@ static void gst_srt_enc_set_property (GObject * object, guint prop_id, #define parent_class gst_srt_enc_parent_class G_DEFINE_TYPE (GstSrtEnc, gst_srt_enc, GST_TYPE_ELEMENT); +GST_ELEMENT_REGISTER_DEFINE (srtenc, "srtenc", GST_RANK_NONE, GST_TYPE_SRT_ENC); static void gst_srt_enc_append_timestamp_to_string (GstClockTime timestamp, GString * str) diff --git a/gst/subenc/gstsrtenc.h b/gst/subenc/gstsrtenc.h index 4fe83e0..05ff34d 100644 --- a/gst/subenc/gstsrtenc.h +++ b/gst/subenc/gstsrtenc.h @@ -58,6 +58,7 @@ struct _GstSrtEnc }; GType gst_srt_enc_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (srtenc); G_END_DECLS #endif diff --git a/gst/subenc/gstsubenc.c b/gst/subenc/gstsubenc.c index 0637c5b..0e3b682 100644 --- a/gst/subenc/gstsubenc.c +++ b/gst/subenc/gstsubenc.c @@ -27,11 +27,12 @@ static gboolean plugin_init (GstPlugin * plugin) { - gst_element_register (plugin, "srtenc", GST_RANK_NONE, GST_TYPE_SRT_ENC); - gst_element_register (plugin, "webvttenc", GST_RANK_NONE, - GST_TYPE_WEBVTT_ENC); + gboolean ret = FALSE; - return TRUE; + ret |= GST_ELEMENT_REGISTER (srtenc, plugin); + ret |= GST_ELEMENT_REGISTER (webvttenc, plugin); + + return ret; } GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, diff --git a/gst/subenc/gstwebvttenc.c b/gst/subenc/gstwebvttenc.c index c8a54b6..d6cf109 100644 --- a/gst/subenc/gstwebvttenc.c +++ b/gst/subenc/gstwebvttenc.c @@ -58,6 +58,8 @@ static void gst_webvtt_enc_set_property (GObject * object, guint prop_id, #define parent_class gst_webvtt_enc_parent_class G_DEFINE_TYPE (GstWebvttEnc, gst_webvtt_enc, GST_TYPE_ELEMENT); +GST_ELEMENT_REGISTER_DEFINE (webvttenc, "webvttenc", GST_RANK_NONE, + GST_TYPE_WEBVTT_ENC); static void gst_webvtt_enc_append_timestamp_to_string (GstClockTime timestamp, diff --git a/gst/subenc/gstwebvttenc.h b/gst/subenc/gstwebvttenc.h index ef76a49..e4f2cda 100644 --- a/gst/subenc/gstwebvttenc.h +++ b/gst/subenc/gstwebvttenc.h @@ -60,6 +60,7 @@ struct _GstWebvttEnc }; GType gst_webvtt_enc_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (webvttenc); G_END_DECLS #endif diff --git a/gst/switchbin/gstswitchbin.c b/gst/switchbin/gstswitchbin.c index 330d378..c3757d7 100644 --- a/gst/switchbin/gstswitchbin.c +++ b/gst/switchbin/gstswitchbin.c @@ -111,6 +111,8 @@ G_DEFINE_TYPE_WITH_CODE (GstSwitchBin, G_IMPLEMENT_INTERFACE (GST_TYPE_CHILD_PROXY, gst_switch_bin_child_proxy_iface_init) ); +GST_ELEMENT_REGISTER_DEFINE (switchbin, "switchbin", GST_RANK_NONE, + gst_switch_bin_get_type ()); static void gst_switch_bin_unlock_paths_and_notify (GstSwitchBin * switchbin); diff --git a/gst/switchbin/gstswitchbin.h b/gst/switchbin/gstswitchbin.h index 8151067..68b4345 100644 --- a/gst/switchbin/gstswitchbin.h +++ b/gst/switchbin/gstswitchbin.h @@ -81,7 +81,7 @@ struct _GstSwitchBinPath GType gst_switch_bin_get_type(void); GType gst_switch_bin_path_get_type(void); - +GST_ELEMENT_REGISTER_DECLARE (switchbin); G_END_DECLS diff --git a/gst/switchbin/plugin.c b/gst/switchbin/plugin.c index a784b24..37f1340 100644 --- a/gst/switchbin/plugin.c +++ b/gst/switchbin/plugin.c @@ -28,14 +28,9 @@ static gboolean plugin_init (GstPlugin * plugin) { - gboolean ret = TRUE; - ret = ret - && gst_element_register (plugin, "switchbin", GST_RANK_NONE, - gst_switch_bin_get_type ()); - return ret; + return GST_ELEMENT_REGISTER (switchbin, plugin); } - GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, GST_VERSION_MINOR, switchbin, diff --git a/gst/timecode/gstavwait.c b/gst/timecode/gstavwait.c index eff57f1..7f73053 100644 --- a/gst/timecode/gstavwait.c +++ b/gst/timecode/gstavwait.c @@ -84,6 +84,7 @@ GST_STATIC_PAD_TEMPLATE ("vsrc", #define parent_class gst_avwait_parent_class G_DEFINE_TYPE (GstAvWait, gst_avwait, GST_TYPE_ELEMENT); +GST_ELEMENT_REGISTER_DEFINE (avwait, "avwait", GST_RANK_NONE, GST_TYPE_AVWAIT); enum { diff --git a/gst/timecode/gstavwait.h b/gst/timecode/gstavwait.h index 8e0bc94..ce892f1 100644 --- a/gst/timecode/gstavwait.h +++ b/gst/timecode/gstavwait.h @@ -98,6 +98,7 @@ struct _GstAvWaitClass }; GType gst_avwait_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (avwait); G_END_DECLS #endif /* __GST_AVWAIT_H__ */ diff --git a/gst/timecode/gsttimecodestamper.c b/gst/timecode/gsttimecodestamper.c index ebb2300..9a91b39 100644 --- a/gst/timecode/gsttimecodestamper.c +++ b/gst/timecode/gsttimecodestamper.c @@ -161,6 +161,8 @@ static void gst_timecodestamper_update_drop_frame (GstTimeCodeStamper * G_DEFINE_TYPE (GstTimeCodeStamper, gst_timecodestamper, GST_TYPE_BASE_TRANSFORM); +GST_ELEMENT_REGISTER_DEFINE (timecodestamper, "timecodestamper", + GST_RANK_NONE, GST_TYPE_TIME_CODE_STAMPER); GType gst_timecodestamper_source_get_type (void) diff --git a/gst/timecode/gsttimecodestamper.h b/gst/timecode/gsttimecodestamper.h index f4387ec..7a9922b 100644 --- a/gst/timecode/gsttimecodestamper.h +++ b/gst/timecode/gsttimecodestamper.h @@ -161,6 +161,7 @@ struct _GstTimeCodeStamperClass }; GType gst_timecodestamper_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (timecodestamper); GType gst_timecodestamper_source_get_type (void); GType gst_timecodestamper_set_get_type (void); diff --git a/gst/timecode/plugin.c b/gst/timecode/plugin.c index 245f3aa..59dc288 100644 --- a/gst/timecode/plugin.c +++ b/gst/timecode/plugin.c @@ -30,13 +30,10 @@ static gboolean plugin_init (GstPlugin * plugin) { - gboolean ret; + gboolean ret = FALSE; - ret = gst_element_register (plugin, "timecodestamper", GST_RANK_NONE, - GST_TYPE_TIME_CODE_STAMPER); - - ret &= gst_element_register (plugin, "avwait", GST_RANK_NONE, - GST_TYPE_AVWAIT); + ret |= GST_ELEMENT_REGISTER (timecodestamper, plugin); + ret |= GST_ELEMENT_REGISTER (avwait, plugin); return ret; } diff --git a/gst/transcode/gsttranscodebin.c b/gst/transcode/gsttranscodebin.c index e5c041c..0ceb163 100644 --- a/gst/transcode/gsttranscodebin.c +++ b/gst/transcode/gsttranscodebin.c @@ -23,13 +23,13 @@ #endif #include "gsttranscoding.h" +#include "gsttranscodeelements.h" #include #include #include -GST_DEBUG_CATEGORY_STATIC (gst_transcodebin_debug); -#define GST_CAT_DEFAULT gst_transcodebin_debug + /** * GstTranscodeBin!sink_%u: @@ -123,7 +123,10 @@ typedef struct #define DEFAULT_AVOID_REENCODING FALSE -G_DEFINE_TYPE (GstTranscodeBin, gst_transcode_bin, GST_TYPE_BIN) +G_DEFINE_TYPE (GstTranscodeBin, gst_transcode_bin, GST_TYPE_BIN); +GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (transcodebin, "transcodebin", GST_RANK_NONE, + GST_TYPE_TRANSCODE_BIN, transcodebin_element_init (plugin)); + enum { PROP_0, @@ -1011,27 +1014,3 @@ gst_transcode_bin_init (GstTranscodeBin * self) make_decodebin (self); } - -static gboolean -plugin_init (GstPlugin * plugin) -{ - gboolean res = TRUE; - gst_pb_utils_init (); - - GST_DEBUG_CATEGORY_INIT (gst_transcodebin_debug, "transcodebin", 0, - "Transcodebin element"); - - res &= gst_element_register (plugin, "transcodebin", GST_RANK_NONE, - GST_TYPE_TRANSCODE_BIN); - - res &= gst_element_register (plugin, "uritranscodebin", GST_RANK_NONE, - gst_uri_transcode_bin_get_type ()); - - return res; -} - -GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, - GST_VERSION_MINOR, - transcode, - "A plugin containing elements for transcoding", plugin_init, VERSION, - GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN) diff --git a/gst/transcode/gsttranscodeelement.c b/gst/transcode/gsttranscodeelement.c new file mode 100644 index 0000000..7fae04b --- /dev/null +++ b/gst/transcode/gsttranscodeelement.c @@ -0,0 +1,46 @@ + +/* GStreamer + * Copyright (C) 2019 Thibault Saunier + * + * gsttranscodebin.c: + * + * 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 "gsttranscodeelements.h" +#include +#include + +#include + +GST_DEBUG_CATEGORY_STATIC (gst_transcodebin_debug); +#define GST_CAT_DEFAULT gst_transcodebin_debug + +void +transcodebin_element_init (GstPlugin * plugin) +{ + static gsize res = FALSE; + + if (g_once_init_enter (&res)) { + gst_pb_utils_init (); + GST_DEBUG_CATEGORY_INIT (gst_transcodebin_debug, "transcodebin", 0, + "Transcodebin element"); + g_once_init_leave (&res, TRUE); + } +} diff --git a/gst/transcode/gsttranscodeelements.h b/gst/transcode/gsttranscodeelements.h new file mode 100644 index 0000000..25d6df3 --- /dev/null +++ b/gst/transcode/gsttranscodeelements.h @@ -0,0 +1,33 @@ +/* GStreamer + * Copyright (C) 2015 Thibault Saunier + * + * gsttranscodebin.c: + * + * 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_TRANSCODE_ELEMENTS_H__ +#define __GST_TRANSCODE_ELEMENTS_H__ + + +#include + +void transcodebin_element_init (GstPlugin * plugin); + +GST_ELEMENT_REGISTER_DECLARE (transcodebin); +GST_ELEMENT_REGISTER_DECLARE (uritranscodebin); + +#endif /* __GST_TRANSCODE_ELEMENTS_H__ */ diff --git a/gst/transcode/gsttranscodeplugin.c b/gst/transcode/gsttranscodeplugin.c new file mode 100644 index 0000000..78fb88a --- /dev/null +++ b/gst/transcode/gsttranscodeplugin.c @@ -0,0 +1,43 @@ +/* GStreamer + * Copyright (C) 2019 Thibault Saunier + * + * gsttranscodebin.c: + * + * 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 "gsttranscodeelements.h" + + +static gboolean +plugin_init (GstPlugin * plugin) +{ + gboolean res = FALSE; + + res |= GST_ELEMENT_REGISTER (transcodebin, plugin); + res |= GST_ELEMENT_REGISTER (uritranscodebin, plugin); + + return res; +} + +GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, + GST_VERSION_MINOR, + transcode, + "A plugin containing elements for transcoding", plugin_init, VERSION, + GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN) diff --git a/gst/transcode/gsturitranscodebin.c b/gst/transcode/gsturitranscodebin.c index c51ea37..8cf13d3 100644 --- a/gst/transcode/gsturitranscodebin.c +++ b/gst/transcode/gsturitranscodebin.c @@ -23,6 +23,7 @@ #endif #include "gsttranscoding.h" +#include "gsttranscodeelements.h" #if HAVE_GETRUSAGE #include "gst-cpu-throttling-clock.h" #endif @@ -73,7 +74,10 @@ typedef struct #define DEFAULT_AVOID_REENCODING FALSE -G_DEFINE_TYPE (GstUriTranscodeBin, gst_uri_transcode_bin, GST_TYPE_PIPELINE) +G_DEFINE_TYPE (GstUriTranscodeBin, gst_uri_transcode_bin, GST_TYPE_PIPELINE); +GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (uritranscodebin, "uritranscodebin", GST_RANK_NONE, + gst_uri_transcode_bin_get_type (), transcodebin_element_init (plugin)); + enum { PROP_0, diff --git a/gst/transcode/meson.build b/gst/transcode/meson.build index a28af9a..080623e 100644 --- a/gst/transcode/meson.build +++ b/gst/transcode/meson.build @@ -1,4 +1,6 @@ gsttranscoder_plugin = library('gsttranscode', + 'gsttranscodeelement.c', + 'gsttranscodeplugin.c', 'gsttranscodebin.c', 'gst-cpu-throttling-clock.c', 'gsturitranscodebin.c', diff --git a/gst/videofilters/gstscenechange.c b/gst/videofilters/gstscenechange.c index b9be4a7..93e761b 100644 --- a/gst/videofilters/gstscenechange.c +++ b/gst/videofilters/gstscenechange.c @@ -112,6 +112,8 @@ G_DEFINE_TYPE_WITH_CODE (GstSceneChange, gst_scene_change, GST_TYPE_VIDEO_FILTER, GST_DEBUG_CATEGORY_INIT (gst_scene_change_debug_category, "scenechange", 0, "debug category for scenechange element")); +GST_ELEMENT_REGISTER_DEFINE (scenechange, "scenechange", + GST_RANK_NONE, gst_scene_change_get_type ()); static void gst_scene_change_class_init (GstSceneChangeClass * klass) diff --git a/gst/videofilters/gstscenechange.h b/gst/videofilters/gstscenechange.h index 762c5a8..b339824 100644 --- a/gst/videofilters/gstscenechange.h +++ b/gst/videofilters/gstscenechange.h @@ -53,6 +53,7 @@ struct _GstSceneChangeClass }; GType gst_scene_change_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (scenechange); G_END_DECLS diff --git a/gst/videofilters/gstvideodiff.c b/gst/videofilters/gstvideodiff.c index a602759..9251c40 100644 --- a/gst/videofilters/gstvideodiff.c +++ b/gst/videofilters/gstvideodiff.c @@ -57,6 +57,8 @@ static GstFlowReturn gst_video_diff_transform_frame (GstVideoFilter * filter, G_DEFINE_TYPE_WITH_CODE (GstVideoDiff, gst_video_diff, GST_TYPE_VIDEO_FILTER, GST_DEBUG_CATEGORY_INIT (gst_video_diff_debug_category, "videodiff", 0, "debug category for videodiff element")); +GST_ELEMENT_REGISTER_DEFINE (videodiff, "videodiff", + GST_RANK_NONE, GST_TYPE_VIDEO_DIFF); static void gst_video_diff_class_init (GstVideoDiffClass * klass) diff --git a/gst/videofilters/gstvideodiff.h b/gst/videofilters/gstvideodiff.h index 8d76d70..3df98e6 100644 --- a/gst/videofilters/gstvideodiff.h +++ b/gst/videofilters/gstvideodiff.h @@ -52,6 +52,7 @@ struct _GstVideoDiffClass }; GType gst_video_diff_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (videodiff); G_END_DECLS diff --git a/gst/videofilters/gstvideofiltersbad.c b/gst/videofilters/gstvideofiltersbad.c index 1f361e4..84c50c2 100644 --- a/gst/videofilters/gstvideofiltersbad.c +++ b/gst/videofilters/gstvideofiltersbad.c @@ -31,15 +31,13 @@ static gboolean plugin_init (GstPlugin * plugin) { + gboolean ret = FALSE; - gst_element_register (plugin, "scenechange", GST_RANK_NONE, - gst_scene_change_get_type ()); - gst_element_register (plugin, "zebrastripe", GST_RANK_NONE, - gst_zebra_stripe_get_type ()); - return gst_element_register (plugin, "videodiff", GST_RANK_NONE, - GST_TYPE_VIDEO_DIFF); + ret |= GST_ELEMENT_REGISTER (scenechange, plugin); + ret |= GST_ELEMENT_REGISTER (zebrastripe, plugin); + ret |= GST_ELEMENT_REGISTER (videodiff, plugin); - return TRUE; + return ret; } GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, diff --git a/gst/videofilters/gstzebrastripe.c b/gst/videofilters/gstzebrastripe.c index e14ab99..b62b665 100644 --- a/gst/videofilters/gstzebrastripe.c +++ b/gst/videofilters/gstzebrastripe.c @@ -88,6 +88,8 @@ G_DEFINE_TYPE_WITH_CODE (GstZebraStripe, gst_zebra_stripe, GST_TYPE_VIDEO_FILTER, GST_DEBUG_CATEGORY_INIT (gst_zebra_stripe_debug_category, "zebrastripe", 0, "debug category for zebrastripe element")); +GST_ELEMENT_REGISTER_DEFINE (zebrastripe, "zebrastripe", + GST_RANK_NONE, gst_zebra_stripe_get_type ()); static void gst_zebra_stripe_class_init (GstZebraStripeClass * klass) diff --git a/gst/videofilters/gstzebrastripe.h b/gst/videofilters/gstzebrastripe.h index 479ce5c..5f2e7bf 100644 --- a/gst/videofilters/gstzebrastripe.h +++ b/gst/videofilters/gstzebrastripe.h @@ -52,6 +52,7 @@ struct _GstZebraStripeClass }; GType gst_zebra_stripe_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (zebrastripe); G_END_DECLS diff --git a/gst/videoframe_audiolevel/gstvideoframe-audiolevel.c b/gst/videoframe_audiolevel/gstvideoframe-audiolevel.c index bd5b43d..cb1390d 100644 --- a/gst/videoframe_audiolevel/gstvideoframe-audiolevel.c +++ b/gst/videoframe_audiolevel/gstvideoframe-audiolevel.c @@ -86,6 +86,8 @@ GST_STATIC_PAD_TEMPLATE ("vsrc", #define parent_class gst_videoframe_audiolevel_parent_class G_DEFINE_TYPE (GstVideoFrameAudioLevel, gst_videoframe_audiolevel, GST_TYPE_ELEMENT); +GST_ELEMENT_REGISTER_DEFINE (videoframe_audiolevel, "videoframe-audiolevel", + GST_RANK_NONE, GST_TYPE_VIDEOFRAME_AUDIOLEVEL); static GstFlowReturn gst_videoframe_audiolevel_asink_chain (GstPad * pad, GstObject * parent, GstBuffer * inbuf); @@ -777,8 +779,7 @@ out: static gboolean gst_videoframe_audiolevel_plugin_init (GstPlugin * plugin) { - return gst_element_register (plugin, "videoframe-audiolevel", - GST_RANK_NONE, GST_TYPE_VIDEOFRAME_AUDIOLEVEL); + return GST_ELEMENT_REGISTER (videoframe_audiolevel, plugin); } GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, diff --git a/gst/videoframe_audiolevel/gstvideoframe-audiolevel.h b/gst/videoframe_audiolevel/gstvideoframe-audiolevel.h index 83332e5..320132d 100644 --- a/gst/videoframe_audiolevel/gstvideoframe-audiolevel.h +++ b/gst/videoframe_audiolevel/gstvideoframe-audiolevel.h @@ -68,6 +68,7 @@ struct _GstVideoFrameAudioLevelClass }; GType gst_videoframe_audiolevel_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (videoframe_audiolevel); G_END_DECLS #endif /* __GST_VIDEOFRAME_AUDIOLEVEL_H__ */ diff --git a/gst/videoparsers/gstav1parse.c b/gst/videoparsers/gstav1parse.c index 048d656..a2c0edc 100644 --- a/gst/videoparsers/gstav1parse.c +++ b/gst/videoparsers/gstav1parse.c @@ -73,6 +73,7 @@ #include #include #include +#include "gstvideoparserselements.h" #include "gstav1parse.h" #include @@ -137,6 +138,8 @@ static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src", #define parent_class gst_av1_parse_parent_class G_DEFINE_TYPE (GstAV1Parse, gst_av1_parse, GST_TYPE_BASE_PARSE); +GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (av1parse, "av1parse", GST_RANK_SECONDARY, + GST_TYPE_AV1_PARSE, videoparsers_element_init (plugin)); static void remove_fields (GstCaps * caps, gboolean all) diff --git a/gst/videoparsers/gstdiracparse.c b/gst/videoparsers/gstdiracparse.c index 105f4f4..d7a0c92 100644 --- a/gst/videoparsers/gstdiracparse.c +++ b/gst/videoparsers/gstdiracparse.c @@ -38,6 +38,7 @@ #include #include #include +#include "gstvideoparserselements.h" #include "gstdiracparse.h" #include "dirac_parse.h" @@ -96,6 +97,8 @@ GST_STATIC_PAD_TEMPLATE ("src", #define parent_class gst_dirac_parse_parent_class G_DEFINE_TYPE (GstDiracParse, gst_dirac_parse, GST_TYPE_BASE_PARSE); +GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (diracparse, "diracparse", GST_RANK_NONE, + GST_TYPE_DIRAC_PARSE, videoparsers_element_init (plugin)); static void gst_dirac_parse_class_init (GstDiracParseClass * klass) diff --git a/gst/videoparsers/gsth263parse.c b/gst/videoparsers/gsth263parse.c index 0f4d42e..d2c1e49 100644 --- a/gst/videoparsers/gsth263parse.c +++ b/gst/videoparsers/gsth263parse.c @@ -31,6 +31,7 @@ #include #include +#include "gstvideoparserselements.h" #include "gsth263parse.h" #include @@ -53,6 +54,9 @@ GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, #define parent_class gst_h263_parse_parent_class G_DEFINE_TYPE (GstH263Parse, gst_h263_parse, GST_TYPE_BASE_PARSE); +GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (h263parse, "h263parse", + GST_RANK_PRIMARY + 1, GST_TYPE_H263_PARSE, + videoparsers_element_init (plugin)); static gboolean gst_h263_parse_start (GstBaseParse * parse); static gboolean gst_h263_parse_stop (GstBaseParse * parse); diff --git a/gst/videoparsers/gsth264parse.c b/gst/videoparsers/gsth264parse.c index 621b1b0..ef265d3 100644 --- a/gst/videoparsers/gsth264parse.c +++ b/gst/videoparsers/gsth264parse.c @@ -29,6 +29,7 @@ #include #include #include +#include "gstvideoparserselements.h" #include "gsth264parse.h" #include @@ -98,6 +99,9 @@ static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src", #define parent_class gst_h264_parse_parent_class G_DEFINE_TYPE (GstH264Parse, gst_h264_parse, GST_TYPE_BASE_PARSE); +GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (h264parse, "h264parse", + GST_RANK_PRIMARY + 1, GST_TYPE_H264_PARSE, + videoparsers_element_init (plugin)); static void gst_h264_parse_finalize (GObject * object); diff --git a/gst/videoparsers/gsth265parse.c b/gst/videoparsers/gsth265parse.c index 7f45337..977bc9d 100644 --- a/gst/videoparsers/gsth265parse.c +++ b/gst/videoparsers/gsth265parse.c @@ -24,6 +24,7 @@ #include #include +#include "gstvideoparserselements.h" #include "gsth265parse.h" #include @@ -91,6 +92,9 @@ static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src", #define parent_class gst_h265_parse_parent_class G_DEFINE_TYPE (GstH265Parse, gst_h265_parse, GST_TYPE_BASE_PARSE); +GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (h265parse, "h265parse", + GST_RANK_SECONDARY, GST_TYPE_H265_PARSE, + videoparsers_element_init (plugin)); static void gst_h265_parse_finalize (GObject * object); diff --git a/gst/videoparsers/gstjpeg2000parse.c b/gst/videoparsers/gstjpeg2000parse.c index 170b920..3ba0358 100644 --- a/gst/videoparsers/gstjpeg2000parse.c +++ b/gst/videoparsers/gstjpeg2000parse.c @@ -22,6 +22,7 @@ # include "config.h" #endif +#include "gstvideoparserselements.h" #include "gstjpeg2000parse.h" #include @@ -117,6 +118,9 @@ static GstStaticPadTemplate sinktemplate = #define parent_class gst_jpeg2000_parse_parent_class G_DEFINE_TYPE (GstJPEG2000Parse, gst_jpeg2000_parse, GST_TYPE_BASE_PARSE); +GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (jpeg2000parse, "jpeg2000parse", + GST_RANK_PRIMARY, GST_TYPE_JPEG2000_PARSE, + videoparsers_element_init (plugin)); static gboolean gst_jpeg2000_parse_start (GstBaseParse * parse); static gboolean gst_jpeg2000_parse_event (GstBaseParse * parse, diff --git a/gst/videoparsers/gstmpeg4videoparse.c b/gst/videoparsers/gstmpeg4videoparse.c index 53dddd4..4b133ad 100644 --- a/gst/videoparsers/gstmpeg4videoparse.c +++ b/gst/videoparsers/gstmpeg4videoparse.c @@ -33,6 +33,7 @@ #include #include +#include "gstvideoparserselements.h" #include "gstmpeg4videoparse.h" GST_DEBUG_CATEGORY (mpeg4v_parse_debug); @@ -71,6 +72,9 @@ enum #define gst_mpeg4vparse_parent_class parent_class G_DEFINE_TYPE (GstMpeg4VParse, gst_mpeg4vparse, GST_TYPE_BASE_PARSE); +GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (mpeg4videoparse, "mpeg4videoparse", + GST_RANK_PRIMARY + 1, GST_TYPE_MPEG4VIDEO_PARSE, + videoparsers_element_init (plugin)); static gboolean gst_mpeg4vparse_start (GstBaseParse * parse); static gboolean gst_mpeg4vparse_stop (GstBaseParse * parse); diff --git a/gst/videoparsers/gstmpegvideoparse.c b/gst/videoparsers/gstmpegvideoparse.c index 6e27dee..f8ef31a 100644 --- a/gst/videoparsers/gstmpegvideoparse.c +++ b/gst/videoparsers/gstmpegvideoparse.c @@ -31,6 +31,7 @@ #include #include +#include "gstvideoparserselements.h" #include "gstmpegvideoparse.h" GST_DEBUG_CATEGORY (mpegv_parse_debug); @@ -64,6 +65,9 @@ enum #define parent_class gst_mpegv_parse_parent_class G_DEFINE_TYPE (GstMpegvParse, gst_mpegv_parse, GST_TYPE_BASE_PARSE); +GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (mpegvideoparse, "mpegvideoparse", + GST_RANK_PRIMARY + 1, GST_TYPE_MPEGVIDEO_PARSE, + videoparsers_element_init (plugin)); static gboolean gst_mpegv_parse_start (GstBaseParse * parse); static gboolean gst_mpegv_parse_stop (GstBaseParse * parse); diff --git a/gst/videoparsers/gstpngparse.c b/gst/videoparsers/gstpngparse.c index 6df53bd..81621d9 100644 --- a/gst/videoparsers/gstpngparse.c +++ b/gst/videoparsers/gstpngparse.c @@ -22,6 +22,7 @@ # include "config.h" #endif +#include "gstvideoparserselements.h" #include "gstpngparse.h" #include @@ -47,6 +48,8 @@ GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, #define parent_class gst_png_parse_parent_class G_DEFINE_TYPE (GstPngParse, gst_png_parse, GST_TYPE_BASE_PARSE); +GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (pngparse, "pngparse", GST_RANK_PRIMARY, + GST_TYPE_PNG_PARSE, videoparsers_element_init (plugin)); static gboolean gst_png_parse_start (GstBaseParse * parse); static gboolean gst_png_parse_event (GstBaseParse * parse, GstEvent * event); diff --git a/gst/videoparsers/gstvc1parse.c b/gst/videoparsers/gstvc1parse.c index 68033df..74f3b96 100644 --- a/gst/videoparsers/gstvc1parse.c +++ b/gst/videoparsers/gstvc1parse.c @@ -79,6 +79,7 @@ #include "config.h" #endif +#include "gstvideoparserselements.h" #include "gstvc1parse.h" #include @@ -186,6 +187,8 @@ static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src", #define parent_class gst_vc1_parse_parent_class G_DEFINE_TYPE (GstVC1Parse, gst_vc1_parse, GST_TYPE_BASE_PARSE); +GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (vc1parse, "vc1parse", GST_RANK_NONE, + GST_TYPE_VC1_PARSE, videoparsers_element_init (plugin)); static void gst_vc1_parse_finalize (GObject * object); diff --git a/gst/videoparsers/gstvideoparserselement.c b/gst/videoparsers/gstvideoparserselement.c new file mode 100644 index 0000000..d555641 --- /dev/null +++ b/gst/videoparsers/gstvideoparserselement.c @@ -0,0 +1,39 @@ +/* GStreamer video parsers + * Copyright (C) 2011 Mark Nauwelaerts + * Copyright (C) 2009 Tim-Philipp Müller + * + * 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 "gstvideoparserselements.h" + +GST_DEBUG_CATEGORY (videoparseutils_debug); + +void +videoparsers_element_init (GstPlugin * plugin) +{ + static gsize res = FALSE; + + if (g_once_init_enter (&res)) { + GST_DEBUG_CATEGORY_INIT (videoparseutils_debug, "videoparseutils", 0, + "video parse utilities"); + g_once_init_leave (&res, TRUE); + } +} diff --git a/gst/videoparsers/gstvideoparserselements.h b/gst/videoparsers/gstvideoparserselements.h new file mode 100644 index 0000000..a8d40c9 --- /dev/null +++ b/gst/videoparsers/gstvideoparserselements.h @@ -0,0 +1,46 @@ +/* GStreamer + * Copyright (C) 2020 Huawei Technologies Co., Ltd. + * @Author: Stéphane Cerveau + * + * 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_VIDEOPARSERS_ELEMENTS_H__ +#define __GST_VIDEOPARSERS_ELEMENTS_H__ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include + + +void videoparsers_element_init (GstPlugin * plugin); + +GST_ELEMENT_REGISTER_DECLARE (av1parse); +GST_ELEMENT_REGISTER_DECLARE (diracparse); +GST_ELEMENT_REGISTER_DECLARE (h263parse); +GST_ELEMENT_REGISTER_DECLARE (h264parse); +GST_ELEMENT_REGISTER_DECLARE (h265parse); +GST_ELEMENT_REGISTER_DECLARE (jpeg2000parse); +GST_ELEMENT_REGISTER_DECLARE (mpeg4videoparse); +GST_ELEMENT_REGISTER_DECLARE (mpegvideoparse); +GST_ELEMENT_REGISTER_DECLARE (pngparse); +GST_ELEMENT_REGISTER_DECLARE (vc1parse); +GST_ELEMENT_REGISTER_DECLARE (vp9parse); + +#endif /* __GST_VIDEOPARSERS_ELEMENTS_H__ */ diff --git a/gst/videoparsers/gstvp9parse.c b/gst/videoparsers/gstvp9parse.c index ccf3d8f..79ca9ff 100644 --- a/gst/videoparsers/gstvp9parse.c +++ b/gst/videoparsers/gstvp9parse.c @@ -23,6 +23,7 @@ #include #include +#include "gstvideoparserselements.h" #include "gstvp9parse.h" #include @@ -74,6 +75,8 @@ static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src", #define parent_class gst_vp9_parse_parent_class G_DEFINE_TYPE (GstVp9Parse, gst_vp9_parse, GST_TYPE_BASE_PARSE); +GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (vp9parse, "vp9parse", GST_RANK_SECONDARY, + GST_TYPE_VP9_PARSE, videoparsers_element_init (plugin)); static gboolean gst_vp9_parse_start (GstBaseParse * parse); static gboolean gst_vp9_parse_stop (GstBaseParse * parse); diff --git a/gst/videoparsers/meson.build b/gst/videoparsers/meson.build index 61f3757..147a265 100644 --- a/gst/videoparsers/meson.build +++ b/gst/videoparsers/meson.build @@ -1,5 +1,6 @@ vparse_sources = [ 'plugin.c', + 'gstvideoparserselement.c', 'h263parse.c', 'gsth263parse.c', 'gstdiracparse.c', diff --git a/gst/videoparsers/plugin.c b/gst/videoparsers/plugin.c index 9cf2962..069da707 100644 --- a/gst/videoparsers/plugin.c +++ b/gst/videoparsers/plugin.c @@ -22,62 +22,34 @@ #include "config.h" #endif -#include "gsth263parse.h" -#include "gsth264parse.h" -#include "gstdiracparse.h" -#include "gstmpegvideoparse.h" -#include "gstmpeg4videoparse.h" -#include "gstpngparse.h" -#include "gstjpeg2000parse.h" -#include "gstvc1parse.h" -#include "gsth265parse.h" -#include "gstvp9parse.h" -#include "gstav1parse.h" - -GST_DEBUG_CATEGORY (videoparseutils_debug); +#include "gstvideoparserselements.h" static gboolean plugin_init (GstPlugin * plugin) { gboolean ret = FALSE; - GST_DEBUG_CATEGORY_INIT (videoparseutils_debug, "videoparseutils", 0, - "video parse utilities"); - - ret |= gst_element_register (plugin, "h263parse", - GST_RANK_PRIMARY + 1, GST_TYPE_H263_PARSE); - ret |= gst_element_register (plugin, "h264parse", - GST_RANK_PRIMARY + 1, GST_TYPE_H264_PARSE); - ret |= gst_element_register (plugin, "diracparse", - GST_RANK_NONE, GST_TYPE_DIRAC_PARSE); - ret |= gst_element_register (plugin, "mpegvideoparse", - GST_RANK_PRIMARY + 1, GST_TYPE_MPEGVIDEO_PARSE); - ret |= gst_element_register (plugin, "mpeg4videoparse", - GST_RANK_PRIMARY + 1, GST_TYPE_MPEG4VIDEO_PARSE); - ret |= gst_element_register (plugin, "pngparse", - GST_RANK_PRIMARY, GST_TYPE_PNG_PARSE); - ret |= gst_element_register (plugin, "jpeg2000parse", - GST_RANK_PRIMARY, GST_TYPE_JPEG2000_PARSE); - ret |= gst_element_register (plugin, "h265parse", - GST_RANK_SECONDARY, GST_TYPE_H265_PARSE); - ret |= gst_element_register (plugin, "vc1parse", - GST_RANK_NONE, GST_TYPE_VC1_PARSE); - + ret |= GST_ELEMENT_REGISTER (h263parse, plugin); + ret |= GST_ELEMENT_REGISTER (h264parse, plugin); + ret |= GST_ELEMENT_REGISTER (diracparse, plugin); + ret |= GST_ELEMENT_REGISTER (mpegvideoparse, plugin); + ret |= GST_ELEMENT_REGISTER (mpeg4videoparse, plugin); + ret |= GST_ELEMENT_REGISTER (pngparse, plugin); + ret |= GST_ELEMENT_REGISTER (jpeg2000parse, plugin); + ret |= GST_ELEMENT_REGISTER (h265parse, plugin); + ret |= GST_ELEMENT_REGISTER (vc1parse, plugin); /** * element-vp9parse: * * Since: 1.20 */ - ret |= gst_element_register (plugin, "vp9parse", - GST_RANK_SECONDARY, GST_TYPE_VP9_PARSE); - + ret |= GST_ELEMENT_REGISTER (vp9parse, plugin); /** * element-av1parse: * * Since: 1.20 */ - ret |= gst_element_register (plugin, "av1parse", - GST_RANK_SECONDARY, GST_TYPE_AV1_PARSE); + ret |= GST_ELEMENT_REGISTER (av1parse, plugin); return ret; } diff --git a/gst/videosignal/gstsimplevideomark.c b/gst/videosignal/gstsimplevideomark.c index 30d9914..2b7606a 100644 --- a/gst/videosignal/gstsimplevideomark.c +++ b/gst/videosignal/gstsimplevideomark.c @@ -106,6 +106,8 @@ G_DEFINE_TYPE_WITH_CODE (GstSimpleVideoMark, gst_video_mark, GST_TYPE_VIDEO_FILTER, GST_DEBUG_CATEGORY_INIT (gst_video_mark_debug_category, "simplevideomark", 0, "debug category for simplevideomark element")); +GST_ELEMENT_REGISTER_DEFINE (simplevideomark, "simplevideomark", + GST_RANK_NONE, GST_TYPE_SIMPLE_VIDEO_MARK); static void gst_video_mark_class_init (GstSimpleVideoMarkClass * klass) diff --git a/gst/videosignal/gstsimplevideomark.h b/gst/videosignal/gstsimplevideomark.h index 63bc311..e4b8136 100644 --- a/gst/videosignal/gstsimplevideomark.h +++ b/gst/videosignal/gstsimplevideomark.h @@ -56,6 +56,8 @@ struct _GstSimpleVideoMarkClass GType gst_video_mark_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (simplevideomark); + G_END_DECLS #endif diff --git a/gst/videosignal/gstsimplevideomarkdetect.c b/gst/videosignal/gstsimplevideomarkdetect.c index 112d5d8..5f806bc 100644 --- a/gst/videosignal/gstsimplevideomarkdetect.c +++ b/gst/videosignal/gstsimplevideomarkdetect.c @@ -128,6 +128,8 @@ G_DEFINE_TYPE_WITH_CODE (GstSimpleVideoMarkDetect, gst_video_detect, GST_DEBUG_CATEGORY_INIT (gst_video_detect_debug_category, "simplevideomarkdetect", 0, "debug category for simplevideomarkdetect element")); +GST_ELEMENT_REGISTER_DEFINE (simplevideomarkdetect, + "simplevideomarkdetect", GST_RANK_NONE, GST_TYPE_SIMPLE_VIDEO_MARK_DETECT); static void gst_video_detect_class_init (GstSimpleVideoMarkDetectClass * klass) diff --git a/gst/videosignal/gstsimplevideomarkdetect.h b/gst/videosignal/gstsimplevideomarkdetect.h index 5138686..f7628c2 100644 --- a/gst/videosignal/gstsimplevideomarkdetect.h +++ b/gst/videosignal/gstsimplevideomarkdetect.h @@ -58,6 +58,8 @@ struct _GstSimpleVideoMarkDetectClass GType gst_video_detect_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (simplevideomarkdetect); + G_END_DECLS #endif diff --git a/gst/videosignal/gstvideoanalyse.c b/gst/videosignal/gstvideoanalyse.c index ab51f52..99f814a 100644 --- a/gst/videosignal/gstvideoanalyse.c +++ b/gst/videosignal/gstvideoanalyse.c @@ -87,6 +87,8 @@ G_DEFINE_TYPE_WITH_CODE (GstVideoAnalyse, gst_video_analyse, GST_TYPE_VIDEO_FILTER, GST_DEBUG_CATEGORY_INIT (gst_video_analyse_debug_category, "videoanalyse", 0, "debug category for videoanalyse element")); +GST_ELEMENT_REGISTER_DEFINE (videoanalyse, "videoanalyse", + GST_RANK_NONE, GST_TYPE_VIDEO_ANALYSE); static void gst_video_analyse_class_init (GstVideoAnalyseClass * klass) diff --git a/gst/videosignal/gstvideoanalyse.h b/gst/videosignal/gstvideoanalyse.h index ee61672..2490c08 100644 --- a/gst/videosignal/gstvideoanalyse.h +++ b/gst/videosignal/gstvideoanalyse.h @@ -52,6 +52,8 @@ struct _GstVideoAnalyseClass GType gst_video_analyse_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (videoanalyse); + G_END_DECLS #endif diff --git a/gst/videosignal/gstvideosignal.c b/gst/videosignal/gstvideosignal.c index 918dc02..76ef12f 100644 --- a/gst/videosignal/gstvideosignal.c +++ b/gst/videosignal/gstvideosignal.c @@ -28,22 +28,16 @@ static gboolean plugin_init (GstPlugin * plugin) { - gboolean res; - - res = gst_element_register (plugin, "videoanalyse", GST_RANK_NONE, - GST_TYPE_VIDEO_ANALYSE); + gboolean ret = FALSE; + ret |= GST_ELEMENT_REGISTER (videoanalyse, plugin); /* FIXME under no circumstances is anyone allowed to revive the * element formerly known as simplevideomarkdetect without changing the name * first. XOXO --ds */ + ret |= GST_ELEMENT_REGISTER (simplevideomarkdetect, plugin); + ret |= GST_ELEMENT_REGISTER (simplevideomark, plugin); - res &= gst_element_register (plugin, "simplevideomarkdetect", GST_RANK_NONE, - GST_TYPE_SIMPLE_VIDEO_MARK_DETECT); - - res &= gst_element_register (plugin, "simplevideomark", GST_RANK_NONE, - GST_TYPE_SIMPLE_VIDEO_MARK); - - return res; + return ret; } GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, diff --git a/gst/vmnc/vmncdec.c b/gst/vmnc/vmncdec.c index cc51c20..93c34e7 100644 --- a/gst/vmnc/vmncdec.c +++ b/gst/vmnc/vmncdec.c @@ -79,6 +79,8 @@ GST_STATIC_PAD_TEMPLATE ("sink", ); G_DEFINE_TYPE (GstVMncDec, gst_vmnc_dec, GST_TYPE_VIDEO_DECODER); +GST_ELEMENT_REGISTER_DEFINE (vmncdec, "vmncdec", GST_RANK_PRIMARY, + GST_TYPE_VMNC_DEC); static void gst_vmnc_dec_class_init (GstVMncDecClass * klass) @@ -957,10 +959,7 @@ gst_vmnc_dec_parse (GstVideoDecoder * decoder, GstVideoCodecFrame * frame, static gboolean plugin_init (GstPlugin * plugin) { - if (!gst_element_register (plugin, "vmncdec", GST_RANK_PRIMARY, - GST_TYPE_VMNC_DEC)) - return FALSE; - return TRUE; + return GST_ELEMENT_REGISTER (vmncdec, plugin); } GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, diff --git a/gst/vmnc/vmncdec.h b/gst/vmnc/vmncdec.h index d28ef7d..7bdd3cb 100644 --- a/gst/vmnc/vmncdec.h +++ b/gst/vmnc/vmncdec.h @@ -104,7 +104,7 @@ typedef struct } GstVMncDecClass; GType gst_vmnc_dec_get_type (void); - +GST_ELEMENT_REGISTER_DECLARE (vmncdec); G_END_DECLS diff --git a/gst/y4m/gsty4mdec.c b/gst/y4m/gsty4mdec.c index da8ae38..bae28f4 100644 --- a/gst/y4m/gsty4mdec.c +++ b/gst/y4m/gsty4mdec.c @@ -92,7 +92,9 @@ GST_STATIC_PAD_TEMPLATE ("src", /* class initialization */ #define gst_y4m_dec_parent_class parent_class G_DEFINE_TYPE (GstY4mDec, gst_y4m_dec, GST_TYPE_ELEMENT); - +GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (y4mdec, "y4mdec", GST_RANK_SECONDARY, + gst_y4m_dec_get_type (), GST_DEBUG_CATEGORY_INIT (y4mdec_debug, "y4mdec", 0, + "y4mdec element")); static void gst_y4m_dec_class_init (GstY4mDecClass * klass) { @@ -894,16 +896,9 @@ gst_y4m_dec_src_query (GstPad * pad, GstObject * parent, GstQuery * query) static gboolean plugin_init (GstPlugin * plugin) { - - gst_element_register (plugin, "y4mdec", GST_RANK_SECONDARY, - gst_y4m_dec_get_type ()); - - GST_DEBUG_CATEGORY_INIT (y4mdec_debug, "y4mdec", 0, "y4mdec element"); - - return TRUE; + return GST_ELEMENT_REGISTER (y4mdec, plugin); } - GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, GST_VERSION_MINOR, y4mdec, diff --git a/gst/y4m/gsty4mdec.h b/gst/y4m/gsty4mdec.h index c2eb9b0..9e56e2f 100644 --- a/gst/y4m/gsty4mdec.h +++ b/gst/y4m/gsty4mdec.h @@ -62,6 +62,7 @@ struct _GstY4mDecClass }; GType gst_y4m_dec_get_type (void); +GST_ELEMENT_REGISTER_DECLARE (y4mdec); G_END_DECLS -- 2.7.4