aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2022-10-02 07:40:14 +0200
committerdec05eba <dec05eba@protonmail.com>2022-10-02 07:45:16 +0200
commitbdd95325ce3b8b3f95316b206b3c4c210ef81c80 (patch)
treefedf3d44179a0b61def3b2522cd927c7aa64aa9c /include
parent24531105312edb362f8aa791698dc223c0c5a661 (diff)
Add mpv option
Diffstat (limited to 'include')
-rw-r--r--include/mpv.hpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/include/mpv.hpp b/include/mpv.hpp
new file mode 100644
index 0000000..6f3b559
--- /dev/null
+++ b/include/mpv.hpp
@@ -0,0 +1,31 @@
+#pragma once
+
+#include <stdint.h>
+#include <SDL.h>
+
+typedef struct mpv_handle mpv_handle;
+typedef struct mpv_render_context mpv_render_context;
+
+class Mpv {
+public:
+ Mpv() = default;
+ ~Mpv();
+
+ bool create();
+ bool destroy();
+
+ bool load_file(const char *path);
+ // |width| and |ħeight| are set to 0 unless there is an event to reconfigure video size
+ void on_event(SDL_Event &event, bool *render_update, int64_t *width, int64_t *height, bool *quit);
+ void seek(double seconds);
+ void toggle_pause();
+ void draw(unsigned int framebuffer_id, int width, int height);
+
+ bool created = false;
+ uint32_t wakeup_on_mpv_render_update = -1;
+ uint32_t wakeup_on_mpv_events = -1;
+
+ mpv_handle *mpv = nullptr;
+ mpv_render_context *mpv_gl = nullptr;
+ bool paused = false;
+}; \ No newline at end of file