Skip to content

Commit

Permalink
Merge pull request #933 from Memphiz/thumborientation
Browse files Browse the repository at this point in the history
Hookup the video orientation hint to the thumbnail generation
  • Loading branch information
Memphiz committed May 10, 2012
2 parents 3fd2548 + 700eea9 commit 209d298
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion xbmc/cores/dvdplayer/DVDFileInfo.cpp
Expand Up @@ -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();
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 209d298

Please sign in to comment.