summaryrefslogtreecommitdiffstats
path: root/player
Commit message (Collapse)AuthorAgeFilesLines
* console: sort the output from the `help` commandChristoph Heinrich2023-07-141-0/+3
| | | | Closes #11927
* player: delete watch later redirect entries againGuido Cella2023-07-141-0/+2
| | | | | | | | | | 6a365b258a broke deleting redirect entries for resuming playback. If you do mpv dir1 dir2, quit-watch-later on a file in dir1, then later quit-watch-later on a file in dir2, mpv dir1 dir2 would not resume from dir2 because the redirect entry for dir1 is never deleted. Fix this by deleting watch later config files for directory/playlist entries.
* stats.lua: set sans-serif as default fontm154k12023-07-101-1/+1
| | | | sans is deprecated and unsupported on some platforms.
* player: delete watch_later file after successful loadDudemanguy2023-07-083-6/+11
| | | | | | | | | | Currently, mpv immediately deletes the watch_later file after an attempt at playing the file is made. This is not really ideal because the file may fail to load for a variety of reasons (including not even existing), but the state is cleared anyway unconditionally. Instead, just wait until after playback is successfully initialized before deleting it. This way silly mistakes like forgetting to mount the drive doesn't result in deleting your watch_later data. Fixes #3427.
* json: unify json_parse depth to MAX_JSON_DEPTH=50cvzi2023-07-081-1/+1
|
* player/screenshot: add "screenshot" loggercloud116652023-07-011-1/+4
|
* loadfile: fix leak due to setting NULL parentNRK2023-06-281-2/+3
| | | | | | | | in the first iteration, *out will be null and thus the steal and the strdup both sets the parent to NULL - leaking the allocation later on (caught via LeakSanitizer). let append_lang() take care of setting the parent instead.
* loadfile: insert missing parenthesesPhilip Langdale2023-06-261-2/+2
| | | | | Impressively, gcc's parentheses warning has caught a situation where the missing parentheses were really needed.
* osc: add toggle for forced-only subsrcombs2023-06-251-0/+37
|
* loadfile: expose auto-forced-only when printing stream inforcombs2023-06-251-1/+9
|
* command: add sub-forced-only-cur proprcombs2023-06-251-0/+13
|
* command: report auto-forced-only flag in track descrcombs2023-06-251-0/+1
|
* sub: rewrite auto-forced-only supportrcombs2023-06-253-6/+13
| | | | | - No longer has a fake "option" used only internally (which didn't always get propagated properly) - Always overrideable during playback
* player: add more precise sub fallback optionsrcombs2023-06-251-10/+38
|
* loadfile: support "auto" as a language optionrcombs2023-06-251-3/+48
| | | | This uses the user's OS-level preferred set of languages
* loadfile: use mp_match_lang_singlercombs2023-06-251-2/+4
| | | | | This adds basic support for IETF language tags, as well as matching 2-letter language codes against 3-letter ones (and vice versa).
* loadfile: take a const char* in match_langrcombs2023-06-251-1/+1
|
* loadfile: short-circuit early on null stream languagercombs2023-06-251-0/+2
|
* player: don't load unwanted files after 519e56fArthur Williams2023-06-071-9/+9
| | | | | | | | | | | | | | | 519e56f caused an attempt to get the language even if the file name didn't start with the movie title. However, detecting a language when fuzz >= 1 or the language is known, caused prio to be non-zero which caused the file to be included regardless of its name. This shouldn't be the behavior when sub-auto != all. Now all the prio updates that depend on lang will only happen if the file in question starts with the movie name. Since language was never detected before if this wasn't true, the behavior should be the same as before 519e56f when sub-auto != all. Closes: #11749
* lua: read_options: find script-opts prefix at index 1 exactlyChristoph Heinrich2023-06-011-1/+1
| | | | | | | Finding the prefix in the key is not enough, the key has to actually start with the prefix. Otherwise a key like `uosc-font_scale` will not only match the `uosc-` prefix, but also the `osc-` prefix, resulting in a logged warning about `-font_scale` being an unknown key.
* player: improve diagnostics around writing watch_later filessfan52023-05-211-2/+4
|
* player: always try to detect subtitle language from file nameArthur Williams2023-05-211-3/+2
| | | | | | | | | | | | | Previously, we'd only attempt to call guess_lang_from_filename if the external file name matched the video name ignoring the extensions. So if they didn't match, we'd just report the language as "unknown". And since the name will never match for urls, the language would always be treated as unknown. Now we'll always try to guess the language from the filename regardless of its similarity to the video file name. Closes #10348
* player: use XDG_STATE_HOME for watch_laterDudemanguy2023-05-092-18/+16
| | | | | | | | | | | | | | | | | | A pain point for some users is the fact that watch_later is stored in the ~/.config directory when it's really not configuration data. Roughly 2 years ago, XDG_STATE_DIR was added to the XDG Base Directory Specification[0] and its description, user-specific state data, actually perfectly matches what watch_later data is for. Let's go ahead and use this directory as the default for watch_later. This change only affects non-darwin unix-like systems (i.e. Linux, BSDs, etc.). The directory doesn't move for anyone else. Internally, quite a few things change with regards to the path selection. If the platform in question does not have a statedir concept, then the path selection will simply return "home" instead (old behavior). Fixes #9147. [0]: https://gitlab.freedesktop.org/xdg/xdg-specs/-/commit/4f2884e16db35f2962d9b64312917c81be5cb54b
* path: expand internal path selection API to allow for additional typesDudemanguy2023-05-091-3/+3
| | | | | | | | Currently, nothing new is actually implemented but the idea is simply to just pass a type string all the way up from mp_find_user_file down to actually getting the platform path. This allows for selecting different directories besides the user's native config directory. See the next commit for an implementation.
* options: read config file as streamThomas Weißschuh2023-04-293-4/+4
| | | | | This aligns the possible sources of config files other loaded data. For example `--input-conf`.
* console.lua: add a script-opt for the border sizeGuido Cella2023-04-261-1/+2
| | | | Because I find the console log easier to read with a thicker border.
* ytdl_hook: fix clip start and endArnold Stanovský2023-04-121-3/+13
|
* player/screenshot: avoid non-sRGB spaces with --screenshot-tag-csp=noLeo Izen2023-04-101-1/+1
| | | | | | If --screenshot-tag-csp=no, then there won't be any color tags in the output space, so PNG and JXL screenshots should be written as sRGB rather than the native space of the input video.
* auto_profiles: try to distinguish invalid properties betterDudemanguy2023-04-071-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* auto_profiles.lua: apply profiles when conditions are truthyGuido Cella2023-04-051-4/+1
| | | | | | | | | | | | Instead of erroring when values returned by profile-cond expressions aren't booleans, apply the relative profiles as long as the return values are truthy. This allows shortening conditions like profile-cond=path:match('foo') ~= nil to profile-cond=path:match('foo')
* osc: skip rendering when osd_dimensions are 0Christoph Heinrich2023-04-051-0/+3
| | | | | | | | The idle logo could appear on the left side of the window for a split second after starting. That is because when osd dimensions can be reported as 0 at the very beginning. Since the width gets calculated based on a fixed height and the aspect ratio, which is 0, that results in a width of 0 until the next update.
* auto_profiles: check for non-existent propertiesDudemanguy2023-03-291-1/+6
| | | | | | | | | | | Previously, it just silently didn't do anything which is not very intuitive. Since the lua api returns an error string, check to see if it matches the "property not found" case and print an error message. Additionally, don't add the fake property to the internal cached_properties list or try to observe it. This avoids redundant evaluate calls which will never actually succeed. We do still mark it under watched_properties however. This avoids having to call mp.get_property_native multiple times.
* various: fix various typos in the code baseAlexander Seiler2023-03-281-5/+5
| | | | Signed-off-by: Alexander Seiler <seileralex@gmail.com>
* various: fix typosHarri Nieminen2023-03-283-4/+4
| | | | Found by codespell
* player/screenshot: add filename return fieldcloud116652023-03-251-1/+7
| | | | DOCS/input: add screenshot return value description
* player: set playlist title to media title if not set alreadyChristoph Heinrich2023-03-241-11/+28
| | | | | | | The playlist title only got set when it was specified in the playlist file. If there is a title after opening a file, that should also be reflected in the playlist.
* Revert "player: set playlist title to media title if not set already"Christoph Heinrich2023-03-241-17/+14
| | | | | | | | | | | | As it turns out that approach was suboptimal. The playlist title would only ever get set when media-title actually gets read, which depending on the configuration and usage might never happen. The next commit reimplements that feature in a different way. This reverts commit 048d4d8b7556f06afb46e7e94852709a1a624aed except for the input.rst change.
* player/command: fix mem leak in user-data property; closes #11436rcombs2023-03-131-0/+5
|
* screenshot: fix segfault when taking a screenshot without videoChristoph Heinrich2023-03-071-25/+29
| | | | Also a style change to exit early when nothing can be done anymore.
* loadfile: strongly prefer that all streams are from the same programrcombs2023-03-031-2/+10
| | | | | | In raw OTA MPEGTS, different programs can be entirely different virtual channels. In web streams, different programs can be different variant bitrates, so using streams from different programs can waste large amounts of bandwidth.
* command: expose hls-bitrate and program-id as track-list subpropertiesrcombs2023-03-031-0/+4
|
* loadfile: report hls_bitrate and program_id in struct trackrcombs2023-03-032-0/+4
|
* ytdl_hook: only log error when no fallback url availableChristoph Heinrich2023-03-031-1/+2
| | | | | | | | | | An error indicates that something doesn't work, but as long as a safe url is available, playback is still expected to work. Thus reduce logging level of MP4 DASH without fragments message and add a new error message for when there is no safe url available either. Also adds a missing space.
* ytdl_hook: init fragment requires other fragmentsChristoph Heinrich2023-03-031-1/+1
| | | | | | | With dash the first fragment was always considered an init fragment if there wasn't a duration. However that only makes sense when there are also other fragments, so check if there are other fragments in addition to the lack of a duration.
* player: remove unittest optionDudemanguy2023-03-021-6/+0
| | | | | | | | | Since meson has its own unit testing system, let's rework mpv's tests so they integrate nicely with this. To prepare for this, start off by dropping the unittest option. Of course, this means that tests will no longer be supported in the waf build at all but it will be dropped anyway. Note that the tests option is preserved for the meson build. We will still make use of this in the future commits.
* external_files: recognize jxl and avif files as cover artMartin Eesmaa2023-02-271-1/+17
|
* {console,ytdl_hook}: use the platform propertyDudemanguy2023-02-272-9/+6
| | | | | | The console.lua check is still kind of dumb since we check an environment variable to distinguish between wayland and x11, but otherwise it should be better in theory.
* command: add platform propertyDudemanguy2023-02-271-0/+7
| | | | | | | | | | | | | | | | | | | | | | | This returns the value of the target OS that mpv was built on as reported by the build system. It is quite conceivable that script writers and API users would need to make OS-dependent choices in some cases. Such people end up writing boilerplate/hacks to guess what OS they are on. Assuming you trust the build system (if you don't, we're in really deep trouble), then mpv actually knows exactly what OS it was built on. Simply take this information at configuration time, make it a define, and let mp_property_platform return the value. Note that mpv has two build systems (waf and meson), so the names of the detected OSes may not be exactly the same. Since meson is the newer build system, the value of this property follows meson's naming conventions*. In the waf build, there is a small function to map known naming deviations to match meson (i.e. changing "win32" to "windows"). waf's documentation is a nightmare to follow, but it seems to simply take the output of sys.platform in python and strip away any trailing numbers if they exist (exception being win32 and os2)*. *: https://mesonbuild.com/Reference-tables.html#operating-system-names *: https://waf.io/apidocs/Utils.html#waflib.Utils.unversioned_sys_platform
* ytdl_hook: don't overwrite force-media-titleChristoph Heinrich2023-02-271-2/+5
| | | | | | | | | | | | | | | | ytdl_hook always set force-media-title, making users unable to force a media-title via options. To prevent that, check if force-media-title is already set to avoid overwriting it. A better solution would be to use tags like is already done for some metadata, however that doesn't work when `all_formats=yes` is used. See cbb8f534b064f144820435148e516978de08cb30 A comment was added to hint at why it isn't done via tags. ref. https://github.com/mpv-player/mpv/pull/10453#issuecomment-1445277496
* ytdl_hook.lua: make exec return a single valueGuido Cella2023-02-271-15/+15
| | | | | | | | | | | | | | This refactors exec to only return the result of the subprocess command, and makes the rest of run_ytdl_hook use the fields of this result, because specifying all those return values multiple times is unwieldy now that exec is called several times, and this is easier to read anyway. I removed the line err = string.format("%s returned '%d'", err, es) altogether instead of updating the es variable, because there was no chance of it being executed since it would only happen when result.killed_by_us is true, but run_ytdl_hook returns early when it is.
* audio: remove a duplicate clearing of a struct variableder richter2023-02-271-1/+0
| | | | Fixes #8301
* client API: reintroduce CONF_TYPE_FLAG for type conversionChristoph Heinrich2023-02-271-1/+1
| | | | | | | | | | Changing the CONF_TYPE_FLAG was a bad idea because mpv_node.u.flag continues to be an int, leading to a mismatch in type sizes which can lead to problems with memcpy(). ref. #11373 This partially reverts commit 17d91b9d4d2d208f4a847395198cdbbcad18de93.
* console: observe osc margins from user-data instead of shared-script-propertiesrcombs2023-02-261-17/+8
|
* osc: set values in user-data in addition to shared-script-propertiesrcombs2023-02-261-0/+4
|
* player: set playlist title to media title if not set alreadyChristoph Heinrich2023-02-261-14/+17
| | | | | | | | | The playlist title only got set when it was specified in the playlist file. If there is a title after opening a file, that should also be reflected in the playlist. ref. #4780
* various: fix warning -Wimplicit-const-int-float-conversionThomas Weißschuh2023-02-261-2/+2
|
* vo_wayland: fix warning -Wvoid-pointer-to-enum-castThomas Weißschuh2023-02-261-1/+1
|
* options: transition properties from flag to boolChristoph Heinrich2023-02-212-33/+33
|
* options: transition commands from OPT_FLAG to OPT_BOOLChristoph Heinrich2023-02-211-16/+16
|
* options: transition options from OPT_FLAG to OPT_BOOLChristoph Heinrich2023-02-211-1/+1
| | | | | | c78482045444c488bb7948305d583a55d17cd236 introduced a bool option type as a replacement for the flag type, but didn't actually transition and remove the flag type because it would have been too much mundane work.
* various: drop unused #include "config.h"Thomas Weißschuh2023-02-2010-11/+0
| | | | | | Most sources don't need config.h. The inclusion only leads to lots of unneeded recompilation if the configuration is changed.
* player/screenshot: pass on ability to output native CSPNiklas Haas2023-02-131-2/+5
| | | | Fixes: #10988
* screenshot: explicitly default VOCTRL_SCREENSHOT cspNiklas Haas2023-02-131-0/+1
| | | | | | | | | This allows the logic in `convert_image` to fast-path if the image params are equal. Without this check, the image params are basically never equal, because that path goes through `mp_image_params_guess_csp` while the `mp_image` itself does not. Force it here for consistency across VOs.
* stats.lua: display HDR peak in nitsdyphire2023-02-021-1/+1
| | | | | | | | The value of `sig-peak` is relative to the SDR peak. This is not a problem when used inside the player, but the `HDR peak` in stats should display human-readable information. So change to return the actual nits value of HDR. Closed https://github.com/mpv-player/mpv/issues/10127
* player/video.c: don't resync audio if video is an imageStratusFearMe212023-01-301-1/+1
|
* lua/js: remove user-data helpersAvi Halachmi (:avih)2023-01-292-43/+0
| | | | | | | | | | | | | | | This reverts: 3fb4140c lua/defaults: add user_data helpers 68a20e7a javascript/defaults: add user_data helpers 00510379 lua/js: fix user_data_del util function As well as the lua/js parts of: 3ec2a098 docs: document new user-data property user-data and its sub-properties can be set/get/observed/deleted via the standard properties interface, so there's no need for additional helpers specific to user-data, which only added maintenance burden.
* lua/js: fix user_data_del util functionrcombs2023-01-282-2/+2
|
* javascript/defaults: add user_data helpersrcombs2023-01-281-0/+24
|
* lua/defaults: add user_data helpersrcombs2023-01-281-0/+19
|
* player/command: add user-data propertyrcombs2023-01-281-0/+171
|