From: Stéphane Cerveau Date: Mon, 15 Feb 2021 12:00:38 +0000 (+0100) Subject: audioparsers: allow per feature registration X-Git-Tag: 1.19.3~509^2~222 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=771d954c0414d6831af654fac6623d86ba48d630;p=platform%2Fupstream%2Fgstreamer.git audioparsers: 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: --- diff --git a/gst/audioparsers/gstaacparse.c b/gst/audioparsers/gstaacparse.c index 2b54a53..b282873 100644 --- a/gst/audioparsers/gstaacparse.c +++ b/gst/audioparsers/gstaacparse.c @@ -46,6 +46,7 @@ #include #include +#include "gstaudioparserselements.h" #include "gstaacparse.h" @@ -108,6 +109,8 @@ static gboolean gst_aac_parse_read_audio_specific_config (GstAacParse * #define gst_aac_parse_parent_class parent_class G_DEFINE_TYPE (GstAacParse, gst_aac_parse, GST_TYPE_BASE_PARSE); +GST_ELEMENT_REGISTER_DEFINE (aacparse, "aacparse", + GST_RANK_PRIMARY + 1, GST_TYPE_AAC_PARSE); /** * gst_aac_parse_class_init: diff --git a/gst/audioparsers/gstac3parse.c b/gst/audioparsers/gstac3parse.c index d797aa0..64b3ca3 100644 --- a/gst/audioparsers/gstac3parse.c +++ b/gst/audioparsers/gstac3parse.c @@ -45,6 +45,7 @@ #include +#include "gstaudioparserselements.h" #include "gstac3parse.h" #include #include @@ -173,6 +174,8 @@ static gboolean gst_ac3_parse_set_sink_caps (GstBaseParse * parse, #define gst_ac3_parse_parent_class parent_class G_DEFINE_TYPE (GstAc3Parse, gst_ac3_parse, GST_TYPE_BASE_PARSE); +GST_ELEMENT_REGISTER_DEFINE (ac3parse, "ac3parse", + GST_RANK_PRIMARY + 1, GST_TYPE_AC3_PARSE); static void gst_ac3_parse_class_init (GstAc3ParseClass * klass) diff --git a/gst/audioparsers/gstamrparse.c b/gst/audioparsers/gstamrparse.c index 190f707..0ef612e 100644 --- a/gst/audioparsers/gstamrparse.c +++ b/gst/audioparsers/gstamrparse.c @@ -42,6 +42,7 @@ #include +#include "gstaudioparserselements.h" #include "gstamrparse.h" #include @@ -85,6 +86,8 @@ static GstFlowReturn gst_amr_parse_pre_push_frame (GstBaseParse * parse, GstBaseParseFrame * frame); G_DEFINE_TYPE (GstAmrParse, gst_amr_parse, GST_TYPE_BASE_PARSE); +GST_ELEMENT_REGISTER_DEFINE (amrparse, "amrparse", + GST_RANK_PRIMARY + 1, GST_TYPE_AMR_PARSE); /** * gst_amr_parse_class_init: diff --git a/gst/audioparsers/gstaudioparserselements.h b/gst/audioparsers/gstaudioparserselements.h new file mode 100644 index 0000000..2cf1369 --- /dev/null +++ b/gst/audioparsers/gstaudioparserselements.h @@ -0,0 +1,39 @@ +/* GStreamer audio parsers + * Copyright (C) 2009 Tim-Philipp Müller + * Copyright (C) 2020 Huawei Technologies Co., Ltd. + * @Author: 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_AUDIOPARSERS_ELEMENTS_H__ +#define __GST_AUDIOPARSERS_ELEMENTS_H__ + +#include + +G_BEGIN_DECLS + +GST_ELEMENT_REGISTER_DECLARE (aacparse); +GST_ELEMENT_REGISTER_DECLARE (amrparse); +GST_ELEMENT_REGISTER_DECLARE (ac3parse); +GST_ELEMENT_REGISTER_DECLARE (dcaparse); +GST_ELEMENT_REGISTER_DECLARE (flacparse); +GST_ELEMENT_REGISTER_DECLARE (mpegaudioparse); +GST_ELEMENT_REGISTER_DECLARE (sbcparse); +GST_ELEMENT_REGISTER_DECLARE (wavpackparse); + +G_END_DECLS + +#endif /* __GST_AUDIOPARSERS_ELEMENTS_H__ */ diff --git a/gst/audioparsers/gstdcaparse.c b/gst/audioparsers/gstdcaparse.c index fd7c1f0..e9c8702 100644 --- a/gst/audioparsers/gstdcaparse.c +++ b/gst/audioparsers/gstdcaparse.c @@ -47,6 +47,7 @@ #include +#include "gstaudioparserselements.h" #include "gstdcaparse.h" #include #include @@ -85,6 +86,8 @@ static gboolean gst_dca_parse_set_sink_caps (GstBaseParse * parse, #define gst_dca_parse_parent_class parent_class G_DEFINE_TYPE (GstDcaParse, gst_dca_parse, GST_TYPE_BASE_PARSE); +GST_ELEMENT_REGISTER_DEFINE (dcaparse, "dcaparse", + GST_RANK_PRIMARY + 1, GST_TYPE_DCA_PARSE); static void gst_dca_parse_class_init (GstDcaParseClass * klass) diff --git a/gst/audioparsers/gstflacparse.c b/gst/audioparsers/gstflacparse.c index 5004d45..8fca410 100644 --- a/gst/audioparsers/gstflacparse.c +++ b/gst/audioparsers/gstflacparse.c @@ -52,6 +52,7 @@ #include "config.h" #endif +#include "gstaudioparserselements.h" #include "gstflacparse.h" #include @@ -216,6 +217,8 @@ static gboolean gst_flac_parse_set_sink_caps (GstBaseParse * parse, #define gst_flac_parse_parent_class parent_class G_DEFINE_TYPE (GstFlacParse, gst_flac_parse, GST_TYPE_BASE_PARSE); +GST_ELEMENT_REGISTER_DEFINE (flacparse, "flacparse", + GST_RANK_PRIMARY + 1, GST_TYPE_FLAC_PARSE); static void gst_flac_parse_class_init (GstFlacParseClass * klass) diff --git a/gst/audioparsers/gstmpegaudioparse.c b/gst/audioparsers/gstmpegaudioparse.c index f4cb1cc..f5e0fc2 100644 --- a/gst/audioparsers/gstmpegaudioparse.c +++ b/gst/audioparsers/gstmpegaudioparse.c @@ -48,6 +48,7 @@ #include +#include "gstaudioparserselements.h" #include "gstmpegaudioparse.h" #include #include @@ -108,6 +109,8 @@ static void gst_mpeg_audio_parse_handle_first_frame (GstMpegAudioParse * #define gst_mpeg_audio_parse_parent_class parent_class G_DEFINE_TYPE (GstMpegAudioParse, gst_mpeg_audio_parse, GST_TYPE_BASE_PARSE); +GST_ELEMENT_REGISTER_DEFINE (mpegaudioparse, "mpegaudioparse", + GST_RANK_PRIMARY + 2, GST_TYPE_MPEG_AUDIO_PARSE); #define GST_TYPE_MPEG_AUDIO_CHANNEL_MODE \ (gst_mpeg_audio_channel_mode_get_type()) diff --git a/gst/audioparsers/gstsbcparse.c b/gst/audioparsers/gstsbcparse.c index 494f9cb..3fa8bb4 100644 --- a/gst/audioparsers/gstsbcparse.c +++ b/gst/audioparsers/gstsbcparse.c @@ -36,6 +36,7 @@ #include "config.h" #endif +#include "gstaudioparserselements.h" #include "gstsbcparse.h" #include @@ -81,6 +82,8 @@ static gsize gst_sbc_parse_header (const guint8 * data, guint * rate, #define parent_class gst_sbc_parse_parent_class G_DEFINE_TYPE (GstSbcParse, gst_sbc_parse, GST_TYPE_BASE_PARSE); +GST_ELEMENT_REGISTER_DEFINE (sbcparse, "sbcparse", + GST_RANK_PRIMARY + 1, GST_TYPE_SBC_PARSE); static void gst_sbc_parse_class_init (GstSbcParseClass * klass) diff --git a/gst/audioparsers/gstwavpackparse.c b/gst/audioparsers/gstwavpackparse.c index 3e37f8a..16b9b4e 100644 --- a/gst/audioparsers/gstwavpackparse.c +++ b/gst/audioparsers/gstwavpackparse.c @@ -39,6 +39,7 @@ #include +#include "gstaudioparserselements.h" #include "gstwavpackparse.h" #include @@ -76,6 +77,8 @@ static GstFlowReturn gst_wavpack_parse_pre_push_frame (GstBaseParse * parse, #define gst_wavpack_parse_parent_class parent_class G_DEFINE_TYPE (GstWavpackParse, gst_wavpack_parse, GST_TYPE_BASE_PARSE); +GST_ELEMENT_REGISTER_DEFINE (wavpackparse, "wavpackparse", + GST_RANK_PRIMARY + 1, GST_TYPE_WAVPACK_PARSE); static void gst_wavpack_parse_class_init (GstWavpackParseClass * klass) diff --git a/gst/audioparsers/plugin.c b/gst/audioparsers/plugin.c index 8cbfe60..0126af6 100644 --- a/gst/audioparsers/plugin.c +++ b/gst/audioparsers/plugin.c @@ -21,36 +21,21 @@ #include "config.h" #endif -#include "gstaacparse.h" -#include "gstamrparse.h" -#include "gstac3parse.h" -#include "gstdcaparse.h" -#include "gstflacparse.h" -#include "gstmpegaudioparse.h" -#include "gstsbcparse.h" -#include "gstwavpackparse.h" +#include "gstaudioparserselements.h" static gboolean plugin_init (GstPlugin * plugin) { - gboolean ret; + gboolean ret = FALSE; - ret = gst_element_register (plugin, "aacparse", - GST_RANK_PRIMARY + 1, GST_TYPE_AAC_PARSE); - ret &= gst_element_register (plugin, "amrparse", - GST_RANK_PRIMARY + 1, GST_TYPE_AMR_PARSE); - ret &= gst_element_register (plugin, "ac3parse", - GST_RANK_PRIMARY + 1, GST_TYPE_AC3_PARSE); - ret &= gst_element_register (plugin, "dcaparse", - GST_RANK_PRIMARY + 1, GST_TYPE_DCA_PARSE); - ret &= gst_element_register (plugin, "flacparse", - GST_RANK_PRIMARY + 1, GST_TYPE_FLAC_PARSE); - ret &= gst_element_register (plugin, "mpegaudioparse", - GST_RANK_PRIMARY + 2, GST_TYPE_MPEG_AUDIO_PARSE); - ret &= gst_element_register (plugin, "sbcparse", - GST_RANK_PRIMARY + 1, GST_TYPE_SBC_PARSE); - ret &= gst_element_register (plugin, "wavpackparse", - GST_RANK_PRIMARY + 1, GST_TYPE_WAVPACK_PARSE); + ret |= GST_ELEMENT_REGISTER (aacparse, plugin); + ret |= GST_ELEMENT_REGISTER (amrparse, plugin); + ret |= GST_ELEMENT_REGISTER (ac3parse, plugin); + ret |= GST_ELEMENT_REGISTER (dcaparse, plugin); + ret |= GST_ELEMENT_REGISTER (flacparse, plugin); + ret |= GST_ELEMENT_REGISTER (mpegaudioparse, plugin); + ret |= GST_ELEMENT_REGISTER (sbcparse, plugin); + ret |= GST_ELEMENT_REGISTER (wavpackparse, plugin); return ret; }