Commit Graph

47677 Commits

Author SHA1 Message Date
wm4 eab5457e47 manpage: correct "complex" key binding description
The key is never nil if it's invoked through the normal input path. The
key name could be "" if mp_cmd.key_name==NULL. This should not happen,
but there's no strong guarantee in input.c that it cannot happen, so
whatever.
2019-11-22 01:15:08 +01:00
wm4 a394d9e3ae manpage: improve "complex" key binding list of table entries 2019-11-22 01:15:08 +01:00
wm4 0a6c09b96f input: introduce a pseudo key name that grabs all text input
The intended target for this is the mpv.repl script, which manually
added every single ASCII key as a separate key binding. This provides a
simpler mechanism, that will catch any kind of text input.

Due to its special nature, explicitly do not give a guarantee for
compatibility; thus the warning in input.rst.
2019-11-22 01:15:08 +01:00
wm4 a098e98198 input: fix ineffective mp_msg_test call
This was supposed not to go through key lookup if the message wasn't
going to be output, but for whatever reason the log levels were
mismatched.
2019-11-22 01:15:07 +01:00
Avi Halachmi (:avih) 67fef2b152 js: complex key binding: use key_name like the docs say 2019-11-20 16:55:21 +02:00
Avi Halachmi (:avih) 14971424b9 js: report key name for "complex" key bindings - match b08c8f50 2019-11-20 16:28:49 +02:00
Avi Halachmi (:avih) da13a3b231 lua: complex key binding: use key_name like the docs say 2019-11-20 16:28:49 +02:00
Chris Down e143966a76 player: Optionally validate st_mtime when restoring playback state
I often watch sporting events. On many occasions I get files with the
same filename for each session. For example, for F1 I might have the
following directory structure:

    F1/
        FP1.mkv
        FP2.mkv
        FP3.mkv
        Qualification.mkv
        Race.mkv

Since usually one simply watches one race after the other, I usually
just rsync the new event's files over the old ones, so, for example,
Race.mkv will be replaced from the file for the last event with the file
from the new event.

One problem with this is that I like to use --resume-playback for other
kinds of media, so I have it on by default. That works great for, say, a
movie, but doesn't work so well with this scheme, because you can
trivially forget to pass --no-resume-playback on the command line and
end up 2 hours in, watching spoilers as the race results scroll down the
screen :-)

This patch adds a new option, --resume-playback-check-mtime, which
validates that the file's mtime hasn't changed since the watch_later
configuration was saved. It does this by setting the watch_later
configuration to have the same mtime as the file after it is saved.

Switching back and forth between checking mtime and not checking mtime
works fine, as we only choose whether to compare based on it, but we
update the watch_later configuration mtime regardless of its value.
2019-11-20 15:11:33 +01:00
wm4 1649ba15ab manpage: extend documentation of key names
These things weren't written down anywhere yet.
2019-11-19 23:13:12 +01:00
wm4 b08c8f50b5 lua: report key name for "complex" key bindings
This might make certain use cases less of a mess.
2019-11-19 23:11:05 +01:00
wm4 13815bf251 manpage: deprecate input section commands
These were a bad idea and are obscure. Scripting key mapping support
still uses them, but this is not relevant to scripting authors, because
the mpv provided helper code (defaults.lua) takes care of this. In
addition, the OSC uses a legacy form of this.

Hopefully, this input section stuff can be removed, and replaced by a
simpler mechanism.
2019-11-19 23:09:59 +01:00
Aman Gupta 03fbb57bd9 audio: add ao_audiotrack for android 2019-11-19 12:10:26 -08:00
Aman Gupta 1a006d6f06 misc: add jni helpers 2019-11-19 12:10:26 -08:00
Aman Gupta f93faf26d8 audio: fix minor whitespace issue in out/internal.h 2019-11-19 12:10:26 -08:00
Avi Halachmi (:avih) eb033bc29f js: don't pre-filter log level argument in mp.enable_messages()
Match lua's 8e5642ff
2019-11-19 18:13:39 +02:00
wm4 521535cebe DOCS/contribute.md: some clarifications
Even if nobody ever reads this file.
2019-11-18 18:14:07 +01:00
Michael Forney 78963d1e66 video/out/bitmap_packer: Avoid empty initializer list 2019-11-18 16:50:21 +01:00
Michael Forney 235fabcfae video/out/vo_tct: Use octal escape sequence instead of non-standard \e 2019-11-18 16:50:21 +01:00
Michael Forney bea582f383 video/out/gpu: Remove stray top-level ';' 2019-11-18 16:50:21 +01:00
wm4 8c2d73f112 player: remove mechanisms for better logging with repl.lua
As preparation for making repl.lua part of the core (maybe), add some
mechanisms which are supposed to improve its behavior.

