summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 71f92e2)
raw | patch | inline | side by side (parent: 71f92e2)
author | Wim Taymans <wim.taymans@gmail.com> | |
Mon, 8 Oct 2007 10:28:18 +0000 (10:28 +0000) | ||
committer | Wim Taymans <wim.taymans@gmail.com> | |
Mon, 8 Oct 2007 10:28:18 +0000 (10:28 +0000) |
Original commit message from CVS:
* plugins/elements/gsttypefindelement.c:
(gst_type_find_element_have_type), (gst_type_find_element_init),
(gst_type_find_element_setcaps), (gst_type_find_element_chain):
Move detecting the input caps of the sinkpad to the setcaps function.
This allows us to update the output caps when we receive new input caps
instead of always using the first detected caps.
* plugins/elements/gsttypefindelement.c:
(gst_type_find_element_have_type), (gst_type_find_element_init),
(gst_type_find_element_setcaps), (gst_type_find_element_chain):
Move detecting the input caps of the sinkpad to the setcaps function.
This allows us to update the output caps when we receive new input caps
instead of always using the first detected caps.
ChangeLog | patch | blob | history | |
plugins/elements/gsttypefindelement.c | patch | blob | history |
diff --git a/ChangeLog b/ChangeLog
index c12ba791dc95a299a4ecf1697a82afedee632d6f..2758fa9f88a6f23ceeba7a5b967b21e178fc11da 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
+2007-10-08 Wim Taymans <wim.taymans@gmail.com>
+
+ * plugins/elements/gsttypefindelement.c:
+ (gst_type_find_element_have_type), (gst_type_find_element_init),
+ (gst_type_find_element_setcaps), (gst_type_find_element_chain):
+ Move detecting the input caps of the sinkpad to the setcaps function.
+ This allows us to update the output caps when we receive new input caps
+ instead of always using the first detected caps.
+
2007-10-08 Wim Taymans <wim.taymans@gmail.com>
* libs/gst/base/gstbasesink.c: (gst_base_sink_event),
index 0e28a60ca6714ee212641980becf942989c75614..09485bc0afd7ebb6919b2c2990f4538b93aeebfb 100644 (file)
@@ -125,6 +125,7 @@ static gboolean gst_type_find_handle_src_query (GstPad * pad, GstQuery * query);
static gboolean gst_type_find_element_handle_event (GstPad * pad,
GstEvent * event);
+static gboolean gst_type_find_element_setcaps (GstPad * pad, GstCaps * caps);
static GstFlowReturn gst_type_find_element_chain (GstPad * sinkpad,
GstBuffer * buffer);
static GstFlowReturn gst_type_find_element_getrange (GstPad * srcpad,
gst_type_find_element_have_type (GstTypeFindElement * typefind,
guint probability, const GstCaps * caps)
{
- g_assert (typefind->caps == NULL);
g_assert (caps != NULL);
GST_INFO_OBJECT (typefind, "found caps %" GST_PTR_FORMAT, caps);
+ if (typefind->caps)
+ gst_caps_unref (typefind->caps);
typefind->caps = gst_caps_copy (caps);
gst_pad_set_caps (typefind->src, (GstCaps *) caps);
}
gst_pad_set_activate_function (typefind->sink,
GST_DEBUG_FUNCPTR (gst_type_find_element_activate));
+ gst_pad_set_setcaps_function (typefind->sink,
+ GST_DEBUG_FUNCPTR (gst_type_find_element_setcaps));
gst_pad_set_chain_function (typefind->sink,
GST_DEBUG_FUNCPTR (gst_type_find_element_chain));
gst_pad_set_event_function (typefind->sink,
typefind->cached_events = NULL;
}
-static GstFlowReturn
-gst_type_find_element_chain (GstPad * pad, GstBuffer * buffer)
+static gboolean
+gst_type_find_element_setcaps (GstPad * pad, GstCaps * caps)
{
GstTypeFindElement *typefind;
- GstFlowReturn res = GST_FLOW_OK;
typefind = GST_TYPE_FIND_ELEMENT (GST_PAD_PARENT (pad));
- /* Shortcircuit typefinding if we already have non-any caps */
- if (typefind->mode == MODE_TYPEFIND) {
- const GstCaps *caps = GST_BUFFER_CAPS (buffer);
+ /* don't operate on ANY caps */
+ if (gst_caps_is_any (caps))
+ return TRUE;
- if (caps && !gst_caps_is_any (caps)) {
- GST_DEBUG_OBJECT (typefind, "Skipping typefinding, using caps from "
- "upstream buffer: %" GST_PTR_FORMAT, caps);
- typefind->mode = MODE_NORMAL;
- g_signal_emit (typefind, gst_type_find_element_signals[HAVE_TYPE], 0,
- GST_TYPE_FIND_MAXIMUM, caps);
-
- gst_type_find_element_send_cached_events (typefind);
- if (typefind->store) {
- GST_DEBUG_OBJECT (typefind, "Pushing store: %d",
- GST_BUFFER_SIZE (typefind->store));
- gst_buffer_set_caps (typefind->store, typefind->caps);
- gst_pad_push (typefind->src, typefind->store);
- typefind->store = NULL;
- }
+ g_signal_emit (typefind, gst_type_find_element_signals[HAVE_TYPE], 0,
+ GST_TYPE_FIND_MAXIMUM, caps);
+
+ /* Shortcircuit typefinding if we get caps */
+ if (typefind->mode == MODE_TYPEFIND) {
+ GST_DEBUG_OBJECT (typefind, "Skipping typefinding, using caps from "
+ "upstream buffer: %" GST_PTR_FORMAT, caps);
+ typefind->mode = MODE_NORMAL;
+
+ gst_type_find_element_send_cached_events (typefind);
+ if (typefind->store) {
+ GST_DEBUG_OBJECT (typefind, "Pushing store: %d",
+ GST_BUFFER_SIZE (typefind->store));
+ gst_buffer_set_caps (typefind->store, typefind->caps);
+ gst_pad_push (typefind->src, typefind->store);
+ typefind->store = NULL;
}
}
+ return TRUE;
+}
+
+static GstFlowReturn
+gst_type_find_element_chain (GstPad * pad, GstBuffer * buffer)
+{
+ GstTypeFindElement *typefind;
+ GstFlowReturn res = GST_FLOW_OK;
+
+ typefind = GST_TYPE_FIND_ELEMENT (GST_PAD_PARENT (pad));
+
switch (typefind->mode) {
case MODE_ERROR:
/* we should already have called GST_ELEMENT_ERROR */