mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-11 01:45:33 +00:00
port to more audio api changes
This commit is contained in:
parent
77ad0a1363
commit
445bf71bd1
22 changed files with 102 additions and 126 deletions
|
@ -112,7 +112,7 @@ static void gst_audio_amplify_get_property (GObject * object, guint prop_id,
|
|||
GValue * value, GParamSpec * pspec);
|
||||
|
||||
static gboolean gst_audio_amplify_setup (GstAudioFilter * filter,
|
||||
GstAudioInfo * info);
|
||||
const GstAudioInfo * info);
|
||||
static GstFlowReturn gst_audio_amplify_transform_ip (GstBaseTransform * base,
|
||||
GstBuffer * buf);
|
||||
|
||||
|
@ -433,7 +433,7 @@ gst_audio_amplify_get_property (GObject * object, guint prop_id,
|
|||
|
||||
/* GstAudioFilter vmethod implementations */
|
||||
static gboolean
|
||||
gst_audio_amplify_setup (GstAudioFilter * base, GstAudioInfo * info)
|
||||
gst_audio_amplify_setup (GstAudioFilter * base, const GstAudioInfo * info)
|
||||
{
|
||||
GstAudioAmplify *filter = GST_AUDIO_AMPLIFY (base);
|
||||
|
||||
|
|
|
@ -107,7 +107,7 @@ static void gst_audio_cheb_band_get_property (GObject * object,
|
|||
static void gst_audio_cheb_band_finalize (GObject * object);
|
||||
|
||||
static gboolean gst_audio_cheb_band_setup (GstAudioFilter * filter,
|
||||
GstAudioInfo * info);
|
||||
const GstAudioInfo * info);
|
||||
|
||||
enum
|
||||
{
|
||||
|
@ -641,7 +641,7 @@ gst_audio_cheb_band_get_property (GObject * object, guint prop_id,
|
|||
/* GstAudioFilter vmethod implementations */
|
||||
|
||||
static gboolean
|
||||
gst_audio_cheb_band_setup (GstAudioFilter * base, GstAudioInfo * info)
|
||||
gst_audio_cheb_band_setup (GstAudioFilter * base, const GstAudioInfo * info)
|
||||
{
|
||||
GstAudioChebBand *filter = GST_AUDIO_CHEB_BAND (base);
|
||||
|
||||
|
|
|
@ -102,7 +102,7 @@ static void gst_audio_cheb_limit_get_property (GObject * object,
|
|||
static void gst_audio_cheb_limit_finalize (GObject * object);
|
||||
|
||||
static gboolean gst_audio_cheb_limit_setup (GstAudioFilter * filter,
|
||||
GstAudioInfo * info);
|
||||
const GstAudioInfo * info);
|
||||
|
||||
enum
|
||||
{
|
||||
|
@ -550,7 +550,7 @@ gst_audio_cheb_limit_get_property (GObject * object, guint prop_id,
|
|||
/* GstAudioFilter vmethod implementations */
|
||||
|
||||
static gboolean
|
||||
gst_audio_cheb_limit_setup (GstAudioFilter * base, GstAudioInfo * info)
|
||||
gst_audio_cheb_limit_setup (GstAudioFilter * base, const GstAudioInfo * info)
|
||||
{
|
||||
GstAudioChebLimit *filter = GST_AUDIO_CHEB_LIMIT (base);
|
||||
|
||||
|
|
|
@ -83,7 +83,7 @@ static void gst_audio_dynamic_get_property (GObject * object, guint prop_id,
|
|||
GValue * value, GParamSpec * pspec);
|
||||
|
||||
static gboolean gst_audio_dynamic_setup (GstAudioFilter * filter,
|
||||
GstAudioInfo * info);
|
||||
const GstAudioInfo * info);
|
||||
static GstFlowReturn gst_audio_dynamic_transform_ip (GstBaseTransform * base,
|
||||
GstBuffer * buf);
|
||||
|
||||
|
@ -323,7 +323,7 @@ gst_audio_dynamic_get_property (GObject * object, guint prop_id,
|
|||
/* GstAudioFilter vmethod implementations */
|
||||
|
||||
static gboolean
|
||||
gst_audio_dynamic_setup (GstAudioFilter * base, GstAudioInfo * info)
|
||||
gst_audio_dynamic_setup (GstAudioFilter * base, const GstAudioInfo * info)
|
||||
{
|
||||
GstAudioDynamic *filter = GST_AUDIO_DYNAMIC (base);
|
||||
gboolean ret = TRUE;
|
||||
|
|
|
@ -82,7 +82,7 @@ static void gst_audio_echo_get_property (GObject * object, guint prop_id,
|
|||
static void gst_audio_echo_finalize (GObject * object);
|
||||
|
||||
static gboolean gst_audio_echo_setup (GstAudioFilter * self,
|
||||
GstAudioInfo * info);
|
||||
const GstAudioInfo * info);
|
||||
static gboolean gst_audio_echo_stop (GstBaseTransform * base);
|
||||
static GstFlowReturn gst_audio_echo_transform_ip (GstBaseTransform * base,
|
||||
GstBuffer * buf);
|
||||
|
@ -271,7 +271,7 @@ gst_audio_echo_get_property (GObject * object, guint prop_id,
|
|||
/* GstAudioFilter vmethod implementations */
|
||||
|
||||
static gboolean
|
||||
gst_audio_echo_setup (GstAudioFilter * base, GstAudioInfo * info)
|
||||
gst_audio_echo_setup (GstAudioFilter * base, const GstAudioInfo * info)
|
||||
{
|
||||
GstAudioEcho *self = GST_AUDIO_ECHO (base);
|
||||
gboolean ret = TRUE;
|
||||
|
|
|
@ -86,7 +86,7 @@ static void gst_audio_fir_filter_get_property (GObject * object, guint prop_id,
|
|||
static void gst_audio_fir_filter_finalize (GObject * object);
|
||||
|
||||
static gboolean gst_audio_fir_filter_setup (GstAudioFilter * base,
|
||||
GstAudioInfo * info);
|
||||
const GstAudioInfo * info);
|
||||
|
||||
|
||||
static void
|
||||
|
@ -183,7 +183,7 @@ gst_audio_fir_filter_init (GstAudioFIRFilter * self)
|
|||
|
||||
/* get notified of caps and plug in the correct process function */
|
||||
static gboolean
|
||||
gst_audio_fir_filter_setup (GstAudioFilter * base, GstAudioInfo * info)
|
||||
gst_audio_fir_filter_setup (GstAudioFilter * base, const GstAudioInfo * info)
|
||||
{
|
||||
GstAudioFIRFilter *self = GST_AUDIO_FIR_FILTER (base);
|
||||
gint new_rate = GST_AUDIO_INFO_RATE (info);
|
||||
|
|
|
@ -70,7 +70,7 @@ static gboolean gst_audio_fx_base_fir_filter_transform_size (GstBaseTransform *
|
|||
base, GstPadDirection direction, GstCaps * caps, gsize size,
|
||||
GstCaps * othercaps, gsize * othersize);
|
||||
static gboolean gst_audio_fx_base_fir_filter_setup (GstAudioFilter * base,
|
||||
GstAudioInfo * info);
|
||||
const GstAudioInfo * info);
|
||||
|
||||
static gboolean gst_audio_fx_base_fir_filter_query (GstPad * pad,
|
||||
GstQuery * query);
|
||||
|
@ -743,7 +743,8 @@ gst_audio_fx_base_fir_filter_push_residue (GstAudioFXBaseFIRFilter * self)
|
|||
|
||||
/* get notified of caps and plug in the correct process function */
|
||||
static gboolean
|
||||
gst_audio_fx_base_fir_filter_setup (GstAudioFilter * base, GstAudioInfo * info)
|
||||
gst_audio_fx_base_fir_filter_setup (GstAudioFilter * base,
|
||||
const GstAudioInfo * info)
|
||||
{
|
||||
GstAudioFXBaseFIRFilter *self = GST_AUDIO_FX_BASE_FIR_FILTER (base);
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ G_DEFINE_TYPE (GstAudioFXBaseIIRFilter,
|
|||
gst_audio_fx_base_iir_filter, GST_TYPE_AUDIO_FILTER);
|
||||
|
||||
static gboolean gst_audio_fx_base_iir_filter_setup (GstAudioFilter * filter,
|
||||
GstAudioInfo * info);
|
||||
const GstAudioInfo * info);
|
||||
static GstFlowReturn
|
||||
gst_audio_fx_base_iir_filter_transform_ip (GstBaseTransform * base,
|
||||
GstBuffer * buf);
|
||||
|
@ -236,7 +236,8 @@ gst_audio_fx_base_iir_filter_set_coefficients (GstAudioFXBaseIIRFilter * filter,
|
|||
/* GstAudioFilter vmethod implementations */
|
||||
|
||||
static gboolean
|
||||
gst_audio_fx_base_iir_filter_setup (GstAudioFilter * base, GstAudioInfo * info)
|
||||
gst_audio_fx_base_iir_filter_setup (GstAudioFilter * base,
|
||||
const GstAudioInfo * info)
|
||||
{
|
||||
GstAudioFXBaseIIRFilter *filter = GST_AUDIO_FX_BASE_IIR_FILTER (base);
|
||||
gboolean ret = TRUE;
|
||||
|
|
|
@ -82,7 +82,7 @@ static void gst_audio_iir_filter_get_property (GObject * object, guint prop_id,
|
|||
static void gst_audio_iir_filter_finalize (GObject * object);
|
||||
|
||||
static gboolean gst_audio_iir_filter_setup (GstAudioFilter * base,
|
||||
GstAudioInfo * info);
|
||||
const GstAudioInfo * info);
|
||||
|
||||
static void
|
||||
gst_audio_iir_filter_class_init (GstAudioIIRFilterClass * klass)
|
||||
|
@ -200,7 +200,7 @@ gst_audio_iir_filter_init (GstAudioIIRFilter * self)
|
|||
|
||||
/* get notified of caps and plug in the correct process function */
|
||||
static gboolean
|
||||
gst_audio_iir_filter_setup (GstAudioFilter * base, GstAudioInfo * info)
|
||||
gst_audio_iir_filter_setup (GstAudioFilter * base, const GstAudioInfo * info)
|
||||
{
|
||||
GstAudioIIRFilter *self = GST_AUDIO_IIR_FILTER (base);
|
||||
gint new_rate = GST_AUDIO_INFO_RATE (info);
|
||||
|
|
|
@ -78,7 +78,7 @@ static void gst_audio_invert_get_property (GObject * object, guint prop_id,
|
|||
GValue * value, GParamSpec * pspec);
|
||||
|
||||
static gboolean gst_audio_invert_setup (GstAudioFilter * filter,
|
||||
GstAudioInfo * info);
|
||||
const GstAudioInfo * info);
|
||||
static GstFlowReturn gst_audio_invert_transform_ip (GstBaseTransform * base,
|
||||
GstBuffer * buf);
|
||||
|
||||
|
@ -172,7 +172,7 @@ gst_audio_invert_get_property (GObject * object, guint prop_id,
|
|||
/* GstAudioFilter vmethod implementations */
|
||||
|
||||
static gboolean
|
||||
gst_audio_invert_setup (GstAudioFilter * base, GstAudioInfo * info)
|
||||
gst_audio_invert_setup (GstAudioFilter * base, const GstAudioInfo * info)
|
||||
{
|
||||
GstAudioInvert *filter = GST_AUDIO_INVERT (base);
|
||||
gboolean ret = TRUE;
|
||||
|
|
|
@ -85,7 +85,7 @@ static void gst_audio_karaoke_get_property (GObject * object, guint prop_id,
|
|||
GValue * value, GParamSpec * pspec);
|
||||
|
||||
static gboolean gst_audio_karaoke_setup (GstAudioFilter * filter,
|
||||
GstAudioInfo * info);
|
||||
const GstAudioInfo * info);
|
||||
static GstFlowReturn gst_audio_karaoke_transform_ip (GstBaseTransform * base,
|
||||
GstBuffer * buf);
|
||||
|
||||
|
@ -239,7 +239,7 @@ gst_audio_karaoke_get_property (GObject * object, guint prop_id,
|
|||
/* GstAudioFilter vmethod implementations */
|
||||
|
||||
static gboolean
|
||||
gst_audio_karaoke_setup (GstAudioFilter * base, GstAudioInfo * info)
|
||||
gst_audio_karaoke_setup (GstAudioFilter * base, const GstAudioInfo * info)
|
||||
{
|
||||
GstAudioKaraoke *filter = GST_AUDIO_KARAOKE (base);
|
||||
gboolean ret = TRUE;
|
||||
|
|
|
@ -149,7 +149,7 @@ static void gst_audio_wsincband_get_property (GObject * object, guint prop_id,
|
|||
static void gst_audio_wsincband_finalize (GObject * object);
|
||||
|
||||
static gboolean gst_audio_wsincband_setup (GstAudioFilter * base,
|
||||
GstAudioInfo * info);
|
||||
const GstAudioInfo * info);
|
||||
|
||||
#define POW2(x) (x)*(x)
|
||||
|
||||
|
@ -371,7 +371,7 @@ gst_audio_wsincband_build_kernel (GstAudioWSincBand * self)
|
|||
|
||||
/* get notified of caps and plug in the correct process function */
|
||||
static gboolean
|
||||
gst_audio_wsincband_setup (GstAudioFilter * base, GstAudioInfo * info)
|
||||
gst_audio_wsincband_setup (GstAudioFilter * base, const GstAudioInfo * info)
|
||||
{
|
||||
GstAudioWSincBand *self = GST_AUDIO_WSINC_BAND (base);
|
||||
|
||||
|
|
|
@ -148,7 +148,7 @@ static void gst_audio_wsinclimit_get_property (GObject * object, guint prop_id,
|
|||
static void gst_audio_wsinclimit_finalize (GObject * object);
|
||||
|
||||
static gboolean gst_audio_wsinclimit_setup (GstAudioFilter * base,
|
||||
GstAudioInfo * info);
|
||||
const GstAudioInfo * info);
|
||||
|
||||
|
||||
#define POW2(x) (x)*(x)
|
||||
|
@ -306,7 +306,7 @@ gst_audio_wsinclimit_build_kernel (GstAudioWSincLimit * self)
|
|||
|
||||
/* get notified of caps and plug in the correct process function */
|
||||
static gboolean
|
||||
gst_audio_wsinclimit_setup (GstAudioFilter * base, GstAudioInfo * info)
|
||||
gst_audio_wsinclimit_setup (GstAudioFilter * base, const GstAudioInfo * info)
|
||||
{
|
||||
GstAudioWSincLimit *self = GST_AUDIO_WSINC_LIMIT (base);
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ plugin_LTLIBRARIES = libgstauparse.la
|
|||
|
||||
libgstauparse_la_SOURCES = gstauparse.c
|
||||
libgstauparse_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS)
|
||||
libgstauparse_la_LIBADD = $(GST_LIBS) $(GST_BASE_LIBS)
|
||||
libgstauparse_la_LIBADD = $(GST_LIBS) $(GST_BASE_LIBS) -lgstaudio-$(GST_MAJORMINOR)
|
||||
libgstauparse_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
|
||||
libgstauparse_la_LIBTOOLFLAGS = --tag=disable-static
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ static void gst_iir_equalizer_child_proxy_interface_init (gpointer g_iface,
|
|||
static void gst_iir_equalizer_finalize (GObject * object);
|
||||
|
||||
static gboolean gst_iir_equalizer_setup (GstAudioFilter * filter,
|
||||
GstAudioInfo * info);
|
||||
const GstAudioInfo * info);
|
||||
static GstFlowReturn gst_iir_equalizer_transform_ip (GstBaseTransform * btrans,
|
||||
GstBuffer * buf);
|
||||
|
||||
|
@ -848,7 +848,7 @@ gst_iir_equalizer_transform_ip (GstBaseTransform * btrans, GstBuffer * buf)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gst_iir_equalizer_setup (GstAudioFilter * audio, GstAudioInfo * info)
|
||||
gst_iir_equalizer_setup (GstAudioFilter * audio, const GstAudioInfo * info)
|
||||
{
|
||||
GstIirEqualizer *equ = GST_IIR_EQUALIZER (audio);
|
||||
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
#include <gst/gst.h>
|
||||
#include "gstgoom.h"
|
||||
#include <gst/video/video.h>
|
||||
#include <gst/audio/audio.h>
|
||||
#include "goom.h"
|
||||
|
||||
#if HAVE_ORC
|
||||
|
@ -82,11 +83,8 @@ static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
|
|||
static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink", /* the name of the pads */
|
||||
GST_PAD_SINK, /* type of the pad */
|
||||
GST_PAD_ALWAYS, /* ALWAYS/SOMETIMES */
|
||||
GST_STATIC_CAPS ("audio/x-raw-int, "
|
||||
"endianness = (int) BYTE_ORDER, "
|
||||
"signed = (boolean) TRUE, "
|
||||
"width = (int) 16, "
|
||||
"depth = (int) 16, "
|
||||
GST_STATIC_CAPS ("audio/x-raw, "
|
||||
"format = (string) " GST_AUDIO_NE (S16) ", "
|
||||
"rate = (int) [ 8000, 96000 ], " "channels = (int) { 1, 2 }")
|
||||
);
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ plugin_LTLIBRARIES = libgstlevel.la
|
|||
|
||||
libgstlevel_la_SOURCES = gstlevel.c
|
||||
libgstlevel_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS)
|
||||
libgstlevel_la_LIBADD = $(GST_BASE_LIBS) $(LIBM)
|
||||
libgstlevel_la_LIBADD = $(GST_BASE_LIBS) $(LIBM) -lgstaudio-$(GST_MAJORMINOR)
|
||||
libgstlevel_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
|
||||
libgstlevel_la_LIBTOOLFLAGS = --tag=disable-static
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ libgstreplaygain_la_SOURCES = \
|
|||
libgstreplaygain_la_CFLAGS = \
|
||||
$(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS)
|
||||
libgstreplaygain_la_LIBADD = \
|
||||
$(GST_PLUGINS_BASE_LIBS) -lgstpbutils-$(GST_MAJORMINOR) \
|
||||
$(GST_PLUGINS_BASE_LIBS) -lgstpbutils-$(GST_MAJORMINOR) -lgstaudio-$(GST_MAJORMINOR)\
|
||||
$(GST_BASE_LIBS) $(GST_LIBS) $(LIBM)
|
||||
libgstreplaygain_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
|
||||
libgstreplaygain_la_LIBTOOLFLAGS = --tag=disable-static
|
||||
|
|
|
@ -79,6 +79,7 @@
|
|||
|
||||
#include <gst/gst.h>
|
||||
#include <gst/base/gstbasetransform.h>
|
||||
#include <gst/audio/audio.h>
|
||||
|
||||
#include "gstrganalysis.h"
|
||||
#include "replaygain.h"
|
||||
|
@ -103,27 +104,20 @@ enum
|
|||
* audio. The used implementation has filter coefficients for the
|
||||
* "usual" sample rates in the 8000 to 48000 Hz range. */
|
||||
#define REPLAY_GAIN_CAPS \
|
||||
"format = (string) { "GST_AUDIO_NE(F32)","GST_AUDIO_NE(S16)" }, " \
|
||||
"channels = (int) { 1, 2 }, " \
|
||||
"rate = (int) { 8000, 11025, 12000, 16000, 22050, 24000, 32000, " \
|
||||
"44100, 48000 }"
|
||||
|
||||
static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
|
||||
GST_PAD_SINK, GST_PAD_ALWAYS, GST_STATIC_CAPS ("audio/x-raw-float, "
|
||||
"width = (int) 32, " "endianness = (int) BYTE_ORDER, "
|
||||
REPLAY_GAIN_CAPS "; "
|
||||
"audio/x-raw-int, "
|
||||
"width = (int) 16, " "depth = (int) [ 1, 16 ], "
|
||||
"signed = (boolean) true, " "endianness = (int) BYTE_ORDER, "
|
||||
REPLAY_GAIN_CAPS));
|
||||
GST_PAD_SINK,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS (REPLAY_GAIN_CAPS));
|
||||
|
||||
static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
|
||||
GST_PAD_SRC, GST_PAD_ALWAYS, GST_STATIC_CAPS ("audio/x-raw-float, "
|
||||
"width = (int) 32, " "endianness = (int) BYTE_ORDER, "
|
||||
REPLAY_GAIN_CAPS "; "
|
||||
"audio/x-raw-int, "
|
||||
"width = (int) 16, " "depth = (int) [ 1, 16 ], "
|
||||
"signed = (boolean) true, " "endianness = (int) BYTE_ORDER, "
|
||||
REPLAY_GAIN_CAPS));
|
||||
GST_PAD_SRC,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS (REPLAY_GAIN_CAPS));
|
||||
|
||||
#define gst_rg_analysis_parent_class parent_class
|
||||
G_DEFINE_TYPE (GstRgAnalysis, gst_rg_analysis, GST_TYPE_BASE_TRANSFORM);
|
||||
|
@ -396,9 +390,8 @@ gst_rg_analysis_set_caps (GstBaseTransform * base, GstCaps * in_caps,
|
|||
GstCaps * out_caps)
|
||||
{
|
||||
GstRgAnalysis *filter = GST_RG_ANALYSIS (base);
|
||||
GstStructure *structure;
|
||||
const gchar *name;
|
||||
gint n_channels, sample_rate, sample_bit_size, sample_size;
|
||||
GstAudioInfo info;
|
||||
gint rate, channels;
|
||||
|
||||
g_return_val_if_fail (filter->ctx != NULL, FALSE);
|
||||
|
||||
|
@ -406,58 +399,42 @@ gst_rg_analysis_set_caps (GstBaseTransform * base, GstCaps * in_caps,
|
|||
"set_caps in %" GST_PTR_FORMAT " out %" GST_PTR_FORMAT,
|
||||
in_caps, out_caps);
|
||||
|
||||
structure = gst_caps_get_structure (in_caps, 0);
|
||||
name = gst_structure_get_name (structure);
|
||||
|
||||
if (!gst_structure_get_int (structure, "width", &sample_bit_size)
|
||||
|| !gst_structure_get_int (structure, "channels", &n_channels)
|
||||
|| !gst_structure_get_int (structure, "rate", &sample_rate))
|
||||
if (!gst_audio_info_from_caps (&info, in_caps))
|
||||
goto invalid_format;
|
||||
|
||||
if (!rg_analysis_set_sample_rate (filter->ctx, sample_rate))
|
||||
rate = GST_AUDIO_INFO_RATE (&info);
|
||||
|
||||
if (!rg_analysis_set_sample_rate (filter->ctx, rate))
|
||||
goto invalid_format;
|
||||
|
||||
if (sample_bit_size % 8 != 0)
|
||||
channels = GST_AUDIO_INFO_CHANNELS (&info);
|
||||
|
||||
if (channels < 1 || channels > 2)
|
||||
goto invalid_format;
|
||||
sample_size = sample_bit_size / 8;
|
||||
|
||||
if (g_str_equal (name, "audio/x-raw-float")) {
|
||||
switch (GST_AUDIO_INFO_FORMAT (&info)) {
|
||||
case GST_AUDIO_FORMAT_F32:
|
||||
/* The depth is not variable for float formats of course. It just
|
||||
* makes the transform function nice and simple if the
|
||||
* rg_analysis_analyze_* functions have a common signature. */
|
||||
filter->depth = sizeof (gfloat) * 8;
|
||||
|
||||
if (sample_size != sizeof (gfloat))
|
||||
if (channels == 1)
|
||||
filter->analyze = rg_analysis_analyze_mono_float;
|
||||
else
|
||||
filter->analyze = rg_analysis_analyze_stereo_float;
|
||||
|
||||
break;
|
||||
case GST_AUDIO_FORMAT_S16:
|
||||
filter->depth = sizeof (gint16) * 8;
|
||||
|
||||
if (channels == 1)
|
||||
filter->analyze = rg_analysis_analyze_mono_int16;
|
||||
else
|
||||
filter->analyze = rg_analysis_analyze_stereo_int16;
|
||||
break;
|
||||
default:
|
||||
goto invalid_format;
|
||||
|
||||
/* The depth is not variable for float formats of course. It just
|
||||
* makes the transform function nice and simple if the
|
||||
* rg_analysis_analyze_* functions have a common signature. */
|
||||
filter->depth = sizeof (gfloat) * 8;
|
||||
|
||||
if (n_channels == 1)
|
||||
filter->analyze = rg_analysis_analyze_mono_float;
|
||||
else if (n_channels == 2)
|
||||
filter->analyze = rg_analysis_analyze_stereo_float;
|
||||
else
|
||||
goto invalid_format;
|
||||
|
||||
} else if (g_str_equal (name, "audio/x-raw-int")) {
|
||||
|
||||
if (sample_size != sizeof (gint16))
|
||||
goto invalid_format;
|
||||
|
||||
if (!gst_structure_get_int (structure, "depth", &filter->depth))
|
||||
goto invalid_format;
|
||||
if (filter->depth < 1 || filter->depth > 16)
|
||||
goto invalid_format;
|
||||
|
||||
if (n_channels == 1)
|
||||
filter->analyze = rg_analysis_analyze_mono_int16;
|
||||
else if (n_channels == 2)
|
||||
filter->analyze = rg_analysis_analyze_stereo_int16;
|
||||
else
|
||||
goto invalid_format;
|
||||
|
||||
} else {
|
||||
|
||||
goto invalid_format;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
|
||||
#include <gst/gst.h>
|
||||
#include <math.h>
|
||||
#include <gst/audio/audio.h>
|
||||
|
||||
#include "gstrglimiter.h"
|
||||
|
||||
|
@ -58,14 +59,18 @@ enum
|
|||
};
|
||||
|
||||
static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
|
||||
GST_PAD_SINK, GST_PAD_ALWAYS, GST_STATIC_CAPS ("audio/x-raw-float, "
|
||||
"width = (int) 32, channels = (int) [1, MAX], "
|
||||
"rate = (int) [1, MAX], endianness = (int) BYTE_ORDER"));
|
||||
GST_PAD_SINK,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS ("audio/x-raw, "
|
||||
"format = (string) " GST_AUDIO_NE (F32) ", "
|
||||
"channels = (int) [1, MAX], " "rate = (int) [1, MAX]"));
|
||||
|
||||
static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
|
||||
GST_PAD_SRC, GST_PAD_ALWAYS, GST_STATIC_CAPS ("audio/x-raw-float, "
|
||||
"width = (int) 32, channels = (int) [1, MAX], "
|
||||
"rate = (int) [1, MAX], endianness = (int) BYTE_ORDER"));
|
||||
GST_PAD_SRC,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS ("audio/x-raw, "
|
||||
"format = (string) " GST_AUDIO_NE (F32) ", "
|
||||
"channels = (int) [1, MAX], " "rate = (int) [1, MAX]"));
|
||||
|
||||
#define gst_rg_limiter_parent_class parent_class
|
||||
G_DEFINE_TYPE (GstRgLimiter, gst_rg_limiter, GST_TYPE_BASE_TRANSFORM);
|
||||
|
|
|
@ -61,6 +61,7 @@
|
|||
|
||||
#include <gst/gst.h>
|
||||
#include <gst/pbutils/pbutils.h>
|
||||
#include <gst/audio/audio.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "gstrgvolume.h"
|
||||
|
@ -96,29 +97,21 @@ enum
|
|||
|
||||
/* Same template caps as GstVolume, for I don't like having just ANY caps. */
|
||||
|
||||
#define FORMAT "{ "GST_AUDIO_NE(F32)","GST_AUDIO_NE(S16)" }"
|
||||
|
||||
static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
|
||||
GST_PAD_SINK, GST_PAD_ALWAYS, GST_STATIC_CAPS ("audio/x-raw-float, "
|
||||
"rate = (int) [ 1, MAX ], "
|
||||
"channels = (int) [ 1, MAX ], "
|
||||
"endianness = (int) BYTE_ORDER, "
|
||||
"width = (int) 32; "
|
||||
"audio/x-raw-int, "
|
||||
"channels = (int) [ 1, MAX ], "
|
||||
"rate = (int) [ 1, MAX ], "
|
||||
"endianness = (int) BYTE_ORDER, "
|
||||
"width = (int) 16, " "depth = (int) 16, " "signed = (bool) TRUE"));
|
||||
GST_PAD_SINK,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS ("audio/x-raw, "
|
||||
"format = (string) " FORMAT ", "
|
||||
"rate = (int) [ 1, MAX ], " "channels = (int) [ 1, MAX ]"));
|
||||
|
||||
static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
|
||||
GST_PAD_SRC, GST_PAD_ALWAYS, GST_STATIC_CAPS ("audio/x-raw-float, "
|
||||
"rate = (int) [ 1, MAX ], "
|
||||
"channels = (int) [ 1, MAX ], "
|
||||
"endianness = (int) BYTE_ORDER, "
|
||||
"width = (int) 32; "
|
||||
"audio/x-raw-int, "
|
||||
"channels = (int) [ 1, MAX ], "
|
||||
"rate = (int) [ 1, MAX ], "
|
||||
"endianness = (int) BYTE_ORDER, "
|
||||
"width = (int) 16, " "depth = (int) 16, " "signed = (bool) TRUE"));
|
||||
GST_PAD_SRC,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS ("audio/x-raw, "
|
||||
"format = (string) " FORMAT ", "
|
||||
"rate = (int) [ 1, MAX ], " "channels = (int) [ 1, MAX ]"));
|
||||
|
||||
#define gst_rg_volume_parent_class parent_class
|
||||
G_DEFINE_TYPE (GstRgVolume, gst_rg_volume, GST_TYPE_BIN);
|
||||
|
@ -186,7 +179,7 @@ gst_rg_volume_class_init (GstRgVolumeClass * klass)
|
|||
* This element internally uses a volume element, which also supports
|
||||
* operating on integer audio formats. These formats do not allow exceeding
|
||||
* digital full scale. If extra headroom is used, make sure that the raw
|
||||
* audio data format is floating point (audio/x-raw-float). Otherwise,
|
||||
* audio data format is floating point (F32). Otherwise,
|
||||
* clipping distortion might be introduced as part of the volume adjustment
|
||||
* itself.
|
||||
*/
|
||||
|
|
|
@ -152,7 +152,8 @@ static gboolean gst_spectrum_start (GstBaseTransform * trans);
|
|||
static gboolean gst_spectrum_stop (GstBaseTransform * trans);
|
||||
static GstFlowReturn gst_spectrum_transform_ip (GstBaseTransform * trans,
|
||||
GstBuffer * in);
|
||||
static gboolean gst_spectrum_setup (GstAudioFilter * base, GstAudioInfo * info);
|
||||
static gboolean gst_spectrum_setup (GstAudioFilter * base,
|
||||
const GstAudioInfo * info);
|
||||
|
||||
static void
|
||||
gst_spectrum_class_init (GstSpectrumClass * klass)
|
||||
|
@ -614,7 +615,7 @@ input_data_int16_max (const guint8 * _in, gfloat * out, guint len,
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gst_spectrum_setup (GstAudioFilter * base, GstAudioInfo * info)
|
||||
gst_spectrum_setup (GstAudioFilter * base, const GstAudioInfo * info)
|
||||
{
|
||||
GstSpectrum *spectrum = GST_SPECTRUM (base);
|
||||
gboolean multi_channel = spectrum->multi_channel;
|
||||
|
|
Loading…
Reference in a new issue