Commit Graph

60 Commits

Author SHA1 Message Date
wm4 ad05e76c57 msg: handle vsnprintf errors
I don't know under which circumstances this can error (other than a
broken format string). It seems it won't return an error code on I/O
errors, so maybe broken format strings are the only case. Either way,
don't continue if an error is returned.
2013-12-20 21:07:58 +01:00
wm4 e9e68fc399 msg: use a global lock to synchronize printing
We have certain race conditions coming from doing multiple fprintf()
calls (setting up colors etc.). I'm not sure whether it would be worth
changing to code such that we do only one fprintf() call (and assume
this synchronizes access), but considering it would be hard to do
(Windows compatibility, ...), and that stdio uses per FILE locks anyway,
this is simpler and probably not less efficient. Also, there's no
problem handling the weird statusline special case this way.

Note that mp_msg_* calls which are silent won't acquire the lock, and
acquiring the lock happens on actual output only (which is slow and
serialized anyway).
2013-12-20 21:07:58 +01:00
wm4 6a8fc3f5e3 msg: change --msglevel, reduce legacy glue
Basically, reimplement --msglevel. Instead of making the new msg code
use the legacy code, make the legacy code use the reimplemented
functionality.

The handling of the deprecated --identify switch changes. It temporarily
stops working; this will be fixed in later commits.

The actual sub-options syntax (like --msglevel-vo=...) goes away, but I
bet nobody knew about this or used this anyway.
2013-12-20 21:07:57 +01:00
wm4 5162c2709e msg: cosmetic changes
In particular, condense the legacy MSGT_ defines and move them to the
end of the file.
2013-12-20 21:07:57 +01:00
wm4 591a6722d2 msg: change hack to silence command line pre-parse error messages
mp_msg_levels[] will go away.
2013-12-20 21:07:57 +01:00
wm4 78292058cc terminal: remove separate formatting for --msgmodule
Instead, --msgmodule uses the same formatting as -v.
2013-12-20 21:07:57 +01:00
wm4 4d4b822171 terminal: abstract terminal color handling
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.
2013-12-20 21:07:57 +01:00
wm4 833eba5304 terminal: move SIGTTOU signal handler setup code
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.
2013-12-19 21:31:33 +01:00
wm4 25d4ae74f1 Rename getch2....c/h to terminal....c/h
"getch2" really tells nothing about what the heck this code does. It'd
be even worse when moving the rest of terminal handling code there.
2013-12-19 21:31:27 +01:00
wm4 0112143fda Split mpvcore/ into common/, misc/, bstr/ 2013-12-17 02:39:45 +01:00