aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2019-08-04 14:58:03 +0200
committerdec05eba <dec05eba@protonmail.com>2019-08-04 14:58:06 +0200
commit62a29abd372a39a413e43a8f75146af823fe7bb3 (patch)
tree71562dcbba424c874da003f7521a0b852563ede5 /include
parent4b24638802385816fb5f90c95f175b30ae2398a8 (diff)
Add video seek, play next video on end file
Diffstat (limited to 'include')
-rw-r--r--include/VideoPlayer.hpp11
1 files changed, 10 insertions, 1 deletions
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 <SFML/Graphics/RenderWindow.hpp>
#include <SFML/Graphics/Texture.hpp>
#include <SFML/Graphics/Sprite.hpp>
+#include <SFML/Graphics/RectangleShape.hpp>
#include <SFML/Window/Context.hpp>
#include <thread>
#include <mutex>
#include <atomic>
#include <stdexcept>
+#include <functional>
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<void()>;
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;
};
}