Commit Graph

793 Commits

Author SHA1 Message Date
wm4 ce6fb9175c options: make --no-config block all auto-loaded configuration files
Until now, the --no-config was explicitly checked in multiple places to
suppress loading of config files.

Add such a check to the config path code itself, and refuse to resolve
_any_ configuration file locations if the option is set.

osc.lua needs a small fixup, because it didn't handle the situation when
no path was returned. There may some of such cases in the C code too,
but I didn't find any on a quick look.
2014-02-14 14:01:27 +01:00
wm4 8437356b6c options: add --no-terminal switch
Mostly useful for internal reasons. This code will be enabled by
default if mpv is started via the client API.
2014-02-10 00:14:52 +01:00
wm4 8ff1a339e9 quvi: disable subtitle fetching by default
This is slow and unreliable, basically unusable.
2014-01-31 00:46:52 +01:00
wm4 36f6e6b826 options: alternative way to specify color options
Try to make it more intuitive by not requiring hex values. The new way
uses float values in the range 0.0-1.0, separated by '/' (':' was
suggested, but that wouldn't allow color options in sub-options).

Example: --osd-color=1.0/0.0/0.0/0.75

Using the range 0.0-1.0 has the advantage that it could be easily
extended to colors beyond 8 bit.

Details see manpage.

Suggestions for alternative syntax or value ranges are welcome, but be
quick with it.
2014-01-31 00:41:54 +01:00
wm4 d3b5643589 lua: add a --lua-opts option, which can be queried by scripts
The values set by this new option can be queried by Lua scripts using
the mp.getopt() function. The function takes a string parameter, and
returns the value of the first key that matches. If no key matches, nil
is returned.
2014-01-16 23:06:41 +01:00
wm4 82067e6ac3 options: add key/value pair list option type 2014-01-16 23:06:41 +01:00
wm4 99ee43b33b msg: move special declarations to msg_control.h
While almost everything uses msg.h, the moved definitions are rarely
needed by anything.
2014-01-16 23:06:40 +01:00
wm4 45641378a2 player: add --term-osd-bar, which shows a status bar on the terminal
Feature request from github issue #451. Disabled by default, will
probably stay this way.
2014-01-15 16:14:37 +01:00
wm4 6759941fca player: redo terminal OSD and status line handling
The terminal OSD code includes the handling of the terminal status line,
showing player OSD messages on the terminal, and showing subtitles on
terminal (the latter two only if there is no video window, or if
terminal OSD is forced).

This didn't handle some corner cases correctly. For example, showing an
OSD message on the terminal always cleared the previous line, even if
the line was an important message (or even just the command prompt, if
most other messages were silenced).

Attempt to handle this correctly by keeping track of how many lines the
terminal OSD currently consists of. Since there could be race conditions
with other messages being printed, implement this in msg.c. Now msg.c
expects that MSGL_STATUS messages rewrite the status line, so the caller
is forced to use a single mp_msg() call to set the status line.

Instead of littering print_status() all over the place, update the
status only once per playloop iteration in update_osd_msg(). In audio-
only mode, the status line might now be a little bit off, but it's
perhaps ok.

Print the status line only if it has changed, or if another message was
printed. This might help with extremely slow terminals, although in
audio+video mode, it'll still be updated very often (A-V sync display
changes on every frame).

Instead of hardcoding the terminal sequences, use
terminfo/termcap to get the sequences. Remove the --term-osd-esc option,
which allowed to override the hardcoded escapes - it's useless now.

The fallback for terminals with no escape sequences for moving the
cursor and clearing a line is removed. This somewhat breaks status line
display on these terminals, including the MS Windows console: instead of
querying the terminal size and clearing the line manually by padding the
output with spaces, the line is simply not cleared. I don't expect this
to be a problem on UNIX, and on MS Windows we could emulate escape
sequences. Note that terminal OSD (other than the status line) was
broken anyway on these terminals.

