summaryrefslogtreecommitdiffstats
path: root/gst/wavparse
diff options
context:
space:
mode:
authorStefan Kost <ensonic@users.sourceforge.net>2007-11-13 06:23:51 +0000
committerStefan Kost <ensonic@users.sourceforge.net>2007-11-13 06:23:51 +0000
commit34c221a52f3aec1726c8d390bee259c1381fa8a9 (patch)
tree25177b61a5a56fc74d72d6718321ad73158a6fad /gst/wavparse
parent85ea09f1431d759eeeccc67877a3ae165272aa82 (diff)
gst/wavparse/gstwavparse.c: Ref the element when we should, but not when we its not needed. Reflow the event_handling...
Original commit message from CVS: * gst/wavparse/gstwavparse.c: (gst_wavparse_stream_headers), (gst_wavparse_pad_convert), (gst_wavparse_pad_query), (gst_wavparse_srcpad_event): Ref the element when we should, but not when we its not needed. Reflow the event_handling to not leak the event.
Diffstat (limited to 'gst/wavparse')
-rw-r--r--gst/wavparse/gstwavparse.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/gst/wavparse/gstwavparse.c b/gst/wavparse/gstwavparse.c
index 2e0d1fc0..8512ed52 100644
--- a/gst/wavparse/gstwavparse.c
+++ b/gst/wavparse/gstwavparse.c
@@ -1851,7 +1851,7 @@ gst_wavparse_pad_convert (GstPad * pad,
GstWavParse *wavparse;
gboolean res = TRUE;
- wavparse = GST_WAVPARSE (gst_pad_get_parent (pad));
+ wavparse = GST_WAVPARSE (GST_PAD_PARENT (pad));
if (*dest_format == src_format) {
*dest_value = src_value;
@@ -1941,8 +1941,6 @@ gst_wavparse_pad_convert (GstPad * pad,
}
done:
- gst_object_unref (wavparse);
-
return res;
/* ERRORS */
@@ -1973,7 +1971,7 @@ static gboolean
gst_wavparse_pad_query (GstPad * pad, GstQuery * query)
{
gboolean res = TRUE;
- GstWavParse *wav = GST_WAVPARSE (GST_PAD_PARENT (pad));
+ GstWavParse *wav = GST_WAVPARSE (gst_pad_get_parent (pad));
/* only if we know */
if (wav->state != GST_WAVPARSE_DATA)
@@ -2062,33 +2060,32 @@ gst_wavparse_pad_query (GstPad * pad, GstQuery * query)
res = gst_pad_query_default (pad, query);
break;
}
+ gst_object_unref (wav);
return res;
}
static gboolean
gst_wavparse_srcpad_event (GstPad * pad, GstEvent * event)
{
- GstWavParse *wavparse = GST_WAVPARSE (GST_PAD_PARENT (pad));
- gboolean res = TRUE;
+ GstWavParse *wavparse = GST_WAVPARSE (gst_pad_get_parent (pad));
+ gboolean res = FALSE;
GST_DEBUG_OBJECT (wavparse, "event %d, %s", GST_EVENT_TYPE (event),
GST_EVENT_TYPE_NAME (event));
- /* can only handle events when we are in the data state */
- if (wavparse->state != GST_WAVPARSE_DATA)
- return FALSE;
-
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_SEEK:
- {
- res = gst_wavparse_perform_seek (wavparse, event);
+ /* can only handle events when we are in the data state */
+ if (wavparse->state != GST_WAVPARSE_DATA) {
+ res = gst_wavparse_perform_seek (wavparse, event);
+ }
gst_event_unref (event);
break;
- }
default:
res = gst_pad_push_event (wavparse->sinkpad, event);
break;
}
+ gst_object_unref (wavparse);
return res;
}