summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGhostNaN <GhostNaN@protonmail.com>2020-08-07 16:12:19 -0400
committerGhostNaN <GhostNaN@protonmail.com>2020-08-07 16:12:19 -0400
commit9ebb7e431136aafbfe66a21724f824ae3d2aa8f3 (patch)
treecc0eb1d9a8f2af6990f289e6ffcf612aee84ff7e
parente8ff8c35645b417af80250ca3085d2d426f6f5f4 (diff)
Avoided race condition so MPV_RENDER_PARAM_WL_DISPLAY is cool again
-rw-r--r--src/paper.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/paper.c b/src/paper.c
index 48b7507..ae9a0e2 100644
--- a/src/paper.c
+++ b/src/paper.c
@@ -243,6 +243,7 @@ int paper_init(char* _monitor, char* video_path, int verbose, char* layer_name)
// Have mpv render onto egl context
mpv_render_param params[] = {
+ {MPV_RENDER_PARAM_WL_DISPLAY, wl},
{MPV_RENDER_PARAM_API_TYPE, MPV_RENDER_API_TYPE_OPENGL},
{MPV_RENDER_PARAM_OPENGL_INIT_PARAMS, &(mpv_opengl_init_params){
.get_proc_address = get_proc_address_mpv,
@@ -256,8 +257,12 @@ int paper_init(char* _monitor, char* video_path, int verbose, char* layer_name)
// Play this file.
const char* cmd[] = {"loadfile", video_path, NULL};
mpv_command_async(mpv, 0, cmd);
+ mpv_event* event = mpv_wait_event(mpv, 0);
+ while (event->event_id != MPV_EVENT_START_FILE){
+ event = mpv_wait_event(mpv, 0);
+ }
if (verbose) {
- printf("Loading %s\n", video_path);
+ printf("Loaded %s\n", video_path);
}
mpv_render_param render_params[] = {