gst/level/gstlevel.*: figure out if we're initialized directly instead of keeping a variable that's wrong in 90% of c...
Original commit message from CVS: * gst/level/gstlevel.c: (gst_level_link), (gst_level_chain), (gst_level_change_state), (gst_level_init): * gst/level/gstlevel.h: figure out if we're initialized directly instead of keeping a variable that's wrong in 90% of cases don't initialize pads and then leak them and use a new unitialized pad. (fixes #142084) these were bugs so n00bish I didn't find them for an hour :/
This commit is contained in:
parent
f868ebb4bc
commit
368d6780c2
11
ChangeLog
11
ChangeLog
@ -1,3 +1,14 @@
|
|||||||
|
2004-05-08 Benjamin Otte <otte@gnome.org>
|
||||||
|
|
||||||
|
* gst/level/gstlevel.c: (gst_level_link), (gst_level_chain),
|
||||||
|
(gst_level_change_state), (gst_level_init):
|
||||||
|
* gst/level/gstlevel.h:
|
||||||
|
figure out if we're initialized directly instead of keeping a
|
||||||
|
variable that's wrong in 90% of cases
|
||||||
|
don't initialize pads and then leak them and use a new unitialized
|
||||||
|
pad. (fixes #142084)
|
||||||
|
these were bugs so n00bish I didn't find them for an hour :/
|
||||||
|
|
||||||
2004-05-08 Iain <iain@prettypeople.org>
|
2004-05-08 Iain <iain@prettypeople.org>
|
||||||
|
|
||||||
* gst/wavparse/gstwavparse.[ch]: Rewrote to use RiffRead instead.
|
* gst/wavparse/gstwavparse.[ch]: Rewrote to use RiffRead instead.
|
||||||
|
@ -165,8 +165,6 @@ gst_level_link (GstPad * pad, const GstCaps * caps)
|
|||||||
filter->MS[i] = filter->RMS_dB[i] = 0.0;
|
filter->MS[i] = filter->RMS_dB[i] = 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
filter->inited = TRUE;
|
|
||||||
|
|
||||||
return GST_PAD_LINK_OK;
|
return GST_PAD_LINK_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -196,6 +194,13 @@ gst_level_fast_16bit_chain (gint16 * in, guint num, gint channels,
|
|||||||
g_return_if_fail (filter != NULL);
|
g_return_if_fail (filter != NULL);
|
||||||
g_return_if_fail (GST_IS_LEVEL (filter));
|
g_return_if_fail (GST_IS_LEVEL (filter));
|
||||||
|
|
||||||
|
if (!gst_pad_is_negotiated (pad)) {
|
||||||
|
GST_ELEMENT_ERROR (filter, CORE, NEGOTIATION, (NULL),
|
||||||
|
("sinkpad not negotiated"));
|
||||||
|
gst_data_unref (_data);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i < filter->channels; ++i)
|
for (i = 0; i < filter->channels; ++i)
|
||||||
filter->CS[i] = filter->peak[i] = filter->MS[i] = filter->RMS_dB[i] = 0.0;
|
filter->CS[i] = filter->peak[i] = filter->MS[i] = filter->RMS_dB[i] = 0.0;
|
||||||
|
|
||||||
@ -288,12 +293,8 @@ gst_level_fast_16bit_chain (gint16 * in, guint num, gint channels,
|
|||||||
static GstElementStateReturn
|
static GstElementStateReturn
|
||||||
gst_level_change_state (GstElement * element)
|
gst_level_change_state (GstElement * element)
|
||||||
{
|
{
|
||||||
GstLevel *filter = GST_LEVEL (element);
|
|
||||||
|
|
||||||
switch (GST_STATE_TRANSITION (element)) {
|
switch (GST_STATE_TRANSITION (element)) {
|
||||||
case GST_STATE_PAUSED_TO_PLAYING:
|
case GST_STATE_PAUSED_TO_PLAYING:
|
||||||
if (!filter->inited)
|
|
||||||
return GST_STATE_FAILURE;
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -418,15 +419,14 @@ gst_level_init (GstLevel * filter)
|
|||||||
(&sink_template_factory), "sink");
|
(&sink_template_factory), "sink");
|
||||||
gst_pad_set_link_function (filter->sinkpad, gst_level_link);
|
gst_pad_set_link_function (filter->sinkpad, gst_level_link);
|
||||||
gst_pad_set_getcaps_function (filter->sinkpad, gst_pad_proxy_getcaps);
|
gst_pad_set_getcaps_function (filter->sinkpad, gst_pad_proxy_getcaps);
|
||||||
|
gst_element_add_pad (GST_ELEMENT (filter), filter->sinkpad);
|
||||||
|
gst_pad_set_chain_function (filter->sinkpad, gst_level_chain);
|
||||||
|
|
||||||
filter->srcpad =
|
filter->srcpad =
|
||||||
gst_pad_new_from_template (gst_static_pad_template_get
|
gst_pad_new_from_template (gst_static_pad_template_get
|
||||||
(&src_template_factory), "src");
|
(&src_template_factory), "src");
|
||||||
gst_pad_set_link_function (filter->srcpad, gst_level_link);
|
gst_pad_set_link_function (filter->srcpad, gst_level_link);
|
||||||
gst_pad_set_getcaps_function (filter->srcpad, gst_pad_proxy_getcaps);
|
gst_pad_set_getcaps_function (filter->srcpad, gst_pad_proxy_getcaps);
|
||||||
|
|
||||||
gst_element_add_pad (GST_ELEMENT (filter), filter->sinkpad);
|
|
||||||
gst_pad_set_chain_function (filter->sinkpad, gst_level_chain);
|
|
||||||
filter->srcpad = gst_pad_new ("src", GST_PAD_SRC);
|
|
||||||
gst_element_add_pad (GST_ELEMENT (filter), filter->srcpad);
|
gst_element_add_pad (GST_ELEMENT (filter), filter->srcpad);
|
||||||
|
|
||||||
filter->CS = NULL;
|
filter->CS = NULL;
|
||||||
|
@ -54,7 +54,6 @@ struct _GstLevel {
|
|||||||
|
|
||||||
GstPad *sinkpad, *srcpad;
|
GstPad *sinkpad, *srcpad;
|
||||||
gboolean signal; /* whether or not to emit signals */
|
gboolean signal; /* whether or not to emit signals */
|
||||||
gboolean inited; /* whether or not the element is initialized */
|
|
||||||
gdouble interval; /* how many seconds between emits */
|
gdouble interval; /* how many seconds between emits */
|
||||||
|
|
||||||
gint rate; /* caps variables */
|
gint rate; /* caps variables */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user