Commit 83b2c63a authored by Wim Taymans's avatar Wim Taymans Committed by Wim Taymans

element: add start_time field an methods

Add a start_time field and some methods. The start_time will contain the
running_time of when the element last went to paused. This time can be user to
report the position in PAUSED but also to do more correct clipping and
stepping later.
parent c74c3bf1
......@@ -482,6 +482,7 @@ GST_ELEMENT_PARENT
GST_ELEMENT_BUS
GST_ELEMENT_CLOCK
GST_ELEMENT_PADS
GST_ELEMENT_START_TIME
GST_ELEMENT_ERROR
GST_ELEMENT_WARNING
GST_ELEMENT_INFO
......@@ -523,6 +524,8 @@ gst_element_link_filtered
<SUBSECTION element-properties>
gst_element_set_base_time
gst_element_get_base_time
gst_element_set_start_time
gst_element_get_start_time
gst_element_set_bus
gst_element_get_bus
gst_element_get_factory
......
......@@ -530,6 +530,62 @@ gst_element_get_base_time (GstElement * element)
return result;
}
/**
* gst_element_set_start_time:
* @element: a #GstElement.
* @time: the base time to set.
*
* Set the start time of an element. See gst_element_get_start_time().
*
* MT safe.
*
* Since: 0.10.24
*/
void
gst_element_set_start_time (GstElement * element, GstClockTime time)
{
GstClockTime old;
g_return_if_fail (GST_IS_ELEMENT (element));
GST_OBJECT_LOCK (element);
old = GST_ELEMENT_START_TIME (element);
GST_ELEMENT_START_TIME (element) = time;
GST_OBJECT_UNLOCK (element);
GST_CAT_DEBUG_OBJECT (GST_CAT_CLOCK, element,
"set start_time=%" GST_TIME_FORMAT ", old %" GST_TIME_FORMAT,
GST_TIME_ARGS (time), GST_TIME_ARGS (old));
}
/**
* gst_element_get_start_time:
* @element: a #GstElement.
*
* Returns the start time of the element. The start time is the
* running time of the clock when this element was last put to
* PAUSED.
*
* MT safe.
*
* Returns: the start time of the element.
*
* Since: 0.10.24
*/
GstClockTime
gst_element_get_start_time (GstElement * element)
{
GstClockTime result;
g_return_val_if_fail (GST_IS_ELEMENT (element), GST_CLOCK_TIME_NONE);
GST_OBJECT_LOCK (element);
result = GST_ELEMENT_START_TIME (element);
GST_OBJECT_UNLOCK (element);
return result;
}
/**
* gst_element_is_indexable:
* @element: a #GstElement.
......
......@@ -262,6 +262,17 @@ typedef enum
*/
#define GST_ELEMENT_PADS(elem) (GST_ELEMENT_CAST(elem)->pads)
/**
* GST_ELEMENT_START_TIME:
* @elem: a #GstElement to return the start time for.
*
* This macro returns the start_time of the @elem. The start_time is the
* running_time of the pipeline when the element went to PAUSED.
*
* Since: 0.10.24
*/
#define GST_ELEMENT_START_TIME(elem) (GST_ELEMENT_CAST(elem)->abidata.ABI.start_time)
/**
* GST_ELEMENT_ERROR:
* @el: the element that generates the error
......@@ -441,6 +452,8 @@ struct _GstElement
struct {
/* state set by application */
GstState target_state;
/* running time of the last PAUSED state */
GstClockTime start_time;
} ABI;
/* adding + 0 to mark ABI change to be undone later */
gpointer _gst_reserved[GST_PADDING + 0];
......@@ -586,6 +599,8 @@ GstClock* gst_element_get_clock (GstElement *element);
gboolean gst_element_set_clock (GstElement *element, GstClock *clock);
void gst_element_set_base_time (GstElement *element, GstClockTime time);
GstClockTime gst_element_get_base_time (GstElement *element);
void gst_element_set_start_time (GstElement *element, GstClockTime time);
GstClockTime gst_element_get_start_time (GstElement *element);
/* indexes */
gboolean gst_element_is_indexable (GstElement *element);
......
......@@ -291,6 +291,7 @@ EXPORTS
gst_element_get_pad
gst_element_get_query_types
gst_element_get_request_pad
gst_element_get_start_time
gst_element_get_state
gst_element_get_static_pad
gst_element_get_type
......@@ -330,6 +331,7 @@ EXPORTS
gst_element_set_clock
gst_element_set_index
gst_element_set_locked_state
gst_element_set_start_time
gst_element_set_state
gst_element_state_change_return_get_name
gst_element_state_get_name
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment