diff options
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); |