diff options
author | dec05eba <dec05eba@protonmail.com> | 2019-08-08 07:26:04 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2019-08-08 07:26:08 +0200 |
commit | c9c2621accb68634685a14703491cacdd7ed2bb1 (patch) | |
tree | 51b55692a6010c533dfd98087e12f555a54772e8 /include | |
parent | 0943801f321216dabe9f45593f608a222c0d4310 (diff) |
Retain fullscreen video when changing to next video
Diffstat (limited to 'include')
-rw-r--r-- | include/Body.hpp | 6 | ||||
-rw-r--r-- | include/Program.h | 2 | ||||
-rw-r--r-- | include/VideoPlayer.hpp | 9 |
3 files changed, 10 insertions, 7 deletions
diff --git a/include/Body.hpp b/include/Body.hpp index 65aae8d..5d16898 100644 --- a/include/Body.hpp +++ b/include/Body.hpp @@ -47,11 +47,15 @@ namespace QuickMedia { sf::Text progress_text; int selected_item; std::vector<std::unique_ptr<BodyItem>> items; - std::vector<std::shared_ptr<sf::Texture>> item_thumbnail_textures; std::thread thumbnail_load_thread; bool draw_thumbnails; private: + struct ThumbnailData { + std::string url; + std::shared_ptr<sf::Texture> texture; + }; std::shared_ptr<sf::Texture> load_thumbnail_from_url(const std::string &url); + std::vector<ThumbnailData> item_thumbnail_textures; bool loading_thumbnail; }; }
\ No newline at end of file diff --git a/include/Program.h b/include/Program.h index f891d8e..ba7e523 100644 --- a/include/Program.h +++ b/include/Program.h @@ -5,7 +5,7 @@ extern "C" { #endif -/* Return 0 if you want to continue reading */ +/* Return 0 if you want to continue reading. @data is null-terminated */ typedef int (*ProgramOutputCallback)(char *data, int size, void *userdata); /* diff --git a/include/VideoPlayer.hpp b/include/VideoPlayer.hpp index 4f60883..a9b177c 100644 --- a/include/VideoPlayer.hpp +++ b/include/VideoPlayer.hpp @@ -28,6 +28,9 @@ namespace QuickMedia { // Throws VideoInitializationException on error VideoPlayer(sf::RenderWindow *window, unsigned int width, unsigned int height, const char *file, bool loop = false); ~VideoPlayer(); + + VideoPlayer(const VideoPlayer&) = delete; + VideoPlayer& operator=(const VideoPlayer&) = delete; void handle_event(sf::Event &event); void setPosition(float x, float y); @@ -40,9 +43,9 @@ namespace QuickMedia { // This is updated when mpv wants to render std::atomic_bool redraw; std::atomic_bool event_update; + // Important: Do not destroy the video player in this callback PlaybackEndedCallback onPlaybackEndedCallback; private: - void on_doubleclick(); void handle_mpv_events(); private: mpv_handle *mpv; @@ -56,9 +59,5 @@ namespace QuickMedia { sf::RectangleShape seekbar; sf::RectangleShape seekbar_background; sf::Clock cursor_last_active_timer; - sf::Clock time_since_last_left_click; - int left_click_counter; - sf::RenderWindow *window; - bool video_is_fullscreen; }; } |