From 2c217ec4c1a4d401327aba2d97740437a08f6fb1 Mon Sep 17 00:00:00 2001 From: jrassa Date: Tue, 13 Jun 2017 18:57:18 -0400 Subject: [PATCH] fix show snapshot on video delay --- es-core/src/components/VideoComponent.cpp | 19 +++++++++---------- es-core/src/components/VideoComponent.h | 1 + .../src/components/VideoPlayerComponent.cpp | 3 +++ es-core/src/components/VideoVlcComponent.cpp | 2 ++ 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/es-core/src/components/VideoComponent.cpp b/es-core/src/components/VideoComponent.cpp index e015d34ce..623bf5d03 100644 --- a/es-core/src/components/VideoComponent.cpp +++ b/es-core/src/components/VideoComponent.cpp @@ -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& theme, const std::string& view, const std::string& element, unsigned int properties) diff --git a/es-core/src/components/VideoComponent.h b/es-core/src/components/VideoComponent.h index 414c51144..a729b7063 100644 --- a/es-core/src/components/VideoComponent.h +++ b/es-core/src/components/VideoComponent.h @@ -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& theme, const std::string& view, const std::string& element, unsigned int properties) override; diff --git a/es-core/src/components/VideoPlayerComponent.cpp b/es-core/src/components/VideoPlayerComponent.cpp index 33599b906..556123648 100644 --- a/es-core/src/components/VideoPlayerComponent.cpp +++ b/es-core/src/components/VideoPlayerComponent.cpp @@ -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) diff --git a/es-core/src/components/VideoVlcComponent.cpp b/es-core/src/components/VideoVlcComponent.cpp index 10c2118e5..d042374cc 100644 --- a/es-core/src/components/VideoVlcComponent.cpp +++ b/es-core/src/components/VideoVlcComponent.cpp @@ -202,6 +202,8 @@ void VideoVlcComponent::render(const Eigen::Affine3f& parentTrans) glDisableClientState(GL_COLOR_ARRAY); glDisable(GL_TEXTURE_2D); + } else { + VideoComponent::renderSnapshot(parentTrans); } }