[videodb] remove unused seasons table from episode_view
[xbmc.git] / xbmc / cores / VideoPlayer / VideoRenderers / HwDecRender / RendererStarfish.cpp
blob26eb1e021b252c80e56fd8c7803373362ef08bba
1 /*
2 * Copyright (C) 2023 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
9 #include "RendererStarfish.h"
11 #include "../RenderFactory.h"
12 #include "DVDCodecs/Video/DVDVideoCodecStarfish.h"
13 #include "ServiceBroker.h"
14 #include "rendering/gles/RenderSystemGLES.h"
15 #include "settings/MediaSettings.h"
16 #include "utils/log.h"
17 #include "windowing/wayland/WinSystemWaylandWebOS.h"
19 #include <appswitching-control-block/AcbAPI.h>
21 CRendererStarfish::CRendererStarfish()
23 CLog::LogF(LOGINFO, "CRendererStarfish: Instanced");
26 CRendererStarfish::~CRendererStarfish() = default;
28 CBaseRenderer* CRendererStarfish::Create(CVideoBuffer* buffer)
30 if (buffer && dynamic_cast<CStarfishVideoBuffer*>(buffer))
31 return new CRendererStarfish();
32 return nullptr;
35 bool CRendererStarfish::Configure(const VideoPicture& picture, float fps, unsigned int orientation)
37 auto buffer = static_cast<CStarfishVideoBuffer*>(picture.videoBuffer);
38 m_acbId = buffer->m_acbId;
39 if (m_acbId)
41 EnableAlwaysClip();
43 m_iFlags = GetFlagsChromaPosition(picture.chroma_position) |
44 GetFlagsColorMatrix(picture.color_space, picture.iWidth, picture.iHeight) |
45 GetFlagsColorPrimaries(picture.color_primaries) |
46 GetFlagsStereoMode(picture.stereoMode);
48 m_format = picture.videoBuffer->GetFormat();
49 m_sourceWidth = picture.iWidth;
50 m_sourceHeight = picture.iHeight;
51 m_renderOrientation = orientation;
53 // Calculate the input frame aspect ratio.
54 CalculateFrameAspectRatio(picture.iDisplayWidth, picture.iDisplayHeight);
55 SetViewMode(m_videoSettings.m_ViewMode);
56 ManageRenderArea();
58 m_configured = true;
60 return true;
63 bool CRendererStarfish::IsConfigured()
65 return m_configured;
68 bool CRendererStarfish::ConfigChanged(const VideoPicture& picture)
70 if (picture.videoBuffer->GetFormat() != m_format)
72 return true;
75 return false;
78 bool CRendererStarfish::Register()
80 VIDEOPLAYER::CRendererFactory::RegisterRenderer("starfish", CRendererStarfish::Create);
81 return true;
84 void CRendererStarfish::ManageRenderArea()
86 // this hack is needed to get the 2D mode of a 3D movie going
87 RENDER_STEREO_MODE stereoMode = CServiceBroker::GetWinSystem()->GetGfxContext().GetStereoMode();
88 if (stereoMode == RENDER_STEREO_MODE_MONO)
89 CServiceBroker::GetWinSystem()->GetGfxContext().SetStereoView(RENDER_STEREO_VIEW_LEFT);
91 CBaseRenderer::ManageRenderArea();
93 if (stereoMode == RENDER_STEREO_MODE_MONO)
94 CServiceBroker::GetWinSystem()->GetGfxContext().SetStereoView(RENDER_STEREO_VIEW_OFF);
96 switch (stereoMode)
98 case RENDER_STEREO_MODE_SPLIT_HORIZONTAL:
99 m_destRect.y2 *= 2.0f;
100 break;
101 case RENDER_STEREO_MODE_SPLIT_VERTICAL:
102 m_destRect.x2 *= 2.0f;
103 break;
104 default:
105 break;
108 if ((m_exportedDestRect != m_destRect || m_exportedSourceRect != m_sourceRect) &&
109 !m_sourceRect.IsEmpty() && !m_destRect.IsEmpty())
111 auto origRect =
112 CRect{0, 0, static_cast<float>(m_sourceWidth), static_cast<float>(m_sourceHeight)};
113 using namespace KODI::WINDOWING::WAYLAND;
114 auto winSystem = static_cast<CWinSystemWaylandWebOS*>(CServiceBroker::GetWinSystem());
115 if (winSystem->SupportsExportedWindow())
117 winSystem->SetExportedWindow(origRect, m_sourceRect, m_destRect);
119 else if (m_acbId)
121 AcbAPI_setCustomDisplayWindow(m_acbId, m_sourceRect.x1, m_sourceRect.y1, m_sourceRect.Width(),
122 m_sourceRect.Height(), m_destRect.x1, m_destRect.y1,
123 m_destRect.Width(), m_destRect.Height(), false, nullptr);
125 m_exportedSourceRect = m_sourceRect;
126 m_exportedDestRect = m_destRect;
130 bool CRendererStarfish::Supports(ERENDERFEATURE feature) const
132 return (feature == RENDERFEATURE_ZOOM || feature == RENDERFEATURE_STRETCH ||
133 feature == RENDERFEATURE_PIXEL_RATIO || feature == RENDERFEATURE_VERTICAL_SHIFT ||
134 feature == RENDERFEATURE_ROTATION);
137 bool CRendererStarfish::Supports(ESCALINGMETHOD method) const
139 return false;
142 bool CRendererStarfish::SupportsMultiPassRendering()
144 return false;
147 void CRendererStarfish::AddVideoPicture(const VideoPicture& picture, int index)
151 void CRendererStarfish::ReleaseBuffer(int idx)
155 CRenderInfo CRendererStarfish::GetRenderInfo()
157 CRenderInfo info;
158 info.max_buffer_size = 4;
159 return info;
162 bool CRendererStarfish::IsGuiLayer()
164 return false;
167 bool CRendererStarfish::RenderCapture(int index, CRenderCapture* capture)
169 return false;
172 void CRendererStarfish::UnInit()
174 m_configured = false;
177 void CRendererStarfish::Update()
179 if (!m_configured)
181 return;
185 void CRendererStarfish::RenderUpdate(
186 int index, int index2, bool clear, unsigned int flags, unsigned int alpha)
188 if (!m_configured)
190 return;
193 ManageRenderArea();