1
0
mirror of https://github.com/mpv-player/mpv synced 2025-02-17 04:58:06 +00:00
mpv/player
Dudemanguy 7ae7fc0112 auto_profiles: try to distinguish invalid properties better
6e4a76db0862303ae7f0f9fd7bdddff128fbd2f0 attemped to reject invalid
properties and print an error for users so they actually know that
something is going wrong. This worked by simply checking if the property
not found error is returned, but it is actually perfectly possible for a
property to not be found (different than being unavailable just to be
clear here) at first and then show up later. An example would be
user-data which can be created at any time. It's also possible with
subproperties of things like track-list where a new track could be added
later.

In light of this, let's soften the error checking logic here with a
simple trick. mpv already keeps track of all toplevel properties and it
can be easily retrieved with the "property-list" property, so just cache
that. When we get a property not found error, instead of rejecting it,
try to match it something in the property-list first. If we have a
match, then consider the property valid and allow the script to behavior
normally. If not, we reject it. This approach means property names that
are obviously wrong like "fake-property-here" will reliably get rejected
and something like "user-data/test" works as usual. The downside is that
errors in the subproperty level are not caught, so something like
"track-list/0/fake-property" would still be considered valid and the
user gets no warning that this won't work. We'll just accept the
compromise and hope this isn't too common.

Fixes #11550.
2023-04-07 01:48:55 +00:00
..
javascript lua/js: remove user-data helpers 2023-01-29 01:52:31 +02:00
lua auto_profiles: try to distinguish invalid properties better 2023-04-07 01:48:55 +00:00
audio.c audio: remove a duplicate clearing of a struct variable 2023-02-27 17:02:19 +00:00
client.c client API: reintroduce CONF_TYPE_FLAG for type conversion 2023-02-27 11:21:49 +01:00
client.h
command.c player: set playlist title to media title if not set already 2023-03-24 02:28:49 +00:00
command.h player: make deprecated track/chapter/metadata events internal 2021-12-15 12:29:10 +01:00
configfiles.c various: drop unused #include "config.h" 2023-02-20 14:21:18 +00:00
core.h loadfile: report hls_bitrate and program_id in struct track 2023-03-03 23:54:46 -06:00
external_files.c external_files: recognize jxl and avif files as cover art 2023-02-27 17:50:46 +00:00
external_files.h player: add automatic loading of external cover art files 2020-09-28 00:12:52 +02:00
javascript.c various: fix warning -Wimplicit-const-int-float-conversion 2023-02-26 16:45:07 +01:00
loadfile.c loadfile: strongly prefer that all streams are from the same program 2023-03-03 23:54:46 -06:00
lua.c various: fix various typos in the code base 2023-03-28 19:29:44 +00:00
main.c player: remove unittest option 2023-03-02 15:45:27 +00:00
misc.c vo_wayland: fix warning -Wvoid-pointer-to-enum-cast 2023-02-26 16:45:07 +01:00
osd.c various: drop unused #include "config.h" 2023-02-20 14:21:18 +00:00
playloop.c various: drop unused #include "config.h" 2023-02-20 14:21:18 +00:00
screenshot.c player/screenshot: add filename return field 2023-03-25 16:24:21 +00:00
screenshot.h
scripting.c player/scripting: fix use-after-free when loading script folders 2021-04-08 23:47:35 +03:00
sub.c various: drop unused #include "config.h" 2023-02-20 14:21:18 +00:00
video.c various: fix typos 2023-03-28 19:29:44 +00:00