Skip to content

Commit

Permalink
make video renderer non-global
Browse files Browse the repository at this point in the history
  • Loading branch information
FernetMenta authored and popcornmix committed Sep 7, 2015
1 parent 227147c commit 7f31193
Show file tree
Hide file tree
Showing 44 changed files with 733 additions and 1,051 deletions.
10 changes: 0 additions & 10 deletions Kodi.xcodeproj/project.pbxproj
Expand Up @@ -1265,7 +1265,6 @@
DFF0F19117528350002DA3A4 /* DVDMessage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E15780D25F9FA00618676 /* DVDMessage.cpp */; };
DFF0F19217528350002DA3A4 /* DVDMessageQueue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E157A0D25F9FA00618676 /* DVDMessageQueue.cpp */; };
DFF0F19417528350002DA3A4 /* DVDOverlayContainer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E157E0D25F9FA00618676 /* DVDOverlayContainer.cpp */; };
DFF0F19517528350002DA3A4 /* DVDOverlayRenderer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E15800D25F9FA00618676 /* DVDOverlayRenderer.cpp */; };
DFF0F19717528350002DA3A4 /* DVDPlayer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E15840D25F9FA00618676 /* DVDPlayer.cpp */; };
DFF0F19817528350002DA3A4 /* DVDPlayerAudio.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E15860D25F9FA00618676 /* DVDPlayerAudio.cpp */; };
DFF0F19917528350002DA3A4 /* DVDPlayerSubtitle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E15880D25F9FA00618676 /* DVDPlayerSubtitle.cpp */; };
Expand Down Expand Up @@ -2003,7 +2002,6 @@
E38E1FA10D25F9FD00618676 /* DVDMessage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E15780D25F9FA00618676 /* DVDMessage.cpp */; };
E38E1FA20D25F9FD00618676 /* DVDMessageQueue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E157A0D25F9FA00618676 /* DVDMessageQueue.cpp */; };
E38E1FA40D25F9FD00618676 /* DVDOverlayContainer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E157E0D25F9FA00618676 /* DVDOverlayContainer.cpp */; };
E38E1FA50D25F9FD00618676 /* DVDOverlayRenderer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E15800D25F9FA00618676 /* DVDOverlayRenderer.cpp */; };
E38E1FA70D25F9FD00618676 /* DVDPlayer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E15840D25F9FA00618676 /* DVDPlayer.cpp */; };
E38E1FA80D25F9FD00618676 /* DVDPlayerAudio.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E15860D25F9FA00618676 /* DVDPlayerAudio.cpp */; };
E38E1FA90D25F9FD00618676 /* DVDPlayerSubtitle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E15880D25F9FA00618676 /* DVDPlayerSubtitle.cpp */; };
Expand Down Expand Up @@ -2432,7 +2430,6 @@
E49911F9174E5D4500741B6D /* DVDMessage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E15780D25F9FA00618676 /* DVDMessage.cpp */; };
E49911FA174E5D4500741B6D /* DVDMessageQueue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E157A0D25F9FA00618676 /* DVDMessageQueue.cpp */; };
E49911FC174E5D4500741B6D /* DVDOverlayContainer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E157E0D25F9FA00618676 /* DVDOverlayContainer.cpp */; };
E49911FD174E5D4500741B6D /* DVDOverlayRenderer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E15800D25F9FA00618676 /* DVDOverlayRenderer.cpp */; };
E49911FF174E5D4500741B6D /* DVDPlayer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E15840D25F9FA00618676 /* DVDPlayer.cpp */; };
E4991200174E5D4500741B6D /* DVDPlayerAudio.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E15860D25F9FA00618676 /* DVDPlayerAudio.cpp */; };
E4991201174E5D4500741B6D /* DVDPlayerSubtitle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E15880D25F9FA00618676 /* DVDPlayerSubtitle.cpp */; };
Expand Down Expand Up @@ -4967,8 +4964,6 @@
E38E157B0D25F9FA00618676 /* DVDMessageQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DVDMessageQueue.h; sourceTree = "<group>"; };
E38E157E0D25F9FA00618676 /* DVDOverlayContainer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DVDOverlayContainer.cpp; sourceTree = "<group>"; };
E38E157F0D25F9FA00618676 /* DVDOverlayContainer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DVDOverlayContainer.h; sourceTree = "<group>"; };
E38E15800D25F9FA00618676 /* DVDOverlayRenderer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DVDOverlayRenderer.cpp; sourceTree = "<group>"; };
E38E15810D25F9FA00618676 /* DVDOverlayRenderer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DVDOverlayRenderer.h; sourceTree = "<group>"; };
E38E15840D25F9FA00618676 /* DVDPlayer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DVDPlayer.cpp; sourceTree = "<group>"; };
E38E15850D25F9FA00618676 /* DVDPlayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DVDPlayer.h; sourceTree = "<group>"; };
E38E15860D25F9FA00618676 /* DVDPlayerAudio.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DVDPlayerAudio.cpp; sourceTree = "<group>"; };
Expand Down Expand Up @@ -8575,8 +8570,6 @@
E38E157B0D25F9FA00618676 /* DVDMessageQueue.h */,
E38E157E0D25F9FA00618676 /* DVDOverlayContainer.cpp */,
E38E157F0D25F9FA00618676 /* DVDOverlayContainer.h */,
E38E15800D25F9FA00618676 /* DVDOverlayRenderer.cpp */,
E38E15810D25F9FA00618676 /* DVDOverlayRenderer.h */,
E38E15840D25F9FA00618676 /* DVDPlayer.cpp */,
E38E15850D25F9FA00618676 /* DVDPlayer.h */,
E38E15860D25F9FA00618676 /* DVDPlayerAudio.cpp */,
Expand Down Expand Up @@ -10350,7 +10343,6 @@
E38E1FA20D25F9FD00618676 /* DVDMessageQueue.cpp in Sources */,
395C29C11A98A0A000EBC7AD /* Webinterface.cpp in Sources */,
E38E1FA40D25F9FD00618676 /* DVDOverlayContainer.cpp in Sources */,
E38E1FA50D25F9FD00618676 /* DVDOverlayRenderer.cpp in Sources */,
E38E1FA70D25F9FD00618676 /* DVDPlayer.cpp in Sources */,
E38E1FA80D25F9FD00618676 /* DVDPlayerAudio.cpp in Sources */,
E38E1FA90D25F9FD00618676 /* DVDPlayerSubtitle.cpp in Sources */,
Expand Down Expand Up @@ -11522,7 +11514,6 @@
DFF0F19117528350002DA3A4 /* DVDMessage.cpp in Sources */,
DFF0F19217528350002DA3A4 /* DVDMessageQueue.cpp in Sources */,
DFF0F19417528350002DA3A4 /* DVDOverlayContainer.cpp in Sources */,
DFF0F19517528350002DA3A4 /* DVDOverlayRenderer.cpp in Sources */,
DFF0F19717528350002DA3A4 /* DVDPlayer.cpp in Sources */,
DFF0F19817528350002DA3A4 /* DVDPlayerAudio.cpp in Sources */,
DFF0F19917528350002DA3A4 /* DVDPlayerSubtitle.cpp in Sources */,
Expand Down Expand Up @@ -12582,7 +12573,6 @@
E49911FA174E5D4500741B6D /* DVDMessageQueue.cpp in Sources */,
E49911FC174E5D4500741B6D /* DVDOverlayContainer.cpp in Sources */,
DF4A3BB31B4B0FC100F9CDC0 /* ApplicationMessenger.cpp in Sources */,
E49911FD174E5D4500741B6D /* DVDOverlayRenderer.cpp in Sources */,
DF29BCF21B5D911800904347 /* EventLog.cpp in Sources */,
E49911FF174E5D4500741B6D /* DVDPlayer.cpp in Sources */,
E4991200174E5D4500741B6D /* DVDPlayerAudio.cpp in Sources */,
Expand Down
22 changes: 10 additions & 12 deletions xbmc/Application.cpp
Expand Up @@ -116,9 +116,6 @@
#include "filesystem/SFTPFile.h"
#endif
#include "PartyModeManager.h"
#ifdef HAS_VIDEO_PLAYBACK
#include "cores/VideoRenderers/RenderManager.h"
#endif
#ifdef HAS_KARAOKE
#include "music/karaoke/karaokelyricsmanager.h"
#endif
Expand Down Expand Up @@ -1941,7 +1938,7 @@ void CApplication::Render()
m_bPresentFrame = false;
if (!extPlayerActive && g_graphicsContext.IsFullScreenVideo() && !m_pPlayer->IsPausedPlayback())
{
m_bPresentFrame = g_renderManager.HasFrame();
m_bPresentFrame = m_pPlayer->HasFrame();
}
else
{
Expand Down Expand Up @@ -2024,6 +2021,8 @@ void CApplication::Render()
// render video layer
g_windowManager.RenderEx();

m_pPlayer->AfterRender();

g_Windowing.EndRender();

// reset our info cache - we do this at the end of Render so that it is
Expand Down Expand Up @@ -2062,14 +2061,11 @@ void CApplication::Render()

if (!extPlayerActive && g_graphicsContext.IsFullScreenVideo() && !m_pPlayer->IsPausedPlayback())
{
g_renderManager.FrameWait(100);
m_pPlayer->FrameWait(100);
}

m_lastFrameTime = XbmcThreads::SystemClockMillis();
CTimeUtils::UpdateFrameTime(flip, vsync);

g_renderManager.UpdateResolution();
g_renderManager.ManageCaptures();
}

