mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-20 13:06:23 +00:00
basesrc: Fix for SEGMENT event API changes
This commit is contained in:
parent
30a7fd7b4d
commit
26a5a877ff
1 changed files with 8 additions and 23 deletions
|
@ -1984,7 +1984,7 @@ gst_base_src_update_length (GstBaseSrc * src, guint64 offset, guint * length)
|
|||
GstBaseSrcClass *bclass;
|
||||
GstFormat format;
|
||||
gint64 stop;
|
||||
gboolean updated = FALSE;
|
||||
GstEvent *event = NULL;
|
||||
|
||||
bclass = GST_BASE_SRC_GET_CLASS (src);
|
||||
|
||||
|
@ -2040,32 +2040,17 @@ gst_base_src_update_length (GstBaseSrc * src, guint64 offset, guint * length)
|
|||
/* keep track of current position and update duration.
|
||||
* segment is in bytes, we checked that above. */
|
||||
GST_OBJECT_LOCK (src);
|
||||
updated = (src->segment.duration != size);
|
||||
src->segment.duration = size;
|
||||
if (src->segment.duration != size) {
|
||||
src->segment.duration = size;
|
||||
event = gst_event_new_segment (&src->segment);
|
||||
}
|
||||
src->segment.position = offset;
|
||||
GST_OBJECT_UNLOCK (src);
|
||||
|
||||
/* If we updated the duration and doing forward playback, we
|
||||
* have to update the downstream segments to update the stop
|
||||
* position */
|
||||
if (updated && src->segment.rate >= 0.0) {
|
||||
gint64 stop;
|
||||
GstEvent *event;
|
||||
|
||||
/* for deriving a stop position for the playback segment from the seek
|
||||
* segment, we must take the duration when the stop is not set */
|
||||
if ((stop = src->segment.stop) == -1)
|
||||
stop = src->segment.duration;
|
||||
|
||||
GST_DEBUG_OBJECT (src, "Sending update newsegment from %" G_GINT64_FORMAT
|
||||
" to %" G_GINT64_FORMAT, src->segment.start, stop);
|
||||
|
||||
event =
|
||||
gst_event_new_new_segment_full (TRUE,
|
||||
src->segment.rate, src->segment.applied_rate, src->segment.format,
|
||||
src->segment.start, stop, src->segment.time);
|
||||
/* If we updated the duration, we have to update the downstream
|
||||
* segments to update the stop position */
|
||||
if (event)
|
||||
gst_pad_push_event (src->srcpad, event);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
||||
|
|
Loading…
Reference in a new issue