modernized video display, audio playback and vo postprocess APIs
THe APIs were already recently updated so modernize it by using bool
where the return value is semantically boolean value. Using TRUE/FALSE is
inherently ambiguous because it is not obvious from the prototype if
success is 0 or TRUE (1).
- removed `needs_mainloop` attribute and deduce if mainloop is needed
from the presence of _run callback (the information is now redundant
only displays needing/running mainloop should announce _run callback)
- run the custom mainloop (currently only Syphon!) only when display
doesn't run its mainloop. This allows running Syphon and GL/SDL
display because it connects to the display mainloop.
Return a macro ((void *) 1) from modules returning pointer to signalize
that help was printed (for correct UG return value). This replaces the
old behavior when module class specific value (eg. &display_init_noerr)
was returned.
Replace blocking/nonblock/discard flags with numerical timeout for
fine-grainer control of latency.
The original flags are kept as convenience macros so the API changes is
only small as long as non-block (default) or blocking is used.
Use name (MOD_NAME) provided by module rather than name given from
command-line. Those 2 may not match - in command-line it is
case-insensitive so ("gl" or even "gL" would be printed inestead of
expected "GL"). Also there may be input/output module of the same name
(eg. decklink) for which we may want to distinguish.
Do not fail when display requiring mainloop is not first. On Linux,
although eg. GL declares the need to be run from mainloop (GLFW-induced
constraint), it runs fine also without it. Thus print only and error
and don't fail.
If a display does not need the mainloop, display_run() just spawns a new
thread and immediately returns. This means that the 'disp_thread' thread
isn't the actual display thread and finishes far sooner than the display.
As a result, display_done() was called while the display was still running.
Do not run the display worker in the main thread if not needed.
This would allow to run a custom mainloop (eg. from Syphon) while being able
to run a display that doesn't need to be run in the main thread.