void CApplication::SetStandAlone(bool value)
Expand Down Expand Up @@ -2539,7 +2535,7 @@ void CApplication::OnApplicationMessage(ThreadMessage* pMsg)
break;

case TMSG_RENDERER_FLUSH:
g_renderManager.Flush();
m_pPlayer->FlushRenderer();
break;

case TMSG_HIBERNATE:
Expand Down Expand Up @@ -2848,7 +2844,7 @@ void CApplication::FrameMove(bool processEvents, bool processGUI)
#if defined(TARGET_RASPBERRY_PI) || defined(HAS_IMXVPU)
// This code reduces rendering fps of the GUI layer when playing videos in fullscreen mode
// it makes only sense on architectures with multiple layers
if (m_pPlayer->IsPlayingVideo() && !m_pPlayer->IsPausedPlayback() && g_renderManager.IsVideoLayer())
if (m_pPlayer->IsPlayingVideo() && !m_pPlayer->IsPausedPlayback() && m_pPlayer->IsRenderingVideoLayer())
fps = CSettings::GetInstance().GetInt(CSettings::SETTING_VIDEOPLAYER_LIMITGUIUPDATE);
#endif

Expand All @@ -2866,6 +2862,8 @@ void CApplication::FrameMove(bool processEvents, bool processGUI)
}
g_windowManager.FrameMove();
}

