Skip to content

Commit

Permalink
Fixed playback status in menu when auto playback was on.
Browse files Browse the repository at this point in the history
  • Loading branch information
ggarra13 committed Jul 5, 2023
1 parent 522cda4 commit 1257d28
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
2 changes: 2 additions & 0 deletions mrv2/docs/HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ v0.6.4
- Fixed Presentation mode not returning to its previous state when switched
off.
- Fixed an internal OpenGL error.
- Fixed Playback menu status at the beginning when Auto Playback was checked.
- Fixed pixel color look-up when loading a single frame.


v0.6.3
Expand Down
4 changes: 4 additions & 0 deletions mrv2/lib/mrvApp/App.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -722,6 +722,7 @@ namespace mrv

struct PlaybackData
{
ViewerUI* ui;
TimelinePlayer* player;
timeline::Playback playback;
};
Expand All @@ -730,8 +731,10 @@ namespace mrv
{
PlaybackData* p = (PlaybackData*)data;
auto player = p->player;
auto ui = p->ui;
player->setPlayback(p->playback);
delete p;
ui->uiMain->fill_menu(ui->uiMenuBar);
}

int App::run()
Expand All @@ -746,6 +749,7 @@ namespace mrv
// We use a timeout to start playback of the loaded video to
// make sure to show all frames
PlaybackData* data = new PlaybackData;
data->ui = ui;
data->player = p.timelinePlayers[0];
data->playback = p.options.playback;
Fl::add_timeout(0.005, (Fl_Timeout_Handler)start_playback, data);
Expand Down
14 changes: 11 additions & 3 deletions mrv2/lib/mrvGL/mrvGLViewport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -354,9 +354,11 @@ namespace mrv

_unmapBuffer();

update = _isPlaybackStopped();
update = _isPlaybackStopped() || _isSingleFrame();
if (update)
{
updatePixelBar();
}

gl::OffscreenBufferOptions offscreenBufferOptions;
offscreenBufferOptions.colorType = imaging::PixelType::RGBA_U8;
Expand Down Expand Up @@ -602,6 +604,8 @@ namespace mrv
glPixelStorei(GL_PACK_SWAP_BYTES, GL_FALSE);
CHECK_GL;

gl::OffscreenBufferBinding binding(gl.buffer);
CHECK_GL;
const imaging::Size& renderSize = gl.buffer->getSize();

// bool update = _shouldUpdatePixelBar();
Expand All @@ -615,19 +619,23 @@ namespace mrv
gl.nextIndex = (gl.index + 1) % 2;

// Set the target framebuffer to read
glReadBuffer(GL_FRONT);
CHECK_GL;

// If we are a single frame, we do a normal ReadPixels of front
// buffer.
if (single_frame)
{
_unmapBuffer();
CHECK_GL;
_mallocBuffer();
if (!p.image)
return;
glBindFramebuffer(GL_FRAMEBUFFER, 0);
CHECK_GL;
glReadBuffer(GL_FRONT);
CHECK_GL;
glReadPixels(
0, 0, renderSize.w, renderSize.h, format, type, p.image);
CHECK_GL;
return;
}
else
Expand Down

0 comments on commit 1257d28

Please sign in to comment.