1
mirror of https://github.com/mpv-player/mpv synced 2024-07-11 23:47:56 +02:00
Commit Graph

43761 Commits

Author SHA1 Message Date
wm4
b2c84a91b6 options: deprecate --vo-defaults
With the conversion from sub-options to global options, this becomes
useless. This change also comes slightly too soon, because not all VOs
have been changed yet.
2016-09-02 21:21:47 +02:00
wm4
849480d0c9 vo_opengl: deprecate sub-options, add them as global options
vo_opengl sub-option were always rather annoying to handle. It seems
better to make them global options instead. This is simpler and easier
to use. The only disadvantage we are aware of is that it's not clear
that many/all of these new global options work with vo_opengl only.

--vo=opengl-hq is also deprecated.

There is extensive compatibility with the old behavior. One exception is
that --vo-defaults will not apply to opengl-hq (though with opengl it
still works). vo-cmdline is also dysfunctional and will be removed in a
following commit.

These changes also affect opengl-cb.

The update mechanism is still rather inefficient: it requires syncing
with the VO after each option change, rather than batching updates.
There's also no granularity (video.c just updates "everything", and if
auto-ICC profiles are enabled, vo_opengl.c will fetch them on each
update).

Most of the manpage changes were done by Niklas Haas <git@haasn.xyz>.
2016-09-02 21:21:47 +02:00
wm4
a07dae57e3 vo_opengl: rename 3dlut-size to icc-3dlut-size
Not documenting this yet, because a later commit will change all the
options anyway.
2016-09-02 15:58:40 +02:00
wm4
72c6bf1345 m_config: add some convenience functions
To be used by the following commits.
2016-09-02 15:58:15 +02:00
wm4
2c917219cf vo: use new option update mechanism
This is still rather basic.

run_reconfig() and run_control() update the options because it's needed
for panscan (and other video scaling options), and fullscreen, border,
ontop updates. In the old model, these options could be accessed only
while both playback thread and VO threads were locked  (i.e. during
synchronous calls like vo_control()), so this should be sufficient in
order not to miss any updates. In the future, a more fine-grained update
mechanism could be added to handle these updates "exactly".

x11_common.c contains an evil hack, as I see no reasonable way to handle
this properly. The VO thread can't "lock" the main thread, so this is
not simple.
2016-09-02 15:50:54 +02:00
wm4
423e53ba0b m_config: introduce basic mechanism to synchronize global option updates
The way option runtime changes are handled is pretty bad in the current
codebase. There's a big option struct (MPOpts), which contains almost
everything, and for which no synchronization mechanism exists. This was
handled by either making some options read-only after initialization,
duplicating the option struct, using sub-options (in the VO), and so on.

Introduce a mechanism that creates a copy of the global options (or
parts of it), and provides a well-defined way to update them in a
thread-safe way.

Most code can remain the same, just that all the component glue code has
to explicitly make use of it first.

There is still lots of room for improvement. For example, the update
mechanism could be better.
2016-09-02 15:50:40 +02:00
wm4
f2e25e9e1f player: don't send win32 taskbar update before window is created
If the win32 taskbar progress update is sent before the VO window is
created, then w32_common.c will ignore it because the actual taskbar
object was not created yet. (At least this is what I suspect happens.
The window is already created at this point, but not mapped.)

Hopefully fix this is fixed by creating until after the window is
created, i.e. the VO has been configured at least once.

Untested (who wants to boot into Windows just to wait until it has
applied all of its stupid updates).

Also not explicit is whether update_vo_playback_state() will actually be
called soon enough in all cases. It probably is.

Probably fixes #3482.
2016-09-02 15:01:09 +02:00
wm4
b2657814c9 vo_opengl: minor renderer option access refactor
Reduce accesses to the renderer opts in vo_opengl.c, and instead add
accessors for them to video.c.

I suppose gamma and maybe icc-auto could be moved to vo_opengl.c
options. Also, the output colorspace could probably be adjusted to what
is really used, not just the options (although it's possible that this
commit changes this, due to video.c mutating its own copy of the options
according to actual renderer capapbilities).

But don't deal with this now.
2016-09-02 14:50:03 +02:00
wm4
4fa6bcbb90 m_config: add helper function for initializing af/ao/vf/vo suboptions
Normally I'd prefer a bunch of smaller functions with fewer parameters
over a single function with a lot of parameters. But future changes will
require messing with the parameters in a slightly more complex way, so a
combined function will be needed anyway. The now-unused "global"
parameter is required for later as well.
2016-09-02 14:49:34 +02:00
Jeong Woon Choi
875aeb0f5c charset_conv: Use CP949 instead of EUC-KR
iconv distinguishes between euc-kr and cp949, while libguess
and libuchardet doesn't (only returns euc-kr). EILSEQ occurs
when the input encoding of iconv is set to euc-kr and if the subs
contain letters not included in euc-kr. Since cp949 is a extension
of euc-kr, choose cp949 instead.

