aboutsummaryrefslogtreecommitdiff
path: root/include/mpv.hpp
blob: 6f3b559ad71e1acac78ad2cb95508949d990b332 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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;
};