Commit Graph

11358 Commits

Author SHA1 Message Date
rcombs 4dcaf70b96 Revert "options: disable vsfilter blur compat by default"
This reverts commit 3d17e19c2c.

The effect of turning off this setting is that mpv doesn't tell libass what
the video stream's resolution is. This happens to result in some files having
their transforms scaled in ways that give higher performance (as described
in #7435) because libass happened to guess a video resolution that resulted
in transforms yielding smaller bitmaps, but it's just as easy for the opposite
to happen depending on the resolutions and effects involved.

The option's name is also somewhat misleading: setting the storage size affects
blur, but it also affects stroke (which is far more important for the vast
majority of scripts) and 3D transforms (which look very screwy when done wrong).
2020-11-22 17:37:43 +02:00
Shreesh Adiga 6ad3e2bfbd vo_sixel: Add aspect ratio based output centering
Resize the image based on the dimensions reported by
vo_get_src_dst_rects to correctly handle aspect ratio
that might be set/ignored.

Added pad-x and pad-y options for padding.
These options will be used to remove the extra padding.
Some terminals report the padding of 2px in the ioctl
dimensions which can't be used for displaying sixel
output. These options can be used for fine tuning
the output video resolution.

Now all the terminal size detection and calculation logic
is done in a single function at resize. Also top and left
values are computed from the dst_rect parameters to simplify
the logic for the aspect ratio based centering.

Additionally vo-sixel-rows and vo-sixel-cols options
have been added to enable the user to override the values
in case of failures with get_terminal_size2.

This commit also adds ability to handle video zoom correctly.
Whenever video-zoom is triggered, the src and dst rects
will be updated. Scaling seems to work well now.
2020-11-22 13:34:25 +02:00
Emanuele Torre 38275338ee doc: split BNF definitions of <command> and <argument> in separate lines
Having them in the same line made it hard to read them in the man page
since they are formatted in the same way and they look as though they
are only one definition.
2020-11-22 01:23:42 +02:00
Leo Izen 9b5672ebed manpage: document improved --playlist security
Recent versions of mpv have applied security checks to --playlist
that previously only existed if playlist files were played as an
input directly. This commit documents this change and how to work
around it, in the event that playlist files are trusted.
2020-11-18 17:30:07 -05:00
Avi Halachmi (:avih) 3710c154d4 docs/input.rst: document the mouse-pos property 2020-11-16 20:29:58 +02:00
wm4 26fc70dbfd path: do not use old_home for win32 exe dir
Apparently mpv supports loading config files from the same directory as
the mpv.exe. This is a fallback of some sort. It used the old_home
mechanism.

I want to add a warning if old_home exists, but that would always show
the warning on win32. Obviously we don't want that.

Add a separate exe_dir entry to deal with that.

Untested, but probably works.

Mistakenly reverted as part of the default configuration directory
location switch-back in aa18a8e1cd.

Separation of the mpv executable directory from old_path is a
good change now that we warn about the old_config directory also
existing.

Fixes #8232
Fixes #8244
Fixes #8262
2020-11-16 00:44:40 +02:00
Avi Halachmi (:avih) 932c1ada0f js: report scripts CPU/memory usage statistics
This can be viewed at page 4 of the internal stats display (i or I).

CPU time report is the same as at lua.c, but untested - doesn't seem
to work on windows - also not for lua.

TL;DR: Set env MPV_LEAK_REPORT=1 to enable js memory reporting stats.
       This also almost doubles the memory usage by js scripts.

For memory reporting, we don't have enough info by default, because
even when using a custom allocator, mujs doesn't report the old size
(on free or realloc) because it doesn't track this value, and as
a result we can't track the overall size.

Our option are either to track the size of each allocation on our own,
or use talloc which tracks this value.

However, using talloc for mujs allocations adds a considerable
overhead, and almost doubles(!) the overall memory used, because each
individual allocation includes a considerable talloc header, and mujs
does many small allocations.

So our solution is that by default we behave like previously - not
using a custom allocator with mujs, and stats does not display memory
usage for js scripts.

However, if the env var MPV_LEAK_REPORT is set to 1, then we use
a custom allocator with talloc and track/report memory usage.

We can't switch allocator at runtime, so an mpv instance either tracks
or doesn't track js scripts memory usage, according to the env var.
(we could use a property and apply it whenever a new script starts,
so that it could change for newly launched scripts, but we don't).
2020-11-15 20:36:04 +02:00
Guido Cella 34f2143e8f manpage: properties fixes
- Explain which properties are writeable.
- Mark edition-list/N/id as writable.
- Remove (R) from some read-only properties since none of the others
have it.
- Add osd-dimension/ to its subproperties.
- options/<name> isn't read-only.
- focused works on macOS because of 82eda2e. Though it shouldn't be
possible to observe it without raising VO_EVENT_FOCUS.
2020-11-11 18:20:33 +00:00
Guido Cella 0ed4d66290 manpage: document the property-change event 2020-11-11 18:20:33 +00:00
Guido Cella fb819f069f manpage: document video-frame-info sub-properties
The picture type is explained in /usr/include/libavutil/avutil.h
Other subproperties in /usr/include/libavutil/frame.h
And there is a more detailed explanation for repeat_pict in
/usr/include/libavcodec/avcodec.h
2020-11-11 18:20:33 +00:00
Guido Cella 39ca957874 manpage: remove redundant "Return(s) "
...from the property descriptions that include it, and reformat the
paragraphs.
And say "Returns" in idle-active.
2020-11-11 18:20:33 +00:00
Guido Cella 5da326a8bb manpage: document demuxer-cache-state better 2020-11-11 18:20:33 +00:00
Guido Cella 81dfaa4962 manpage: be consistent with booleans
When possible, refer to booleans with "Whether..." since it can refer to
both yes (using input.conf and mp.get_property) and true (using the JSON
IPC or mp.get_property_native/bool), else explicitly say yes/true.
Say "true" for subprocess and osd-overlay named arguments since you
can't use them in input.conf and you will typically use them with the
boolean true in the named arguments, like the subprocess example in the
manpage does (though the string "yes" also works).
Subproperties that can't be accessed with the / syntax like
demuxer-cache-state's bof-cached and eof-cached always return true,
never yes.
2020-11-11 18:20:33 +00:00
Dudemanguy 790647314c DOCS: correct interface-changes.rst
delete-watch-later-config was introduced in mpv 0.33.0 not mpv 0.31.0.
2020-11-07 18:55:03 -06:00
Shreesh Adiga 19913921eb video/out/vo_sixel.c: Implement sixel as a output device
Based on the implementation of ffmpeg's sixel backend output written
by Hayaki Saito
https://github.com/saitoha/FFmpeg-SIXEL/blob/sixel/libavdevice/sixel.c

Sixel is a protocol to display graphics in a terminal. This commit
adds support to play videos on a sixel enabled terminal using libsixel.
With --vo=sixel, the output will be in sixel format.

The input frame will be scaled to the user specified resolution
(--vo-sixel-width and --vo-sixel-height) using swscaler and then
encoded using libsixel and output to the terminal. This method
requires high cpu and there are high frame drops for 720p and
higher resolution videos and might require using lesser colors and
have drop in quality.  Docs have all the supported options listed
to fine tune the output quality.

TODO: A few parameters of libsixel such as the sixel_encode_policy
and the SIXEL_XTERM16 variables are hardcoded, might want to
expose them as command line options. Also the initialization
resolution is not automatic and if the user doesn't specify the
dimensions, it picks 320x240 as the default resolution which is not
optimal. So need to automatically pick the best fit resolution for
the current open terminal window size.
2020-11-07 18:51:49 +02:00
Leo Izen dfa5ae2ad6 manpage: document av1 addition to --hwdec-codecs default setting
Document the change to add AV1 to the list of default hwdec
codecs, in commit 172146e9f7.
2020-11-05 23:05:54 +02:00
soredake b4d9980870 input.conf: add default keybindings for sub-scale 2020-10-27 17:13:56 +00:00
Guido Cella e49404cba9 console: let type set the cursor position
This allows keybindings such as:

a script-message-to console type "seek :0 absolute" 6
% script-message-to console type "seek  absolute-percent" 6

The cursor position 0 isn't allowed because it has the weird effect of
filling the console with the text twice, leaving the cursor in the
middle.
Negative positions would put the cursor n characters before the end, and
positions greater than the text's length at the end. They seem to work
at first, but the console breaks when you move the cursor, so they
aren't allowed.
It seems that float values don't cause issues, but I'm using the
argument's floor anyway to be safe. Using >= 1 instead of > 0 ignores
values like 0.5.
2020-10-27 17:10:50 +00:00
Ricardo Constantino 93f84b514a
ytdl_hook: support alternative youtube-dl path
Allows using a youtube-dl not in PATH or a compatible fork of
youtube-dl.
2020-10-27 15:42:39 +00:00
Vladimir Panteleev a92466c289 command: add delete-watch-later-config
This introduces the delete-watch-later-config command, to complement
write-watch-later-config. This is an alternative to #8141.

The general problem that this change is attempting to help solve has
been described in #336, #3169 and #6574. Though persistent playback
position of a single file is generally a solved problem, this is not
the case for playlists, as described in #8138.

The motivation is facilitating intermittent playback of very large
playlists, consisting of hundreds of entries each many hours
long. Though the current "watch later" mechanism works well - provided
that the files each occur only once in that playlist, and are played
only via that playlist - the biggest issue is that the position is
lost completely should mpv exit uncleanly (e.g. due to a power
failure).  Existing workarounds (in the form of Lua scripts which call
write-watch-later-config periodically) fail in the playlist case, due
to the mechanism used by mpv to determine where within a playlist to
resume playback from.

The missing puzzle piece needed to allow scripts to implement a
complete solution to this problem is simply a way to clean up the
watch-later configuration that the script asked mpv to write using
write-watch-later-config. With that in place, scripts can then
register an end-file event listener, check the stop playback reason,
and in the "eof" and "stop" case, invoke delete-watch-later-config to
delete any saved positions written by write-watch-later-config. The
script can then proceed to immediately write a new one when the next
file is loaded, which altogether allows mpv to resume from the correct
playlist and file position upon next startup.

Because events are delivered and executed asynchronously,
delete-watch-later-config takes an optional filename argument, to
allow scripts to clear watch-later configuration for files after mpv
had already moved on from playing them and proceeded to another file.

A Lua script which makes use of this change can be found here:
https://gist.github.com/CyberShadow/2f71a97fb85ed42146f6d9f522bc34ef
(A modification of the one written by @Hakkin, in that this one takes
advantage of the new command, and also saves the state immediately
when a new file is loaded.)
2020-10-22 19:53:35 +00:00
sfan5 3d9d041a11 command: expose underlying pixfmt for hwdec 2020-10-16 17:48:05 +02:00
Philip Langdale 9a1942ac95 manpage: Document behaviour of *nix configuration directories
The original documentation here is unclear, so let's describe the
behaviour we actually have. Inspired by wm4's updated docs but
obviously not identical because we're not changing any of the
behaviours.
2020-10-16 00:47:18 +03:00
Philip Langdale 949e06c86c Revert "path: switch back to using non-XDG config dir by default"
This reverts commit 269f0e743e.
2020-10-16 00:47:18 +03:00
Philip Langdale aa18a8e1cd Revert "path: do not use old_home for win32 exe dir"
This reverts commit c3694f0acb.
2020-10-16 00:47:18 +03:00
Philip Langdale 8a2449e3d5 Revert "manpage: reference standard for configuration file location"
This reverts commit 67b4a96e45.
2020-10-16 00:47:18 +03:00
Tim Gates 2cfeee68d4 docs: fix simple typo, unminimze -> unminimize
There is a small typo in DOCS/man/options.rst.

Closes #8165
2020-10-14 19:45:52 +00:00
Chris Varenhorst 4797594347 DOCS: fix typo on sub-filter-regex-enable 2020-10-12 03:00:29 -04:00
wm4 67b4a96e45 manpage: reference standard for configuration file location 2020-10-09 19:06:27 +02:00
Dudemanguy 5dc16a4a18 Revert "wayland: add wayland-display-socket option"
Pointless feature that can be done with environment variables. It was
also implemented incorrectly and broke autoprobing.

This reverts commit 015b676875.
2020-10-07 08:41:47 -05:00
Dudemanguy 015b676875 wayland: add wayland-display-socket option
As per the client API, a client can connect to any arbitrary wayland
socket. mpv has always just passed NULL which connected to the
compositor currently in use, but one could just as easily pass the name
of a different socket (i.e. the value of WAYLAND_DISPLAY). Here, we just
expose this argument as a user configurable option. If the user passes a
socket name that does not exist, then print a warning and fall back to
NULL.
2020-10-06 17:45:59 +00:00
wm4 39f4fd0dc7 screenshot: add --screenshot-sw option
Probably worthless. As usual, the manpage dumps all the subtle
differences due to implementation details on the user.
2020-10-05 00:16:46 +02:00
wm4 55d7f9ded1 player: add automatic loading of external cover art files
Picks up files like "cover.jpg". It's made part of normal external file
loading, so I'm adding 3 new options that are direct equivalents for the
options that control loading of external subtitle and audio files. Even
though I bet nobody wants them and they just increase confusion... I
guess the world is actually hell, so this outcome should be fine.

It prefers non-specific external files like "cover.jpg" over embedded
cover art. Not sure if that's wanted or unwanted.

There's some pain over explicitly marking such files as external
pictures. This is basically an optimization: in most cases, a heuristic
would treat an image file loaded with --external-file the same (it's a
heuristic because ffmpeg can't tell us whether something is an image or
a video). However, even with this heuristic, it would decode the cover
art picture again on each seek, which would essentially slow down
seeking in audio files. This bothered me greatly, which is why I'm
adding these additional options at all, and bothered with the previous
commit.

Fixes: #3056
2020-09-28 00:12:52 +02:00
der richter 18a35f17e2 mac: add an option to prevent focusing of the window on open
on macOS 10.15 setting the activation policy behaves quite weirdly. the
call changes the current active App to a nameless process, which
probably also the reason that prevents the not focusing to work.
a workaround for that, is to refocus the previous active app.

Fixes #7725
2020-09-25 16:48:24 +02:00
der richter 03047a0169 mac: add an option to change the App activation policy
useful to hide the app icon in the Dock if necessary.
2020-09-20 15:28:50 +02:00
der richter e28724d90d mac: add ontop window level for desktop
this puts the window ontop of the desktop but behind the desktop icons.

Fixes #7791
2020-09-20 15:28:50 +02:00
Guido Cella a7afc79d8f manpage: fix console keybindings punctuation 2020-09-18 14:29:04 +02:00
wm4 fb3facf052 msg: make --msg-time show time in seconds
More readable, similar to what --log-file will use (although the
terminal code shows microseconds and uses less left padding).
2020-09-18 14:26:41 +02:00
Guido Cella b2f4320d06 manpage: refer to --sub-color for colors
Don't make the user search for --osd-color only to make him search again
for --sub-color.
2020-09-17 10:35:35 +02:00
Guido Cella f825473c7a manpage: mark file-local-options as writable 2020-09-17 10:35:08 +02:00
Mohammad AlSaleh b959a22291 stream_slice: interpret `end` as offset if it starts with '+'
Example:
    slice://1g-2g@file.ts (1 to 2)
    slice://1g-+2g@file.ts (1 to 3)

Signed-off-by: Mohammad AlSaleh <CE.Mohammad.AlSaleh@gmail.com>
2020-09-17 10:34:57 +02:00
wnoun 49f5c9b482 command: add property track-list/N/main-selection 2020-09-12 13:03:13 +02:00
wm4 78bbd62d3b manpage: "fix" some formatting
Yeah, fuck this retarded garbage.
2020-09-10 23:03:58 +02:00
wm4 92e7f75bec vo_vdpau: remove deprecated/inactive --vo-vdpau-deint option
I think this has been dead code for quite a while. It was deprecated
anyway.
2020-09-09 15:38:39 +02:00
Guido Cella 9b9ce74afa command: add read-only focused property
Add a property that returns whether the window is focused, currently
only for X11 and Wayland.

My use cause for this is having an equivalent of pause-when-minimize.lua
for tiling window managers: make mpv play only while it's in the current
workspace or is focused (I'm fine with either one but prefer focus).
On X I do this by observing display-names, which is empty when the
rectangles of the display and mpv don't intersect, but on Wayland its
value doesn't change when mpv leaves the current workspace (and the same
check doesn't work since the geometries still intersect).

This could later be made writable as requested in #6252.

Note that on Wayland se shouldn't consider an unactivated window with
keyboard input focused.

The wlroots compositors I tested set activated after changing the
keyboard focus, so if you set wl->focused only in
keyboard_handle_enter() and keyboard_handle_leave() to avoid adding the
"has_keyboard_input" member, focused isn't set to true when first
opening mpv until you focus another window and focus mpv again.

Conversely, if that order can't be assumed for all compositors, we
should toggle wl->focused when necessary in keyboard_handle_enter() and
keyboard_handle_leave() as well as in handle_toplevel_config().
2020-09-08 20:09:17 +02:00
Guido Cella 5a4fc8684e manpage: fix typo
Change 'already by defined' to 'already defined' and reformat the
paragaph.
2020-09-06 10:45:28 -04:00
wm4 1643cb865f audio: fix stream-silence with push AOs (somewhat)
--audio-stream-silence is a shitty feature compensating for awful
consumer garbage, that mutes PCM at first to check whether it's
compressed audio, using formats advocated and owned by malicious patent
troll companies (who spend more money on their lawyers than paying any
technicians), wrapped in a wasteful way to make it constant bitrate
using a standard whose text is not freely available, and only rude users
want it. This feature has been carelessly broken, because it's
complicated and stupid. What would Jesus do? If not getting an aneurysm,
or pushing over tables with expensive A/V receivers on top of them, he'd
probably fix the feature. So let's take inspiration from Jesus Christ
himself, and do something as dumb as wasting some of our limited
lifetime on this incredibly stupid fucking shit.

This is tricky, because state changes like end-of-audio are supposed to
be driven by the AO driver, while playing silence precludes this. But it
seems code paths for "untimed" AOs can be reused.

But there are still problems. For example, underruns will just happen
normally (and stop audio streaming), because we don't have a separate
heuristic to check whether the buffer is "low enough" (as a consequence
of a network stall, but before the audio output itself underruns).
2020-09-03 22:39:23 +02:00
wm4 4b3500dd14 client API: inactivate the opengl_cb API
The render API replaced the opengl_cb API over 2 years ago. Since then,
the opengl_cb API was emulated on top of the render API. While it would
probably be reasonable to emulate these APIs until they're removed in an
eventual libmpv 2.0 bump, I have some non-technical reasons to disable
the API now.

The API stubs remain; they're needed for formal ABI compatibility.
2020-09-03 14:52:11 +02:00
wm4 d96e2c7313 DOCS/interface-changes: remove encoding mode deprecation entry
It was undeprecated.
2020-09-01 21:28:13 +02:00
Chris Varenhorst bb1f821078 DOCS: fix minor issue on the --video-latency-hacks explanation 2020-08-28 23:36:16 -04:00
crackself dc1a855438 Update compile-windows.md
fix lua5.1-5.2  support with luajit (mxe default upstream lua5.3 )
2020-08-28 23:34:29 -04:00