summaryrefslogtreecommitdiffstats
path: root/xbmc/guilib/StereoscopicsManager.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-10 18:07:22 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-10 18:07:22 +0000
commitc04dcc2e7d834218ef2d4194331e383402495ae1 (patch)
tree7333e38d10d75386e60f336b80c2443c1166031d /xbmc/guilib/StereoscopicsManager.h
parentInitial commit. (diff)
downloadkodi-c04dcc2e7d834218ef2d4194331e383402495ae1.tar.xz
kodi-c04dcc2e7d834218ef2d4194331e383402495ae1.zip
Adding upstream version 2:20.4+dfsg.upstream/2%20.4+dfsg
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'xbmc/guilib/StereoscopicsManager.h')
-rw-r--r--xbmc/guilib/StereoscopicsManager.h99
1 files changed, 99 insertions, 0 deletions
diff --git a/xbmc/guilib/StereoscopicsManager.h b/xbmc/guilib/StereoscopicsManager.h
new file mode 100644
index 0000000..8de93dc
--- /dev/null
+++ b/xbmc/guilib/StereoscopicsManager.h
@@ -0,0 +1,99 @@
+/*
+ * Copyright (C) 2005-2018 Team Kodi
+ * This file is part of Kodi - https://kodi.tv
+ *
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ * See LICENSES/README.md for more information.
+ */
+
+#pragma once
+
+/*!
+ * @file StereoscopicsManager.cpp
+ * @brief This class acts as container for stereoscopic related functions
+ */
+
+#include "guilib/IMsgTargetCallback.h"
+#include "rendering/RenderSystemTypes.h"
+#include "settings/lib/ISettingCallback.h"
+
+#include <stdlib.h>
+
+class CAction;
+class CDataCacheCore;
+class CGUIWindowManager;
+class CSettings;
+
+enum STEREOSCOPIC_PLAYBACK_MODE
+{
+ STEREOSCOPIC_PLAYBACK_MODE_ASK,
+ STEREOSCOPIC_PLAYBACK_MODE_PREFERRED,
+ STEREOSCOPIC_PLAYBACK_MODE_MONO,
+
+ STEREOSCOPIC_PLAYBACK_MODE_IGNORE = 100,
+};
+
+class CStereoscopicsManager : public ISettingCallback,
+ public IMsgTargetCallback
+{
+public:
+ CStereoscopicsManager();
+
+ ~CStereoscopicsManager(void) override;
+
+ void Initialize();
+
+ RENDER_STEREO_MODE GetStereoMode(void) const;
+ std::string DetectStereoModeByString(const std::string &needle) const;
+ std::string GetLabelForStereoMode(const RENDER_STEREO_MODE &mode) const;
+
+ void SetStereoMode(const RENDER_STEREO_MODE &mode);
+
+ static const char* ConvertGuiStereoModeToString(const RENDER_STEREO_MODE &mode);
+ /**
+ * @brief Converts a stereoscopics related action/command from Builtins and JsonRPC into the according cAction ID.
+ * @param command The command/action
+ * @param parameter The parameter of the command
+ * @return The integer of the according cAction or -1 if not valid
+ */
+ static CAction ConvertActionCommandToAction(const std::string &command, const std::string &parameter);
+ static std::string NormalizeStereoMode(const std::string &mode);
+
+ void OnSettingChanged(const std::shared_ptr<const CSetting>& setting) override;
+ void OnStreamChange();
+ bool OnMessage(CGUIMessage &message) override;
+ /*!
+ * @brief Handle 3D specific cActions
+ * @param action The action to process
+ * @return True if action could be handled, false otherwise.
+ */
+ bool OnAction(const CAction &action);
+
+private:
+ RENDER_STEREO_MODE GetNextSupportedStereoMode(const RENDER_STEREO_MODE &currentMode, int step = 1) const;
+ RENDER_STEREO_MODE GetStereoModeByUserChoice() const;
+ RENDER_STEREO_MODE GetStereoModeOfPlayingVideo(void) const;
+ RENDER_STEREO_MODE GetPreferredPlaybackMode(void) const;
+ std::string GetVideoStereoMode() const;
+ bool IsVideoStereoscopic() const;
+
+ void SetStereoModeByUser(const RENDER_STEREO_MODE &mode);
+
+ void ApplyStereoMode(const RENDER_STEREO_MODE &mode, bool notify = true);
+ void OnPlaybackStopped(void);
+
+ /**
+ * @brief will convert a string representation into a GUI stereo mode
+ * @param mode The string to convert
+ * @return -1 if not found, otherwise the according int of the RENDER_STEREO_MODE enum
+ */
+ static int ConvertStringToGuiStereoMode(const std::string &mode);
+ static int ConvertVideoToGuiStereoMode(const std::string &mode);
+
+ // Construction parameters
+ std::shared_ptr<CSettings> m_settings;
+
+ // Stereoscopic parameters
+ RENDER_STEREO_MODE m_stereoModeSetByUser;
+ RENDER_STEREO_MODE m_lastStereoModeSetByUser;
+};