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.
This commit is contained in:
Andy Wingo 2007-12-17 15:06:48 +00:00
parent a4b2009e24
commit f3f11f4822
4 changed files with 32 additions and 5 deletions

View file

@ -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

View file

@ -1 +1,2 @@
UINT64:VOID
VOID:STRING,UINT64,UINT64

View file

@ -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

View file

@ -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);
};