mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-18 22:36:33 +00:00
flac: 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
0b257dd1d5
commit
762e3c31b5
7 changed files with 98 additions and 24 deletions
|
@ -21,36 +21,18 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "gstflacenc.h"
|
#include "gstflacelements.h"
|
||||||
#include "gstflacdec.h"
|
|
||||||
#include "gstflactag.h"
|
|
||||||
|
|
||||||
#include <gst/tag/tag.h>
|
|
||||||
#include <gst/gst-i18n-plugin.h>
|
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
plugin_init (GstPlugin * plugin)
|
plugin_init (GstPlugin * plugin)
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_NLS
|
gboolean ret = FALSE;
|
||||||
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
|
|
||||||
|
|
||||||
if (!gst_element_register (plugin, "flacenc", GST_RANK_PRIMARY,
|
ret |= GST_ELEMENT_REGISTER (flacdec, plugin);
|
||||||
GST_TYPE_FLAC_ENC))
|
ret |= GST_ELEMENT_REGISTER (flacenc, plugin);
|
||||||
return FALSE;
|
ret |= GST_ELEMENT_REGISTER (flactag, plugin);
|
||||||
if (!gst_element_register (plugin, "flacdec", GST_RANK_PRIMARY,
|
|
||||||
GST_TYPE_FLAC_DEC))
|
|
||||||
return FALSE;
|
|
||||||
if (!gst_element_register (plugin, "flactag", GST_RANK_PRIMARY,
|
|
||||||
gst_flac_tag_get_type ()))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
gst_tag_register_musicbrainz_tags ();
|
return ret;
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
||||||
|
|
|
@ -47,6 +47,8 @@
|
||||||
#include <gst/gst-i18n-plugin.h>
|
#include <gst/gst-i18n-plugin.h>
|
||||||
#include <gst/tag/tag.h>
|
#include <gst/tag/tag.h>
|
||||||
|
|
||||||
|
#include "gstflacelements.h"
|
||||||
|
|
||||||
/* Taken from http://flac.sourceforge.net/format.html#frame_header */
|
/* Taken from http://flac.sourceforge.net/format.html#frame_header */
|
||||||
static const GstAudioChannelPosition channel_positions[8][8] = {
|
static const GstAudioChannelPosition channel_positions[8][8] = {
|
||||||
{GST_AUDIO_CHANNEL_POSITION_MONO},
|
{GST_AUDIO_CHANNEL_POSITION_MONO},
|
||||||
|
@ -114,6 +116,9 @@ static GstFlowReturn gst_flac_dec_handle_frame (GstAudioDecoder * audio_dec,
|
||||||
GstBuffer * buf);
|
GstBuffer * buf);
|
||||||
|
|
||||||
G_DEFINE_TYPE (GstFlacDec, gst_flac_dec, GST_TYPE_AUDIO_DECODER);
|
G_DEFINE_TYPE (GstFlacDec, gst_flac_dec, GST_TYPE_AUDIO_DECODER);
|
||||||
|
GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (flacdec, "flacdec", GST_RANK_PRIMARY,
|
||||||
|
GST_TYPE_FLAC_DEC, flac_element_init (plugin));
|
||||||
|
|
||||||
|
|
||||||
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
|
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
|
||||||
#define FORMATS "{ S8, S16LE, S24_32LE, S32LE } "
|
#define FORMATS "{ S8, S16LE, S24_32LE, S32LE } "
|
||||||
|
|
43
ext/flac/gstflacelement.c
Normal file
43
ext/flac/gstflacelement.c
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
/* GStreamer
|
||||||
|
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
|
||||||
|
*
|
||||||
|
* 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 "gstflacelements.h"
|
||||||
|
|
||||||
|
#include <gst/tag/tag.h>
|
||||||
|
#include <gst/gst-i18n-plugin.h>
|
||||||
|
|
||||||
|
void
|
||||||
|
flac_element_init (GstPlugin * plugin)
|
||||||
|
{
|
||||||
|
static gsize res = FALSE;
|
||||||
|
if (g_once_init_enter (&res)) {
|
||||||
|
#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);
|
||||||
|
}
|
||||||
|
}
|
36
ext/flac/gstflacelements.h
Normal file
36
ext/flac/gstflacelements.h
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
/*
|
||||||
|
* 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_FLAC_ELEMENTS_H__
|
||||||
|
#define __GST_FLAC_ELEMENTS_H__
|
||||||
|
|
||||||
|
#include <gst/gst.h>
|
||||||
|
|
||||||
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
|
||||||
|
void flac_element_init (GstPlugin * plugin);
|
||||||
|
|
||||||
|
GST_ELEMENT_REGISTER_DECLARE (flacenc);
|
||||||
|
GST_ELEMENT_REGISTER_DECLARE (flacdec);
|
||||||
|
GST_ELEMENT_REGISTER_DECLARE (flactag);
|
||||||
|
|
||||||
|
G_END_DECLS
|
||||||
|
|
||||||
|
#endif /* __GST_FLAC_ELEMENTS_H__ */
|
|
@ -55,6 +55,8 @@
|
||||||
#include <gst/tag/tag.h>
|
#include <gst/tag/tag.h>
|
||||||
#include <gst/gsttagsetter.h>
|
#include <gst/gsttagsetter.h>
|
||||||
|
|
||||||
|
#include "gstflacelements.h"
|
||||||
|
|
||||||
/* Taken from http://flac.sourceforge.net/format.html#frame_header */
|
/* Taken from http://flac.sourceforge.net/format.html#frame_header */
|
||||||
static const GstAudioChannelPosition channel_positions[8][8] = {
|
static const GstAudioChannelPosition channel_positions[8][8] = {
|
||||||
{GST_AUDIO_CHANNEL_POSITION_MONO},
|
{GST_AUDIO_CHANNEL_POSITION_MONO},
|
||||||
|
@ -131,6 +133,8 @@ G_DEFINE_TYPE_WITH_CODE (GstFlacEnc, gst_flac_enc, GST_TYPE_AUDIO_ENCODER,
|
||||||
G_IMPLEMENT_INTERFACE (GST_TYPE_TAG_SETTER, NULL)
|
G_IMPLEMENT_INTERFACE (GST_TYPE_TAG_SETTER, NULL)
|
||||||
G_IMPLEMENT_INTERFACE (GST_TYPE_TOC_SETTER, NULL)
|
G_IMPLEMENT_INTERFACE (GST_TYPE_TOC_SETTER, NULL)
|
||||||
);
|
);
|
||||||
|
GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (flacenc, "flacenc", GST_RANK_PRIMARY,
|
||||||
|
GST_TYPE_FLAC_ENC, flac_element_init (plugin));
|
||||||
|
|
||||||
static gboolean gst_flac_enc_start (GstAudioEncoder * enc);
|
static gboolean gst_flac_enc_start (GstAudioEncoder * enc);
|
||||||
static gboolean gst_flac_enc_stop (GstAudioEncoder * enc);
|
static gboolean gst_flac_enc_stop (GstAudioEncoder * enc);
|
||||||
|
|
|
@ -54,6 +54,7 @@
|
||||||
#include <gst/tag/tag.h>
|
#include <gst/tag/tag.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "gstflacelements.h"
|
||||||
#include "gstflactag.h"
|
#include "gstflactag.h"
|
||||||
|
|
||||||
GST_DEBUG_CATEGORY_STATIC (flactag_debug);
|
GST_DEBUG_CATEGORY_STATIC (flactag_debug);
|
||||||
|
@ -89,6 +90,8 @@ static gboolean gst_flac_tag_sink_event (GstPad * pad, GstObject * parent,
|
||||||
#define gst_flac_tag_parent_class parent_class
|
#define gst_flac_tag_parent_class parent_class
|
||||||
G_DEFINE_TYPE_WITH_CODE (GstFlacTag, gst_flac_tag, GST_TYPE_ELEMENT,
|
G_DEFINE_TYPE_WITH_CODE (GstFlacTag, gst_flac_tag, GST_TYPE_ELEMENT,
|
||||||
G_IMPLEMENT_INTERFACE (GST_TYPE_TAG_SETTER, NULL));
|
G_IMPLEMENT_INTERFACE (GST_TYPE_TAG_SETTER, NULL));
|
||||||
|
GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (flactag, "flactag", GST_RANK_PRIMARY,
|
||||||
|
GST_TYPE_FLAC_TAG, flac_element_init (plugin));
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
flac_sources = [
|
flac_sources = [
|
||||||
'gstflac.c',
|
'gstflac.c',
|
||||||
|
'gstflacelement.c',
|
||||||
'gstflacdec.c',
|
'gstflacdec.c',
|
||||||
'gstflacenc.c',
|
'gstflacenc.c',
|
||||||
'gstflactag.c',
|
'gstflactag.c',
|
||||||
|
|
Loading…
Reference in a new issue