Skip to content

Commit

Permalink
OMXImage: Rearchitect to use file buffer
Browse files Browse the repository at this point in the history
  • Loading branch information
popcornmix committed Apr 3, 2020
1 parent a73826c commit 1478885
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 168 deletions.
38 changes: 24 additions & 14 deletions xbmc/TextureCacheJob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,20 +81,6 @@ bool CTextureCacheJob::CacheTexture(CBaseTexture **out_texture)
else if (m_details.hash == m_oldHash)
return true;

#if defined(TARGET_RASPBERRY_PI)
if (CServiceBroker::GetSettingsComponent()->GetSettings()->GetBool("videoplayer.acceleratedjpegs") && COMXImage::CreateThumb(image, width, height, additional_info, CTextureCache::GetCachedPath(m_cachePath + ".jpg")))
{
m_details.width = width;
m_details.height = height;
m_details.file = m_cachePath + ".jpg";
if (out_texture)
*out_texture = LoadImage(CTextureCache::GetCachedPath(m_details.file), width, height, "" /* already flipped */);
CLog::Log(LOGDEBUG, "Fast %s image '%s' to '%s': %p",
m_oldHash.empty() ? "Caching" : "Recaching", CURL::GetRedacted(image),
m_details.file, static_cast<void*>(out_texture));
return true;
}
#endif
CBaseTexture *texture = nullptr;
if (additional_info == "music")
{ // special case for embedded music images
Expand All @@ -110,6 +96,30 @@ bool CTextureCacheJob::CacheTexture(CBaseTexture **out_texture)
if (!(!(file.IsPicture() && !(file.IsZIP() || file.IsRAR() || file.IsCBR() || file.IsCBZ() ))
&& !StringUtils::StartsWithNoCase(file.GetMimeType(), "image/") && !StringUtils::EqualsNoCase(file.GetMimeType(), "application/octet-stream"))) // ignore non-pictures
{
#if defined(TARGET_RASPBERRY_PI)
if (CServiceBroker::GetSettingsComponent()->GetSettings()->GetBool("videoplayer.acceleratedjpegs"))
{
// Read image into memory to use our vfs
XFILE::CFile xfile;
XFILE::auto_buffer buf;

if (xfile.LoadFile(image, buf) > 0)
{
if (COMXImage::CreateThumb(image, buf, width, height, additional_info, CTextureCache::GetCachedPath(m_cachePath + ".jpg")))
{
m_details.width = width;
m_details.height = height;
m_details.file = m_cachePath + ".jpg";
if (out_texture)
*out_texture = LoadImage(CTextureCache::GetCachedPath(m_details.file), width, height, "" /* already flipped */);
CLog::Log(LOGDEBUG, "Fast %s image '%s' to '%s': %p",
m_oldHash.empty() ? "Caching" : "Recaching", CURL::GetRedacted(image),
m_details.file, static_cast<void*>(out_texture));
return true;
}
}
}
#endif
texture = new CTexture();
if (!(texture->LoadFromFileInternal(image, width, height, true, file.GetMimeType())))
{
Expand Down

0 comments on commit 1478885

Please sign in to comment.