Add a silent mode. Calling mpv_request_log_messages() with the log level
name prefixed with "silent:" will disable logging from the API user's
perspective. But it will keep the log buffer, and record new messages,
without returning them to the user. If logging is enabled again by
requesting the same log level without "silent:" prefix, the buffered log
messages are returned to the user at once. This is not documented,
because it's far too messy and special as that I'd want anyone to rely
on this behavior, but it will be perfectly fine for an internal script.

Another thing is that we record early startup messages. The goal is to
make the repl.lua script show option and config parsing file errors.
This works only with the special "terminal-default" log level.

In addition, reduce the "terminal-default" capacity to only 100 log
messages. If this is going to be enabled by default, it shouldn't use
too much resources.
2019-11-18 00:44:54 +01:00
wm4 8e5642ff68 lua: don't pre-filter log level argument in mp.enable_messages()
This will just make it  not work if mpv_request_log_messages() gets
extended to accept more names. Pass the argument without checking.

To keep the behavior the same (for whatever reasons, probably not
important), still raise an error if the libmpv API function returns an
error that the argument was bad.

(The check_loglevel() function is still used when the script _emits_ log
messages, which is different, and for which there is no API anyway.)
2019-11-18 00:44:54 +01:00
Philip Langdale a714ab0601 vo_gpu: hwdec_cuda: Reduce message level of errors while probing
We should only be printing errors that occur when not probing, to
avoid creating the impression that something is wrong - and errors
during probing isn't a problem.
2019-11-17 09:44:32 -08:00
wm4 78cf974375 options: deprecate --video-sync=display-adrop
A stupid thing that will probably be in the way.
2019-11-17 02:11:45 +01:00
wm4 d92395d205 player: remove some unnecessary coverart special cases
These should not be needed, since video is in EOF mode in this case
anyway.

Not too sure about the video.c case to be honest, well, here goes
nothing.
2019-11-17 02:11:45 +01:00
wm4 4e74320320 video: make track switching work for external images
Until now, this didn't work, since the external image had pts 0; so
enabling video at a later time did nothing, because the image was
discarded. Since hrseek now ends on the last frame (instead of nothing),
reusing the hrseek mechanism solves this, and we don't even need to
treat the cursed coverart case separately.
2019-11-17 02:11:45 +01:00
wm4 42c5867c4e player: remove commented declaration
It was commented almost 2 years ago in a "rewrite everything" commit.
2019-11-17 02:11:45 +01:00
wm4 23414d1d71 audio: log A/V initial sync status 2019-11-17 02:11:45 +01:00
wm4 c7487cebd1 demux_mf: fix backward seeking behavior
If SEEK_FORWARD is set, a demuxer should skip to the next frame if the
timestamp does not fall on the start of a frame. If that flag is not
set, it should always seek to the first frame before the target
timestamp (or the first frame in the file).
2019-11-17 02:11:45 +01:00
wm4 f942071524 video: set EOF status as soon as possible
See what the added code comment says. Normally when this is needed, it's
the cover art case. But this flag is not set when using an external
image. This gives weird seek behavior, because the frame will be
"normally" displayed for its determined duration, and during normal
video playback, the video pts will be used - which is always 0 here.

This should happen only if audio is active. Otherwise, we're more or
less in image viewer mode, where the image should be displayed for a
configured duration.
2019-11-17 02:11:45 +01:00
wm4 6bcda94cbc video: if hr-seek goes past last frame, seek to last frame
This gives much better behavior in general, and is what we want if video
somehow ends earlier than audio.

A common special is using an audio file with an external image file.
This commit makes things like switching aspect ratio work (provided the
demuxer for the image behaves correctly, which currently isn't the case
with demux_mf.c). Since the image file had timestamp 0, it was usually
skipped by hr-seek, and changed properties weren't applied to it at the
start of the filter chain.
2019-11-17 02:11:45 +01:00
wm4 ba6ba32825 f_decoder_wrapper: put coverart through image output logic
This wasn't done, probably regression from one of the last dozen of
times this special code path was touched. This meant coverart images
ignored the user-set aspect ratio completely, and some other things.
2019-11-17 02:11:45 +01:00
Philip Langdale ba370e9599 vo_gpu: context_glx: Add X11 native resource
Surprisingly, we've managed to get this far without context_glx ever
adding the X11 display as a native resource. But with the recent change
to attempt to enable vdpau when using EGL, the hwdec now requires the
display to be added. So let's add it.
2019-11-16 15:35:32 -08:00
Dudemanguy 0d8a6c6984 wayland: use eglGetPlatformDisplay()
See aacc194. The same logic all applies to Wayland. In fact, we already
require EGL 1.5 for wayland anyway, so it's better to do it right.
2019-11-16 14:23:07 -06:00
wm4 aacc1942fb x11: require EGL 1.5 and use eglGetPlatformDisplay()
eglGetPlatform() is a broken API, since it takes a windowing specific
argument, yet is supposed to work for multiple APIs at the same time. On
Linux, it can take both a X11 "Display" and a "wl_display". Obviously
there is no way to specify what kind of display the argument is (it's
just a void*).

