Commit Graph

312 Commits

Author SHA1 Message Date
wm4 cf55fa6471 player: use config parser for setting up pseudo-gui profile 2015-04-10 20:40:50 +02:00
wm4 00151e987d options: fix run length escape case in config file parser
Oops.
2015-04-04 01:15:11 +02:00
wm4 9ea0590371 options: rewrite config file parser
The format doesn't change. Some details are different, though. For
example, it will now accept option values with spaces even if they're
not quoted. (I see no reason why the user should be forced to add
quotes.)

The code is now smaller and should be much easier to extend. It also
can load config from in-memory buffers, which might be helpful in the
future.

read_file() should eventually be replaced with stream_read_complete().
But since the latter function may access options under various
circumstances, and also needs access to the mpv_global struct, there
is a separate implementation for now.
2015-04-04 01:04:04 +02:00
wm4 5a2825ec35 video: cleanup stereo mode parsing
Use OPT_CHOICE_C() instead of the custom parser. The functionality is
pretty much equivalent.

(On a side note, it seems --video-stereo-mode can't be removed, because
it controls whether to "reduce" stereo video to mono, which is also the
default. In fact I'm not sure how this should be handled at all.)
2015-04-02 23:54:08 +02:00
wm4 9e98702493 options: fix --geometry to string conversion
Fixes #1744.
2015-04-01 22:32:34 +02:00
wm4 00230fab6a options: make --video-rotate use range 0-360
Include 360 in the range and don't stop at 359. This makes cycling
through the range in 90° steps less awkward.
2015-03-31 00:09:03 +02:00
wm4 27715b7dd1 video: move colorspace overrides to vf_format, simplify
Remove the colorspace-related top-level options, add them to vf_format.
They are rather obscure and not needed often, so it's better to get them
out of the way. In particular, this gets rid of the semi-complicated
logic in command.c (most of which was needed for OSD display and the
direct feedback from the VO). It removes the duplicated color-related
name mappings.

This removes the ability to write the colormatrix and related
properties. Since filters can be changed at runtime, there's no loss of
functionality, except that you can't cycle automatically through the
color constants anymore (but who needs to do this).

This also changes the type of the mp_csp_names and related variables, so
they can directly be used with OPT_CHOICE. This probably ended up a bit
awkward, for the sake of not adding a new option type which would have
used the previous format.
2015-03-31 00:09:03 +02:00
wm4 205a2ef169 csputils: unify names for colorspace/etc. names 2015-03-31 00:09:03 +02:00
wm4 8fff125422 RPI support
This requires FFmpeg git master for accelerated hardware decoding.
Keep in mind that FFmpeg must be compiled with --enable-mmal. Libav
will also work.

Most things work. Screenshots don't work with accelerated/opaque
decoding (except using full window screenshot mode). Subtitles are
very slow - even simple but huge overlays can cause frame drops.

This always uses fullscreen mode. It uses dispmanx and mmal directly,
and there are no window managers or anything on this level.

vo_opengl also kind of works, but is pretty useless and slow. It can't
use opaque hardware decoding (copy back can be used by forcing the
option --vd=lavc:h264_mmal). Keep in mind that the dispmanx backend
is preferred over the X11 ones in case you're trying on X11; but X11
is even more useless on RPI.

This doesn't correctly reject extended h264 profiles and thus doesn't
fallback to software decoding. The hw supports only up to the high
profile, and will e.g. return garbage for Hi10P video.

This sets a precedent of enabling hw decoding by default, but only
if RPI support is compiled (which most hopefully it will be disabled
on desktop Linux platforms). While it's more or less required to use
hw decoding on the weak RPI, it causes more problems than it solves
on real platforms (Linux has the Intel GPU problem, OSX still has
some cases with broken decoding.) So I can live with this compromise
of having different defaults depending on the platform.

Raspberry Pi 2 is required. This wasn't tested on the original RPI,
though at least decoding itself seems to work (but full playback was
not tested).
2015-03-29 16:09:56 +02:00
wd0 38b05daf7d parse_commandline: fail gracefully on bad args
Args of zero length (i.e. --=) now display a proper error message.

Signed-off-by: wm4 <wm4@nowhere>
2015-03-29 13:44:34 +02:00
wm4 4f7abd5e43 m_config: remove assertion for option names with length 0
There's actually no reason why we should assert. It's unexpected and
"should" not happen, but actually there are several ways to make it
happen.

Still, add a check m_config_get_co(), to avoid matching pseudo-entries
with no name.
2015-03-29 13:44:34 +02:00
wm4 81a63545a0 options: add conversion to string for geometry option types
Pretty messy, which is why it wasn't done at first. (Also, I'd really
like to have simpler syntax and semantics for this damn option, but who
knows when this will happen.)

