Make sure video player is initialized for each video renderable

This commit is contained in:
Malin E
2023-03-21 15:29:11 +01:00
parent f62d0bb677
commit b0c0ea81ab
6 changed files with 18 additions and 2 deletions

View File

@@ -40,6 +40,7 @@ class ScreenSpaceVideo : public ScreenSpaceRenderable {
public:
ScreenSpaceVideo(const ghoul::Dictionary& dictionary);
bool initializeGL() override;
bool deinitializeGL() override;
void update() override;
void render() override;

View File

@@ -51,6 +51,8 @@ public:
VideoPlayer(const ghoul::Dictionary& dictionary);
~VideoPlayer();
void initialize();
// Video interaction
void pause();
void play();

View File

@@ -224,6 +224,8 @@ void RenderableVideoSphere::initializeGL() {
);
ghoul::opengl::updateUniformLocations(*_shader, _uniformCache, UniformNames);
_videoPlayer.initialize();
}
void RenderableVideoSphere::deinitializeGL() {

View File

@@ -88,6 +88,12 @@ void ScreenSpaceVideo::render() {
ScreenSpaceRenderable::render();
}
bool ScreenSpaceVideo::initializeGL() {
_videoPlayer.initialize();
return ScreenSpaceRenderable::initializeGL();
}
bool ScreenSpaceVideo::deinitializeGL() {
_videoPlayer.destroy();

View File

@@ -360,6 +360,9 @@ void VideoPlayer::stepFrameBackward() {
commandAsyncMpv(cmd);
}
void VideoPlayer::initialize() {
initializeMpv();
}
void VideoPlayer::initializeMpv() {
_mpvHandle = mpv_create();

View File

@@ -138,7 +138,7 @@ int VideoTileProvider::minLevel() {
}
int VideoTileProvider::maxLevel() {
// This is the level where above the tile is marked as unavailable and is no longer
// This is the level where above the tile is marked as unavailable and is no longer
// displayed. Since we want to display the tiles at all times we set the max level
return 1337;
}
@@ -147,7 +147,9 @@ float VideoTileProvider::noDataValueAsFloat() {
return std::numeric_limits<float>::min();
}
void VideoTileProvider::internalInitialize() {}
void VideoTileProvider::internalInitialize() {
_videoPlayer.initialize();
}
VideoTileProvider::~VideoTileProvider() {}