Just some cleanup.

Original commit message from CVS:
Just some cleanup.
This commit is contained in:
Edgard Lima 2005-10-31 19:08:27 +00:00
parent 7d5d482411
commit f8667dcaec
2 changed files with 34 additions and 24 deletions

View file

@ -1,3 +1,9 @@
2005-10-31 Edgard Lima <edgard.lima@indt.org.br>
* gst/auparse/gstauparse.c: gst_auparse_init, gst_auparse_chain,
gst_auparse_change_state:
Just some cleanup.
2005-10-31 Edgard Lima <edgard.lima@indt.org.br>
* ext/speex/gstspeexenc.c: (gst_speexenc_chain)

View file

@ -146,13 +146,10 @@ gst_auparse_init (GstAuParse * auparse)
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;
@ -174,10 +171,6 @@ gst_auparse_chain (GstPad * pad, GstBuffer * buf)
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'",
@ -226,6 +219,8 @@ gst_auparse_chain (GstPad * pad, GstBuffer * buf)
} else {
GST_ELEMENT_ERROR (auparse, STREAM, WRONG_TYPE, (NULL), (NULL));
gst_buffer_unref (buf);
g_object_unref (auparse);
return GST_FLOW_ERROR;
}
@ -311,18 +306,11 @@ Samples :
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",
@ -348,15 +336,14 @@ Samples :
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;
@ -376,10 +363,13 @@ Samples :
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);
}
@ -387,10 +377,24 @@ Samples :
static GstStateChangeReturn
gst_auparse_change_state (GstElement * element, GstStateChange transition)
{
if (parent_class->change_state)
return parent_class->change_state (element, transition);
GstAuParse *auparse = GST_AUPARSE (element);
GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
return GST_STATE_CHANGE_SUCCESS;
if (parent_class->change_state)
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 ret;
}
static gboolean