Added a 'fadeInType' property to the video element

This commit is contained in:
Leon Styhre 2025-02-06 23:08:17 +01:00
parent ec7253a602
commit 61e671501c
4 changed files with 19 additions and 1 deletions

View file

@ -383,6 +383,7 @@ std::map<std::string, std::map<std::string, ThemeData::ElementPropertyType>>
{"pillarboxThreshold", NORMALIZED_PAIR},
{"scanlines", BOOLEAN},
{"delay", FLOAT},
{"fadeInType", STRING},
{"fadeInTime", FLOAT},
{"scrollFadeIn", BOOLEAN},
{"brightness", FLOAT},

View file

@ -26,6 +26,7 @@ VideoComponent::VideoComponent()
, mColorShiftEnd {0xFFFFFFFF}
, mVideoCornerRadius {0.0f}
, mColorGradientHorizontal {true}
, mRenderBlackFrame {true}
, mTargetSize {0.0f, 0.0f}
, mCropPos {0.5f, 0.5f}
, mImageCropPos {0.5f, 0.5f}
@ -328,6 +329,21 @@ void VideoComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
if (mConfig.startDelay != 0)
mConfig.showStaticImageDelay = true;
if (elem->has("fadeInType")) {
const std::string& fadeInType {elem->get<std::string>("fadeInType")};
if (fadeInType == "black") {
mRenderBlackFrame = true;
}
else if (fadeInType == "transparent") {
mRenderBlackFrame = false;
}
else {
LOG(LogWarning) << "VideoComponent: Invalid theme configuration, property "
"\"fadeInType\" for element \""
<< element.substr(6) << "\" defined as \"" << fadeInType << "\"";
}
}
if (properties && elem->has("fadeInTime"))
mFadeInTime = glm::clamp(elem->get<float>("fadeInTime"), 0.0f, 8.0f) * 1000.0f;

View file

@ -120,6 +120,7 @@ protected:
unsigned int mColorShiftEnd;
float mVideoCornerRadius;
bool mColorGradientHorizontal;
bool mRenderBlackFrame;
glm::vec2 mTargetSize;
glm::vec2 mCropPos;
glm::vec2 mImageCropPos;

View file

@ -217,7 +217,7 @@ void VideoFFmpegComponent::render(const glm::mat4& parentTrans)
mRenderer->setMatrix(parentTrans);
}
if (!mScreensaverMode && !mMediaViewerMode) {
if (!mScreensaverMode && !mMediaViewerMode && mRenderBlackFrame) {
mBlackFrame.setOpacity(mOpacity * mThemeOpacity);
mBlackFrame.render(trans);
}