Merge pull request #4930 from eduardosm/esm-branch1
Fix song continuously rewinding when seeking using keyboard arrow keys.
This commit is contained in:
commit
625a995751
0
src/engines/enginebase.h
Executable file → Normal file
0
src/engines/enginebase.h
Executable file → Normal file
0
src/engines/gstengine.cpp
Executable file → Normal file
0
src/engines/gstengine.cpp
Executable file → Normal file
0
src/engines/gstengine.h
Executable file → Normal file
0
src/engines/gstengine.h
Executable file → Normal file
@ -77,6 +77,7 @@ GstEnginePipeline::GstEnginePipeline(GstEngine* engine)
|
|||||||
pipeline_is_initialised_(false),
|
pipeline_is_initialised_(false),
|
||||||
pipeline_is_connected_(false),
|
pipeline_is_connected_(false),
|
||||||
pending_seek_nanosec_(-1),
|
pending_seek_nanosec_(-1),
|
||||||
|
last_known_position_ns_(0),
|
||||||
volume_percent_(100),
|
volume_percent_(100),
|
||||||
volume_modifier_(1.0),
|
volume_modifier_(1.0),
|
||||||
pipeline_(nullptr),
|
pipeline_(nullptr),
|
||||||
@ -976,10 +977,10 @@ void GstEnginePipeline::TransitionToNext() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
qint64 GstEnginePipeline::position() const {
|
qint64 GstEnginePipeline::position() const {
|
||||||
gint64 value = 0;
|
if (pipeline_is_initialised_)
|
||||||
gst_element_query_position(pipeline_, GST_FORMAT_TIME, &value);
|
gst_element_query_position(pipeline_, GST_FORMAT_TIME, &last_known_position_ns_);
|
||||||
|
|
||||||
return value;
|
return last_known_position_ns_;
|
||||||
}
|
}
|
||||||
|
|
||||||
qint64 GstEnginePipeline::length() const {
|
qint64 GstEnginePipeline::length() const {
|
||||||
@ -1033,6 +1034,7 @@ bool GstEnginePipeline::Seek(qint64 nanosec) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pending_seek_nanosec_ = -1;
|
pending_seek_nanosec_ = -1;
|
||||||
|
last_known_position_ns_ = nanosec;
|
||||||
return gst_element_seek_simple(pipeline_, GST_FORMAT_TIME,
|
return gst_element_seek_simple(pipeline_, GST_FORMAT_TIME,
|
||||||
GST_SEEK_FLAG_FLUSH, nanosec);
|
GST_SEEK_FLAG_FLUSH, nanosec);
|
||||||
}
|
}
|
||||||
|
@ -258,6 +258,13 @@ signals:
|
|||||||
bool pipeline_is_connected_;
|
bool pipeline_is_connected_;
|
||||||
qint64 pending_seek_nanosec_;
|
qint64 pending_seek_nanosec_;
|
||||||
|
|
||||||
|
// We can only use gst_element_query_position() when the pipeline is in
|
||||||
|
// PAUSED nor PLAYING state. Whenever we get a new position (e.g. after a
|
||||||
|
// correct call to gst_element_query_position() or after a seek), we store
|
||||||
|
// it here so that we can use it when using gst_element_query_position() is
|
||||||
|
// not possible.
|
||||||
|
mutable gint64 last_known_position_ns_;
|
||||||
|
|
||||||
int volume_percent_;
|
int volume_percent_;
|
||||||
qreal volume_modifier_;
|
qreal volume_modifier_;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user