2007-12-17 Andy Wingo <wingo@pobox.com>
+ * gst/switch/gstswitch.h (struct _GstStreamSelector):
+
+ * gst/switch/gstswitch.c (gst_stream_selector_wait)
+ (gst_selector_pad_chain, gst_stream_selector_init)
+ (gst_stream_selector_dispose): Add infrastructure for new blocking
+ mechanism that does not use gst_pad_set_blocked, which does not
+ work on sink pads. Patch 7/12.
+
* gst/switch/gstswitch.c (gst_stream_selector_class_init)
(gst_stream_selector_get_property): Add last-stop-time readable
property. Patch 6/12.
return result;
}
+static gboolean
+gst_stream_selector_wait (GstStreamSelector * self, GstPad * pad)
+{
+ gboolean flushing;
+
+ GST_OBJECT_LOCK (self);
+
+ while (self->blocked)
+ g_cond_wait (self->blocked_cond, GST_OBJECT_GET_LOCK (self));
+
+ GST_OBJECT_UNLOCK (self);
+
+ GST_OBJECT_LOCK (pad);
+ flushing = GST_PAD_IS_FLUSHING (pad);
+ GST_OBJECT_UNLOCK (pad);
+
+ return flushing;
+}
+
static GstFlowReturn
gst_selector_pad_chain (GstPad * pad, GstBuffer * buf)
{
selpad = GST_SELECTOR_PAD_CAST (pad);
seg = &selpad->segment;
+ if (gst_stream_selector_wait (sel, pad))
+ goto ignore;
+
active_sinkpad = gst_stream_selector_activate_sinkpad (sel, pad);
timestamp = GST_BUFFER_TIMESTAMP (buf);
res = GST_FLOW_NOT_LINKED;
goto done;
}
-
}
static void gst_stream_selector_dispose (GObject * object);
sel->active_sinkpad = NULL;
sel->nb_sinkpads = 0;
gst_segment_init (&sel->segment, GST_FORMAT_UNDEFINED);
+
+ sel->blocked_cond = g_cond_new ();
+ sel->blocked = FALSE;
}
static void
sel->active_sinkpad = NULL;
}
+ if (sel->blocked_cond) {
+ g_cond_free (sel->blocked_cond);
+ sel->blocked_cond = NULL;
+ }
+
G_OBJECT_CLASS (parent_class)->dispose (object);
}