In osd.c, the function get_term_width() is not used anymore, so remove
it. To remind us that the MS Windows console apparently adds a line
break when writint the last column, adjust screen_width in terminal-
win.c accordingly.
2014-01-13 20:08:13 +01:00
wm4 ad654f3803 options: remove --screenw and --screenh
Doesn't make any sense anymore. X11 (which was mentioned in the manpage)
autodetects it, and everything else ignored the option values.

Since for incomprehensible reasons the backends and vo.c still need to
exchange information about the screensize using the option fields,
they're not removed yet.
2014-01-11 18:58:07 +01:00
wm4 09bf69afdb options: don't reset pause mode when switching to next file
This basically reverts the default as set by commit 812798c5. This seems
to be a matter of taste, but personally I think keeping the pause
setting is better.
2014-01-09 21:23:19 +01:00
Andre D 7c425fb71f quvi: add option to not fetch subtitles
Signed-off-by: wm4 <wm4@nowhere>
2014-01-05 23:07:34 +01:00
wm4 2214ee8472 options: make --msglevel=help print something helpful 2014-01-01 19:42:48 +01:00
wm4 066ecfcbfb common: simplify and optimize string escape parsing
This code is shared between input.conf parser and option parser. Until
now, the performance didn't really matter. But I want to use this code
for JSON parsing too, and since JSON will have to be parsed a lot, it
should probably try to avoid realloc'ing too much.

This commit moves parsing of C-style escaped strings into a common
function, and allows using it in a way realloc can be completely
avoided, if the already allocated buffer is large enough.
2013-12-30 22:49:50 +01:00
wm4 392856ed4d vd_lavc: by default, output all frames, even corrupted ones
Set the flag CODEC_FLAG_OUTPUT_CORRUPT by default. Note that there is
also CODEC_FLAG2_SHOW_ALL, which is older, but this seems to be ffmpeg
only.

Note that whether you want this enabled depends on the user. Some might
prefer that only good frames are output, while others want the decoder
to try as hard as possible to output _anything_. Since mplayer/mpv is
rather the kind of player that tries hard instead of being "clever", set
the new default to override libavcodec's default.

A nice way to test this is switching video tracks. Since mpv doesn't
wait for the next key frame, it'll start feeding the decoder with a
packet from the middle of the stream.
2013-12-29 14:19:22 +01:00
wm4 dacb6ad98f options: simplify handling of some help options 2013-12-26 19:25:51 +01:00
wm4 f751609450 player: fix initial selection with --secondary-sid
Also, make sure that a track can't be selected twice. While this might
work in some situations, it certainly won't work with subtitles demuxed
from a stream.

Fixes #425.
2013-12-25 11:32:29 +01:00
wm4 3720b3f17d player: add --secondary-sid for displaying a second subtitle stream
This is relatively hacky, but it's Christmas, so it's ok. This does two
things: 1. allow selecting two subtitle tracks, and 2. include a hack
that renders the second subtitle always as toptitle. See manpage
additions how to use this.
2013-12-24 17:46:14 +01:00
wm4 fd081c467d options: print any options set in verbose mode
So we will know whether someone uses broken config file options when
posting a log with -v.
2013-12-23 17:30:19 +01:00
wm4 9fb0441b16 options: disable joystick by default 2013-12-23 11:35:37 +01:00
wm4 2de2b60222 path: add function to split URL into prefix and path
Used in the following commit.
2013-12-22 23:25:10 +01:00
wm4 8c0675b7d0 path: don't accept empty protocol as valid
mp_is_url("://") returned true.
2013-12-22 23:25:10 +01:00
wm4 3782fa20ed path: change mp_splitext() semantics
Including the "." in the returned extension was too inconvenient. I
think originally, the semantics were supposed to work like in Python,
but screw this.

Also, return NULL instead of "" on failure (which is what its only user
actually seems to expect).
2013-12-22 23:25:08 +01:00
wm4 e6bea0ec5a Don't include version.h from make options.c
I find this annoying. It's the reason common/version.c exists at all.

