mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-20 04:56:24 +00:00
streamsynchronizer: update position for reverse
When doing reverse playback the positino advances from timestamp_end to timestamp.
This commit is contained in:
parent
b3d94bd0e4
commit
34eea4d5f2
1 changed files with 23 additions and 11 deletions
|
@ -502,6 +502,7 @@ gst_stream_synchronizer_sink_chain (GstPad * pad, GstObject * parent,
|
||||||
GstPad *opad;
|
GstPad *opad;
|
||||||
GstFlowReturn ret = GST_FLOW_ERROR;
|
GstFlowReturn ret = GST_FLOW_ERROR;
|
||||||
GstStream *stream;
|
GstStream *stream;
|
||||||
|
GstClockTime duration = GST_CLOCK_TIME_NONE;
|
||||||
GstClockTime timestamp = GST_CLOCK_TIME_NONE;
|
GstClockTime timestamp = GST_CLOCK_TIME_NONE;
|
||||||
GstClockTime timestamp_end = GST_CLOCK_TIME_NONE;
|
GstClockTime timestamp_end = GST_CLOCK_TIME_NONE;
|
||||||
|
|
||||||
|
@ -514,9 +515,10 @@ gst_stream_synchronizer_sink_chain (GstPad * pad, GstObject * parent,
|
||||||
GST_BUFFER_OFFSET (buffer), GST_BUFFER_OFFSET_END (buffer));
|
GST_BUFFER_OFFSET (buffer), GST_BUFFER_OFFSET_END (buffer));
|
||||||
|
|
||||||
timestamp = GST_BUFFER_TIMESTAMP (buffer);
|
timestamp = GST_BUFFER_TIMESTAMP (buffer);
|
||||||
if (GST_BUFFER_TIMESTAMP_IS_VALID (buffer)
|
duration = GST_BUFFER_DURATION (buffer);
|
||||||
&& GST_BUFFER_DURATION_IS_VALID (buffer))
|
if (GST_CLOCK_TIME_IS_VALID (timestamp)
|
||||||
timestamp_end = timestamp + GST_BUFFER_DURATION (buffer);
|
&& GST_CLOCK_TIME_IS_VALID (duration))
|
||||||
|
timestamp_end = timestamp + duration;
|
||||||
|
|
||||||
GST_STREAM_SYNCHRONIZER_LOCK (self);
|
GST_STREAM_SYNCHRONIZER_LOCK (self);
|
||||||
stream = gst_pad_get_element_private (pad);
|
stream = gst_pad_get_element_private (pad);
|
||||||
|
@ -537,7 +539,10 @@ gst_stream_synchronizer_sink_chain (GstPad * pad, GstObject * parent,
|
||||||
GST_LOG_OBJECT (pad,
|
GST_LOG_OBJECT (pad,
|
||||||
"Updating position from %" GST_TIME_FORMAT " to %" GST_TIME_FORMAT,
|
"Updating position from %" GST_TIME_FORMAT " to %" GST_TIME_FORMAT,
|
||||||
GST_TIME_ARGS (stream->segment.position), GST_TIME_ARGS (timestamp));
|
GST_TIME_ARGS (stream->segment.position), GST_TIME_ARGS (timestamp));
|
||||||
stream->segment.position = timestamp;
|
if (stream->segment.rate > 0.0)
|
||||||
|
stream->segment.position = timestamp;
|
||||||
|
else
|
||||||
|
stream->segment.position = timestamp_end;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
GST_STREAM_SYNCHRONIZER_UNLOCK (self);
|
GST_STREAM_SYNCHRONIZER_UNLOCK (self);
|
||||||
|
@ -554,13 +559,20 @@ gst_stream_synchronizer_sink_chain (GstPad * pad, GstObject * parent,
|
||||||
|
|
||||||
GST_STREAM_SYNCHRONIZER_LOCK (self);
|
GST_STREAM_SYNCHRONIZER_LOCK (self);
|
||||||
stream = gst_pad_get_element_private (pad);
|
stream = gst_pad_get_element_private (pad);
|
||||||
if (stream && stream->segment.format == GST_FORMAT_TIME
|
if (stream && stream->segment.format == GST_FORMAT_TIME) {
|
||||||
&& GST_CLOCK_TIME_IS_VALID (timestamp_end)) {
|
GstClockTime position;
|
||||||
GST_LOG_OBJECT (pad,
|
|
||||||
"Updating position from %" GST_TIME_FORMAT " to %" GST_TIME_FORMAT,
|
if (stream->segment.rate > 0.0)
|
||||||
GST_TIME_ARGS (stream->segment.position),
|
position = timestamp_end;
|
||||||
GST_TIME_ARGS (timestamp_end));
|
else
|
||||||
stream->segment.position = timestamp_end;
|
position = timestamp;
|
||||||
|
|
||||||
|
if (GST_CLOCK_TIME_IS_VALID (position)) {
|
||||||
|
GST_LOG_OBJECT (pad,
|
||||||
|
"Updating position from %" GST_TIME_FORMAT " to %" GST_TIME_FORMAT,
|
||||||
|
GST_TIME_ARGS (stream->segment.position), GST_TIME_ARGS (position));
|
||||||
|
stream->segment.position = position;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Advance EOS streams if necessary. For non-EOS
|
/* Advance EOS streams if necessary. For non-EOS
|
||||||
|
|
Loading…
Reference in a new issue