aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xbmc/addons/AddonInstaller.cpp7
-rw-r--r--xbmc/cores/VideoPlayer/VideoRenderers/BaseRenderer.cpp154
-rw-r--r--xbmc/cores/VideoPlayer/VideoRenderers/BaseRenderer.h20
-rw-r--r--xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGL.cpp42
-rw-r--r--xbmc/interfaces/json-rpc/PlayerOperations.cpp29
-rw-r--r--xbmc/interfaces/json-rpc/schema/version.txt2
-rw-r--r--xbmc/platform/win10/filesystem/WinLibraryDirectory.cpp34
7 files changed, 114 insertions, 174 deletions
diff --git a/xbmc/addons/AddonInstaller.cpp b/xbmc/addons/AddonInstaller.cpp
index 0c755bebab..9ce448d61c 100644
--- a/xbmc/addons/AddonInstaller.cpp
+++ b/xbmc/addons/AddonInstaller.cpp
@@ -311,7 +311,7 @@ bool CAddonInstaller::CheckDependencies(const AddonPtr &addon,
const AddonVersion &version = it.requiredVersion;
bool optional = it.optional;
AddonPtr dep;
- bool haveAddon = CServiceBroker::GetAddonMgr().GetAddon(addonID, dep);
+ bool haveAddon = CServiceBroker::GetAddonMgr().GetAddon(addonID, dep, ADDON_UNKNOWN, false);
if ((haveAddon && !dep->MeetsVersion(version)) || (!haveAddon && !optional))
{
// we have it but our version isn't good enough, or we don't have it and we need it
@@ -329,6 +329,11 @@ bool CAddonInstaller::CheckDependencies(const AddonPtr &addon,
}
}
+ // need to enable the dependency
+ if (dep && CServiceBroker::GetAddonMgr().IsAddonDisabled(addonID))
+ if (!CServiceBroker::GetAddonMgr().EnableAddon(addonID))
+ return false;
+
// at this point we have our dep, or the dep is optional (and we don't have it) so check that it's OK as well
//! @todo should we assume that installed deps are OK?
if (dep && std::find(preDeps.begin(), preDeps.end(), dep->ID()) == preDeps.end())
diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/BaseRenderer.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/BaseRenderer.cpp
index 37c5a5df60..ae6a1ee347 100644
--- a/xbmc/cores/VideoPlayer/VideoRenderers/BaseRenderer.cpp
+++ b/xbmc/cores/VideoPlayer/VideoRenderers/BaseRenderer.cpp
@@ -25,16 +25,7 @@
CBaseRenderer::CBaseRenderer()
{
- m_sourceFrameRatio = 1.0f;
- m_sourceWidth = 720;
- m_sourceHeight = 480;
- m_fps = 0.0f;
- m_renderOrientation = 0;
- m_oldRenderOrientation = 0;
- m_oldDestRect.SetRect(0.0f, 0.0f, 0.0f, 0.0f);
- m_iFlags = 0;
-
- for(int i=0; i < 4; i++)
+ for (int i=0; i < 4; i++)
{
m_rotatedDestCoords[i].x = 0;
m_rotatedDestCoords[i].y = 0;
@@ -66,23 +57,8 @@ inline void CBaseRenderer::ReorderDrawPoints()
{m_destRect.x2, m_destRect.y1},
{m_destRect.x2, m_destRect.y2},
{m_destRect.x1, m_destRect.y2}};
- bool changeAspect = false;
- int pointOffset = 0;
- switch (m_renderOrientation)
- {
- case 90:
- pointOffset = 1;
- changeAspect = true;
- break;
- case 180:
- pointOffset = 2;
- break;
- case 270:
- pointOffset = 3;
- changeAspect = true;
- break;
- }
+ int pointOffset = m_renderOrientation / 90;
// if renderer doesn't support rotation
// treat orientation as 0 degree so that
@@ -90,53 +66,6 @@ inline void CBaseRenderer::ReorderDrawPoints()
if (!Supports(RENDERFEATURE_ROTATION))
{
pointOffset = 0;
- changeAspect = false;
- }
-
-
- float diffX = 0.0f;
- float diffY = 0.0f;
- float centerX = 0.0f;
- float centerY = 0.0f;
-
- if (changeAspect)// we are either rotating by 90 or 270 degrees which inverts aspect ratio
- {
- float newWidth = m_destRect.Height(); // new width is old height
- float newHeight = m_destRect.Width(); // new height is old width
- float diffWidth = newWidth - m_destRect.Width(); // difference between old and new width
- float diffHeight = newHeight - m_destRect.Height(); // difference between old and new height
-
- // if the new width is bigger then the old or
- // the new height is bigger then the old - we need to scale down
- if (diffWidth > 0.0f || diffHeight > 0.0f)
- {
- float aspectRatio = GetAspectRatio();
- // scale to fit screen width because
- // the difference in width is bigger then the
- // difference in height
- if (diffWidth > diffHeight)
- {
- newWidth = m_destRect.Width(); // clamp to the width of the old dest rect
- newHeight *= aspectRatio;
- }
- else // scale to fit screen height
- {
- newHeight = m_destRect.Height(); // clamp to the height of the old dest rect
- newWidth /= aspectRatio;
- }
- }
-
- // calculate the center point of the view
- centerX = m_viewRect.x1 + m_viewRect.Width() / 2.0f;
- centerY = m_viewRect.y1 + m_viewRect.Height() / 2.0f;
-
- // calculate the number of pixels we need to go in each
- // x direction from the center point
- diffX = newWidth / 2;
- // calculate the number of pixels we need to go in each
- // y direction from the center point
- diffY = newHeight / 2;
-
}
for (int destIdx=0, srcIdx=pointOffset; destIdx < 4; destIdx++)
@@ -144,28 +73,6 @@ inline void CBaseRenderer::ReorderDrawPoints()
m_rotatedDestCoords[destIdx].x = origMat[srcIdx][0];
m_rotatedDestCoords[destIdx].y = origMat[srcIdx][1];
- if (changeAspect)
- {
- switch (srcIdx)
- {
- case 0:// top left
- m_rotatedDestCoords[destIdx].x = centerX - diffX;
- m_rotatedDestCoords[destIdx].y = centerY - diffY;
- break;
- case 1:// top right
- m_rotatedDestCoords[destIdx].x = centerX + diffX;
- m_rotatedDestCoords[destIdx].y = centerY - diffY;
- break;
- case 2:// bottom right
- m_rotatedDestCoords[destIdx].x = centerX + diffX;
- m_rotatedDestCoords[destIdx].y = centerY + diffY;
- break;
- case 3:// bottom left
- m_rotatedDestCoords[destIdx].x = centerX - diffX;
- m_rotatedDestCoords[destIdx].y = centerY + diffY;
- break;
- }
- }
srcIdx++;
srcIdx = srcIdx % 4;
}
@@ -199,7 +106,7 @@ void CBaseRenderer::CalcNormalRenderRect(float offsetX, float offsetY, float wid
float inputFrameRatio, float zoomAmount, float verticalShift)
{
// if view window is empty, set empty destination
- if(height == 0 || width == 0)
+ if (height == 0 || width == 0)
{
m_destRect.SetRect(0.0f, 0.0f, 0.0f, 0.0f);
return;
@@ -214,20 +121,43 @@ void CBaseRenderer::CalcNormalRenderRect(float offsetX, float offsetY, float wid
// allow a certain error to maximize size of render area
float fCorrection = width / height / outputFrameRatio - 1.0f;
- float fAllowed = CServiceBroker::GetSettings().GetInt(CSettings::SETTING_VIDEOPLAYER_ERRORINASPECT) * 0.01f;
- if(fCorrection > fAllowed) fCorrection = fAllowed;
- if(fCorrection < - fAllowed) fCorrection = - fAllowed;
+ float fAllowed = CServiceBroker::GetSettings().GetInt(CSettings::SETTING_VIDEOPLAYER_ERRORINASPECT) * 0.01f;
+ if (fCorrection > fAllowed)
+ fCorrection = fAllowed;
+ if (fCorrection < -fAllowed)
+ fCorrection = - fAllowed;
outputFrameRatio *= 1.0f + fCorrection;
- // maximize the movie width
- float newWidth = width;
- float newHeight = newWidth / outputFrameRatio;
+ bool isRotated = false;
+ if (m_renderOrientation == 90 ||
+ m_renderOrientation == 270)
+ isRotated = true;
- if (newHeight > height)
+ float newWidth;
+ float newHeight;
+
+ if (!isRotated)
{
- newHeight = height;
- newWidth = newHeight * outputFrameRatio;
+ // maximize the movie width
+ newWidth = width;
+ newHeight = newWidth / outputFrameRatio;
+ if (newHeight > height)
+ {
+ newHeight = height;
+ newWidth = newHeight * outputFrameRatio;
+ }
+ }
+ else
+ {
+ // maximize the movie hight
+ newHeight = std::min(width, height);
+ newWidth = newHeight / outputFrameRatio;
+ if (newWidth > width)
+ {
+ newWidth = std::min(width, height);
+ newHeight = newWidth * outputFrameRatio;
+ }
}
// Scale the movie up by set zoom amount
@@ -279,14 +209,7 @@ void CBaseRenderer::CalcNormalRenderRect(float offsetX, float offsetY, float wid
}
}
- if (m_oldDestRect != m_destRect || m_oldRenderOrientation != m_renderOrientation)
- {
- // adapt the drawing rect points if we have to rotate
- // and either destrect or orientation changed
- ReorderDrawPoints();
- m_oldDestRect = m_destRect;
- m_oldRenderOrientation = m_renderOrientation;
- }
+ ReorderDrawPoints();
}
//***************************************************************************************
@@ -394,7 +317,10 @@ void CBaseRenderer::ManageRenderArea()
break;
}
- CalcNormalRenderRect(m_viewRect.x1, m_viewRect.y1, m_viewRect.Width(), m_viewRect.Height(), GetAspectRatio() * CDisplaySettings::GetInstance().GetPixelRatio(), CDisplaySettings::GetInstance().GetZoomAmount(), CDisplaySettings::GetInstance().GetVerticalShift());
+ CalcNormalRenderRect(m_viewRect.x1, m_viewRect.y1, m_viewRect.Width(), m_viewRect.Height(),
+ GetAspectRatio() * CDisplaySettings::GetInstance().GetPixelRatio(),
+ CDisplaySettings::GetInstance().GetZoomAmount(),
+ CDisplaySettings::GetInstance().GetVerticalShift());
}
EShaderFormat CBaseRenderer::GetShaderFormat()
diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/BaseRenderer.h b/xbmc/cores/VideoPlayer/VideoRenderers/BaseRenderer.h
index 451d182e6f..253f0af55d 100644
--- a/xbmc/cores/VideoPlayer/VideoRenderers/BaseRenderer.h
+++ b/xbmc/cores/VideoPlayer/VideoRenderers/BaseRenderer.h
@@ -94,20 +94,21 @@ protected:
float inputFrameRatio, float zoomAmount, float verticalShift);
void CalculateFrameAspectRatio(unsigned int desired_width, unsigned int desired_height);
virtual void ManageRenderArea();
- virtual void ReorderDrawPoints();//might be overwritten (by egl e.x.)
+ virtual void ReorderDrawPoints();
virtual EShaderFormat GetShaderFormat();
+ void MarkDirty();
+
+ //@todo drop those
void saveRotatedCoords();//saves the current state of m_rotatedDestCoords
void syncDestRectToRotatedPoints();//sync any changes of m_destRect to m_rotatedDestCoords
void restoreRotatedCoords();//restore the current state of m_rotatedDestCoords from saveRotatedCoords
- void MarkDirty();
- unsigned int m_sourceWidth;
- unsigned int m_sourceHeight;
- float m_sourceFrameRatio;
- float m_fps;
+ unsigned int m_sourceWidth = 720;
+ unsigned int m_sourceHeight = 480;
+ float m_sourceFrameRatio = 1.0f;
+ float m_fps = 0.0f;
- unsigned int m_renderOrientation; // orientation of the video in degrees counter clockwise
- unsigned int m_oldRenderOrientation; // orientation of the previous frame
+ unsigned int m_renderOrientation = 0; // orientation of the video in degrees counter clockwise
// for drawing the texture with glVertex4f (holds all 4 corner points of the destination rect
// with correct orientation based on m_renderOrientation
// 0 - top left, 1 - top right, 2 - bottom right, 3 - bottom left
@@ -115,12 +116,11 @@ protected:
CPoint m_savedRotatedDestCoords[4];//saved points from saveRotatedCoords call
CRect m_destRect;
- CRect m_oldDestRect; // destrect of the previous frame
CRect m_sourceRect;
CRect m_viewRect;
// rendering flags
- unsigned m_iFlags;
+ unsigned m_iFlags = 0;
AVPixelFormat m_format = AV_PIX_FMT_NONE;
CVideoSettings m_videoSettings;
diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGL.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGL.cpp
index d7ea04ee29..1440bde494 100644
--- a/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGL.cpp
+++ b/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGL.cpp
@@ -557,7 +557,7 @@ void CLinuxRendererGL::DrawBlackBars()
glUniform4f(uniCol, m_clearColour / 255.0f, m_clearColour / 255.0f, m_clearColour / 255.0f, 1.0f);
//top quad
- if (m_rotatedDestCoords[0].y > 0.0)
+ if (m_destRect.y1 > 0.0)
{
GLubyte quad = count;
vertices[quad].x = 0.0;
@@ -567,25 +567,25 @@ void CLinuxRendererGL::DrawBlackBars()
vertices[quad+1].y = 0;
vertices[quad+1].z = 0;
vertices[quad+2].x = m_viewRect.Width();
- vertices[quad+2].y = m_rotatedDestCoords[0].y;
+ vertices[quad+2].y = m_destRect.y1;
vertices[quad+2].z = 0;
vertices[quad+3] = vertices[quad+2];
vertices[quad+4].x = 0;
- vertices[quad+4].y = m_rotatedDestCoords[0].y;
+ vertices[quad+4].y = m_destRect.y1;
vertices[quad+4].z = 0;
vertices[quad+5] = vertices[quad];
count += 6;
}
// bottom quad
- if (m_rotatedDestCoords[2].y < m_viewRect.Height())
+ if (m_destRect.y2 < m_viewRect.Height())
{
GLubyte quad = count;
vertices[quad].x = 0.0;
- vertices[quad].y = m_rotatedDestCoords[2].y;
+ vertices[quad].y = m_destRect.y2;
vertices[quad].z = 0;
vertices[quad+1].x = m_viewRect.Width();
- vertices[quad+1].y = m_rotatedDestCoords[2].y;
+ vertices[quad+1].y = m_destRect.y2;
vertices[quad+1].z = 0;
vertices[quad+2].x = m_viewRect.Width();
vertices[quad+2].y = m_viewRect.Height();
@@ -599,42 +599,42 @@ void CLinuxRendererGL::DrawBlackBars()
}
// left quad
- if (m_rotatedDestCoords[0].x > 0.0)
+ if (m_destRect.x1 > 0.0)
{
GLubyte quad = count;
vertices[quad].x = 0.0;
- vertices[quad].y = m_rotatedDestCoords[0].y;
+ vertices[quad].y = m_destRect.y1;
vertices[quad].z = 0;
- vertices[quad+1].x = m_rotatedDestCoords[0].x;
- vertices[quad+1].y = m_rotatedDestCoords[0].y;
+ vertices[quad+1].x = m_destRect.x1;
+ vertices[quad+1].y = m_destRect.y1;
vertices[quad+1].z = 0;
- vertices[quad+2].x = m_rotatedDestCoords[3].x;
- vertices[quad+2].y = m_rotatedDestCoords[3].y;
+ vertices[quad+2].x = m_destRect.x1;
+ vertices[quad+2].y = m_destRect.y2;
vertices[quad+2].z = 0;
vertices[quad+3] = vertices[quad+2];
vertices[quad+4].x = 0;
- vertices[quad+4].y = m_rotatedDestCoords[3].y;
+ vertices[quad+4].y = m_destRect.y2;
vertices[quad+4].z = 0;
vertices[quad+5] = vertices[quad];
count += 6;
}
- //right quad
- if (m_rotatedDestCoords[2].x < m_viewRect.Width())
+ // right quad
+ if (m_destRect.x2 < m_viewRect.Width())
{
GLubyte quad = count;
- vertices[quad].x = m_rotatedDestCoords[1].x;
- vertices[quad].y = m_rotatedDestCoords[1].y;
+ vertices[quad].x = m_destRect.x2;
+ vertices[quad].y = m_destRect.y1;
vertices[quad].z = 0;
vertices[quad+1].x = m_viewRect.Width();
- vertices[quad+1].y = m_rotatedDestCoords[1].y;
+ vertices[quad+1].y = m_destRect.y1;
vertices[quad+1].z = 0;
vertices[quad+2].x = m_viewRect.Width();
- vertices[quad+2].y = m_rotatedDestCoords[2].y;
+ vertices[quad+2].y = m_destRect.y2;
vertices[quad+2].z = 0;
vertices[quad+3] = vertices[quad+2];
- vertices[quad+4].x = m_rotatedDestCoords[1].x;
- vertices[quad+4].y = m_rotatedDestCoords[2].y;
+ vertices[quad+4].x = m_destRect.x2;
+ vertices[quad+4].y = m_destRect.y2;
vertices[quad+4].z = 0;
vertices[quad+5] = vertices[quad];
count += 6;
diff --git a/xbmc/interfaces/json-rpc/PlayerOperations.cpp b/xbmc/interfaces/json-rpc/PlayerOperations.cpp
index a12eca3d44..1ba4dedb12 100644
--- a/xbmc/interfaces/json-rpc/PlayerOperations.cpp
+++ b/xbmc/interfaces/json-rpc/PlayerOperations.cpp
@@ -23,6 +23,7 @@
#include "GUIInfoManager.h"
#include "music/MusicDatabase.h"
#include "pvr/PVRManager.h"
+#include "pvr/PVRGUIActions.h"
#include "pvr/channels/PVRChannel.h"
#include "pvr/channels/PVRChannelGroupsContainer.h"
#include "pvr/epg/EpgInfoTag.h"
@@ -557,39 +558,31 @@ JSONRPC_STATUS CPlayerOperations::Open(const std::string &method, ITransportLaye
}
else if (parameterObject["item"].isMember("channelid"))
{
- if (!CServiceBroker::GetPVRManager().IsStarted())
- return FailedToExecute;
-
- CPVRChannelGroupsContainerPtr channelGroupContainer = CServiceBroker::GetPVRManager().ChannelGroups();
+ const CPVRChannelGroupsContainerPtr channelGroupContainer = CServiceBroker::GetPVRManager().ChannelGroups();
if (!channelGroupContainer)
return FailedToExecute;
- CPVRChannelPtr channel = channelGroupContainer->GetChannelById((int)parameterObject["item"]["channelid"].asInteger());
- if (channel == NULL)
+ const CPVRChannelPtr channel = channelGroupContainer->GetChannelById(static_cast<int>(parameterObject["item"]["channelid"].asInteger()));
+ if (!channel)
return InvalidParams;
- CFileItemList *l = new CFileItemList; //don't delete,
- l->Add(std::make_shared<CFileItem>(channel));
- CApplicationMessenger::GetInstance().PostMsg(TMSG_MEDIA_PLAY, -1, -1, static_cast<void*>(l));
+ if (!CServiceBroker::GetPVRManager().GUIActions()->PlayMedia(std::make_shared<CFileItem>(channel)))
+ return FailedToExecute;
return ACK;
}
else if (parameterObject["item"].isMember("recordingid"))
{
- if (!CServiceBroker::GetPVRManager().IsStarted())
- return FailedToExecute;
-
- CPVRRecordingsPtr recordingsContainer = CServiceBroker::GetPVRManager().Recordings();
+ const CPVRRecordingsPtr recordingsContainer = CServiceBroker::GetPVRManager().Recordings();
if (!recordingsContainer)
return FailedToExecute;
- CFileItemPtr fileItem = recordingsContainer->GetById((int)parameterObject["item"]["recordingid"].asInteger());
- if (fileItem == NULL)
+ const CFileItemPtr fileItem = recordingsContainer->GetById(static_cast<int>(parameterObject["item"]["recordingid"].asInteger()));
+ if (!fileItem)
return InvalidParams;
- CFileItemList *l = new CFileItemList; //don't delete,
- l->Add(std::make_shared<CFileItem>(*fileItem));
- CApplicationMessenger::GetInstance().PostMsg(TMSG_MEDIA_PLAY, -1, -1, static_cast<void*>(l));
+ if (!CServiceBroker::GetPVRManager().GUIActions()->PlayMedia(fileItem))
+ return FailedToExecute;
return ACK;
}
diff --git a/xbmc/interfaces/json-rpc/schema/version.txt b/xbmc/interfaces/json-rpc/schema/version.txt
index cc75305c10..d611b57a60 100644
--- a/xbmc/interfaces/json-rpc/schema/version.txt
+++ b/xbmc/interfaces/json-rpc/schema/version.txt
@@ -1 +1 @@
-JSONRPC_VERSION 9.5.1
+JSONRPC_VERSION 9.5.2
diff --git a/xbmc/platform/win10/filesystem/WinLibraryDirectory.cpp b/xbmc/platform/win10/filesystem/WinLibraryDirectory.cpp
index b9dca7c208..969d91193c 100644
--- a/xbmc/platform/win10/filesystem/WinLibraryDirectory.cpp
+++ b/xbmc/platform/win10/filesystem/WinLibraryDirectory.cpp
@@ -233,23 +233,39 @@ int CWinLibraryDirectory::StatDirectory(const CURL& url, struct __stat64* statDa
/* set st_ino */
statData->st_ino = 0; // inode number is not implemented on Win32
+ statData->st_atime = 0;
+ statData->st_ctime = 0;
+ statData->st_mtime = 0;
+
auto requestedProps = Wait(dir.Properties().RetrievePropertiesAsync(
{L"System.DateAccessed", L"System.DateCreated", L"System.DateModified"}));
- auto dateAccessed = requestedProps.Lookup(L"System.DateAccessed").as<winrt::IPropertyValue>();
- if (dateAccessed)
+ if (requestedProps.HasKey(L"System.DateAccessed") &&
+ requestedProps.Lookup(L"System.DateAccessed"))
{
- statData->st_atime = winrt::clock::to_time_t(dateAccessed.GetDateTime());
+ auto dateAccessed = requestedProps.Lookup(L"System.DateAccessed").as<winrt::IPropertyValue>();
+ if (dateAccessed)
+ {
+ statData->st_atime = winrt::clock::to_time_t(dateAccessed.GetDateTime());
+ }
}
- auto dateCreated = requestedProps.Lookup(L"System.DateCreated").as<winrt::IPropertyValue>();
- if (dateCreated)
+ if (requestedProps.HasKey(L"System.DateCreated") &&
+ requestedProps.Lookup(L"System.DateCreated"))
{
- statData->st_ctime = winrt::clock::to_time_t(dateCreated.GetDateTime());
+ auto dateCreated = requestedProps.Lookup(L"System.DateCreated").as<winrt::IPropertyValue>();
+ if (dateCreated)
+ {
+ statData->st_ctime = winrt::clock::to_time_t(dateCreated.GetDateTime());
+ }
}
- auto dateModified = requestedProps.Lookup(L"System.DateModified").as<winrt::IPropertyValue>();
- if (dateModified)
+ if (requestedProps.HasKey(L"System.DateModified") &&
+ requestedProps.Lookup(L"System.DateModified"))
{
- statData->st_mtime = winrt::clock::to_time_t(dateModified.GetDateTime());
+ auto dateModified = requestedProps.Lookup(L"System.DateModified").as<winrt::IPropertyValue>();
+ if (dateModified)
+ {
+ statData->st_mtime = winrt::clock::to_time_t(dateModified.GetDateTime());
+ }
}
statData->st_dev = 0;