2002-03-20 21:45:03 +00:00
|
|
|
/* GStreamer
|
2001-12-22 23:27:31 +00:00
|
|
|
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
|
2006-05-20 22:42:15 +00:00
|
|
|
* <2006> Stefan Kost <ensonic@users.sf.net>
|
2001-12-22 23:27:31 +00:00
|
|
|
*
|
|
|
|
* 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., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
gst/spectrum/Makefile.am: Link to base libraries
Original commit message from CVS:
* gst/spectrum/Makefile.am:
Link to base libraries
* gst/spectrum/demo-osssrc.c: (main):
use new threshhold property
* gst/spectrum/gstspectrum.c: (gst_spectrum_class_init),
(gst_spectrum_init), (gst_spectrum_dispose),
(gst_spectrum_set_property), (gst_spectrum_set_sink_caps),
(gst_spectrum_get_sink_caps), (gst_spectrum_chain),
(gst_spectrum_change_state):
* gst/spectrum/gstspectrum.h:
Use gst_adapter, support multiple-channels, add threshold property for
result, add docs, fix resulting spectrum range (was including mirrored
results)
2006-05-21 16:23:23 +00:00
|
|
|
/**
|
|
|
|
* SECTION:element-spectrum
|
|
|
|
*
|
|
|
|
* <refsect2>
|
|
|
|
* The Spectrum element analyzes the frequency spectrum of an audio signal.
|
gst/spectrum/: port to use message to get results, cleanly exit when closing the window
Original commit message from CVS:
* gst/spectrum/demo-audiotest.c: (on_window_destroy),
(draw_spectrum), (message_handler), (main):
* gst/spectrum/demo-osssrc.c: (on_window_destroy), (draw_spectrum),
(message_handler), (main):
port to use message to get results, cleanly exit when closing the window
* gst/spectrum/gstspectrum.c: (gst_spectrum_class_init),
(gst_spectrum_init), (gst_spectrum_dispose),
(gst_spectrum_set_property), (gst_spectrum_get_property),
(gst_spectrum_set_caps), (gst_spectrum_start),
(gst_spectrum_message_new), (gst_spectrum_transform_ip):
* gst/spectrum/gstspectrum.h:
port to derive from basetransform and send results via messages
(like level element)
2006-06-16 09:49:07 +00:00
|
|
|
* If <link linkend="GstSpectrum--message">message property</link> is #TRUE it
|
|
|
|
* sends analysis results as application message named
|
|
|
|
* <classname>"spectrum"</classname> after each interval of time given
|
|
|
|
* by the <link linkend="GstSpectrum--interval">interval property</link>.
|
|
|
|
* The message's structure contains two fields:
|
|
|
|
* <itemizedlist>
|
|
|
|
* <listitem>
|
|
|
|
* <para>
|
|
|
|
* #GstClockTime
|
|
|
|
* <classname>"endtime"</classname>:
|
|
|
|
* the end time of the buffer that triggered the message
|
|
|
|
* </para>
|
|
|
|
* </listitem>
|
|
|
|
* <listitem>
|
|
|
|
* <para>
|
|
|
|
* #GstValueList of #guchar
|
|
|
|
* <classname>"spectrum"</classname>:
|
|
|
|
* the level for each frequency band. A value of 0 maps to the
|
|
|
|
* db value given by the
|
|
|
|
* <link linkend="GstSpectrum--threshold">threshold property.</link>.
|
|
|
|
* </para>
|
|
|
|
* </listitem>
|
gst/spectrum/Makefile.am: Link to base libraries
Original commit message from CVS:
* gst/spectrum/Makefile.am:
Link to base libraries
* gst/spectrum/demo-osssrc.c: (main):
use new threshhold property
* gst/spectrum/gstspectrum.c: (gst_spectrum_class_init),
(gst_spectrum_init), (gst_spectrum_dispose),
(gst_spectrum_set_property), (gst_spectrum_set_sink_caps),
(gst_spectrum_get_sink_caps), (gst_spectrum_chain),
(gst_spectrum_change_state):
* gst/spectrum/gstspectrum.h:
Use gst_adapter, support multiple-channels, add threshold property for
result, add docs, fix resulting spectrum range (was including mirrored
results)
2006-05-21 16:23:23 +00:00
|
|
|
*
|
gst/spectrum/: port to use message to get results, cleanly exit when closing the window
Original commit message from CVS:
* gst/spectrum/demo-audiotest.c: (on_window_destroy),
(draw_spectrum), (message_handler), (main):
* gst/spectrum/demo-osssrc.c: (on_window_destroy), (draw_spectrum),
(message_handler), (main):
port to use message to get results, cleanly exit when closing the window
* gst/spectrum/gstspectrum.c: (gst_spectrum_class_init),
(gst_spectrum_init), (gst_spectrum_dispose),
(gst_spectrum_set_property), (gst_spectrum_get_property),
(gst_spectrum_set_caps), (gst_spectrum_start),
(gst_spectrum_message_new), (gst_spectrum_transform_ip):
* gst/spectrum/gstspectrum.h:
port to derive from basetransform and send results via messages
(like level element)
2006-06-16 09:49:07 +00:00
|
|
|
* This element cannot be used with the gst-launch command in a sensible way.
|
|
|
|
* The included demo shows how to use it in an application.
|
gst/spectrum/Makefile.am: Link to base libraries
Original commit message from CVS:
* gst/spectrum/Makefile.am:
Link to base libraries
* gst/spectrum/demo-osssrc.c: (main):
use new threshhold property
* gst/spectrum/gstspectrum.c: (gst_spectrum_class_init),
(gst_spectrum_init), (gst_spectrum_dispose),
(gst_spectrum_set_property), (gst_spectrum_set_sink_caps),
(gst_spectrum_get_sink_caps), (gst_spectrum_chain),
(gst_spectrum_change_state):
* gst/spectrum/gstspectrum.h:
Use gst_adapter, support multiple-channels, add threshold property for
result, add docs, fix resulting spectrum range (was including mirrored
results)
2006-05-21 16:23:23 +00:00
|
|
|
*
|
|
|
|
* Last reviewed on 2006-05-21 (0.10.3)
|
gst/spectrum/: port to use message to get results, cleanly exit when closing the window
Original commit message from CVS:
* gst/spectrum/demo-audiotest.c: (on_window_destroy),
(draw_spectrum), (message_handler), (main):
* gst/spectrum/demo-osssrc.c: (on_window_destroy), (draw_spectrum),
(message_handler), (main):
port to use message to get results, cleanly exit when closing the window
* gst/spectrum/gstspectrum.c: (gst_spectrum_class_init),
(gst_spectrum_init), (gst_spectrum_dispose),
(gst_spectrum_set_property), (gst_spectrum_get_property),
(gst_spectrum_set_caps), (gst_spectrum_start),
(gst_spectrum_message_new), (gst_spectrum_transform_ip):
* gst/spectrum/gstspectrum.h:
port to derive from basetransform and send results via messages
(like level element)
2006-06-16 09:49:07 +00:00
|
|
|
* </refsect2>
|
gst/spectrum/Makefile.am: Link to base libraries
Original commit message from CVS:
* gst/spectrum/Makefile.am:
Link to base libraries
* gst/spectrum/demo-osssrc.c: (main):
use new threshhold property
* gst/spectrum/gstspectrum.c: (gst_spectrum_class_init),
(gst_spectrum_init), (gst_spectrum_dispose),
(gst_spectrum_set_property), (gst_spectrum_set_sink_caps),
(gst_spectrum_get_sink_caps), (gst_spectrum_chain),
(gst_spectrum_change_state):
* gst/spectrum/gstspectrum.h:
Use gst_adapter, support multiple-channels, add threshold property for
result, add docs, fix resulting spectrum range (was including mirrored
results)
2006-05-21 16:23:23 +00:00
|
|
|
*/
|
2001-12-22 23:27:31 +00:00
|
|
|
|
2003-06-29 19:46:12 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
2001-12-22 23:27:31 +00:00
|
|
|
#include <string.h>
|
gst/spectrum/: port to use message to get results, cleanly exit when closing the window
Original commit message from CVS:
* gst/spectrum/demo-audiotest.c: (on_window_destroy),
(draw_spectrum), (message_handler), (main):
* gst/spectrum/demo-osssrc.c: (on_window_destroy), (draw_spectrum),
(message_handler), (main):
port to use message to get results, cleanly exit when closing the window
* gst/spectrum/gstspectrum.c: (gst_spectrum_class_init),
(gst_spectrum_init), (gst_spectrum_dispose),
(gst_spectrum_set_property), (gst_spectrum_get_property),
(gst_spectrum_set_caps), (gst_spectrum_start),
(gst_spectrum_message_new), (gst_spectrum_transform_ip):
* gst/spectrum/gstspectrum.h:
port to derive from basetransform and send results via messages
(like level element)
2006-06-16 09:49:07 +00:00
|
|
|
#include <gst/audio/audio.h>
|
2001-12-22 23:27:31 +00:00
|
|
|
#include "gstspectrum.h"
|
|
|
|
|
2006-05-20 22:42:15 +00:00
|
|
|
GST_DEBUG_CATEGORY_STATIC (gst_spectrum_debug);
|
|
|
|
#define GST_CAT_DEFAULT gst_spectrum_debug
|
|
|
|
|
2002-09-18 19:02:51 +00:00
|
|
|
/* elementfactory information */
|
2006-04-25 21:56:38 +00:00
|
|
|
static const GstElementDetails gst_spectrum_details =
|
2004-03-14 22:34:33 +00:00
|
|
|
GST_ELEMENT_DETAILS ("Spectrum analyzer",
|
|
|
|
"Filter/Analyzer/Audio",
|
|
|
|
"Run an FFT on the audio signal, output spectrum data",
|
2006-05-21 16:41:44 +00:00
|
|
|
"Erik Walthinsen <omega@cse.ogi.edu>, "
|
2006-05-20 22:42:15 +00:00
|
|
|
"Stefan Kost <ensonic@users.sf.net>");
|
|
|
|
|
|
|
|
static GstStaticPadTemplate sink_template_factory =
|
|
|
|
GST_STATIC_PAD_TEMPLATE ("sink",
|
|
|
|
GST_PAD_SINK,
|
|
|
|
GST_PAD_ALWAYS,
|
|
|
|
GST_STATIC_CAPS ("audio/x-raw-int, "
|
|
|
|
"rate = (int) [ 1, MAX ], "
|
gst/spectrum/Makefile.am: Link to base libraries
Original commit message from CVS:
* gst/spectrum/Makefile.am:
Link to base libraries
* gst/spectrum/demo-osssrc.c: (main):
use new threshhold property
* gst/spectrum/gstspectrum.c: (gst_spectrum_class_init),
(gst_spectrum_init), (gst_spectrum_dispose),
(gst_spectrum_set_property), (gst_spectrum_set_sink_caps),
(gst_spectrum_get_sink_caps), (gst_spectrum_chain),
(gst_spectrum_change_state):
* gst/spectrum/gstspectrum.h:
Use gst_adapter, support multiple-channels, add threshold property for
result, add docs, fix resulting spectrum range (was including mirrored
results)
2006-05-21 16:23:23 +00:00
|
|
|
"channels = (int) [1, MAX], "
|
2006-05-20 22:42:15 +00:00
|
|
|
"endianness = (int) BYTE_ORDER, "
|
|
|
|
"width = (int) 16, " "depth = (int) 16, " "signed = (boolean) true")
|
|
|
|
);
|
|
|
|
|
|
|
|
static GstStaticPadTemplate src_template_factory =
|
|
|
|
GST_STATIC_PAD_TEMPLATE ("src",
|
|
|
|
GST_PAD_SRC,
|
|
|
|
GST_PAD_ALWAYS,
|
gst/spectrum/: port to use message to get results, cleanly exit when closing the window
Original commit message from CVS:
* gst/spectrum/demo-audiotest.c: (on_window_destroy),
(draw_spectrum), (message_handler), (main):
* gst/spectrum/demo-osssrc.c: (on_window_destroy), (draw_spectrum),
(message_handler), (main):
port to use message to get results, cleanly exit when closing the window
* gst/spectrum/gstspectrum.c: (gst_spectrum_class_init),
(gst_spectrum_init), (gst_spectrum_dispose),
(gst_spectrum_set_property), (gst_spectrum_get_property),
(gst_spectrum_set_caps), (gst_spectrum_start),
(gst_spectrum_message_new), (gst_spectrum_transform_ip):
* gst/spectrum/gstspectrum.h:
port to derive from basetransform and send results via messages
(like level element)
2006-06-16 09:49:07 +00:00
|
|
|
GST_STATIC_CAPS ("audio/x-raw-int, "
|
|
|
|
"rate = (int) [ 1, MAX ], "
|
|
|
|
"channels = (int) [1, MAX], "
|
|
|
|
"endianness = (int) BYTE_ORDER, "
|
|
|
|
"width = (int) 16, " "depth = (int) 16, " "signed = (boolean) true")
|
|
|
|
);
|
2001-12-22 23:27:31 +00:00
|
|
|
|
gst/spectrum/: port to use message to get results, cleanly exit when closing the window
Original commit message from CVS:
* gst/spectrum/demo-audiotest.c: (on_window_destroy),
(draw_spectrum), (message_handler), (main):
* gst/spectrum/demo-osssrc.c: (on_window_destroy), (draw_spectrum),
(message_handler), (main):
port to use message to get results, cleanly exit when closing the window
* gst/spectrum/gstspectrum.c: (gst_spectrum_class_init),
(gst_spectrum_init), (gst_spectrum_dispose),
(gst_spectrum_set_property), (gst_spectrum_get_property),
(gst_spectrum_set_caps), (gst_spectrum_start),
(gst_spectrum_message_new), (gst_spectrum_transform_ip):
* gst/spectrum/gstspectrum.h:
port to derive from basetransform and send results via messages
(like level element)
2006-06-16 09:49:07 +00:00
|
|
|
/* Spectrum properties */
|
2007-03-06 13:57:55 +00:00
|
|
|
#define DEFAULT_SIGNAL_SPECTRUM TRUE
|
|
|
|
#define DEFAULT_SIGNAL_INTERVAL (GST_SECOND / 10)
|
|
|
|
#define DEFAULT_BANDS 128
|
|
|
|
#define DEFAULT_THRESHOLD -60
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
enum
|
|
|
|
{
|
gst/spectrum/: port to use message to get results, cleanly exit when closing the window
Original commit message from CVS:
* gst/spectrum/demo-audiotest.c: (on_window_destroy),
(draw_spectrum), (message_handler), (main):
* gst/spectrum/demo-osssrc.c: (on_window_destroy), (draw_spectrum),
(message_handler), (main):
port to use message to get results, cleanly exit when closing the window
* gst/spectrum/gstspectrum.c: (gst_spectrum_class_init),
(gst_spectrum_init), (gst_spectrum_dispose),
(gst_spectrum_set_property), (gst_spectrum_get_property),
(gst_spectrum_set_caps), (gst_spectrum_start),
(gst_spectrum_message_new), (gst_spectrum_transform_ip):
* gst/spectrum/gstspectrum.h:
port to derive from basetransform and send results via messages
(like level element)
2006-06-16 09:49:07 +00:00
|
|
|
PROP_0,
|
|
|
|
PROP_SIGNAL_SPECTRUM,
|
|
|
|
PROP_SIGNAL_INTERVAL,
|
|
|
|
PROP_BANDS,
|
|
|
|
PROP_THRESHOLD
|
2001-12-22 23:27:31 +00:00
|
|
|
};
|
|
|
|
|
gst/spectrum/: port to use message to get results, cleanly exit when closing the window
Original commit message from CVS:
* gst/spectrum/demo-audiotest.c: (on_window_destroy),
(draw_spectrum), (message_handler), (main):
* gst/spectrum/demo-osssrc.c: (on_window_destroy), (draw_spectrum),
(message_handler), (main):
port to use message to get results, cleanly exit when closing the window
* gst/spectrum/gstspectrum.c: (gst_spectrum_class_init),
(gst_spectrum_init), (gst_spectrum_dispose),
(gst_spectrum_set_property), (gst_spectrum_get_property),
(gst_spectrum_set_caps), (gst_spectrum_start),
(gst_spectrum_message_new), (gst_spectrum_transform_ip):
* gst/spectrum/gstspectrum.h:
port to derive from basetransform and send results via messages
(like level element)
2006-06-16 09:49:07 +00:00
|
|
|
GST_BOILERPLATE (GstSpectrum, gst_spectrum, GstBaseTransform,
|
|
|
|
GST_TYPE_BASE_TRANSFORM);
|
2001-12-22 23:27:31 +00:00
|
|
|
|
2006-05-20 22:42:15 +00:00
|
|
|
static void gst_spectrum_dispose (GObject * object);
|
2004-03-14 22:34:33 +00:00
|
|
|
static void gst_spectrum_set_property (GObject * object, guint prop_id,
|
|
|
|
const GValue * value, GParamSpec * pspec);
|
gst/spectrum/: port to use message to get results, cleanly exit when closing the window
Original commit message from CVS:
* gst/spectrum/demo-audiotest.c: (on_window_destroy),
(draw_spectrum), (message_handler), (main):
* gst/spectrum/demo-osssrc.c: (on_window_destroy), (draw_spectrum),
(message_handler), (main):
port to use message to get results, cleanly exit when closing the window
* gst/spectrum/gstspectrum.c: (gst_spectrum_class_init),
(gst_spectrum_init), (gst_spectrum_dispose),
(gst_spectrum_set_property), (gst_spectrum_get_property),
(gst_spectrum_set_caps), (gst_spectrum_start),
(gst_spectrum_message_new), (gst_spectrum_transform_ip):
* gst/spectrum/gstspectrum.h:
port to derive from basetransform and send results via messages
(like level element)
2006-06-16 09:49:07 +00:00
|
|
|
static void gst_spectrum_get_property (GObject * object, guint prop_id,
|
|
|
|
GValue * value, GParamSpec * pspec);
|
|
|
|
static gboolean gst_spectrum_set_caps (GstBaseTransform * trans, GstCaps * in,
|
|
|
|
GstCaps * out);
|
|
|
|
static gboolean gst_spectrum_start (GstBaseTransform * trans);
|
2006-09-12 20:18:55 +00:00
|
|
|
static gboolean gst_spectrum_stop (GstBaseTransform * trans);
|
|
|
|
static gboolean gst_spectrum_event (GstBaseTransform * trans, GstEvent * event);
|
gst/spectrum/: port to use message to get results, cleanly exit when closing the window
Original commit message from CVS:
* gst/spectrum/demo-audiotest.c: (on_window_destroy),
(draw_spectrum), (message_handler), (main):
* gst/spectrum/demo-osssrc.c: (on_window_destroy), (draw_spectrum),
(message_handler), (main):
port to use message to get results, cleanly exit when closing the window
* gst/spectrum/gstspectrum.c: (gst_spectrum_class_init),
(gst_spectrum_init), (gst_spectrum_dispose),
(gst_spectrum_set_property), (gst_spectrum_get_property),
(gst_spectrum_set_caps), (gst_spectrum_start),
(gst_spectrum_message_new), (gst_spectrum_transform_ip):
* gst/spectrum/gstspectrum.h:
port to derive from basetransform and send results via messages
(like level element)
2006-06-16 09:49:07 +00:00
|
|
|
static GstFlowReturn gst_spectrum_transform_ip (GstBaseTransform * trans,
|
|
|
|
GstBuffer * in);
|
|
|
|
|
2001-12-22 23:27:31 +00:00
|
|
|
|
|
|
|
#define fixed short
|
2006-05-20 22:42:15 +00:00
|
|
|
extern int gst_spectrum_fix_fft (fixed fr[], fixed fi[], int m, int inverse);
|
|
|
|
extern void gst_spectrum_fix_loud (fixed loud[], fixed fr[], fixed fi[], int n,
|
2004-03-14 22:34:33 +00:00
|
|
|
int scale_shift);
|
2006-05-20 22:42:15 +00:00
|
|
|
extern void gst_spectrum_window (fixed fr[], int n);
|
2001-12-22 23:27:31 +00:00
|
|
|
|
2003-11-02 22:34:11 +00:00
|
|
|
static void
|
|
|
|
gst_spectrum_base_init (gpointer g_class)
|
|
|
|
{
|
|
|
|
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
|
|
|
|
|
2006-05-20 22:42:15 +00:00
|
|
|
gst_element_class_add_pad_template (element_class,
|
|
|
|
gst_static_pad_template_get (&sink_template_factory));
|
|
|
|
gst_element_class_add_pad_template (element_class,
|
|
|
|
gst_static_pad_template_get (&src_template_factory));
|
2003-11-02 22:34:11 +00:00
|
|
|
gst_element_class_set_details (element_class, &gst_spectrum_details);
|
|
|
|
}
|
2006-05-20 22:42:15 +00:00
|
|
|
|
2001-12-22 23:27:31 +00:00
|
|
|
static void
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_spectrum_class_init (GstSpectrumClass * klass)
|
2001-12-22 23:27:31 +00:00
|
|
|
{
|
gst/spectrum/Makefile.am: Link to base libraries
Original commit message from CVS:
* gst/spectrum/Makefile.am:
Link to base libraries
* gst/spectrum/demo-osssrc.c: (main):
use new threshhold property
* gst/spectrum/gstspectrum.c: (gst_spectrum_class_init),
(gst_spectrum_init), (gst_spectrum_dispose),
(gst_spectrum_set_property), (gst_spectrum_set_sink_caps),
(gst_spectrum_get_sink_caps), (gst_spectrum_chain),
(gst_spectrum_change_state):
* gst/spectrum/gstspectrum.h:
Use gst_adapter, support multiple-channels, add threshold property for
result, add docs, fix resulting spectrum range (was including mirrored
results)
2006-05-21 16:23:23 +00:00
|
|
|
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
gst/spectrum/: port to use message to get results, cleanly exit when closing the window
Original commit message from CVS:
* gst/spectrum/demo-audiotest.c: (on_window_destroy),
(draw_spectrum), (message_handler), (main):
* gst/spectrum/demo-osssrc.c: (on_window_destroy), (draw_spectrum),
(message_handler), (main):
port to use message to get results, cleanly exit when closing the window
* gst/spectrum/gstspectrum.c: (gst_spectrum_class_init),
(gst_spectrum_init), (gst_spectrum_dispose),
(gst_spectrum_set_property), (gst_spectrum_get_property),
(gst_spectrum_set_caps), (gst_spectrum_start),
(gst_spectrum_message_new), (gst_spectrum_transform_ip):
* gst/spectrum/gstspectrum.h:
port to derive from basetransform and send results via messages
(like level element)
2006-06-16 09:49:07 +00:00
|
|
|
GstBaseTransformClass *trans_class = GST_BASE_TRANSFORM_CLASS (klass);
|
2001-12-22 23:27:31 +00:00
|
|
|
|
|
|
|
gobject_class->set_property = gst_spectrum_set_property;
|
gst/spectrum/: port to use message to get results, cleanly exit when closing the window
Original commit message from CVS:
* gst/spectrum/demo-audiotest.c: (on_window_destroy),
(draw_spectrum), (message_handler), (main):
* gst/spectrum/demo-osssrc.c: (on_window_destroy), (draw_spectrum),
(message_handler), (main):
port to use message to get results, cleanly exit when closing the window
* gst/spectrum/gstspectrum.c: (gst_spectrum_class_init),
(gst_spectrum_init), (gst_spectrum_dispose),
(gst_spectrum_set_property), (gst_spectrum_get_property),
(gst_spectrum_set_caps), (gst_spectrum_start),
(gst_spectrum_message_new), (gst_spectrum_transform_ip):
* gst/spectrum/gstspectrum.h:
port to derive from basetransform and send results via messages
(like level element)
2006-06-16 09:49:07 +00:00
|
|
|
gobject_class->get_property = gst_spectrum_get_property;
|
2006-05-20 22:42:15 +00:00
|
|
|
gobject_class->dispose = gst_spectrum_dispose;
|
|
|
|
|
gst/spectrum/: port to use message to get results, cleanly exit when closing the window
Original commit message from CVS:
* gst/spectrum/demo-audiotest.c: (on_window_destroy),
(draw_spectrum), (message_handler), (main):
* gst/spectrum/demo-osssrc.c: (on_window_destroy), (draw_spectrum),
(message_handler), (main):
port to use message to get results, cleanly exit when closing the window
* gst/spectrum/gstspectrum.c: (gst_spectrum_class_init),
(gst_spectrum_init), (gst_spectrum_dispose),
(gst_spectrum_set_property), (gst_spectrum_get_property),
(gst_spectrum_set_caps), (gst_spectrum_start),
(gst_spectrum_message_new), (gst_spectrum_transform_ip):
* gst/spectrum/gstspectrum.h:
port to derive from basetransform and send results via messages
(like level element)
2006-06-16 09:49:07 +00:00
|
|
|
trans_class->set_caps = GST_DEBUG_FUNCPTR (gst_spectrum_set_caps);
|
|
|
|
trans_class->start = GST_DEBUG_FUNCPTR (gst_spectrum_start);
|
2006-09-12 20:18:55 +00:00
|
|
|
trans_class->stop = GST_DEBUG_FUNCPTR (gst_spectrum_stop);
|
|
|
|
trans_class->event = GST_DEBUG_FUNCPTR (gst_spectrum_event);
|
gst/spectrum/: port to use message to get results, cleanly exit when closing the window
Original commit message from CVS:
* gst/spectrum/demo-audiotest.c: (on_window_destroy),
(draw_spectrum), (message_handler), (main):
* gst/spectrum/demo-osssrc.c: (on_window_destroy), (draw_spectrum),
(message_handler), (main):
port to use message to get results, cleanly exit when closing the window
* gst/spectrum/gstspectrum.c: (gst_spectrum_class_init),
(gst_spectrum_init), (gst_spectrum_dispose),
(gst_spectrum_set_property), (gst_spectrum_get_property),
(gst_spectrum_set_caps), (gst_spectrum_start),
(gst_spectrum_message_new), (gst_spectrum_transform_ip):
* gst/spectrum/gstspectrum.h:
port to derive from basetransform and send results via messages
(like level element)
2006-06-16 09:49:07 +00:00
|
|
|
trans_class->transform_ip = GST_DEBUG_FUNCPTR (gst_spectrum_transform_ip);
|
|
|
|
trans_class->passthrough_on_same_caps = TRUE;
|
|
|
|
|
|
|
|
g_object_class_install_property (gobject_class, PROP_SIGNAL_SPECTRUM,
|
2006-07-12 09:28:46 +00:00
|
|
|
g_param_spec_boolean ("message", "Message",
|
gst/spectrum/: port to use message to get results, cleanly exit when closing the window
Original commit message from CVS:
* gst/spectrum/demo-audiotest.c: (on_window_destroy),
(draw_spectrum), (message_handler), (main):
* gst/spectrum/demo-osssrc.c: (on_window_destroy), (draw_spectrum),
(message_handler), (main):
port to use message to get results, cleanly exit when closing the window
* gst/spectrum/gstspectrum.c: (gst_spectrum_class_init),
(gst_spectrum_init), (gst_spectrum_dispose),
(gst_spectrum_set_property), (gst_spectrum_get_property),
(gst_spectrum_set_caps), (gst_spectrum_start),
(gst_spectrum_message_new), (gst_spectrum_transform_ip):
* gst/spectrum/gstspectrum.h:
port to derive from basetransform and send results via messages
(like level element)
2006-06-16 09:49:07 +00:00
|
|
|
"Post a level message for each passed interval",
|
2007-03-06 13:57:55 +00:00
|
|
|
DEFAULT_SIGNAL_SPECTRUM, G_PARAM_READWRITE));
|
gst/spectrum/: port to use message to get results, cleanly exit when closing the window
Original commit message from CVS:
* gst/spectrum/demo-audiotest.c: (on_window_destroy),
(draw_spectrum), (message_handler), (main):
* gst/spectrum/demo-osssrc.c: (on_window_destroy), (draw_spectrum),
(message_handler), (main):
port to use message to get results, cleanly exit when closing the window
* gst/spectrum/gstspectrum.c: (gst_spectrum_class_init),
(gst_spectrum_init), (gst_spectrum_dispose),
(gst_spectrum_set_property), (gst_spectrum_get_property),
(gst_spectrum_set_caps), (gst_spectrum_start),
(gst_spectrum_message_new), (gst_spectrum_transform_ip):
* gst/spectrum/gstspectrum.h:
port to derive from basetransform and send results via messages
(like level element)
2006-06-16 09:49:07 +00:00
|
|
|
|
|
|
|
g_object_class_install_property (gobject_class, PROP_SIGNAL_INTERVAL,
|
|
|
|
g_param_spec_uint64 ("interval", "Interval",
|
|
|
|
"Interval of time between message posts (in nanoseconds)",
|
2007-03-06 13:57:55 +00:00
|
|
|
1, G_MAXUINT64, DEFAULT_SIGNAL_INTERVAL, G_PARAM_READWRITE));
|
gst/spectrum/Makefile.am: Link to base libraries
Original commit message from CVS:
* gst/spectrum/Makefile.am:
Link to base libraries
* gst/spectrum/demo-osssrc.c: (main):
use new threshhold property
* gst/spectrum/gstspectrum.c: (gst_spectrum_class_init),
(gst_spectrum_init), (gst_spectrum_dispose),
(gst_spectrum_set_property), (gst_spectrum_set_sink_caps),
(gst_spectrum_get_sink_caps), (gst_spectrum_chain),
(gst_spectrum_change_state):
* gst/spectrum/gstspectrum.h:
Use gst_adapter, support multiple-channels, add threshold property for
result, add docs, fix resulting spectrum range (was including mirrored
results)
2006-05-21 16:23:23 +00:00
|
|
|
|
gst/spectrum/: port to use message to get results, cleanly exit when closing the window
Original commit message from CVS:
* gst/spectrum/demo-audiotest.c: (on_window_destroy),
(draw_spectrum), (message_handler), (main):
* gst/spectrum/demo-osssrc.c: (on_window_destroy), (draw_spectrum),
(message_handler), (main):
port to use message to get results, cleanly exit when closing the window
* gst/spectrum/gstspectrum.c: (gst_spectrum_class_init),
(gst_spectrum_init), (gst_spectrum_dispose),
(gst_spectrum_set_property), (gst_spectrum_get_property),
(gst_spectrum_set_caps), (gst_spectrum_start),
(gst_spectrum_message_new), (gst_spectrum_transform_ip):
* gst/spectrum/gstspectrum.h:
port to derive from basetransform and send results via messages
(like level element)
2006-06-16 09:49:07 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_BANDS,
|
|
|
|
g_param_spec_uint ("bands", "Bands", "number of frequency bands",
|
2007-03-06 13:57:55 +00:00
|
|
|
0, G_MAXUINT, DEFAULT_BANDS, G_PARAM_READWRITE));
|
gst/spectrum/Makefile.am: Link to base libraries
Original commit message from CVS:
* gst/spectrum/Makefile.am:
Link to base libraries
* gst/spectrum/demo-osssrc.c: (main):
use new threshhold property
* gst/spectrum/gstspectrum.c: (gst_spectrum_class_init),
(gst_spectrum_init), (gst_spectrum_dispose),
(gst_spectrum_set_property), (gst_spectrum_set_sink_caps),
(gst_spectrum_get_sink_caps), (gst_spectrum_chain),
(gst_spectrum_change_state):
* gst/spectrum/gstspectrum.h:
Use gst_adapter, support multiple-channels, add threshold property for
result, add docs, fix resulting spectrum range (was including mirrored
results)
2006-05-21 16:23:23 +00:00
|
|
|
|
gst/spectrum/: port to use message to get results, cleanly exit when closing the window
Original commit message from CVS:
* gst/spectrum/demo-audiotest.c: (on_window_destroy),
(draw_spectrum), (message_handler), (main):
* gst/spectrum/demo-osssrc.c: (on_window_destroy), (draw_spectrum),
(message_handler), (main):
port to use message to get results, cleanly exit when closing the window
* gst/spectrum/gstspectrum.c: (gst_spectrum_class_init),
(gst_spectrum_init), (gst_spectrum_dispose),
(gst_spectrum_set_property), (gst_spectrum_get_property),
(gst_spectrum_set_caps), (gst_spectrum_start),
(gst_spectrum_message_new), (gst_spectrum_transform_ip):
* gst/spectrum/gstspectrum.h:
port to derive from basetransform and send results via messages
(like level element)
2006-06-16 09:49:07 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_THRESHOLD,
|
2006-05-21 16:41:44 +00:00
|
|
|
g_param_spec_int ("threshold", "Threshold",
|
2007-03-06 13:57:55 +00:00
|
|
|
"db threshold for result, maps to 0", G_MININT, 0, DEFAULT_THRESHOLD,
|
gst/spectrum/: port to use message to get results, cleanly exit when closing the window
Original commit message from CVS:
* gst/spectrum/demo-audiotest.c: (on_window_destroy),
(draw_spectrum), (message_handler), (main):
* gst/spectrum/demo-osssrc.c: (on_window_destroy), (draw_spectrum),
(message_handler), (main):
port to use message to get results, cleanly exit when closing the window
* gst/spectrum/gstspectrum.c: (gst_spectrum_class_init),
(gst_spectrum_init), (gst_spectrum_dispose),
(gst_spectrum_set_property), (gst_spectrum_get_property),
(gst_spectrum_set_caps), (gst_spectrum_start),
(gst_spectrum_message_new), (gst_spectrum_transform_ip):
* gst/spectrum/gstspectrum.h:
port to derive from basetransform and send results via messages
(like level element)
2006-06-16 09:49:07 +00:00
|
|
|
G_PARAM_READWRITE));
|
2006-05-20 22:42:15 +00:00
|
|
|
|
2006-05-21 16:41:44 +00:00
|
|
|
GST_DEBUG_CATEGORY_INIT (gst_spectrum_debug, "spectrum", 0,
|
|
|
|
"audio spectrum analyser element");
|
2001-12-22 23:27:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2006-05-21 16:41:44 +00:00
|
|
|
gst_spectrum_init (GstSpectrum * spectrum, GstSpectrumClass * g_class)
|
2001-12-22 23:27:31 +00:00
|
|
|
{
|
gst/spectrum/Makefile.am: Link to base libraries
Original commit message from CVS:
* gst/spectrum/Makefile.am:
Link to base libraries
* gst/spectrum/demo-osssrc.c: (main):
use new threshhold property
* gst/spectrum/gstspectrum.c: (gst_spectrum_class_init),
(gst_spectrum_init), (gst_spectrum_dispose),
(gst_spectrum_set_property), (gst_spectrum_set_sink_caps),
(gst_spectrum_get_sink_caps), (gst_spectrum_chain),
(gst_spectrum_change_state):
* gst/spectrum/gstspectrum.h:
Use gst_adapter, support multiple-channels, add threshold property for
result, add docs, fix resulting spectrum range (was including mirrored
results)
2006-05-21 16:23:23 +00:00
|
|
|
spectrum->adapter = gst_adapter_new ();
|
|
|
|
|
2007-03-06 13:57:55 +00:00
|
|
|
spectrum->message = DEFAULT_SIGNAL_SPECTRUM;
|
|
|
|
spectrum->interval = DEFAULT_SIGNAL_INTERVAL;
|
|
|
|
spectrum->bands = DEFAULT_BANDS;
|
|
|
|
spectrum->threshold = DEFAULT_THRESHOLD;
|
gst/spectrum/Makefile.am: Link to base libraries
Original commit message from CVS:
* gst/spectrum/Makefile.am:
Link to base libraries
* gst/spectrum/demo-osssrc.c: (main):
use new threshhold property
* gst/spectrum/gstspectrum.c: (gst_spectrum_class_init),
(gst_spectrum_init), (gst_spectrum_dispose),
(gst_spectrum_set_property), (gst_spectrum_set_sink_caps),
(gst_spectrum_get_sink_caps), (gst_spectrum_chain),
(gst_spectrum_change_state):
* gst/spectrum/gstspectrum.h:
Use gst_adapter, support multiple-channels, add threshold property for
result, add docs, fix resulting spectrum range (was including mirrored
results)
2006-05-21 16:23:23 +00:00
|
|
|
spectrum->base = 9;
|
|
|
|
spectrum->len = 1024; /* 2 ^ (base+1) */
|
2006-05-20 22:42:15 +00:00
|
|
|
|
|
|
|
spectrum->loud = g_malloc (spectrum->len * sizeof (gint16));
|
2006-09-11 18:02:39 +00:00
|
|
|
spectrum->im = g_malloc0 (spectrum->len * sizeof (gint16));
|
|
|
|
spectrum->re = g_malloc0 (spectrum->len * sizeof (gint16));
|
gst/spectrum/: port to use message to get results, cleanly exit when closing the window
Original commit message from CVS:
* gst/spectrum/demo-audiotest.c: (on_window_destroy),
(draw_spectrum), (message_handler), (main):
* gst/spectrum/demo-osssrc.c: (on_window_destroy), (draw_spectrum),
(message_handler), (main):
port to use message to get results, cleanly exit when closing the window
* gst/spectrum/gstspectrum.c: (gst_spectrum_class_init),
(gst_spectrum_init), (gst_spectrum_dispose),
(gst_spectrum_set_property), (gst_spectrum_get_property),
(gst_spectrum_set_caps), (gst_spectrum_start),
(gst_spectrum_message_new), (gst_spectrum_transform_ip):
* gst/spectrum/gstspectrum.h:
port to derive from basetransform and send results via messages
(like level element)
2006-06-16 09:49:07 +00:00
|
|
|
spectrum->spect = g_malloc (spectrum->bands * sizeof (guchar));
|
2006-05-20 22:42:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_spectrum_dispose (GObject * object)
|
|
|
|
{
|
|
|
|
GstSpectrum *spectrum = GST_SPECTRUM (object);
|
|
|
|
|
gst/spectrum/Makefile.am: Link to base libraries
Original commit message from CVS:
* gst/spectrum/Makefile.am:
Link to base libraries
* gst/spectrum/demo-osssrc.c: (main):
use new threshhold property
* gst/spectrum/gstspectrum.c: (gst_spectrum_class_init),
(gst_spectrum_init), (gst_spectrum_dispose),
(gst_spectrum_set_property), (gst_spectrum_set_sink_caps),
(gst_spectrum_get_sink_caps), (gst_spectrum_chain),
(gst_spectrum_change_state):
* gst/spectrum/gstspectrum.h:
Use gst_adapter, support multiple-channels, add threshold property for
result, add docs, fix resulting spectrum range (was including mirrored
results)
2006-05-21 16:23:23 +00:00
|
|
|
if (spectrum->adapter) {
|
|
|
|
g_object_unref (spectrum->adapter);
|
|
|
|
spectrum->adapter = NULL;
|
|
|
|
}
|
|
|
|
|
2006-05-20 22:42:15 +00:00
|
|
|
g_free (spectrum->re);
|
|
|
|
g_free (spectrum->im);
|
|
|
|
g_free (spectrum->loud);
|
gst/spectrum/: port to use message to get results, cleanly exit when closing the window
Original commit message from CVS:
* gst/spectrum/demo-audiotest.c: (on_window_destroy),
(draw_spectrum), (message_handler), (main):
* gst/spectrum/demo-osssrc.c: (on_window_destroy), (draw_spectrum),
(message_handler), (main):
port to use message to get results, cleanly exit when closing the window
* gst/spectrum/gstspectrum.c: (gst_spectrum_class_init),
(gst_spectrum_init), (gst_spectrum_dispose),
(gst_spectrum_set_property), (gst_spectrum_get_property),
(gst_spectrum_set_caps), (gst_spectrum_start),
(gst_spectrum_message_new), (gst_spectrum_transform_ip):
* gst/spectrum/gstspectrum.h:
port to derive from basetransform and send results via messages
(like level element)
2006-06-16 09:49:07 +00:00
|
|
|
g_free (spectrum->spect);
|
2006-05-20 22:42:15 +00:00
|
|
|
|
2006-09-11 18:02:39 +00:00
|
|
|
spectrum->re = NULL;
|
|
|
|
spectrum->im = NULL;
|
|
|
|
spectrum->loud = NULL;
|
|
|
|
spectrum->spect = NULL;
|
|
|
|
|
2006-05-20 22:42:15 +00:00
|
|
|
G_OBJECT_CLASS (parent_class)->dispose (object);
|
2001-12-22 23:27:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_spectrum_set_property (GObject * object, guint prop_id,
|
|
|
|
const GValue * value, GParamSpec * pspec)
|
2001-12-22 23:27:31 +00:00
|
|
|
{
|
gst/spectrum/: port to use message to get results, cleanly exit when closing the window
Original commit message from CVS:
* gst/spectrum/demo-audiotest.c: (on_window_destroy),
(draw_spectrum), (message_handler), (main):
* gst/spectrum/demo-osssrc.c: (on_window_destroy), (draw_spectrum),
(message_handler), (main):
port to use message to get results, cleanly exit when closing the window
* gst/spectrum/gstspectrum.c: (gst_spectrum_class_init),
(gst_spectrum_init), (gst_spectrum_dispose),
(gst_spectrum_set_property), (gst_spectrum_get_property),
(gst_spectrum_set_caps), (gst_spectrum_start),
(gst_spectrum_message_new), (gst_spectrum_transform_ip):
* gst/spectrum/gstspectrum.h:
port to derive from basetransform and send results via messages
(like level element)
2006-06-16 09:49:07 +00:00
|
|
|
GstSpectrum *filter = GST_SPECTRUM (object);
|
2001-12-22 23:27:31 +00:00
|
|
|
|
|
|
|
switch (prop_id) {
|
gst/spectrum/: port to use message to get results, cleanly exit when closing the window
Original commit message from CVS:
* gst/spectrum/demo-audiotest.c: (on_window_destroy),
(draw_spectrum), (message_handler), (main):
* gst/spectrum/demo-osssrc.c: (on_window_destroy), (draw_spectrum),
(message_handler), (main):
port to use message to get results, cleanly exit when closing the window
* gst/spectrum/gstspectrum.c: (gst_spectrum_class_init),
(gst_spectrum_init), (gst_spectrum_dispose),
(gst_spectrum_set_property), (gst_spectrum_get_property),
(gst_spectrum_set_caps), (gst_spectrum_start),
(gst_spectrum_message_new), (gst_spectrum_transform_ip):
* gst/spectrum/gstspectrum.h:
port to derive from basetransform and send results via messages
(like level element)
2006-06-16 09:49:07 +00:00
|
|
|
case PROP_SIGNAL_SPECTRUM:
|
|
|
|
filter->message = g_value_get_boolean (value);
|
|
|
|
break;
|
|
|
|
case PROP_SIGNAL_INTERVAL:
|
2006-09-11 18:23:59 +00:00
|
|
|
filter->interval = g_value_get_uint64 (value);
|
gst/spectrum/: port to use message to get results, cleanly exit when closing the window
Original commit message from CVS:
* gst/spectrum/demo-audiotest.c: (on_window_destroy),
(draw_spectrum), (message_handler), (main):
* gst/spectrum/demo-osssrc.c: (on_window_destroy), (draw_spectrum),
(message_handler), (main):
port to use message to get results, cleanly exit when closing the window
* gst/spectrum/gstspectrum.c: (gst_spectrum_class_init),
(gst_spectrum_init), (gst_spectrum_dispose),
(gst_spectrum_set_property), (gst_spectrum_get_property),
(gst_spectrum_set_caps), (gst_spectrum_start),
(gst_spectrum_message_new), (gst_spectrum_transform_ip):
* gst/spectrum/gstspectrum.h:
port to derive from basetransform and send results via messages
(like level element)
2006-06-16 09:49:07 +00:00
|
|
|
break;
|
|
|
|
case PROP_BANDS:
|
2007-05-21 12:43:37 +00:00
|
|
|
GST_OBJECT_LOCK (filter);
|
gst/spectrum/: port to use message to get results, cleanly exit when closing the window
Original commit message from CVS:
* gst/spectrum/demo-audiotest.c: (on_window_destroy),
(draw_spectrum), (message_handler), (main):
* gst/spectrum/demo-osssrc.c: (on_window_destroy), (draw_spectrum),
(message_handler), (main):
port to use message to get results, cleanly exit when closing the window
* gst/spectrum/gstspectrum.c: (gst_spectrum_class_init),
(gst_spectrum_init), (gst_spectrum_dispose),
(gst_spectrum_set_property), (gst_spectrum_get_property),
(gst_spectrum_set_caps), (gst_spectrum_start),
(gst_spectrum_message_new), (gst_spectrum_transform_ip):
* gst/spectrum/gstspectrum.h:
port to derive from basetransform and send results via messages
(like level element)
2006-06-16 09:49:07 +00:00
|
|
|
filter->bands = g_value_get_uint (value);
|
|
|
|
g_free (filter->spect);
|
|
|
|
filter->spect = g_malloc (filter->bands * sizeof (guchar));
|
2007-05-21 12:43:37 +00:00
|
|
|
GST_OBJECT_UNLOCK (filter);
|
gst/spectrum/: port to use message to get results, cleanly exit when closing the window
Original commit message from CVS:
* gst/spectrum/demo-audiotest.c: (on_window_destroy),
(draw_spectrum), (message_handler), (main):
* gst/spectrum/demo-osssrc.c: (on_window_destroy), (draw_spectrum),
(message_handler), (main):
port to use message to get results, cleanly exit when closing the window
* gst/spectrum/gstspectrum.c: (gst_spectrum_class_init),
(gst_spectrum_init), (gst_spectrum_dispose),
(gst_spectrum_set_property), (gst_spectrum_get_property),
(gst_spectrum_set_caps), (gst_spectrum_start),
(gst_spectrum_message_new), (gst_spectrum_transform_ip):
* gst/spectrum/gstspectrum.h:
port to derive from basetransform and send results via messages
(like level element)
2006-06-16 09:49:07 +00:00
|
|
|
GST_DEBUG_OBJECT (filter, "reallocation, spect = %p, bands =%d ",
|
|
|
|
filter->spect, filter->bands);
|
gst/spectrum/Makefile.am: Link to base libraries
Original commit message from CVS:
* gst/spectrum/Makefile.am:
Link to base libraries
* gst/spectrum/demo-osssrc.c: (main):
use new threshhold property
* gst/spectrum/gstspectrum.c: (gst_spectrum_class_init),
(gst_spectrum_init), (gst_spectrum_dispose),
(gst_spectrum_set_property), (gst_spectrum_set_sink_caps),
(gst_spectrum_get_sink_caps), (gst_spectrum_chain),
(gst_spectrum_change_state):
* gst/spectrum/gstspectrum.h:
Use gst_adapter, support multiple-channels, add threshold property for
result, add docs, fix resulting spectrum range (was including mirrored
results)
2006-05-21 16:23:23 +00:00
|
|
|
break;
|
gst/spectrum/: port to use message to get results, cleanly exit when closing the window
Original commit message from CVS:
* gst/spectrum/demo-audiotest.c: (on_window_destroy),
(draw_spectrum), (message_handler), (main):
* gst/spectrum/demo-osssrc.c: (on_window_destroy), (draw_spectrum),
(message_handler), (main):
port to use message to get results, cleanly exit when closing the window
* gst/spectrum/gstspectrum.c: (gst_spectrum_class_init),
(gst_spectrum_init), (gst_spectrum_dispose),
(gst_spectrum_set_property), (gst_spectrum_get_property),
(gst_spectrum_set_caps), (gst_spectrum_start),
(gst_spectrum_message_new), (gst_spectrum_transform_ip):
* gst/spectrum/gstspectrum.h:
port to derive from basetransform and send results via messages
(like level element)
2006-06-16 09:49:07 +00:00
|
|
|
case PROP_THRESHOLD:
|
|
|
|
filter->threshold = g_value_get_int (value);
|
2001-12-22 23:27:31 +00:00
|
|
|
break;
|
|
|
|
default:
|
2006-05-20 22:42:15 +00:00
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
2001-12-22 23:27:31 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
gst/spectrum/: port to use message to get results, cleanly exit when closing the window
Original commit message from CVS:
* gst/spectrum/demo-audiotest.c: (on_window_destroy),
(draw_spectrum), (message_handler), (main):
* gst/spectrum/demo-osssrc.c: (on_window_destroy), (draw_spectrum),
(message_handler), (main):
port to use message to get results, cleanly exit when closing the window
* gst/spectrum/gstspectrum.c: (gst_spectrum_class_init),
(gst_spectrum_init), (gst_spectrum_dispose),
(gst_spectrum_set_property), (gst_spectrum_get_property),
(gst_spectrum_set_caps), (gst_spectrum_start),
(gst_spectrum_message_new), (gst_spectrum_transform_ip):
* gst/spectrum/gstspectrum.h:
port to derive from basetransform and send results via messages
(like level element)
2006-06-16 09:49:07 +00:00
|
|
|
static void
|
|
|
|
gst_spectrum_get_property (GObject * object, guint prop_id,
|
|
|
|
GValue * value, GParamSpec * pspec)
|
|
|
|
{
|
|
|
|
GstSpectrum *filter = GST_SPECTRUM (object);
|
|
|
|
|
|
|
|
switch (prop_id) {
|
|
|
|
case PROP_SIGNAL_SPECTRUM:
|
|
|
|
g_value_set_boolean (value, filter->message);
|
|
|
|
break;
|
|
|
|
case PROP_SIGNAL_INTERVAL:
|
|
|
|
g_value_set_uint64 (value, filter->interval);
|
|
|
|
break;
|
|
|
|
case PROP_BANDS:
|
|
|
|
g_value_set_uint (value, filter->bands);
|
|
|
|
break;
|
|
|
|
case PROP_THRESHOLD:
|
|
|
|
g_value_set_int (value, filter->threshold);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_spectrum_set_caps (GstBaseTransform * trans, GstCaps * in, GstCaps * out)
|
|
|
|
{
|
|
|
|
GstSpectrum *filter = GST_SPECTRUM (trans);
|
|
|
|
GstStructure *structure;
|
|
|
|
|
|
|
|
structure = gst_caps_get_structure (in, 0);
|
|
|
|
gst_structure_get_int (structure, "rate", &filter->rate);
|
|
|
|
gst_structure_get_int (structure, "channels", &filter->channels);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_spectrum_start (GstBaseTransform * trans)
|
|
|
|
{
|
|
|
|
GstSpectrum *filter = GST_SPECTRUM (trans);
|
|
|
|
|
|
|
|
filter->num_frames = 0;
|
2007-03-07 11:23:20 +00:00
|
|
|
gst_segment_init (&filter->segment, GST_FORMAT_UNDEFINED);
|
gst/spectrum/: port to use message to get results, cleanly exit when closing the window
Original commit message from CVS:
* gst/spectrum/demo-audiotest.c: (on_window_destroy),
(draw_spectrum), (message_handler), (main):
* gst/spectrum/demo-osssrc.c: (on_window_destroy), (draw_spectrum),
(message_handler), (main):
port to use message to get results, cleanly exit when closing the window
* gst/spectrum/gstspectrum.c: (gst_spectrum_class_init),
(gst_spectrum_init), (gst_spectrum_dispose),
(gst_spectrum_set_property), (gst_spectrum_get_property),
(gst_spectrum_set_caps), (gst_spectrum_start),
(gst_spectrum_message_new), (gst_spectrum_transform_ip):
* gst/spectrum/gstspectrum.h:
port to derive from basetransform and send results via messages
(like level element)
2006-06-16 09:49:07 +00:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2006-09-12 20:18:55 +00:00
|
|
|
static gboolean
|
|
|
|
gst_spectrum_stop (GstBaseTransform * trans)
|
|
|
|
{
|
|
|
|
GstSpectrum *filter = GST_SPECTRUM (trans);
|
|
|
|
|
|
|
|
gst_adapter_clear (filter->adapter);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_spectrum_event (GstBaseTransform * trans, GstEvent * event)
|
|
|
|
{
|
|
|
|
GstSpectrum *filter = GST_SPECTRUM (trans);
|
|
|
|
|
|
|
|
switch (GST_EVENT_TYPE (event)) {
|
|
|
|
case GST_EVENT_FLUSH_STOP:
|
|
|
|
case GST_EVENT_EOS:
|
|
|
|
gst_adapter_clear (filter->adapter);
|
|
|
|
break;
|
2007-03-07 11:23:20 +00:00
|
|
|
case GST_EVENT_NEWSEGMENT:{
|
|
|
|
GstFormat format;
|
|
|
|
gdouble rate, arate;
|
|
|
|
gint64 start, stop, time;
|
|
|
|
gboolean update;
|
|
|
|
|
|
|
|
/* the newsegment values are used to clip the input samples
|
|
|
|
* and to convert the incomming timestamps to running time */
|
|
|
|
gst_event_parse_new_segment_full (event, &update, &rate, &arate, &format,
|
|
|
|
&start, &stop, &time);
|
|
|
|
|
|
|
|
/* now configure the values */
|
|
|
|
gst_segment_set_newsegment_full (&filter->segment, update,
|
|
|
|
rate, arate, format, start, stop, time);
|
|
|
|
break;
|
|
|
|
}
|
2006-09-12 20:18:55 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
gst/spectrum/: port to use message to get results, cleanly exit when closing the window
Original commit message from CVS:
* gst/spectrum/demo-audiotest.c: (on_window_destroy),
(draw_spectrum), (message_handler), (main):
* gst/spectrum/demo-osssrc.c: (on_window_destroy), (draw_spectrum),
(message_handler), (main):
port to use message to get results, cleanly exit when closing the window
* gst/spectrum/gstspectrum.c: (gst_spectrum_class_init),
(gst_spectrum_init), (gst_spectrum_dispose),
(gst_spectrum_set_property), (gst_spectrum_get_property),
(gst_spectrum_set_caps), (gst_spectrum_start),
(gst_spectrum_message_new), (gst_spectrum_transform_ip):
* gst/spectrum/gstspectrum.h:
port to derive from basetransform and send results via messages
(like level element)
2006-06-16 09:49:07 +00:00
|
|
|
static GstMessage *
|
|
|
|
gst_spectrum_message_new (GstSpectrum * spectrum, GstClockTime endtime)
|
|
|
|
{
|
|
|
|
GstStructure *s;
|
|
|
|
GValue v = { 0, };
|
|
|
|
GValue *l;
|
|
|
|
guint i;
|
|
|
|
guchar *spect = spectrum->spect;
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (spectrum, "preparing message, spect = %p, bands =%d ",
|
|
|
|
spect, spectrum->bands);
|
|
|
|
|
|
|
|
s = gst_structure_new ("spectrum", "endtime", GST_TYPE_CLOCK_TIME,
|
|
|
|
endtime, NULL);
|
|
|
|
|
|
|
|
g_value_init (&v, GST_TYPE_LIST);
|
|
|
|
/* will copy-by-value */
|
|
|
|
gst_structure_set_value (s, "spectrum", &v);
|
|
|
|
g_value_unset (&v);
|
|
|
|
|
|
|
|
g_value_init (&v, G_TYPE_UCHAR);
|
|
|
|
l = (GValue *) gst_structure_get_value (s, "spectrum");
|
|
|
|
for (i = 0; i < spectrum->bands; i++) {
|
|
|
|
g_value_set_uchar (&v, spect[i]);
|
|
|
|
gst_value_list_append_value (l, &v); /* copies by value */
|
|
|
|
}
|
|
|
|
g_value_unset (&v);
|
|
|
|
|
|
|
|
return gst_message_new_element (GST_OBJECT (spectrum), s);
|
|
|
|
}
|
gst/spectrum/Makefile.am: Link to base libraries
Original commit message from CVS:
* gst/spectrum/Makefile.am:
Link to base libraries
* gst/spectrum/demo-osssrc.c: (main):
use new threshhold property
* gst/spectrum/gstspectrum.c: (gst_spectrum_class_init),
(gst_spectrum_init), (gst_spectrum_dispose),
(gst_spectrum_set_property), (gst_spectrum_set_sink_caps),
(gst_spectrum_get_sink_caps), (gst_spectrum_chain),
(gst_spectrum_change_state):
* gst/spectrum/gstspectrum.h:
Use gst_adapter, support multiple-channels, add threshold property for
result, add docs, fix resulting spectrum range (was including mirrored
results)
2006-05-21 16:23:23 +00:00
|
|
|
|
2006-05-20 22:42:15 +00:00
|
|
|
static GstFlowReturn
|
gst/spectrum/: port to use message to get results, cleanly exit when closing the window
Original commit message from CVS:
* gst/spectrum/demo-audiotest.c: (on_window_destroy),
(draw_spectrum), (message_handler), (main):
* gst/spectrum/demo-osssrc.c: (on_window_destroy), (draw_spectrum),
(message_handler), (main):
port to use message to get results, cleanly exit when closing the window
* gst/spectrum/gstspectrum.c: (gst_spectrum_class_init),
(gst_spectrum_init), (gst_spectrum_dispose),
(gst_spectrum_set_property), (gst_spectrum_get_property),
(gst_spectrum_set_caps), (gst_spectrum_start),
(gst_spectrum_message_new), (gst_spectrum_transform_ip):
* gst/spectrum/gstspectrum.h:
port to derive from basetransform and send results via messages
(like level element)
2006-06-16 09:49:07 +00:00
|
|
|
gst_spectrum_transform_ip (GstBaseTransform * trans, GstBuffer * in)
|
2001-12-22 23:27:31 +00:00
|
|
|
{
|
gst/spectrum/: port to use message to get results, cleanly exit when closing the window
Original commit message from CVS:
* gst/spectrum/demo-audiotest.c: (on_window_destroy),
(draw_spectrum), (message_handler), (main):
* gst/spectrum/demo-osssrc.c: (on_window_destroy), (draw_spectrum),
(message_handler), (main):
port to use message to get results, cleanly exit when closing the window
* gst/spectrum/gstspectrum.c: (gst_spectrum_class_init),
(gst_spectrum_init), (gst_spectrum_dispose),
(gst_spectrum_set_property), (gst_spectrum_get_property),
(gst_spectrum_set_caps), (gst_spectrum_start),
(gst_spectrum_message_new), (gst_spectrum_transform_ip):
* gst/spectrum/gstspectrum.h:
port to derive from basetransform and send results via messages
(like level element)
2006-06-16 09:49:07 +00:00
|
|
|
GstSpectrum *spectrum = GST_SPECTRUM (trans);
|
gst/spectrum/Makefile.am: Link to base libraries
Original commit message from CVS:
* gst/spectrum/Makefile.am:
Link to base libraries
* gst/spectrum/demo-osssrc.c: (main):
use new threshhold property
* gst/spectrum/gstspectrum.c: (gst_spectrum_class_init),
(gst_spectrum_init), (gst_spectrum_dispose),
(gst_spectrum_set_property), (gst_spectrum_set_sink_caps),
(gst_spectrum_get_sink_caps), (gst_spectrum_chain),
(gst_spectrum_change_state):
* gst/spectrum/gstspectrum.h:
Use gst_adapter, support multiple-channels, add threshold property for
result, add docs, fix resulting spectrum range (was including mirrored
results)
2006-05-21 16:23:23 +00:00
|
|
|
gint wanted;
|
|
|
|
gint i, j, k;
|
|
|
|
gint32 acc;
|
|
|
|
gfloat pos, step;
|
gst/spectrum/: port to use message to get results, cleanly exit when closing the window
Original commit message from CVS:
* gst/spectrum/demo-audiotest.c: (on_window_destroy),
(draw_spectrum), (message_handler), (main):
* gst/spectrum/demo-osssrc.c: (on_window_destroy), (draw_spectrum),
(message_handler), (main):
port to use message to get results, cleanly exit when closing the window
* gst/spectrum/gstspectrum.c: (gst_spectrum_class_init),
(gst_spectrum_init), (gst_spectrum_dispose),
(gst_spectrum_set_property), (gst_spectrum_get_property),
(gst_spectrum_set_caps), (gst_spectrum_start),
(gst_spectrum_message_new), (gst_spectrum_transform_ip):
* gst/spectrum/gstspectrum.h:
port to derive from basetransform and send results via messages
(like level element)
2006-06-16 09:49:07 +00:00
|
|
|
guchar *spect = spectrum->spect;
|
2007-03-06 13:57:55 +00:00
|
|
|
|
2007-03-07 11:23:20 +00:00
|
|
|
GstClockTime endtime =
|
|
|
|
gst_segment_to_running_time (&spectrum->segment, GST_FORMAT_TIME,
|
|
|
|
GST_BUFFER_TIMESTAMP (in));
|
gst/spectrum/: port to use message to get results, cleanly exit when closing the window
Original commit message from CVS:
* gst/spectrum/demo-audiotest.c: (on_window_destroy),
(draw_spectrum), (message_handler), (main):
* gst/spectrum/demo-osssrc.c: (on_window_destroy), (draw_spectrum),
(message_handler), (main):
port to use message to get results, cleanly exit when closing the window
* gst/spectrum/gstspectrum.c: (gst_spectrum_class_init),
(gst_spectrum_init), (gst_spectrum_dispose),
(gst_spectrum_set_property), (gst_spectrum_get_property),
(gst_spectrum_set_caps), (gst_spectrum_start),
(gst_spectrum_message_new), (gst_spectrum_transform_ip):
* gst/spectrum/gstspectrum.h:
port to derive from basetransform and send results via messages
(like level element)
2006-06-16 09:49:07 +00:00
|
|
|
GstClockTime blktime =
|
|
|
|
GST_FRAMES_TO_CLOCK_TIME (spectrum->len, spectrum->rate);
|
|
|
|
|
2006-10-06 02:29:35 +00:00
|
|
|
GST_LOG_OBJECT (spectrum, "input size: %d bytes", GST_BUFFER_SIZE (in));
|
gst/spectrum/Makefile.am: Link to base libraries
Original commit message from CVS:
* gst/spectrum/Makefile.am:
Link to base libraries
* gst/spectrum/demo-osssrc.c: (main):
use new threshhold property
* gst/spectrum/gstspectrum.c: (gst_spectrum_class_init),
(gst_spectrum_init), (gst_spectrum_dispose),
(gst_spectrum_set_property), (gst_spectrum_set_sink_caps),
(gst_spectrum_get_sink_caps), (gst_spectrum_chain),
(gst_spectrum_change_state):
* gst/spectrum/gstspectrum.h:
Use gst_adapter, support multiple-channels, add threshold property for
result, add docs, fix resulting spectrum range (was including mirrored
results)
2006-05-21 16:23:23 +00:00
|
|
|
|
gst/spectrum/: port to use message to get results, cleanly exit when closing the window
Original commit message from CVS:
* gst/spectrum/demo-audiotest.c: (on_window_destroy),
(draw_spectrum), (message_handler), (main):
* gst/spectrum/demo-osssrc.c: (on_window_destroy), (draw_spectrum),
(message_handler), (main):
port to use message to get results, cleanly exit when closing the window
* gst/spectrum/gstspectrum.c: (gst_spectrum_class_init),
(gst_spectrum_init), (gst_spectrum_dispose),
(gst_spectrum_set_property), (gst_spectrum_get_property),
(gst_spectrum_set_caps), (gst_spectrum_start),
(gst_spectrum_message_new), (gst_spectrum_transform_ip):
* gst/spectrum/gstspectrum.h:
port to derive from basetransform and send results via messages
(like level element)
2006-06-16 09:49:07 +00:00
|
|
|
gst_adapter_push (spectrum->adapter, gst_buffer_ref (in));
|
gst/spectrum/Makefile.am: Link to base libraries
Original commit message from CVS:
* gst/spectrum/Makefile.am:
Link to base libraries
* gst/spectrum/demo-osssrc.c: (main):
use new threshhold property
* gst/spectrum/gstspectrum.c: (gst_spectrum_class_init),
(gst_spectrum_init), (gst_spectrum_dispose),
(gst_spectrum_set_property), (gst_spectrum_set_sink_caps),
(gst_spectrum_get_sink_caps), (gst_spectrum_chain),
(gst_spectrum_change_state):
* gst/spectrum/gstspectrum.h:
Use gst_adapter, support multiple-channels, add threshold property for
result, add docs, fix resulting spectrum range (was including mirrored
results)
2006-05-21 16:23:23 +00:00
|
|
|
/* required number of bytes */
|
2006-09-11 18:02:39 +00:00
|
|
|
wanted = spectrum->channels * spectrum->len * sizeof (gint16);
|
gst/spectrum/Makefile.am: Link to base libraries
Original commit message from CVS:
* gst/spectrum/Makefile.am:
Link to base libraries
* gst/spectrum/demo-osssrc.c: (main):
use new threshhold property
* gst/spectrum/gstspectrum.c: (gst_spectrum_class_init),
(gst_spectrum_init), (gst_spectrum_dispose),
(gst_spectrum_set_property), (gst_spectrum_set_sink_caps),
(gst_spectrum_get_sink_caps), (gst_spectrum_chain),
(gst_spectrum_change_state):
* gst/spectrum/gstspectrum.h:
Use gst_adapter, support multiple-channels, add threshold property for
result, add docs, fix resulting spectrum range (was including mirrored
results)
2006-05-21 16:23:23 +00:00
|
|
|
/* FIXME: 4.0 was 2.0 before, but that include the mirrored spectrum */
|
gst/spectrum/: port to use message to get results, cleanly exit when closing the window
Original commit message from CVS:
* gst/spectrum/demo-audiotest.c: (on_window_destroy),
(draw_spectrum), (message_handler), (main):
* gst/spectrum/demo-osssrc.c: (on_window_destroy), (draw_spectrum),
(message_handler), (main):
port to use message to get results, cleanly exit when closing the window
* gst/spectrum/gstspectrum.c: (gst_spectrum_class_init),
(gst_spectrum_init), (gst_spectrum_dispose),
(gst_spectrum_set_property), (gst_spectrum_get_property),
(gst_spectrum_set_caps), (gst_spectrum_start),
(gst_spectrum_message_new), (gst_spectrum_transform_ip):
* gst/spectrum/gstspectrum.h:
port to derive from basetransform and send results via messages
(like level element)
2006-06-16 09:49:07 +00:00
|
|
|
step = (gfloat) spectrum->len / (spectrum->bands * 4.0);
|
gst/spectrum/Makefile.am: Link to base libraries
Original commit message from CVS:
* gst/spectrum/Makefile.am:
Link to base libraries
* gst/spectrum/demo-osssrc.c: (main):
use new threshhold property
* gst/spectrum/gstspectrum.c: (gst_spectrum_class_init),
(gst_spectrum_init), (gst_spectrum_dispose),
(gst_spectrum_set_property), (gst_spectrum_set_sink_caps),
(gst_spectrum_get_sink_caps), (gst_spectrum_chain),
(gst_spectrum_change_state):
* gst/spectrum/gstspectrum.h:
Use gst_adapter, support multiple-channels, add threshold property for
result, add docs, fix resulting spectrum range (was including mirrored
results)
2006-05-21 16:23:23 +00:00
|
|
|
|
2006-10-06 11:31:11 +00:00
|
|
|
while (gst_adapter_available (spectrum->adapter) >= wanted) {
|
|
|
|
const gint16 *samples;
|
gst/spectrum/Makefile.am: Link to base libraries
Original commit message from CVS:
* gst/spectrum/Makefile.am:
Link to base libraries
* gst/spectrum/demo-osssrc.c: (main):
use new threshhold property
* gst/spectrum/gstspectrum.c: (gst_spectrum_class_init),
(gst_spectrum_init), (gst_spectrum_dispose),
(gst_spectrum_set_property), (gst_spectrum_set_sink_caps),
(gst_spectrum_get_sink_caps), (gst_spectrum_chain),
(gst_spectrum_change_state):
* gst/spectrum/gstspectrum.h:
Use gst_adapter, support multiple-channels, add threshold property for
result, add docs, fix resulting spectrum range (was including mirrored
results)
2006-05-21 16:23:23 +00:00
|
|
|
|
2006-10-06 11:31:11 +00:00
|
|
|
samples = (const gint16 *) gst_adapter_peek (spectrum->adapter, wanted);
|
gst/spectrum/Makefile.am: Link to base libraries
Original commit message from CVS:
* gst/spectrum/Makefile.am:
Link to base libraries
* gst/spectrum/demo-osssrc.c: (main):
use new threshhold property
* gst/spectrum/gstspectrum.c: (gst_spectrum_class_init),
(gst_spectrum_init), (gst_spectrum_dispose),
(gst_spectrum_set_property), (gst_spectrum_set_sink_caps),
(gst_spectrum_get_sink_caps), (gst_spectrum_chain),
(gst_spectrum_change_state):
* gst/spectrum/gstspectrum.h:
Use gst_adapter, support multiple-channels, add threshold property for
result, add docs, fix resulting spectrum range (was including mirrored
results)
2006-05-21 16:23:23 +00:00
|
|
|
|
gst/equalizer/: Add 3 and 10 band version and add missing gst_object_sync_values.
Original commit message from CVS:
* gst/equalizer/Makefile.am:
* gst/equalizer/gstiirequalizer.c: (_do_init),
(gst_iir_equalizer_band_set_property),
(gst_iir_equalizer_band_class_init),
(gst_iir_equalizer_band_get_type),
(gst_iir_equalizer_child_proxy_get_child_by_index),
(gst_iir_equalizer_child_proxy_get_children_count),
(gst_iir_equalizer_child_proxy_interface_init), (setup_filter),
(gst_iir_equalizer_compute_frequencies),
(gst_iir_equalizer_transform_ip), (plugin_init):
* gst/equalizer/gstiirequalizer10bands.c:
(gst_iir_equalizer_10bands_base_init),
(gst_iir_equalizer_10bands_class_init),
(gst_iir_equalizer_10bands_init),
(gst_iir_equalizer_10bands_set_property),
(gst_iir_equalizer_10bands_get_property):
* gst/equalizer/gstiirequalizer10bands.h:
* gst/equalizer/gstiirequalizer3bands.c:
(gst_iir_equalizer_3bands_base_init),
(gst_iir_equalizer_3bands_class_init),
(gst_iir_equalizer_3bands_init),
(gst_iir_equalizer_3bands_set_property),
(gst_iir_equalizer_3bands_get_property):
* gst/equalizer/gstiirequalizer3bands.h:
* gst/equalizer/gstiirequalizernbands.c:
(gst_iir_equalizer_nbands_base_init),
(gst_iir_equalizer_nbands_init):
Add 3 and 10 band version and add missing gst_object_sync_values.
* gst/spectrum/gstspectrum.c: (gst_spectrum_event),
(gst_spectrum_transform_ip):
Add some comments about float support.
2007-03-14 14:48:08 +00:00
|
|
|
/* the current fft code is gint16 based, so supporting other formats would
|
|
|
|
* not really benefit now */
|
gst/spectrum/Makefile.am: Link to base libraries
Original commit message from CVS:
* gst/spectrum/Makefile.am:
Link to base libraries
* gst/spectrum/demo-osssrc.c: (main):
use new threshhold property
* gst/spectrum/gstspectrum.c: (gst_spectrum_class_init),
(gst_spectrum_init), (gst_spectrum_dispose),
(gst_spectrum_set_property), (gst_spectrum_set_sink_caps),
(gst_spectrum_get_sink_caps), (gst_spectrum_chain),
(gst_spectrum_change_state):
* gst/spectrum/gstspectrum.h:
Use gst_adapter, support multiple-channels, add threshold property for
result, add docs, fix resulting spectrum range (was including mirrored
results)
2006-05-21 16:23:23 +00:00
|
|
|
for (i = 0, j = 0; i < spectrum->len; i++) {
|
gst/equalizer/: Add 3 and 10 band version and add missing gst_object_sync_values.
Original commit message from CVS:
* gst/equalizer/Makefile.am:
* gst/equalizer/gstiirequalizer.c: (_do_init),
(gst_iir_equalizer_band_set_property),
(gst_iir_equalizer_band_class_init),
(gst_iir_equalizer_band_get_type),
(gst_iir_equalizer_child_proxy_get_child_by_index),
(gst_iir_equalizer_child_proxy_get_children_count),
(gst_iir_equalizer_child_proxy_interface_init), (setup_filter),
(gst_iir_equalizer_compute_frequencies),
(gst_iir_equalizer_transform_ip), (plugin_init):
* gst/equalizer/gstiirequalizer10bands.c:
(gst_iir_equalizer_10bands_base_init),
(gst_iir_equalizer_10bands_class_init),
(gst_iir_equalizer_10bands_init),
(gst_iir_equalizer_10bands_set_property),
(gst_iir_equalizer_10bands_get_property):
* gst/equalizer/gstiirequalizer10bands.h:
* gst/equalizer/gstiirequalizer3bands.c:
(gst_iir_equalizer_3bands_base_init),
(gst_iir_equalizer_3bands_class_init),
(gst_iir_equalizer_3bands_init),
(gst_iir_equalizer_3bands_set_property),
(gst_iir_equalizer_3bands_get_property):
* gst/equalizer/gstiirequalizer3bands.h:
* gst/equalizer/gstiirequalizernbands.c:
(gst_iir_equalizer_nbands_base_init),
(gst_iir_equalizer_nbands_init):
Add 3 and 10 band version and add missing gst_object_sync_values.
* gst/spectrum/gstspectrum.c: (gst_spectrum_event),
(gst_spectrum_transform_ip):
Add some comments about float support.
2007-03-14 14:48:08 +00:00
|
|
|
/* convert to mono */
|
gst/spectrum/Makefile.am: Link to base libraries
Original commit message from CVS:
* gst/spectrum/Makefile.am:
Link to base libraries
* gst/spectrum/demo-osssrc.c: (main):
use new threshhold property
* gst/spectrum/gstspectrum.c: (gst_spectrum_class_init),
(gst_spectrum_init), (gst_spectrum_dispose),
(gst_spectrum_set_property), (gst_spectrum_set_sink_caps),
(gst_spectrum_get_sink_caps), (gst_spectrum_chain),
(gst_spectrum_change_state):
* gst/spectrum/gstspectrum.h:
Use gst_adapter, support multiple-channels, add threshold property for
result, add docs, fix resulting spectrum range (was including mirrored
results)
2006-05-21 16:23:23 +00:00
|
|
|
for (k = 0, acc = 0; k < spectrum->channels; k++)
|
|
|
|
acc += samples[j++];
|
|
|
|
spectrum->re[i] = (gint16) (acc / spectrum->channels);
|
|
|
|
}
|
|
|
|
|
|
|
|
gst_spectrum_window (spectrum->re, spectrum->len);
|
|
|
|
gst_spectrum_fix_fft (spectrum->re, spectrum->im, spectrum->base, FALSE);
|
|
|
|
gst_spectrum_fix_loud (spectrum->loud, spectrum->re, spectrum->im,
|
|
|
|
spectrum->len, 0);
|
|
|
|
|
gst/spectrum/: port to use message to get results, cleanly exit when closing the window
Original commit message from CVS:
* gst/spectrum/demo-audiotest.c: (on_window_destroy),
(draw_spectrum), (message_handler), (main):
* gst/spectrum/demo-osssrc.c: (on_window_destroy), (draw_spectrum),
(message_handler), (main):
port to use message to get results, cleanly exit when closing the window
* gst/spectrum/gstspectrum.c: (gst_spectrum_class_init),
(gst_spectrum_init), (gst_spectrum_dispose),
(gst_spectrum_set_property), (gst_spectrum_get_property),
(gst_spectrum_set_caps), (gst_spectrum_start),
(gst_spectrum_message_new), (gst_spectrum_transform_ip):
* gst/spectrum/gstspectrum.h:
port to derive from basetransform and send results via messages
(like level element)
2006-06-16 09:49:07 +00:00
|
|
|
/* resample to requested number of bands */
|
|
|
|
for (i = 0, pos = 0.0; i < spectrum->bands; i++, pos += step) {
|
gst/spectrum/Makefile.am: Link to base libraries
Original commit message from CVS:
* gst/spectrum/Makefile.am:
Link to base libraries
* gst/spectrum/demo-osssrc.c: (main):
use new threshhold property
* gst/spectrum/gstspectrum.c: (gst_spectrum_class_init),
(gst_spectrum_init), (gst_spectrum_dispose),
(gst_spectrum_set_property), (gst_spectrum_set_sink_caps),
(gst_spectrum_get_sink_caps), (gst_spectrum_chain),
(gst_spectrum_change_state):
* gst/spectrum/gstspectrum.h:
Use gst_adapter, support multiple-channels, add threshold property for
result, add docs, fix resulting spectrum range (was including mirrored
results)
2006-05-21 16:23:23 +00:00
|
|
|
if (spectrum->loud[(gint) pos] > spectrum->threshold) {
|
|
|
|
spect[i] = spectrum->loud[(gint) pos] - spectrum->threshold;
|
|
|
|
/*
|
|
|
|
if (spect[i] > 15);
|
|
|
|
spect[i] = 15;
|
|
|
|
*/
|
|
|
|
} else
|
|
|
|
/* treat as silence */
|
|
|
|
spect[i] = 0;
|
|
|
|
}
|
|
|
|
|
gst/spectrum/: port to use message to get results, cleanly exit when closing the window
Original commit message from CVS:
* gst/spectrum/demo-audiotest.c: (on_window_destroy),
(draw_spectrum), (message_handler), (main):
* gst/spectrum/demo-osssrc.c: (on_window_destroy), (draw_spectrum),
(message_handler), (main):
port to use message to get results, cleanly exit when closing the window
* gst/spectrum/gstspectrum.c: (gst_spectrum_class_init),
(gst_spectrum_init), (gst_spectrum_dispose),
(gst_spectrum_set_property), (gst_spectrum_get_property),
(gst_spectrum_set_caps), (gst_spectrum_start),
(gst_spectrum_message_new), (gst_spectrum_transform_ip):
* gst/spectrum/gstspectrum.h:
port to derive from basetransform and send results via messages
(like level element)
2006-06-16 09:49:07 +00:00
|
|
|
spectrum->num_frames += spectrum->len;
|
|
|
|
endtime += blktime;
|
|
|
|
/* do we need to message ? */
|
|
|
|
if (spectrum->num_frames >=
|
|
|
|
GST_CLOCK_TIME_TO_FRAMES (spectrum->interval, spectrum->rate)) {
|
|
|
|
if (spectrum->message) {
|
|
|
|
GstMessage *m = gst_spectrum_message_new (spectrum, endtime);
|
|
|
|
|
|
|
|
gst_element_post_message (GST_ELEMENT (spectrum), m);
|
|
|
|
}
|
|
|
|
spectrum->num_frames = 0;
|
|
|
|
}
|
2006-10-06 11:31:11 +00:00
|
|
|
|
|
|
|
gst_adapter_flush (spectrum->adapter, wanted);
|
2001-12-22 23:27:31 +00:00
|
|
|
}
|
|
|
|
|
gst/spectrum/: port to use message to get results, cleanly exit when closing the window
Original commit message from CVS:
* gst/spectrum/demo-audiotest.c: (on_window_destroy),
(draw_spectrum), (message_handler), (main):
* gst/spectrum/demo-osssrc.c: (on_window_destroy), (draw_spectrum),
(message_handler), (main):
port to use message to get results, cleanly exit when closing the window
* gst/spectrum/gstspectrum.c: (gst_spectrum_class_init),
(gst_spectrum_init), (gst_spectrum_dispose),
(gst_spectrum_set_property), (gst_spectrum_get_property),
(gst_spectrum_set_caps), (gst_spectrum_start),
(gst_spectrum_message_new), (gst_spectrum_transform_ip):
* gst/spectrum/gstspectrum.h:
port to derive from basetransform and send results via messages
(like level element)
2006-06-16 09:49:07 +00:00
|
|
|
return GST_FLOW_OK;
|
gst/spectrum/Makefile.am: Link to base libraries
Original commit message from CVS:
* gst/spectrum/Makefile.am:
Link to base libraries
* gst/spectrum/demo-osssrc.c: (main):
use new threshhold property
* gst/spectrum/gstspectrum.c: (gst_spectrum_class_init),
(gst_spectrum_init), (gst_spectrum_dispose),
(gst_spectrum_set_property), (gst_spectrum_set_sink_caps),
(gst_spectrum_get_sink_caps), (gst_spectrum_chain),
(gst_spectrum_change_state):
* gst/spectrum/gstspectrum.h:
Use gst_adapter, support multiple-channels, add threshold property for
result, add docs, fix resulting spectrum range (was including mirrored
results)
2006-05-21 16:23:23 +00:00
|
|
|
}
|
|
|
|
|
2001-12-22 23:27:31 +00:00
|
|
|
static gboolean
|
2004-03-14 22:34:33 +00:00
|
|
|
plugin_init (GstPlugin * plugin)
|
2001-12-22 23:27:31 +00:00
|
|
|
{
|
2004-03-14 22:34:33 +00:00
|
|
|
return gst_element_register (plugin, "spectrum", GST_RANK_NONE,
|
|
|
|
GST_TYPE_SPECTRUM);
|
2001-12-22 23:27:31 +00:00
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
|
|
|
GST_VERSION_MINOR,
|
|
|
|
"spectrum",
|
|
|
|
"Run an FFT on the audio signal, output spectrum data",
|
2006-04-01 10:09:11 +00:00
|
|
|
plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
|