summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoni Poikelin <joni.poikelin@qt.io>2022-08-31 14:20:43 +0300
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-09-01 06:58:11 +0000
commitd74dcb2758b64edd492984ebab2633ba588dfc72 (patch)
tree859f42e4b3143f1adabb02ef515fbe35dba24dd5
parent8bc8a48d5371df56573e46618be97183e64d0457 (diff)
downloadqtmultimedia-d74dcb2758b64edd492984ebab2633ba588dfc72.tar.gz
Fix backward playback and seek
Fixes: QTBUG-105344 Change-Id: I1fd4e8e9a640e6a592345a94c40e3e739182d136 Reviewed-by: Lars Knoll <lars@knoll.priv.no> (cherry picked from commit acb9093864c7c4530919d9bf69223b0d9010b739) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/plugins/multimedia/gstreamer/common/qgstpipeline.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/plugins/multimedia/gstreamer/common/qgstpipeline.cpp b/src/plugins/multimedia/gstreamer/common/qgstpipeline.cpp
index d56ad1561..b2cfa79f8 100644
--- a/src/plugins/multimedia/gstreamer/common/qgstpipeline.cpp
+++ b/src/plugins/multimedia/gstreamer/common/qgstpipeline.cpp
@@ -293,10 +293,12 @@ bool QGstPipeline::seek(qint64 pos, double rate)
// always adjust the rate, so it can be set before playback starts
// setting position needs a loaded media file that's seekable
d->m_rate = rate;
+ qint64 from = rate > 0 ? pos : 0;
+ qint64 to = rate > 0 ? duration() : pos;
bool success = gst_element_seek(element(), rate, GST_FORMAT_TIME,
GstSeekFlags(GST_SEEK_FLAG_FLUSH),
- GST_SEEK_TYPE_SET, pos,
- GST_SEEK_TYPE_SET, -1);
+ GST_SEEK_TYPE_SET, from,
+ GST_SEEK_TYPE_SET, to);
if (!success)
return false;