when in libmpv mode there is no need to for logging and reading options.
this also prevents possible race conditions with the usage and deinit of
the mpv_handler.
NSApp.terminate() is not a requirement to properly shut down a cocoa
App since it only calls exit() internally. though when not used the
cocoa termination events won't trigger, which we don't need. this
prevented us to exit with a proper exit code.
rework the whole termination logic to end up at one point where we can
return the exit code from the mpv_main function.
Fixes#7456
this event has several advantages, it unifies the mpv:// url handling,
the dropping of files on the App icon and opening via finder into one
event, and it also lets us remove the file open workaround.
we had to keep track of opened files via the command line because the
event was also triggered by passed files on the command line, leading
to redundant load events.
the new event doesn't trigger from files passed via the command line
anymore.
since cocoa is initialising mpv and does several things before the mpv
core does anything and the mpv_handle was passed to the App, this can be
used to log such things before the mpv logging is available. helpful for
debugging especially bundle related things.
the logger mapping looks a bit unintuitive but error is basically yellow
what our warning is and fatal is red what our error is.
add new app_bridge objc file for bridging between mpv core and app
functionality. replace old EventsResponder singleton with AppHub.
another step to clean up all App functionality and have one central
place for it.
timeBeginPeriod() only allows setting minimum timer resolution
to 1 ms. However, modern x86 platforms support a minimum timer
resolution of 0.5 ms. Use NtSetTimerResolution() instead for
the increased resolution, which can be set with MPV_HRT_RES.
Additionally, change the units of mp_start_hires_timers(),
mp_end_hires_timer(), MPV_HRT_RES, and MPV_HRT_MAX to nanoseconds,
in accordance with other functions used in timer.h.
GetConsoleMode() can be quite slow and in mpv the mode never changes, so
we can just check it once.
Fixes performance when writing lots of logs to terminal.
%s is evaluated as wchar_t only in "Windows classic" semantic. It is not
C standard compliant.
%ls is compatible with both and means the same wchar_t format.
This commit fixes error output from mpv.com.
See: https://devblogs.microsoft.com/oldnewthing/?p=102823