Commit Graph

47999 Commits

Author SHA1 Message Date
der richter 77d42d5532 input: add new PLAYONLY and PAUSEONLY MP_KEY key codes
since the old PLAY and PAUSE key codes cycle through the pause property,
the new key codes only explicitly set the pause property.
2020-01-26 12:09:55 +01:00
wm4 ae0520cafc client API: document srand() use 2020-01-21 17:07:40 +01:00
wm4 1ea145a9a1 player: make failure to load scripts non-fatal again
Restore the behavior from a few commits ago. I decided that it's strange
that this is fatal, since e.g. config file errors are also non-fatal.
2020-01-20 19:58:51 +01:00
wm4 65f3c7453d stream_libarchive: more broken garbage
Why the fuck am I even bothering with this crap?
2020-01-20 19:58:51 +01:00
wm4 3ef0754102 Revert "stream_libarchive: remove "old" rar volume pattern"
This reverts commit 1b0129c414.

It turns out most of the files affected by the idiotic use-case actually
use this old naming pattern, which I hoped was unused.

This means for now we'll always assume .rar files are multi-part (until
proven otherwise), but the following commit tries to fix this.
2020-01-20 19:58:51 +01:00
der richter e666546910 github: rename Bug to Issue and slightly change the question template 2020-01-20 10:12:40 +01:00
wm4 da913998d3 input: fix cycle 2nd argument stringification
Triggered the fallback code that formatted the argument as "(NULL)".
2020-01-19 20:53:26 +01:00
wm4 90c11fa729 stream_libarchive: do not require leading / in archive URLs
The / was added some time ago, because it simplifies some other things.
But there is actually no reason to reject old URLs.
2020-01-19 19:26:51 +01:00
wm4 00cdda2ae8 scripting: make player error when attempting to load unknown scripts
It's ridiculous that --script=something.dumb does not cause an error.
Make it error, and extend this behavior to the scripts/ sub-dir in the
mpv config dir.
2020-01-19 19:25:54 +01:00
wm4 ee7be62dbc player: write watch-later config even for unseekable streams
I think there was a user complaint that this does not restore the
playlist position.

There's no reason not to save the "state" for unseekable streams; what
we probably don't want is to make restoring trying to issue a seek. So
just don't save the position. (Although we probably could anyway, since
seek requests on unseekable streams are ignored now.)

Fixes: issue number forgotten, if it even exists.
2020-01-17 15:26:16 +01:00
wm4 ad1ae64251 f_autoconvert: remove subfmt conversion BS
This was used to convert e.g. P010 to NV12 within the filter chain,
which hopefully a thing that is not needed anymore. (And has been dead
code since the ANGLE "RGB" interop code was removed.)
2020-01-17 15:19:05 +01:00
wm4 044996e112 f_hwtransfer: extend vaapi whitelist with some working formats
Notably, BGR0, which is the only additional format listed as supported
by the texture mapper, results in broken colors. This is most likely not
a mpv issue, so the whitelist fulfils its purpose.
2020-01-17 15:13:23 +01:00
wm4 a500608845 f_hwtransfer: minor debug logging improvement 2020-01-17 15:10:36 +01:00
wm4 7ed6b5f44d vo_gpu: hwdec_vaapi: set correct hw_imgfmt value
As documented on struct mp_hwdec_ctx, hw_imgfmt specifies the hardware
surface wrapper format for which supported_formats is valid. If this was
not set, f_hwtransfer ignored supported_formats, and assumed all formats
were supported.
2020-01-17 15:08:46 +01:00
Avi Halachmi (:avih) 40832773c1 osc: more frequent cache updates: from 10% diff to 5% or 5s
Cache display updates, especially when it's bigger than few minute,
could have been be very infrequent to the point that one is not sure
if it updates at all.

