viewer: fixed issue with reverse playback

This commit is contained in:
itsmattkc
2022-05-16 15:44:25 -07:00
parent 96594ef948
commit a48513a8a1
3 changed files with 6 additions and 2 deletions
+3 -1
View File
@@ -66,6 +66,7 @@ ViewerDisplayWidget::ViewerDisplayWidget(QWidget *parent) :
show_fps_(false),
frames_skipped_(0),
show_widget_background_(false),
playback_speed_(0),
push_mode_(kPushNull),
add_band_(nullptr),
queue_starved_(false)
@@ -882,6 +883,7 @@ void ViewerDisplayWidget::RequestStartEditingText()
void ViewerDisplayWidget::Play(const int64_t &start_timestamp, const int &playback_speed, const rational &timebase)
{
playback_timebase_ = timebase;
playback_speed_ = playback_speed;
timer_.Start(start_timestamp, playback_speed, timebase.toDouble());
@@ -924,7 +926,7 @@ void ViewerDisplayWidget::UpdateFromQueue()
}
return;
} else if (pf.timestamp > time) {
} else if ((pf.timestamp > time) == (playback_speed_ > 0)) {
// The next frame in the queue is too new, so just do a regular update. Either the
// frame we want will arrive in time, or we'll just have to skip it.
+2
View File
@@ -360,6 +360,8 @@ private:
QVariant load_frame_;
int playback_speed_;
enum PushMode {
/// New frame to push to internal texture
kPushFrame,
+1 -1
View File
@@ -41,7 +41,7 @@ public:
if (this->empty() || (this->back().timestamp < f.timestamp) == (playback_speed > 0)) {
this->push_back(f);
} else {
for (iterator i=this->begin(); i!=this->end(); i++) {
for (auto i=this->begin(); i!=this->end(); i++) {
if ((i->timestamp > f.timestamp) == (playback_speed > 0)) {
this->insert(i, f);
break;