From 7a02f3e3f0b94e3e758a27371b85dc042b827fdc Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sat, 2 Sep 2023 20:58:26 +0200 Subject: [PATCH] movieplayer: rework player handling Signed-off-by: GetAway Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/df27866642fe2f26ffa3db3a9dee972fb568389c Author: Thilo Graf Date: 2023-09-02 (Sat, 02 Sep 2023) ------------------ This commit was generated by Migit --- src/gui/movieplayer.cpp | 12 ++++++++++-- src/gui/movieplayer.h | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/gui/movieplayer.cpp b/src/gui/movieplayer.cpp index 9024d9457..d280bce9f 100644 --- a/src/gui/movieplayer.cpp +++ b/src/gui/movieplayer.cpp @@ -169,8 +169,8 @@ void CMoviePlayerGui::Init(void) frameBuffer = CFrameBuffer::getInstance(); - if (playback == NULL) - playback = new cPlayback(0); + // init playback instance + playback = getPlayback(); #if HAVE_CST_HARDWARE videoDecoder->setPlaybackPtr(playback); #endif @@ -3544,3 +3544,11 @@ size_t CMoviePlayerGui::GetReadCount() //printf("GetReadCount: %lld\n", res); return (size_t) res; } + +cPlayback *CMoviePlayerGui::getPlayback() +{ + if (playback == NULL) // mutex needed ? + playback = new cPlayback(0); + + return playback; +} diff --git a/src/gui/movieplayer.h b/src/gui/movieplayer.h index 50b2e578e..9aa34d0f2 100644 --- a/src/gui/movieplayer.h +++ b/src/gui/movieplayer.h @@ -277,7 +277,7 @@ class CMoviePlayerGui : public CMenuTarget void deleteTimeshift() { timeshift_deletion = true; } void moveTimeshift() { timeshift_to_record = true; } int file_prozent; - cPlayback *getPlayback() { return playback; } + static cPlayback *getPlayback(); void SetFile(std::string &name, std::string &file, std::string info1="", std::string info2="", std::string file2="") { pretty_name = name; file_name = file; info_1 = info1; info_2 = info2; second_file_name = file2; } bool PlayBackgroundStart(const std::string &file, const std::string &name, t_channel_id chan, const std::string &script=""); void stopPlayBack(void);