Reduce the 10% change-threshold to 5% and add another threshold of 5s.
2020-01-14 13:15:48 +02:00
Philip Langdale 3259494d9e bash completion: only generate option list when needed
Right now we are generating the fully option list before doing
anything else. That makes filename completion significantly slower
than it was before, for no gain. It's easy to only generate the
option list when it's actually needed.

I also know I could additionally cache the option list across
invocations, but I'm not doing that yet to make testing easier.
2020-01-13 17:12:25 -08:00
Philip Langdale 4d51660195 osc: usability improvements for pseudo-csd title bar
There are two improvements here:

1) Correct the right-side padding on the title box. This was messed
   up previously because I was passing the title box width when I
   should be passing the x coordinate. I've also increased the
   spacing to separate the title from the window controls more
   clearly.

2) I'ved added a mouse tracking area over the title bar so that the
   osc doesn't disappear if you hover over the title box. This didn't
   work previously because the input area only covers the actual
   window controls. The implementation here is simplified in that
   it's only a mouse area and not an input area. This is enough to
   keep the osc visible, but it won't stop the mouse pointer
   disappearing. Fixing that requires a full input area which, for
   now, I will say isn't worth the effort.
2020-01-13 16:25:34 -08:00
Philip Langdale 9f7c271087 osc: when fullscreened, un-maximise window control should un-fullscreen
It's a bit unintuitive today when you use the un-maximise control
while fullscreened. Depending on the VO in use, this might silently
change the maximise state without any visible effect, or it might
do nothing. It's less surprising if the control exits the fullscreen
state.

Note that the exact behaviour is still VO dependent. If the window
was maximised before being fullscreened, it might exit fullscreen
back to maximised or back to regular window mode.

I thought about trying to explicitly control that behaviour but
it makes the osc code weird and probably wouldn't work all the time.
2020-01-12 08:43:19 -08:00
Dudemanguy a870145fb9 wayland: support maximize/minimize on startup
Allow the --window-maximized and --window-minimized flags to actually
work when the player is started on wayland. If the compositor doesn't
support maximization or minimization, then these options just do
nothing.
2020-01-12 16:12:09 +00:00
dudemanguy b8a42cc41c wayland: unscrew up cursors
Fixes #7345

There was a multitude of issues with cursor handling in wayland and
behavior seemed to vary for strange reasons across compositors and also
bad things were being done in wayland_common. The problem is complicated
and involved fullscreen states being set incorrectly under certain
instances and so on. The best solution is to just remove most of the
extra cruft. In handle_toplevel_config, instead of automatically
assuming is_fullscreen and is_maximized are false, we should use
whatever value is currently set vo_opts which matters when we initially
launch the window.
2020-01-12 01:54:41 +00:00
dudemanguy 6cb3d024c8 Revert "options: move cursor autohiding opts to mp_vo_opts"
This reverts commit 65a317436d.
2020-01-12 01:54:41 +00:00
wm4 63bf362d11 f_hwtransfer: move format fields to private struct
A user can barely do anything useful with it, and there are no users
which access these anyway, so private is better.
2020-01-12 01:47:42 +01:00
wm4 68292a2780 f_hwtransfer: restructure and error properly on broken cases
I think the previous code didn't consider the situation if the input
format was not any of the upload formats. It then could have possibly
tried to upload the wrong format (and not sure what the underlying APIs
do with it).

