fix show snapshot on video delay

This commit is contained in:
jrassa 2017-06-13 18:57:18 -04:00
parent 6e7f5d1609
commit 2c217ec4c1
4 changed files with 15 additions and 10 deletions

View file

@ -164,19 +164,18 @@ void VideoComponent::render(const Eigen::Affine3f& parentTrans)
// Handle looping of the video
handleLooping();
}
if (!mIsPlaying)
void VideoComponent::renderSnapshot(const Eigen::Affine3f& parentTrans)
{
// This is the case where the video is not currently being displayed. Work out
// if we need to display a static image
if ((mConfig.showSnapshotNoVideo && mVideoPath.empty()) || (mStartDelayed && mConfig.showSnapshotDelay))
{
// This is the case where the video is not currently being displayed. Work out
// if we need to display a static image
if ((mConfig.showSnapshotNoVideo && mVideoPath.empty()) || (mStartDelayed && mConfig.showSnapshotDelay))
{
// Display the static image instead
mStaticImage.setOpacity((unsigned char)(mFadeIn * 255.0f));
mStaticImage.render(parentTrans);
}
// Display the static image instead
mStaticImage.setOpacity((unsigned char)(mFadeIn * 255.0f));
mStaticImage.render(parentTrans);
}
}
void VideoComponent::applyTheme(const std::shared_ptr<ThemeData>& theme, const std::string& view, const std::string& element, unsigned int properties)

View file

@ -56,6 +56,7 @@ public:
void setOpacity(unsigned char opacity) override;
void render(const Eigen::Affine3f& parentTrans) override;
void renderSnapshot(const Eigen::Affine3f& parentTrans);
virtual void applyTheme(const std::shared_ptr<ThemeData>& theme, const std::string& view, const std::string& element, unsigned int properties) override;

View file

@ -27,6 +27,9 @@ VideoPlayerComponent::~VideoPlayerComponent()
void VideoPlayerComponent::render(const Eigen::Affine3f& parentTrans)
{
VideoComponent::render(parentTrans);
if (!mIsPlaying || mPlayerPid == -1)
VideoComponent::renderSnapshot(parentTrans);
}
void VideoPlayerComponent::setResize(float width, float height)

View file

@ -202,6 +202,8 @@ void VideoVlcComponent::render(const Eigen::Affine3f& parentTrans)
glDisableClientState(GL_COLOR_ARRAY);
glDisable(GL_TEXTURE_2D);
} else {
VideoComponent::renderSnapshot(parentTrans);
}
}