options.c did this for the user agent, which contains the version
number. Because not including version.h means you can't build the user
agent and use it in mp_default_opts anymore, do something rather awkward
in main.c to initialize the default user agent.
2013-12-22 14:35:45 +01:00
wm4 3a637d411f options: move network related options to MPOpts 2013-12-22 13:11:22 +01:00
wm4 bd5e0a2ba2 options: make --msglevel extend previous settings
Make it so --msglevel extends previous --msglevel uses, instead of
overwriting them. Do this by literally appending the --msglevel option
value to the previous one.
2013-12-22 12:18:01 +01:00
wm4 245e5b8441 msg: remove global state 2013-12-21 23:11:12 +01:00
wm4 ad2199128d path lookup functions: mp_msg conversions
There's a single mp_msg() in path.c, but all path lookup functions seem
to depend on it, so we get a rat-tail of stuff we have to change. This
is probably a good thing though, because we can have the path lookup
functions also access options, so we could allow overriding the default
config path, or ignore the MPV_HOME environment variable, and such
things.

Also take the chance to consistently add talloc_ctx parameters to the
path lookup functions.

Also, this change causes a big mess on configfiles.c. It's the same
issue: everything suddenly needs a (different) context argument. Make it
less wild by providing a mp_load_auto_profiles() function, which
isolates most of it to configfiles.c.
2013-12-21 21:43:17 +01:00
wm4 9149e2af56 playlist_parser: mp_msg conversion 2013-12-21 21:43:16 +01:00
wm4 09e588662e options: some more mp_msg conversions 2013-12-21 21:43:16 +01:00
wm4 7bdee8f35e m_option: add mp_log context to sub-module print_help callback 2013-12-21 21:43:16 +01:00
wm4 9242c34fa2 m_option: add mp_log callback to OPT_STRING_VALIDATE options
And also convert a bunch of other code, especially ao_wasapi and
ao_portaudio.
2013-12-21 21:43:16 +01:00
wm4 d8d42b44fc m_option, m_config: mp_msg conversions
Always pass around mp_log contexts in the option parser code. This of
course affects all users of this API as well.

In stream.c, pass a mp_null_log, because we can't do it properly yet.
This will be fixed later.
2013-12-21 21:05:02 +01:00
wm4 a2d144fc8f m_property: mp_msg conversions
Includes some semi-crappy hacks to avoid changing too much code for this
conversion (allowing NULL log argument for m_property_do()).
2013-12-21 21:04:21 +01:00
wm4 ed71606e65 input: rework how input sources are added
Until now, there were two functions to add input sources (stuff like
stdin input, slave mode, lirc, joystick). Unify them to a single
function (mp_input_add_fd()), and make sure the associated callbacks
always have a context parameter.

Change the lirc and joystick code such that they take store their state
in a context struct (probably worthless), and use the new mp_msg
replacements (the point of this refactoring).

Additionally, get rid of the ugly USE_FD0_CMD_SELECT etc. ifdeffery in
the terminal handling code.
2013-12-21 20:50:13 +01:00
wm4 dadf3a9a46 m_config: add custom context to includefunc callback 2013-12-21 20:50:13 +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 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 7a8207a3fb options: use M_OPT_EXIT with -V
Otherwise, output will actually be muted during pre-pase stage, and it
will exit before running it again with output enabled.
2013-12-19 21:27:09 +01:00
wm4 b97b92fe40 m_option.h: actually remove config.h include
This was supposed to be done in commit 80b34ebe.
2013-12-19 21:26:09 +01:00
wm4 80b34ebea4 m_option: don't include config.h in header
Requires a small workaround.
2013-12-18 17:12:27 +01:00
wm4 0112143fda Split mpvcore/ into common/, misc/, bstr/ 2013-12-17 02:39:45 +01:00
wm4 eb15151705 Move options/config related files from mpvcore/ to options/
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.
2013-12-17 02:07:57 +01:00