summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>2012-03-18 18:32:36 +0100
committerMark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>2012-03-18 18:32:36 +0100
commit3354fda883efd6dadc4087319b19a0e26e161521 (patch)
tree59406c9aec29672cec4ff84395d2047e4c5b686b
parent497ba9d2c513cdd758e7f8882cbf59a96045d2b5 (diff)
downloadgstreamer-plugins-bad-3354fda883efd6dadc4087319b19a0e26e161521.tar.gz
removesilence: port to 0.11
-rw-r--r--configure.ac2
-rw-r--r--gst/removesilence/Makefile.am2
-rw-r--r--gst/removesilence/gstremovesilence.c65
3 files changed, 33 insertions, 36 deletions
diff --git a/configure.ac b/configure.ac
index 3ea1e3a23..0e04f6d82 100644
--- a/configure.ac
+++ b/configure.ac
@@ -306,7 +306,7 @@ GST_PLUGINS_NONPORTED=" aiff asfmux \
hdvparse hls id3tag inter interlace ivfparse jpegformat jp2kdecimator \
kate liveadder legacyresample librfb mpegtsmux \
mpegpsmux mve mxf mythtv nsf nuvdemux \
- patchdetect pnm rawparse real removesilence scaletempo \
+ patchdetect pnm rawparse real scaletempo \
sdi segmentclip siren speed subenc stereo tta videofilters \
videomeasure videosignal vmnc \
decklink fbdev linsys shm vcd \
diff --git a/gst/removesilence/Makefile.am b/gst/removesilence/Makefile.am
index c022ac133..23e0f702a 100644
--- a/gst/removesilence/Makefile.am
+++ b/gst/removesilence/Makefile.am
@@ -2,7 +2,7 @@
plugin_LTLIBRARIES = libgstremovesilence.la
libgstremovesilence_la_SOURCES = gstremovesilence.c vad_private.c
-libgstremovesilence_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS)
+libgstremovesilence_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS)
libgstremovesilence_la_LIBADD = $(GST_PLUGINS_BASE_LIBS) $(GST_BASE_LIBS) $(GST_LIBS)
libgstremovesilence_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
libgstremovesilence_la_LIBTOOLFLAGS = --tag=disable-static
diff --git a/gst/removesilence/gstremovesilence.c b/gst/removesilence/gstremovesilence.c
index edb9af3ab..f41328cbf 100644
--- a/gst/removesilence/gstremovesilence.c
+++ b/gst/removesilence/gstremovesilence.c
@@ -37,7 +37,7 @@
#include <gst/gst.h>
#include <gst/base/gstbasetransform.h>
-#include <gst/controller/gstcontroller.h>
+#include <gst/audio/audio.h>
#include "gstremovesilence.h"
@@ -64,26 +64,26 @@ enum
static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- GST_STATIC_CAPS
- ("audio/x-raw-int, "
- "rate=[1, MAX], channels=1, endianness=BYTE_ORDER, "
- "width=16, depth=16, signed=true"));
+ GST_STATIC_CAPS ("audio/x-raw, "
+ "format = (string) " GST_AUDIO_NE (S16) ", "
+ "layout = (string) interleaved, "
+ "rate = (int) [ 1, MAX ], " "channels = (int) 1"));
static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
- GST_STATIC_CAPS
- ("audio/x-raw-int, "
- "rate=[1, MAX], channels=1, endianness=BYTE_ORDER, "
- "width=16, depth=16, signed=true"));
+ GST_STATIC_CAPS ("audio/x-raw, "
+ "format = (string) " GST_AUDIO_NE (S16) ", "
+ "layout = (string) interleaved, "
+ "rate = (int) [ 1, MAX ], " "channels = (int) 1"));
#define DEBUG_INIT(bla) \
GST_DEBUG_CATEGORY_INIT (gst_remove_silence_debug, "removesilence", 0, "removesilence element")
-GST_BOILERPLATE_FULL (GstRemoveSilence, gst_remove_silence, GstBaseTransform,
- GST_TYPE_BASE_TRANSFORM, DEBUG_INIT);
-
+#define gst_remove_silence_parent_class parent_class
+G_DEFINE_TYPE_WITH_CODE (GstRemoveSilence, gst_remove_silence,
+ GST_TYPE_BASE_TRANSFORM, DEBUG_INIT (0));
static void gst_remove_silence_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
@@ -97,31 +97,16 @@ static void gst_remove_silence_reset (GstRemoveSilence * filter);
/* GObject vmethod implementations */
-static void
-gst_remove_silence_base_init (gpointer gclass)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (gclass);
-
- gst_element_class_set_details_simple (element_class,
- "RemoveSilence",
- "Filter/Effect/Audio",
- "Removes all the silence periods from the audio stream.",
- "Tiago Katcipis <tiagokatcipis@gmail.com>\n \
- Paulo Pizarro <paulo.pizarro@gmail.com>");
-
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&src_template));
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&sink_template));
-}
-
/* initialize the removesilence's class */
static void
gst_remove_silence_class_init (GstRemoveSilenceClass * klass)
{
GObjectClass *gobject_class;
+ GstElementClass *gstelement_class;
gobject_class = (GObjectClass *) klass;
+ gstelement_class = (GstElementClass *) klass;
+
gobject_class->finalize = gst_remove_silence_finalize;
gobject_class->set_property = gst_remove_silence_set_property;
gobject_class->get_property = gst_remove_silence_get_property;
@@ -137,6 +122,17 @@ gst_remove_silence_class_init (GstRemoveSilenceClass * klass)
"Set the hysteresis (on samples) used on the internal VAD",
1, G_MAXUINT64, DEFAULT_VAD_HYSTERESIS, G_PARAM_READWRITE));
+ gst_element_class_set_details_simple (gstelement_class,
+ "RemoveSilence",
+ "Filter/Effect/Audio",
+ "Removes all the silence periods from the audio stream.",
+ "Tiago Katcipis <tiagokatcipis@gmail.com>\n \
+ Paulo Pizarro <paulo.pizarro@gmail.com>");
+
+ gst_element_class_add_pad_template (gstelement_class,
+ gst_static_pad_template_get (&src_template));
+ gst_element_class_add_pad_template (gstelement_class,
+ gst_static_pad_template_get (&sink_template));
GST_BASE_TRANSFORM_CLASS (klass)->transform_ip =
GST_DEBUG_FUNCPTR (gst_remove_silence_transform_ip);
@@ -148,8 +144,7 @@ gst_remove_silence_class_init (GstRemoveSilenceClass * klass)
* initialize instance structure
*/
static void
-gst_remove_silence_init (GstRemoveSilence * filter,
- GstRemoveSilenceClass * gclass)
+gst_remove_silence_init (GstRemoveSilence * filter)
{
filter->vad = vad_new (DEFAULT_VAD_HYSTERESIS);
filter->remove = FALSE;
@@ -226,12 +221,14 @@ gst_remove_silence_transform_ip (GstBaseTransform * trans, GstBuffer * inbuf)
{
GstRemoveSilence *filter = NULL;
int frame_type;
+ GstMapInfo map;
filter = GST_REMOVE_SILENCE (trans);
+ gst_buffer_map (inbuf, &map, GST_MAP_READ);
frame_type =
- vad_update (filter->vad, (gint16 *) GST_BUFFER_DATA (inbuf),
- GST_BUFFER_SIZE (inbuf) / sizeof (gint16));
+ vad_update (filter->vad, (gint16 *) map.data, map.size / sizeof (gint16));
+ gst_buffer_unmap (inbuf, &map);
if (frame_type == VAD_SILENCE) {