summaryrefslogtreecommitdiffstats
path: root/player
Commit message (Collapse)AuthorAgeFilesLines
* Revert "demux: improve stream selection state"Dudemanguy2023-09-303-13/+4
| | | | | | | | The stream selection state wasn't improved. I didn't realize this messed with caches. All in all, just not a good idea. Back to drawing board I guess. This reverts commit f40bbfec4fcd2d9a787a4d98ec7698a646e5607e.
* vo: change vsync base to nanosecondsKacper Michajłow2023-09-291-1/+1
| | | | | There is no reason to use microseconds precision. We have precise timers all all relevant platforms.
* win32/pthread: define _POSIX_TIMERS to notify they are not supportedKacper Michajłow2023-09-293-2/+3
|
* timer: rename mp_add_timeout to reflect what it actually doesKacper Michajłow2023-09-292-2/+2
|
* timer: rename mp_time_us_to_timespec to reflect what it actually doesKacper Michajłow2023-09-291-1/+1
|
* playloop: make chapter property more accurate when seeking chaptersMike Will2023-09-294-11/+17
| | | | | | | | | | | | | | | | | | | | | | When seeking chapters, `last_chapter_seek` acts as a projection of what the current chapter will be once mpv has a chance to seek to it. This allows for more accurate results from the `chapter` property. It works by comparing the projection to the actual current chapter and returning the larger of the two indexes, but this only works when seeking forward. If we want it to work for both forward and backward chapter seeking, we can instead use a boolean called `last_chapter_flag`, which gets switched on when a chapter seek request is made, and then switched off when the seek has been performed. We should also check to ensure that we don't allow the chapter index to be set to -1 unless there is a span of time between the very beginning of the track and the start of the first chapter. Since the new approach to resetting `last_chapter_seek` no longer depends on `last_chapter_pts`, that member variable can be removed.
* playloop: don't refresh seek on external sub streamsDudemanguy2023-09-281-1/+1
| | | | | | External subtitles are always read as eager, so they do not need to be changed on pause/unpause. Don't do the refresh seek since it will just buffer forever. Fixes f40bbfec4fcd2d9a787a4d98ec7698a646e5607e.
* demux: improve stream selection stateDudemanguy2023-09-273-4/+13
| | | | | | | | | | | | | | | | | | | | | | | This replaces the previous commit and makes more sense. The internal demux marked tracks as eager depending on their type and for subtitles it would always lazily read them unless there happened to be no available av stream. However, we want the sub stream to be eager if the player is paused. The existing subtitle is still preserved on the screen, but if the user changes tracks that's when the problem occurs. So to handle this case, propagate the mpctx->paused down to the stream selection logic. This modifies both demuxer_refresh_track and demuxer_select_track to take that boolean value. A few other parts of the player use this, but we can just assume false there (no change in behavior from before) since they should never be related to subtitles. The core player code is aware of its own state naturally, and can always pass the appropriate value so go ahead and do so. When we change the pause state, a refresh seek is done on all existing subtitle tracks to make sure their eager state is the appropriate value (i.e. so it's not still set to eager after a pause and a track switch). Slightly invasive change, but it works with the existing logic instead of going around it so ultimately it should be a better approach. We can additionally remove the old force boolean from sub_read_packets since it is no longer needed.
* osc: move the idle logo behind other overlaysChristoph Heinrich2023-09-271-4/+4
| | | | | | | | The default `z` of an overlay is 0, which is used by e.g. console.lua. Having the idle logo at a `z` of 1000 means that it ends up above the console (and anything that don't set a value higher then 1000). It doesn't make sense for the idle logo to overshadow other things, so put it at -1000 instead to prevent that.
* command: only warn shared-script-properties onceDudemanguy2023-09-271-2/+6
| | | | | | | Evidently I was wrong and mpv only actually warns once on deprecation (playlist-pos nor display-fps did not and warned every time, but those were outliers apparently). Someone complained so just hack it into command_ctx for now.
* command: deprecate shared-script-propertiesDudemanguy2023-09-271-0/+2
| | | | user-data is simply better.
* osc: remove shared-script-properties usageDudemanguy2023-09-271-5/+0
| | | | | | 0b4860248b3395b32a89908efd34fdef12f4906e added user-data which is completely superior and makes this property obsolete. We've already had one mpv release with the osc using user-data so drop this.
* console.lua: complete properties after cycle-valuesGuido Cella2023-09-271-0/+2
|
* osc.lua: fix calculation for slider's min-max averageMike Will2023-09-251-1/+1
| | | | | | Average of two numbers is given by the sum of the two numbers divided by two. It's gone unnoticed because `s_min` is basically always zero.
* options: remove deprecated --record-file optionDudemanguy2023-09-214-113/+0
| | | | | | No wonder wm4 wanted to get rid of this. This option requires touching a bunch of crap in the core player code. --stream-record works perfectly fine and is a lot nicer so there's no need for this to exist anymore.
* command: stop restarting playback when writing to playlist-posDudemanguy2023-09-211-5/+2
| | | | | | | | | e9e93b4dbe748cd341a6fbea355e6ba013ada81b added a warning about writing the same value to the playlist-pos property that in the future it would stop restarting playback. Instead, you should use the playlist-play-index command for that. Well go ahead and drop the old deprecated behavior now and do what wm4 wanted this to do: just ignore if the same value is written again.
* command: remove some old deprecated properitiesDudemanguy2023-09-211-20/+7
| | | | | | | | drop-frame-count and vo-drop-frame-count are ancient and have no reason to exist anymore. The other change is that support for writing to display-fps has been removed, and the property is strictly read-only now. 3a2dc8b22e9f947c9cd3a91445b0731b8df1d798 is what deprecated it with a warning to users, so we can remove it without much trouble.
* various: add missing include in header fllesllyyr2023-09-211-0/+1
| | | | Mostly cosmetic
* mp_image: add force_window fieldDudemanguy2023-09-211-0/+1
| | | | | | It's useful for some VOs (dmabuf-wayland) to know if the image params are actually real or fake ones sent by the core for the purpose of force_window.
* options: make video-crop validation more strictKacper Michajłow2023-09-202-4/+2
|
* player/video: don't try to restore old crop when invalid were providedKacper Michajłow2023-09-201-29/+20
| | | | | Instead just reset the crop to give user feedback that it was wrong. Also don't override decoder crop on invalid crops.
* cplugin: allow loading mpv_* symbols dynamicallyKacper Michajłow2023-09-201-0/+75
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Defining MPV_CPLUGIN_DYNAMIC_SYM during plugin compilation will replace mpv_* functions with function pointers. Those pointer will be initialized when loading the plugin. It is recommended to use this symbol table when targeting Windows. The loader does not have notion of global symbols. Loading cplugin into mpv process will not allow this plugin to call any of the symbols that may be available in other modules. Instead cplugin has to link explicitly to specific PE binary, libmpv-2.dll/mpv.exe or any other binary that may have linked mpv statically. This limits portability of cplugin as it would need to be compiled separately for each of target PE binary that includes mpv's symbols. Which in practice is unrealictis, as we want one cplugin to be loaded without those restrictions. Instead of linking to any PE binary, we create function pointer for all mpv's exported symbols. For convinience names of entrypoints are redefined to those pointer so no changes are required in cplugin source code, except defining MPV_CPLUGIN_DYNAMIC_SYM. Those function pointer are exported to make them available for mpv to init with correct values during runtime, before calling `mpv_open_cplugin`. Note that those pointer are decorated with `selectany` attribute, so no need to worry about multiple definitions, linker will keep only single instance. This fixes cplugin usability on Windows. Without any API changes, only recompilation with -DMPV_CPLUGIN_DYNAMIC_SYM is needed.
* 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 "Ir