New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add useCache option to python ControlImage.setImage function #3130
Conversation
@@ -133,9 +134,10 @@ class CGUILargeTextureManager : public IJobCallback | |||
CStdString m_path; | |||
CTextureArray m_texture; | |||
unsigned int m_timeToDelete; | |||
bool use_cache; |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
First off, let's find the real issue: If it's caching images, why is it caching low resolution copies? Is it due to the size of the images not satisfying the fanart size rule, thus being cached at thumbsize? Please take a look at the sizes of the originals and the sizes of the cached versions in your texture cache. Secondly, is it a problem with the sizing, or is there a problem with the caching beyond this? Seems to me that if the image is going to be displayed more than once, we probably want to cache. Thirdly, I wonder whether this might be better associated with the control, rather than specified externally. After all, this is basically what the cache is designed for: displaying images within the skin fast. For a slideshow, you probably prefer the original image, right? Fourthly, you'll notice the other (non-caching) path won't apply to images that aren't already local (skin images primarily). |
Ok, before I fix the problems you mentioned in the code, I'll answer your questions about the real issue and see if it's still worth getting this patch merged.
So, in summary, even if there is a problem with the caching logic in (1), I think it still makes sense to bypass the cache completely for a slideshow screensaver, which means either providing a flag or a new control. |
There's another way this could be done: It could be done via a special URL construct. You'll notice you're just passing the boolean alongside the path all the way through. I'm not sure what should be in control of the caching. Should it be the control, or the code that sets images? I don't see a reason why you'd want to stop caching selectively for a particular control, but on the other hand, I'm not sure that should be something the skinner would wish to control (though perhaps it could be done programatically on the control via the python/internal API). |
I think the Python /API would be the one who needs to be in control. It shouldn't be the skinner. |
Re: 4. One of the things that helped me realize that there was some kind of selective caching going on was the fact that if I changed the control type from "largeimage" to "image" in the screensaver.xbmc.slideshow resources, the caching was always disabled, so there's at least some kind of link between which image control is used and whether the image may be stored in the texture cache, at least for local files. Yes, we could do a URL construct if that was preferable to passing a boolean all the way through. Does xbmc mind passing parameters as part of the URL? Something like file:///foo/bar?no-cache=1? I really don't know enough about skinning and XBMC in general to have an opinion on what should be in control of the caching. |
Another good example where caching makes no sense or is even counterproductive is showing pictures from a webcam.
@jdieter: XBMC already has some kind of internal URL Parameters, e.g. |
@jdieter |
Ok, I think I've addressed the minor coding issues raised by jmarshallnz. Are there any architectural changes you'd like me to make? P.S. I've rebased my patch to current master, not sure if that's appropriate or if anyone cares. |
{ | ||
m_info.use_cache = useCache; | ||
return true; | ||
} |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Looking good. Fix up the last bits then squash down into a single commit. Will go in the November merge window. |
Ok, I've cleaned up the last two items you listed and have squashed the four commits down into one. Let me know if there's anything else. Thanks for reviewing this. |
Looks good. Queued for Nov merge window. By the looks it might need some rebasing around that time. I'll ping you when the time comes (or just do it myself if I have a spare 10). |
Ok, sounds good. Thanks again. |
@@ -46,18 +47,22 @@ | |||
bool CImageLoader::DoWork() | |||
{ | |||
bool needsChecking = false; | |||
CStdString loadPath; |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@jdieter |
… be set to false to bypass the cache Signed-off-by: Jonathan Dieter <jdieter@lesbg.com>
It's now rebased. |
jenkins build this please |
Add useCache option to python ControlImage.setImage function
@MartijnKaijser will need a python API bump, right? |
Correct. Will do tonight |
Using the current official slideshow screensaver addon, it seems that sometimes the slideshow pictures are cached - at low quality - in the texture cache. I've gone ahead and added a useCache option to the setImage function for images. The default is true (which means all current plugins work exactly the same), but if you set it to false, the texture cache will be completely bypassed when loading the picture.
If you apply this patch, and then change the following line in the slideshow addon, XBMC will no longer try to cache the pictures.
Most of the work is passing the useCache option from the python interpreter to the code that actually loads the image.
Also, I'm not sure if it's intended, but only one of the two different image loading paths (LargeImage) is caching textures. It seems that regular Images are already bypassing the texture cache.