mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-20 23:36:38 +00:00
wavpack: 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:
parent
aaa5a140d7
commit
98fa1618f8
6 changed files with 107 additions and 41 deletions
|
@ -1,7 +1,7 @@
|
|||
/* GStreamer wavpack plugin
|
||||
* (c) 2004 Arwed v. Merkatz <v.merkatz@gmx.net>
|
||||
*
|
||||
* gstwavpack.c: plugin loader
|
||||
* gstwavpackplugin.c: plugin loader
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
|
@ -23,28 +23,17 @@
|
|||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <gst/gst-i18n-plugin.h>
|
||||
|
||||
#include "gstwavpackdec.h"
|
||||
#include "gstwavpackenc.h"
|
||||
|
||||
/* debug category for common code */
|
||||
GST_DEBUG_CATEGORY (wavpack_debug);
|
||||
#include "gstwavpackelements.h"
|
||||
|
||||
static gboolean
|
||||
plugin_init (GstPlugin * plugin)
|
||||
{
|
||||
GST_DEBUG_CATEGORY_INIT (wavpack_debug, "wavpack", 0, "Wavpack elements");
|
||||
gboolean ret = FALSE;
|
||||
|
||||
#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 (wavpackdec, plugin);
|
||||
ret |= GST_ELEMENT_REGISTER (wavpackenc, plugin);
|
||||
|
||||
return (gst_wavpack_dec_plugin_init (plugin)
|
||||
&& gst_wavpack_enc_plugin_init (plugin));
|
||||
return ret;
|
||||
}
|
||||
|
||||
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
||||
|
|
|
@ -49,6 +49,7 @@
|
|||
#include <string.h>
|
||||
|
||||
#include <wavpack/wavpack.h>
|
||||
#include "gstwavpackelements.h"
|
||||
#include "gstwavpackdec.h"
|
||||
#include "gstwavpackcommon.h"
|
||||
#include "gstwavpackstreamreader.h"
|
||||
|
@ -101,6 +102,12 @@ static void gst_wavpack_dec_post_tags (GstWavpackDec * dec);
|
|||
|
||||
#define gst_wavpack_dec_parent_class parent_class
|
||||
G_DEFINE_TYPE (GstWavpackDec, gst_wavpack_dec, GST_TYPE_AUDIO_DECODER);
|
||||
#define _do_init \
|
||||
GST_DEBUG_CATEGORY_INIT (gst_wavpack_dec_debug, "wavpackdec", 0, \
|
||||
"Wavpack decoder"); \
|
||||
wavpack_element_init (plugin);
|
||||
GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (wavpackdec, "wavpackdec",
|
||||
GST_RANK_PRIMARY, GST_TYPE_WAVPACK_DEC, _do_init);
|
||||
|
||||
static void
|
||||
gst_wavpack_dec_class_init (GstWavpackDecClass * klass)
|
||||
|
@ -473,14 +480,3 @@ decode_error:
|
|||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
gboolean
|
||||
gst_wavpack_dec_plugin_init (GstPlugin * plugin)
|
||||
{
|
||||
if (!gst_element_register (plugin, "wavpackdec",
|
||||
GST_RANK_PRIMARY, GST_TYPE_WAVPACK_DEC))
|
||||
return FALSE;
|
||||
GST_DEBUG_CATEGORY_INIT (gst_wavpack_dec_debug, "wavpackdec", 0,
|
||||
"Wavpack decoder");
|
||||
return TRUE;
|
||||
}
|
||||
|
|
48
ext/wavpack/gstwavpackelement.c
Normal file
48
ext/wavpack/gstwavpackelement.c
Normal file
|
@ -0,0 +1,48 @@
|
|||
/* GStreamer wavpack plugin
|
||||
* (c) 2004 Arwed v. Merkatz <v.merkatz@gmx.net>
|
||||
*
|
||||
* gstwavpack.c: plugin loader
|
||||
*
|
||||
* 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 <gst/gst-i18n-plugin.h>
|
||||
|
||||
#include "gstwavpackelements.h"
|
||||
|
||||
/* debug category for common code */
|
||||
GST_DEBUG_CATEGORY (wavpack_debug);
|
||||
|
||||
void
|
||||
wavpack_element_init (GstPlugin * plugin)
|
||||
{
|
||||
static gsize res = FALSE;
|
||||
if (g_once_init_enter (&res)) {
|
||||
GST_DEBUG_CATEGORY_INIT (wavpack_debug, "wavpack", 0, "Wavpack elements");
|
||||
|
||||
#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
|
||||
g_once_init_leave (&res, TRUE);
|
||||
}
|
||||
}
|
38
ext/wavpack/gstwavpackelements.h
Normal file
38
ext/wavpack/gstwavpackelements.h
Normal file
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* 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_WAVPACK_ELEMENTS_H__
|
||||
#define __GST_WAVPACK_ELEMENTS_H__
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <gst/gst.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
void wavpack_element_init (GstPlugin * plugin);
|
||||
|
||||
GST_ELEMENT_REGISTER_DECLARE (wavpackdec);
|
||||
GST_ELEMENT_REGISTER_DECLARE (wavpackenc);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GST_WAVPACK_ELEMENTS_H__ */
|
|
@ -54,6 +54,7 @@
|
|||
#include <wavpack/wavpack.h>
|
||||
#include "gstwavpackenc.h"
|
||||
#include "gstwavpackcommon.h"
|
||||
#include "gstwavpackelements.h"
|
||||
|
||||
static gboolean gst_wavpack_enc_start (GstAudioEncoder * enc);
|
||||
static gboolean gst_wavpack_enc_stop (GstAudioEncoder * enc);
|
||||
|
@ -200,6 +201,12 @@ gst_wavpack_enc_joint_stereo_mode_get_type (void)
|
|||
|
||||
#define gst_wavpack_enc_parent_class parent_class
|
||||
G_DEFINE_TYPE (GstWavpackEnc, gst_wavpack_enc, GST_TYPE_AUDIO_ENCODER);
|
||||
#define _do_init \
|
||||
GST_DEBUG_CATEGORY_INIT (gst_wavpack_enc_debug, "wavpackenc", 0, \
|
||||
"Wavpack encoder"); \
|
||||
wavpack_element_init (plugin);
|
||||
GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (wavpackenc, "wavpackenc", GST_RANK_NONE,
|
||||
GST_TYPE_WAVPACK_ENC, _do_init);
|
||||
|
||||
static void
|
||||
gst_wavpack_enc_class_init (GstWavpackEncClass * klass)
|
||||
|
@ -994,16 +1001,3 @@ gst_wavpack_enc_get_property (GObject * object, guint prop_id, GValue * value,
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
gboolean
|
||||
gst_wavpack_enc_plugin_init (GstPlugin * plugin)
|
||||
{
|
||||
if (!gst_element_register (plugin, "wavpackenc",
|
||||
GST_RANK_NONE, GST_TYPE_WAVPACK_ENC))
|
||||
return FALSE;
|
||||
|
||||
GST_DEBUG_CATEGORY_INIT (gst_wavpack_enc_debug, "wavpackenc", 0,
|
||||
"Wavpack encoder");
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
wavpack_sources = [
|
||||
'gstwavpackelement.c',
|
||||
'gstwavpack.c',
|
||||
'gstwavpackcommon.c',
|
||||
'gstwavpackdec.c',
|
||||
|
|
Loading…
Reference in a new issue