Skip to content

Commit

Permalink
[rbp] Add settings option to disable gpu jpeg acceleration
Browse files Browse the repository at this point in the history
  • Loading branch information
popcornmix committed Apr 3, 2020
1 parent b1d75fe commit 5d98919
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 3 deletions.
10 changes: 10 additions & 0 deletions addons/resource.language.en_gb/resources/strings.po
Expand Up @@ -21403,6 +21403,16 @@ msgstr ""
#empty strings from id 38081 to 38099
#strings 38081 to 38099 reserved for music library

#: system/settings/rbp.xml
msgctxt "#38114"
msgid "Use GPU for jpeg acceleration"
msgstr ""

#: system/settings/rbp.xml
msgctxt "#38115"
msgid "This option uses the GPU for encoding and decoding jpegs"
msgstr ""

#. Description of section #14200 "Player""
#: system/settings/settings.xml
msgctxt "#38100"
Expand Down
5 changes: 5 additions & 0 deletions system/settings/rbp.xml
Expand Up @@ -27,6 +27,11 @@
</control>
<control type="edit" format="integer" />
</setting>
<setting id="videoplayer.acceleratedjpegs" type="boolean" label="38114" help="38115">
<level>2</level>
<default>true</default>
<control type="toggle" />
</setting>
</group>
</category>
</section>
Expand Down
3 changes: 2 additions & 1 deletion xbmc/TextureCacheJob.cpp
Expand Up @@ -12,6 +12,7 @@
#include "guilib/Texture.h"
#include "settings/AdvancedSettings.h"
#include "settings/SettingsComponent.h"
#include "settings/Settings.h"
#include "utils/log.h"
#include "filesystem/File.h"
#include "pictures/Picture.h"
Expand Down Expand Up @@ -81,7 +82,7 @@ bool CTextureCacheJob::CacheTexture(CBaseTexture **out_texture)
return true;

#if defined(TARGET_RASPBERRY_PI)
if (COMXImage::CreateThumb(image, width, height, additional_info, CTextureCache::GetCachedPath(m_cachePath + ".jpg")))
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;
Expand Down
6 changes: 5 additions & 1 deletion xbmc/guilib/TexturePi.cpp
Expand Up @@ -6,6 +6,10 @@
* See LICENSES/README.md for more information.
*/

#include "ServiceBroker.h"
#include "settings/Settings.h"
#include "settings/SettingsComponent.h"

#include "Texture.h"
#include "cores/omxplayer/OMXImage.h"
#include "guilib/TextureManager.h"
Expand Down Expand Up @@ -100,7 +104,7 @@ void CPiTexture::Update(unsigned int width, unsigned int height, unsigned int pi

bool CPiTexture::LoadFromFileInternal(const std::string& texturePath, unsigned int maxWidth, unsigned int maxHeight, bool requirePixels, const std::string& strMimeType)
{
if (URIUtils::HasExtension(texturePath, ".jpg|.tbn"))
if (CServiceBroker::GetSettingsComponent()->GetSettings()->GetBool("videoplayer.acceleratedjpegs") && URIUtils::HasExtension(texturePath, ".jpg|.tbn"))
{
COMXImageFile *file = g_OMXImage.LoadJpeg(texturePath);
if (file)
Expand Down
2 changes: 1 addition & 1 deletion xbmc/pictures/Picture.cpp
Expand Up @@ -61,7 +61,7 @@ bool CPicture::CreateThumbnailFromSurface(const unsigned char *buffer, int width
if (URIUtils::HasExtension(thumbFile, ".jpg"))
{
#if defined(TARGET_RASPBERRY_PI)
if (COMXImage::CreateThumbnailFromSurface(const_cast<unsigned char*>(buffer), width, height, XB_FMT_A8R8G8B8, stride, thumbFile.c_str()))
if (CServiceBroker::GetSettingsComponent()->GetSettings()->GetBool("videoplayer.acceleratedjpegs") && COMXImage::CreateThumbnailFromSurface(const_cast<unsigned char*>(buffer), width, height, XB_FMT_A8R8G8B8, stride, thumbFile.c_str()))
return true;
#endif
}
Expand Down

0 comments on commit 5d98919

Please sign in to comment.