summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-08-11 19:02:01 +0200
committerwm4 <wm4@nowhere>2015-08-11 19:02:25 +0200
commitb103a8e11335e8381f07959b4a627729cfd08e74 (patch)
tree8c048200ac35c85fddbe46c5f27aba70b7a86eea
parent533e151febe798e0449e26f8544194a66ec6e92b (diff)
downloadmpv-b103a8e11335e8381f07959b4a627729cfd08e74.tar.bz2
mpv-b103a8e11335e8381f07959b4a627729cfd08e74.tar.xz
DOCS/client_api_examples/sdl: don't load file before GL init
Could lead to failure because it's essentially a race condition.
-rw-r--r--DOCS/client_api_examples/sdl/main.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/DOCS/client_api_examples/sdl/main.c b/DOCS/client_api_examples/sdl/main.c
index 38d2cf57cc..8a489c06f0 100644
--- a/DOCS/client_api_examples/sdl/main.c
+++ b/DOCS/client_api_examples/sdl/main.c
@@ -72,10 +72,6 @@ int main(int argc, char *argv[])
if (mpv_set_option_string(mpv, "vo", "opengl-cb") < 0)
die("failed to set VO");
- // Play this file. Note that this asynchronously starts playback.
- const char *cmd[] = {"loadfile", argv[1], NULL};
- mpv_command(mpv, cmd);
-
// We use events for thread-safe notification of the SDL main loop.
wakeup_on_mpv_redraw = SDL_RegisterEvents(1);
wakeup_on_mpv_events = SDL_RegisterEvents(1);
@@ -90,6 +86,10 @@ int main(int argc, char *argv[])
// users which run OpenGL on a different thread.)
mpv_opengl_cb_set_update_callback(mpv_gl, on_mpv_redraw, NULL);
+ // Play this file. Note that this asynchronously starts playback.
+ const char *cmd[] = {"loadfile", argv[1], NULL};
+ mpv_command(mpv, cmd);
+
while (1) {
SDL_Event event;
if (SDL_WaitEvent(&event) != 1)