Fixes #1705.
2015-03-24 21:50:35 +01:00
wm4 9b5a7241e8 input: remove Linux joystick support
Why did this exist in the first place? Other than being completely
useless, this even caused some regressions in the past. For example,
there was the case of a laptop exposing its accelerometer as joystick
device, which led to extremely fun things due to the default mappings of
axis movement being mapped to seeking.

I suppose those who really want to use their joystick to control a media
player (???) can configure it as mouse device or so.
2015-03-24 16:04:44 +01:00
wm4 1e659a9f0f input: remove classic LIRC support
It's much easier to configure remotes as X11 input devices.
2015-03-24 16:04:44 +01:00
wm4 53f24ac5ad audio: prefer libdcadec by default if present
If you enable this library in FFmpeg, you probably really want it to be
used.
2015-03-23 18:46:26 +01:00
wm4 68b71346ec m_option: remove dead initialization 2015-03-23 18:17:38 +01:00
wm4 ab37a77b36 m_property: memcpy(ptr, NULL, 0) is undefined 2015-03-23 18:02:28 +01:00
wm4 9b77666783 options: introduce --cache=yes choice
I think this is what I alwass missed ever since I found the MPlayer
cache options: a way to enable the cache on local files with the default
settings, whatever they are.
2015-03-12 23:51:41 +01:00
wm4 1eeeab2e14 cache: bump default size to 150MB
(Well, almost 150MB.)
2015-03-12 23:43:45 +01:00
Philip Sequeira 6172e843cd options: add M_OPT_FILE to new options that are missing it
Fixes shell completion.
2015-03-07 22:19:38 +01:00
wm4 90496f3088 player: fix operation if command line is empty
main() being called with argc==0 is probably possible. Fix by skipping
the program name early. (I already changed and reverted this once, but
this time we make sure that it's less likely to confuse the skipped argv
with main()'s argv by naming it "options".)
2015-03-06 11:31:05 +01:00
wm4 dcabceb626 player: minor simplification
argv is always terminated with a NULL, so we don't need to drag argc
along. Simplifies the following commit a little bit.
2015-03-05 10:57:38 +01:00
wm4 f447179c59 options: add flag option type 2015-03-04 17:28:42 +01:00
wm4 85bf102f54 win32: fix some more -Wparentheses warnings
Stupid compiler.

For decode_surrogate_pair(), I changed the order of evaluation; it
shouldn't matter, but this order is more readable in my opinion.
2015-03-04 17:28:41 +01:00
wm4 1eb533afb3 options: handle choice -> flag fallback automatically
In the past it happened quite often that flag options (yes/no) were
changed to choice options (yes/no/some more). The problem with this was
that while flag options don't need a parameter, this wasn't the case
with choice options. A hack was introduced to compensate for this:
setting M_OPT_OPTIONAL_PARAM on the option, and an empty string ("") was
added as choice, so that the choice could be used like a flag. So, for
example, "--mute" would set the choice "".

Fix this by 1. not requiring a parameter if there's a "yes" choice, and
2. redirect an empty parameter to "yes". The effect is that a choice
option with the choices ["yes", "no"] is pretty much equivalent to a
flag option.
2015-02-27 18:31:24 +01:00
wm4 b143102f6d options: minor simplification in flag option parser 2015-02-27 18:17:46 +01:00
wm4 b7bb0de1d9 demux: bump default demuxer queue sizes
Now that we have fast stream switching, we can bump these sizes, as the
queues cause no delay in switching anymore.

Of course, the fast stream switching works for mkv and mp4 only. Other
formats will incur a quite terrible delay especially in network mode,
which this commit changes to 10 seconds. Let's see if someone
complains...
2015-02-27 12:44:40 +01:00
Thiago Kenji Okada 633147c959 ytdl: add "--ytdl-params" option
This option allows the user to pass non-supported options directly to
youtube-dl, such as "--proxy URL", "--username USERNAME" and
'--password PASSWORD".

There is no sanity checking so it's possible to break things (i.e.
if you pass "--version" mpv exits with random JSON error).

