summaryrefslogtreecommitdiffstats
path: root/player
Commit message (Collapse)AuthorAgeFilesLines
* 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
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
|