summaryrefslogtreecommitdiffstats
path: root/gst/switch
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2007-12-17 15:06:48 +0000
committerAndy Wingo <wingo@pobox.com>2007-12-17 15:06:48 +0000
commitf3f11f48228a94c36e58a63af5bcdbedf097d317 (patch)
treea2a4ea7d7f50ba8e22e0efa5dc99fbb995704d31 /gst/switch
parenta4b2009e243a651c7c65fff916b1315ba7d4a281 (diff)
downloadgst-plugins-bad-f3f11f48228a94c36e58a63af5bcdbedf097d317.tar.gz
gst-plugins-bad-f3f11f48228a94c36e58a63af5bcdbedf097d317.tar.bz2
gst-plugins-bad-f3f11f48228a94c36e58a63af5bcdbedf097d317.zip
gst/switch/: gst/switch/gstswitch.c (gst_stream_selector_class_init) (gst_stream_selector_block): Make the block() si...
Original commit message from CVS: 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.
Diffstat (limited to 'gst/switch')
-rw-r--r--gst/switch/gstswitch-marshal.list1
-rw-r--r--gst/switch/gstswitch.c28
-rw-r--r--gst/switch/gstswitch.h2
3 files changed, 26 insertions, 5 deletions
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);
};