Signed-off-by: wm4 <wm4@nowhere>
2015-02-25 22:32:48 +01:00
wm4 1cac7d1a65 demux: add a demux_open_url() function
Often stream and a demuxer are opened at the same time. Provide a
function for this and replace most of its uses.
2015-02-20 21:56:55 +01:00
wm4 d34eabe286 m_config: log options set by the client API too 2015-02-16 20:04:31 +01:00
wm4 2308b3a2a6 sub: mess with styling defaults, change --ass-use-margins behavior
Now --ass-use-margins doesn't apply to normal subtitles anymore. This is
probably the inverse from the mpv behavior users expected so far, and
thus a breaking change, so rename the option, that the user at least has
a chance to lookup the option and decide whether the new behavior is
wanted or not.

The basic idea here is:
- plain text subtitles should have a certain useful defalt behavior,
  like actually using margins
- ASS subtitles should never be broken by default
- ASS subtitles should look and behave like plaintext subtitles if
  the --ass-style-override=force option is used

This also subtly changes --sub-scale-with-window and adds the --ass-
scale-with-window option. Since this one isn't so important, don't
bother with compatibility.
2015-02-16 20:04:29 +01:00
wm4 b63503db04 options: mark some more options as runtime-settable
Most of these are in the category of options which can be changed
without issues, but which will not take effect immediately.
2015-02-16 20:04:05 +01:00
wm4 4c283d5f8d osd: make it possible to have different subtitle vs. OSD defaults
Until now, they used exactly the same defaults for the styling options.
The defaults were shared, so it was impossible to have different
defaults. Change this. This requires duplicating the full default
struct, even for settings that are the same. The list of options is
still shared, though.
2015-02-16 20:03:56 +01:00
wm4 a27aa68dd3 player: undeprecate 'config' files
Actually, it's pretty simple to look for multiple filenames at once,
since mp_find_all_config_files() is already a bit "special" anyway.

See #1569. Reverts most of commit db167cd4 (keeps osx-bundle.conf).
2015-02-15 14:28:49 +01:00
wm4 aee0978d50 player: add a --loop=force mode
Requested. See manpage additions.

This also makes the magical loop_times constants slightly saner, but
shouldn't change the semantics of any existing --loop option values.
2015-02-12 22:41:45 +01:00
wm4 f3ae845fd2 options: add --network-timeout
Not quite sure if this actually works as intended.

