From c9c2621accb68634685a14703491cacdd7ed2bb1 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Thu, 8 Aug 2019 07:26:04 +0200 Subject: Retain fullscreen video when changing to next video --- include/Body.hpp | 6 +++++- include/Program.h | 2 +- include/VideoPlayer.hpp | 9 ++++----- 3 files changed, 10 insertions(+), 7 deletions(-) (limited to 'include') 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> items; - std::vector> item_thumbnail_textures; std::thread thumbnail_load_thread; bool draw_thumbnails; private: + struct ThumbnailData { + std::string url; + std::shared_ptr texture; + }; std::shared_ptr load_thumbnail_from_url(const std::string &url); + std::vector 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; }; } -- cgit v1.2.3