0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 12:02:23 +02:00
Commit Graph

2293 Commits

Author SHA1 Message Date
wm4
11f5713e3b options: add an option type for byte sizes
And use it for 2 demuxer options. It could be used for more options
later. (Though the --cache options can not use this, because they use KB
as base unit.)
2018-01-25 20:18:32 -08:00
wm4
3dd5621cec command: make sure to redraw on overlay commands
When overlay-add etc. is run, make sure the playlop is rerun so that it
considers actually redrawing the screen.

(I considered making the OSD code generally wakeup the player, but that
will probably lead to redundant wakeups, so I didn't bother.)

Fixes #5431.
2018-01-25 20:18:32 -08:00
Ricardo Constantino
e6e6b0dcc7
ytdl_hook: whitelist protocols from urls retrieved from youtube-dl
Not very clean since there's a lot of potential unsafe urls that youtube-dl
can give us, depending on whether it's a single url, split tracks,
playlists, segmented dash, etc.
2018-01-26 01:47:43 +00:00
wm4
082029f850
player: redo hack for video keyframe seeks with external audio
If you play a video with an external audio track, and do backwards
keyframe seeks, then audio can be missing. This is because a backwards
seek can end up way before the seek target (this is just how this seek
mode works). The audio file will be seeked at the correct seek target
(since audio usually has a much higher seek granularity), which results
in silence being played until the video reaches the originally intended
seek target.

There was a hack in audio.c to deal with this. Replace it with a
different hack. The new hack probably works about as well as the old
hack, except it doesn't add weird crap to the audio resync path (which
is some of the worst code here, so this is some nice preparation for
rewriting it). As a more practical advantage, it doesn't discard the
audio demuxer packet cache. The old code did, which probably ruined
seeking in youtube DASH streams.

A non-hacky solution would be handling external files in the demuxer
layer. Then chaining the seeks would be pretty easy. But we're pretty
far from that, because it would either require intrusive changes to the
demuxer layer, or wouldn't be flexible enough to load/unload external
files at runtime. Maybe later.
2018-01-18 01:25:53 -08:00
Ricardo Constantino
86004909ac
ytdl_hook: support native dash demuxer, if present
Uses track tbr instead of track disposition id for dash selection

Works just as expected because youtube-dl also takes tbr from the manifests.
2018-01-15 11:20:02 +00:00
Ricardo Constantino
3a76bfdccc
osc: leave only demuxer cache duration and limit its refresh rate
Sorta requested in #5390
2018-01-14 12:57:37 +00:00
Kevin Mitchell
845f32732f osd: treat user provided term-status-msg the same as the default
This is achieved by adding the new function get_term_status_msg that
returns the status message specified by the user, or the mpv default.

Previously, term_osd_print_status_lazy would exit early as soon as a
user status message had been set, which potentially skipped adding the
term_osd_bar if the user also requested that.