Fixes #1566.
2015-02-06 17:01:35 +01:00
wm4 ffe894ec0a options: change --msg-level option
Make it accept "," as separator, instead of only ":". Do this by using
the key-value-list parser. Before this, the option was stored as a
string, with the option parser verifying that the option value as
correct. Now it's stored pre-parsed, although the log levels still
require separate verification and parsing-on-use to some degree (which
is why the msg-level option type doesn't go away).

Because the internal type changes, the client API "native" type also
changes. This could be prevented with some more effort, but I don't
think it's worth it - if MPV_FORMAT_STRING is used, it still works the
same, just with a different separator on read accesses.
2015-02-06 16:48:52 +01:00
wm4 1a38741dce options: allow ":" as separator in key-value lists
Before this, unquoted occurrences of ":" lead to parsing errors. There's
no reason to reject it, especially since the traditional MPlayer syntax
uses ":" as separator. (Which is also the reason why ":" was rejected
before: the parser shares this code for handling splitting/quoting, and
we merely checked explicitly whether the option was split on ",".)
2015-02-06 15:42:12 +01:00
wm4 cfd3d5b520 player: do not autoload audio with audio files, enable autoloading
Autoload external audio files only if there's at least a video track
(which is not coverart pseudo-video).

Enable external audio file autoloading by default. Now that we actively
avoid doing stupid things like loading an external audio file for an
audio-only file, this should be fine.

Additionally, don't autoload subtitles if a subtitle is played.
Although you currently can't play subtitles without audio or video,
it's disturbing and stupid that the player might load subtitle files
with different extension and then fail.
2015-02-05 22:14:17 +01:00
wm4 9248f75853 options: allow things like --geometry=x50
Although the use is somewhat questionable, it seems strange that e.g.
--geometry=50% works (and sets the width only), but setting the height
only in a similar manner does not work.
2015-02-04 23:15:14 +01:00
wm4 c3c714b059 player: remove --fixed-vo
In ancient times, this was needed because it was not default, and many
VOs had problems with it. But it was always default in mpv, and all VOs
are required to deal with it. Also, running --fixed-vo=no is not useful
and just creates weird corner cases. Get rid of it.
2015-02-03 23:11:08 +01:00
wm4 de81cb07f4 options: allow more options to be changed at runtime
This allows setting these options directly (without going through
properties, or with going through the "options/" property). The
documented restrictions apply to all of these: changes do not get
immediately applied, unlike with corresponding properties.

This is in reaction to #1548.
2015-02-03 23:11:08 +01:00
wm4 2c22fcd350 options: fix parsing for options/af and options/vf
Basically, the declared option name and the name passed to the
parse_obj_settings_list() must be the same.

Fixes the issue addressed in #1550, but differently.
2015-02-03 13:40:55 +01:00
wm4 c07e046bfa player: add external audio file auto-loading
Apparently some people want this. Not enabled by default.

Fixes #967.
2015-02-02 21:23:12 +01:00
wm4 cf8fa2bdd4 options: slightly improve help output for choice and flag options 2015-02-02 18:07:37 +01:00
wm4 9b8d3acc8b options: list correct default value for --screenshot-template
Make the default value part of the option metadata, instead of doing
this in the screenshot code. Makes more sense with --list-options and
the command.c option metadata properties.
2015-01-26 11:38:23 +01:00
wm4 96f7c96da0 msg: add --log-file option
This allows getting the log at all with --no-terminal and without having
to retrieve log messages manually with the client API. The log level is
hardcoded to -v. A higher log level would lead to too much log output
(huge file sizes and latency issues due to waiting on the disk), and
isn't too useful in general anyway. For debugging, the terminal can be
used instead.
2015-01-26 11:31:02 +01:00
wm4 f033eaff9b options: make --hls-bitrate=max the default
The previous default ("no") seemed to be equivalent to "min" in practice
(though it might depend on the website, which is even worse).

Better just select the best stream by default.
2015-01-26 03:58:13 +01:00
wm4 d9609c792c options: don't list removed options 2015-01-25 00:36:40 +01:00
wm4 6b24cb2756 win32: remove check for SetPriorityClass()
This function is always available, which is reflected by the fact that
the configure check doesn't actually bother to check for its existence.
Instead, MinGW and Cygwin imply it. The check was probably "needed" when
the priority code was still in a separate source file.

Remove the check, and use _WIN32 for testing for the win32 API (in a
bunch of other places too).
2015-01-20 15:18:51 +01:00