From 62a29abd372a39a413e43a8f75146af823fe7bb3 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sun, 4 Aug 2019 14:58:03 +0200 Subject: Add video seek, play next video on end file --- include/VideoPlayer.hpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/VideoPlayer.hpp b/include/VideoPlayer.hpp index e98221e..9fbad33 100644 --- a/include/VideoPlayer.hpp +++ b/include/VideoPlayer.hpp @@ -3,11 +3,13 @@ #include #include #include +#include #include #include #include #include #include +#include class mpv_handle; class mpv_opengl_cb_context; @@ -17,6 +19,8 @@ namespace QuickMedia { public: VideoInitializationException(const std::string &errMsg) : std::runtime_error(errMsg) {} }; + + using PlaybackEndedCallback = std::function; class VideoPlayer { public: @@ -27,11 +31,14 @@ namespace QuickMedia { void setPosition(float x, float y); bool resize(const sf::Vector2i &size); void draw(sf::RenderWindow &window); + + void load_file(const std::string &path); // This counter is incremented when mpv wants to redraw content std::atomic_int redrawCounter; - private: sf::Context context; + PlaybackEndedCallback onPlaybackEndedCallback; + private: mpv_handle *mpv; mpv_opengl_cb_context *mpvGl; std::thread renderThread; @@ -42,5 +49,7 @@ namespace QuickMedia { bool alive; sf::Vector2i video_size; sf::Vector2i desired_size; + sf::RectangleShape seekbar; + sf::RectangleShape seekbar_background; }; } -- cgit v1.2.3