This commit is mainly for correcting the previous commit message. The previous commit fixed an issue where [un]registering events above the first event ID "hole" is not requested from libmpv, and that's indeed true. However, this had nearly zero impact in practice, because libmpv enables all events by default anyway (except TICK). Therefore, above the first ID "hole" [un]register requests are not sent to libmpv, and the events just keep arriving. But the callback functions are still added/removed correctly (at defaults.js), and so the script is not called back even if unregister did not actually happen with libmpv. The only event which was affected is TICK - which is not enabled by default as it's deprecated, and before the previous commit could not be enabled. So the fix is more a general correctness fix now that the IDs array can have "holes", but with effctively no impact in practice.
Showing the changes to player/javascript.c (1 of 1 file). Show all
Unified · Split
| @@ -611,6 +611,7 @@ static void script__request_event(js_State *J) · 610 unmodified lines | |||
| 611 | bool enable = js_toboolean(J, 2); | 611 | bool enable = js_toboolean(J, 2); |
| 612 | 612 | ||
| 613 | for (int n = 0; n < 256; n++) { | 613 | for (int n = 0; n < 256; n++) { |
| 614 | // some n's may be missing ("holes"), returning NULL | ||
| 614 | const char *name = mpv_event_name(n); | 615 | const char *name = mpv_event_name(n); |
| 615 | if (name && strcmp(name, event) == 0) { | 616 | if (name && strcmp(name, event) == 0) { |
| 616 | push_status(J, mpv_request_event(jclient(J), n, enable)); | 617 | push_status(J, mpv_request_event(jclient(J), n, enable)); |