Added 'rotation' and 'rotationOrigin' properties to the video element

Also changed the 'interpolation' property to also apply to the video stream
This commit is contained in:
Leon Styhre 2023-09-30 12:12:32 +02:00
parent fcc46148e9
commit 0e2571e8dd
4 changed files with 10 additions and 0 deletions

View file

@ -303,6 +303,8 @@ std::map<std::string, std::map<std::string, ThemeData::ElementPropertyType>>
{"cropSize", NORMALIZED_PAIR},
{"maxSize", NORMALIZED_PAIR},
{"origin", NORMALIZED_PAIR},
{"rotation", FLOAT},
{"rotationOrigin", NORMALIZED_PAIR},
{"stationary", STRING},
{"path", PATH},
{"default", PATH},

View file

@ -45,6 +45,7 @@ VideoComponent::VideoComponent()
, mPlayAudio {true}
, mDrawPillarboxes {true}
, mRenderScanlines {false}
, mLinearInterpolation {false}
, mHasVideo {false}
, mGeneralFade {false}
, mFadeIn {1.0f}
@ -211,12 +212,17 @@ void VideoComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
if (elem->has("audio"))
mPlayAudio = elem->get<bool>("audio");
mStaticImage.setRotation(mRotation);
mStaticImage.setRotationOrigin(mRotationOrigin);
if (elem->has("interpolation")) {
const std::string& interpolation {elem->get<std::string>("interpolation")};
if (interpolation == "linear") {
mLinearInterpolation = true;
mStaticImage.setLinearInterpolation(true);
}
else if (interpolation == "nearest") {
mLinearInterpolation = false;
mStaticImage.setLinearInterpolation(false);
}
else {

View file

@ -136,6 +136,7 @@ protected:
bool mPlayAudio;
bool mDrawPillarboxes;
bool mRenderScanlines;
bool mLinearInterpolation;
bool mHasVideo;
bool mGeneralFade;
float mFadeIn;

View file

@ -1363,6 +1363,7 @@ void VideoFFmpegComponent::startVideoStream()
// Get an empty texture for rendering the video.
mTexture = TextureResource::get("");
mTexture->setLinearMagnify(mLinearInterpolation);
// This is used for the audio and video synchronization.
mTimeReference = std::chrono::high_resolution_clock::now();