The file-local-options property sets options that are reset when file
change occurs. This is different from per-file options which are set with
--{ commandline arguments and options parameter of the loadfile command.
Per-file options use file-local option mechanism for setting options when
the file is loaded, but they are persistent and stay with the playlist
entries, unlike file-local-options set at runtime.
This corrects the on_load hook documentation about the effect of setting
file-local-options.
This allows controlling whether the files in a playlist inherit the
per-file options of the playlist file itself. For playlists created
by --autocreate-playlist, --playlist-inherit-options=current allows
inheriting only for the item the playlist is created from.
Currently, if a playlist file is played and replaced by its contents,
the per-file options of the playlist file are ignored.
This commit makes these options inherited for its contents so they work
as expected.
The feature test macro is nonstandard and not available on older GCC
version, which causes build failure despite the compiler does support
__builtin_mul_overflow.
Since there are no fallback when __builtin_mul_overflow is not
available, there is no need to check, so simply remove it.
If __builtin_mul_overflow is not supported compilation will still fail
just like currently.
Currently, all fopen uses in mpv do not set cloexec flag, resulting
in fd leak whenever mpv creates a process.
This makes mpv use mp_fopen on all platforms, and always set O_CLOEXEC
on the opened fd. This is required because the "e" flag for fopen is
nonstandard and UB in C11, and unsupported on macOS.
This had been done similarly in other projects. e.g.
https://gitlab.com/graphviz/graphviz/-/merge_requests/3797
When setting properties via M_PROPERTY_SET_NODE, the property value
is limited by static declared range. However, some properties like
volume handle dynamic M_PROPERTY_GET_CONSTRICTED_TYPE requests and
return runtime determined limits. M_PROPERTY_SET_NODE in this case
does not respect that limit, and allows setting to a value out of
range.
Fix this by always trying to use M_PROPERTY_GET_CONSTRICTED_TYPE
first so that the dynamic limits will be used.
This has been deprecated for 9 years since
9eef41dec1.
With the previous commit, this can be replaced by conditional autoprofiles.
Add usage hint to the documentation.
This is only used to update the list for player internal sub ext matching.
Since this handling now lives in the dnd client, it can be removed from
core, which also eliminates a global variable.
This unifies --drag-and-drop handling to a single place. All platforms
currently only support normal drop (mapped to "replace") and shift click
drop (mapped to "append").
This adds dropped-file property which contains a list of dropped files
and the type of the drop. This allows clients to implement custom drag
and drop handling.
This adds _down_command support to bind_mouse_buttons so it can be
used to bind button down actions like mbtn_left_down, and let forward
and backward buttons use bind_mouse_buttons. This makes mouse button
down actions customizable.
The event responder must have up, down, or press suffix, but
940ab99055 removed it for frame stepping
function, making it unusable. Fix this by using the down suffix.
Fixes: 940ab99055
The comment about video backends not updating pointer position is only
true if no mouse button is being pressed. If mouse button is pressed on
mpv window and then moves out of window region without releasing the
button, some platforms (win32, Wayland, X11) "capture" the pointer and
still report the coordinates, while some other platforms (SDL) do not.
The value of mouse-pos/hover also differs between platforms in this case.
The value is true on win32 and Wayland, but false on X11.
Fix documentation to address them.
Subtitles in general have constant brightness, but currently
--image-subs-hdr-peak=video uses detected peak value which is not synced
with scene and undesirable.
Add new modes that allow using static peak metadata or per-scene metadata.
704afb8968 assumed that HDR image
subtitles target SDR white. However, this is incorrect according to
UHD BD spec version 3.2:
> CLUTs of Presentation Graphics streams and Interactive Graphics streams
> are prepared by content author according to dynamic range property of
> the Primary video stream.
> If a Primary video stream is HDR, the Graphics streams have CLUTs
> expressed in BT.2020 color space primaries and ST2084 EOTF.
> If a Primary video stream is SDR, the Graphics streams have CLUTs
> expressed in BT.709 color space primaries and BT.1886 EOTF.
This means that PGS subtitles always have the same colorspace and HDR
dynamic range as the video, so the target peak should also be the same.
This is also supported by the BD-J spec (which displays PGS graphics):
> However the BD-ROM player does not support color space conversion nor
> dynamic range conversion of Java graphics and Background plane when
> mixing with video plane.
The Graphics model spec further states:
> The composited image on the graphics plane is transformed to full color
> and transparency by the CLUT module and then overlaid on the video
> image.
These sentences indicate that BD-ROM players simply overlay the decoded
graphics onto the video without any kind of conversion.
Change the default of image-subs-hdr-peak to 1000 to fix this.
This accommodates most HDR videos with a peak brightness of 1000 nits
and some bad HDR videos with 10000 nits peak brightness due to reencoding
and mixed with unmodified subtitles.
If there are compatibility issues, the option can be manually
set to sdr or video.
Fixes: 704afb8968
Since cb56c2f888, the priority of
--cover-art-auto and --cover-art-whitelist is unclear. Depending on the
number of elements in --cover-art-whitelist, the priority of
--cover-art-whitelist files can be lower, equal, or higher than
--cover-art-auto matches, creating unpredictable behavior.
Fix this by making --cover-art-whitelist priority always between "fuzzy"
and "all" priority. test_cover_filename now uses bstr_find_in_list0 to
return a negative priority value depending on the position in list.
The "all" priority is set to INT_MIN. Modify filter_subidx to use 0
priority as removal marker, since all files in the external files list
already have non-zero priority.
The documentation says that the scripts are loaded in alphabetical order,
which indicates that the case is not sensitive. Use strcasecmp to satisfy
this requirement.
Some commands have named arguments named "name", which conflict with
the "name" entry used to specify command name in mpv_command_node, so
they cannot be used with mpv_command_node.
These commands include:
set, del, change-list, add, cycle, multiply, enable-section,
disable-section, define-section, script-binding, keybind, keypress,
keydown, keyup, apply-profile.
This makes mpv_command_node accept command name as key "_name", so
"name" can be used to specify command arguments. For compatibility,
if "_name" entry does not exist, then "name" is used as fallback.
If --input-ipc-server path name starts with "@", then "@" is replaced
with a null character, which represents the abstract socket namespace
on Linux. Because abstract sockets have no file system presence, it
should not delete the file with the same name starting with "@".
Previous commit left the common %s format extension unresolved.
This implements the format in a platform independent way so it can be
used on all platforms, including on Windows where strftime does not
support %s.
The format specifier is controlled by the user that can be arbitrary
character. Using invalid specifier in strftime is UB. Fix this by only
accepting the specifiers recognized in C11.
Partial compatibility is provided for extension formats k, l, P by
translating them to the closest standard alternative.
mp_input_get_tablet_pos stores the address to an array that is protected
by lock, and the content is accessed without acquiring lock.
Fix this by writing the values to an array inside mp_input_get_tablet_pos.
Fixes: 0fbf20f057
When buttons > MP_MAX_TABLET_PAD_BUTTONS and the value is stored in
ictx->tablet_pad_buttons, the next mp_input_set_tablet_pad_focus call
will cause out of bound write, and mp_property_tablet_pos will cause
out of bound read.
Fix this by limiting ictx->tablet_pad_buttons range.
Fixes: 0fbf20f057
When XdndEnter advertises format without using XdndTypeList, some of
the atoms in the 3 fixed items may be None, which causes error in
XGetAtomName. Fix this by not resolving name when atom is None.
Fixes the following error message when dragging file on mpv window:
X11 error: BadAtom (invalid Atom parameter)
This util function uses the generic libavutil hash API to hash any data
with the specified algorithm to a bstr. It deduplicates multiple hash
routines used in mpv.
This uses the update_data request for clipboard backends that require it.
When clipboard monitoring is disabled, the backends will no longer
fetch data when it detects data change, and will now only do that when
receiving the update_data request.
The client now needs to run this command to update the clipboard content,
otherwise the property value is outdated.
This makes sure that applications that depend on "paste once" behavior
work correctly.
This command runs in a separate worker thread so that it can be used
as a "blocking" way to update clipboard until the update notification
arrives without blocking the playback core. It accepts a maximum timeout
parameter. This uses the existing mp_cancel mechanism to make sure this
command can be aborted and the worker threads will not stall the player
too much when quitting mpv.
For backends that do not support update_data, this command does nothing.