mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-17 05:09:58 +01:00
BugFix MediaPlayer
Ensure change of direction operates inside timeline range, Ensures reload resets media player frames.
This commit is contained in:
@@ -738,6 +738,7 @@ void MediaPlayer::close()
|
|||||||
force_update_ = false;
|
force_update_ = false;
|
||||||
rate_ = 1.0;
|
rate_ = 1.0;
|
||||||
rate_change_ = RATE_CHANGE_NONE;
|
rate_change_ = RATE_CHANGE_NONE;
|
||||||
|
position_ = GST_CLOCK_TIME_NONE;
|
||||||
|
|
||||||
// clean up GST
|
// clean up GST
|
||||||
if (pipeline_ != nullptr) {
|
if (pipeline_ != nullptr) {
|
||||||
@@ -752,6 +753,7 @@ void MediaPlayer::close()
|
|||||||
for(guint i = 0; i < N_VFRAME; i++) {
|
for(guint i = 0; i < N_VFRAME; i++) {
|
||||||
frame_[i].access.lock();
|
frame_[i].access.lock();
|
||||||
frame_[i].unmap();
|
frame_[i].unmap();
|
||||||
|
frame_[i].status = INVALID;
|
||||||
frame_[i].access.unlock();
|
frame_[i].access.unlock();
|
||||||
}
|
}
|
||||||
write_index_ = 0;
|
write_index_ = 0;
|
||||||
@@ -1309,7 +1311,7 @@ void MediaPlayer::update()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// manage loop mode
|
// manage loop mode
|
||||||
if (need_loop)
|
if (need_loop && desired_state_ == GST_STATE_PLAYING) // avoid repeated call
|
||||||
execute_loop_command();
|
execute_loop_command();
|
||||||
|
|
||||||
force_update_ = false;
|
force_update_ = false;
|
||||||
@@ -1325,7 +1327,6 @@ void MediaPlayer::execute_loop_command()
|
|||||||
execute_seek_command();
|
execute_seek_command();
|
||||||
}
|
}
|
||||||
else { //LOOP_NONE
|
else { //LOOP_NONE
|
||||||
if (desired_state_ == GST_STATE_PLAYING) // avoid repeated call
|
|
||||||
play(false);
|
play(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1347,8 +1348,9 @@ void MediaPlayer::execute_seek_command(GstClockTime target, bool force)
|
|||||||
|
|
||||||
// no target given
|
// no target given
|
||||||
if (target == GST_CLOCK_TIME_NONE) {
|
if (target == GST_CLOCK_TIME_NONE) {
|
||||||
// create seek event with current position (rate changed ?)
|
// create seek event with current position (called for rate changed)
|
||||||
seek_pos = position_;
|
// CLAMP the time to ensure we do not bounce outside of timeline
|
||||||
|
seek_pos = CLAMP(position_, timeline_.first() + timeline_.step(), timeline_.last() - timeline_.step());
|
||||||
// seek with KEY mode if playing
|
// seek with KEY mode if playing
|
||||||
seek_flags |= GST_SEEK_FLAG_KEY_UNIT | GST_SEEK_FLAG_SNAP_AFTER;
|
seek_flags |= GST_SEEK_FLAG_KEY_UNIT | GST_SEEK_FLAG_SNAP_AFTER;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user