Make wakeup function class specific

This commit is contained in:
Ylva Selling
2023-02-07 11:39:27 -05:00
parent 12398c4b1e
commit 33326e29f5
2 changed files with 5 additions and 7 deletions

View File

@@ -127,8 +127,6 @@ namespace {
namespace openspace::globebrowsing {
int VideoTileProvider::_wakeup = 0;
bool checkMpvError(int status) {
if (status < 0) {
LERROR(fmt::format("Libmpv API error: {}", mpv_error_string(status)));
@@ -143,10 +141,10 @@ void* getOpenGLProcAddress(void*, const char* name) {
);
}
void VideoTileProvider::on_mpv_render_update(void*) {
void VideoTileProvider::on_mpv_render_update(void* ctx) {
// The wakeup flag is set here to enable the mpv_render_context_render
// path in the main loop.
_wakeup = 1;
static_cast<VideoTileProvider*>(ctx)->_wakeup = 1;
}
void VideoTileProvider::observePropertyMpv(std::string name, mpv_format format,
@@ -407,7 +405,7 @@ void VideoTileProvider::initializeMpv() {
mpv_render_context_set_update_callback(
_mpvRenderContext,
on_mpv_render_update,
nullptr
this
);
// Load file

View File

@@ -106,7 +106,7 @@ private:
void handleMpvProperties(mpv_event* event);
void swapBuffersMpv(); // Called in postDraw
void cleanUpMpv(); // Called in internalDeinitialze
static void on_mpv_render_update(void*);
static void on_mpv_render_update(void*); // Has to be static because of C api
void observePropertyMpv(std::string name, mpv_format format, LibmpvPropertyKey key);
void setPropertyStringMpv(std::string name, std::string value);
void seekToTime(double time);
@@ -129,7 +129,7 @@ private:
std::unique_ptr<ghoul::opengl::Texture>_frameTexture = nullptr;
mpv_opengl_fbo _mpvFbo;
GLuint _fbo = 0;
static int _wakeup;
int _wakeup = 0;
bool _didRender = false;
bool _isPaused = false;