Signed-off-by: wm4 <wm4@nowhere>
2016-09-02 14:46:11 +02:00
wm4
c72df80460 DOCS: move libmpv stub to manpage
And replace the sort-of duplicated explanations.

(It's a bit funny to use weblinks to the generated web version of itself
instead of proper RST links, but I think I don't care.)
2016-09-02 09:53:11 +02:00
wm4
907bf83297 manpage: mention the client API/interface change logs
Also, I'm seeing that we still have mplayer-changes.rst - add a warning
that it's outdated.
2016-09-02 09:48:35 +02:00
wm4
3659f9e416 command: deprecate "cache" property, replace with "cache-percent"
The --cache option and cache property conflict, so one of them has to be
renamed. The option is probably used frequently, so initiate
deprecation/rename of the property.
2016-09-02 09:42:19 +02:00
Niklas Haas
ce05413a87 vo_opengl: remove pre/post/scale-shaders
Deprecated in favor of user-shaders, which are functionally equivalent
but superior. (Except in the case of scaler-shader, which has no direct
replacement, but it turned out to be a very unpopular feature either way
- most custom scalers don't fit into the mpv kernel infrastructure and
are therefore implemented as user shaders either way)

Signed-off-by: wm4 <wm4@nowhere>
2016-09-02 09:29:16 +02:00
wm4
453fea87fa client API: create core thread at an earlier time
Create the core thread right in mpv_create(), and reduce what
mpv_initialize() does further. This is simpler, and allows the API user
to do more before calling mpv_initialize(). The latter is not the real
goal, rather we'd like mpv_intialize() reduced to do almost nothing. It
still does a lot, but nothing truly special anymore that is absolutely
required for basic mpv workings.

One thing we want the user to be able to do is changing properties
before mpv_initialize() to reduce the special status of
mpv_set_option().
2016-09-01 21:55:21 +02:00
wm4
1393d79417 command: fix or document some property/option consistency issues
Make some existing properties behave more like options. This mostly
means they don't deny access if the associated component is not active,
but redirects to the option.

One kind of fishy change is that we apply --brightness etc. only if
they're not set to the default value. This won't necessarily work with
--vo=xv, but affects only cases where 1. the Xv adapter has been changed
to non-defaults, and 2. the user tries to reset them with mpv by passing
e.g. --brightness=0. We don't care about Xv, and the noted use-case is
dumb, so this change is acceptable.
2016-09-01 20:57:33 +02:00
wm4
192a7344d9 command: remove 2 deprecated properties
They were delcared to be removed in mpv 0.20.0, and the next release
will be 0.21.0.
2016-09-01 20:01:29 +02:00
wm4
e4e1dc3c79 command: rename/deprecate some conflicting property names
These conflict with options of the same name, and prevent a "full"
unification. Not addressed is the "cache" property, and possibly a few
properties that behave differently from their equivalent options.
2016-09-01 20:01:02 +02:00
wm4
d32bee5f01 command: add options to property list
Now options are accessible through the property list as well, which
unifies them to a degree.

Not all options support runtime changes (meaning affected components
need to be restarted for the options to take effects). Remove from the
manpage those properties which are cleanly mapped to options anyway.
From the user-perspective they're just options available through the
property interface.
2016-09-01 20:00:43 +02:00
wm4
17dbb39dec m_config: fix "no-" option handling with sub-options
E.g. --vf=scale=no-arnd didn't work, because it didn't recognize no-arnd
as flag option.

The top-level command line parser is not affected by this, because it
uses the result of m_config_option_requires_param() differently and
assumes unknown parameters do not necessarily require a parameter. (The
suboption parser can't do this.)
2016-09-01 14:29:08 +02:00
wm4
6b4f560f3c vo, ao: disable positional parameter suboptions
Positional parameters cause problems because they can be ambiguous with
flag options. If a flag option is removed or turned into a non-flag
option, it'll usually be interpreted as value for the first sub-option
(as positional parameter), resulting in very confusing error messages.
This changes it into a simple "option not found" error.

I don't expect that anyone really used positional parameters with --vo
or --ao. Although the docs for --ao=pulse seem to encourage positional
parameters for the host/sink options, which means it could possibly
annoy some PulseAudio users.

--vf and --af are still mostly used with positional parameters, so this
must be a configurable option in the option parser.
2016-09-01 14:21:32 +02:00
wm4
ec3c428e5f stream_cb: remove broken cast
seek_fn is supposed to return the new file offset, or a negative error
code. Our code doesn't use the offset, and only wants to know if any
errors happened. The int cast is completely broken and might treat a
successful seek as failed depending on whether the sign bit will be set.
2016-08-31 22:25:06 +02:00
wm4
e22ae2cba0 m_config: remove an unused function
Well, almost unused.
2016-08-31 22:22:21 +02:00
quilloss
aae47146a7 vo: update w32_common left out by 4d75514 2016-08-31 22:19:55 +02:00
wm4
7539928c1c m_config: remove some aliasing checks
We strictly assume no aliasing (the previous commit removed the last
case), so remove the checks.
2016-08-31 22:17:24 +02:00
wm4
c55d859920 m_option: replace --no-video-aspect alias
Instead, add a hacky OPT_ASPECT option type, which only exists to accept
a "no" parameter, which in combination with the "--no-..." handling code
makes --no-video-aspect work again.

We can also remove the code in m_config.c, which only existed to make
"--no-aspect" (a deprecated alias) to work.
2016-08-31 22:17:21 +02:00
wm4
2057209057 m_config: deprecate top-level suboptions
This is a really old weird MPlayer feature. While the MPlayer requires
you to use the sub-option syntax in these cases, mpv "flattens" them to
normal options. The still-supported alternate sub-option syntax remains
a weird artifact that hopefully nobody uses.

For example you can do "-sub-text font=Foo:color=0.5" instead of using
"--sub-text-font=Foo --sub-text-color=0.5". For --sub-text this is an
accidental feature, but it used to be documented for
--demuxer-rawaudio and some others.

This should just be removed, but for now only print a warning to preempt
complaints from weird users wanting this feature back.
2016-08-31 22:16:43 +02:00
wm4
b10dcecf7d client API: deprecate "no-..." option handling
The client API can do this (and there are apparently some libmpv using
projects which rely on this). But it's just unnecessary bloat as it
requires a separate code path from the option parser. It would be better
to remove this code. Formally deprecate it, including API bump and
warning in the API changes file to make it really clear.
2016-08-31 22:16:43 +02:00
wm4
7dde096d8a m_config: introduce and use OPT_ALIAS for some options
OPT_ALIAS redirects the options at a higher level, instead of
introducing "duplicate" options with different name but same backing
storage. This uses the OPT_REPLACED mechanisms - only the deprecation
warning had to be made conditional. Note that e.g. --no-video still
works, because the "--no-..." redirection and OPT_ALIAS are orthogonal.

The deprecated --sub -> --sub-file alias had to be dropped, because it
essentially conflicts with --no-sub. If anyone complains, this could
probably still be undone by letting m_config_find_negation_opt do a
special mapping for --no-sub. (Which would be dumb, but simple and
effective.)
2016-08-31 22:16:19 +02:00
wm4
e024906408 m_config: handle --no-... options differently
Instead of adding "no-"-prefixed aliases to the internal option list,
which will act like normal options, do it in the parsing stage. This
turns out to be simpler (and cheaper), and avoids adding aliased
options.
2016-08-31 16:45:58 +02:00
wm4
ce8dae3f0d m_property: remove pointless explicitly clamping
This is basically dead code, and even the commit that added this code 4
years ago said that this should be for debugging only.

(Though it is possible that the clamp callback was used for something
else, and then unused again. Also, some of the clamping code remains and
is used for internal checking, e.g. clamp_double().)
2016-08-31 15:31:51 +02:00
wm4
f519887fe7 input: use OPT_REPLACED for an old option alias 2016-08-31 14:46:21 +02:00
wm4
7614f2b3a6 vo_xv: remove an aliased option
Trying to get rid of them, and no-colorkey is an instance of it. Kill
it.
2016-08-31 13:38:14 +02:00
wm4
4d75514321 vo: change messy handling of fullscreen and other flags
Before this commit, all VOs had to toggle the option flag themselves,
now command.c does it.

I can't really comprehend why it required every VO to do this manually.
Maybe it was for rejecting the property/option change if the VO didn't
support a specific capability. But then it could have checked the VOCTRL
result. In any case, I don't care, and successfully changing the
property without doing anything (With some VOs) is fine too. Many things
work this way now, and it's simpler overall.

This change will be useful for cleaning up VO option handling.
2016-08-30 23:52:16 +02:00
wm4
af1379c43d options: make mp_vo_opts options an actual sub-option group
Just a minor refactor along the planned option change. This commit will
make it easier to update (i.e. copy) the VO options without copying
_all_ options. For now, behavior should be equivalent, though.

(The VO options were put into a separate struct quite early - when all
global variables were removed from the source code. It wasn't clear
whether the separate struct would have any actual purpose, but it seems
it will now. Awesome, huh.)
2016-08-30 23:50:57 +02:00
wm4
e65a8d7b61 m_config: pass parent option in m_config_add_option()
Instead of just the parent name. This is a minor refactor as preparation
for other things.
2016-08-30 23:48:42 +02:00
wm4
5f88e6a0db m_config: rename is_generated to is_hidden
More appropriate. Originally it really was for automatically added
options, but now it even needed some stupid comments to indicate that
it was used for simply hiding options.
2016-08-30 23:47:09 +02:00
wm4
3bb134969e m_option: remove M_OPT_TYPE_DYNAMIC flag
It's actually redundant with whether m_option_type.free is set. Some
option types were flagged inconsistently. Its only use was for running
an additional sanity check without any real functionality.
2016-08-30 23:45:58 +02:00
wm4
6f6d2eb770 command: cosmetics: fix some minor whitespace mistakes 2016-08-30 23:45:20 +02:00
wm4
f3b3702025 player: make --force-window work with opengl-cb
No reason not to? This probably avoids surprises if someone really tries
to combine them.
2016-08-30 23:44:28 +02:00
wm4
d223959cda player: slightly adjust framerate guessing heuristic
Some files not only use rounded timestamps, but they also do it
incorrectly. They may jitter between up to 4 specific frame durations.
In this case, I found a file that mostly used 41ms and 42ms, but also
had 40ms and 43ms outliers (often but not always following each other).

This breaks the assumption of the framerate estimation code that the
frame duration can deviate up to 1ms. If it jitters around 4 possible
frame durations, the maximum deviation is 3ms. Increase it accordingly.

The change might make playback of "true VFR" video via display-sync mode
worse, but it's not like it was particularly good in the first place.

Also, the check whether to usen the container FPS needs to be stricter.
In the worst case, num_dur is 1, which doesn't really indicate any
evidence that the framerate is correct. Only if there are "enough"
frames the deviation check will become meaningful. 16 is an arbitrary
value that has been designated "enough" by myself.

Also otuput the frame duration values for --dump-stats.
2016-08-29 17:15:06 +02:00
Rostislav Pehlivanov
ae3bbc4f63 Merge pull request #3467 from atomnuker/master
wayland: reject resize events with either dimension being 0
2016-08-29 13:40:55 +01:00
Rostislav Pehlivanov
cb2cb540f4 wayland: reject resize events with either dimension being 0
Newer versions of mutter/gnome now ask mpv to resize to 0 by 0 pixels.
2016-08-29 13:21:54 +01:00
wm4
3e0d4de988 vo_opengl: explicitly check for GL errors around framebuffer depth check
It seems like many GL implementations (including Mesa) choke on this,
while others are fine. We still think that this use of the GL API is
allowed by the standard (at least in the Mesa case), so to reduce
confusion, explicitly check the "controversial" calls, and use an
appropriate error message.
2016-08-29 14:02:24 +02:00
wm4
251ecf6e4b sd_lavc: always set decoder timebase
Like it's done for audio and video. Just to be uniform.

I'm sorry for deleting the anti-ffmpeg vitriol. It's still all true, but
since we decided to always set the timebase, the crappiness is isolated
to FFmpeg internals.
2016-08-29 13:15:54 +02:00
wm4
edbb8f6286 vd_lavc: always force milliseconds for MMAL
This libavcodec wrapper should rescale the API timestamps to whatever
it internally needs, but it doesn't yet. So restore this code.
2016-08-29 13:15:44 +02:00
wm4
0110b738d5 vd_lavc, ad_lavc: set pkt_timebase, not time_base
These are different AVCodecContext fields. pkt_timebase is the correct
one for identifying the unit of packet/frame timestamps when decoding,
while time_base is for encoding. Some decoders also overwrite the
time_base field with some unrelated codec metadata.

pkt_timebase does not exist in Libav, so an #if is required.
2016-08-29 12:46:12 +02:00
wm4
bda614bfd8 m_config: profile option values can be NULL
Sigh.
2016-08-29 09:30:39 +02:00
wm4
f42e4374d5 command: export profile list as a property
Targeted at scripts, which can do whatever they want with it. This comes
with the promise that they could get randomly broken any time.

See #977.
2016-08-28 19:46:54 +02:00
wm4
a9a55ea7f2 misc: add some annoying mpv_node helpers
Sigh.

Some parts of mpv essentially duplicate this code (with varrying levels
of triviality) - this can be fixed "later".
2016-08-28 19:39:05 +02:00