+2005-12-07 Edward Hervey <edward@fluendo.com>
+
+ Time to welcome ogm to 0.10 :)
+
+ * ext/ogg/gstoggdemux.c: (internal_element_pad_added_cb),
+ (gst_ogg_pad_typefind):
+ Oggdemux can now properly typefind elements with dynamic pads.
+ * ext/ogg/gstogmparse.c: (gst_ogm_parse_chain):
+ Properly set caps on src pad, and set caps on outgoing buffers.
+
2005-12-06 Thomas Vander Stichele <thomas at apestaart dot org>
* ext/alsa/gstalsamixer.h:
GstClockTime first_time; /* the timestamp of the second page */
ogg_stream_state stream;
+
+ gboolean dynamic; /* True if the internal element had dynamic pads */
+ guint padaddedid; /* The signal id for element::pad-added */
};
struct _GstOggPadClass
return GST_FLOW_OK;
}
+static void
+internal_element_pad_added_cb (GstElement * element, GstPad * pad,
+ GstOggPad * oggpad)
+{
+ if (GST_PAD_DIRECTION (pad) == GST_PAD_SRC) {
+ if (!(gst_pad_link (pad, oggpad->elem_out) == GST_PAD_LINK_OK)) {
+ GST_ERROR ("Really couldn't find a valid pad");
+ }
+ oggpad->dynamic = FALSE;
+ g_signal_handler_disconnect (element, oggpad->padaddedid);
+ oggpad->padaddedid = 0;
+ }
+}
+
/* runs typefind on the packet, which is assumed to be the first
* packet in the stream.
*
gst_object_unref (template);
/* and this pad may not be named src.. */
+ /* And it might also not exist at this time... */
{
GstPad *p;
p = gst_element_get_pad (element, "src");
- gst_pad_link (p, pad->elem_out);
- gst_object_unref (p);
+ if (p) {
+ gst_pad_link (p, pad->elem_out);
+ gst_object_unref (p);
+ } else {
+ pad->dynamic = TRUE;
+ pad->padaddedid = g_signal_connect (G_OBJECT (element),
+ "pad-added", G_CALLBACK (internal_element_pad_added_cb), pad);
+ }
}
}
}
g_assert_not_reached ();
}
- ogm->srcpad = gst_pad_new_from_template (ogm->srcpadtempl, "src");
- //gst_pad_use_explicit_caps (ogm->srcpad);
- //if (!gst_pad_set_explicit_caps (ogm->srcpad, caps)) {
- // GST_ELEMENT_ERROR (ogm, CORE, NEGOTIATION, (NULL), (NULL));
- //gst_object_unref (ogm->srcpad);
- // ogm->srcpad = NULL;
- // break;
- //}
+ if (caps) {
+ ogm->srcpad = gst_pad_new ("src", GST_PAD_SRC);
+ gst_pad_set_caps (ogm->srcpad, caps);
+ } else {
+ GST_WARNING_OBJECT (ogm,
+ "No fixed caps were found, carrying on with template");
+ ogm->srcpad = gst_pad_new_from_template (ogm->srcpadtempl, "src");
+ }
gst_element_add_pad (GST_ELEMENT (ogm), ogm->srcpad);
break;
}
GST_ELEMENT_ERROR (ogm, RESOURCE, SYNC, (NULL), (NULL));
break;
}
+ gst_buffer_set_caps (sbuf, GST_PAD_CAPS (ogm->srcpad));
gst_pad_push (ogm->srcpad, sbuf);
} else {
GST_ELEMENT_ERROR (ogm, STREAM, WRONG_TYPE,