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: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/876>
This commit is contained in:
Stéphane Cerveau 2021-02-15 13:00:38 +01:00
parent 06ea16232b
commit 771d954c04
10 changed files with 73 additions and 25 deletions

View file

@ -46,6 +46,7 @@
#include <gst/base/gstbitreader.h>
#include <gst/pbutils/pbutils.h>
#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:

View file

@ -45,6 +45,7 @@
#include <string.h>
#include "gstaudioparserselements.h"
#include "gstac3parse.h"
#include <gst/base/base.h>
#include <gst/pbutils/pbutils.h>
@ -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)

View file

@ -42,6 +42,7 @@
#include <string.h>
#include "gstaudioparserselements.h"
#include "gstamrparse.h"
#include <gst/pbutils/pbutils.h>
@ -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:

View file

@ -0,0 +1,39 @@
/* GStreamer audio parsers
* Copyright (C) 2009 Tim-Philipp Müller <tim centricular net>
* Copyright (C) 2020 Huawei Technologies Co., Ltd.
* @Author: Julian Bouzas <julian.bouzas@collabora.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __GST_AUDIOPARSERS_ELEMENTS_H__
#define __GST_AUDIOPARSERS_ELEMENTS_H__
#include <gst/gst.h>
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__ */

View file

@ -47,6 +47,7 @@
#include <string.h>
#include "gstaudioparserselements.h"
#include "gstdcaparse.h"
#include <gst/base/base.h>
#include <gst/pbutils/pbutils.h>
@ -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)

View file

@ -52,6 +52,7 @@
#include "config.h"
#endif
#include "gstaudioparserselements.h"
#include "gstflacparse.h"
#include <string.h>
@ -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)

View file

@ -48,6 +48,7 @@
#include <string.h>
#include "gstaudioparserselements.h"
#include "gstmpegaudioparse.h"
#include <gst/base/gstbytereader.h>
#include <gst/pbutils/pbutils.h>
@ -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())

View file

@ -36,6 +36,7 @@
#include "config.h"
#endif
#include "gstaudioparserselements.h"
#include "gstsbcparse.h"
#include <string.h>
@ -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)

View file

@ -39,6 +39,7 @@
#include <string.h>
#include "gstaudioparserselements.h"
#include "gstwavpackparse.h"
#include <gst/base/base.h>
@ -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)

View file

@ -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;
}