code cleanups renamed FORMAT to WIDTH and disabled it since the code is fixed for 16 bit

Original commit message from CVS:
code cleanups
renamed FORMAT to WIDTH and disabled it since the code is fixed for 16 bit
This commit is contained in:
Thomas Vander Stichele 2002-10-01 12:03:05 +00:00
parent 8e4fdf7c7a
commit 7917c63f5d

View File

@ -48,7 +48,7 @@ enum {
enum {
ARG_0,
ARG_FORMAT,
/* ARG_WIDTH, */ /* width is not even implemented so no use in having this */
ARG_SAMPLERATE,
ARG_TABLESIZE,
ARG_SAMPLES_PER_BUFFER,
@ -76,16 +76,21 @@ GST_PAD_TEMPLATE_FACTORY (sinesrc_src_factory,
static void gst_sinesrc_class_init (GstSineSrcClass *klass);
static void gst_sinesrc_init (GstSineSrc *src);
static void gst_sinesrc_set_property (GObject *object, guint prop_id,
const GValue *value, GParamSpec *pspec);
static void gst_sinesrc_get_property (GObject *object, guint prop_id,
GValue *value, GParamSpec *pspec);
static void gst_sinesrc_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec);
static void gst_sinesrc_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec);
/*static gboolean gst_sinesrc_change_state(GstElement *element, */
/* GstElementState state); */
/*static void gst_sinesrc_close_audio(GstSineSrc *src); */
/*static gboolean gst_sinesrc_open_audio(GstSineSrc *src); */
static void gst_sinesrc_update_freq(const GValue *value, gpointer data);
static void gst_sinesrc_update_freq (const GValue *value,
gpointer data);
static void gst_sinesrc_populate_sinetable (GstSineSrc *src);
static inline void gst_sinesrc_update_table_inc (GstSineSrc *src);
static void gst_sinesrc_force_caps (GstSineSrc *src);
@ -102,17 +107,13 @@ gst_sinesrc_get_type (void)
if (!sinesrc_type) {
static const GTypeInfo sinesrc_info = {
sizeof(GstSineSrcClass),
NULL,
NULL,
(GClassInitFunc)gst_sinesrc_class_init,
NULL,
NULL,
sizeof(GstSineSrc),
0,
sizeof (GstSineSrcClass), NULL, NULL,
(GClassInitFunc) gst_sinesrc_class_init, NULL, NULL,
sizeof (GstSineSrc), 0,
(GInstanceInitFunc) gst_sinesrc_init,
};
sinesrc_type = g_type_register_static (GST_TYPE_ELEMENT, "GstSineSrc", &sinesrc_info, 0);
sinesrc_type = g_type_register_static (GST_TYPE_ELEMENT, "GstSineSrc",
&sinesrc_info, 0);
}
return sinesrc_type;
}
@ -128,23 +129,27 @@ gst_sinesrc_class_init (GstSineSrcClass *klass)
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_FORMAT,
g_param_spec_int("format","format","format",
G_MININT,G_MAXINT,0,G_PARAM_READWRITE));
/*
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_WIDTH,
g_param_spec_int("width", "Width", "Width of audio data in bits",
1, 32, 0, G_PARAM_READWRITE));
*/
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SAMPLERATE,
g_param_spec_int("samplerate","samplerate","samplerate",
G_MININT,G_MAXINT,0,G_PARAM_READWRITE));
g_param_spec_int ("samplerate","Sample Rate","Sample Rate (in Hz)",
1, G_MAXINT, 0, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_TABLESIZE,
g_param_spec_int ("tablesize", "tablesize", "tablesize",
G_MININT,G_MAXINT,0,G_PARAM_READWRITE));
g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_SAMPLES_PER_BUFFER,
g_param_spec_int("samplesperbuffer","samplesperbuffer","samplesperbuffer",
0, G_MAXINT, 1024, G_PARAM_READWRITE));
1, G_MAXINT, 0, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass),
ARG_SAMPLES_PER_BUFFER,
g_param_spec_int ("samplesperbuffer", "Samples per buffer",
"Number of samples in each outgoing buffer",
1, G_MAXINT, 1024, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FREQ,
g_param_spec_float("freq","freq","freq",
g_param_spec_float ("freq", "Frequency", "Frequency of sine source",
0.0, 20000.0, 440.0, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_VOLUME,
g_param_spec_float("volume","volume","volume",
g_param_spec_float ("volume", "Volume", "Volume",
0.0, 1.0, 0.8, G_PARAM_READWRITE));
gobject_class->set_property = gst_sinesrc_set_property;
@ -163,7 +168,7 @@ gst_sinesrc_init (GstSineSrc *src)
gst_pad_set_get_function (src->srcpad, gst_sinesrc_get);
src->format = 16;
src->width = 16;
src->samplerate = 44100;
src->volume = 1.0;
src->freq = 440.0;
@ -269,17 +274,17 @@ gst_sinesrc_get(GstPad *pad)
}
static void
gst_sinesrc_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
gst_sinesrc_set_property (GObject *object, guint prop_id,
const GValue *value, GParamSpec *pspec)
{
GstSineSrc *src;
/* it's not null if we got it, but it might not be ours */
g_return_if_fail (GST_IS_SINESRC (object));
src = GST_SINESRC (object);
switch (prop_id) {
case ARG_FORMAT:
src->format = g_value_get_int (value);
case ARG_WIDTH:
src->width = g_value_get_int (value);
src->newcaps = TRUE;
break;
case ARG_SAMPLERATE:
@ -310,7 +315,8 @@ gst_sinesrc_set_property (GObject *object, guint prop_id, const GValue *value, G
}
static void
gst_sinesrc_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
gst_sinesrc_get_property (GObject *object, guint prop_id,
GValue *value, GParamSpec *pspec)
{
GstSineSrc *src;
@ -319,8 +325,8 @@ gst_sinesrc_get_property (GObject *object, guint prop_id, GValue *value, GParamS
src = GST_SINESRC(object);
switch (prop_id) {
case ARG_FORMAT:
g_value_set_int (value, src->format);
case ARG_WIDTH:
g_value_set_int (value, src->width);
break;
case ARG_SAMPLERATE:
g_value_set_int (value, src->samplerate);
@ -433,7 +439,8 @@ plugin_init (GModule *module, GstPlugin *plugin)
&gst_sinesrc_details);
g_return_val_if_fail (factory != NULL, FALSE);
gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET (sinesrc_src_factory));
gst_element_factory_add_pad_template (factory,
GST_PAD_TEMPLATE_GET (sinesrc_src_factory));
gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory));