From 6085893c0db1d1102c3ef0bb5d8faa14a9e7245a Mon Sep 17 00:00:00 2001 From: Alexander Wilms Date: Mon, 29 Jan 2024 20:20:31 +0100 Subject: [PATCH] CVideoPlayer: Make overlay an argument of playVideo() instead of an attribute --- client/CVideoHandler.cpp | 11 ++++++----- client/CVideoHandler.h | 3 +-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/client/CVideoHandler.cpp b/client/CVideoHandler.cpp index 4cdb42ce9..4595e5977 100644 --- a/client/CVideoHandler.cpp +++ b/client/CVideoHandler.cpp @@ -101,8 +101,8 @@ bool CVideoPlayer::open(const VideoPath & fname, bool scale) } // loop = to loop through the video -// useOverlay = directly write to the screen. -bool CVideoPlayer::open(const VideoPath & videoToOpen, bool loop, bool useOverlay, bool scale) +// overlay = directly write to the screen. +bool CVideoPlayer::open(const VideoPath & videoToOpen, bool loop, bool overlay, bool scale) { close(); @@ -199,7 +199,7 @@ bool CVideoPlayer::open(const VideoPath & videoToOpen, bool loop, bool useOverla } // Allocate a place to put our YUV image on that screen - if (useOverlay) + if (overlay) { texture = SDL_CreateTexture( mainRenderer, SDL_PIXELFORMAT_IYUV, SDL_TEXTUREACCESS_STATIC, pos.w, pos.h); } @@ -624,7 +624,7 @@ Point CVideoPlayer::size() } // Plays a video. Only works for overlays. -bool CVideoPlayer::playVideo(int x, int y, bool stopOnKey) +bool CVideoPlayer::playVideo(int x, int y, bool stopOnKey, bool overlay) { // Note: either the windows player or the linux player is // broken. Compensate here until the bug is found. @@ -683,6 +683,7 @@ bool CVideoPlayer::openAndPlayVideo(const VideoPath & name, int x, int y, EVideo { bool scale; bool stopOnKey; + bool overlay; switch(videoType) { @@ -698,7 +699,7 @@ bool CVideoPlayer::openAndPlayVideo(const VideoPath & name, int x, int y, EVideo overlay = true; } open(name, false, true, scale); - bool ret = playVideo(x, y, stopOnKey); + bool ret = playVideo(x, y, stopOnKey, overlay); close(); return ret; } diff --git a/client/CVideoHandler.h b/client/CVideoHandler.h index e112966fc..89f8016a2 100644 --- a/client/CVideoHandler.h +++ b/client/CVideoHandler.h @@ -95,9 +95,8 @@ class CVideoPlayer final : public IMainVideoPlayer /// video playback currnet progress, in seconds double frameTime; bool doLoop; // loop through video - bool overlay; - bool playVideo(int x, int y, bool stopOnKey); + bool playVideo(int x, int y, bool stopOnKey, bool overlay); bool open(const VideoPath & fname, bool loop, bool useOverlay = false, bool scale = false); public: CVideoPlayer();