Instead of making msg.c an ifdef hell for unix vs. windows code, move
the code to separate functions defined in terminal-unix.c/terminal-
win.c.
Drop the code that selects random colors for --msgmodule prefixes.
So you can pass a command as list of strings (each item is an argument),
instead of having to worry about escaping and such.
These functions also take an argument for the default command flags. In
particular, this allows setting saner defaults for commands sent by
program code.
Expose this to Lua as mp.send_commandv command (suggestions for a better
name welcome). The Lua version doesn't allow setting the default command
flags, but it can still use command prefixes. The default flags are
different from input.conf, and disable OSD and property expansion.
This comes with a real change in behavior: now the signal handler is set
only when the terminal input code is active (e.g. not with
--no-consolecontrols), but this should be ok.
Remove these because I'm too lazy to convert them to proper
STREAM_CTRLs. Considering that probably nobody uses radio://, caring
about this is a complete waste of time. I will add these commands back
if someone asks for them, but I don't expect this to happen.
Apparently this has been broken for a year or so. The were three
reasons for the breakage here:
1. The window dragging hack prevented any DOWN event from
passing through since it always returned before we even got
the button.
2. The window style had CS_DBLCLKS in its flags, so we did not
get any DOWN events when the OS had detected a double click
(instead expecting us to handle a DBL event).
3. We never sent any mouse buttons when mouse movement handling
was disabled.
request_channels has been deprecated for years (request_channel_layout
is the replacement), but it appears it's still needed despite the
deprecation at least on older libavcodec versions.
So still set request_channels, but to it with the avoption API, which
hides the deprecation warning. This should also prevent mpv getting
trashed when libavcodec happens to bump its major version.
In my opinion, config.h inclusions should be kept to a minimum. MPlayer
code really liked including config.h everywhere, though, even in often
used header files. Try to reduce this.
Since m_option.h and options.h are extremely often included, a lot of
files have to be changed.
Moving path.c/h to options/ is a bit questionable, but since this is
mainly about access to config files (which are also handled in
options/), it's probably ok.
The tmsg stuff was for the internal gettext() based translation system,
which nobody ever attempted to use and thus was removed. mp_gtext() and
set_osd_tmsg() were also for this.
mp_dbg was once enabled in debug mode only, but since we have log level
for enabling debug messages, it seems utterly useless.
Nothing actually used the returned length. Since the remaining time can
easily become 0 or negative (e.g. incorrectly estimated file duration),
the time_remaining function still needs 2 return values, though.
"-" could skip optional arguments. I think this was a pretty bad idea,
because it introduced a weird special case.
I'll remove the special syntax, but keep compatibility for the "seek"
and "screenshot" commands.
If input is not waiting for select(), writing to the wakeup pipe is
wasteful, and, if there are many wakeups, might even block the wakeup
threads if the pipe gets full.
However, if it's waiting for select(), the wakup pipe must be used to
unblock the waiting thread. Actually there's a small race condition: we
might determine that the main thread is in select(), and write to the
wakeup pipe (whether we do this while unlocked or locked doesn't really
matter). Then, the main thread might leave select() before reading from
the wakup pipe. This should be harmless, because at worst more wakeups
than needed happen, but never fewer.
In order to use bare mp_log contexts, I find myself creating dummy
structs (with a single "log" field) to use the MP_ERR() etc. macros,
which hardcode the idiom that a context struct has a log field. On the
other hand, just using mp_msg_log() is too much typing (and I want to
rename it to mp_msg() when the transition is done), so it seems nice to
have message printing macros that use mp_log directly.