mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-18 22:36:33 +00:00
pulse: 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
65e0bc21a5
commit
8c4c4b5cff
6 changed files with 105 additions and 25 deletions
53
ext/pulse/gstpulseelement.c
Normal file
53
ext/pulse/gstpulseelement.c
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
/*
|
||||||
|
* GStreamer pulseaudio plugin
|
||||||
|
*
|
||||||
|
* Copyright (c) 2004-2008 Lennart Poettering
|
||||||
|
*
|
||||||
|
* gst-pulse is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as
|
||||||
|
* published by the Free Software Foundation; either version 2.1 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* gst-pulse 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
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with gst-pulse; 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 "gstpulseelements.h"
|
||||||
|
#include "pulsedeviceprovider.h"
|
||||||
|
|
||||||
|
GST_DEBUG_CATEGORY (pulse_debug);
|
||||||
|
|
||||||
|
GST_DEVICE_PROVIDER_REGISTER_DEFINE (pulsedeviceprovider, "pulsedeviceprovider",
|
||||||
|
GST_RANK_PRIMARY, GST_TYPE_PULSE_DEVICE_PROVIDER);
|
||||||
|
|
||||||
|
void
|
||||||
|
pulse_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_DEBUG_CATEGORY_INIT (pulse_debug, "pulse", 0, "PulseAudio elements");
|
||||||
|
|
||||||
|
g_once_init_leave (&res, TRUE);
|
||||||
|
}
|
||||||
|
}
|
39
ext/pulse/gstpulseelements.h
Normal file
39
ext/pulse/gstpulseelements.h
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
/*
|
||||||
|
* GStreamer pulseaudio plugin
|
||||||
|
*
|
||||||
|
* Copyright (c) 2004-2008 Lennart Poettering
|
||||||
|
* 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_PULSE_ELEMENTS_H__
|
||||||
|
#define __GST_PULSE_ELEMENTS_H__
|
||||||
|
|
||||||
|
#include <gst/gst.h>
|
||||||
|
|
||||||
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
void pulse_element_init (GstPlugin * plugin);
|
||||||
|
|
||||||
|
GST_ELEMENT_REGISTER_DECLARE (pulsesink);
|
||||||
|
GST_ELEMENT_REGISTER_DECLARE (pulsesrc);
|
||||||
|
|
||||||
|
GST_DEVICE_PROVIDER_REGISTER_DECLARE (pulsedeviceprovider);
|
||||||
|
|
||||||
|
G_END_DECLS
|
||||||
|
|
||||||
|
#endif /* __GST_PULSE_ELEMENTS_H__ */
|
|
@ -1,4 +1,5 @@
|
||||||
pulse_sources = [
|
pulse_sources = [
|
||||||
|
'gstpulseelement.c',
|
||||||
'plugin.c',
|
'plugin.c',
|
||||||
'pulsesink.c',
|
'pulsesink.c',
|
||||||
'pulsesrc.c',
|
'pulsesrc.c',
|
||||||
|
|
|
@ -23,38 +23,19 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <gst/gst-i18n-plugin.h>
|
#include "gstpulseelements.h"
|
||||||
|
|
||||||
#include "pulsesink.h"
|
|
||||||
#include "pulsesrc.h"
|
|
||||||
#include "pulsedeviceprovider.h"
|
|
||||||
|
|
||||||
GST_DEBUG_CATEGORY (pulse_debug);
|
|
||||||
|
|
||||||
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, "pulsesink", GST_RANK_PRIMARY + 10,
|
ret |= GST_ELEMENT_REGISTER (pulsesink, plugin);
|
||||||
GST_TYPE_PULSESINK))
|
ret |= GST_ELEMENT_REGISTER (pulsesrc, plugin);
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
if (!gst_element_register (plugin, "pulsesrc", GST_RANK_PRIMARY + 10,
|
ret |= GST_DEVICE_PROVIDER_REGISTER (pulsedeviceprovider, plugin);
|
||||||
GST_TYPE_PULSESRC))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
if (!gst_device_provider_register (plugin, "pulsedeviceprovider",
|
return ret;
|
||||||
GST_RANK_PRIMARY, GST_TYPE_PULSE_DEVICE_PROVIDER))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
GST_DEBUG_CATEGORY_INIT (pulse_debug, "pulse", 0, "PulseAudio elements");
|
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
||||||
|
|
|
@ -59,6 +59,7 @@
|
||||||
|
|
||||||
#include <gst/glib-compat-private.h>
|
#include <gst/glib-compat-private.h>
|
||||||
|
|
||||||
|
#include "gstpulseelements.h"
|
||||||
#include "pulsesink.h"
|
#include "pulsesink.h"
|
||||||
#include "pulseutil.h"
|
#include "pulseutil.h"
|
||||||
|
|
||||||
|
@ -1820,6 +1821,8 @@ G_DEFINE_TYPE_WITH_CODE (GstPulseSink, gst_pulsesink, GST_TYPE_AUDIO_BASE_SINK,
|
||||||
gst_pulsesink_init_contexts ();
|
gst_pulsesink_init_contexts ();
|
||||||
G_IMPLEMENT_INTERFACE (GST_TYPE_STREAM_VOLUME, NULL)
|
G_IMPLEMENT_INTERFACE (GST_TYPE_STREAM_VOLUME, NULL)
|
||||||
);
|
);
|
||||||
|
GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (pulsesink, "pulsesink",
|
||||||
|
GST_RANK_PRIMARY + 10, GST_TYPE_PULSESINK, pulse_element_init (plugin));
|
||||||
|
|
||||||
static GstAudioRingBuffer *
|
static GstAudioRingBuffer *
|
||||||
gst_pulsesink_create_ringbuffer (GstAudioBaseSink * sink)
|
gst_pulsesink_create_ringbuffer (GstAudioBaseSink * sink)
|
||||||
|
|
|
@ -45,6 +45,7 @@
|
||||||
#include <gst/gsttaglist.h>
|
#include <gst/gsttaglist.h>
|
||||||
#include <gst/audio/audio.h>
|
#include <gst/audio/audio.h>
|
||||||
|
|
||||||
|
#include "gstpulseelements.h"
|
||||||
#include "pulsesrc.h"
|
#include "pulsesrc.h"
|
||||||
#include "pulseutil.h"
|
#include "pulseutil.h"
|
||||||
|
|
||||||
|
@ -115,6 +116,8 @@ static GstClockTime gst_pulsesrc_get_time (GstClock * clock, GstPulseSrc * src);
|
||||||
#define gst_pulsesrc_parent_class parent_class
|
#define gst_pulsesrc_parent_class parent_class
|
||||||
G_DEFINE_TYPE_WITH_CODE (GstPulseSrc, gst_pulsesrc, GST_TYPE_AUDIO_SRC,
|
G_DEFINE_TYPE_WITH_CODE (GstPulseSrc, gst_pulsesrc, GST_TYPE_AUDIO_SRC,
|
||||||
G_IMPLEMENT_INTERFACE (GST_TYPE_STREAM_VOLUME, NULL));
|
G_IMPLEMENT_INTERFACE (GST_TYPE_STREAM_VOLUME, NULL));
|
||||||
|
GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (pulsesrc, "pulsesrc",
|
||||||
|
GST_RANK_PRIMARY + 10, GST_TYPE_PULSESRC, pulse_element_init (plugin));
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_pulsesrc_class_init (GstPulseSrcClass * klass)
|
gst_pulsesrc_class_init (GstPulseSrcClass * klass)
|
||||||
|
|
Loading…
Reference in a new issue