From: <wi...@ke...> - 2007-12-17 15:05:04
|
CVS Root: /cvs/gstreamer Module: gst-plugins-bad Changes by: wingo Date: Mon Dec 17 2007 15:05:08 UTC Log message: 2007-12-17 Andy Wingo <wi...@po...> * 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 pad property, not an element property. (gst_selector_pad_chain): Mark the last_stop time as timestamp + duration, not timestamp. Patch 9/12. Modified files: . : ChangeLog gst/switch : gstswitch.c Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-bad/ChangeLog.diff?r1=1.2953&r2=1.2954 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-bad/gst/switch/gstswitch.c.diff?r1=1.34&r2=1.35 ====Begin Diffs==== Index: ChangeLog =================================================================== RCS file: /cvs/gstreamer/gst-plugins-bad/ChangeLog,v retrieving revision 1.2953 retrieving revision 1.2954 diff -u -d -r1.2953 -r1.2954 --- ChangeLog 17 Dec 2007 15:01:54 -0000 1.2953 +++ ChangeLog 17 Dec 2007 15:04:50 -0000 1.2954 @@ -1,5 +1,12 @@ 2007-12-17 Andy Wingo <wi...@po...> + * 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 + pad property, not an element property. + (gst_selector_pad_chain): Mark the last_stop time as timestamp + + duration, not timestamp. Patch 9/12. + * gst/switch/gstswitch.c (gst_stream_selector_change_state) (gst_stream_selector_block, gst_stream_selector_switch): Use the cond mechanism instead of blocked pads. Patch 8/12. Index: gstswitch.c RCS file: /cvs/gstreamer/gst-plugins-bad/gst/switch/gstswitch.c,v retrieving revision 1.34 retrieving revision 1.35 diff -u -d -r1.34 -r1.35 --- gstswitch.c 17 Dec 2007 15:01:55 -0000 1.34 +++ gstswitch.c 17 Dec 2007 15:04:51 -0000 1.35 @@ -55,8 +55,12 @@ enum { - PROP_ACTIVE_PAD = 1, - PROP_LAST_STOP_TIME + PROP_ACTIVE_PAD = 1 +}; +enum +{ + PAD_PROP_LAST_STOP_TIME = 1 }; @@ -110,6 +114,8 @@ static void gst_selector_pad_class_init (GstSelectorPadClass * klass); static void gst_selector_pad_init (GstSelectorPad * pad); static void gst_selector_pad_finalize (GObject * object); +static void gst_selector_pad_get_property (GObject * object, + guint prop_id, GValue * value, GParamSpec * pspec); static GstPadClass *selector_pad_parent_class = NULL; @@ -155,6 +161,13 @@ selector_pad_parent_class = g_type_class_peek_parent (klass); + gobject_class->get_property = + GST_DEBUG_FUNCPTR (gst_selector_pad_get_property); + g_object_class_install_property (gobject_class, PAD_PROP_LAST_STOP_TIME, + g_param_spec_uint64 ("last-stop-time", "Last stop time", + "Last stop time seen on pad", 0, G_MAXUINT64, GST_CLOCK_TIME_NONE, + G_PARAM_READABLE)); gobject_class->finalize = gst_selector_pad_finalize; } @@ -174,6 +187,28 @@ static void +gst_selector_pad_get_property (GObject * object, guint prop_id, + GValue * value, GParamSpec * pspec) + GstSelectorPad *spad = GST_SELECTOR_PAD_CAST (object); + switch (prop_id) { + case PAD_PROP_LAST_STOP_TIME:{ + GST_OBJECT_LOCK (object); + if (spad->active) + g_value_set_uint64 (value, spad->segment.last_stop); + else + g_value_set_uint64 (value, GST_CLOCK_TIME_NONE); + GST_OBJECT_UNLOCK (object); + break; + } + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + } +} +static void gst_selector_pad_reset (GstSelectorPad * pad) pad->active = FALSE; @@ -340,7 +375,7 @@ GstFlowReturn res; GstPad *active_sinkpad; GstSelectorPad *selpad; - GstClockTime timestamp; + GstClockTime end_time, duration; GstSegment *seg; sel = GST_STREAM_SELECTOR (gst_pad_get_parent (pad)); @@ -352,11 +387,14 @@ active_sinkpad = gst_stream_selector_activate_sinkpad (sel, pad); - timestamp = GST_BUFFER_TIMESTAMP (buf); - if (GST_CLOCK_TIME_IS_VALID (timestamp)) { - GST_DEBUG_OBJECT (sel, "received timestamp %" GST_TIME_FORMAT, - GST_TIME_ARGS (timestamp)); - gst_segment_set_last_stop (seg, seg->format, timestamp); + end_time = GST_BUFFER_TIMESTAMP (buf); + if (GST_CLOCK_TIME_IS_VALID (end_time)) { + duration = GST_BUFFER_DURATION (buf); + if (GST_CLOCK_TIME_IS_VALID (duration)) + end_time += duration; + GST_DEBUG_OBJECT (sel, "received end time %" GST_TIME_FORMAT, + GST_TIME_ARGS (end_time)); + gst_segment_set_last_stop (seg, seg->format, end_time); } /* Ignore buffers from pads except the selected one */ @@ -467,10 +505,6 @@ g_object_class_install_property (gobject_class, PROP_ACTIVE_PAD, g_param_spec_string ("active-pad", "Active pad", "Name of the currently" " active sink pad", NULL, G_PARAM_READWRITE)); - g_object_class_install_property (gobject_class, PROP_LAST_STOP_TIME, - g_param_spec_uint64 ("last-stop-time", "Last stop time", - "Last stop time on active pad", 0, G_MAXUINT64, GST_CLOCK_TIME_NONE, - G_PARAM_READABLE)); gobject_class->dispose = gst_stream_selector_dispose; gstelement_class->request_new_pad = gst_stream_selector_request_new_pad; gstelement_class->release_pad = gst_stream_selector_release_pad; @@ -629,18 +663,6 @@ GST_OBJECT_UNLOCK (object); break; } - case PROP_LAST_STOP_TIME:{ - GstSelectorPad *spad; - - GST_OBJECT_LOCK (object); - spad = GST_SELECTOR_PAD_CAST (sel->active_sinkpad); - if (spad && spad->active) - g_value_set_uint64 (value, spad->segment.last_stop); - else - g_value_set_uint64 (value, GST_CLOCK_TIME_NONE); - GST_OBJECT_UNLOCK (object); - break; - } default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); |