From bdd95325ce3b8b3f95316b206b3c4c210ef81c80 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sun, 2 Oct 2022 07:40:14 +0200 Subject: Add mpv option --- include/mpv.hpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 include/mpv.hpp (limited to 'include') 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 +#include + +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 -- cgit v1.2.3