Mesa has _eglNativePlatformDetectNativeDisplay, which does funny stuff
to try to guess the display type, including trying to call mincore() to
determine whether the pointer can be accessed at all. I guess this
recently accidentally broke (as a bug), but on the other hand, maybe
it's time to do this properly.

The fix is using eglGetPlaformDisplay(). This requires EGL 1.5, plus
Mesa needs to support the associated platform extension
(EGL_KHR_platform_x11).

Since I see no reasonable way to do this in a compatible way, just
require that EGL 1.5 is available. The problem is that EGL 1.4 seems to
require you to create a display to query EGL version and extension, and
you have a chicken-and-egg problem. It's very stupid. Maybe you could
jump through some more hoops to get something compatible, but fuck that.
Users on "too old" Mesa will fall back to GLX (which we keep around for
a regrettable company known by the name of Nvidia).

I think Wayland and GBM should do the same. They're sufficiently
bleeding-edge that you can expect them to have EGL 1.5. On the other
hand, the cursed RPI code will have to stay with a eglGetDisplay().

Speculative fix for #7154.

(Rant about EGL follows. Actually I deleted it.)
2019-11-16 20:55:03 +01:00
wm4 73c3dc0a7b vo_gpu: sync duplicated condition on peak computation
pass_color_map() (in video_shaders.c) and pass_colormanage() (video.c)
both duplicate the condition on whether to do peak computation. Peak
computation requires a compute shader, so if the duplicated conditions
don't match, video_shaders.c will generate a compute shader, but video.c
will try to run it as fragment shader. This leads to a "blue screen".

This can be reproduced by playing a HDTV video with --target-peak=99.

It's not clear how to fix this. Should pass_tone_map() be only invoked
if mp_trc_is_hdr() == true (what pass_colormanage() uses to decide
whether to enable peak computation), or should pass_colormanage() just
tell pass_color_map() to skip peak computation? Decide for the latter,
as it's more robust.

Even if not correct, at least it gets rid of the blue shit.

Fixes: #7149
2019-11-16 19:02:36 +01:00
wm4 b2006eeb74 client API: remove sync. property notification code again
It's too easy to introduce unintended circular lock dependencies. Just
now we found that the (old) cocoa vo_gpu backend is also affected by
this, because it waits on the Cocoa main thread, which in turn uses
libmpv API for OSX... stuff.

Also fix a missing initial property update after observe.

This leaves me unhappy, because it just leads to a stupid thread ping
pong. Will probably rewrite this later.
2019-11-16 18:33:28 +01:00
wm4 b0d95f6f3c manpage: add section about using mpv from programs and scripts
Give an overview over the various methods. I feel like I've written text
like this over and over again (compatibility.rst and
interface-changes.rst for example duplicate the list of mpv API
abstractions), but such is life in hell.

Use this in particular to strongly suggest not to parse terminal output.
This suggestion got lost or de-emphasized at some point (maybe when
removing MPlayer and "slave mode" references). Some of this text is
still there, but it can be considered "fine print" at best, that nobody
will see. Now we have it in a more prominent place. This is especially
important since MPlayer-style use of mpv still seems to be prevalent,
see for example #7153.
2019-11-16 15:38:05 +01:00
wm4 f57f13ceb0 options: deprecate --input-file
I have no idea why this still exists, since we have --input-ipc-server.
I think there was something about Windows, but the latter option is
implemented even on Windows.
2019-11-16 15:28:18 +01:00
wm4 6bbf44d842 video: take first frame into account in audio-sync mode
It appears commit 4ad68d9452 broke handling the first video
frame duration through roundabout ways (I think because the duration of
the first frame was now available at all in the normal case). The first
frame was cut short, which showed up especially with looping, or if the
file had a low FPS.

This questionable change seems to fix it without breaking any other
known cases => push and call it a day.

The display-sync mode did not have this problem.

Fixes: #7150
2019-11-16 13:47:23 +01:00
wm4 b6413f82b2 demux_lavf: fight ffmpeg API some more and get the timeout set
It sometimes happens that HLS streams freeze because the HTTP server is
not responding for a fragment (or something similar, the exact
circumstances are unknown). The --timeout option didn't affect this,
because it's never set on HLS recursive connections (these download the
fragments, while the main connection likely nothing and just wastes a
TCP socket).

