diff options
author | dec05eba <dec05eba@protonmail.com> | 2022-12-16 21:13:38 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2022-12-16 21:47:06 +0100 |
commit | 442fc29582b5581111e3ffd286f4f3d282877f3c (patch) | |
tree | cfcc2a18381bded582f1054ac8072d448b523edf /include | |
parent | e47a34f3c4d9f892c002d0dce7fb43a3ca1b4f28 (diff) |
Fix bug where image are not removed from loading when not visible
Matrix: fix invites not showing notification
Diffstat (limited to 'include')
-rw-r--r-- | include/AsyncImageLoader.hpp | 1 | ||||
-rw-r--r-- | include/FileAnalyzer.hpp | 3 | ||||
-rw-r--r-- | include/MessageQueue.hpp | 10 | ||||
-rw-r--r-- | include/Program.hpp | 1 |
4 files changed, 12 insertions, 3 deletions
diff --git a/include/AsyncImageLoader.hpp b/include/AsyncImageLoader.hpp index 986430c..42e7915 100644 --- a/include/AsyncImageLoader.hpp +++ b/include/AsyncImageLoader.hpp @@ -27,6 +27,7 @@ namespace QuickMedia { std::unique_ptr<mgl::Image> image; // Set in another thread. This should be .reset after loading it into |texture|, to save memory size_t counter = 0; Path thumbnail_path; + std::string url; }; struct ThumbnailLoadData { diff --git a/include/FileAnalyzer.hpp b/include/FileAnalyzer.hpp index 7be154f..ed17140 100644 --- a/include/FileAnalyzer.hpp +++ b/include/FileAnalyzer.hpp @@ -45,6 +45,9 @@ namespace QuickMedia { // Set |width| or |height| to 0 to disable scaling. // TODO: Make this async + bool video_get_start_frame(const FileAnalyzer &file, const char *destination_path, int width = 0, int height = 0); + // Set |width| or |height| to 0 to disable scaling. + // TODO: Make this async bool video_get_middle_frame(const FileAnalyzer &file, const char *destination_path, int width = 0, int height = 0); class FileAnalyzer { diff --git a/include/MessageQueue.hpp b/include/MessageQueue.hpp index ba28431..1e48102 100644 --- a/include/MessageQueue.hpp +++ b/include/MessageQueue.hpp @@ -59,14 +59,18 @@ namespace QuickMedia { } // Return true from |callback| to remove the element - void erase_if(std::function<bool(T&)> callback) { + int erase_if(std::function<bool(T&)> callback) { std::unique_lock<std::mutex> lock(mutex); + int removed = 0; for(auto it = data_queue.begin(); it != data_queue.end();) { - if(callback(*it)) + if(callback(*it)) { it = data_queue.erase(it); - else + ++removed; + } else { ++it; + } } + return removed; } bool is_running() const { diff --git a/include/Program.hpp b/include/Program.hpp index 674c834..5249de6 100644 --- a/include/Program.hpp +++ b/include/Program.hpp @@ -33,6 +33,7 @@ int exec_program_write_stdin(const char **args, const char *str, size_t size, Pr |buffer_size| has to be between 1 and 65536. */ int exec_program(const char **args, ProgramOutputCallback output_callback, void *userdata, int buffer_size = 16384); +int exec_program(const char **args, ProgramOutputCallback output_callback, void *userdata, int *allowed_exit_status, int num_allowed_exit_status, int buffer_size = 16384); // Return the exit status, or a negative value if waiting failed int wait_program(pid_t process_id); |