summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* present_sync: remove unneeded clear_values functionDudemanguy2023-11-073-13/+0
| | | | | | | | | This was specifically special logic for drm. Before present_sync, it would also clear out all of its vsync values like this. The old drm code would save a bunch of samples which would confuse vo.c when unpausing since it got old, bogus values. Since we make sure to match successive vsync samples with the swapchain depth and that present sync samples also match the swapchain depth, this is unneeded.
* vo: require successive vsyncs to be more than swapchain depthDudemanguy2023-11-071-1/+1
| | | | To make sure that present_sync is in line with the vsync timings here.
* present_sync: only save as many entries as the swapchain depthDudemanguy2023-11-075-7/+10
| | | | | | Saving more than the swapchain depth is just wasteful. We can just save a copy of the vo_opts here and check the value whenever we're updating values.
* vo: replace max swapchain depth magic numberDudemanguy2023-11-075-5/+6
|
* DOCS/mpv: consistent formatting of keybindingsChristoph Heinrich2023-11-071-12/+12
|
* DOCS/console: correct capitalization of keybindingsChristoph Heinrich2023-11-071-19/+19
|
* wayland: improve wl_output guessing before mpv window is mappedDudemanguy2023-11-062-4/+12
| | | | | | | | | | | | | | | | | | | | There's some geometry-related things that mpv has to calculate before the window is actually mapped onto the screen in wayland. But there's no way to know which output the window will end up on before it happens, so it's possible to calculate it using the wrong values. mpv corrects itself later when the surface event happens, but making the initial guess work better can help in certain cases. find_output is the only thing that needs to be changed here. Its main purpose is to grab the right output based on user settings when we're trying to full screen and giving a fallback in case we don't have wl->current_output yet. The x11 code already does something similar, so we're basically just copying it. Allow user settings like --screen and --screen-name to influence the initial wl_output guess. Those options won't actually place the window on that specific screen since we can't do that in wayland, but if the user knows where the window will end up beforehand it makes sense to listen to the arguments they pass. If something goes wrong, then we just fallback to 0 like before.
* sub: adjust offsets when sub seeking/steppingDudemanguy2023-11-063-7/+10
| | | | | | | | | | | | | | | | | | | | | In the sub seek code path, there was an arbitrary small offset added to the pts before the seek. However when seeking backwards, the offset was an additional subtraction. de6eace6e984be3cd2515e9be6362a0cf04b7457 added this logic 10 years ago and perhaps it made sense then, but the additional subtraction when seeking backwards causes the subtitle seek to go too far to the previous subtitle if the durations overlap. This should always be an addition to work correctly. Additionally, the sub stepping code path also could use this offset for the same reason (duration overlaps). However, it is only applicable to sd_ass not sd_lavc. sd_lavc has step_sub support but on a sample it didn't even work anyway. Perhaps it only works for certain kinds of subtitles (patches welcome). Anyways instead of keeping this offset as a magic number, we can define it in sd.h which is handy for this. For sd_ass, we add the offset when sub stepping, and the offset is always added for sub seeking like it was before. Update the comment to be a little more relevant to what actually happens today. Fixes #11445.
* DOCS/input: stop documenting vf delGuido Cella2023-11-061-7/+0
| | | | Because b56e63e2a9 removed it.
* dec_sub: always copy packet for new segmentsDudemanguy2023-11-061-1/+1
| | | | | | | | | | | Since 062104d16e34f348ffd9324ca4c997b6b0f487d4, we started saving cached packets for subtitles. However, these can point to the same address as what is stored in sub->new_segment. When a segment is updated, the packet is potentially freed. Later during decoding, this can lead to a double free since the cached packets will naturally try to free itself and update. Fix this by simply always making sub->new_segment a full copy of the packet so its lifetime doesn't have to be tied to the cached packet stuff.
* drm: use present_sync mechanism for presentation feedbackDudemanguy2023-11-066-122/+40
| | | | | | | | | | | A ton of code and drm-specific abstractions can be dropped with this. One important thing to note is that the usage of sbc is completely dropped here. The utility of that is not particularly clear since the sbc value was manually incremented before the flip and it's not as if the drm page flip event gives it to us like it does with the msec and ust. It can be reintroduced later if there is a need. For drm, we also add a present_sync_clear_values helper since all presentation feedback needs to be cleared on pause/resume for it.
* present_sync: rename function to present_sync_update_valuesDudemanguy2023-11-064-4/+4
| | | | This had to have been a mistake. It was just confusing.
* present_sync: rewrite around linked listDudemanguy2023-11-064-33/+81
| | | | | | | | | | | | | | | | | | | | | | | | | When this was originally written, the queuing/list approach was deliberately removed since it adds more complication and xorg/wayland don't really use it anyway. In practice, you only really have one frame in flight with presentation timestamps. However, one slight annoyance is that the drm code has its own thing which is almost exactly the same and does its own calculations. Ideally, we'd port drm to this instead, but the implementation there takes into account N-frames in flight which probably does actually work. So we need to make present_sync smarter and be able to handle this. mpv does actually have its own linked list implementation already which is a good fit for this. mp_present becomes the list and each mp_present_entry has its own set of timestamps. During initialization, we create all the entries we need and then simply treat it like a queue during the lifecycle of the VO. When an entry is fully used (present_sync_get_info), then we remove it from the list, zero it out, and append it to the end for future use. This avoids needing to allocate memory on every frame (which is what drm currently does) and allows for a reasonable number of in flight frames at the same time as this should never grow to some obscene number. The nice thing is that current users of present_sync don't need to change anything besides the initialization step.
* ytdl_hook: fix mixed thumbnail.preference availabilityChristoph Heinrich2023-11-061-1/+1
|
* Revert "vo: clear vsync_offset if drawing while paused"llyyr2023-11-061-3/+0
| | | | | | This reverts commit 640c07fb19b7ea11f1a97784e517c38449f816d0. This commit isn't needed anymore after the previous commit.
* video: reset `display_sync_error` when resetting statellyyr2023-11-061-0/+1
| | | | | | | | | | This would cause mpv to, in some very specific scenarios, have a negative vsync_offset after seeking which would result in mpv requesting a pts before the first frame to libplacebo. Fix it by setting it to 0 when we reset state, such as after seeking. Fixes: https://github.com/mpv-player/mpv/issues/12813
* threads: unbreak mpv on builds without assertsKacper Michajłow2023-11-063-4/+2
| | | | | | Also remove duplicated macro. Fixes: #12818 #12820
* player/command: add video-params and siblings to MPV_EVENT_TICKKacper Michajłow2023-11-051-1/+1
| | | | It contains metadata that may change per frame.
* ALL: use pl_hdr_metadata and nuke sig_peakKacper Michajłow2023-11-0515-94/+51
| | | | | | | | This commit replaces all uses of sig_peak and maps all HDR metadata. Form notable changes mixed usage of maxCLL and max_luma is resolved and not always max_luma is used which makes vo_gpu and vo_gpu_next behave the same way.
* demux_mkv: parse mastering metadataKacper Michajłow2023-11-051-5/+47
|
* player/command: remove hdr-metadata propertyKacper Michajłow2023-11-053-86/+10
| | | | | It is now included in video-out-params and was never released in stable version, so we can safely remove it.
* csputils: add pl_hdr_metadata to mp_colorspace and deprecate sig_peakKacper Michajłow2023-11-057-10/+63
| | | | | Note this commit does not change all uses of sig-peak, this is for future refactoring.
* player/command: use pl_hdr_metadata_containsKacper Michajłow2023-11-051-5/+3
|
* csputils: change mp_hdr_metadata to pl_hdr_metadataKacper Michajłow2023-11-054-33/+6
|
* timer: remove unnecesary time conversionsKacper Michajłow2023-11-054-4/+4
|
* win32/pthread: remove unused codeKacper Michajłow2023-11-053-529/+0
|
* timer: remove unused codeKacper Michajłow2023-11-053-53/+0
|
* threads: remove unused codeKacper Michajłow2023-11-052-33/+0
|
* threads: rename threads.c to threads-posix.cKacper Michajłow2023-11-053-2/+2
|
* threads: move pthread debug to threads-posix.hKacper Michajłow2023-11-053-64/+61
| | | | And remove redundant define while at it.
* mp_thread: add win32 implementationKacper Michajłow2023-11-0513-37/+252
|
* mp_thread: prefer tracking threads with idKacper Michajłow2023-11-0513-40/+43
| | | | | | | | | | | | | | This change essentially removes mp_thread_self() and instead add mp_thread_id to track threads and have ability to query current thread id during runtime. This will be useful for upcoming win32 implementation, where accessing thread handle is different than on pthreads. Greatly reduces complexity. Otherweis locked map of tid <-> handle is required which is completely unnecessary for all mpv use-cases. Note that this is the mp_thread_id, not to confuse with system tid. For example on threads-posix implementation it is simply pthread_t.
* ALL: use new mp_thread abstractionKacper Michajłow2023-11-0581-1299/+1252
|
* threads: add new mp_thread abstractionKacper Michajłow2023-11-052-0/+148
| | | | | | This will allow to avoid hacky pthreads symbols/header override. Inspired by pl_thread from libplacebo.
* sub: redecode cached packets on UPDATE_SUB_HARD or UPDATE_SUB_FILTDudemanguy2023-11-054-10/+31
| | | | | | | | | | | | | | | | UPDATE_SUB_HARD causes all of the ass objects to reset in order to apply the new style. UPDATE_SUB_FILT doesn't actually reset the sd, but it should in order to update the actual filters so that was added here. Doing this causes the current subtitle to be dropped. In the paused cause, this concidentally works because command.c forces a video refresh which then reloads the subtitle essentially. But while playing, the subtitle will be dropped and you won't get anything until the next one appears. Instead of using video refreshes, what we can do is just always save the last two subtitle packets in a cache and redecode them if needed. This is much easier and also allows us to get rid of all the video refresh logic in command.c. Fixes #12386.
* options: add UPDATE_SUB_HARD flag to sub-ass-overrideDudemanguy2023-11-051-1/+2
| | | | | | | | The other options that have to do with ass styles also uses this flag. It's needed since we have to destroy the ass objects and reinit them. It's a bit incomplete since it will technically only properly work when paused (while playing, the current subtitle gets discarded). That fix is in the next commit.
* vo_gpu_next: update to newer cache APIDudemanguy2023-11-051-98/+96
| | | | | | | | The old one would actually crash if the libplacebo.cache file was invalid. Additionally, set a max size of 1 GiB for icc cache and 50 MiB for gpu shader cache. The per object size limit is removed which puts mpv in line with plplay. Finally, a few memory leaks are also fixed since several objects previously were not freed on uninit.
* ra_pl: drop deprecated cached_program paramDudemanguy2023-11-051-7/+0
| | | | | This was deprecated in api version 322 which earlier than the current 6.338 version that mpv depends on. So remove it.
* vo_gpu_next: remove unneeded PL_API_VER guarding and definesDudemanguy2023-11-051-131/+1
| | | | | Since the minimum required libplacebo version is 6.338, all of these checks are unneeded.
* mp_image: pass rotation correctly to/from AVFrameKacper Michajłow2023-11-031-1/+8
| | | | | | Fixes rotating image by --video-rotate when filtering. Fixes: #12771
* win32: add more values for monitor refresh rate detectionnanahi2023-11-021-0/+4
| | | | | Add more refresh rates for get_refresh_rate_from_gdi() now (Nov 2023) that 165 Hz is common, 240 Hz is on the rise, and 120 * N Hz is the future.
* DOCS/man/console: update type examplesGuido Cella2023-11-021-2/+6
|
* lua: remove a ton of unneeded parenthesesDudemanguy2023-11-025-147/+146
| | | | | | | | | | | For whatever reason, some of the lua code (particularly the osc and ytdl_hook) is full of a bunch of stuff like if (foo), if not (foo == nil), etc. The parenthesis aren't needed in lua and actually just look weird since nobody actually writes lua like this. You can see most of the other conditionals are written normally. So cleanup the style to match when the parenthesis clearly aren't doing anything. Not directly related, but also add some spaces on a few math operations while we're at it.
* console.lua: complete file pathsGuido Cella2023-11-021-0/+44
|
* console.lua: complete list option verbsGuido Cella2023-11-021-0/+18
|
* console.lua: inline mp.optionsGuido Cella2023-11-021-2/+1
| | | | | | This avoids a "Redefined local `options`" LSP warning in list_option_list() after the previous commit. It still works, but reusing names for local variables is error-prone.
* console.lua: complete list optionsGuido Cella2023-11-021-0/+22
|
* console.lua: complete profilesGuido Cella2023-11-021-0/+12
|
* console.lua: complete commands after helpGuido Cella2023-11-021-1/+9
| | | | And complete help itself.
* console: complete infinite cycle-values argumentsChristoph Heinrich2023-11-011-24/+4
| | | | | cycle-values already completed the first two arguments, but the command accepts infinitely many arguments, so enable completion for all of them.
* m_option: don't try to remove all filter matchesDudemanguy2023-11-011-8/+6
| | | | | | | | | | | | Probably should have actually tested the filter changes but I didn't. This was the wrong spot anyway since labels are unique. Something like this should have been done further down when finding it by content. On second thought, having multiple filters with the same content does have a usecase (e.g. stacking multiple rotations) so removing all of them at once probably isn't great. There's no practical usecase for having duplicates in a string list, so we'll leave that change alone. Fixes #12791.
* player/main: set main thread name as mpvKacper Michajłow2023-11-011-1/+1
| | | | | Now that we don't prepend `mpv/` to all thread names, `main` is too ambiguous and since it is main thread it can be seen as process name.
* vo_gpu_next: use pl_queue_params() macroNiklas Haas2023-10-311-2/+2
| | | | In case new default parameters are added later.
* vf_vapoursynth: set crop metadata after mapping vapoursynth frameKacper Michajłow2023-10-311-0/+2
| | | | | | | | Vapoursynth does not provide crop metadata and input one is likely to be invalidated during filtering. Set crop to full frame if image dimensions were changed during filtering. Fixes: #12780
* player/video: loosen logic checks for adjust_syncDudemanguy2023-10-301-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, the av sync change calculation was only done if the audio_status was STATUS_PLAYING, but there is at least one or two more states where this should be done. player/audio is capable of adding delay if the state is anything besides STATUS_EOF. This means that while calling adjust_sync, the delay value could have changed from the audio side of the equation from the previous playloop, and it doesn't necessarily mean that the current audio_status is STATUS_PLAYING either. So the old code would technically skip this case. In practice, this is just one frame so it hardly matters, but it should be taken into account. For example, STATUS_READY is definitely possible here in adjust_sync. I'm not sure if it's actually possible for STATUS_SYNCING to happen but the audio code can change add delay with that status, so it doesn't hurt. STATUS_DRAINING is probably not relevant, but again include it to mirror the audio code logic. Of course, STATUS_EOF is obviously a no-no since that means no audio at all, so we return from there. I didn't take hard measurements or anything, but this does seem to result in slightly smaller av sync fluctuations on discontinuities (like seeking) which makes sense because we're now making an additional correction that wasn't previously done. Another change is to always try adjust_sync as long as the frame_time is nonzero. The old logic only did this if the video_status was playing or greater, but it is possible to get new frames with a different PTS that do not have that status. The audio is still playing so logically it should be adjusted as well. Again, this happens for just one frame, so it doesn't really matter in practice but it should make more sense. A zero frame_time is skipped since that would mean the pts did not advance and the previous playloop should have done the adjustment for that time already.
* player/video: don't reset ao on video chain reinitDudemanguy2023-10-301-8/+4
| | | | | | | | | | | | | | | | | | | | 3038e578af5b06129c2dd98cffeede7cdf8db700 recently changed the logic here so it wouldn't trigger on still images, but after thinking about the code here some more, I don't believe it's needed at all. Doing an ao reset when you flip the video track is very disruptive and not really desirable at all. Since the ao no longer adds bogus delay values while the video is off, there should be no need to do a full reset for syncing reasons. The delay value will be zero, so we can let the audio just play normally and let the video code do its thing. There is one slight trick here however. When using a display sync mode, part of the syncing code will try to update the audio and video playback speed. This can cause an audio underrun if we're just turning the video back one. An easy way to avoid most of these is to not update the speed if we are in the STATUS_SYNCING state for video. This isn't quite perfect and underruns are still possible, but it actually seems to depend on the AO. e.g. I couldn't trigger an underrun with alsa but I could with pipewire. In any case, the audio artifact here is much less noticeable than doing a full ao reset, so it's still an improvement.
* demux: make hysteresis-secs respect cache-secsNRK2023-10-303-7/+9
| | | | | | | | | | | | currently hysteresis-secs only works when the demuxer-max-bytes fills up. but it's possible for the cache-secs/demuxer-readahead-secs to be reached first. in those cases, hysteresis-secs doesn't work and keeps buffering non-stop. but the goal of this option was to save power by avoiding non-stop buffering so go ahead and make it respect cache-secs as well. additionally remove some redundant repetition from the docs.
* demux: cosmeticsNRK2023-10-301-6/+5
| | | | | - brace goes to next line for multi-line conditional - sort standard headers some more
* m_option: drop support for -del for list optionsDudemanguy2023-10-306-115/+19
| | | | | | 5f74ed58286a1339412554932f31844ec1b64280 deprecated this many years ago. The utility is questionable at best given that -remove exists and is more natural to use. Free up some code and drop it.
* m_option: remove all matches when using -removeDudemanguy2023-10-301-13/+22
| | | | | | | | When using -remove with list options, it previously only removed the first match. Technically, it is possible for there to be more than entry with the same name. They should all be removed. key/value lists specifically only allow unique keys so we don't need to do anything there.
* options: make --screenshot-directory/--watch-later-directory aliasesDudemanguy2023-10-303-4/+8
| | | | By popular demand I guess.
* ytdl_hook: reverse thumbnail orderChristoph Heinrich2023-10-301-1/+2
| | | | | | ytdl lists thumbnails in ascending order according to height/preference. all_formats=yes adds formats from best to worst, so the same should also be done for thumbnails.
* ytdl_hook: support the preference field of thumbnailsChristoph Heinrich2023-10-301-1/+4
| | | | | | | yt-dlp has a preference field for it's thumbnails, and not all of it's listed thumbnails have fields with their dimensions. Therefore prefere the preference field when available and fall back to height if it's not.
* ytdl_hook: add thumbnail optionChristoph Heinrich2023-10-302-12/+13
| | | | | Opening speed could be improved with the "async" prefix, but then the tracks would be out of order.
* ytdl_hook: support thumbnailsEva2023-10-301-3/+36
| | | | | | Similar to "write-sub=", adding "write-thumbnail=" to raw-options will add the highest resolution thumbnail as a video track. Closes #7041
* various: remove trailing whitespaceGuido Cella2023-10-307-13/+13
|
* ao_coreaudio: signal buffer underrunsUmar Getagazov2023-10-291-1