summaryrefslogtreecommitdiffstats
path: root/player
Commit message (Collapse)AuthorAgeFilesLines
* stats.lua: display output resolution if it differs to native oneKacper Michajłow2023-08-181-11/+23
| | | | | Useful when filters are applied that alters the video resolution, like crop. Also display aspect ratio per each resolution.
* stats.lua: hide window scale in fullscreenKacper Michajłow2023-08-181-1/+3
| | | | | It display window (not fullscreen) scale, which is quite confusing as it doesn't match any other currently displayed values.
* loadfile: avoid infinite playlist loading loopsDudemanguy2023-08-162-0/+30
| | | | | | | | | | | | | There are a number of ways one can craft a playlist file that refers to itself or cleverly goes around in a loop to other playlist files. There is obviously no use for this, but mpv spins around forever trying to load the files so you have to just SIGTERM/SIGKILL it. We can be smarter about this and attempt to detect it. The condition for detecting this is surprisingly simple: the filename of the first entry in the playlist must match a previous playlist path we stored. If we get this, we can then log an error and stop playback. If there is a "real" file loaded at any point in time, then we know it's not an infinite loop and clear out the saved playlist paths. Fixes #3967.
* player: add playlist-path propertiesDudemanguy2023-08-132-5/+19
| | | | | | | | | | | | A bit of a long standing pain with scripting is that when opening a file that gets interpreted as a playlist (like an m3u), the original path of the file gets thrown away later. Workarounds basically consist of getting the filename before mpv expands the path, but that's not really reliable. Instead of throwing it away, save the original playlist path by copying to the playlist entries when applicable (demuxer playlist and the playlist option). Then expose these as properties: playlist-path for the currently playing entry and playlist/N/playlist-path for each specific entry. Closes #8508, #7605.
* player: add --term-remaining-playtime optionDudemanguy2023-08-131-1/+2
| | | | | | | The OSC reports the speed-adjusted remaining time, but the terminal does not. This is a weird mismatch and the OSC's default behavior makes sense, so let's just do some division and add an option to disable it. Also named "remaining-playtime" after the OSC option. Fixes #10445.
* player: make sub-pos a float valueDudemanguy2023-08-131-1/+1
| | | | | | | | mpv makes this option an integer, but the underlying ass API actually accepts doubles. From some testing, there is no meaningful precision difference between float or double (it seems to go in roughly 0.05 steps), so just make it a float. sd_lavc also can handle non-integer values here. Closes #11583.
* stats.lua: use video-params/aspect-nameKacper Michajłow2023-08-131-1/+3
|
* player/command: add video-params/aspect-nameKacper Michajłow2023-08-131-1/+45
| | | | With pretty printed aspect ratio and related format.
* ytdl_hook: improve Windows exe search with suffixfireattack2023-08-131-3/+3
|
* command: don't print "unknown" on video tracksDudemanguy2023-08-111-1/+4
| | | | | | | | | | | When printing the name of the video track on the OSC, mpv almost always prefixes it with "unknown". This is referring to the language tag which essentially nobody ever does for the video track since it doesn't make any sense. Instead of putting unknown when there's no language, just make it an empty string instead. "Unknown" confuses can confuse users here and practically nobody would guess that it's referring to language. We still will print the language for a video track in case someone out there really does tag it, but that should be rare.
* player/video: avoid spamming logs with EOFDudemanguy2023-08-112-1/+6
| | | | | | | When playing a sparse video stream, the debug log gets hit with the video EOF constantly since the audio is still playing. There's no practical use for this so just do add some logic to only signal it once if it is sparse.
* audio: drain ao before setting pauseDudemanguy2023-08-112-3/+6
| | | | | | | | | There's an edge cause with gapless audio and pausing. Since, gapless audio works by sending an EOF immediately, it's possible to pause on the next file before audio actually finishes playing and thus the sound gets cut off. The fix is to simply just always do an ao_drain if the ao is about to set a pause on EOF and we still have audio playing. Fixes #8898.
* command: show "no" for hwdec-current if hwdec failedDudemanguy2023-08-111-1/+1
| | | | | Now actually matches the documentation (was an empty string not null). Fixes #11464.
* command: fix some fringe play-dir behaviorDudemanguy2023-08-111-0/+6
| | | | | | | | | | | | | | | | | | | This is pretty obscure but if you screw around with the play-dir option to essentially create a ping-pong loop; mpv will get hit by an assertion error. What's happening here is that changing the play-dir always requires a seek. This is handled in player/command along with the other runtime option changes. However, queue_seek can actually clear the value of mpctx->stop_play if the file is ending. So while loadfile is terminating playback and the play-dir gets changed, the value of mpctx->stop_play gets cleared because of seek. This then hits that assertion later when mpv tries to finish the file. The fix is to just add some weird logic to play-dir in player/command. We have to be sure that mpctx->play_dir matches the new direction immediately when we get the change so explictly set it here and don't wait for it later. Secondly, keep the old value of mpctx->stop_play before the seek and restore it afterwards. This ensures that termination still happens cleanly and allows the ping-pong loop to work. Fixes #10782
* sub: fix switching tracks while pausedDudemanguy2023-08-111-2/+4
| | | | | | | | Internal subtitles were not shown when switching between tracks while mpv was paused. The reason for this is simply because the demuxer data isn't available yet when the track switch happens. Fixing it is basically just retrying until the packet is actually available when the player is paused. Fixes #8311.
* osc: support speed-independent time-remaiing displayDave2023-08-111-2/+6
| | | | | The new OSC config option "remaining_playtime" controls whether the time-remaining display considers speed (yes - default) or ignores it.
* command: fix stack smashing when displaying aspect-ratiollyyr2023-08-111-11/+7
| | | | | | 1df0a42a8cb12005311f6a03f3a1c4329c798f8c changed aspect-ratio from floats to doubles, but forgot to change this function for pretty-printing them as fractions for the video-aspect-override property
* external_files: add sbv to the sub whitelistDudemanguy2023-08-101-2/+2
|
* external_files: alphabetize file extensionsDudemanguy2023-08-101-8/+8
| | | | Looks nicer.
* player/main: do not print build time, if it is unknownKacper Michajłow2023-08-021-2/+3
|
* build: remove outdated generated directoryDudemanguy2023-07-316-10/+36
| | | | | | | | | | | | | | | | This only existed as essentially a workaround for meson's behavior and to maintain compatibility with the waf build. Since waf put everything in a generated subdirectory, we had to put make a subdirectory called "generated" in the source for meson so stuff could go to the right place. Well now we don't need to do that anymore. Move the meson.build files around so they go in the appropriate place in the subdirectory of the source tree and change the paths of the headers accordingly. A couple of important things to note. 1. mpv.com now gets made in build/player/mpv.com (necessary because of a meson limitation) 2. The macos icon generation path is shortened to TOOLS/osxbundle/icon.icns.inc.
* audio: add AO_INIT_MEDIA_ROLE_MUSICThomas Weißschuh2023-07-311-0/+17
| | | | This allows the AO to set the media role directly during init().
* Revert "audio: add AOCONTROL_UPDATE_MEDIA_ROLE"Thomas Weißschuh2023-07-303-30/+0
| | | | | | | The only user of these APIs was ao_pipewire and the logic there got converted so drop the now dead code. This reverts commit 3167a77aa38b3700c9a4459fa5fe2f65eef080a8.
* player/video: check for track and decoder existenceDudemanguy2023-07-271-2/+6
| | | | | | | | | | | The track during lavfi-complex can actually be NULL which meant that ca4192e2df7bcfdb9e18461f19e1bd2dd0ee3c7a regressed lavfi-complex by causing mpv to crash during runtime changes of the filter. Additionally, it's possible for the decoder wrapper to also be NULL. check_framedrop within write_video checks this, but check_for_hwdec_fallback does not. Perhaps, it's impossible for this to happen, but we might as well add the check here to be on the safe side since mp_decoder_wrapper_control is not designed to handle a NULL.
* player/video: check for forced eofDudemanguy2023-07-221-0/+15
| | | | | | | | | | | It's a bit of an edge case, but since we now allow the disabling of the software fallback it's possible to have a situation where hwdec completely fails and the mpv window is still lingering from the previous item in the playlist. What needs to happen is simply that the vo_chain should uninit itself and handle force_window if needed. In order to do that, a new VDCTRL is added that checks vd_lavc if force_eof was set. player/video will then start the uninit process if needed after getting this.
* osc: don't add margins to osc-deadzonesizellyyr2023-07-211-8/+5
| | | | | | | | | | | | | | | Currently, the osc will add a margin of (osc_height / 2) to the deadzonesize for the window controls, the topbar and the bottombar, i.e. when osc-deadzonesize=1, the osc will show up even if the cursor is only hovering (osc_height / 2) pixels above or below it. This is not what this option is supposed to do according to the manual, instead osc-deadzonesize=1 should result in the osc only appearing when it is directly hovered. The user can simply set osc-deadzonesize=0.9 or so if such a margin is desired, instead make the option work as advertised by removing this margin. It should be noted that osc-layout=box does not share this behavior, and it already works as advertised in the manual.
* screenshot: implement screenshot-window in sw for most VOsDudemanguy2023-07-211-6/+29
| | | | | | mpv already has a bunch of software scaling utils. Instead of forcing every VO to implement this, we can just grab the frame and scale it in software in one central place. Fixes #11968.
* screenshot: clarify software screenshot logicDudemanguy2023-07-211-15/+20
| | | | | | | | We should always be trying hardware screenshots (VOCTRL_SCREENSHOT and VOCTRL_SCREENSHOT_WIN) before software ones. Rearrange all the logic here to hopefully make this clearer. The mode is passed to add_osd (renamed since it will also be used to add the osd) which will be used more in the next commit.
* image_writer: move tag_csp check into image_writer_flexible_csp()sfan52023-07-191-1/+1
| | | | | | | This ensures the sRGB fallback to happen in all situations involving the image writer code, notably --screenshot-sw. fixes: cbbe2e52210d9885a0897e9c7833267a60456c56
* loadfile: make get_audio_lang function staticllyyr2023-07-171-1/+1
| | | | This fixes a build warning about missing prototypes
* loadfile: compute audio lang for sub selection when using lavfi-complexrcombs2023-07-161-3/+30
| | | | | | | | When using lavfi-complex, no single track populates current_track for audio. We work around this by iterating over the list of tracks and using the first non-null language from a selected track. If multiple tracks are selected (i.e. used by the filter) and have conflicting language tags, we'll ignore them all and maintain the previous behavior (null).
* 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