[WASAPI] fix stream types and frequencies enumeration
[xbmc.git] / xbmc / guilib / StereoscopicsManager.h
blob8de93dc189e51f509de9cf7e94259ed7d2e6c691
1 /*
2 * Copyright (C) 2005-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: LGPL-2.1-or-later
6 * See LICENSES/README.md for more information.
7 */
9 #pragma once
11 /*!
12 * @file StereoscopicsManager.cpp
13 * @brief This class acts as container for stereoscopic related functions
16 #include "guilib/IMsgTargetCallback.h"
17 #include "rendering/RenderSystemTypes.h"
18 #include "settings/lib/ISettingCallback.h"
20 #include <stdlib.h>
22 class CAction;
23 class CDataCacheCore;
24 class CGUIWindowManager;
25 class CSettings;
27 enum STEREOSCOPIC_PLAYBACK_MODE
29 STEREOSCOPIC_PLAYBACK_MODE_ASK,
30 STEREOSCOPIC_PLAYBACK_MODE_PREFERRED,
31 STEREOSCOPIC_PLAYBACK_MODE_MONO,
33 STEREOSCOPIC_PLAYBACK_MODE_IGNORE = 100,
36 class CStereoscopicsManager : public ISettingCallback,
37 public IMsgTargetCallback
39 public:
40 CStereoscopicsManager();
42 ~CStereoscopicsManager(void) override;
44 void Initialize();
46 RENDER_STEREO_MODE GetStereoMode(void) const;
47 std::string DetectStereoModeByString(const std::string &needle) const;
48 std::string GetLabelForStereoMode(const RENDER_STEREO_MODE &mode) const;
50 void SetStereoMode(const RENDER_STEREO_MODE &mode);
52 static const char* ConvertGuiStereoModeToString(const RENDER_STEREO_MODE &mode);
53 /**
54 * @brief Converts a stereoscopics related action/command from Builtins and JsonRPC into the according cAction ID.
55 * @param command The command/action
56 * @param parameter The parameter of the command
57 * @return The integer of the according cAction or -1 if not valid
59 static CAction ConvertActionCommandToAction(const std::string &command, const std::string &parameter);
60 static std::string NormalizeStereoMode(const std::string &mode);
62 void OnSettingChanged(const std::shared_ptr<const CSetting>& setting) override;
63 void OnStreamChange();
64 bool OnMessage(CGUIMessage &message) override;
65 /*!
66 * @brief Handle 3D specific cActions
67 * @param action The action to process
68 * @return True if action could be handled, false otherwise.
70 bool OnAction(const CAction &action);
72 private:
73 RENDER_STEREO_MODE GetNextSupportedStereoMode(const RENDER_STEREO_MODE &currentMode, int step = 1) const;
74 RENDER_STEREO_MODE GetStereoModeByUserChoice() const;
75 RENDER_STEREO_MODE GetStereoModeOfPlayingVideo(void) const;
76 RENDER_STEREO_MODE GetPreferredPlaybackMode(void) const;
77 std::string GetVideoStereoMode() const;
78 bool IsVideoStereoscopic() const;
80 void SetStereoModeByUser(const RENDER_STEREO_MODE &mode);
82 void ApplyStereoMode(const RENDER_STEREO_MODE &mode, bool notify = true);
83 void OnPlaybackStopped(void);
85 /**
86 * @brief will convert a string representation into a GUI stereo mode
87 * @param mode The string to convert
88 * @return -1 if not found, otherwise the according int of the RENDER_STEREO_MODE enum
90 static int ConvertStringToGuiStereoMode(const std::string &mode);
91 static int ConvertVideoToGuiStereoMode(const std::string &mode);
93 // Construction parameters
94 std::shared_ptr<CSettings> m_settings;
96 // Stereoscopic parameters
97 RENDER_STEREO_MODE m_stereoModeSetByUser;
98 RENDER_STEREO_MODE m_lastStereoModeSetByUser;