fixes #3280
2018-01-14 00:31:47 -08:00
Kevin Mitchell
48fa7da865 osd: reference local pointer to mpctx->opts
For brevity, since it's already there. Result should be identical.
2018-01-13 23:26:54 -08:00
wm4
a5f53da229 af_lavrresample: deprecate this filter
The future direction might be not having such a user-visible filter at
all, similar to how vf_scale went away (or actually, redirects to
libavfilter's vf_scale).
2018-01-13 03:26:45 -08:00
wm4
d53c0604ca player: silence config file loading message on resuming
This is just an implementation detail; seems to be ugly to log it by
default. Other cases of the try_load_config() function should be logged,
though.
2018-01-13 03:26:45 -08:00
Ricardo Constantino
b478d2b1ce
ytdl_hook: look for the right ytdl binary according to system
package.config is available in 5.1, 5.2, 5.3 and luajit, so should be fine.
The first character is the path separator, so it's '\' on windows and '/'
on *nix.

This should also prevent cases where users download the wrong binary.
2018-01-12 18:17:37 +00:00
Ricardo Constantino
2d6fdccb92
ytdl_hook: be more informative when youtube-dl fails 2018-01-12 01:52:37 +00:00
wm4
2d345c59d6 input: make command argument list a dynamic array
Replace the static array with dynamic memory allocation. This also
requires some code to honor mp_cmd.nargs more strictly. Generally
allocates more stuff.

Fixes #5375 (although we could also just raise the static limit).
2018-01-10 20:36:27 -08:00
Ricardo Constantino
154ff98128
ytdl_hook: don't try to use webpage_url if non-existent 2018-01-11 00:16:53 +00:00
Kevin Mitchell
6e974f77bd command: make pause display the same osd-msg-bar as seek
Previously, toggling pause would generate no osd response, and changing
that wasn't even configurable. This was surprising to users who
generally expect to see *where* pause / unpause is taking place (#3028).
2018-01-07 16:07:04 -08:00
Kevin Mitchell
cd8daee3d3 command: default to osd-msg-bar for seeks
The previous default was osd-bar (unless the user specified
--no-osd-bar, in which case case it was osd-msg). Aside from requiring
some twisted logic to implement, this surprised users since osd-msg3
wasn't displayed when seeking with the keyboard (#3028), so the time
seeked to was never displayed.
2018-01-07 16:07:04 -08:00
Kevin Mitchell
212f83ba2e command: remove unnecessary whitespace 2018-01-07 16:07:04 -08:00
Ricardo Constantino
b62066433d
ytdl_hook: actually use the script option from 87d3af6 2018-01-07 16:15:47 +00:00
Ricardo Constantino
87d3af6f19
ytdl_hook: add script option to revert to trying youtube-dl first
Should only make a difference if most of the URLs you open need
youtube-dl parsing.
2018-01-07 15:56:55 +00:00
wm4
5103b5dc2c player: handle audio playback restart in central playback start code
No idea why this wasn't done earlier. This makes playback start in audio
only tracks closer to video-only or video/audio restart. It has the
consequence that --cache-pause-initial now works for audio-only streams
too.
2018-01-07 05:03:15 -08:00
wm4
ebe0f5d313 player: slightly refactor/simplify cache pausing logic
The underlying logic is still the same (basically pausing if the demuxer
cache underruns), but clean up the higher level logic a bit. It goes
from 3 levels of nested if statements to 1.

Also remove the code duplication for the --cache-pause-initial logic.

In addition, make sure an earlier buffering state has no influence on
the new state after a seek (this is also why some of the state resetting
can be removed from loadfile.c).

Initialize cache_buffer always to 100. It basically means we start out
assuming all buffers are filled enough. This actually matters for
verbose messages only, but removes some weird special casing.
2018-01-07 05:03:15 -08:00
wm4
34cf655ddd player: strictly never autoselect tracks from --external-files
Before this commit, some autoselection of tracks coming from files
loaded with --external-files was still done. This commit removes all of
it, and the only way to select a track is via the explicit stream
selection options like --vid/--sid/--aid.

I think this was always the original intention. The change could in
theory still unintentionally surprise some users, so add a changelog
entry.

This does not affect --audio-file/--sub-file, even if these contain
mismatching track types. E.g. if audio files passed to --audio-file
contain subtitles, these should still be selected. Past feature requests
indicate that users want this.
2018-01-06 14:42:22 -08:00
Ricardo Constantino
cf8855cd2e
ytdl_hook: check for possible infinite loop in playlist generation 2018-01-06 18:43:46 +00:00
Ricardo Constantino
442ff93626
ytdl_hook: add additional check for comedycentral urls
If this breaks another site again, remove this whole if and just leave them as
separate playlist items.

Close #5364
2018-01-06 18:22:08 +00:00
wm4
8e1390e734 demux: export some debugging fields about low level demuxer behavior
Export them as explicitly undocumented debugging fields for the
"demuxer-cache-state" property.

Should be somewhat helpful to debug "wtf is the demuxer" doing
situations better, especially when seeking. It also becomes visible how
long the demuxer is blocked on an "old" seek when you keep seeking while
the first seek hasn't finished.
2018-01-05 18:34:29 -08:00
Ricardo Constantino
cf411a9489
ytdl_hook: update obsolete warning about retrying URL if failed 2018-01-04 20:35:43 +00:00
wm4
e894f75bb5 player: cosmetics: rename internal variable for consistency
This was so annoying.
2018-01-03 15:43:51 -08:00
wm4
f798bc3c25 player: add --cache-pause-initial option to start in buffering state
Reasons why you'd want this see manpage additions. Disabled by default,
because it would increase latency of live streams by default. (Or well,
at least it would be another problem when trying getting lower latency.)
2018-01-03 15:43:51 -08:00
wm4
9c22108fec player: use fixed timeout for cache pausing (buffering) duration
This tried to be clever by waiting for a longer time each time the
buffer was underrunning, or shorter if it was getting better. I think
this was pretty weird behavior and makes no sense. If the user really
wants the stream to buffer longer, he/she/it can just pause the player
(the network caches will continue to be filled until they're full).
Every time I actually noticed this code triggering in my own use, I
didn't find it helpful. Apart from that it was pretty hard to test.

Some waiting is needed to avoid that the player just plays the available
data as fast as possible (to compensate for late frames and underrunning
audio). Just use a fixed wait time, which can now be controlled by the
new --cache-pause-wait option.
2018-01-03 15:43:51 -08:00
dudemanguy
c809b73db6
osc: add seekbarkeyframes as a user option 2018-01-03 15:35:39 +00:00
sfan5
3cb616a286 player: remove internal vo-resize command again
Its only usecase was automated in the previous commit.
2018-01-02 15:04:31 -08:00
sfan5
48943a73f6 vo_gpu/context_android: replace both options with android-surface-size
This allows us to automatically trigger a VOCTRL_RESIZE (also contained).
2018-01-02 15:04:31 -08:00
wm4
6aad532aa3 options: move most subtitle and OSD rendering options to sub structs
Remove them from the big MPOpts struct and move them to their sub
structs. In the places where their fields are used, create a private
copy of the structs, instead of accessing the semi-deprecated global
option struct instance (mpv_global.opts) directly.

This actually makes accessing these options finally thread-safe. They
weren't even if they should have for years. (Including some potential
for undefined behavior when e.g. the OSD font was changed at runtime.)

This is mostly transparent. All options get moved around, but most users
of the options just need to access a different struct (changing sd.opts
to a different type changes a lot of uses, for example).

One thing which has to be considered and could cause potential
regressions is that the new option copies must be explicitly updated.
sub_update_opts() takes care of this for example.

Another thing is that writing to the option structs manually won't work,
because the changes won't be propagated to other copies. Apparently the
only affected case is the implementation of the sub-step command, which
tries to change sub_delay. Handle this one explicitly (osd_changed()
doesn't need to be called anymore, because changing the option triggers
UPDATE_OSD, and updates the OSD as a consequence). The way the option
value is propagated is rather hacky, but for now this will do.
2018-01-02 14:27:37 -08:00
wm4
3bf7df4a5e sub: move all subtitle timestamp messing code to a central place
It was split at least across osd.c and sd_ass.c/sd_lavc.c. sd_lavc.c
actually ignored most of the more obscure subtitle timing things.
There's no reason for this - just move it all to dec_sub.c (mostly from
sd_ass.c, because it has some of the most complex stuff).

Now timestamps are transformed as they enter or leave dec_sub.c.

There appear to have been some subtle mismatches about how subtitle
timestamps were transformed, e.g. sd_functions.accepts_packet didn't
apply the subtitle speed to the timestamp. This patch should fix them,
although it's not clear if they caused actual misbehavior.

The semantics of SD_CTRL_SUB_STEP are slightly changed, which is the
reason for the changes in command.c and sd_lavc.c.
2018-01-02 14:27:37 -08:00
Ricardo Constantino
828bd2963c
command: add demuxer-lavf-list property
Was only available with --demuxer-lavf-format=help and the demuxer
needed to be used for it to actually print the list.

This can be used in the future to check if 'dash' support was compiled
with FFmpeg so ytdl_hook can use it instead. For now, dashdec is too
rudimentary to be used right away.
2018-01-02 20:46:58 +00:00
Ricardo Constantino
89f81da481
player: add on_load_fail hook 2018-01-02 16:01:22 +00:00
Ricardo Constantino
97816bbef0
osc: check if demuxer cache has not reached eof
Avoids flickering stream cache status while filling the demuxer cache.
2018-01-02 14:28:32 +00:00
Ricardo Constantino
0da5688c84
ytdl_hook: fix single-entry playlists
Close #5313
2018-01-02 14:28:03 +00:00
wm4
49e704cb19
build: move copyright statement to a shared location
Now macosx_menubar.m and mpv.rc (win32) use the same copyright string.
(This is a bit roundabout, because mpv.rc can't use C constants. Also
the C code wants to avoid rebuilding real source files if only version.h
changed, so only version.c includes version.h.)
2018-01-01 21:05:09 +00:00
wm4
a90abe0546
Update copyright year 2018-01-01 21:05:07 +00:00
wm4
ed6ae656b0 main: fix typo
What the heck. This negated the entire check.
2018-01-01 22:26:43 +11:00
Leo Izen
4a6bb49215 player/playloop.c: Revert --loop-file and --start interaction
This reverts commit 9513165c99
and commit 4efe330efb.

I had changed --loop-file to interact with --start to work
the same way that --loop-playlist does. (That is, --loop-file
seeks to the --start time upon looping, not the beginning of
the file.) However, the consensus is that the old behavior is
preferred and the interaction with --loop-playlist is the one
that is incorrect.

In addition, this change introduced a bug in the interaction
between Quit-Watch-Later and --loop-file, where upon reaching
playback end it would seek to the resume timestamp, not the
start of the file.

As a result, this commit reverts that change.
2017-12-31 17:02:55 -07:00
sfan5
0030e049cd player: add internal vo-resize command
Intended to be used with the properties from previous commit.
2017-12-27 14:29:15 -07:00
Ricardo Constantino
b51f6c59b9 osc: hide cache if not forced for local files
Also hide cache if 'cache-used' is 0 (usually means video fits
entirely within demuxer-cache-duration or stream cache is disabled).
2017-12-26 19:11:52 +01:00
Julian
882d8ece57 stats: enhance cache stats
Show total cache as well as demuxer cache separately.
This adjusts the presented values to be consistent with status line
and OSC modifications made in https://github.com/mpv-player/mpv/pull/5250
2017-12-26 18:40:43 +01:00
Julian
a4eda0c984 lua: implement mp_utils.format_bytes_humanized 2017-12-26 18:40:43 +01:00
pavelxdd
5f8402e3ec osc: make seek ranges rendering optional
This commit adds a new osc setting `seekranges` to control
the seek ranges visibility.
2017-12-26 01:18:26 +01:00
wm4
69ae23fdd1 options: drop some previously deprecated options
A release has been made, so drop options deprecated for that release.
Also drop some options which have been deprecated a much longer time
before.

Also fix a typo in client-api-changes.rst.
2017-12-25 04:06:17 -07:00
Ricardo Constantino
b1b03da137 ytdl_hook: use table concat for playlist building
Faster and more efficient than string concat with large playlists.
2017-12-24 14:13:57 -07:00
Ricardo Constantino
1623430b20 ytdl_hook: don't preappend ytdl:// to non-youtube links in playlists
Close #5003
2017-12-24 14:13:57 -07:00
wm4
29af787217 player: update duration based on highest timestamp demuxed
This will help with things like livestreams.

As a minor detail, subtitles are excluded, because they sometimes have
"unused" events after video and audio ends. To avoid this annoying
corner case, just ignore them.
2017-12-24 21:49:12 +01:00
wm4
c12d897a3a player: allow seeking in cached parts of unseekable streams
Before this change and before the seekable stream cache became a thing,
we could possibly seek using the stream cache. But we couldn't know
whether the seek would succeed. We knew the available byte range, but
could in general not tell whether a demuxer would stay within the range
when trying to seek to a specific time position. We preferred to have
safe defaults, so seeking in streams that were detected as unseekable
were not honored. We allowed overriding this via --force-seekable=yes,
in which case it depended on your luck whether the seek would work, or
the player crapped its pants.

With the demuxer packet cache, we can tell exactly whether a seek will
work (at least if there's only 1 seek range). We can just let seeks go
through. Everything to allow this is already in place, and this commit
just moves around some minor things.

Note that the demux_seek() return value was not used before, because low
level (i.e. network level) seeks are usually asynchronous, and if they
fail, the state is pretty much undefined. We simply repurpose the return
value to signal whether cache seeking worked. If it didn't, we can just
resume playback normally, because demuxing continues unaffected, and no
decoder are reset.

This should be particularly helpful to people who for some reason stream
data into stdin via streamlink and such.
2017-12-24 21:45:12 +01:00
Martin Herkt
5ffbe2ba8a
command: use IEC symbols for file size formatting 2017-12-24 21:27:41 +01:00
wm4
a721dac601 player: make track language matching case insensitive
There is no reason not to do this, and probably saves the user some
trouble.

Mostly untested.

Closes #5272.
2017-12-23 15:14:13 -07:00
wm4
62cf960ef0 osc: show demuxer cache buffered amount in bytes
Same as previous commit, but for the OSC.

(A bit of a waste to request demuxer-cache-state at least twice per
frame, but the OSC queries so many properties it probably doesn't matter
anymore.)
2017-12-23 00:32:59 +01:00
wm4
822b247d10 player: show demuxer cache buffered amount in bytes in the status line
I don't want to add another field to display stream and demuxer cache
separately, so just add them up. This strangely makes sense, since the
forward buffered stream cache amount consists of data not read by the
demuxer yet. (If the demuxer cache has buffered the full stream, the
forward buffered stream cache amount is 0.)
2017-12-23 00:32:59 +01:00
wm4
2964788055
options: deprecate --ff- options and properties
Some old crap which nobody needs and which probably nobody uses.

This relies on a GCC extension: using "## __VA_ARGS__" to remove the
comma from the argument list if the va args are empty. It's supported
by clang, and there's some chance newer standards will introduce a
proper way to do this. (Even if it breaks somewhere, it will be a
problem only for 1 release, since I want to drop the deprecated
properties immediately.)
2017-12-21 19:51:30 +01:00
wm4
eb619d0f57 command: make video-frame-info property observable
Pointed out as missing by someone. Not terribly useful, but here we go.
2017-12-20 15:28:23 +11:00
rim
b0d0bc5700 dvb: Fix long channel switching: next/prev channel 2017-12-16 23:24:55 -08:00
TheAMM
3c4667c862 js: implement mp.msg.trace()
To match the new Lua helper introduced in
1afdeee1ad

Add documentation for both.
2017-12-16 02:25:24 -08:00
Niklas Haas
1afdeee1ad lua: implement mp.msg.trace 2017-12-15 22:28:47 -08:00
Niklas Haas
ba1943ac00 msg: reinterpret a bunch of message levels
I've decided that MP_TRACE means “noisy spam per frame”, whereas
MP_DBG just means “more verbose debugging messages than MSGL_V”.
Basically, MSGL_DBG shouldn't create spam per frame like it currently
does, and MSGL_V should make sense to the end-user and provide mostly
additional informational output.

MP_DBG is basically what I want to make the new default for --log-file,
so the cut-off point for MP_DBG is if we probably want to know if for
debugging purposes but the user most likely doesn't care about on the
terminal.

Also, the debug callbacks for libass and ffmpeg got bumped in their
verbosity levels slightly, because being external components they're a
bit less relevant to mpv debugging, and a bit too over-eager in what
they consider to be relevant information.

I exclusively used the "try it on my machine and remove messages from
MSGL_* until it does what I want it to" approach of refactoring, so
YMMV.
2017-12-15 22:28:47 -08:00
TSaaristo
522bfe5be1 lua+js: implement utils.file_info()
This commit introduces mp.utils.file_info() for querying information
on file paths, implemented for both Lua and Javascript.

The function takes a file path as an argument and returns a Lua table /
JS object upon success. The table/object will contain the values:
mode, size, atime, mtime, ctime and the convenience booleans is_file, is_dir.

On error, the Lua side will return `nil, error` and the Javascript side
will return `undefined` (and mark the last error).

This feature utilizes the already existing cross-platform `mp_stat()`
function.
2017-12-13 21:55:28 +02:00
pavelxdd
fd4e756e9c osd: fix a compiler warning by adding parentheses in if condition 2017-12-10 17:20:58 -08:00
wm4
0a749a38f7 video: add a shitty hack to avoid missing subtitles with vf_sub
update_subtitles() makes sure all subtitle packets at/before the given
PTS have been read and processed. Normally, this function is only called
before sending a frame to the VO. This is too late for vf_sub, which
expects the subtitles to be updated before feeding a frame to the
filters.

Apparently this was specifically a problem for the first frame.
Subsequent frames might have been ok due to general prefetching.

(This will fail anyway, should a filter dare to add an offset to the
timestamps of the filered frames before they pass to vf_sub.)

Fixes #5194.
2017-12-08 20:33:23 +02:00
wm4
80d43ee4e6 player: when loading external file, always add all track types
Until now, using --sub-file would add only subtitle tracks from the
given file. (E.g. if you passed a video file, only the subtitle tracks
from it were added, not the video or audio tracks.)

This is slightly messy (because streams are hidden), and users don't
even want it, as shown by #5132. Change it to always add all streams.
But if there's no stream of the wanted type, we still report an error
and do not add any streams. It's also made sure none of the other track
types are autoselected.

Also adjust the error messages on load failure slightly.

Fixes #5132.
2017-12-07 23:48:16 -08:00
wm4
520fc74036 player: rebase start time even for subtitle streams
It appears libavformat never sets the file start time for subtitles, so
this special check is not needed. The original idea was probably that
_if_ the demuxer set the start time to the first subtitle packet, the
subtitles would be shifted incorrectly.
2017-12-07 23:48:16 -08:00
Kevin Mitchell
985e83e217 Revert "ytdl: handle HLS with FFmpeg"
Apparently, this breaks youtube live and possibly other things.

This reverts commit 06519aae58.
2017-12-07 00:46:27 -08:00
wm4
06519aae58 ytdl: handle HLS with FFmpeg
Using youtube-dl's metadata ends up with stupid things like missing
variant streams, or missing audio streams entirely.
2017-12-06 23:59:59 -08:00
Leo Izen
0433162f7f player/osd.c: fix putting --start time on OSD
I missed an ab-loop check in ff7e294. It should now work as expected.
2017-12-05 17:15:08 -05:00
Leo Izen
9513165c99 player/playloop.c: fix --loop-file without --start
I missed a check for MP_NOPTS_VALUE in 4efe330. Now
it should work as expected.
2017-12-05 14:36:47 -05:00
Leo Izen
fdc311625e player/misc.c: allow both --length and --end to control play endpoint
Most options that change the playback endpoint coexist and playback
stops when it reaches any of them. (e.g. --ab-loop-b, --end, or
--chapter). This patch extends that behavior to --length so it isn't
automatically trumped by --end if both are present. These two will
interact now as the other options do.

This change is also documented in DOCS/man/options.rst.
2017-12-04 12:34:02 -05:00
Leo Izen
4efe330efb player/playloop.c: respect playback start time when using --loop-file
Using --loop-file should now seek to the position denoted by --start
or equivalent option, rather than always seeking to the beginning as
it had done before. --loop-playlist already behaves this way, so
this brings --loop-file in line for added consistency.
2017-12-03 22:32:36 -05:00
Leo Izen
ff7e294610 player: use start timestamp for ab-looping if --ab-loop-a is absent
If --ab-loop-b is present, then ab-looping will be enabled and will
attempt to seek to the beginning of the file. This patch changes it
so it will instead seek to the start of playback, either via --start
or some equivalent, rather than always to the beginning of the file.
2017-12-03 22:23:24 -05:00
Leo Izen
a6ca167794 player: add get_play_start_pts
Added a get_play_start_pts function to coincide with the
already-existing get_play_end_pts. This prevents code duplication
and also serves to make it so code that probes the start time
(such as get_current_pos_ratio) will work correctly with chapters.

Included is a bug fix for misc.c/rel_time_to_abs that makes it work
correctly with chapters when --rebase-start-time=no is set.
2017-12-03 21:57:34 -05:00
Nicolas F
744b67d9e5 Fix various typos in log messages 2017-12-03 21:24:18 +01:00
wm4
076b1d266e audio: fix missing volume update on init and reinit
This is never updated after the AO inits, so there are several cases
where the volume would stay at 100%, even if it shouldn't. This affects
initial volume as well as track switching or switching between files.
2017-12-01 21:18:06 +01:00
Nicolas F
2e24f5f1b5 scripting: report dlerror() output
dlopen() and dlsym() can fail in various ways, and we can find out
how it failed by calling dlerror(). This is particularly useful if
you typo the filename of a script when explicitly passing it with
--script, and dlopen actually tells you that the file doesn't exist
instead of leading you down a rabbit hole of disassembling your
shared object file to figure out why the thing won't load.
2017-12-01 21:13:48 +01:00
wm4
eb8957cea1 vd_lavc: rewrite how --hwdec is handled
Change it from explicit metadata about every hwaccel method to trying to
get it from libavcodec. As shown by add_all_hwdec_methods(), this is a
quite bumpy road, and a bit worse than expected.

This will probably cause a bunch of regressions. In particular I didn't
check all the strange decoder wrappers, which all cause some sort of
special cases each. You're volunteering for beta testing by using this
commit.

One interesting thing is that we completely get rid of mp_hwdec_ctx in
vd_lavc.c, and that HWDEC_* mostly goes away (some filters still use it,
and the VO hwdec interops still have a lot of code to set it up, so it's
not going away completely for now).
2017-12-01 21:11:43 +01:00
wm4
91586c3592 vo_gpu: make it possible to load multiple hwdec interop drivers
Make the VO<->decoder interface capable of supporting multiple hwdec
APIs at once. The main gain is that this simplifies autoprobing a lot.
Before this change, it could happen that the VO loaded the "wrong" hwdec
API, and the decoder was stuck with the choice (breaking hw decoding).
With the change applied, the VO simply loads all available APIs, so
autoprobing trickery is left entirely to the decoder.

In the past, we were quite careful about not accidentally loading the
wrong interop drivers. This was in part to make sure autoprobing works,
but also because libva had this obnoxious bug of dumping garbage to
stderr when using the API. libva was fixed, so this is not a problem
anymore.

The --opengl-hwdec-interop option is changed in various ways (again...),
and renamed to --gpu-hwdec-interop. It does not have much use anymore,
other than debugging. It's notable that the order in the hwdec interop
array ra_hwdec_drivers[] still matters if multiple drivers support the
same image formats, so the option can explicitly force one, if that
should ever be necessary, or more likely, for debugging. One example are
the ra_hwdec_d3d11egl and ra_hwdec_d3d11eglrgb drivers, which both
support d3d11 input.

vo_gpu now always loads the interop lazily by default, but when it does,
it loads them all. vo_opengl_cb now always loads them when the GL
context handle is initialized. I don't expect that this causes any
problems.

It's now possible to do things like changing between vdpau and nvdec
decoding at runtime.

This is also preparation for cleaning up vd_lavc.c hwdec autoprobing.
It's another reason why hwdec_devices_request_all() does not take a
hwdec type anymore.
2017-12-01 05:57:01 +01:00
sfan5
244cc1f018 client: Allow "C.UTF-8" as LC_NUMERIC locale
This is required on newer Android NDKs, as setting LC_NUMERIC
to "C" will still return "C.UTF-8" if you query it.
2017-11-30 21:06:37 +02:00
wm4
d725630b5f audio: add audio softvol processing to AO
This does what af_volume used to do. Since we couldn't relicense it,
just rewrite it. Since we don't have a new filter mechanism yet, and the
libavfilter is too inconvenient, do applying the volume gain in ao.c
directly. This is done before handling the audio data to the driver.

Since push.c runs a separate thread, and pull.c is called asynchronously
from the audio driver's thread, the volume value needs to be
synchronized. There's no existing central mutex, so do some shit with
atomics. Since there's no atomic_float type predefined (which is at
least needed when using the legacy wrapper), do some nonsense about
reinterpret casting the float value to an int for the purpose of atomic
access. Not sure if using memcpy() is undefined behavior, but for now I
don't care.

The advantage of not using a filter is lower complexity (no filter auto
insertion), and lower latency (gain processing is done after our
internal audio buffer of at least 200ms).

Disavdantages include inability to use native volume control _before_
other filters with custom filter chains, and the need to add new
processing for each new sample type.

Since this doesn't reuse any of the old GPL code, nor does indirectly
rely on it, volume and replaygain handling now works in LGPL mode.

How to process the gain is inspired by libavfilter's af_volume (LGPL).
In particular, we use exactly the same rounding, and we quantize
processing for integer sample types by 256 steps. Some of libavfilter's
copyright may or may not apply, but I think not, and it's the same
license anyway.
2017-11-29 21:30:51 +01:00
wm4
3d27a0792b af: remove deprecated audio filters
These couldn't be relicensed, and won't survive the LGPL transition. The
other existing filters are mostly LGPL (except libaf glue code).

This remove the deprecated pan option. I guess it could be restored by
inserting a libavfilter filter (if there's one), but for now let it be
gone.

This temporarily breaks volume control (and things related to it, like
replaygain).
2017-11-29 21:30:51 +01:00
wm4
23d9dc5457 video: remove automatic stereo3d filter insertion
The internal stereo3d filter was removed due to being GPL only, and due
to being a mess that somehow used libavfilter's filter. Without this
filter, it's hard to remove our internal stereo3d image attribute, so
even using libavfilter's stereo3d filter would not work too well (unless
someone fixes it and makes it able to use AVFrame metadata, which we
then could mirror in mp_image).

This was never well thought-through anyway, so just drop it. I think
some "downsampling" support would still make sense, maybe that can be
readded later.
2017-11-29 21:30:51 +01:00
wm4
03518c1a83 video: fix rotation and deinterlace auto filters
Now using libavfilter filters directly.

The rotation case is a bit lazy, because it uses the slow vf_rotate
filter in all cases, instead of using special filters for 90° step
rotations.
2017-11-29 21:30:51 +01:00
wm4
d5dae869c6 player: match subtitles with language tags with --sub-auto=exact
Apparently a relatively widespread convention, and almost as strict as
the old "exact" semantics. (So it's not going to auto load radically
unrelated files.)
2017-11-27 19:45:13 +01:00
wm4
386e8cd16d player: change 3 remaining GPL-only code pieces to LGPL
There has been no new developments or agreements, but I was uncertain
about the copyright status of them. Thus this part of code was marked as
being potentially GPL, and was not built in LGPL mode. Now I've taken a
close look again, and decided that these can be relicensed using the
existing relicensing agreements.

OSD level 3 was introduced in commit 8d190244, with the author being
unreachable. As I decided in commit 6ddd95fd, OSD level 3 itself can
be kept, but the "osd" command had to go, and the "rendering" of OSD
level 3 (the HAVE_GPL code in osd.c) was uncertain. But the code for
this was rewritten: instead of duplicating the time/percent formatting
code, it was changed to use common code, and some weird extra logic was
removed. The code inside of the "if" is exactly the same as the code
that formats the OSD status line (covered by LGPL relicensing).

The current commands for adding/removing sub/audio tracks more or less
originated from commit 2f376d1b39, with the author being unreachable.
But the original code was very different, mostly due to MPlayer's
incredibly messy handling of subtitles in general. Nothing of this
remains in the current code. Even the command declarations were
rewritten. The commands (as seen from the user side) are rather similar
in naming and semantics, but we don't consider this copyrightable. So it
doesn't look like anything copyrightable is left.

The add/cycle commands were more or less based on step_property,
introduced in commit 7a71da01d6, with the patch author disagreeing with
the LGPL relicensing. But all code original to the patch has been
replaced in later mpv changes, and the original code was mostly copied
from MP_CMD_SET_PROPERTY anyway. The underlying property interface was
completely changed, the error handling was redone, and all of this is
very similar to the changes that were done on SET_PROPERTY. The command
declarations are completely different in the first place, because the
semantic change from step to add/cycle. The commit also seems to have
been co-authored by reimar to some degree. He also had the idea to
change the original patch from making the command modify a specific
property to making it generic.

(The error message line, especially with its %g formatting, might
contain some level of originality, so change that just to be sure.
This commit Copies and adapts the error message for SET_PROPERTY.)

Although I'm a bit on the fence with all the above things, it really
doesn't look like there's anything substantial that would cause issues.
I thus claim that there is no problem with changing the license to LGPL
for the above things. It's probably still slightly below the standard
that was usually applied in the code relicensing in mpv, but probably
still far above to the usual in open source relicensing (and above
commercial standards as well, if you look what certain tech giants do).
2017-11-24 14:12:10 +01:00
wm4
efbb919997 player: minor fix/simplification of OSD time/duration handling
Always display the duration as "unknown" if the duration is known. Also
fix that at least demux_lavf reported unknown duration as 0 (fix by
setting the default to unknown in demux.c).

Remove the dumb _u formatter function, and use a different approach to
avoiding displaying "unknown" as playback time on playback start (set
last_seek_pts for that).
2017-11-24 13:58:57 +01:00
wm4
8e50dc1b4d demux: export demuxer cache sizes in bytes
Plus sort of document them, together with the already existing
undocumented fields. (This is mostly for debugging, so use is
discouraged.)
2017-11-10 16:43:18 +01:00
wm4
a2a623ebb9 player: change license of some code surrounding --frames to LGPL
The original author of the patch has agreed now.
2017-11-06 20:53:27 +01:00
wm4
75cdd13e29 player: log if NDEBUG is defined
I sure want to know whether assert()s were unexpectedly not compiled in.
2017-11-04 17:48:30 +01:00
wm4
36630585f6 osc: make cycling visibility an input.conf key binding
As builtin script, it should not register global key bindings, and add
them to input.conf instead. This is similar to what stats.lua does.
2017-11-03 14:41:18 +01:00
ChrisK2
89513d26a2 osc: render seek ranges a bit less ugly 2017-11-02 22:00:12 +01:00
wm4
1d9057cb9a osc: render seek ranges
Pretty fucking ugly, but I'm not a UI designer.

Of course only does something with --demuxer-seekable-cache.
2017-11-02 20:03:53 +01:00
Nicolas F
49e925f830 screenshot: create directories from template
screenshot-template could be set to e.g. "%F/%04n", so we want to
make sure that the path generated from the template actually exists.
2017-11-02 17:07:35 +01:00
wm4
2d958dbf2b demux: refactor to export seek ranges
Even though only 1 seek range is supported at the time.

Other than preparation for possibly future features, the main gain is
actually that we finally separate the reporting for the buffering, and
the seek ranges. These can be subtly different, so it's good to have a
clear separation.

This commit also fixes that the ts_reader wasn't rebased to the start
time, which could make the player show "???" for buffered cache amount
in some .ts files and others (especially at the end, when ts_reader
could become higher than ts_max). It also fixes writing the cache-end
field in the demuxer-cache-state property: it checked ts_start against
NOPTS, which makes no sense.

ts_start was never used (except for the bug mentioned above), so get rid
of it completely. This also makes it convenient to move the segment
check for last_ts to the demux_add_packet() function.
2017-10-30 15:28:59 +01:00
wm4
4d47805a76 lavfi: fix warnings with newer libavfilter versions
Most likely will cause new warnings with avfilter_graph_alloc_filter()
on old libavfilter versions. Ingore that part.
2017-10-27 18:09:08 +02:00
wm4
41beaa653a audio: fix small memory leak
Most commonly happened with --end, in which case that field tends to be
set.
2017-10-27 13:54:08 +02:00
wm4
f08ec22567 command: change demuxer-cache-state property to return multiple ranges
Even if the demuxer cache does not multiple ranges yet. This is to
reduce the pain should caching of multiple ranges ever be implemented.

Also change it from the sub properties stuff to return a mpv_node
directly, which is less roundabout. Sub-property access won't work
anymore, though.

Remove the seekable-start/-end fields as well, as they're redundant with
the ranges.

All this would normally be considered an API change, but since it's been
only a few days with no known users, change it immediately.

This adds some node.c helpers as well, as the code would be too damn
fugly otherwise.
2017-10-26 22:31:04 +02:00
wm4
dbd22f43be demux: drop redundant SEEK_BACKWARD flag
Seems like most code dealing with this was for setting it in redundant
cases. Now SEEK_BACKWARD is redundant, and SEEK_FORWARD is the odd one
out.

Also fix that SEEK_FORWARD was not correctly unset in try_seek_cache().

In demux_mkv_seek(), make the arbitrary decision that a video stream is
not required for the subtitle prefetch logic to be active. We might want
subtitles with long duration even with audio only playback, or if the
file is used as external subtitle.
2017-10-23 19:05:39 +02:00
Nicolas F
0358cca39e video: fix typo in log message 2017-10-22 16:51:09 +11:00
wm4
60df01512c command: read the diff if you want to know 2017-10-21 21:13:53 +02:00
wm4
719a435d36 demux: add a back buffer and the ability to seek into it
This improves upon the previous commit, and partially rewrites it (and
other code). It does:

- disable the seeking within cache by default, and add an option to
  control it
- mess with the buffer estimation reporting code, which will most likely
  lead to funny regressions even if the new features are not enabled
- add a back buffer to the packet cache
- enhance the seek code so you can seek into the back buffer
- unnecessarily change a bunch of other stuff for no reason
- fuck up everything and vomit ponies and rainbows

This should actually be pretty usable. One thing we should add are some
properties to report the proper buffer state. Then the OSC could show a
nice buffer range. Also configuration of the buffers could be made
simpler. Once this has been tested enough, it can be enabled by default,
and might replace the stream cache's byte ringbuffer.

In addition it may or may not be possible to keep other buffer ranges
when seeking outside of the current range, but that would be much more
complex.
2017-10-21 19:26:33 +02:00
wm4
872c2403a4 video: fix poitential NULL deref
Regression introduced by direct rendering code additions. Found by same
static analyzer.
2017-10-18 12:14:56 +02:00
wm4
ddfccd67d5 video: remove special path for hwdec screenshots
This was phased out, and was used only by vdpau by now. Drop the
mechanism and the vdpau special code, which means screenshots won't
include the vf_vdpaupp processing anymore. (I don't care enough about
vdpau, it's on its way out.)
2017-10-16 17:07:35 +02:00
Julian
5f8438bce6 stats: add file size
also one minor cosmetic change: comment the "coming soon" dummy page
2017-10-13 00:28:41 +02:00
wm4
5f012f2d16 audio: clarify GPL-only parts 2017-10-10 17:36:35 +02:00
Julian
92a9150cc2 lua: integrate stats.lua script
Signed-off-by: wm4 <wm4@nowhere>

Rename --stats to --load-stats-overlay and add an entry to options.rst
over the original commit.

Signed-off-by: wm4 <wm4@nowhere>
2017-10-09 20:47:33 +02:00
Julian
c38ad6ae6f stats: change the way toggling/oneshot works internally
Previously multiple timers were used to realize oneshot, toggling
(redrawing) and page keybindings. The oneshot case in particular also
relied on mp.osd_message to display text only for a given duration.
This was changed to only use one timer in total now. Because now each
case has a defined "start" and "end" point (including oneshot)
mp.set_osd_ass() can be used to print stats as well. This is currently
optional and has to be activated using the config option
persistent_overlay=true.

One shortcoming: oneshot and toggling are mutual exclusive right now.
Previously you could enter toggling while oneshot stats were shown,
this is not possible anymore to reduce the number of cases to be
considered. This can be added later on if desired.
2017-10-09 20:40:32 +02:00
Julian
eadec19d22 stats: stop coloring timing values
It used a bad heuristic that got even worse/less reliable with recent
changes in mpv. In fact, it's not reliable at all.
Watch out for dropped frames instead. That's a useful indicator.
2017-10-09 20:40:32 +02:00
Julian
54b3a9fdb0 stats: add current and total chapter number
Fixes #44
(well, partially, I'm still not sure about the time)
2017-10-09 20:40:32 +02:00
Jan Janssen
01f2798e04 stats: add audio and video filters 2017-10-09 20:40:32 +02:00
Niklas Haas
055fc5ced3 stats: reorganize the framedrop counters
Clarified the relationship between `Dropped` and `VO`, and also merged
the DS-exclusive stats into the DS line.
2017-10-09 20:40:32 +02:00
Julian
1016ff34ea stats: revert DR indicator as it's unnecessary
It's apparently already stated as part of the upload pass name.
This reverts commit ec837f64c29a1b825e28b65edc34059b6c1cad40.
2017-10-09 20:40:32 +02:00
Julian
9bcb8f3bd9 stats: reduce default font size to 8 2017-10-09 20:40:32 +02:00
Julian
19b8dfbd2b stats: visually indicate direct rendering 2017-10-09 20:40:32 +02:00
Julian
5c8e9e8072 stats: change font weight of % sign as well
Due to popular demand
2017-10-09 20:40:32 +02:00
Julian
d0608d3fdf stats: fix indentation/newline of frame timing page
There was a superfluous newline and some indentation
2017-10-09 20:40:32 +02:00
Julian
471b152527 stats: show % of a pass on frame timing page 2017-10-09 20:40:32 +02:00
Julian
f0719727cc stats: always print perfdata total
There's no point in disabling it anyway
2017-10-09 20:40:32 +02:00
Julian
1231b1ae68 stats: make add_header() append at current position 2017-10-09 20:40:32 +02:00
Julian
96ef2aa48b stats: print perfdata total by default
There is enough space now
2017-10-09 20:40:32 +02:00
Julian
56029b6b59 stats: mark dummy as such 2017-10-09 20:40:32 +02:00
Julian
9470ccd8ae stats: correctly re-eval ASS tag usage
Fixes #42
2017-10-09 20:40:32 +02:00
Julian
b93efd0a52 stats: make page keybinding repeatable
There's no reason it's not.
2017-10-09 20:40:32 +02:00
Julian
6c7aae769a stats: remove table in table
Almost cosmetic change.
This tables-in-table was done back when we actually processed strings
but that's long ago now and no longer needed nor useful.
2017-10-09 20:40:32 +02:00
Julian
783046f5ff stats: resilience against accidential timer removal
Previously I could trigger a bug with intense button mashing, however,
was unable to reproduce it and therefore debug it.
This change now seems to be resilient against button mashing, let's hope
it really is.
2017-10-09 20:40:32 +02:00
Julian
21603dd5af stats: allow keybindings for specific page
A keybinding in input.conf like:
   e script-binding stats/display-page-2
can be used to directly show the respective page (2, in this case)
2017-10-09 20:40:32 +02:00
Julian
98ddbf8c34 stats: support for multiple "pages" of stats
Please note that the latest version of this script needs a very recent
version of mpv (from yesterday, to be precise, see the readme).
For older versions, please go to "releases".

HOW IT WORKS:
While the stats are visible (i.e. text is printed to the OSD) a
subsequent click on a numeric key (1, 2, ...) will display the
corresponding "page".
This works no matter if the stats are toggled or just shown as a single
invocation. In case of a single invocation, the newly displayed page
will be shown for the full duration again.
The selected page will be remembered (not persistantly though).

So far, only 3 pages are available.
1: the default page, stats as they used to be
2: extensive VO performance stats (to be redesigned/changed soon)
3: dummy

In the future, many more pages are possible.

Implementation is likely to change again (functionality will stay
the same). A new timer had to be introduced to remove the forced
keybindings in the oneshot case. The toggle case can remove them without
a timer. Ensuring that each mode won't remove timers of the other mode
didn't really turn out neat.
Therefore, I intend to change this again, maybe by merging the
oneshot case into the toggle case.
2017-10-09 20:40:32 +02:00
Julian
c04ff9dce0 stats: remove check for lua timer function
We now require a modern mpv version.
`property_aliases` is kept for future use.
2017-10-09 20:40:32 +02:00
Niklas Haas
1691b978cf stats: rescale graphs to make the average align with the center, if possible
For vsync measurements this is not currently done because they don't
track their average
2017-10-09 20:40:32 +02:00
Niklas Haas
22a8b99f7a stats: add support for vo-passes, which replaces vo-performance
Due to the large amount of per-pass data, the function takes a parameter
indicating whether or not to print a simplified view instead.

The overall intent is to print the simplified view for now, but supposed
printing the full view on a dedicated "tab" (or extra view type), and as
such, `o.print_perfdata_passes` will go away again. I've only introduced
it for now so users can play around with this functionality if they want
to, until Argon- gets around to implementing stats "tabs".
2017-10-09 20:40:32 +02:00
Niklas Haas
6d10d5a29f stats: update HDR peak for upstream changes
This no longer reports cd/m² but now reports a relative peak as a
multiple of the SDR reference brightness.
2017-10-09 20:40:32 +02:00
Julian
fa80ac13b6 stats: add support for deprecated properties
Previously, we used a property and when it was unavailable we assumed it
doesn't exist before assuming it really is just unavailable. This lead
to unnecessarily falling back to deprecated properties which made mpv
print deprecation warnings.
Now we can really check if a property is not known to mpv.
The alternative would've been to check the error part of mp.get_property
and perform string comparisons on the returned error message.

Not sure if supporting old mpv versions is actually worth it though.

Fixes #37 #36
2017-10-09 20:40:32 +02:00
Julian
6f9a7d1fdb stats: comment to remind me about deprecated properties 2017-10-09 20:40:32 +02:00
Ricardo Constantino
7429eace57 stats: add new versions of decoder and VO dropped frame counts 2017-10-09 20:40:32 +02:00
Julian
bd0d0befc0 stats: put vsync ratio and jitter on the same line
Free some vertical space. Hope this doesn't hurt visibility.
2017-10-09 20:40:32 +02:00
Julian
8bc6c91f4a stats: declare function as local
Apparently forgot this one
2017-10-09 20:40:32 +02:00
Julian
c02d89fcd1 stats: use container-fps together with fps (as fallback)
This was already done for the actual stats a few months ago.
Now it is also used by the perfdata coloring code.
2017-10-09 20:40:32 +02:00
Julian
c4ea382894 stats: rename option timing_total to print_perfdata_total
Should make its purpose more clear. Also add a comment to further
explain its use.
2017-10-09 20:40:31 +02:00
Julian
5a9ccfdcb8 stats: add vsync-ratio and vsync-jitter
Both come with graphs enabled by default.
They can be disabled using the options plot_vsync_ratio and
plot_vsync_jitter (see the readme regarding customization).

In case both graphs are deactivated the ratio and jitter properties will
be printed on the same line to save some space.

One more user-visible/noticeable change: the maximum used to scale the
values for each graph is no longer calculated each time the stats are
shown but instead when collecting the data. This means the maximum
can actually be higher than all values currently present in a graph's
data buffer. This makes it easier to judge a graph's values, especially
since as we have no axis labels.
To prevent high values staying max forever graph data buffers are
cleared when toggling (can be disabled). It was never useful to
keep old data and simply append newer data (with a time skip) anyway.
2017-10-09 20:40:31 +02:00
Julian
78cbe40fa5 stats: add some documentation for generate_graph() 2017-10-09 20:40:31 +02:00
Julian
b58b812384 stats: access less variables outside function's state 2017-10-09 20:40:31 +02:00
Ricardo Constantino (:RiCON)
fa0b1f071a stats: add new container-fps that deprecates fps 2017-10-09 20:40:31 +02:00
Ricardo Constantino (:RiCON)
49d64997ef stats: remove hwdec-active property 2017-10-09 20:40:31 +02:00
Julian
97c1cd6658 stats: fix bug introduced in earlier commit
Commit 76387aba26574d0d96af688cf11d10bd165171f7 broke the script in case
of timing_total=true.
2017-10-09 20:40:31 +02:00
Julian
3f4fd36aa8 stats: fix comment typo 2017-10-09 20:40:31 +02:00
Julian
6c7385c539 stats: disable coloring peak performance data
The peak value is probably not very well suited to draw many conclusions
from it.
2017-10-09 20:40:31 +02:00
Julian
0242165b3c stats: change coloring of performance data
Previously it used display-fps to determine coloration even when
display-sync was not even used.
2017-10-09 20:40:31 +02:00
Julian
9d8495a960 stats: save ASS sequences locally
Instead of querying them constantly.
Also add a tiny bit of documentation to some variables.
2017-10-09 20:40:31 +02:00