Commit ab758a9a authored by Tim-Philipp Müller's avatar Tim-Philipp Müller 🐠
Browse files

audioaggregator, audiomixer, audiointerleave: move from -bad to -base

https://bugzilla.gnome.org/show_bug.cgi?id=791218
parents aab5cccc 29534c38
This diff is collapsed.
/* GStreamer
* Copyright (C) 2014 Collabora
* Author: Olivier Crete <olivier.crete@collabora.com>
*
* gstaudioaggregator.h:
*
* 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_AUDIO_AGGREGATOR_H__
#define __GST_AUDIO_AGGREGATOR_H__
#ifndef GST_USE_UNSTABLE_API
#warning "The Base library from gst-plugins-bad is unstable API and may change in future."
#warning "You can define GST_USE_UNSTABLE_API to avoid this warning."
#endif
#include <gst/gst.h>
#include <gst/base/gstaggregator.h>
#include <gst/audio/audio.h>
G_BEGIN_DECLS
/*******************************
* GstAudioAggregator Structs *
*******************************/
typedef struct _GstAudioAggregator GstAudioAggregator;
typedef struct _GstAudioAggregatorPrivate GstAudioAggregatorPrivate;
typedef struct _GstAudioAggregatorClass GstAudioAggregatorClass;
/************************
* GstAudioAggregatorPad API *
***********************/
#define GST_TYPE_AUDIO_AGGREGATOR_PAD (gst_audio_aggregator_pad_get_type())
#define GST_AUDIO_AGGREGATOR_PAD(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUDIO_AGGREGATOR_PAD, GstAudioAggregatorPad))
#define GST_AUDIO_AGGREGATOR_PAD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AUDIO_AGGREGATOR_PAD, GstAudioAggregatorPadClass))
#define GST_AUDIO_AGGREGATOR_PAD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),GST_TYPE_AUDIO_AGGREGATOR_PAD, GstAudioAggregatorPadClass))
#define GST_IS_AUDIO_AGGREGATOR_PAD(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIO_AGGREGATOR_PAD))
#define GST_IS_AUDIO_AGGREGATOR_PAD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIO_AGGREGATOR_PAD))
/****************************
* GstAudioAggregatorPad Structs *
***************************/
typedef struct _GstAudioAggregatorPad GstAudioAggregatorPad;
typedef struct _GstAudioAggregatorPadClass GstAudioAggregatorPadClass;
typedef struct _GstAudioAggregatorPadPrivate GstAudioAggregatorPadPrivate;
/**
* GstAudioAggregatorPad:
* @parent: The parent #GstAggregatorPad
* @info: The audio info for this pad set from the incoming caps
*
* The default implementation of GstPad used with #GstAudioAggregator
*/
struct _GstAudioAggregatorPad
{
GstAggregatorPad parent;
GstAudioInfo info;
/*< private >*/
GstAudioAggregatorPadPrivate * priv;
gpointer _gst_reserved[GST_PADDING];
};
/**
* GstAudioAggregatorPadClass:
*
*/
struct _GstAudioAggregatorPadClass
{
GstAggregatorPadClass parent_class;
/*< private >*/
gpointer _gst_reserved[GST_PADDING_LARGE];
};
GST_EXPORT
GType gst_audio_aggregator_pad_get_type (void);
#define GST_TYPE_AUDIO_AGGREGATOR_CONVERT_PAD (gst_audio_aggregator_convert_pad_get_type())
#define GST_AUDIO_AGGREGATOR_CONVERT_PAD(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUDIO_AGGREGATOR_CONVERT_PAD, GstAudioAggregatorConvertPad))
#define GST_AUDIO_AGGREGATOR_CONVERT_PAD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AUDIO_AGGREGATOR_CONVERT_PAD, GstAudioAggregatorConvertPadClass))
#define GST_AUDIO_AGGREGATOR_CONVERT_PAD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),GST_TYPE_AUDIO_AGGREGATOR_CONVERT_PAD, GstAudioAggregatorConvertPadClass))
#define GST_IS_AUDIO_AGGREGATOR_CONVERT_PAD(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIO_AGGREGATOR_CONVERT_PAD))
#define GST_IS_AUDIO_AGGREGATOR_CONVERT_PAD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIO_AGGREGATOR_CONVERT_PAD))
/****************************
* GstAudioAggregatorPad Structs *
***************************/
typedef struct _GstAudioAggregatorConvertPad GstAudioAggregatorConvertPad;
typedef struct _GstAudioAggregatorConvertPadClass GstAudioAggregatorConvertPadClass;
typedef struct _GstAudioAggregatorConvertPadPrivate GstAudioAggregatorConvertPadPrivate;
/**
* GstAudioAggregatorConvertPad:
* @parent: The parent #GstAudioAggregatorPad
*
* An implementation of GstPad that can be used with #GstAudioAggregator.
*
* See #GstAudioAggregator for more details.
*/
struct _GstAudioAggregatorConvertPad
{
GstAudioAggregatorPad parent;
/*< private >*/
GstAudioAggregatorConvertPadPrivate * priv;
gpointer _gst_reserved[GST_PADDING];
};
/**
* GstAudioAggregatorConvertPadClass:
*
*/
struct _GstAudioAggregatorConvertPadClass
{
GstAudioAggregatorPadClass parent_class;
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
GST_EXPORT
GType gst_audio_aggregator_convert_pad_get_type (void);
/**************************
* GstAudioAggregator API *
**************************/
#define GST_TYPE_AUDIO_AGGREGATOR (gst_audio_aggregator_get_type())
#define GST_AUDIO_AGGREGATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUDIO_AGGREGATOR,GstAudioAggregator))
#define GST_AUDIO_AGGREGATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AUDIO_AGGREGATOR,GstAudioAggregatorClass))
#define GST_AUDIO_AGGREGATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),GST_TYPE_AUDIO_AGGREGATOR,GstAudioAggregatorClass))
#define GST_IS_AUDIO_AGGREGATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIO_AGGREGATOR))
#define GST_IS_AUDIO_AGGREGATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIO_AGGREGATOR))
/**
* GstAudioAggregator:
* @parent: The parent #GstAggregator
* @info: The information parsed from the current caps
* @current_caps: The caps set by the subclass
*
* GstAudioAggregator object
*/
struct _GstAudioAggregator
{
GstAggregator parent;
/* All member are read only for subclasses, must hold OBJECT lock */
GstAudioInfo info;
GstCaps *current_caps;
/*< private >*/
GstAudioAggregatorPrivate *priv;
gpointer _gst_reserved[GST_PADDING];
};
/**
* GstAudioAggregatorClass:
* @create_output_buffer: Create a new output buffer contains num_frames frames.
* @aggregate_one_buffer: Aggregates one input buffer to the output
* buffer. The in_offset and out_offset are in "frames", which is
* the size of a sample times the number of channels. Returns TRUE if
* any non-silence was added to the buffer
* @convert_buffer: Convert a buffer from one format to another. The pad
* is either a sinkpad, when converting an input buffer, or the source pad,
* when converting the output buffer after a downstream format change is
* requested.
*/
struct _GstAudioAggregatorClass {
GstAggregatorClass parent_class;
GstBuffer * (* create_output_buffer) (GstAudioAggregator * aagg,
guint num_frames);
gboolean (* aggregate_one_buffer) (GstAudioAggregator * aagg,
GstAudioAggregatorPad * pad, GstBuffer * inbuf, guint in_offset,
GstBuffer * outbuf, guint out_offset, guint num_frames);
GstBuffer * (* convert_buffer) (GstAudioAggregator *aagg,
GstPad * pad,
GstAudioInfo *in_info,
GstAudioInfo *out_info,
GstBuffer * buffer);
/*< private >*/
gpointer _gst_reserved[GST_PADDING_LARGE];
};
/*************************
* GstAggregator methods *
************************/
GST_EXPORT
GType gst_audio_aggregator_get_type(void);
GST_EXPORT
void gst_audio_aggregator_set_sink_caps (GstAudioAggregator * aagg,
GstAudioAggregatorPad * pad,
GstCaps * caps);
GST_EXPORT
void gst_audio_aggregator_class_perform_conversion (GstAudioAggregatorClass * klass);
G_END_DECLS
#endif /* __GST_AUDIO_AGGREGATOR_H__ */
plugin_LTLIBRARIES = libgstaudiomixer.la
ORC_SOURCE=gstaudiomixerorc
include $(top_srcdir)/common/orc.mak
libgstaudiomixer_la_SOURCES = gstaudiomixer.c gstaudiointerleave.c
nodist_libgstaudiomixer_la_SOURCES = $(ORC_NODIST_SOURCES)
libgstaudiomixer_la_CFLAGS = \
-I$(top_srcdir)/gst-libs \
-I$(top_builddir)/gst-libs \
$(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) \
$(GST_CFLAGS) $(ORC_CFLAGS)
libgstaudiomixer_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
libgstaudiomixer_la_LIBADD = \
$(top_builddir)/gst-libs/gst/audio/libgstbadaudio-$(GST_API_VERSION).la \
$(GST_PLUGINS_BASE_LIBS) -lgstaudio-@GST_API_VERSION@ \
$(GST_BASE_LIBS) $(GST_LIBS) $(ORC_LIBS)
noinst_HEADERS = gstaudiomixer.h gstaudiointerleave.h
This diff is collapsed.
/* GStreamer
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
* 2000 Wim Taymans <wtay@chello.be>
* Copyright (C) 2013 Sebastian Dröge <slomo@circular-chaos.org>
*
* gstaudiointerleave.h: Header for audiointerleave element
*
* 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_AUDIO_INTERLEAVE_H__
#define __GST_AUDIO_INTERLEAVE_H__
#include <gst/gst.h>
#include <gst/audio/audio.h>
#include <gst/audio/gstaudioaggregator.h>
G_BEGIN_DECLS
#define GST_TYPE_AUDIO_INTERLEAVE (gst_audio_interleave_get_type())
#define GST_AUDIO_INTERLEAVE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUDIO_INTERLEAVE,GstAudioInterleave))
#define GST_IS_AUDIO_INTERLEAVE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIO_INTERLEAVE))
#define GST_AUDIO_INTERLEAVE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass) ,GST_TYPE_AUDIO_INTERLEAVE,GstAudioInterleaveClass))
#define GST_IS_AUDIO_INTERLEAVE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass) ,GST_TYPE_AUDIO_INTERLEAVE))
#define GST_AUDIO_INTERLEAVE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj) ,GST_TYPE_AUDIO_INTERLEAVE,GstAudioInterleaveClass))
typedef struct _GstAudioInterleave GstAudioInterleave;
typedef struct _GstAudioInterleaveClass GstAudioInterleaveClass;
typedef struct _GstAudioInterleavePad GstAudioInterleavePad;
typedef struct _GstAudioInterleavePadClass GstAudioInterleavePadClass;
typedef void (*GstInterleaveFunc) (gpointer out, gpointer in, guint stride,
guint nframes);
/**
* GstAudioInterleave:
*
* The GstAudioInterleave object structure.
*/
struct _GstAudioInterleave {
GstAudioAggregator parent;
gint padcounter;
guint channels; /* object lock */
GstCaps *sinkcaps;
GValueArray *channel_positions;
GValueArray *input_channel_positions;
gboolean channel_positions_from_input;
gint default_channels_ordering_map[64];
GstInterleaveFunc func;
};
struct _GstAudioInterleaveClass {
GstAudioAggregatorClass parent_class;
};
GType gst_audio_interleave_get_type (void);
#define GST_TYPE_AUDIO_INTERLEAVE_PAD (gst_audio_interleave_pad_get_type())
#define GST_AUDIO_INTERLEAVE_PAD(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUDIO_INTERLEAVE_PAD,GstAudioInterleavePad))
#define GST_IS_AUDIO_INTERLEAVE_PAD(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIO_INTERLEAVE_PAD))
#define GST_AUDIO_INTERLEAVE_PAD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass) ,GST_TYPE_AUDIO_INTERLEAVE_PAD,GstAudioInterleavePadClass))
#define GST_IS_AUDIO_INTERLEAVE_PAD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass) ,GST_TYPE_AUDIO_INTERLEAVE_PAD))
#define GST_AUDIO_INTERLEAVE_PAD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj) ,GST_TYPE_AUDIO_INTERLEAVE_PAD,GstAudioInterleavePadClass))
struct _GstAudioInterleavePad {
GstAudioAggregatorPad parent;
guint channel;
};
struct _GstAudioInterleavePadClass {
GstAudioAggregatorPadClass parent_class;
};
GType gst_audio_interleave_pad_get_type (void);
G_END_DECLS
#endif /* __GST_AUDIO_INTERLEAVE_H__ */
/* GStreamer
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
* 2001 Thomas <thomas@apestaart.org>
* 2005,2006 Wim Taymans <wim@fluendo.com>
* 2013 Sebastian Dröge <sebastian@centricular.com>
*
* audiomixer.c: AudioMixer element, N in, one out, samples are added
*
* 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.
*/
/**
* SECTION:element-audiomixer
* @title: audiomixer
*
* The audiomixer allows to mix several streams into one by adding the data.
* Mixed data is clamped to the min/max values of the data format.
*
* Unlike the adder element audiomixer properly synchronises all input streams
* and also handles live inputs such as capture sources or RTP properly.
*
* The audiomixer element can accept any sort of raw audio data, it will
* be converted to the target format if necessary, with the exception
* of the sample rate, which has to be identical to either what downstream
* expects, or the sample rate of the first configured pad. Use a capsfilter
* after the audiomixer element if you want to precisely control the format
* that comes out of the audiomixer, which supports changing the format of
* its output while playing.
*
* If you want to control the manner in which incoming data gets converted,
* see the #GstAudioAggregatorPad:converter-config property, which will let
* you for example change the way in which channels may get remapped.
*
* The input pads are from a GstPad subclass and have additional
* properties to mute each pad individually and set the volume:
*
* * "mute": Whether to mute the pad or not (#gboolean)
* * "volume": The volume of the pad, between 0.0 and 10.0 (#gdouble)
*
* ## Example launch line
* |[
* gst-launch-1.0 audiotestsrc freq=100 ! audiomixer name=mix ! audioconvert ! alsasink audiotestsrc freq=500 ! mix.
* ]| This pipeline produces two sine waves mixed together.
*
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "gstaudiomixer.h"
#include <gst/audio/audio.h>
#include <string.h> /* strcmp */
#include "gstaudiomixerorc.h"
#include "gstaudiointerleave.h"
#define GST_CAT_DEFAULT gst_audiomixer_debug
GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
#define DEFAULT_PAD_VOLUME (1.0)
#define DEFAULT_PAD_MUTE (FALSE)
/* some defines for audio processing */
/* the volume factor is a range from 0.0 to (arbitrary) VOLUME_MAX_DOUBLE = 10.0
* we map 1.0 to VOLUME_UNITY_INT*
*/
#define VOLUME_UNITY_INT8 8 /* internal int for unity 2^(8-5) */
#define VOLUME_UNITY_INT8_BIT_SHIFT 3 /* number of bits to shift for unity */
#define VOLUME_UNITY_INT16 2048 /* internal int for unity 2^(16-5) */
#define VOLUME_UNITY_INT16_BIT_SHIFT 11 /* number of bits to shift for unity */
#define VOLUME_UNITY_INT24 524288 /* internal int for unity 2^(24-5) */
#define VOLUME_UNITY_INT24_BIT_SHIFT 19 /* number of bits to shift for unity */
#define VOLUME_UNITY_INT32 134217728 /* internal int for unity 2^(32-5) */
#define VOLUME_UNITY_INT32_BIT_SHIFT 27
enum
{
PROP_PAD_0,
PROP_PAD_VOLUME,
PROP_PAD_MUTE
};
G_DEFINE_TYPE (GstAudioMixerPad, gst_audiomixer_pad,
GST_TYPE_AUDIO_AGGREGATOR_CONVERT_PAD);
static void
gst_audiomixer_pad_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec)
{
GstAudioMixerPad *pad = GST_AUDIO_MIXER_PAD (object);
switch (prop_id) {
case PROP_PAD_VOLUME:
g_value_set_double (value, pad->volume);
break;
case PROP_PAD_MUTE:
g_value_set_boolean (value, pad->mute);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
gst_audiomixer_pad_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec)
{
GstAudioMixerPad *pad = GST_AUDIO_MIXER_PAD (object);
switch (prop_id) {
case PROP_PAD_VOLUME:
GST_OBJECT_LOCK (pad);
pad->volume = g_value_get_double (value);
pad->volume_i8 = pad->volume * VOLUME_UNITY_INT8;
pad->volume_i16 = pad->volume * VOLUME_UNITY_INT16;
pad->volume_i32 = pad->volume * VOLUME_UNITY_INT32;
GST_OBJECT_UNLOCK (pad);
break;
case PROP_PAD_MUTE:
GST_OBJECT_LOCK (pad);
pad->mute = g_value_get_boolean (value);
GST_OBJECT_UNLOCK (pad);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
gst_audiomixer_pad_class_init (GstAudioMixerPadClass * klass)
{
GObjectClass *gobject_class = (GObjectClass *) klass;
gobject_class->set_property = gst_audiomixer_pad_set_property;
gobject_class->get_property = gst_audiomixer_pad_get_property;
g_object_class_install_property (gobject_class, PROP_PAD_VOLUME,
g_param_spec_double ("volume", "Volume", "Volume of this pad",
0.0, 10.0, DEFAULT_PAD_VOLUME,
G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_PAD_MUTE,
g_param_spec_boolean ("mute", "Mute", "Mute this pad",
DEFAULT_PAD_MUTE,
G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE | G_PARAM_STATIC_STRINGS));
}
static void
gst_audiomixer_pad_init (GstAudioMixerPad * pad)
{
pad->volume = DEFAULT_PAD_VOLUME;
pad->mute = DEFAULT_PAD_MUTE;
}
enum
{
PROP_0
};
/* These are the formats we can mix natively */
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
#define CAPS \
GST_AUDIO_CAPS_MAKE ("{ S32LE, U32LE, S16LE, U16LE, S8, U8, F32LE, F64LE }") \
", layout = interleaved"
#else
#define CAPS \
GST_AUDIO_CAPS_MAKE ("{ S32BE, U32BE, S16BE, U16BE, S8, U8, F32BE, F64BE }") \
", layout = interleaved"
#endif
static GstStaticPadTemplate gst_audiomixer_src_template =
GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (CAPS)
);
#define SINK_CAPS \
GST_STATIC_CAPS (GST_AUDIO_CAPS_MAKE (GST_AUDIO_FORMATS_ALL) \
", layout=interleaved")
static GstStaticPadTemplate gst_audiomixer_sink_template =
GST_STATIC_PAD_TEMPLATE ("sink_%u",
GST_PAD_SINK,
GST_PAD_REQUEST,
SINK_CAPS);
static void gst_audiomixer_child_proxy_init (gpointer g_iface,
gpointer iface_data);
#define gst_audiomixer_parent_class parent_class
G_DEFINE_TYPE_WITH_CODE (GstAudioMixer, gst_audiomixer,
GST_TYPE_AUDIO_AGGREGATOR, G_IMPLEMENT_INTERFACE (GST_TYPE_CHILD_PROXY,
gst_audiomixer_child_proxy_init));
static GstPad *gst_audiomixer_request_new_pad (GstElement * element,
GstPadTemplate * temp, const gchar * req_name, const GstCaps * caps);
static void gst_audiomixer_release_pad (GstElement * element, GstPad * pad);
static gboolean
gst_audiomixer_aggregate_one_buffer (GstAudioAggregator * aagg,
GstAudioAggregatorPad * aaggpad, GstBuffer * inbuf, guint in_offset,
GstBuffer * outbuf, guint out_offset, guint num_samples);
static void
gst_audiomixer_class_init (GstAudioMixerClass * klass)
{
GstElementClass *gstelement_class = (GstElementClass *) klass;
GstAudioAggregatorClass *aagg_class = (GstAudioAggregatorClass *) klass;
gst_element_class_add_static_pad_template (gstelement_class,
&gst_audiomixer_src_template);
gst_element_class_add_static_pad_template_with_gtype (gstelement_class,
&gst_audiomixer_sink_template, GST_TYPE_AUDIO_MIXER_PAD);
gst_element_class_set_static_metadata (gstelement_class, "AudioMixer",
"Generic/Audio", "Mixes multiple audio streams",
"Sebastian Dröge <sebastian@centricular.com>");
gstelement_class->request_new_pad =
GST_DEBUG_FUNCPTR (gst_audiomixer_request_new_pad);
gstelement_class->release_pad =
GST_DEBUG_FUNCPTR (gst_audiomixer_release_pad);
aagg_class->aggregate_one_buffer = gst_audiomixer_aggregate_one_buffer;
}
static void
gst_audiomixer_init (GstAudioMixer * audiomixer)
{
}
static GstPad *
gst_audiomixer_request_new_pad (GstElement * element, GstPadTemplate * templ,
const gchar * req_name, const GstCaps * caps)
{
GstAudioMixerPad *newpad;
newpad = (GstAudioMixerPad *)
GST_ELEMENT_CLASS (parent_class)->request_new_pad (element,
templ, req_name, caps);
if (newpad == NULL)
goto could_not_create;
gst_child_proxy_child_added (GST_CHILD_PROXY (element), G_OBJECT (newpad),
GST_OBJECT_NAME (newpad));
return GST_PAD_CAST (newpad);