gst_element_add_pad (GST_ELEMENT (auparse), auparse->sinkpad);
gst_pad_set_chain_function (auparse->sinkpad, gst_auparse_chain);
- auparse->srcpad = NULL;
-#if 0 /* FIXME: spider */
- gst_pad_new_from_template (gst_static_pad_template_get
+ auparse->srcpad = gst_pad_new_from_template (gst_static_pad_template_get
(&gst_auparse_src_template), "src");
- gst_element_add_pad (GST_ELEMENT (auparse), auparse->srcpad);
gst_pad_use_fixed_caps (auparse->srcpad);
-#endif
+ gst_element_add_pad (GST_ELEMENT (auparse), auparse->srcpad);
auparse->offset = 0;
auparse->size = 0;
layout[0] = 0;
- g_return_val_if_fail (pad != NULL, GST_FLOW_ERROR);
- g_return_val_if_fail (GST_IS_PAD (pad), GST_FLOW_ERROR);
- g_return_val_if_fail (buf != NULL, GST_FLOW_ERROR);
-
auparse = GST_AUPARSE (gst_pad_get_parent (pad));
GST_DEBUG ("gst_auparse_chain: got buffer in '%s'",
} else {
GST_ELEMENT_ERROR (auparse, STREAM, WRONG_TYPE, (NULL), (NULL));
+ gst_buffer_unref (buf);
+ g_object_unref (auparse);
return GST_FLOW_ERROR;
}
default:
GST_ELEMENT_ERROR (auparse, STREAM, FORMAT, (NULL), (NULL));
+ gst_buffer_unref (buf);
+ g_object_unref (auparse);
return GST_FLOW_ERROR;
}
- auparse->srcpad =
- gst_pad_new_from_template (gst_static_pad_template_get
- (&gst_auparse_src_template), "src");
-
- g_return_val_if_fail (auparse->srcpad != NULL, GST_FLOW_ERROR);
-
-
- gst_pad_use_fixed_caps (auparse->srcpad);
-
if (law) {
tempcaps =
gst_caps_new_simple ((law == 1) ? "audio/x-mulaw" : "audio/x-alaw",
NULL);
}
- gst_pad_use_fixed_caps (auparse->srcpad);
gst_pad_set_active (auparse->srcpad, TRUE);
gst_pad_set_caps (auparse->srcpad, tempcaps);
- gst_element_add_pad (GST_ELEMENT (auparse), auparse->srcpad);
if ((ret = gst_pad_alloc_buffer (auparse->srcpad, GST_BUFFER_OFFSET_NONE,
size - (auparse->offset),
GST_PAD_CAPS (auparse->srcpad), &newbuf)) != GST_FLOW_OK) {
- printf ("failed gst_pad_alloc_buffer\n");
+ gst_buffer_unref (buf);
+ g_object_unref (auparse);
return ret;
}
ret = GST_FLOW_OK;
gst_pad_push_event (auparse->srcpad, event);
+ gst_buffer_unref (buf);
+ g_object_unref (auparse);
return gst_pad_push (auparse->srcpad, newbuf);
}
+ g_object_unref (auparse);
return gst_pad_push (auparse->srcpad, buf);
}
static GstStateChangeReturn
gst_auparse_change_state (GstElement * element, GstStateChange transition)
{
+ GstAuParse *auparse = GST_AUPARSE (element);
+ GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
+
if (parent_class->change_state)
- return parent_class->change_state (element, transition);
+ ret = parent_class->change_state (element, transition);
+
+ switch (transition) {
+ case GST_STATE_CHANGE_READY_TO_NULL:
+ auparse->offset = 0;
+ auparse->size = 0;
+ auparse->encoding = 0;
+ auparse->frequency = 0;
+ auparse->channels = 0;
+ default:
+ break;
+ }
- return GST_STATE_CHANGE_SUCCESS;
+ return ret;
}
static gboolean