diff options
author | Joakim Plate <elupus@ecce.se> | 2013-06-10 22:18:46 +0200 |
---|---|---|
committer | Joakim Plate <elupus@ecce.se> | 2013-08-01 16:55:47 +0200 |
commit | 039c7b693f2612f5ffea045471532ceb419bda87 (patch) | |
tree | b3de9a28362c185195c4043a4ae1fb26e1959202 | |
parent | 14d3c2d25d8c5b5c5d0ffd3567a97ee5f2698cb6 (diff) |
dvdplayer: factor out render flags from player
-rw-r--r-- | XBMC.xcodeproj/project.pbxproj | 6 | ||||
-rw-r--r-- | project/VS2010Express/XBMC.vcxproj | 2 | ||||
-rw-r--r-- | project/VS2010Express/XBMC.vcxproj.filters | 6 | ||||
-rw-r--r-- | xbmc/cores/VideoRenderers/Makefile.in | 1 | ||||
-rw-r--r-- | xbmc/cores/VideoRenderers/RenderFlags.cpp | 86 | ||||
-rw-r--r-- | xbmc/cores/VideoRenderers/RenderFlags.h | 13 | ||||
-rw-r--r-- | xbmc/cores/dvdplayer/DVDPlayerVideo.cpp | 59 |
7 files changed, 115 insertions, 58 deletions
diff --git a/XBMC.xcodeproj/project.pbxproj b/XBMC.xcodeproj/project.pbxproj index caae0ef9b1..f601859c1a 100644 --- a/XBMC.xcodeproj/project.pbxproj +++ b/XBMC.xcodeproj/project.pbxproj @@ -246,6 +246,7 @@ 5538432B15F3646C00CE061B /* NptPosixTime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5538432A15F3646C00CE061B /* NptPosixTime.cpp */; settings = {COMPILER_FLAGS = "-I$SRCROOT/lib/libUPnP/Platinum/Source/Core -I$SRCROOT/lib/libUPnP/Platinum/Source/Platinum -I$SRCROOT/lib/libUPnP/Platinum/Source/Devices/MediaConnect -I$SRCROOT/lib/libUPnP/Platinum/Source/Devices/MediaRenderer -I$SRCROOT/lib/libUPnP/Platinum/Source/Devices/MediaServer -I$SRCROOT/lib/libUPnP/Platinum/Source/Extras -I$SRCROOT/lib/libUPnP/Neptune/Source/System/Posix -I$SRCROOT/lib/libUPnP/Neptune/Source/Core"; }; }; 5538433115F3678900CE061B /* NptCocoaEnviroment.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5538432D15F3678900CE061B /* NptCocoaEnviroment.mm */; settings = {COMPILER_FLAGS = "-I$SRCROOT/lib/libUPnP/Platinum/Source/Core -I$SRCROOT/lib/libUPnP/Platinum/Source/Platinum -I$SRCROOT/lib/libUPnP/Platinum/Source/Devices/MediaConnect -I$SRCROOT/lib/libUPnP/Platinum/Source/Devices/MediaRenderer -I$SRCROOT/lib/libUPnP/Platinum/Source/Devices/MediaServer -I$SRCROOT/lib/libUPnP/Platinum/Source/Extras -I$SRCROOT/lib/libUPnP/Neptune/Source/System/Posix -I$SRCROOT/lib/libUPnP/Neptune/Source/Core"; }; }; 5538433415F3685C00CE061B /* NptAppleAutoreleasePool.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5538433315F3685C00CE061B /* NptAppleAutoreleasePool.mm */; settings = {COMPILER_FLAGS = "-I$SRCROOT/lib/libUPnP/Platinum/Source/Core -I$SRCROOT/lib/libUPnP/Platinum/Source/Platinum -I$SRCROOT/lib/libUPnP/Platinum/Source/Devices/MediaConnect -I$SRCROOT/lib/libUPnP/Platinum/Source/Devices/MediaRenderer -I$SRCROOT/lib/libUPnP/Platinum/Source/Devices/MediaServer -I$SRCROOT/lib/libUPnP/Platinum/Source/Extras -I$SRCROOT/lib/libUPnP/Neptune/Source/System/Posix -I$SRCROOT/lib/libUPnP/Neptune/Source/Core"; }; }; + 55611BA31766672F00754072 /* RenderFlags.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 55611BA21766672F00754072 /* RenderFlags.cpp */; }; 7C0B98A4154B79C30065A238 /* AEDeviceInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C0B98A1154B79C30065A238 /* AEDeviceInfo.cpp */; }; 7C1A492315A962EE004AF4A4 /* SeekHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C1A492115A962EE004AF4A4 /* SeekHandler.cpp */; }; 7C1A85661520522500C63311 /* TextureCacheJob.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C1A85631520522500C63311 /* TextureCacheJob.cpp */; }; @@ -3640,6 +3641,8 @@ 5538432A15F3646C00CE061B /* NptPosixTime.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = NptPosixTime.cpp; path = lib/libUPnP/Neptune/Source/System/Posix/NptPosixTime.cpp; sourceTree = SOURCE_ROOT; }; 5538432D15F3678900CE061B /* NptCocoaEnviroment.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = NptCocoaEnviroment.mm; path = lib/libUPnP/Neptune/Source/System/Cocoa/NptCocoaEnviroment.mm; sourceTree = SOURCE_ROOT; }; 5538433315F3685C00CE061B /* NptAppleAutoreleasePool.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = NptAppleAutoreleasePool.mm; path = lib/libUPnP/Neptune/Source/System/Apple/NptAppleAutoreleasePool.mm; sourceTree = SOURCE_ROOT; }; + 55611BA21766672F00754072 /* RenderFlags.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderFlags.cpp; sourceTree = "<group>"; }; + 55611BA41766679200754072 /* RenderFlags.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderFlags.h; sourceTree = "<group>"; }; 6E2FACD20E26E92800DF79EA /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; 6E97BDBF0DA2B620003A2A89 /* EventClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EventClient.h; sourceTree = "<group>"; }; 6E97BDC00DA2B620003A2A89 /* EventPacket.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EventPacket.h; sourceTree = "<group>"; }; @@ -7664,6 +7667,8 @@ 431AE5D8109C1A63007428C3 /* OverlayRendererUtil.h */, F56579AD13060D1E0085ED7F /* RenderCapture.cpp */, F56579AE13060D1E0085ED7F /* RenderCapture.h */, + 55611BA21766672F00754072 /* RenderFlags.cpp */, + 55611BA41766679200754072 /* RenderFlags.h */, E38E16650D25F9FA00618676 /* RenderManager.cpp */, E38E16660D25F9FA00618676 /* RenderManager.h */, E38E16740D25F9FA00618676 /* WinRenderer.h */, @@ -10562,6 +10567,7 @@ DF40BC2F178B4C07009DB567 /* LanguageInvokerThread.cpp in Sources */, DF40BC31178B4C07009DB567 /* ScriptInvocationManager.cpp in Sources */, DFBB430A178B574E006CC20A /* AddonCallbacksCodec.cpp in Sources */, + 55611BA31766672F00754072 /* RenderFlags.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/project/VS2010Express/XBMC.vcxproj b/project/VS2010Express/XBMC.vcxproj index e06fb25bdc..eaee036940 100644 --- a/project/VS2010Express/XBMC.vcxproj +++ b/project/VS2010Express/XBMC.vcxproj @@ -1910,6 +1910,7 @@ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release (DirectX)|Win32'">true</ExcludedFromBuild> </ClCompile> <ClCompile Include="..\..\xbmc\cores\VideoRenderers\OverlayRendererUtil.cpp" /> + <ClCompile Include="..\..\xbmc\cores\VideoRenderers\RenderFlags.cpp" /> <ClCompile Include="..\..\xbmc\cores\VideoRenderers\RenderManager.cpp" /> <ClCompile Include="..\..\xbmc\cores\VideoRenderers\WinRenderer.cpp" /> <ClCompile Include="..\..\xbmc\cores\VideoRenderers\VideoShaders\ConvolutionKernels.cpp" /> @@ -2724,6 +2725,7 @@ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release (DirectX)|Win32'">true</ExcludedFromBuild> </ClInclude> <ClInclude Include="..\..\xbmc\cores\VideoRenderers\OverlayRendererUtil.h" /> + <ClInclude Include="..\..\xbmc\cores\VideoRenderers\RenderFlags.h" /> <ClInclude Include="..\..\xbmc\cores\VideoRenderers\RenderManager.h" /> <ClInclude Include="..\..\xbmc\cores\VideoRenderers\WinRenderer.h" /> <ClInclude Include="..\..\xbmc\cores\VideoRenderers\VideoShaders\ConvolutionKernels.h" /> diff --git a/project/VS2010Express/XBMC.vcxproj.filters b/project/VS2010Express/XBMC.vcxproj.filters index 3b2c73da82..9cbbaee31c 100644 --- a/project/VS2010Express/XBMC.vcxproj.filters +++ b/project/VS2010Express/XBMC.vcxproj.filters @@ -648,6 +648,9 @@ <ClCompile Include="..\..\xbmc\cores\VideoRenderers\OverlayRendererUtil.cpp"> <Filter>cores\VideoRenderers</Filter> </ClCompile> + <ClCompile Include="..\..\xbmc\cores\VideoRenderers\RenderFlags.cpp"> + <Filter>cores\VideoRenderers</Filter> + </ClCompile> <ClCompile Include="..\..\xbmc\cores\VideoRenderers\RenderManager.cpp"> <Filter>cores\VideoRenderers</Filter> </ClCompile> @@ -3530,6 +3533,9 @@ <ClInclude Include="..\..\xbmc\cores\VideoRenderers\OverlayRendererUtil.h"> <Filter>cores\VideoRenderers</Filter> </ClInclude> + <ClInclude Include="..\..\xbmc\cores\VideoRenderers\RenderFlags.h"> + <Filter>cores\VideoRenderers</Filter> + </ClInclude> <ClInclude Include="..\..\xbmc\cores\VideoRenderers\RenderManager.h"> <Filter>cores\VideoRenderers</Filter> </ClInclude> diff --git a/xbmc/cores/VideoRenderers/Makefile.in b/xbmc/cores/VideoRenderers/Makefile.in index 3c1214dbd1..4803029208 100644 --- a/xbmc/cores/VideoRenderers/Makefile.in +++ b/xbmc/cores/VideoRenderers/Makefile.in @@ -3,6 +3,7 @@ SRCS += OverlayRenderer.cpp SRCS += OverlayRendererUtil.cpp SRCS += RenderCapture.cpp SRCS += RenderManager.cpp +SRCS += RenderFlags.cpp ifeq ($(findstring arm,@ARCH@),arm) SRCS += yuv2rgb.neon.S diff --git a/xbmc/cores/VideoRenderers/RenderFlags.cpp b/xbmc/cores/VideoRenderers/RenderFlags.cpp new file mode 100644 index 0000000000..e77d2c3060 --- /dev/null +++ b/xbmc/cores/VideoRenderers/RenderFlags.cpp @@ -0,0 +1,86 @@ +/* + * Copyright (C) 2005-2013 Team XBMC + * http://www.xbmc.org + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include "RenderFlags.h" +#include <string> +#include <map> + + +namespace RenderManager { + + unsigned int GetFlagsColorMatrix(unsigned int color_matrix, unsigned width, unsigned height) + { + switch(color_matrix) + { + case 7: // SMPTE 240M (1987) + return CONF_FLAGS_YUVCOEF_240M; + case 6: // SMPTE 170M + case 5: // ITU-R BT.470-2 + case 4: // FCC + return CONF_FLAGS_YUVCOEF_BT601; + case 1: // ITU-R Rec.709 (1990) -- BT.709 + return CONF_FLAGS_YUVCOEF_BT709; + case 3: // RESERVED + case 2: // UNSPECIFIED + default: + if(width > 1024 || height >= 600) + return CONF_FLAGS_YUVCOEF_BT709; + else + return CONF_FLAGS_YUVCOEF_BT601; + break; + } + } + + unsigned int GetFlagsChromaPosition(unsigned int chroma_position) + { + switch(chroma_position) + { + case 1: return CONF_FLAGS_CHROMA_LEFT; + case 2: return CONF_FLAGS_CHROMA_CENTER; + case 3: return CONF_FLAGS_CHROMA_TOPLEFT; + } + return 0; + } + + unsigned int GetFlagsColorPrimaries(unsigned int color_primaries) + { + switch(color_primaries) + { + case 1: return CONF_FLAGS_COLPRI_BT709; + case 4: return CONF_FLAGS_COLPRI_BT470M; + case 5: return CONF_FLAGS_COLPRI_BT470BG; + case 6: return CONF_FLAGS_COLPRI_170M; + case 7: return CONF_FLAGS_COLPRI_240M; + } + return 0; + } + + unsigned int GetFlagsColorTransfer(unsigned int color_transfer) + { + switch(color_transfer) + { + case 1: return CONF_FLAGS_TRC_BT709; + case 4: return CONF_FLAGS_TRC_GAMMA22; + case 5: return CONF_FLAGS_TRC_GAMMA28; + } + return 0; + } + +} diff --git a/xbmc/cores/VideoRenderers/RenderFlags.h b/xbmc/cores/VideoRenderers/RenderFlags.h index be66ead704..d408c8d9e1 100644 --- a/xbmc/cores/VideoRenderers/RenderFlags.h +++ b/xbmc/cores/VideoRenderers/RenderFlags.h @@ -21,6 +21,8 @@ * */ +#include <string> + #define RENDER_FLAG_BOT 0x01 #define RENDER_FLAG_TOP 0x02 #define RENDER_FLAG_BOTH (RENDER_FLAG_BOT | RENDER_FLAG_TOP) @@ -78,4 +80,15 @@ #define CONF_FLAGS_STEREO_CADANCE_LEFT_RIGHT 0x000000 #define CONF_FLAGS_STEREO_CADANCE_RIGHT_LEFT 0x008000 + + +namespace RenderManager { + + unsigned int GetFlagsColorMatrix(unsigned int color_matrix, unsigned width, unsigned height); + unsigned int GetFlagsChromaPosition(unsigned int chroma_position); + unsigned int GetFlagsColorPrimaries(unsigned int color_primaries); + unsigned int GetFlagsColorTransfer(unsigned int color_transfer); + +} + #endif diff --git a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp index 5bfbd1dedb..29cfb32035 100644 --- a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp +++ b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp @@ -47,6 +47,7 @@ #include "utils/log.h" using namespace std; +using namespace RenderManager; class CPulldownCorrection { @@ -999,64 +1000,6 @@ static std::string GetRenderFormatName(ERenderFormat format) return "UNKNOWN"; } -static unsigned int GetFlagsColorMatrix(unsigned int color_matrix, unsigned width, unsigned height) -{ - switch(color_matrix) - { - case 7: // SMPTE 240M (1987) - return CONF_FLAGS_YUVCOEF_240M; - case 6: // SMPTE 170M - case 5: // ITU-R BT.470-2 - case 4: // FCC - return CONF_FLAGS_YUVCOEF_BT601; - case 1: // ITU-R Rec.709 (1990) -- BT.709 - return CONF_FLAGS_YUVCOEF_BT709; - case 3: // RESERVED - case 2: // UNSPECIFIED - default: - if(width > 1024 || height >= 600) - return CONF_FLAGS_YUVCOEF_BT709; - else - return CONF_FLAGS_YUVCOEF_BT601; - break; - } -} - -static unsigned int GetFlagsChromaPosition(unsigned int chroma_position) -{ - switch(chroma_position) - { - case 1: return CONF_FLAGS_CHROMA_LEFT; - case 2: return CONF_FLAGS_CHROMA_CENTER; - case 3: return CONF_FLAGS_CHROMA_TOPLEFT; - } - return 0; -} - -static unsigned int GetFlagsColorPrimaries(unsigned int color_primaries) -{ - switch(color_primaries) - { - case 1: return CONF_FLAGS_COLPRI_BT709; - case 4: return CONF_FLAGS_COLPRI_BT470M; - case 5: return CONF_FLAGS_COLPRI_BT470BG; - case 6: return CONF_FLAGS_COLPRI_170M; - case 7: return CONF_FLAGS_COLPRI_240M; - } - return 0; -} - -static unsigned int GetFlagsColorTransfer(unsigned int color_transfer) -{ - switch(color_transfer) - { - case 1: return CONF_FLAGS_TRC_BT709; - case 4: return CONF_FLAGS_TRC_GAMMA22; - case 5: return CONF_FLAGS_TRC_GAMMA28; - } - return 0; -} - int CDVDPlayerVideo::OutputPicture(const DVDVideoPicture* src, double pts) { /* picture buffer is not allowed to be modified in this call */ |