summaryrefslogtreecommitdiffstats
path: root/player
Commit message (Collapse)AuthorAgeFilesLines
* scripting: dll cpluginschuck-2023-09-201-0/+7
|
* demux: add crop to mp_codec_paramsKacper Michajłow2023-09-171-0/+5
|
* osc: add scrolling to audio/sub buttonsllyyr2023-09-171-0/+8
| | | | Consistent with other osc buttons now
* player: redo --subs-fallback-forcedDudemanguy2023-09-091-8/+18
| | | | | | | | | | | | | In the never ending quest of trying to satisfy every possible user request for subtitle autoselection, I ended up redoing how --subs-fallback-forced works. The old behavior had it as strictly a fallback-type option when there were no lang matches, but now we can make it an active part of compare_track and it works along with slang to select the desired track. Since it's a three state option, the no option still works to avoid selecting any forced subtitle tracks. The meaning of always slightly changes to mean "only select forced subtitle tracks" and yes remains essentially the same (no special priority given besides the audio matching subtitle language case).
* player/video: apply crop for all frames in vo_frameKacper Michajłow2023-09-091-32/+39
| | | | | Sometimes needed when frames are extracted out of order, for example in case of screenshot.
* screenshot: support crop with --screenshot-swKacper Michajłow2023-09-091-0/+13
|
* video: allow overriding container crop if it is presentKacper Michajłow2023-09-082-8/+16
| | | | | | Setting `--video-crop=0x0+0+0` applies full frame crop, ignoring the container one. Setting --video-crop=0 disables manual crop and restores container one if it is available.
* stats.lua: don't display full frame cropKacper Michajłow2023-09-081-5/+23
| | | | It is valid to have 0x0+w+h crop, but no need to print that.
* player/command: mark video-params/crop- unavailable if emptyKacper Michajłow2023-09-081-4/+5
|
* osc: add scrolling to the seekbarNRK2023-09-021-0/+4
| | | | | | the osc currently allows for changing volume via scrolling when on top of the volume icon. this does the same thing for the seekbar by allowing seeking via scroll.
* loadfile: fix forced subtitles not respecting slangDudemanguy2023-09-011-2/+7
| | | | | | | | | | | | | | fbe8f9919428a7ed24a61899bfd85bbb7680e389 made it possible for mpv to autoselect forced subtitles again (it was bugged and would ignore without slang being specified). Unfortunately, I forgot to take slang into account here, so it would always autoselect the subtitles if they are available. Fix this by checking both that it matches the lang and that the previous track pick wasn't already matched (os_langs being true is essentially equivalent to there not being any specified slang). This way, it still respects the order of languages in your slang list. Probably someone out there will be upset that forced subtitles aren't always preferred regardless of the order, but that can be another option for later I guess.
* osc: remove toggle for forced only subpicturesllyyr2023-08-311-39/+0
| | | | | | | | | | | | | | | DVD/PGS are definitely not common, and ones that make use of the forced subpictures flag even less so. For this button to be useful, the subtitle track would need to be DVD or PGS, the track would need to make use of the forced flag, the user would have to know what forced subpictures are, and the user would need to have the preference of only viewing forced subpictures on a subtitle. The function of this button is too niche to be on the osc, if this behavior is desired the user can simply bind a key in their input.conf. Moreover, this button only adds confusion because there's no intuitive way to show what it does, and there's no explanation for it anywhere in the manuals. osc real-estate is quite limited as it is, so let's not waste any space on buttons with highly questionable utility at best and confusing or bad UX at worst.
* stats.lua: display --video-crop values when usedKacper Michajłow2023-08-311-0/+4
|
* player/command: add video-params/crop-[w,h,x,y]Kacper Michajłow2023-08-311-0/+4
|
* vo: add --video-cropKacper Michajłow2023-08-312-1/+35
| | | | | | Just cropping by VO that works with hwdec. Fixes: #12222
* player/video: don't copy mp_image_params when not neededKacper Michajłow2023-08-311-7/+7
|
* player/command: remove video-aspect propertyKacper Michajłow2023-08-311-63/+1
| | | | 4 years is enough of deprecation period.
* stats.lua: enable --tone-mapping-visualize while stats shownNiklas Haas2023-08-301-0/+10
| | | | Except in oneshot mode. Controllable via new option.
* stats.lua: display hdr metadata and peak detectionKacper Michajłow2023-08-291-6/+67
|
* command: add hdr-metadata propertyKacper Michajłow2023-08-291-0/+35
|
* loadfile: fix --no-subs-with-matching-audio with --slangDudemanguy2023-08-291-2/+4
| | | | | | | | | If --slang was set to some language and it matched the subtitle track, then --no-subs-with-matching-audio would do nothing. Fix the logic by doing the --no-subs-with-matching-audio step at the end to ensure that it always "wins" over whatever --slang or --subs-fallback has set. Clarify the docs a bit to make it clearer that this is the intended behavior. Fixes fbe8f9919428a7ed24a61899bfd85bbb7680e389.
* osc: replace sub-forced-only with sub-forced-events-onlyDudemanguy2023-08-291-2/+2
|
* command: remove sub-forced-only-cur propertyDudemanguy2023-08-291-9/+1
| | | | | | Since we no longer have the auto choice, this is always exactly equal to the value of the option (sub-forced-events-only). Remove the property and alias it.
* player: rename --sub-forced-only to --sub-forced-events-onlyDudemanguy2023-08-292-3/+3
| | | | | | | | The old name is pretty bad and users mistakenly think it has something to do with selecting forced subtitles (that would be --subs-fallback-forced). Instead of giving it such a generic name, make it clearer that this has to do specifically with forced sub events which is only relevant for a small minority of subtitles.
* player: remove auto choice from sub-forced-onlyDudemanguy2023-08-293-16/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | First of all, this never worked. Or if it ever did, it was in some select few scenarios. c9474dc9ed6172a5f17f66f4b7d367da6b077909 is what originally added support for the auto choice. However, that commit worked by propagating a value to a fake option used internally. This shouldn't have ever worked because the underlying m_config_cache was never updated so the value shouldn't have been preserved when accessed in sd_lavc. And indeed with some testing, the value there is always 0 unsurprisingly. This was later rewritten in ba7cc071068f4f57ae354e77f64552712fda6855 along with a lot of other sub changes, but with that, it was still mostly broken. The reason is because one of the key parts of having to hit this logic (prefer_forced) required `--no-subs-with-matching-audio` to be set. If the audio language matches the subtitle language (the requirement also excludes forced subs), the option makes no subtitle selection in the first place so pick->forced_only_def is not set to true and nothing even happens. Another way around this would be to attempt to change your OS language (like with the LANG environment variable) so that the subtitle track gets selected but then audio_matches mistakenly becomes false because it compares the OS language to the audio language which then make preferred_forced 0, so nothing happens. I don't think there's a scenario where pick->forced_only_def is actually set to true (thus meaning `auto` is useless), but maybe someone could contrive something very strange. Regardless, it's definitely not something even remotely common. fbe8f9919428a7ed24a61899bfd85bbb7680e389 changed track selection again but didn't consider this particular case. The net result is that DVD/PGS subs become equivalent to --sub-forced-only being yes, so this a change in behavior and probably not a good one. Note that I wasn't able to actually observe any difference in a PGS sample. It still displayed subtitles fine but that sample probably didn't have the right flags to hit the sub-forced-only logic. Anyways, the auto feature is extremely questionable at best and in my view, not actually worth it. It is meant to be used with `--no-subs-with-matching-audio` to display forced pictures in subtitle tracks that are not marked as forced, but that contradicts that particular option's purpose and description in the manual (secretly selecting a track under certain conditions even though it says not to). Instead of trying to shove all this logic into select_default_track which is already insanely complicated as it is, recognize that this is a trivial lua script. If you absolutely want to turn --sub-forced-only on under these certain conditions (DVD/PGS subtitles, matching audio and subtitle languages, etc.), just look at the current-tracks property and do your thing. The very, very niche behavior that this option tried to accomplish basically never worked, no user even knows what this option does, and well it's just not worth supporting in core mpv code. Drop all this code for sanity's sake and change --sub-forced-only back to a bool.
* stats.lua: add hints about scrollingKacper Michajłow2023-08-281-3/+6
|
* stats.lua: refactor video params displayKacper Michajłow2023-08-281-10/+20
| | | | | | | | - Move window scale to scaled resolution line - add deinterlacing display - rename "Gamma" to "Transfer" - reorder to colormatrix/primaries/transfer as commonly used by ffmpeg/ffprobe
* stats.lua: remove dummy new lines from headersKacper Michajłow2023-08-281-3/+3
|
* stats.lua: display actual output video size after anamorphic correctionKacper Michajłow2023-08-281-5/+7
| | | | | This makes much more sens than frame size that is the same as native one.
* player: add always to --subs-fallback-forcedDudemanguy2023-08-281-2/+4
| | | | | | In general, forced tracks should only be shown if they match the language of the audio. However some people do want them no matter what, so add an always option to this so such tracks are always selected.
* player: add --subs-match-os-language optionDudemanguy2023-08-281-11/+21
| | | | | | | This is the replacement for the previous auto option for slang. It behaves similar however it never overrides slang if that is set and will instead try to pick the subtitle that matches the user's language if appropriately flagged by the file.
* loadfile: simplify default track selection a bitDudemanguy2023-08-281-36/+22
| | | | | | | | | | | | | | What was previously there is extremely complicated and really confusing. Poorly named variables like "prefer_forced" that don't neccesarily have anything to do with prefering forced tracks didn't help either. Try to rewrite a few things to be saner. The idea is that after you loop through the tracks, the special sub-specific options (like subs-fallback and so on) should be handled and the track should be deselected if appropriate. Another change is to remove the "prefered_forced" argument in compare_track. This actually was both not neccessary and caused bad behavior by always depriortizing forced tracks even when it didn't apply (e.g. forced video tracks were never selected even though the flag should simply be ignored for anything that's not a subtitle track).
* player: remove special auto option from alang/slang/vlangDudemanguy2023-08-281-7/+2
| | | | | | | | | | | | This proved to be too problematic. Depending on the value of --subs-with-matching-audio, you could either end up with cases where --slang wasn't respected and users didn't get subtitles or alternatively cases where subtitles were given and the user didn't ask for them. Fundamentally, the OS language functionality doesn't really map well to slang (and for alang/vlang it makes zero sense; not that anyone actually used it). Instead of trying to shove it in an option where it doesn't belong, we should split this off into something else. So for now, just remove the special handling of "auto" and flip slang back to NULL.
* playlist: remove unused code to track redirectsGuido Cella2023-08-281-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | It turns out that the code to track redirects (playlists and directories) never worked correctly, only the last redirect is remembered and num_redirects is never greater than 1. You can see this by doing quit-watch-later with the old watch later system, before dbf244fd2f, on a m3u playlist of files and a m3u playlist of directories. Only in the first case a redirect entry for the m3u file is created, because in the second case the m3u redirect is replaced by the directory one. If you did mpv --directory-mode=lazy /foo it did create redirect entries for all subdirectories e.g. /foo/bar, /foo/bar/baz, /foo/bar/baz/qux, this made it seem like it worked correctly, but actually /foo/bar/bar/qux was the only redirect entry and thus it was considered as the first redirect, and mpv created redirect entries for each segment of the first redirect only. In the previous commit dbf244fd2f, rather than figuring out how to fix the code to track redirects, and since creating redirect entries for multiple redirects is overkill, I just used the new playlist-path property which does the same thing but only for the last redirect. By replacing the only other use of the old redirect code with playlist-path, we can remove it.
* player: always write redirect entries for resuming playbackGuido Cella2023-08-281-36/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 35f43dfacbe added a system to write resume files for redirects, i.e. directories and playlists that mpv expands. It creates a resume file for each redirect, and for the first redirect only, it writes a resume file for each segment of its path, without even converting it to an absolute path if it's relative. This is incomplete: mpv 'Iron Maiden/1982 The Number of the Beast/8 Hallowed Be Thy Name.mp3' This doesn't save any redirect entry. mpv --directory-mode=recursive 'Iron Maiden', then quit-watch-later on Hallowed Be Thy Name This saves a redirect entry for "Iron Maiden", but not for "1982 The Number of the Beast". It doesn't save redirect entries for the directories above "Iron Maiden" either because "Iron Maiden" isn't converted to an absolute path. In both of these cases mpv --directory-mode=lazy 'Iron Maiden' won't resume from "Hallowed Be Thy Name" because "1982 The Number of the Beast" isn't the first subdirectory and there is no redirect entry for it. 503dada42f made mpv recursively expand subdirectories precisely to fix this, and f266eadf1e added back an option not to expand them. But if we fix how redirect entries are stored, we can make the superior --directory-mode=lazy (because it's faster and doesn't result in massive playlists) the default, and also ensure that mpv will resume playback even when you quit-watch-later a file without redirects and then play the directories above it. Fix this by always creating redirect entries for all segments of the absolute path of the file, so that both mpv 'Iron Maiden/1982 The Number of the Beast/8 Hallowed Be Thy Name.mp3' and mpv --directory-mode=lazy 'Iron Maiden' will create redirect entries for /$USER /$USER/music /$USER/music/Iron Maiden /$USER/music/Iron Maiden/1982 The Number of the Beast making mpv --directory-mode=lazy "Iron Maiden" resume from "Hallowed Be Thy Name". This commit also makes mpv delete the redirect entries of parent directories when resuming playback, because if for example you have a playlist with all the songs in a discography: 1980 Iron Maiden/1 Prowler.mp3 1980 Iron Maiden/2 Remember Tomorrow.mp3 ... 1981 Killers/1 The Ides of March.mp3 1981 Killers/2 Wrathchild.mp3 ... Now mpv will eventually create redirect entries for every album. If you later decide to play the directories instead and there are 20 albums, you would have to do mpv * 20 times to clear all the redirect entries.
* osc: fix margin for forced-only subs toggle in bar layoutllyyr2023-08-271-1/+2
| | | | | | This ensures the spacing between forced-only sub toggle button and the volume button matches the spacing between the volume and the fullscreen button on bottombar/topbar layouts
* osc: only add sub forced-only toggle to layout for DVD/PGS subsllyyr2023-08-271-12/+13
| | | | | | | | | | | | | | | | | Fixes: 945d7c1eda47c97c4bfba884fb21f398a64b2289 Previously, we would have a button with empty string added to the layout for non DVD/PGS subtitles. This would cause there to be an invisible button present that would take up space and could still be clicked despite being invisible when the current subtitle track was not DVD/PGS. The idea was that the button would be invisible for regular subtitle tracks, and be visible as "[ ]"/"[F]" for DVD/PGS subtitle tracks. This commit modifies the bar and box layouts to only add this button if the current subtitle track is DVD/PGS. This results in there no longer being an invisible button, and also prevents it from taking up space. The button is added to layout as before when the current subtitle track is DVD/PGS, matching the same logic as before.
* command: add `sub-ass-extradata` propertyllyyr2023-08-271-0/+24
|
* player: make all autoload extensions configurableDudemanguy2023-08-263-21/+23
| | | | | | | | | | | | | | | | | | | | | | | | --audio-file-auto, --cover-art-auto, and --sub-auto all work by using an internally hardcoded list that determine what file extensions get recognized. This is fine and people periodically update it, but we can actually expose this as a stringlist option instead. This way users can add or remove any file extension for any type. For the most part, this is pretty pretty easy and involves making sub_exts, etc. the defaults for the new options (--audio-file-auto-exts, --cover-art-auto-exts, and --sub-auto-exts). There's actually one slight complication however. The input code uses mp_might_be_subtitle_file which guesses if the file drag and dropped file is a subtitle. The input ctx has no access to mpctx so we have to be clever here. For this, the trick is to recognize that we can leverage the m_option_change_callback. We add a new flag, UPDATE_SUB_EXTS, which fires when the player starts up. Then in the callback, we can set the value of sub_exts in external_files to opts->sub_auto_exts. Whenever the option updates, the callback is fired again and sub_exts updates. That way mp_might_be_subtitle_file can just operate off of this global variable instead of trying to mess with the core mpv state directly. Fixes #12000.
* player: use audio pts corresponding to playing audio on EOFllyyr2023-08-251-2/+1
| | | | | | | | | We should account for ao queue when setting playback position on EOF, previously we were using the pts value corresponding to the start of the ao queue, rather than the currently playing audio. This fixes time-remaining being a negative number when mpv seeks to EOF while playback is paused.
* 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 t