aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGarrett Brown <themagnificentmrb@gmail.com>2017-08-08 08:46:26 -0700
committerGarrett Brown <themagnificentmrb@gmail.com>2017-08-08 10:12:18 -0700
commit693c812805bf9aa0c77e1103a63defc6f3437173 (patch)
tree3e696d0c25827296a71d96a9ca46617d03d78713
parent5e3a36abe6f2f92a3b36a380fb8ff22569e3dd04 (diff)
Video select dialogs: Remove dependence on IPlayer interface
-rw-r--r--cmake/treedata/common/cores.txt1
-rw-r--r--cmake/treedata/common/retroplayer.txt2
-rw-r--r--xbmc/cores/RetroPlayer/RetroPlayer.cpp91
-rw-r--r--xbmc/cores/RetroPlayer/RetroPlayer.h30
-rw-r--r--xbmc/cores/RetroPlayer/rendering/CMakeLists.txt5
-rw-r--r--xbmc/cores/RetroPlayer/rendering/RPRenderManager.cpp53
-rw-r--r--xbmc/cores/RetroPlayer/rendering/RPRenderManager.h43
-rw-r--r--xbmc/games/dialogs/osd/CMakeLists.txt1
-rw-r--r--xbmc/games/dialogs/osd/DialogGameVideoFilter.cpp19
-rw-r--r--xbmc/games/dialogs/osd/DialogGameVideoSelect.cpp10
-rw-r--r--xbmc/games/dialogs/osd/DialogGameVideoSelect.h8
-rw-r--r--xbmc/games/dialogs/osd/DialogGameViewMode.cpp19
-rw-r--r--xbmc/games/dialogs/osd/DialogGameViewMode.h2
-rw-r--r--xbmc/games/dialogs/osd/IVideoSelectCallback.h39
14 files changed, 286 insertions, 37 deletions
diff --git a/cmake/treedata/common/cores.txt b/cmake/treedata/common/cores.txt
index 8d79dd18dc..d23939d314 100644
--- a/cmake/treedata/common/cores.txt
+++ b/cmake/treedata/common/cores.txt
@@ -6,4 +6,3 @@ xbmc/cores/DllLoader/exports/util cores/dll-loader/exports/util
xbmc/cores/ExternalPlayer cores/externalplayer
xbmc/cores/paplayer cores/paplayer
xbmc/cores/playercorefactory cores/playercorefactory
-xbmc/cores/RetroPlayer cores/RetroPlayer
diff --git a/cmake/treedata/common/retroplayer.txt b/cmake/treedata/common/retroplayer.txt
new file mode 100644
index 0000000000..6a655e3301
--- /dev/null
+++ b/cmake/treedata/common/retroplayer.txt
@@ -0,0 +1,2 @@
+xbmc/cores/RetroPlayer cores/RetroPlayer
+xbmc/cores/RetroPlayer/rendering cores/RetroPlayer/rendering
diff --git a/xbmc/cores/RetroPlayer/RetroPlayer.cpp b/xbmc/cores/RetroPlayer/RetroPlayer.cpp
index bf077a04cc..c4df024999 100644
--- a/xbmc/cores/RetroPlayer/RetroPlayer.cpp
+++ b/xbmc/cores/RetroPlayer/RetroPlayer.cpp
@@ -24,6 +24,7 @@
#include "RetroPlayerVideo.h"
#include "addons/AddonManager.h"
#include "cores/DataCacheCore.h"
+#include "cores/RetroPlayer/rendering/RPRenderManager.h"
#include "cores/VideoPlayer/Process/ProcessInfo.h"
#include "dialogs/GUIDialogYesNo.h"
#include "filesystem/File.h"
@@ -31,6 +32,7 @@
#include "games/addons/savestates/Savestate.h"
#include "games/addons/savestates/SavestateUtils.h"
#include "games/addons/GameClient.h"
+#include "games/dialogs/osd/DialogGameVideoSelect.h"
#include "games/ports/PortManager.h"
#include "games/tags/GameInfoTag.h"
#include "games/GameServices.h"
@@ -56,7 +58,7 @@ using namespace RETRO;
CRetroPlayer::CRetroPlayer(IPlayerCallback& callback) :
IPlayer(callback),
- m_renderManager(m_clock, this),
+ m_renderManager(new CRPRenderManager(m_clock, this)),
m_processInfo(CProcessInfo::CreateInstance())
{
m_processInfo->SetDataCache(&CServiceBroker::GetDataCacheCore());
@@ -96,7 +98,7 @@ bool CRetroPlayer::OpenFile(const CFileItem& file, const CPlayerOptions& options
if (m_gameClient->Initialize())
{
m_audio.reset(new CRetroPlayerAudio(*m_processInfo));
- m_video.reset(new CRetroPlayerVideo(m_renderManager, *m_processInfo, m_clock));
+ m_video.reset(new CRetroPlayerVideo(*m_renderManager, *m_processInfo, m_clock));
if (!file.GetPath().empty())
bSuccess = m_gameClient->OpenFile(file, m_audio.get(), m_video.get());
@@ -148,6 +150,7 @@ bool CRetroPlayer::OpenFile(const CFileItem& file, const CPlayerOptions& options
if (bSuccess)
{
+ RegisterWindowCallbacks();
SetSpeed(1);
m_callback.OnPlayBackStarted();
m_autoSave.reset(new CRetroPlayerAutoSave(*m_gameClient));
@@ -173,6 +176,7 @@ bool CRetroPlayer::CloseFile(bool reopen /* = false */)
if (m_gameClient)
{
+ UnregisterWindowCallbacks();
m_gameClient->CloseFile();
m_gameClient->Unload();
m_gameClient.reset();
@@ -406,7 +410,7 @@ bool CRetroPlayer::SetPlayerState(const std::string& state)
void CRetroPlayer::FrameMove()
{
- m_renderManager.FrameMove();
+ m_renderManager->FrameMove();
if (m_gameClient)
{
@@ -446,6 +450,36 @@ void CRetroPlayer::FrameMove()
}
}
+void CRetroPlayer::Render(bool clear, uint32_t alpha /* = 255 */, bool gui /* = true */)
+{
+ m_renderManager->Render(clear, 0, alpha, gui);
+}
+
+void CRetroPlayer::FlushRenderer()
+{
+ m_renderManager->Flush(true);
+}
+
+void CRetroPlayer::SetRenderViewMode(int mode)
+{
+ m_renderManager->SetViewMode(mode);
+}
+
+float CRetroPlayer::GetRenderAspectRatio()
+{
+ return m_renderManager->GetAspectRatio();
+}
+
+void CRetroPlayer::TriggerUpdateResolution()
+{
+ m_renderManager->TriggerUpdateResolution(0.0f, 0, 0);
+}
+
+bool CRetroPlayer::IsRenderingVideo()
+{
+ return m_renderManager->IsConfigured();
+}
+
bool CRetroPlayer::Supports(EINTERLACEMETHOD method)
{
return m_processInfo->Supports(method);
@@ -455,6 +489,35 @@ EINTERLACEMETHOD CRetroPlayer::GetDeinterlacingMethodDefault()
{
return m_processInfo->GetDeinterlacingMethodDefault();
}
+bool CRetroPlayer::Supports(ESCALINGMETHOD method)
+{
+ return m_renderManager->Supports(method);
+}
+
+bool CRetroPlayer::Supports(ERENDERFEATURE feature)
+{
+ return m_renderManager->Supports(feature);
+}
+
+unsigned int CRetroPlayer::RenderCaptureAlloc()
+{
+ return m_renderManager->AllocRenderCapture();
+}
+
+void CRetroPlayer::RenderCaptureRelease(unsigned int captureId)
+{
+ m_renderManager->ReleaseRenderCapture(captureId);
+}
+
+void CRetroPlayer::RenderCapture(unsigned int captureId, unsigned int width, unsigned int height, int flags)
+{
+ m_renderManager->StartRenderCapture(captureId, width, height, flags);
+}
+
+bool CRetroPlayer::RenderCaptureGetPixels(unsigned int captureId, unsigned int millis, uint8_t *buffer, unsigned int size)
+{
+ return m_renderManager->RenderCaptureGetPixels(captureId, millis, buffer, size);
+}
void CRetroPlayer::UpdateClockSync(bool enabled)
{
@@ -494,6 +557,28 @@ void CRetroPlayer::CloseOSD()
g_windowManager.CloseDialogs(true);
}
+void CRetroPlayer::RegisterWindowCallbacks()
+{
+ CDialogGameVideoSelect *dialogVideoFilter = dynamic_cast<CDialogGameVideoSelect*>(g_windowManager.GetWindow(WINDOW_DIALOG_GAME_VIDEO_FILTER));
+ if (dialogVideoFilter != nullptr)
+ dialogVideoFilter->RegisterCallback(m_renderManager.get());
+
+ CDialogGameVideoSelect *dialogViewMode = dynamic_cast<CDialogGameVideoSelect*>(g_windowManager.GetWindow(WINDOW_DIALOG_GAME_VIEW_MODE));
+ if (dialogViewMode != nullptr)
+ dialogViewMode->RegisterCallback(m_renderManager.get());
+}
+
+void CRetroPlayer::UnregisterWindowCallbacks()
+{
+ CDialogGameVideoSelect *dialogVideoFilter = dynamic_cast<CDialogGameVideoSelect*>(g_windowManager.GetWindow(WINDOW_DIALOG_GAME_VIDEO_FILTER));
+ if (dialogVideoFilter != nullptr)
+ dialogVideoFilter->UnregisterCallback();
+
+ CDialogGameVideoSelect *dialogViewMode = dynamic_cast<CDialogGameVideoSelect*>(g_windowManager.GetWindow(WINDOW_DIALOG_GAME_VIEW_MODE));
+ if (dialogViewMode != nullptr)
+ dialogViewMode->UnregisterCallback();
+}
+
void CRetroPlayer::PrintGameInfo(const CFileItem &file) const
{
const CGameInfoTag *tag = file.GetGameInfoTag();
diff --git a/xbmc/cores/RetroPlayer/RetroPlayer.h b/xbmc/cores/RetroPlayer/RetroPlayer.h
index f3be04f6cd..dfcbae4f99 100644
--- a/xbmc/cores/RetroPlayer/RetroPlayer.h
+++ b/xbmc/cores/RetroPlayer/RetroPlayer.h
@@ -37,6 +37,7 @@ namespace RETRO
class CRetroPlayerAudio;
class CRetroPlayerAutoSave;
class CRetroPlayerVideo;
+ class CRPRenderManager;
class CRetroPlayer : public IPlayer,
public IRenderMsg
@@ -118,20 +119,20 @@ namespace RETRO
//virtual void GetAudioCapabilities(std::vector<int> &audioCaps) override { audioCaps.assign(1,IPC_AUD_ALL); }
//virtual void GetSubtitleCapabilities(std::vector<int> &subCaps) override { subCaps.assign(1,IPC_SUBS_ALL); }
void FrameMove() override;
- void Render(bool clear, uint32_t alpha = 255, bool gui = true) override { m_renderManager.Render(clear, 0, alpha, gui); }
- void FlushRenderer() override { m_renderManager.Flush(true); }
- void SetRenderViewMode(int mode) override { m_renderManager.SetViewMode(mode); }
- float GetRenderAspectRatio() override { return m_renderManager.GetAspectRatio(); }
- void TriggerUpdateResolution() override { m_renderManager.TriggerUpdateResolution(0.0f, 0, 0); }
- bool IsRenderingVideo() override { return m_renderManager.IsConfigured(); }
+ void Render(bool clear, uint32_t alpha = 255, bool gui = true) override;
+ void FlushRenderer() override;
+ void SetRenderViewMode(int mode) override;
+ float GetRenderAspectRatio() override;
+ void TriggerUpdateResolution() override;
+ bool IsRenderingVideo() override;
bool Supports(EINTERLACEMETHOD method) override;
EINTERLACEMETHOD GetDeinterlacingMethodDefault() override;
- bool Supports(ESCALINGMETHOD method) override { return m_renderManager.Supports(method); }
- bool Supports(ERENDERFEATURE feature) override { return m_renderManager.Supports(feature); }
- unsigned int RenderCaptureAlloc() override { return m_renderManager.AllocRenderCapture(); }
- void RenderCaptureRelease(unsigned int captureId) override { m_renderManager.ReleaseRenderCapture(captureId); }
- void RenderCapture(unsigned int captureId, unsigned int width, unsigned int height, int flags) override { m_renderManager.StartRenderCapture(captureId, width, height, flags); }
- bool RenderCaptureGetPixels(unsigned int captureId, unsigned int millis, uint8_t *buffer, unsigned int size) override { return m_renderManager.RenderCaptureGetPixels(captureId, millis, buffer, size); }
+ bool Supports(ESCALINGMETHOD method) override;
+ bool Supports(ERENDERFEATURE feature) override;
+ unsigned int RenderCaptureAlloc() override;
+ void RenderCaptureRelease(unsigned int captureId) override;
+ void RenderCapture(unsigned int captureId, unsigned int width, unsigned int height, int flags) override;
+ bool RenderCaptureGetPixels(unsigned int captureId, unsigned int millis, uint8_t *buffer, unsigned int size) override;
// implementation of IRenderMsg
virtual void VideoParamsChange() override { }
@@ -154,6 +155,9 @@ namespace RETRO
*/
void CloseOSD();
+ void RegisterWindowCallbacks();
+ void UnregisterWindowCallbacks();
+
/**
* \brief Dump game information (if any) to the debug log.
*/
@@ -172,7 +176,7 @@ namespace RETRO
State m_state = State::STARTING;
double m_priorSpeed = 0.0f; // Speed of gameplay before entering OSD
CDVDClock m_clock;
- CRenderManager m_renderManager;
+ std::unique_ptr<CRPRenderManager> m_renderManager;
std::unique_ptr<CProcessInfo> m_processInfo;
std::unique_ptr<CRetroPlayerAudio> m_audio;
std::unique_ptr<CRetroPlayerVideo> m_video;
diff --git a/xbmc/cores/RetroPlayer/rendering/CMakeLists.txt b/xbmc/cores/RetroPlayer/rendering/CMakeLists.txt
new file mode 100644
index 0000000000..290b131c83
--- /dev/null
+++ b/xbmc/cores/RetroPlayer/rendering/CMakeLists.txt
@@ -0,0 +1,5 @@
+set(SOURCES RPRenderManager.cpp)
+
+set(HEADERS RPRenderManager.h)
+
+core_add_library(rp-rendering)
diff --git a/xbmc/cores/RetroPlayer/rendering/RPRenderManager.cpp b/xbmc/cores/RetroPlayer/rendering/RPRenderManager.cpp
new file mode 100644
index 0000000000..5cc6c2fbf0
--- /dev/null
+++ b/xbmc/cores/RetroPlayer/rendering/RPRenderManager.cpp
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2017 Team Kodi
+ * http://kodi.tv
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this Program; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "RPRenderManager.h"
+#include "settings/MediaSettings.h"
+#include "settings/VideoSettings.h"
+
+using namespace KODI;
+using namespace RETRO;
+
+CRPRenderManager::CRPRenderManager(CDVDClock &clock, IRenderMsg *player) :
+ CRenderManager(clock, player)
+{
+}
+
+bool CRPRenderManager::SupportsScalingMethod(ESCALINGMETHOD method)
+{
+ return Supports(method);
+}
+
+bool CRPRenderManager::SupportsRenderFeature(ERENDERFEATURE feature)
+{
+ return Supports(feature);
+}
+
+void CRPRenderManager::SetRenderViewMode(ViewMode mode)
+{
+ SetViewMode(mode);
+}
+
+void CRPRenderManager::SetScalingMethod(ESCALINGMETHOD method)
+{
+ //! @todo
+ CVideoSettings &videoSettings = CMediaSettings::GetInstance().GetCurrentVideoSettings();
+ videoSettings.m_ScalingMethod = method;
+}
diff --git a/xbmc/cores/RetroPlayer/rendering/RPRenderManager.h b/xbmc/cores/RetroPlayer/rendering/RPRenderManager.h
new file mode 100644
index 0000000000..3a107e8c10
--- /dev/null
+++ b/xbmc/cores/RetroPlayer/rendering/RPRenderManager.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2017 Team Kodi
+ * http://kodi.tv
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this Program; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+#pragma once
+
+#include "cores/VideoPlayer/VideoRenderers/RenderManager.h"
+#include "games/dialogs/osd/IVideoSelectCallback.h"
+
+namespace KODI
+{
+namespace RETRO
+{
+ class CRPRenderManager : public CRenderManager,
+ public GAME::IVideoSelectCallback
+ {
+ public:
+ CRPRenderManager(CDVDClock &clock, IRenderMsg *player);
+ ~CRPRenderManager() override = default;
+
+ // Implementation of IVideoSelectCallback
+ bool SupportsScalingMethod(ESCALINGMETHOD method) override;
+ bool SupportsRenderFeature(ERENDERFEATURE feature) override;
+ void SetRenderViewMode(ViewMode mode) override;
+ void SetScalingMethod(ESCALINGMETHOD method) override;
+ };
+}
+}
diff --git a/xbmc/games/dialogs/osd/CMakeLists.txt b/xbmc/games/dialogs/osd/CMakeLists.txt
index 77bf41d3de..53b148a9ab 100644
--- a/xbmc/games/dialogs/osd/CMakeLists.txt
+++ b/xbmc/games/dialogs/osd/CMakeLists.txt
@@ -8,6 +8,7 @@ set(HEADERS DialogGameOSD.h
DialogGameVideoFilter.h
DialogGameVideoSelect.h
DialogGameViewMode.h
+ IVideoSelectCallback.h
)
core_add_library(gameosddialogs)
diff --git a/xbmc/games/dialogs/osd/DialogGameVideoFilter.cpp b/xbmc/games/dialogs/osd/DialogGameVideoFilter.cpp
index dec044da2c..40e1014fe8 100644
--- a/xbmc/games/dialogs/osd/DialogGameVideoFilter.cpp
+++ b/xbmc/games/dialogs/osd/DialogGameVideoFilter.cpp
@@ -19,13 +19,11 @@
*/
#include "DialogGameVideoFilter.h"
+#include "IVideoSelectCallback.h"
#include "guilib/LocalizeStrings.h"
#include "guilib/WindowIDs.h"
#include "settings/GameSettings.h"
#include "settings/MediaSettings.h"
-#include "settings/VideoSettings.h" //! @todo
-#include "Application.h"
-#include "ApplicationPlayer.h"
#include "FileItem.h"
using namespace KODI;
@@ -58,10 +56,13 @@ void CDialogGameVideoFilter::PreInit()
{
m_videoFilters.clear();
- for (const auto &videoFilter : m_allVideoFilters)
+ if (m_callback != nullptr)
{
- if (g_application.m_pPlayer->Supports(videoFilter.scalingMethod))
- m_videoFilters.emplace_back(videoFilter);
+ for (const auto &videoFilter : m_allVideoFilters)
+ {
+ if (m_callback->SupportsScalingMethod(videoFilter.scalingMethod))
+ m_videoFilters.emplace_back(videoFilter);
+ }
}
}
@@ -82,7 +83,7 @@ void CDialogGameVideoFilter::GetItems(CFileItemList &items)
void CDialogGameVideoFilter::OnItemFocus(unsigned int index)
{
- if (index < m_videoFilters.size())
+ if (index < m_videoFilters.size() && m_callback != nullptr)
{
const ESCALINGMETHOD scalingMethod = m_videoFilters[index].scalingMethod;
@@ -91,9 +92,7 @@ void CDialogGameVideoFilter::OnItemFocus(unsigned int index)
{
gameSettings.SetScalingMethod(scalingMethod);
- //! @todo
- CVideoSettings &videoSettings = CMediaSettings::GetInstance().GetCurrentVideoSettings();
- videoSettings.m_ScalingMethod = scalingMethod;
+ m_callback->SetScalingMethod(scalingMethod);
}
}
}
diff --git a/xbmc/games/dialogs/osd/DialogGameVideoSelect.cpp b/xbmc/games/dialogs/osd/DialogGameVideoSelect.cpp
index c9bd1057b2..9d3da07e43 100644
--- a/xbmc/games/dialogs/osd/DialogGameVideoSelect.cpp
+++ b/xbmc/games/dialogs/osd/DialogGameVideoSelect.cpp
@@ -51,6 +51,16 @@ CDialogGameVideoSelect::CDialogGameVideoSelect(int windowId) :
CDialogGameVideoSelect::~CDialogGameVideoSelect() = default;
+void CDialogGameVideoSelect::RegisterCallback(IVideoSelectCallback *callback)
+{
+ m_callback = callback;
+}
+
+void CDialogGameVideoSelect::UnregisterCallback()
+{
+ m_callback = nullptr;
+}
+
bool CDialogGameVideoSelect::OnMessage(CGUIMessage &message)
{
switch (message.GetMessage())
diff --git a/xbmc/games/dialogs/osd/DialogGameVideoSelect.h b/xbmc/games/dialogs/osd/DialogGameVideoSelect.h
index ed01707722..79e199caaa 100644
--- a/xbmc/games/dialogs/osd/DialogGameVideoSelect.h
+++ b/xbmc/games/dialogs/osd/DialogGameVideoSelect.h
@@ -30,11 +30,16 @@ namespace KODI
{
namespace GAME
{
+ class IVideoSelectCallback;
+
class CDialogGameVideoSelect : public CGUIDialog
{
public:
~CDialogGameVideoSelect() override;
+ void RegisterCallback(IVideoSelectCallback *callback);
+ void UnregisterCallback();
+
// implementation of CGUIControl via CGUIDialog
bool OnMessage(CGUIMessage &message) override;
@@ -57,6 +62,9 @@ namespace GAME
virtual unsigned int GetFocusedItem() const = 0;
virtual void PostExit() = 0;
+ protected:
+ IVideoSelectCallback *m_callback = nullptr;
+
private:
void Update();
void Clear();
diff --git a/xbmc/games/dialogs/osd/DialogGameViewMode.cpp b/xbmc/games/dialogs/osd/DialogGameViewMode.cpp
index bf6e201857..eba4696ad5 100644
--- a/xbmc/games/dialogs/osd/DialogGameViewMode.cpp
+++ b/xbmc/games/dialogs/osd/DialogGameViewMode.cpp
@@ -19,13 +19,11 @@
*/
#include "DialogGameViewMode.h"
-#include "cores/IPlayer.h"
+#include "IVideoSelectCallback.h"
#include "guilib/LocalizeStrings.h"
#include "guilib/WindowIDs.h"
#include "settings/GameSettings.h"
#include "settings/MediaSettings.h"
-#include "Application.h"
-#include "ApplicationPlayer.h"
#include "FileItem.h"
using namespace KODI;
@@ -66,7 +64,7 @@ void CDialogGameViewMode::GetItems(CFileItemList &items)
void CDialogGameViewMode::OnItemFocus(unsigned int index)
{
- if (index < viewModes.size())
+ if (index < viewModes.size() && m_callback != nullptr)
{
const ViewMode viewMode = viewModes[index].viewMode;
@@ -75,7 +73,7 @@ void CDialogGameViewMode::OnItemFocus(unsigned int index)
{
gameSettings.SetViewMode(viewMode);
- g_application.m_pPlayer->SetRenderViewMode(viewMode);
+ m_callback->SetRenderViewMode(viewMode);
}
}
}
@@ -96,11 +94,14 @@ unsigned int CDialogGameViewMode::GetFocusedItem() const
bool CDialogGameViewMode::HasViewModes()
{
- if (g_application.m_pPlayer->Supports(RENDERFEATURE_STRETCH))
- return true;
+ if (m_callback != nullptr)
+ {
+ if (m_callback->SupportsRenderFeature(RENDERFEATURE_STRETCH))
+ return true;
- if (g_application.m_pPlayer->Supports(RENDERFEATURE_PIXEL_RATIO))
- return true;
+ if (m_callback->SupportsRenderFeature(RENDERFEATURE_PIXEL_RATIO))
+ return true;
+ }
return false;
}
diff --git a/xbmc/games/dialogs/osd/DialogGameViewMode.h b/xbmc/games/dialogs/osd/DialogGameViewMode.h
index e51685e917..309748c862 100644
--- a/xbmc/games/dialogs/osd/DialogGameViewMode.h
+++ b/xbmc/games/dialogs/osd/DialogGameViewMode.h
@@ -32,7 +32,7 @@ namespace GAME
~CDialogGameViewMode() override = default;
//! @todo
- static bool HasViewModes();
+ bool HasViewModes();
protected:
// implementation of CDialogGameVideoSelect
diff --git a/xbmc/games/dialogs/osd/IVideoSelectCallback.h b/xbmc/games/dialogs/osd/IVideoSelectCallback.h
new file mode 100644
index 0000000000..6714561fcc
--- /dev/null
+++ b/xbmc/games/dialogs/osd/IVideoSelectCallback.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2017 Team Kodi
+ * http://kodi.tv
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this Program; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+#pragma once
+
+#include "cores/IPlayer.h"
+
+namespace KODI
+{
+namespace GAME
+{
+ class IVideoSelectCallback
+ {
+ public:
+ virtual ~IVideoSelectCallback() = default;
+
+ virtual bool SupportsScalingMethod(ESCALINGMETHOD method) = 0;
+ virtual bool SupportsRenderFeature(ERENDERFEATURE feature) = 0;
+ virtual void SetRenderViewMode(ViewMode mode) = 0;
+ virtual void SetScalingMethod(ESCALINGMETHOD scalingMethod) = 0;
+ };
+}
+}