Take care of this, also improve logging, and change it such that
mp_hwupload_find_upload_format() does not unnecessarily change the state
(although it doesn't really matter).
2020-01-12 01:43:21 +01:00
wm4 a3f220ba44 f_autoconvert: usw f_hwtransfer properly
With the recent change how f_hwtransfer could select formats, it's
possible that the upload_fmts list contains formats that are never
selected, and the filter would have failed.

The way it works now is that f_hwtransfer gets to select the format
(which honestly doesn't make sense, but whatever), and f_autoconvert
gets only a single format.

It would be more ideal if f_hwtransfer provided a list of possible input
formats, but that's absurdly too complex for now. Maybe I'll change it
back at some later point, but I expect this shit to be in a perpetual
state of complexity and brokenness.
2020-01-12 01:33:02 +01:00
wm4 4b168bcda3 input: escape command parameters when logging
Some complex commands (like commands generated by scripts to define key
bindings or the OSD overlay command) contain new lines, which "corrupts"
logging.

Fix this by escaping the parameters C-style. Abuse the JSON writer for
this, which already has code to vaguely produce C-style escapes.

At first I considered stripping the quotes, but then I thought it's
actually a good idea to leave them in, as it makes things clearer.

Follows an idea by avih.
2020-01-12 01:04:33 +01:00
wm4 b947bfcf1f f_hwtransfer: slightly better logging 2020-01-11 22:46:04 +01:00
wm4 7555e2a42a f_hwtransfer: whitelist vaapi formats that actually appear to work
(Oh yes, we could have skipped all the complexity, and hardcoded the
cases that work in the first place. This wouldn't be an issue if FFmpeg
or libva exported correct information. Also possible that FFmpeg's
filter chain does not allow to do this correctly in the first place,
since filters expose next to no meta information about what hw formats
etc. they need.)

Note that uploading yuv420p to a nv12 vaapi surface actually works, but
the blacklist excludes it. So this might get a bit slower. I'm not
bothering with this case because it's rarely needed, and the blacklist
specification would become a bit more complex if you had to specify
sw/upload format pairs.

Fixes: #7350
2020-01-11 22:45:42 +01:00
wm4 a009b57c77 f_hwtransfer: change order in which hwdec upload formats are considered
Basically, instead of trusting the upload format, and picking the first
sw format that has a desired upload format, trust the sw format. So now
we pick the sw format first, and then select from the set of upload
formats supported by it.

This is probably more straightforward, and works around a crash with
vaapi:

  mpv 8bit.mkv --vf=format=vaapi --gpu-hwdec-interop=all

(Forces vaapi upload if hw decoding is not enabled.)

Unfortunately, this still does not work, because vaapi, FFmpeg, the VO
interop code, or all of them are doing something stupid. In particular,
this picks the yuv420p sw format, which doesn't really exist despiter
advertised (???????????????????????????????????????), and simply breaks.

See: #7350
2020-01-11 22:29:53 +01:00
wm4 a3ddddff3a vaapi: reduce log levels further
Try to exclude mostly uninteresting information from verbose logging,
but still include it in debug logging.
2020-01-11 16:35:30 +01:00
wm4 f23dcfef82 vo_gpu: hwdec_vaapi: silence warning during probing
hwdec_vaapi tries to probe all available surface formats in advance. For
that, we iterate over _all_ profiles in an attempt to collect possible
surface formats. This means we try profiles we normally wouldn't use for
decoding or filtering, and which could be "unrelated" services.

It seems some drivers report at least one profile, for which
vaQueryConfigEntrypoints() fails (because the profile is not supported;
not sure why it lists it, then). So turn the error message into a
verbose message to avoid confusing output.

Fixes: #7347
2020-01-11 16:35:30 +01:00
Dudemanguy cfceaec266 wayland: don't set cursor before pointer id
This shouldn't really matter, but it's probably best to avoid.
vo_wayland_control would execute set_cursor_visibility while wl->pointer
existed but it didn't check if wl->pointer_id existed. So
wl_pointer_set_cursor would be set to a null surface with an id of 0.
Instead, just wait until we have an actual, non-zero pointer id so that
the cursor is set with the correct, actual id and not a fictious 0 id.
This ensures that the pointer isn't set until it enters the wl_surface
which is what we want.
2020-01-11 00:05:21 -06:00
Philip Langdale 8b85b40b2f bash completion: add initial implementation of bash completion
While we've had a zsh completion script for a while, we haven't had
one for bash. This one is reasonably comprehensive, although there are
improvements one could imagine for certain options.
2020-01-09 12:07:05 -08:00
der richter 28609cc498 cocoa-cb: don't active window when minimized or hidden on file change
Fixes #7195
2020-01-09 20:41:44 +01:00
der richter ea9f9af76c github: add several issue templates and a warning to not ignore them 2020-01-09 20:20:35 +01:00
der richter e6c9e33a31 cocoa-cb: add runtime dpi change and use proper fallback for initial dpi
at the time of the initial dpi query the window is not instantiated yet.
we use a proper fallback in that case, eg the target configured screen
or the main screen if none is set.

also change some weird oversight and a small optimisation.
2020-01-09 19:13:42 +01:00
wm4 7bb3f53cf5 command, vo: add a mechanism for runtime DPI scale changes
Follow up to commit a58585d5e0. It turned out that the OSX backend
needs this.
2020-01-09 19:13:42 +01:00
der richter 57f9de7b53 travis: update macOS images and make building faster
don't build our own ffmpeg anymore and instead use the bottled version
from homebrew. update the newest macOS image. also handle macOS 10.12
as a legacy OS since homebrew and Apple stopped supporting it.
nevertheless it's helpful to build on that version since it's the last
version we support building on. it's a bit special since we have to pin
the homebrew-core version to a previous one where all the bottles for
macOS 10.12 are still available, otherwise it would build nearly
everything from source and that would take ages. also start caching the
homebrew cache folder for downloads.
2020-01-09 19:11:38 +01:00
wm4 363048077f client API: fix property notification from non-playloop sources
This code assumed that the function is only called from the playloop
itself (and since property notification is done at the end of it, i.e.
before sleeping, it obviously would not have needed to wake up the
core).

But this function is actually called from some comments (such as
playlist-move), so this assumption was incorrect. Use the same method as
the other function.

Untested.

Fixes: #7339 (probably)
2020-01-09 18:16:41 +01:00
wm4 3a9f0f537f client API: change event mask to event number in one place
Cosmetic change. Slightly more convenient/readable.
2020-01-09 18:12:10 +01:00
wm4 33e999de82 stream_libarchive: fix unnecessarily opening all volumes on opening
Seems like I'm still not done with rar playback stuff...

It turns out the reason for archive_read_open1() opening all volumes had
nothing to do with libarchive's rar code, but was a consequence of how
multi volume support is implemented in libarchive, and due to the fact
that we enabled archive_read_support_format_zip_seekable() (through
archive_read_support_format_zip()).

The seekable zip format will seek to the end of the file and search for
a zip "header" there. It could possibly be considered a libarchive bug
that it does that even if it's fairly sure that it's a RAR file.

We already do probing on a small buffer read from the start of the file
(i.e. not giving libarchive a way to seek the stream before we think
it's an archive), but that does not help, since libarchive needs to
probe _again_. libarchive does not seem to provide a function to query
the format (no archive_read_get_format()). Which seems quite strange,
but at least I didn't find one.

This commit works this around by doing some manual rar/zip probing. We
could have gone only with rar probing. But detecting zip separately
allows us to avoid that stream_libarchive seeks to the end during early
probing. This is an additional bonus on top of "fixing" multi volume
rar.

The zip probing is from archive_read_format_zip_streamable_bid(). The
rar signature is the common prefix of the rar and rar5 formats in
libarchive (presumably the RAR fixed header parts without version).

If the demuxer seeks to the end of the rar entry, this will still open
all volumes; I'm not sure whether the old/removed rar code in mpv could
handle this better.

See: #7182
2020-01-09 02:25:13 +01:00
Avi Halachmi (:avih) 5e0875c9e0 js: use osd-dimentions for mp.get_osd_{size,margins}
This matches lua's 11b9315b but with the lagacy field names which the
js code used previously.

Currently the property always returns an object (with dummy/last/null
field values if there are no dimensions), but the code is ready for
a future case where it might return null if there are no dimensions - at
which case it will forward the null, breaking backward compatibility for
a better API.
2020-01-08 11:49:49 +02:00
wm4 f612de1712 vo_gpu: fix crash if dither texture fails to allocate
Theoretically possible (and quite unlikely due to the small texture
size). The code was originally written with the assumption that texture
allocations can't fail, and it was never updated out of laziness.
Untested.
2020-01-08 03:45:17 +01:00
wm4 1c83ded3b0 osc: don't delay updates on resize
The idea is that if the player is resized, we do not delay redrawing
(which is normally done to limit the redraw rate to something
reasonable).

Not sure if this even does anything. For one, reacting to osd-dimensions
changes is cleaner than just polling the screen size with the next tick
event, and hoping that resizes generate tick events for whatever
logically unrelated reasons.
2020-01-08 02:37:12 +01:00
wm4 4a65c22c50 osd: fix possible misses of osd-dimensions property updates
check_obj_resize() in sub/osd.c calls mp_client_broadcast_event(), which
calls notify_property_events(). This is pretty unexpected, because
check_obj_resize() may be called from the VO thread. While that's sort
of awful, it seems to be OK locking-wise. But it breaks an assumption in
notify_property_events() that the core doesn't need to be woken up,
which could possibly lead to a missed/delayed property update (although
rather unlikely).

Fix this by explicitly waking up the core when it's called from the OSD
code.
2020-01-08 02:31:18 +01:00
wm4 a58585d5e0 command: cache display-hidpi-scale property
This is a gross hack for the shitty design of how VO properties are
handled (which was fine with MPlayer, but became increasingly a shit tub
with mpv's VO thread).

The problem here is that console.lua reads display-hidpi-scale on every
render, but which may take a long time for video timing and vsync
blocking. It will also block the core, making osc.lua unable to react to
window resizing quickly enough.

This should be solved by not using the "classic" blocking VOCTRL
mechanism, and instead side-stepping it with something that doesn't
require any waiting (like for example the "fullscreen" property does).

But this require more thinking and work my "brain" can handle at the
moment. So for now add a shitty hack that will cause a lot of problems,
and which will have to be replaced later. Most importantly, it'll break
theoretic support for multiple screens with different DPI, or runtime
DPI changes. Possibly could affect the Cocoa backend; the X11 isn't
dynamic enough by nature, and other backends do not implement this.
2020-01-08 02:16:45 +01:00
wm4 7ce41cda05 command: remove outdated MP_EVENT_WIN_STATE entries
These properties are handled very differently now, and being in that
list did pretty much nothing.
2020-01-08 02:01:49 +01:00
wm4 11b9315b3f lua: use new OSD property
See previous commit.

A nice side-effect is that mp.get_osd_margins() is not a special
Lua-only thing anymore. I didn't test whether this function still works
as expected, though.
2020-01-08 00:16:58 +01:00
wm4 db9048f21a command: add osd-dimensions property
This "bundles" all OSD properties. It also makes some previously
Lua-only values available (Lua has mp.get_osd_margins(), unsure if
anything uses it).

The main intention is actually to allow retrieving all fields in an
"atomic" way. (Could introduce a mechanism on the level of the mpv
client API to do this, but doing ti ad-hoc all the time like this commit
is easier.)
2020-01-08 00:16:01 +01:00
wm4 d3cef97ad3 options: change option parsing when using a single dash
Addresses dumb things like accidentally overwriting a media file with
e.g. "mpv --log-file test.mkv" (when the user thought that --log-file
was a flag option, when it actually takes a filename). This example will
now print an error. It still works with "-log-file overwritten.mkv", but
prints a warning.

Not sure if I'm being too careful or not "radical" enough. In any case,
both the syntax that stops working and the syntax that produces a
warning now have been discouraged and were called legacy for almost a
decade.
2020-01-07 23:08:45 +01:00
wm4 5b56be0e91 build: fix minimum libarchive version
Seems like 3.3.3 was not correct and too early.

Fixes: #7334
2020-01-07 22:31:35 +01:00