|
Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
|
Job class for caching textures. More...
#include <TextureCacheJob.h>
Public Member Functions | |
| CTextureCacheJob (const std::string &url, const CTextureDetails &oldDetails={}, const std::string &knownHash="") | |
| ~CTextureCacheJob () override | |
| const char * | GetType () const override |
| Function that returns the type of job. | |
| bool | Equals (const CJob *job) const override |
| Function that compares this job instance with the given job instance. | |
| bool | DoWork () override |
| Main workhorse function of CJob instances. | |
| bool | CacheTexture (std::unique_ptr< CTexture > *texture=nullptr) |
| retrieve a hash for the given image Combines the size, ctime and mtime of the image file into a "unique" hash | |
Public Member Functions inherited from CJob | |
| CJob ()=default | |
| virtual | ~CJob ()=default |
| Destructor for job objects. | |
| void | SetProgressCallback (CJobManager *callback) |
| Function to set a callback for jobs to report progress. | |
| virtual bool | ShouldCancel (unsigned int progress, unsigned int total) const |
| Function for longer jobs to report progress and check whether they have been cancelled. | |
| size_t | GetPendingCallbackCount () const |
| Get the number of callbacks pending for this job during completion. | |
Static Public Member Functions | |
| static bool | ResizeTexture (const std::string &url, unsigned int height, unsigned int width, CPictureScalingAlgorithm::Algorithm scalingAlgorithm, uint8_t *&result, size_t &result_size) |
| static std::string | GetImageHash (const CFileItem &listedFile) |
| Retrieve a hash for a file already returned by a directory listing. | |
| static bool | MayBeAnImage (const std::string &mimeType) |
| Whether a mime type leaves an image possible. | |
Public Attributes | |
| std::string | m_url |
| CTextureDetails | m_oldDetails |
| CTextureDetails | m_details |
| bool | m_holdsProcessingClaim {false} |
| Whether this job is the one that reserved m_url in the texture cache. Only the reserver may release it. | |
Static Public Attributes | |
| static constexpr const char * | JOB_TYPE_CACHE_IMAGE = "cacheimage" |
Additional Inherited Members | |
Public Types inherited from CJob | |
| enum | PRIORITY { PRIORITY_LOW_PAUSABLE = 0 , PRIORITY_LOW , PRIORITY_NORMAL , PRIORITY_HIGH , PRIORITY_DEDICATED } |
| Priority levels for jobs, specified by clients when adding jobs to the CJobManager. More... | |
Job class for caching textures.
Handles loading and caching of textures.
| CTextureCacheJob::CTextureCacheJob | ( | const std::string & | url, |
| const CTextureDetails & | oldDetails = {}, | ||
| const std::string & | knownHash = "" ) |
| url | location of the image |
| oldDetails | what the image is already cached as, if anything. Its hash is only set once the image is due its periodic check, and an unchanged image is then revalidated rather than cached all over again. |
| knownHash | hash of the source file, if the caller already knows it (see GetImageHash()) |
|
overridedefault |
retrieve a hash for the given image Combines the size, ctime and mtime of the image file into a "unique" hash
| url | location of the image |
|
overridevirtual |
Main workhorse function of CJob instances.
All CJob subclasses must implement this function, performing all processing. Once this function is complete, the OnJobComplete() callback is called, and the job is then destroyed.
Implements CJob.
Function that compares this job instance with the given job instance.
CJob subclasses may optionally implement this to provide customized comparison functionality. This is useful for the CJobManager::AddJob() routine, which preempts similar jobs with the new job.
| job | the job to compared with this CJob instance. |
Reimplemented from CJob.
|
static |
Retrieve a hash for a file already returned by a directory listing.
| listedFile | the file, as listed by CDirectory::GetDirectory() without DIR_FLAG_NO_FILE_INFO |
|
inlineoverridevirtual |
Function that returns the type of job.
CJob subclasses may optionally implement this function to specify the type of job. This is useful for the CJobManager::AddJob() routine, which preempts similar jobs with the new job.
Reimplemented from CJob.
|
static |
Whether a mime type leaves an image possible.
| mimeType | the type to consider, empty if nothing has said what it is |
|
static |
|
staticconstexpr |
| CTextureDetails CTextureCacheJob::m_details |
| bool CTextureCacheJob::m_holdsProcessingClaim {false} |
Whether this job is the one that reserved m_url in the texture cache. Only the reserver may release it.
| CTextureDetails CTextureCacheJob::m_oldDetails |
| std::string CTextureCacheJob::m_url |