mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-04 16:39:39 +00:00
aggregator: Add get_next_time function for live streams
Add a function to do the right thing for live streams. https://bugzilla.gnome.org/show_bug.cgi?id=795486
This commit is contained in:
parent
13d5957fd7
commit
05298b3093
3 changed files with 42 additions and 0 deletions
|
@ -231,6 +231,7 @@ gst_aggregator_get_latency
|
|||
gst_aggregator_set_latency
|
||||
gst_aggregator_get_buffer_pool
|
||||
gst_aggregator_get_allocator
|
||||
gst_aggregator_simple_get_next_time
|
||||
<SUBSECTION Standard>
|
||||
GST_IS_AGGREGATOR
|
||||
GST_IS_AGGREGATOR_CLASS
|
||||
|
|
|
@ -3114,3 +3114,40 @@ gst_aggregator_get_allocator (GstAggregator * self,
|
|||
if (params)
|
||||
*params = self->priv->allocation_params;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_aggregator_simple_get_next_time:
|
||||
* @self: A #GstAggregator
|
||||
*
|
||||
* This is a simple #GstAggregator::get_next_time implementation that
|
||||
* just looks at the #GstSegment on the srcpad of the aggregator and bases
|
||||
* the next time on the running there there.
|
||||
*
|
||||
* This is the desired behaviour in most cases where you have a live source
|
||||
* and you have a dead line based aggregator subclass.
|
||||
*
|
||||
* Returns: The running time based on the position
|
||||
*
|
||||
* Since: 1.16
|
||||
*/
|
||||
GstClockTime
|
||||
gst_aggregator_simple_get_next_time (GstAggregator * self)
|
||||
{
|
||||
GstClockTime next_time;
|
||||
GstAggregatorPad *srcpad = GST_AGGREGATOR_PAD (self->srcpad);
|
||||
GstSegment *segment = &srcpad->segment;
|
||||
|
||||
GST_OBJECT_LOCK (self);
|
||||
if (segment->position == -1 || segment->position < segment->start)
|
||||
next_time = segment->start;
|
||||
else
|
||||
next_time = segment->position;
|
||||
|
||||
if (segment->stop != -1 && next_time > segment->stop)
|
||||
next_time = segment->stop;
|
||||
|
||||
next_time = gst_segment_to_running_time (segment, GST_FORMAT_TIME, next_time);
|
||||
GST_OBJECT_UNLOCK (self);
|
||||
|
||||
return next_time;
|
||||
}
|
||||
|
|
|
@ -348,6 +348,10 @@ void gst_aggregator_get_allocator (GstAggregator
|
|||
GstAllocator ** allocator,
|
||||
GstAllocationParams * params);
|
||||
|
||||
GST_BASE_API
|
||||
GstClockTime gst_aggregator_simple_get_next_time (GstAggregator * self);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GST_AGGREGATOR_H__ */
|
||||
|
|
Loading…
Reference in a new issue