m_pPlayer->FrameMove();
}


Expand Down Expand Up @@ -3582,8 +3580,8 @@ PlayBackRet CApplication::PlayFile(const CFileItem& item, bool bRestart)
#ifdef HAS_VIDEO_PLAYBACK
else if(m_pPlayer->IsPlayingVideo())
{
// if player didn't manange to switch to fullscreen by itself do it here
if (options.fullscreen && g_renderManager.IsConfigured() &&
// if player didn't manage to switch to fullscreen by itself do it here
if (options.fullscreen && m_pPlayer->IsRenderingVideo() &&
g_windowManager.GetActiveWindow() != WINDOW_FULLSCREEN_VIDEO )
SwitchToFullScreen(true);
}
Expand Down
164 changes: 164 additions & 0 deletions xbmc/ApplicationPlayer.cpp
Expand Up @@ -717,3 +717,167 @@ int CApplicationPlayer::GetPlaySpeed() const
{
return m_iPlaySpeed;
}

void CApplicationPlayer::FrameMove()
{
std::shared_ptr<IPlayer> player = GetInternal();
if (player)
player->FrameMove();
}

void CApplicationPlayer::FrameWait(int ms)
{
std::shared_ptr<IPlayer> player = GetInternal();
if (player)
player->FrameWait(ms);
}

bool CApplicationPlayer::HasFrame()
{
std::shared_ptr<IPlayer> player = GetInternal();
if (player)
return player->HasFrame();
else
return false;
}

void CApplicationPlayer::Render(bool clear, uint32_t alpha, bool gui)
{
std::shared_ptr<IPlayer> player = GetInternal();
if (player)
player->Render(clear, alpha, gui);
}

void CApplicationPlayer::AfterRender()
{
std::shared_ptr<IPlayer> player = GetInternal();
if (player)
player->AfterRender();
}

void CApplicationPlayer::FlushRenderer()
{
std::shared_ptr<IPlayer> player = GetInternal();
if (player)
player->FlushRenderer();
}

void CApplicationPlayer::SetRenderViewMode(int mode)
{
std::shared_ptr<IPlayer> player = GetInternal();
if (player)
player->SetRenderViewMode(mode);
}

float CApplicationPlayer::GetRenderAspectRatio()
{
std::shared_ptr<IPlayer> player = GetInternal();
if (player)
return player->GetRenderAspectRatio();
else
return 1.0;
}

RESOLUTION CApplicationPlayer::GetRenderResolution()
{
std::shared_ptr<IPlayer> player = GetInternal();
if (player)
return player->GetRenderResolution();
else
return RES_INVALID;
}

bool CApplicationPlayer::IsRenderingVideo()
{
std::shared_ptr<IPlayer> player = GetInternal();
if (player)
return player->IsRenderingVideo();
else
return false;
}

bool CApplicationPlayer::IsRenderingGuiLayer()
{
std::shared_ptr<IPlayer> player = GetInternal();
if (player)
return player->IsRenderingGuiLayer();
else
return false;
}

bool CApplicationPlayer::IsRenderingVideoLayer()
{
std::shared_ptr<IPlayer> player = GetInternal();
if (player)
return player->IsRenderingVideoLayer();
else
return false;
}

bool CApplicationPlayer::Supports(EDEINTERLACEMODE mode)
{
std::shared_ptr<IPlayer> player = GetInternal();
if (player)
return player->Supports(mode);
else
return false;
}

bool CApplicationPlayer::Supports(EINTERLACEMETHOD method)
{
std::shared_ptr<IPlayer> player = GetInternal();
if (player)
return player->Supports(method);
else
return false;
}

bool CApplicationPlayer::Supports(ESCALINGMETHOD method)
{
std::shared_ptr<IPlayer> player = GetInternal();
if (player)
return player->Supports(method);
else
return false;
}

bool CApplicationPlayer::Supports(ERENDERFEATURE feature)
{
std::shared_ptr<IPlayer> player = GetInternal();
if (player)
return player->Supports(feature);
else
return false;
}

CRenderCapture* CApplicationPlayer::RenderCaptureAlloc()
{
std::shared_ptr<IPlayer> player = GetInternal();
if (player)
return player->RenderCaptureAlloc();
else
return NULL;
}

void CApplicationPlayer::RenderCapture(CRenderCapture* capture, unsigned int width, unsigned int height, int flags)
{
std::shared_ptr<IPlayer> player = GetInternal();
if (player)
player->RenderCapture(capture, width, height, flags);
}

void CApplicationPlayer::RenderCaptureRelease(CRenderCapture* capture)
{
std::shared_ptr<IPlayer> player = GetInternal();
if (player)
player->RenderCaptureRelease(capture);
}

std::string CApplicationPlayer::GetRenderVSyncState()
{
std::shared_ptr<IPlayer> player = GetInternal();
if (player)
return player->GetRenderVSyncState();
else
return "";
}
24 changes: 24 additions & 0 deletions xbmc/ApplicationPlayer.h
Expand Up @@ -22,7 +22,9 @@

#include <memory>
#include "threads/SystemClock.h"
#include "guilib/Resolution.h"
#include "cores/playercorefactory/PlayerCoreFactory.h"
#include "cores/IPlayer.h"

typedef enum
{
Expand All @@ -40,6 +42,7 @@ namespace PVR
class CAction;
class CPlayerOptions;
class CStreamDetails;
class CRenderCapture;

struct SPlayerAudioStreamInfo;
struct SPlayerVideoStreamInfo;
Expand Down Expand Up @@ -78,6 +81,27 @@ class CApplicationPlayer
void ResetPlayer() { m_eCurrentPlayer = EPC_NONE; }
void SetPlaySpeed(int iSpeed, bool bApplicationMuted);

void FrameMove();
void FrameWait(int ms);
bool HasFrame();
void Render(bool clear, uint32_t alpha = 255, bool gui = true);
void AfterRender();
void FlushRenderer();
void SetRenderViewMode(int mode);
float GetRenderAspectRatio();
RESOLUTION GetRenderResolution();
bool IsRenderingVideo();
bool IsRenderingGuiLayer();
bool IsRenderingVideoLayer();
bool Supports(EDEINTERLACEMODE mode);
bool Supports(EINTERLACEMETHOD method);
bool Supports(ESCALINGMETHOD method);
bool Supports(ERENDERFEATURE feature);
CRenderCapture *RenderCaptureAlloc();
void RenderCapture(CRenderCapture* capture, unsigned int width, unsigned int height, int flags);
void RenderCaptureRelease(CRenderCapture* capture);
std::string GetRenderVSyncState();

// proxy calls
void AddSubtitle(const std::string& strSubPath);
bool CanPause();
Expand Down
2 changes: 0 additions & 2 deletions xbmc/SystemGlobals.cpp
Expand Up @@ -18,7 +18,6 @@
*
*/
#include "system.h"
#include "cores/VideoRenderers/RenderManager.h"
#include "cores/DataCacheCore.h"
#include "GUILargeTextureManager.h"
#include "guilib/TextureManager.h"
Expand All @@ -44,7 +43,6 @@
#include "linux/RBP.h"
#endif

CXBMCRenderManager g_renderManager;
CLangCodeExpander g_LangCodeExpander;
CLocalizeStrings g_localizeStrings;
CLocalizeStrings g_localizeStringsTemp;
Expand Down

0 comments on commit 7f31193

Please sign in to comment.