summaryrefslogtreecommitdiffstats
path: root/player
Commit message (Collapse)AuthorAgeFilesLines
* dispatch: change mp_dispatch_queue_process timer to nanosecondsDudemanguy2023-10-161-1/+1
| | | | | The playloop is the only thing that adjusts the timeout with a value other than 0, so nothing else needs to be changed.
* command: unbreak runtime play-dir changesDudemanguy2023-10-161-3/+5
| | | | | | | The whole mess with setting the option value explictly and saving the old stop_play value only needs to happen if we're at the end of file. Doing it in general is unneccessary and breaks other things. Fixes #12424.
* stats.lua: remove compatibility aliases of propertiesllyyr2023-10-151-17/+3
| | | | | | These are ancient and have existed since before stats.lua lived in the mpv repository. We don't need to worry about ancient mpv versions anymore, so remove these.
* stats.lua: fix page 2 alignment of "Total"Christoph Heinrich2023-10-151-3/+3
| | | | | | | | | The text didn't line up with with the percentages above it because it didn't use a monospace font. Instead insert the text at the same position in the template as the percentages and convert one o.prefix_sep from the percentages into hard coded \h\h to ensure alignment even when the user changes o.prefix_sep.
* stats.lua: add chroma-locationKacper Michajłow2023-10-141-0/+3
|
* stats.lua: change "Pixel Format" to "Format"Kacper Michajłow2023-10-141-1/+1
|
* stats.lua: fix missing newline when print_perfdata_passes is enabledKacper Michajłow2023-10-141-4/+4
|
* stats.lua: sort filter parameters to ensure consistent outputKacper Michajłow2023-10-141-2/+2
|
* player/command: change how floating point number are printedKacper Michajłow2023-10-141-2/+7
| | | | | | | | Use "%.7g" to show 7 significant digits. Removes the trailing zeros, and in general makes it more readable, than fixed 3 decimal digits. For avsync use "%+.2g" to add plus sign, similar to display-sync values.
* stats.lua: don't print custom pixel format, when hwdecKacper Michajłow2023-10-141-5/+2
| | | | | There is already other place to indicate hw decoding. "cuda" or "d3d11" is not a pixel format.
* stats.lua: remove leading zeros from pass timingsKacper Michajłow2023-10-141-2/+2
| | | | Makes it more readable in my opinion.
* stats.lua: add frame infoKacper Michajłow2023-10-141-0/+23
|
* stats.lua: simplify fps displayKacper Michajłow2023-10-141-15/+26
| | | | | | - rename prefix to `Framerate:` - if both estimated and specified values are the same display fps once - skip the suffix if both the estimated and specified values agrees
* stats.lua: adjust spacing between values a littleKacper Michajłow2023-10-141-23/+43
|
* stats.lua: show HDR meta if not equal to 203Kacper Michajłow2023-10-141-4/+7
| | | | | SDR white (203) is indeed not interesting, but anything else, even if lower is.
* stats.lua: separate video parameters from video outKacper Michajłow2023-10-141-42/+85
| | | | | | | | Source video parameters are interesting, but we mix them with video output/target parameters. Which will differ. Add "Display" showing true output params from VO, including HDR passthrough info and everything. This makes much more consistent output and alows to quickly diagnose how is source video translated to target display.
* command: fix fps property nameKacper Michajłow2023-10-141-1/+1
| | | | fps property was not renamed in events.
* command: early exit in some properties to avoid going through VOCTRLKacper Michajłow2023-10-141-18/+39
|
* command: fix segfault with playlist-{next,prev}-playlistGuido Cella2023-10-131-0/+1
| | | | | | | | | | | | | | | | | | | | This was wrongly assuming that playlist_path is always set for the current playlist entry, but it's only set when a file was added by expanding a playlist. The crash in playlist_get_first_in_next_playlist can be reproduced with mpv foo.mkv foo.zip, playlist-next, playlist-prev, playlist-next-playlist. You need to run playlist-next, playlist-prev first because foo.zip's playlist_path is NULL until you do that, which makes playlist_get_first_in_next_playlist return immediately. The crash in cmd_playlist_next_prev_playlist can be replicated with mpv --loop-playlist foo.zip foo.mkv, running playlist-next until foo.mkv, and playlist-play-next. Again, you need to open foo.zip first or its playlist_path is NULL which skips running strcmp(entry->playlist_path, mpctx->playlist->current->playlist_path). Fixes https://github.com/mpv-player/mpv/issues/12495#issuecomment-1760968608
* console.lua: print the log and input line to the terminalGuido Cella2023-10-111-0/+33
|
* ytdl_hook.lua: set metadata with single tracksGuido Cella2023-10-111-3/+4
| | | | | | | | | | Use EDL for single tracks with metadata to set the uploader, channel url and description metadata with --ytdl-format=best. Currently, these are only set with the other ytdl formats with video and audio in different streams. The uploader tag is commonly available in sites other than Youtube too, so it may be simpler to always use EDL with single tracks.
* defaults.lua: add a disabled parameter to timer constructorsMike Will2023-10-111-4/+6
| | | | | | | | Added to the functions `mp.add_timeout` and `mp.add_periodic_timer`. If the `disabled` argument is set to `true` or a truthy value, the timer will wait to be manually started with a call to its `resume()` method.
* libmpv: add mpv_time_ns()Dudemanguy2023-10-101-0/+5
| | | | | | 9606c3fca9d568dc43711017dcb35a408c0d2883 added mp_time_ns(). Since we apparently expose the mp_time_us() to clients already, there's no reason to not also expose the new nanosecond one.
* vo: use nanoseconds for frame duration and ptsDudemanguy2023-10-101-2/+2
|
* player: store last_time timestamp in nanosecondsDudemanguy2023-10-102-3/+3
|
* vo: remove vo_get_estimated_vsync_interval conversion to secondsDudemanguy2023-10-101-1/+1
| | | | | This is weird. The caller should be responsible for converting the value if desired. Move the conversion to player/command.c instead.
* console.lua: exit with with Ctrl+[Guido Cella2023-10-101-0/+1
| | | | | This binding commonly closes similar input buffers like vim's Command-line mode and dmenu.
* command: add playlist-next-playlist and playlist-prev-playlistGuido Cella2023-10-091-0/+43
| | | | | | | | | | | | playlist-prev-playlist goes to the beginning of the previous playlist because this seems more useful and symmetrical to playlist-next-playlist. It does not go to the beginning when the current playlist-path starts with the previous playlist-path, e.g. with mpv --loop-playlist foo/, which expands to foo/{1..9}.zip, the current playlist path foo/1.zip beings with the playlist-path foo/ of {2..9}.zip and thus playlist-prev-playlist goes to 9.zip rather than to 2.zip. Closes #12495.
* core: remove duplicate init_{audio,video}_decoder declarationsDudemanguy2023-10-081-2/+0
|
* core: remove declarations of unused functionslcksk2023-10-081-4/+0
|
* console: support utf8 for table formattingChristoph Heinrich2023-10-071-3/+18
|
* console: cull lines outside of visible areaChristoph Heinrich2023-10-071-18/+25
| | | | | | Lines that would be outside of the visible area are now culled. The log messages were already culled, however with the introduction of suggestions, they also needed a small update.
* console: show completion suggestions as tableChristoph Heinrich2023-10-071-8/+77
| | | | | | | | | | | | Completion suggestions are now nicely formatted into a table. Maximum width of the table is estimated based on OSD size and font size. This requires a new scaling factor option `font_hw_ratio`. A factor of 2.15 works great for me, but the default is 2.0 to avoid problems with other fonts. The space between columns is automatically adjusted to be between 2 and 8 spaces. It tries to use as few rows as possible.
* console: show suggestions for completionChristoph Heinrich2023-10-071-17/+34
| | | | | | | Tab completion now shows a list of all potential completions between the log messages and prompt. The text is colored to differentiate it from regular text. The color matches the theme and is similar to the mpv logo.
* console: refactor text styles for log levelsChristoph Heinrich2023-10-071-9/+22
| | | | | | | The text styles are now in a table. The color definitions of the theme where the colors were taken from are now included in a comment for future reference. The colors have been converted to BGR as is required by ASS.
* player/video: mention --profile=fast and --hwdec in AV desync messageKacper Michajłow2023-10-071-0/+1
|
* Revert "video: remove another redundant wakeup"Kacper Michajłow2023-10-071-3/+1
| | | | | | | | | | | | | | | vo_still_displaying() is racey with vo_request_wakeup_on_done() and above that it doesn't work as expected. VO can run out of work and go to sleep for 1000s, while the play thread still returns on vo_still_displaying() check, because of a check `now < frame_end` so it never advances and go to sleep itself. This fixes dead lock that we have when image parameters changes during playback. This reverts commit 0c9ac5835be70ae26e4aa875e833fe2c7b3b3bf3. Fixes: #12575
* vo_gpu_next: improve updating overlaysDudemanguy2023-10-051-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | fbe154831a8addfc18a4f81e1c4b9284c31acace added a new VOCTRL to signal when the OSD changed for gpu-next's handling of subtitles, but this is both not necessary and actually incomplete. The VOCTRL would signal OSD changes, but not all subtitle changes (like selecting another non-external sub track for example). VOCTRL_OSD_CHANGED was used to increment p->osd_sync which would then redraw the blended subtitles if the player was paused. But there's already a VOCTRL_PAUSE and VOCTRL_RESUME. Plus, the sub_bitmap_list object will have items in it if it changed in any way, so we don't need the VOCTRL_OSD_CHANGED method at all. That can be removed. The check that fp->osd_sync < p->osd_sync stays in place since that's an optimization while the video is playing, but we also check the pause state as well since the VO can know this. If we're paused, then always do update_overlays since core must be signalling a redraw to us if we get a draw_frame call here. Additionally in update_overlays itself, the p->osd_sync counter is incremented if we have any items since the frame signature will need that. As for the actual bug that is fixed, changing subtitle tracks while paused with blended subtitles now correctly works. Previously, it was never updated so the old subtitle stayed there forever until you deselected it (since VOCTRL_OSD_CHANGED triggered there). Also include some cosmetic code fixes that were noticed.
* player: remove unused mutate argument in mp_next_fileDudemanguy2023-10-053-7/+6
| | | | | | e277fadd60350caad1fc31e92a5076692e61dcc9 originally added this but it never actually did anything in the function... wm4 probably changed his mind but forget to delete it so just remove it here.
* loadfile: fix an old wonky playlist heuristicDudemanguy2023-10-051-12/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2c6a3cb1f27e02b2e66390a2465ab648905a64d0 originally added this struct member and then 1be863afdbe9017aa227234e8525b209fb818224 later added some more logic to loadfile that uses this. There's been more changes since then of course, but bits using playback_short and playback_start have mostly stayed the same. It's a bit strange it's worked this way for so long since it makes an assumption on how long files should be and leads to weird, broken behavior on playlists with shorter videos. The main reason for playlist_short, as far as I can tell, is to deal with some fringe cases with short videos and trying to go back in the playlist. More specifically, if you use --loop=inf on a very short video (say less than 1 second) and try to go back in the playlist, you won't be able to without any of this special logic that deals with it. But the current approach has several side effects like going back multiple items in the playlist instead of just one if the video is less than one second. This is just bad so delete everything related to playlist_short and playlist_start. Instead, let's handle this by keeping track of playlist-prev attempts. Going forward in the playlist doesn't require any special handling since a bad/broken file will just advance to the next one. So it's only going backwards that requires some special consideration. If we're going backwards and the user isn't using force, then mark the playlist entry with a special flag. If the file loads successfully in play_current_file, we can just clear the flag and not worry about it. However if there's a failure, then we set a bool telling play_current_file that it should go back one more item in the playlist if possible and try again. This way, we avoid the previously mentioned --loop=inf edgecase and the user can still attempt to retry previously failed items in the playlist (like a url or such). Fixes #6576, fixes #12548.
* af/vf-command: add ability to target a specific lavfi filterAshyni2023-10-051-6/+17
| | | | fixes: #11180
* external_files: remove duplicate from cover art whitelistGuido Cella2023-10-041-1/+0
| | | | | I made a mistake in 0070a5820e here because there were 2 separate groups of "front" filenames.
* external_files: base cover-art-whitelist on cover-art-auto-extsGuido Cella2023-10-011-41/+10
| | | | | | | | | | Combine the cover art whitelist with the extensions in --cover-art-auto-exts instead of hardcoding them. This is shorter, checks for more extensions, saves us from updating the whitelist everytime we add a new image extension, and since the whitelist had gotten so big and the priority is calculated as MP_ARRAY_SIZE(cover_files) - n, files like cover.jpg were taking priority over cover art loaded by --cover-art-auto=exact.
* 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
| | | | | | | | | | | | | | | |