summaryrefslogtreecommitdiff
path: root/ext/soundtouch/gstpitch.cc
diff options
context:
space:
mode:
authorSebastian Dröge <slomo@circular-chaos.org>2008-01-27 05:56:04 +0000
committerSebastian Dröge <slomo@circular-chaos.org>2008-01-27 05:56:04 +0000
commit27fbdb97d126d2b29611778362e73b03dc75e472 (patch)
tree81bce3a08b70b404f65e758acd4720e2a530ecda /ext/soundtouch/gstpitch.cc
parentfe38597aee1bda146e2ca9c1b1dbc8ec04dc4d50 (diff)
ext/soundtouch/: Add BPM detection plugin based on SoundTouch's libBPM.
Original commit message from CVS: * ext/soundtouch/Makefile.am: * ext/soundtouch/gstbpmdetect.cc: * ext/soundtouch/gstbpmdetect.hh: * ext/soundtouch/plugin.c: (plugin_init): Add BPM detection plugin based on SoundTouch's libBPM. * ext/soundtouch/gstpitch.cc: Allow sample rates until MAX instead of only 48kHz and remove the buffer-frames field from that caps. Clear the remaining samples completely when necessary to get into a clean state again.
Diffstat (limited to 'ext/soundtouch/gstpitch.cc')
-rw-r--r--ext/soundtouch/gstpitch.cc29
1 files changed, 9 insertions, 20 deletions
diff --git a/ext/soundtouch/gstpitch.cc b/ext/soundtouch/gstpitch.cc
index 83c043e9b..7ee726f03 100644
--- a/ext/soundtouch/gstpitch.cc
+++ b/ext/soundtouch/gstpitch.cc
@@ -62,11 +62,10 @@ enum
#define SUPPORTED_CAPS \
GST_STATIC_CAPS( \
"audio/x-raw-float, " \
- "rate = (int) [ 8000, 48000 ], " \
+ "rate = (int) [ 8000, MAX ], " \
"channels = (int) [ 1, 2 ], " \
"endianness = (int) BYTE_ORDER, " \
- "width = (int) 32, " \
- "buffer-frames = (int) [ 0, MAX ]" \
+ "width = (int) 32" \
)
static GstStaticPadTemplate gst_pitch_sink_template =
@@ -124,6 +123,9 @@ gst_pitch_class_init (GstPitchClass * klass)
gobject_class = G_OBJECT_CLASS (klass);
element_class = GST_ELEMENT_CLASS (klass);
+ GST_DEBUG_CATEGORY_INIT (pitch_debug, "pitch", 0,
+ "audio pitch control element");
+
gobject_class->set_property = gst_pitch_set_property;
gobject_class->get_property = gst_pitch_get_property;
gobject_class->dispose = GST_DEBUG_FUNCPTR (gst_pitch_dispose);
@@ -725,9 +727,11 @@ gst_pitch_sink_event (GstPad * pad, GstEvent * event)
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_FLUSH_STOP:
gst_pitch_flush_buffer (pitch, FALSE);
+ pitch->priv->st->clear ();
break;
case GST_EVENT_EOS:
gst_pitch_flush_buffer (pitch, TRUE);
+ pitch->priv->st->clear ();
break;
case GST_EVENT_NEWSEGMENT:
if (!gst_pitch_process_segment (pitch, &event)) {
@@ -737,6 +741,7 @@ gst_pitch_sink_event (GstPad * pad, GstEvent * event)
GST_PITCH_GET_PRIVATE (pitch)->pending_segment = event;
event = NULL;
}
+ pitch->priv->st->clear ();
break;
default:
break;
@@ -812,6 +817,7 @@ gst_pitch_change_state (GstElement * element, GstStateChange transition)
case GST_STATE_CHANGE_READY_TO_PAUSED:
pitch->next_buffer_time = 0;
pitch->next_buffer_offset = 0;
+ pitch->priv->st->clear ();
break;
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
break;
@@ -839,20 +845,3 @@ gst_pitch_change_state (GstElement * element, GstStateChange transition)
return ret;
}
-
-static gboolean
-plugin_init (GstPlugin * plugin)
-{
- gst_controller_init (NULL, NULL);
-
- GST_DEBUG_CATEGORY_INIT (pitch_debug, "pitch", 0,
- "audio pitch control element");
-
- return gst_element_register (plugin, "pitch", GST_RANK_NONE, GST_TYPE_PITCH);
-}
-
-GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- "soundtouch",
- "Audio Pitch Controller",
- plugin_init, VERSION, "LGPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)