Apply an elaborate hack on top of an existing elaborate hack to somehow
get these options set. Of course this could still break easily, but hey,
it's ffmpeg, it can't not try to fuck you over. I'm so fucking sick of
ffmpeg's API bullshit, especially wrt. HLS.

Of course the change is sort of pointless. For HLS, GET requests should
just aggressively retried (because they're not "streamed", they're just
actual files on a CDN), while normal HTTP connections should probably
not be made this fragile (they could be streamed, i.e. they are backed
by some sort of real time encoder, and block if there is no data yet).
The 1 minute default timeout is too high to save playback if this
happens with HLS.

Vaguely related to #5793.
2019-11-16 13:15:45 +01:00
wm4 8d4e012bfa demux_playlist: fix previous commit
This just froze, due to obvious stupidity (I forgot to deal with all
semantic changes done to the the former stream_skip()).

Fixes: ac7f67b3f2
2019-11-15 12:10:01 +01:00
wm4 9efdb0368e player: enable "pause caching" code for local playback too
There isn't really a need to disable this for local playback. I think
originally I did this because I was afraid the code could mess up or be
annoying on local mode, but that's not really a good argument. I'd
rather test this code in local mode too. In this case, it shouldn't
really happen that it runs out of cache in the first place.
2019-11-14 13:51:47 +01:00
wm4 5a99015acf stream_lavf: set --network-timeout to 60 seconds by default
Until now, we've made FFmpeg use the default network timeout - which is
apparently infinite. I don't know if this was changed at some point,
although it seems likely, as I was sure there was a more useful default.

For most use cases, a smaller timeout is more useful (for example
recording something in the background), so force a timeout of 1 minute.

See: #5793
2019-11-14 13:46:03 +01:00
wm4 ac7f67b3f2 demux_mkv, stream: attempt to improve behavior in unseekable streams
stream_skip() semantics were kind of bad, especially after the recent
change to the stream code. Forward stream_skip() calls could still
trigger a seek and fail, even if it was supposed to actually skip data.
(Maybe the idea that stream_skip() should try to seek is worthless in
the first place.)

Rename it to stream_seek_skip() (takes absolute position now because I
think that's better), and make it always skip if the stream is marked as
forward.

While we're at it, make EOF detection more robust. I guess s->eof
shouldn't exist at all, since it's valid only "sometimes". It should be
removed... but not today. A 1-byte stream_read_peek() call is good to
get the s->eof flag set to a correct value.
2019-11-14 12:59:14 +01:00
dudemanguy dcc3c2eb38 wayland: use hidpi-window-scale option 2019-11-12 01:00:08 +00:00
Philip Sequeira b5894e760d github: ask for build/config.log 2019-11-10 20:59:17 -08:00
Philip Sequeira 85aa9635e0 build: fix compilation conditions for vaapi interop inits
This makes the condition for including each init match the condition for
compiling the file that defines it.

It's possible to e.g. HAVE_GL and HAVE_VAAPI without HAVE_VAAPI_EGL,
which resulted in "undefined reference to `vaapi_gl_init'" with the old
code.
2019-11-10 20:59:17 -08:00
wm4 07fd511e14 options: remove M_SETOPT_RUNTIME
Used to contain flags for "save" setting of options at runtime. Now
there is nothing special needed anymore and it's 0. So drop it
completely, and remove anything that distinguishes between runtime and
initialization time.
2019-11-10 23:53:57 +01:00
wm4 4cae192377 options: remove M_OPT_FIXED
Options marked with this flag were changed to strictly read-only after
initialization (mpv_initialize() in the client API, after option parsing
and config file loading with the CLI player).

This used to be necessary, because there was a single option struct that
could be accessed by multiple threads. For example, --config-dir sets
MPOpts.force_configdir, which was read whenever anything accessed the
mpv config dir (which could be on different threads, e.g. font
initialization tries to lookup fonts.conf from an arbitrary thread).

This isn't needed anymore, because threads now access these in a thread
safe way. In the case of --config-dir, the path is actually just copied
on init.

This M_OPT_FIXED mechanism is thus not strictly needed anymore. It still
prevents writing to some options that cannot take effect at runtime, but
even that can be dropped. In general, all mpv options can be changed any
time at runtime, even if they never take effect, and there's no need to
make an exception for a very low number of options. So just get rid of
it.
2019-11-10 23:49:23 +01:00
wm4 20c9538e32 audio: more alignment nonsense
It's hard to see what FFmpeg does or what its API requires. It looks
like the alignment in our own allocation code might be slightly too
lenient, but who knows. Even if this is not needed, upping the alignment
only wastes memory and doesn't do anything bad.

(Note that the only reason why we have our own code is because FFmpeg
doesn't even provide it as API. API users are forced to recreate this,
even if they have no need for custom allocation!)
2019-11-10 15:30:29 +01:00