From 700eea9d7a51cb474e4dbca8f2fa39f4c3e51c94 Mon Sep 17 00:00:00 2001 From: Memphiz Date: Sat, 5 May 2012 17:02:23 +0200 Subject: [PATCH] [add] - hookup the video orientation hint to the thumbnail generation --- xbmc/cores/dvdplayer/DVDFileInfo.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/xbmc/cores/dvdplayer/DVDFileInfo.cpp b/xbmc/cores/dvdplayer/DVDFileInfo.cpp index d53b73577dfc8..69dee53a03e47 100644 --- a/xbmc/cores/dvdplayer/DVDFileInfo.cpp +++ b/xbmc/cores/dvdplayer/DVDFileInfo.cpp @@ -75,6 +75,21 @@ bool CDVDFileInfo::GetFileDuration(const CStdString &path, int& duration) return false; } +int DegreeToOrientation(int degrees) +{ + switch(degrees) + { + case 90: + return 5; + case 180: + return 2; + case 270: + return 7; + default: + return 0; + } +} + bool CDVDFileInfo::ExtractThumb(const CStdString &strPath, CTextureDetails &details, CStreamDetails *pStreamDetails) { unsigned int nTime = XbmcThreads::SystemClockMillis(); @@ -223,12 +238,13 @@ bool CDVDFileInfo::ExtractThumb(const CStdString &strPath, CTextureDetails &deta if (context) { + int orientation = DegreeToOrientation(hint.orientation); dllSwScale.sws_scale(context, src, srcStride, 0, picture.iHeight, dst, dstStride); dllSwScale.sws_freeContext(context); details.width = nWidth; details.height = nHeight; - CPicture::CacheTexture(pOutBuf, nWidth, nHeight, nWidth * 4, 0, nWidth, nHeight, CTextureCache::GetCachedPath(details.file)); + CPicture::CacheTexture(pOutBuf, nWidth, nHeight, nWidth * 4, orientation, nWidth, nHeight, CTextureCache::GetCachedPath(details.file)); bOk = true; }