summaryrefslogtreecommitdiffstats
path: root/player/loadfile.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-02-15 16:19:19 +0100
committerwm4 <wm4@nowhere>2016-02-15 16:19:19 +0100
commit39ab426f05826a924cc89b362c60c4b7172cf922 (patch)
tree71cf5d7ea5a38d7c45bfdbb7f6073323f83b1eb0 /player/loadfile.c
parentb7034db4afcc0a90ff88fb422cd929b2c15f535d (diff)
downloadmpv-39ab426f05826a924cc89b362c60c4b7172cf922.tar.bz2
mpv-39ab426f05826a924cc89b362c60c4b7172cf922.tar.xz
player: add on_preloaded hook
(Limited usefulness.)
Diffstat (limited to 'player/loadfile.c')
-rw-r--r--player/loadfile.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/player/loadfile.c b/player/loadfile.c
index bd48bb4b0e..7a0afe4c52 100644
--- a/player/loadfile.c
+++ b/player/loadfile.c
@@ -871,6 +871,19 @@ static int process_open_hooks(struct MPContext *mpctx)
return 0;
}
+static int process_preloaded_hooks(struct MPContext *mpctx)
+{
+ mp_hook_run(mpctx, NULL, "on_preloaded");
+
+ while (!mp_hook_test_completion(mpctx, "on_preloaded")) {
+ mp_idle(mpctx);
+ if (mpctx->stop_play)
+ return -1;
+ }
+
+ return 0;
+}
+
static void process_unload_hooks(struct MPContext *mpctx)
{
mp_hook_run(mpctx, NULL, "on_unload");
@@ -1256,6 +1269,9 @@ reopen_file:
check_previous_track_selection(mpctx);
+ if (process_preloaded_hooks(mpctx))
+ goto terminate_playback;
+
if (!init_complex_filters(mpctx))
goto terminate_playback;