From e163284b6802fe6375536f48cea281062294eaa2 Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 4 Feb 2015 18:25:40 +0100 Subject: command: add on_unload hook Fixes #1552. --- player/loadfile.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'player') diff --git a/player/loadfile.c b/player/loadfile.c index db032d422c..4f8b512e86 100644 --- a/player/loadfile.c +++ b/player/loadfile.c @@ -808,6 +808,14 @@ static int process_open_hooks(struct MPContext *mpctx) return 0; } +static void process_unload_hooks(struct MPContext *mpctx) +{ + mp_hook_run(mpctx, NULL, "on_unload"); + + while (!mp_hook_test_completion(mpctx, "on_unload")) + mp_idle(mpctx); +} + static void print_timeline(struct MPContext *mpctx) { if (mpctx->timeline) { @@ -1212,6 +1220,8 @@ terminate_playback: goto goto_reopen_demuxer; } + process_unload_hooks(mpctx); + mp_nav_destroy(mpctx); if (mpctx->stop_play == KEEP_PLAYING) -- cgit v1.2.3