mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-18 22:36:33 +00:00
gst/spectrum/gstspectrum.c: Fix and cleanup default property values.
Original commit message from CVS: * gst/spectrum/gstspectrum.c: (gst_spectrum_class_init), (gst_spectrum_init), (gst_spectrum_set_property), (gst_spectrum_transform_ip): Fix and cleanup default property values. Add FIXMEs for stuff that looks rather wrong.
This commit is contained in:
parent
85c849417d
commit
91ffb37c7a
2 changed files with 25 additions and 6 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
2007-03-06 Wim Taymans <wim@fluendo.com>
|
||||||
|
|
||||||
|
* gst/spectrum/gstspectrum.c: (gst_spectrum_class_init),
|
||||||
|
(gst_spectrum_init), (gst_spectrum_set_property),
|
||||||
|
(gst_spectrum_transform_ip):
|
||||||
|
Fix and cleanup default property values.
|
||||||
|
Add FIXMEs for stuff that looks rather wrong.
|
||||||
|
|
||||||
2007-03-05 Stefan Kost <ensonic@users.sf.net>
|
2007-03-05 Stefan Kost <ensonic@users.sf.net>
|
||||||
|
|
||||||
* gst/spectrum/demo-audiotest.c: (message_handler):
|
* gst/spectrum/demo-audiotest.c: (message_handler):
|
||||||
|
|
|
@ -93,6 +93,11 @@ GST_STATIC_PAD_TEMPLATE ("src",
|
||||||
);
|
);
|
||||||
|
|
||||||
/* Spectrum properties */
|
/* Spectrum properties */
|
||||||
|
#define DEFAULT_SIGNAL_SPECTRUM TRUE
|
||||||
|
#define DEFAULT_SIGNAL_INTERVAL (GST_SECOND / 10)
|
||||||
|
#define DEFAULT_BANDS 128
|
||||||
|
#define DEFAULT_THRESHOLD -60
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
PROP_0,
|
PROP_0,
|
||||||
|
@ -157,20 +162,20 @@ gst_spectrum_class_init (GstSpectrumClass * klass)
|
||||||
g_object_class_install_property (gobject_class, PROP_SIGNAL_SPECTRUM,
|
g_object_class_install_property (gobject_class, PROP_SIGNAL_SPECTRUM,
|
||||||
g_param_spec_boolean ("message", "Message",
|
g_param_spec_boolean ("message", "Message",
|
||||||
"Post a level message for each passed interval",
|
"Post a level message for each passed interval",
|
||||||
TRUE, G_PARAM_READWRITE));
|
DEFAULT_SIGNAL_SPECTRUM, G_PARAM_READWRITE));
|
||||||
|
|
||||||
g_object_class_install_property (gobject_class, PROP_SIGNAL_INTERVAL,
|
g_object_class_install_property (gobject_class, PROP_SIGNAL_INTERVAL,
|
||||||
g_param_spec_uint64 ("interval", "Interval",
|
g_param_spec_uint64 ("interval", "Interval",
|
||||||
"Interval of time between message posts (in nanoseconds)",
|
"Interval of time between message posts (in nanoseconds)",
|
||||||
1, G_MAXUINT64, GST_SECOND / 10, G_PARAM_READWRITE));
|
1, G_MAXUINT64, DEFAULT_SIGNAL_INTERVAL, G_PARAM_READWRITE));
|
||||||
|
|
||||||
g_object_class_install_property (gobject_class, PROP_BANDS,
|
g_object_class_install_property (gobject_class, PROP_BANDS,
|
||||||
g_param_spec_uint ("bands", "Bands", "number of frequency bands",
|
g_param_spec_uint ("bands", "Bands", "number of frequency bands",
|
||||||
0, G_MAXUINT, 0, G_PARAM_READWRITE));
|
0, G_MAXUINT, DEFAULT_BANDS, G_PARAM_READWRITE));
|
||||||
|
|
||||||
g_object_class_install_property (gobject_class, PROP_THRESHOLD,
|
g_object_class_install_property (gobject_class, PROP_THRESHOLD,
|
||||||
g_param_spec_int ("threshold", "Threshold",
|
g_param_spec_int ("threshold", "Threshold",
|
||||||
"db threshold for result, maps to 0", G_MININT, 0, -60,
|
"db threshold for result, maps to 0", G_MININT, 0, DEFAULT_THRESHOLD,
|
||||||
G_PARAM_READWRITE));
|
G_PARAM_READWRITE));
|
||||||
|
|
||||||
GST_DEBUG_CATEGORY_INIT (gst_spectrum_debug, "spectrum", 0,
|
GST_DEBUG_CATEGORY_INIT (gst_spectrum_debug, "spectrum", 0,
|
||||||
|
@ -182,8 +187,10 @@ gst_spectrum_init (GstSpectrum * spectrum, GstSpectrumClass * g_class)
|
||||||
{
|
{
|
||||||
spectrum->adapter = gst_adapter_new ();
|
spectrum->adapter = gst_adapter_new ();
|
||||||
|
|
||||||
spectrum->interval = GST_SECOND / 10;
|
spectrum->message = DEFAULT_SIGNAL_SPECTRUM;
|
||||||
spectrum->bands = 128;
|
spectrum->interval = DEFAULT_SIGNAL_INTERVAL;
|
||||||
|
spectrum->bands = DEFAULT_BANDS;
|
||||||
|
spectrum->threshold = DEFAULT_THRESHOLD;
|
||||||
spectrum->base = 9;
|
spectrum->base = 9;
|
||||||
spectrum->len = 1024; /* 2 ^ (base+1) */
|
spectrum->len = 1024; /* 2 ^ (base+1) */
|
||||||
|
|
||||||
|
@ -230,6 +237,7 @@ gst_spectrum_set_property (GObject * object, guint prop_id,
|
||||||
filter->interval = g_value_get_uint64 (value);
|
filter->interval = g_value_get_uint64 (value);
|
||||||
break;
|
break;
|
||||||
case PROP_BANDS:
|
case PROP_BANDS:
|
||||||
|
/* FIXME, this will segfault when the transform function is running */
|
||||||
filter->bands = g_value_get_uint (value);
|
filter->bands = g_value_get_uint (value);
|
||||||
g_free (filter->spect);
|
g_free (filter->spect);
|
||||||
filter->spect = g_malloc (filter->bands * sizeof (guchar));
|
filter->spect = g_malloc (filter->bands * sizeof (guchar));
|
||||||
|
@ -360,6 +368,9 @@ gst_spectrum_transform_ip (GstBaseTransform * trans, GstBuffer * in)
|
||||||
gint32 acc;
|
gint32 acc;
|
||||||
gfloat pos, step;
|
gfloat pos, step;
|
||||||
guchar *spect = spectrum->spect;
|
guchar *spect = spectrum->spect;
|
||||||
|
|
||||||
|
/* FIXME, the buffer timestamp does not mean anything, maybe you mean
|
||||||
|
* stream_time or running_time? */
|
||||||
GstClockTime endtime = GST_BUFFER_TIMESTAMP (in);
|
GstClockTime endtime = GST_BUFFER_TIMESTAMP (in);
|
||||||
GstClockTime blktime =
|
GstClockTime blktime =
|
||||||
GST_FRAMES_TO_CLOCK_TIME (spectrum->len, spectrum->rate);
|
GST_FRAMES_TO_CLOCK_TIME (spectrum->len, spectrum->rate);
|
||||||
|
|
Loading…
Reference in a new issue