[gst-devel] [gst-cvs] slomo gst-plugins-bad: gst-plugins-bad/ gst-plugins-bad/ext/soundtouch/

Sebastian Dröge slomo at circular-chaos.org
Mon Jan 28 08:06:27 CET 2008


Am Sonntag, den 27.01.2008, 20:15 +0200 schrieb Stefan Kost:
> hi,
> 
> slomo at kemper.freedesktop.org schrieb:
> > CVS Root:       /cvs/gstreamer
> > Module:         gst-plugins-bad
> > Changes by:     slomo
> > Date:           Sun Jan 27 2008  05:56:18 UTC
> > 
> > Log message:
> > * 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.
> 
> cool plugin! some comments for gst_bpm_detect_transform_ip
> 
>   if (filter->format.channels == 0 || filter->format.rate == 0) {
>     GST_ERROR_OBJECT (bpm_detect, "No channels or rate set yet");
>     return GST_FLOW_ERROR;
>   }
> 
>   nsamples = GST_BUFFER_SIZE (in) / (4 * filter->format.channels);
> 
>   if (!bpm_detect->priv->detect)
>     bpm_detect->priv->detect =
>         new BPMDetect (filter->format.channels, filter->format.rate);
> 
> I would change that to
> 
>   if (G_UNLIKELY(!bpm_detect->priv->detect)) {
>     if (filter->format.channels == 0 || filter->format.rate == 0) {
>       GST_ERROR_OBJECT (bpm_detect, "No channels or rate set yet");
>       return GST_FLOW_ERROR;
>     }
>     bpm_detect->priv->detect =
>         new BPMDetect (filter->format.channels, filter->format.rate);
>   }
> 
>   nsamples = GST_BUFFER_SIZE (in) / (4 * filter->format.channels);

Why? :) I'll change it later because it looks a bit cleaner but is there
another reason? ;)

> Another one:
> 
>   data = (gfloat *) g_memdup (GST_BUFFER_DATA (in), GST_BUFFER_SIZE (in));
>   bpm_detect->priv->detect->inputSamples (data, nsamples);
>   g_free (data);
> 
> why do you need to copy?

Because BPMDetect downmixes from stereo to mono when getting stereo. And
the result is placed in the first half of the input buffer.

For mono it's unnecessary though. I'll change that later...
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Dies ist ein digital signierter Nachrichtenteil
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20080128/f322059b/attachment.pgp>


More information about the gstreamer-devel mailing list