summaryrefslogtreecommitdiffstats
path: root/gst/auparse
diff options
context:
space:
mode:
authorRonald S. Bultje <rbultje@ronald.bitfreak.net>2004-05-11 00:20:02 +0000
committerRonald S. Bultje <rbultje@ronald.bitfreak.net>2004-05-11 00:20:02 +0000
commitd303506bcaf59d68c82ec90b0a985d55901b4865 (patch)
tree682e403c7238d6153b51a7d63af133d0a2736421 /gst/auparse
parent3eb5b6313bbc9906507b66bf70178ee15780fb86 (diff)
gst/auparse/gstauparse.c: Hack around spider. Remove me some day please.
Original commit message from CVS: * gst/auparse/gstauparse.c: (gst_auparse_class_init), (gst_auparse_init), (gst_auparse_chain), (gst_auparse_change_state): Hack around spider. Remove me some day please.
Diffstat (limited to 'gst/auparse')
-rw-r--r--gst/auparse/gstauparse.c45
1 files changed, 41 insertions, 4 deletions
diff --git a/gst/auparse/gstauparse.c b/gst/auparse/gstauparse.c
index c8473e83..5838bd1d 100644
--- a/gst/auparse/gstauparse.c
+++ b/gst/auparse/gstauparse.c
@@ -48,7 +48,7 @@ GST_STATIC_PAD_TEMPLATE ("sink",
static GstStaticPadTemplate gst_auparse_src_template =
GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
- GST_PAD_ALWAYS,
+ GST_PAD_SOMETIMES, /* FIXME: spider */
GST_STATIC_CAPS (GST_AUDIO_INT_PAD_TEMPLATE_CAPS "; " /* does not support 24bit without patch */
GST_AUDIO_FLOAT_PAD_TEMPLATE_CAPS "; "
"audio/x-alaw, "
@@ -77,6 +77,8 @@ static void gst_auparse_init (GstAuParse * auparse);
static void gst_auparse_chain (GstPad * pad, GstData * _data);
+static GstElementStateReturn gst_auparse_change_state (GstElement * element);
+
static GstElementClass *parent_class = NULL;
/*static guint gst_auparse_signals[LAST_SIGNAL] = { 0 }; */
@@ -127,6 +129,8 @@ gst_auparse_class_init (GstAuParseClass * klass)
gstelement_class = (GstElementClass *) klass;
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
+
+ gstelement_class->change_state = gst_auparse_change_state;
}
static void
@@ -138,11 +142,13 @@ 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 =
- gst_pad_new_from_template (gst_static_pad_template_get
+ auparse->srcpad = NULL;
+#if 0 /* FIXME: spider */
+ 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_explicit_caps (auparse->srcpad);
+#endif
auparse->offset = 0;
auparse->size = 0;
@@ -268,10 +274,16 @@ Samples :
case 26: /* 5 bit CCITT G723 ADPCM */
default:
- g_warning ("help!, dont know how to deal with this format yet\n");
+ GST_ELEMENT_ERROR (auparse, STREAM, FORMAT, (NULL), (NULL));
+ gst_buffer_unref (buf);
return;
}
+ auparse->srcpad =
+ gst_pad_new_from_template (gst_static_pad_template_get
+ (&gst_auparse_src_template), "src");
+ gst_pad_use_explicit_caps (auparse->srcpad);
+
if (law) {
tempcaps =
gst_caps_new_simple ((law == 1) ? "audio/x-mulaw" : "audio/x-alaw",
@@ -293,9 +305,13 @@ Samples :
if (!gst_pad_set_explicit_caps (auparse->srcpad, tempcaps)) {
gst_buffer_unref (buf);
+ gst_object_unref (GST_OBJECT (auparse->srcpad));
+ auparse->srcpad = NULL;
return;
}
+ gst_element_add_pad (GST_ELEMENT (auparse), auparse->srcpad);
+
newbuf = gst_buffer_new ();
GST_BUFFER_DATA (newbuf) = (gpointer) malloc (size - (auparse->offset));
memcpy (GST_BUFFER_DATA (newbuf), data + 24, size - (auparse->offset));
@@ -310,6 +326,27 @@ Samples :
gst_pad_push (auparse->srcpad, GST_DATA (buf));
}
+static GstElementStateReturn
+gst_auparse_change_state (GstElement * element)
+{
+ GstAuParse *auparse = GST_AUPARSE (element);
+
+ switch (GST_STATE_TRANSITION (element)) {
+ case GST_STATE_PAUSED_TO_READY:
+ if (auparse->srcpad) {
+ gst_element_remove_pad (element, auparse->srcpad);
+ auparse->srcpad = NULL;
+ }
+ break;
+ default:
+ break;
+ }
+
+ if (parent_class->change_state)
+ return parent_class->change_state (element);
+
+ return GST_STATE_SUCCESS;
+}
static gboolean
plugin_init (GstPlugin * plugin)