summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--gst/switch/gstswitch-marshal.list1
-rw-r--r--gst/switch/gstswitch.c28
-rw-r--r--gst/switch/gstswitch.h2
4 files changed, 32 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index a1dea5f8..f58e0d1b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2007-12-17 Andy Wingo <wingo@pobox.com>
+ * gst/switch/gstswitch-marshal.list:
+ * gst/switch/gstswitch.h (struct _GstStreamSelectorClass):
+ * gst/switch/gstswitch.c (gst_stream_selector_class_init)
+ (gst_stream_selector_block): Make the block() signal return the
+ last stop time of the active pad. Patch 10/12.
+
* gst/switch/gstswitch.c (gst_selector_pad_get_property)
(gst_selector_pad_class_init, gst_stream_selector_class_init)
(gst_stream_selector_get_property): Expose 'last-stop-time' as a
diff --git a/gst/switch/gstswitch-marshal.list b/gst/switch/gstswitch-marshal.list
index 57ed247e..56014826 100644
--- a/gst/switch/gstswitch-marshal.list
+++ b/gst/switch/gstswitch-marshal.list
@@ -1 +1,2 @@
+UINT64:VOID
VOID:STRING,UINT64,UINT64
diff --git a/gst/switch/gstswitch.c b/gst/switch/gstswitch.c
index ea0dcbb5..7b44801b 100644
--- a/gst/switch/gstswitch.c
+++ b/gst/switch/gstswitch.c
@@ -446,7 +446,7 @@ static GstStateChangeReturn gst_stream_selector_change_state (GstElement *
element, GstStateChange transition);
static GList *gst_stream_selector_get_linked_pads (GstPad * pad);
static GstCaps *gst_stream_selector_getcaps (GstPad * pad);
-static void gst_stream_selector_block (GstStreamSelector * self);
+static GstClockTime gst_stream_selector_block (GstStreamSelector * self);
static void gst_stream_selector_switch (GstStreamSelector * self,
const gchar * pad_name, GstClockTime stop_time, GstClockTime start_time);
@@ -514,12 +514,14 @@ gst_stream_selector_class_init (GstStreamSelectorClass * klass)
* GstStreamSelector::block:
* @streamselector: the streamselector element to emit this signal on
*
- * Block all sink pads in preparation for a switch.
+ * Block all sink pads in preparation for a switch. Returns the stop time of
+ * the current switch segment, or #GST_CLOCK_TIME_NONE if there is no current
+ * active pad or the current active pad never received data.
*/
gst_stream_selector_signals[SIGNAL_BLOCK] =
g_signal_new ("block", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstStreamSelectorClass, block),
- NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
+ NULL, NULL, gst_switch_marshal_UINT64__VOID, G_TYPE_UINT64, 0);
/**
* GstStreamSelector::switch:
* @streamselector: the streamselector element to emit this signal on
@@ -840,9 +842,11 @@ gst_stream_selector_change_state (GstElement * element,
return result;
}
-static void
+static GstClockTime
gst_stream_selector_block (GstStreamSelector * self)
{
+ GstClockTime ret = GST_CLOCK_TIME_NONE;
+
GST_OBJECT_LOCK (self);
if (self->blocked)
@@ -850,7 +854,23 @@ gst_stream_selector_block (GstStreamSelector * self)
self->blocked = TRUE;
+ if (self->active_sinkpad) {
+ GstSelectorPad *spad = GST_SELECTOR_PAD_CAST (self->active_sinkpad);
+
+ if (spad->active) {
+ ret = spad->segment.last_stop;
+ GST_DEBUG_OBJECT (self, "last stop on %" GST_PTR_FORMAT ": %"
+ GST_TIME_FORMAT, spad, GST_TIME_ARGS (ret));
+ } else {
+ GST_DEBUG_OBJECT (self, "pad %" GST_PTR_FORMAT " never got data", spad);
+ }
+ } else {
+ GST_DEBUG_OBJECT (self, "no active pad while blocking");
+ }
+
GST_OBJECT_UNLOCK (self);
+
+ return ret;
}
static void
diff --git a/gst/switch/gstswitch.h b/gst/switch/gstswitch.h
index 7ede7346..b1699593 100644
--- a/gst/switch/gstswitch.h
+++ b/gst/switch/gstswitch.h
@@ -58,7 +58,7 @@ struct _GstStreamSelector {
struct _GstStreamSelectorClass {
GstElementClass parent_class;
- void (*block) (GstStreamSelector *self);
+ GstClockTime (*block) (GstStreamSelector *self);
void (*switch_) (GstStreamSelector *self, const gchar *pad_name,
GstClockTime stop_time, GstClockTime start_time);
};