Commit Graph

2026 Commits

Author SHA1 Message Date
Julian a87af63365 stats: rename some functions
More useful names
2017-10-09 20:40:31 +02:00
Julian 2f5ee99509 stats: add toggling of stats
You can now either show the stats once or toggle their display. Both are
using different key bindings which are additionally configurable now.

Please bear in mind that "toggling" means "redraw every x seconds for x
seconds". Therefore, this approach is prone to problems especially when
something else is printing text to the OSD as well as every of these
calls will overwrite each other. This is currently a limitation of mpv.

Fixes #18
2017-10-09 20:40:31 +02:00
Ricardo Constantino (:RiCON) fe5b042b74 stats: add hwdec-current
Fallback to hwdec-active if not available. This one will be removed in
mpv 0.19.0.
2017-10-09 20:40:31 +02:00
Ricardo Constantino (:RiCON) 7c261899cf stats: add cache-speed 2017-10-09 20:40:31 +02:00
Julian 5fb8dc5943 stats: decrease default font size
It's getting a bit cramped
2017-10-09 20:40:31 +02:00
Niklas Haas bee7404efc stats: add video-params/gamma property 2017-10-09 20:40:31 +02:00
Kevin Mitchell 1f41c729bb stats: update frame drop diagnostics 2017-10-09 20:40:31 +02:00
Kevin Mitchell 41246c8a34 stats: add display fps 2017-10-09 20:40:31 +02:00
Julian 1a1e5b87fb stats: rename some variables for consistency 2017-10-09 20:40:31 +02:00
Niklas Haas 47016bf45e stats: add support for video-sync=display 2017-10-09 20:40:31 +02:00
Julian f22361727e stats: fix line wrapping
These spaces were not displayed on screen, however they were taken into
account for line wrapping.
2017-10-09 20:40:31 +02:00
Julian 6402f88de4 stats: remove dead link from comment 2017-10-09 20:40:31 +02:00
Rostislav Pehlivanov 918774b5aa stats: print bold text in terminals
This simply prints ASCII codes to display any text marked as bold in the
terminal. Supported by every sane terminal since 1986. For those insane,
there's a check. The check has been copied from the ansicolors.lua
script floating around and it checks if the directory path uses "\"
instead of "/", and in case it does, it checks whether ANSICON env
variable has been set (which is used to indicate the Windows terminal
supports ACII escape sequences).
2017-10-09 20:40:31 +02:00
Julian 89c854dc09 stats: minor simplification 2017-10-09 20:40:31 +02:00
Julian 3dbd031da0 stats: remove countless hardcoded strings
feels a bit better that way
2017-10-09 20:40:31 +02:00
Julian 6ed69cb132 stats: document append_property return value 2017-10-09 20:40:31 +02:00
Julian ab8b6e3c16 stats: fix oversight
this one slipped through my "tests"
2017-10-09 20:40:31 +02:00
Julian 95b6bc31b0 stats: unify redundant functions
Unify both append_property* functions and greatly refactor them.
Instead of thousands of arguments we now use a table.
While this is in theory cleaner it does not exactly look like it.
However, it's way more flexible and extendable this way.
Also, since the new append_property() might look a bit confusing
I felt the need to add a comment.
2017-10-09 20:40:31 +02:00
Julian d88adcfbc7 stats: proper usage of imported module
and comment nitpicking
2017-10-09 20:40:31 +02:00
Julian 0bf4b0d18a stats: add debug option
print a warning for properties without value
2017-10-09 20:40:31 +02:00
Julian f9fe3b264e stats: reflect latest changes to mpv
Some properties were renamed recently.
Of course this requires a recent mpv built (>
https://github.com/mpv-player/mpv/commit/f9507f) now.
2017-10-09 20:40:31 +02:00
Julian a78fce4676 stats: don't add superfluous EOL characters
Previously we unnecessarily added newline characters at the end.
Only noticeable when printed on terminal, though.
2017-10-09 20:40:31 +02:00
Julian 81efbc3921 stats: make non-ASS styling configurable
Also add a few convenience functions and remove the unused italic and
underlined formatting functions.
2017-10-09 20:40:31 +02:00
Rostislav Pehlivanov 9e57927af1 stats: make the OSD usable in audio-only mode
Previously, the script would throw garbage (ASS tags) at the terminal
when the bound key was pressed. This changes the behaviour to _not_
print any ASS tags (and replace those which can be interpreted by the
terminal) if there's no video.

I cleaned the patch up since you mentioned you were busy. As I said
before, there is absolutely no problem with calling mpv to display
strings to the OSD without any video. They'll just go straight to the
terminal just as they would with an active VO.
2017-10-09 20:40:31 +02:00
Julian 74e215e9bf stats: avoid clashing with similar named scripts 2017-10-09 20:40:31 +02:00
Julian c2f0557977 stats: initial commit 2017-10-09 20:40:31 +02:00
wm4 b6af3db568 command: drop "audio-out-detected-device" property
Coreaudio stopped setting it a few releases ago (66a958bb4f). There is
not much of a user- or API-visible change, so remove it without
deprecation.
2017-10-09 15:48:47 +02:00
wm4 bfae72a278 player: change a minor code fragment to LGPL
Seems absurd to keep this under GPL, since it's only a tiny code
fragment (that would always look the same, no matter if you rewrote it
independently), but now I got proper permission from the original author
anyway.
2017-10-04 19:10:52 +02:00
Avi Halachmi (:avih) 365b1d4f3d osc: fix rare stack overflow when changing visibility mode
Under some conditions, hide_osc() was calling render(), which then called
hide_osc() again, and so forth, until the stack overflows.

Tracking the exact conditions where this happens (and then managing them
to prevent it) is an excercise in futility.

Remove the osc directly - instead of going through the entire rendering
procedure just to end up rendering nothing.

Fixes #4900 .
2017-09-23 14:41:17 +03:00
Avi Halachmi (:avih) 2dd2acac89 js: fix broken mp.set_property_number, mp.set_property_native
Also implicitly fixes memory leak when mp.set_property_native was used,
because the cleanup did not expect more allocations from the accidental
use of mpv_get_property.
2017-09-23 14:41:17 +03:00
Niklas Haas 65979986a9 vo_opengl: refactor into vo_gpu
This is done in several steps:

1. refactor MPGLContext -> struct ra_ctx
2. move GL-specific stuff in vo_opengl into opengl/context.c
3. generalize context creation to support other APIs, and add --gpu-api
4. rename all of the --opengl- options that are no longer opengl-specific
5. move all of the stuff from opengl/* that isn't GL-specific into gpu/
   (note: opengl/gl_utils.h became opengl/utils.h)
6. rename vo_opengl to vo_gpu
7. to handle window screenshots, the short-term approach was to just add
   it to ra_swchain_fns. Long term (and for vulkan) this has to be moved to
   ra itself (and vo_gpu altered to compensate), but this was a stop-gap
   measure to prevent this commit from getting too big
8. move ra->fns->flush to ra_gl_ctx instead
9. some other minor changes that I've probably already forgotten

Note: This is one half of a major refactor, the other half of which is
provided by rossy's following commit. This commit enables support for
all linux platforms, while his version enables support for all non-linux
platforms.

Note 2: vo_opengl_cb.c also re-uses ra_gl_ctx so it benefits from the
--opengl- options like --opengl-early-flush, --opengl-finish etc. Should
be a strict superset of the old functionality.

Disclaimer: Since I have no way of compiling mpv on all platforms, some
of these ports were done blindly. Specifically, the blind ports included
context_mali_fbdev.c and context_rpi.c. Since they're both based on
egl_helpers, the port should have gone smoothly without any major
changes required. But if somebody complains about a compile error on
those platforms (assuming anybody actually uses them), you know where to
complain.
2017-09-21 15:00:55 +02:00
wm4 bfa9b62858 build: add preliminary LGPL mode
See "Copyright" file for caveats.

This changes the remaining "almost LGPL" files to LGPL, because we think
that the conditions the author set for these was finally fulfilled.
2017-09-21 13:56:27 +02:00
wm4 fdb300b983 audio: make libaf derived code optional
This code could not be relicensed. The intention was to write new filter
code (which could handle both audio and video), but that's a bit of
work. Write some code that can do audio conversion (resampling,
downmixing, etc.) without the old audio filter chain code in order to
speed up the LGPL relicensing.

If you build with --disable-libaf, nothing in audio/filter/* is compiled
in. It breaks a few features, such as --volume, --af, pitch correction
on speed changes, replaygain.

Most likely this adds some bugs, even if --disable-libaf is not used.
(How the fuck does EOF notification work again anyway?)
2017-09-21 12:48:30 +02:00
wm4 caaa1189ba audio_buffer: remove dependency on mp_audio
Just reimplement it in some way, as mp_audio is GPL-only.

Actually I wanted to get rid of audio_buffer.c completely (and instead
have a list of mp_aframes), but to do so would require rewriting some
more player core audio code. So to get this LGPL relicensing over
quickly, just do some extra work.
2017-09-21 04:10:19 +02:00
wm4 80e3173aa1 options: remove --heartbeat-cmd and --heartbeat--interval
This mechanism uses system() and shouldn't even exist. x11_common.c has
its own solution for the original problem (disabling Linux DE
screensavers without MPlayer/mpv having to link a dbus lib). If that is
not sufficient, you can create a simple Lua script.

Incidentally fixes #4888.
2017-09-18 22:54:03 +02:00
Niklas Haas 3faf1fb0a4
vo: avoid putting large voctrl_performance_data on stack
This is around 512 kB, which is just way too much. Heap-allocate it
instead. Also cut down the max pass count to 64, since 128 was
unrealistically high even for vo_opengl.
2017-09-11 18:20:18 +02:00
Niklas Haas 1da53248ab
vo_opengl: refactor/fix mp_pass_perf code
This was needlessly complicated and prone to breakage, because even the
references to the ring buffer could end up getting invalidated and
containing garbage data on e.g. shader cache flush. For much the same
reason why we can't keep around the *timer_pool, we're also forced to
hard-copy the entire sample buffer per pass per frame.

Not a huge deal, though. This is, what, a few kB per frame? We have more
pressing CPU performance concerns anyway.

Also simplified/fixed some other code.
2017-09-11 00:35:23 +02:00
Ricardo Constantino d280b3db93
ytdl_hook: resolve relative paths when joining segment urls
FFmpeg/mpv don't do it automatically.
See #4827
2017-09-03 13:42:51 +01:00
wm4 181b071431 audio: fix format change regression
Ever since the mp_aframe change, audio mid-stream format changes crash.
I have no idea why the recent mp_aframe change triggers this. Didn't
look too deeply into it either. It appears to work now, though.

Fixes #4828.
2017-09-03 13:09:49 +02:00
James Ross-Gowan 7897f79217 input: merge mouse wheel and axis keycodes
Mouse wheel bindings have always been a cause of user confusion.
Previously, on Wayland and macOS, precise touchpads would generate AXIS
keycodes and notched mouse wheels would generate mouse button keycodes.
On Windows, both types of device would generate AXIS keycodes and on
X11, both types of device would generate mouse button keycodes. This
made it pretty difficult for users to modify their mouse-wheel bindings,
since it differed between platforms and in some cases, between devices.

To make it more confusing, the keycodes used on Windows were changed in
18a45a42d5 without a deprecation period or adequate communication to
users.

This change aims to make mouse wheel binds less confusing. Both the
mouse button and AXIS keycodes are now deprecated aliases of the new
WHEEL keycodes. This will technically break input configs on Wayland and
macOS that assign different commands to precise and non-precise scroll
events, but this is probably uncommon (if anyone does it at all) and I
think it's a fair tradeoff for finally fixing mouse wheel-related
confusion on other platforms.
2017-09-03 20:31:44 +10:00
James Ross-Gowan 957e9a37db input: use mnemonic names for mouse buttons
mpv's mouse button numbering is based on X11 button numbering, which
allows for an arbitrary number of buttons and includes mouse wheel input
as buttons 3-6. This button numbering was used throughout the codebase
and exposed in input.conf, and it was difficult to remember which
physical button each number actually referred to and which referred to
the scroll wheel.

In practice, PC mice only have between two and five buttons and one or
two scroll wheel axes, which are more or less in the same location and
have more or less the same function. This allows us to use names to
refer to the buttons instead of numbers, which makes input.conf syntax a
lot easier to remember. It also makes the syntax robust to changes in
mpv's underlying numbering. The old MOUSE_BTNx names are still
understood as deprecated aliases of the named buttons.

This changes both the input.conf syntax and the MP_MOUSE_BTNx symbols in
the codebase, since I think both would benefit from using names over
numbers, especially since some platforms don't use X11 button numbering
and handle different mouse buttons in different windowing system events.

This also makes the names shorter, since otherwise they would be pretty
long, and it removes the high-numbered MOUSE_BTNx_DBL names, since they
weren't used.

Names are the same as used in Qt:
https://doc.qt.io/qt-5/qt.html#MouseButton-enum
2017-09-03 20:31:44 +10:00
wm4 b62150bd6b command: restore OSD marker for video equalizer properties
Commit 03cf150ff3 accidentally dropped these. Readd them in a simpler
way (so only a property_osd_display[] entry is enough). This commit
doesn't actually touch the video equalizer properties, because the
default value of 0 for the marker is what they require anyway.
2017-08-23 14:23:37 +02:00
wm4 8f2ccba71b video: change --deinterlace behavior
This removes all GPL only code from it, and that's the whole purpose.
Also happens to be much simpler.

The "deinterlace" option still sort of exists, but only as runtime
changeable option. The main change in behavior is that the property will
not report back the actual deint state. Or in other words, if inserting
or initializing the filter fails, the deinterlace property will still
return "yes". This is in line with most recent behavior changes to
properties and options.
2017-08-22 19:08:07 +02:00
wm4 03cf150ff3 video: redo video equalizer option handling
I really wouldn't care much about this, but some parts of the core code
are under HAVE_GPL, so there's some need to get rid of it. Simply turn
the video equalizer from its current fine-grained handling with vf/vo
fallbacks into global options. This makes updating them much simpler.

This removes any possibility of applying video equalizers in filters,
which affects vf_scale, and the previously removed vf_eq. Not a big
loss, since the preferred VOs have this builtin.

Remove video equalizer handling from vo_direct3d, vo_sdl, vo_vaapi, and
vo_xv. I'm not going to waste my time on these legacy VOs.

vo.eq_opts_cache exists _only_ to send a VOCTRL_SET_EQUALIZER, which
exists _only_ to trigger a redraw. This seems silly, but for now I feel
like this is less of a pain. The rest of the equalizer using code is
self-updating.

See commit 96b906a51d for how some video equalizer code was GPL only.
Some command line option names and ranges can probably be traced back to
a GPL only committer, but we don't consider these copyrightable.
2017-08-22 17:01:35 +02:00
wm4 d2bdb72b69 options: add a thread-safe way to notify option updates
So far, we had a thread-safe way to read options, but no option update
notification mechanism. Everything was funneled though the main thread's
central mp_option_change_callback() function. For example, if the
panscan options were changed, the function called vo_control() with
VOCTRL_SET_PANSCAN to manually notify the VO thread of updates. This
worked, but's pretty inconvenient. Most of these problems come from the
fact that MPlayer was written as a single-threaded program.

This commit works towards a more flexible mechanism. It adds an update
callback to m_config_cache (the thing that is already used for
thread-safe access of global options).

This alone would still be rather inconvenient, at least in context of
VOs. Add another mechanism on top of it that uses mp_dispatch_queue, and
takes care of some annoying synchronization issues. We extend
mp_dispatch_queue itself to make this easier and slightly more
efficient.

As a first application, use this to reimplement certain VO scaling and
renderer options. The update_opts() function translates these to the
"old" VOCTRLs, though.

An annoyingly subtle issue is that m_config_cache's destructor now
releases pending notifications, and must be released before the
associated dispatch queue. Otherwise, it could happen that option
updates during e.g. VO destruction queue or run stale entries, which is
not expected.

Rather untested. The singly-linked list code in dispatch.c is probably
buggy, and I bet some aspects about synchronization are not entirely
sane.
2017-08-22 15:50:33 +02:00
wm4 1f593beeb4 audio: introduce a new type to hold audio frames
This is pretty pointless, but I believe it allows us to claim that the
new code is not affected by the copyright of the old code. This is
needed, because the original mp_audio struct was written by someone who
has disagreed with LGPL relicensing (it was called af_data at the time,
and was defined in af.h).

The "GPL'ed" struct contents that surive are pretty trivial: just the
data pointer, and some metadata like the format, samplerate, etc. - but
at least in this case, any new code would be extremely similar anyway,
and I'm not really sure whether it's OK to claim different copyright. So
what we do is we just use AVFrame (which of course is LGPL with 100%
certainty), and add some accessors around it to adapt it to mpv
conventions.

Also, this gets rid of some annoying conventions of mp_audio, like the
struct fields that require using an accessor to write to them anyway.

For the most part, this change is only dumb replacements of mp_audio
related functions and fields. One minor actual change is that you can't
allocate the new type on the stack anymore.

Some code still uses mp_audio. All audio filter code will be deleted, so
it makes no sense to convert this code. (Audio filters which are LGPL
and which we keep will have to be ported to a new filter infrastructure
anyway.) player/audio.c uses it because it interacts with the old filter
code. push.c has some complex use of mp_audio and mp_audio_buffer, but
this and pull.c will most likely be rewritten to do something else.
2017-08-16 21:10:54 +02:00
wm4 68201f4591 player: make refresh seeks slightly more robust
Refresh seeks are automatically issued when changing filters, which
improves user experience if these filters change buffering or such.

The refresh seek could actually overwrite a previously ongoing seek:

	set pause yes
	set time-pos 10
	set vf ""

Here, the video code issued a refresh seek to the previous video
position, which could be different from the previously triggered (and
still ongoing) seek, this overwriting the seek.

Factor all refresh seek handling into a new function, and make it handle
ongoing seeks correctly.

Remove the weird new canonical_pts field, which actually had no use.

Fixes #4757.
2017-08-14 14:02:13 +02:00
wm4 b6d79deebb player: do not destroy VO immediately if there is no video track
Commit f1d161d55f accidentally added the handle_force_window() call if
no track is selected.

This was OK, but breaks something like "mpv *", where some files are not
playable (like subtitle files) - the unplayable files would remove and
recreate the VO window, which is annoying.

Just drop the call again.
2017-08-14 12:19:54 +02:00
wm4 c6628a5fb6 player: add --track-auto-selection option
I imagine this is useful. Or maybe it isn't.
2017-08-12 23:44:47 +02:00
wm4 b531332835 player: fix another audio resync issue
This oddly triggers bogus EOF when switching filter graphs between two
audio files (in this case, "[vid1]f[vo];[aid2]f[ao]"->"[aid1]f[ao]",
with aid2 being an external audio source).

This commit also fixes desync when seeking with an external file
connected via --lavfi-complex.

(Yes, the audio resync code is cursed.)
2017-08-12 23:35:12 +02:00