summaryrefslogtreecommitdiffstats
path: root/player
Commit message (Collapse)AuthorAgeFilesLines
* csputils: replace mp_chroma_location with pl_chroma_locationKacper Michajłow2024-01-221-1/+1
|
* csputils: replace mp_alpha_type with pl_alpha_modeKacper Michajłow2024-01-221-6/+6
|
* csputils: replace mp_colorspace with pl_color_spaceKacper Michajłow2024-01-221-5/+5
|
* command: do a normal seek instead of a refresh seek when switching vojmir12024-01-221-1/+1
|
* osc: add osc-windowcontrols_title optionDudemanguy2024-01-221-1/+2
| | | | | This allows the title shown with the windowcontrols to be controlled separately from the normal osc title. Fixes #13295.
* Revert "player/video: loosen logic checks for adjust_sync"llyyr2024-01-211-2/+2
| | | | | | | | | This reverts commit cb2b579f61764452652c6cf5c6a94ae5e67c77ed. This breaks files where the audio starts much later after the video since mpv reads the first audio packet even if it isn't supposed to start yet, resulting in the audio_status being STATUS_READY for the entire time mpv is "waiting" for the first audio packet to be played.
* player: remove --term-remaining-playtime optionDudemanguy2024-01-201-2/+1
| | | | | This wasn't useful and didn't even really do what it said anyway. Closes #12167.
* command: restore lang after track reloadGuido Cella2024-01-203-0/+13
| | | | | | | | | | If a track's language was guessed from its filename, the commands that reload the track, like sub-reload, remove it. Fix this by calling guess_lang_from_filename() again. Note that backing up t->lang and restoring it if nt->lang is NULL would work incorrectly when lang is in the stream and it is removed before reloading.
* command: minor m_property_strdup_ro style changesnanahi2024-01-201-6/+5
|
* stats.lua: display the current GPU contextnanahi2024-01-201-0/+2
| | | | | | This displays the current GPU context when --vo=gpu or --vo=gpu-next is used, which shows the platform and backend information of the vo which are previously not available.
* command: export current-gpu-context propertynanahi2024-01-201-0/+8
| | | | | | | This exports `current-gpu-context` property, which is the string description of the current active GPU context. This allows scripts to uniquely identify the platform and backend used for --vo=gpu and --vo=gpu-next.
* player/command: reselect track after UPDATE_SUB_HARDDudemanguy2024-01-201-0/+2
| | | | | | The lingering cache needs to be cleared so the packets don't stay forever on the screen past their welcome. Do this by simply refreshing the stream. Fixes #13148.
* console.lua: highlight the selected suggestion in the terminalGuido Cella2024-01-201-3/+10
|
* scripting: don't observe properties with type nilGuido Cella2024-01-202-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | mp.observe_property('foo', nil, ...) calls the handler at least 2 times on each playlist change even when the property doesn't change. This is dangerous because if you haven't read observe_property's documentation in a long time this is easy to forget, and you can end up using it for handlers that are computationally expensive or that cause unintended side effects. Therefore, this commit discourages its use more explicitly in the documentation, and replaces its usages in scripts. For console.lua, observing focused with type nil leads to calling mp.osd_message('') when changing file while playing in the terminal with the console disabled. I don't notice issues from this, but it's safer to avoid it. For playlist and track-list this doesn't really matter since they trigger multiple changes on each new file anyway, but changing it can avoid encouraging people to imitate the code. One usage of none in stats.lua is kept because according to b9084dfd47 it is a hack to replicate the deprecated tick event.
* osc: don't autohide mouse cursor when hovering over windowcontrols titlenanahi2024-01-201-0/+14
| | | | | | | | | | | When the mouse cursor is hovering over the (CSD) windowcontrols title, the osc keeps displaying, but the cursor autohide isn't disabled like other visible regions. Fix this by disabling the cursor autohide in this region. All other existing behaviors of the mouse cursor in this region are unchanged, including triggering main window area input and allowing VO dragging.
* command: add osd display for volume-gainnanahi2024-01-201-0/+3
|
* audio: add --volume-gain options to control volume in decibelsnanahi2024-01-202-2/+26
| | | | | | This adds volume-gain, volume-gain-max, volume-gain-min options, which can be used to control audio volume and target dynamic range in decibels. The gain is applied on top of the existing volume setting.
* command: fix bitrate unit capitalizationnanahi2024-01-181-1/+1
| | | | This is 1 billion times smaller than it should be in SI units.
* stats.lua: make capitalization consistent across pagesllyyr2024-01-171-11/+11
|
* console.lua: style log lines in the terminalGuido Cella2024-01-143-29/+40
| | | | | | | | | | When running the console in the terminal, style log lines with the same escape sequences as msg.c. mp.input can also specify terminal escape sequences, e.g. a script to select a playlist entry can invert the color of the selection. Also add a missing newline to help's error message.
* player: add forced choice to subs-with-matching-audioDudemanguy2024-01-131-2/+5
| | | | | | | | | | fe875083b3d30b06ef77745f40570e8f63afec2 confused things a bit and made --no-subs-with-matching-audio actually mean what it says: no subtitles if the languages match. However, the option actually meant no non-forced subtitles not no subtitles at all. This isn't really intuitive so instead of changing the behavior back to the old way (we already have a release since then), add a third option "forced" which is equivalent to the old meaning of --no-subs-with-matching audio. Fixes #13151.
* scripting: add mp.inputGuido Cella2024-01-135-36/+278
| | | | This lets scripts get textual input from the user using console.lua.
* console.lua: expand ~/ in file completionGuido Cella2024-01-041-0/+10
| | | | | | | Makes Tab expand loadfile ~/ to loadfile /home/$USER/. I used expand-path instead of os.getenv('HOME') to make it work on Windows.
* player/video: set video_out to NULL before broadcasting eventsKacper Michajłow2024-01-041-1/+1
| | | | This avoids possible reference of video_out after destory.
* command: allow changing --gpu-api and --gpu-context at runtimeGuido Cella2024-01-011-1/+4
|
* console.lua: hide the cursor when unfocusedGuido Cella2024-01-011-1/+3
| | | | | | | | | | | This is commonly done to understand whether a window is focused. This explicitly checks if focused is false instead of unavailable to not break the cursor where focused is unimplemented like on --vo=drm. The cursor is taller than the input text so it is made transparent instead of completely removing it so that the log doesn't move up and down while toggling focus. Alternatively, cheight = opts.font_size * 8 can be changed to 7.
* console.lua: don't reinsert completion_append after cyclingGuido Cella2024-01-011-8/+10
| | | | | | | 43ed0a83d0 avoided reinserting the string that is appended after certain completions when it is already after the cursor when inserting the longest common prefix of the suggestions. Do the same when cycling through them.
* screenshot: remove artificial limit on the number of screenshots takennanahi2023-12-281-1/+1
| | | | | | This allows taking more than 99999 screenshots in a single session, and also for the case when a sequence of 99999 screenshots already exists on the filesystem.
* msg: keep status line on the end of fileKacper Michajłow2023-12-271-1/+4
| | | | | | Apparently found useful by some users. Fixes: #13092
* console.lua: refactor find_common_prefixGuido Cella2023-12-261-16/+7
| | | | | | | | | | | Reuse common_prefix_length() to make find_common_prefix() shorter and faster by not creating many temporary strings. The decrease in the average time to run find_common_prefix() over 1000 calls I measured is: set \<Tab>: 1e-4s -> 1e-5s set s\Tab>: 1e-5s -> 5e-6s
* osc: allow disabling special mouse wheel behaviorDudemanguy2023-12-211-16/+28
| | | | | | | | When hovering certain elements over the OSC, using the mouse wheel can result in special commands (such as seeking, changing audio tracks, etc.) Not everyone neccessarily wants this feature, so add an option to make it possible to disable all of it. Maybe more fine-tuned control would be more ideal, but probably not worth it. Fixes #13096.
* options: add --secondary-sub-ass-overridedyphire2023-12-181-0/+1
| | | | Default: strip. preserve the old behavior
* lua: don't return a second value from successful format_jsonGuido Cella2023-12-171-4/+4
| | | | | | | | | | | | | Even for successful calls, utils.format_json returns nil as the second return value. This doesn't have any purpose and is not documented, and it is inconvenient for passing JSON to script-message, because mp.commandv('script-message', 'foo', utils.format_json(...)) errors because mp.commandv receives nil as the fourth argument. This commit makes format_json return only one value in case of success to fix this.
* command: support passing scale to `keypress`sfan52023-12-171-2/+4
|
* input: add value argument for mp_input_put_key_artificialsfan52023-12-171-5/+5
|
* OSC: fix indentation and stray whitepaceHRXN2023-12-171-2/+2
|
* player: refactor secondary subtitle options and propertiesDudemanguy2023-12-163-39/+20
| | | | | | | | | | | | Over the years, we've accumulated several secondary subtitle related options and properties, but the implementation was not really consistent and it wasn't clear what the right process for adding more should be. So to make things nicer, let's refactor all of the subtitle options with secondary variants (sub-delay, sub-pos, and sub-visibility) and split them off to a new, separate struct. All of the underlying values are stored in an array instead for simplicity. Additionally, the implementation of some secondary-sub-* properties were slightly changed so there would be less redundancy.
* console.lua: clear the suggestions when you move the cursorGuido Cella2023-12-151-0/+12
| | | | | | | | | | | Clear completion suggestions from functions that move the cursor, so that you can't insert suggestions at the wrong spot by pressing Tab again after moving the cursor, Also clear suggestions from some editing functions that were never updated. It is not actually necessary to clear suggestions from functions that remove text in front of the cursor, but since handle_del() already clears them, let's just clear them everywhere.
* console.lua: complete current-tracks sub-propertiesGuido Cella2023-12-151-6/+8
| | | | | | Also inline option-info's sub-properties so we don't have to define sub-properties at the top of the function for every one we decide to complete.
* console.lua: implement case-insensitive completionGuido Cella2023-12-151-16/+58
| | | | | | This is useful for completing files and more rarely for profiles. It will also be useful to third-party scripts interacting with the console once the API to do it is merged.
* options: add --secondary-sub-poskarelrooted2023-12-132-1/+14
| | | | The default value is 0 (on the top of the screen)
* Revert "OSC: Remove merriment"Niklas Haas2023-12-131-0/+21
| | | | | This reverts commit af2635d8c9389504cb0b07a78f3999096d80a1ab, and restores feature parity with VLC.
* OSC: Remove merrimentMia Herkt2023-12-131-21/+0
| | | | | | | | | | | | | I honestly don’t care either way but I also don’t believe this innocent and cute hat is worth repeatedly having people show up on the issue tracker to aggressively virtue signal and then shit-talk the project elsewhere when their “concerns” are ignored and made fun of. For the record, I approve of neither brand of childish nonsense. If your workflow depends on December festivities, feel free to use an alternative OSC implementation. Fixes #13082 and #9548
* sub: don't busy loop if the player is paused for cacheDudemanguy2023-12-121-1/+2
| | | | | | | | | When updating subtitles while paused, mpv waits until a packet is available. However in the case of a network stream, it is possible that mpv will pause itself when buffering for cache reasons. This makes that particular loop do a busy loop and can take a long time depending on network streams. Simply just don't do the loop here if we are paused for cache reasons. Fixes #13077.
* player/command: make new overlay-add arguments actually optionalsfan52023-12-081-2/+2
| | | | fixes: 4754bd54c7ab22c6c98283d81e22d219b3b64ade
* player/command: add ability to scale overlayGraham Booker2023-12-081-3/+13
|
* console.lua: cycle through completionsGuido Cella2023-12-061-18/+55
|
* console: automatically determine the font_hw_ratioChristoph Heinrich2023-12-061-2/+77
| | | | | | | | | | | A simplified version of the text width estimation code from uosc. An osd_overlay is created with compute_bounds=true for measuring the width of the lower case alphabet at what's estimated to be the largest font size possible without clipping. The lower case alphabet was chosen to get decent results for proportional fonts, even if they aren't officially supported.
* console.lua: simplify the condition to print to the terminalGuido Cella2023-12-061-8/+3
| | | | | This was a simpler fix to not print the console log to the OSD while switching VO.
* playloop: use a 16:9 ratio with --force-windowGuido Cella2023-11-301-1/+5
| | | | | | | | | ca2b05c0fb changed the window size with --force-window and no video tracks to be closer to 16:9, but I don't see why we shouldn't have an actual 16:9 ratio. The advantage is that subtitles with fullscreen and no video tracks will have the same size and position (depending on the values of --sub-scale-with-window and --sub-use-margins) as with 16:9 videos, because there will be no (invisible) black bars.
* player/command: don't pass mp_image_params by valueKacper Michajłow2023-11-281-36/+36
|
* meson: generate .com in the same place as the .exe if possibleDudemanguy2023-11-271-3/+4
| | | | | | | | | Meson was pretty strict about target ids and generating the mpv.com in the same directory as mpv.exe wasn't possible. So as a workaround we tucked it away in a subdirectory, but that's not really intuitive at all. Well as of meson 1.3.0, this is now possible so leverage it since it makes way more sense. We still keep the old workaround for anyone using older meson versions.
* options: add secondary-sub-delayRipose2023-11-262-6/+18
| | | | | | | | | | | | | Add --secondary-sub-delay option and decouple --sub-delay from secondary subtitles. This produces desirable behavior in most cases as secondary and primary subtitles tracks tend to be timed independently of one another. This feature is implemented by turning the sub_delay field in mp_subtitle_opts into an array of 2 floats. From here the track index is either passed around or derived when sub_delay is needed. There are some cases in dec_sub.c where it is possible for dec_sub.order (equivalent to track index) to be -1. In these cases, sub_delay is inferred as 0.
* player: remove shared-script-properties propertyDudemanguy2023-11-223-74/+0
| | | | | | | | | | | | This property was never encouraged. The manual even stated that "You should avoid using it, unless you absolutely have to." Since we now have user-data which is superior in every single way and replaces this, delete this property. The manual also has threatened people for years with the line "It's a makeshift solution which could go away any time (for example, when a better solution becomes available)." We were nice and deprecated it in 1d00aee8e191c9689a20e67e3d6dfd2af6ad2588 for a while to give script authors some time to update. Let's remove it for good now.
* command: add missing null check to event handlersfan52023-11-201-1/+1
| | | | | | | Unclear if there are other situations but at least using --force-media-title this can be called without a playing file, causing a segfault. fixes: 34a04d05676
* various: add some missing error checksKacper Michajłow2023-11-181-1/+1
|
* vo: pass approximate frame duration in vo_frameKacper Michajłow2023-11-181-0/+1
| | | | | | This information is already there, but speed adjusted. To avoid duplicating the calculation of frame duration, it's kept in the vo_frame structure.
* player/video: account for repeats in ideal_frame_vsync_durationKacper Michajłow2023-11-181-0/+4
| | | | | Frame repeats may occur to compensate for A/V diff. This commit ensures a uniform distribution of vsync points based on the number of repeats.
* loadfile: remove some dead codeDudemanguy2023-11-181-4/+1
| | | | | | 034f75dacd01bd0b7c6c03e39b193f891f0d5ef2 removed the loop that could cause !next to actually happen here. This code would never be executed and is not needed.
* command: notify media-title on force-media-title changeChristoph Heinrich2023-11-151-0/+2
| | | | Fixes #12887
* player: don't remove all selected sub tracks in mp_dselect_trackkarelrooted2023-11-141-0/+2
| | | | fix secondary sub disappear after sub-reload, sub-remove.
* stats.lua: fix incorrect storage aspect ratio valuenanahi2023-11-141-1/+7
| | | | | | | | | | | The "Resolution" property shows the storage resolution for videos with non-square pixels. Currently, display aspect ratio is shown for both "Resolution" and "Output Resolution" properties which results in a duplicate, and is incorrect for the "Resolution" property. The correct aspect ratio is now shown using the sar and sar-name properties.
* command: export storage aspect ratio (sar) propertiesnanahi2023-11-141-0/+3
| | | | | | | | | Display aspect ratio (aspect) and pixel aspect ratio (par) are already exported, but storage aspect ratio (sar) isn't. This value is needed to display the storage aspect ratio for non-square pixel sources in stats.lua. This exports two new properties: video-params/sar and video-params/sar-name. Docmentation is updated accordingly.
* player/video: fix calculation of ideal_frame_vsync_durationKacper Michajłow2023-11-121-1/+1
| | | | | | | | | | | | | | During move of this code from vo_gpu_next.c to video.c someone(TM) tried to be smart and simplify the expression. The num_vsync includes error compensation which can cause it to display +-1 vsync at the same rate. We explicitly don't want to include this in "ideal" parameters. Also num_vsyncs was already rounded so we produced off timings in general. Revert back to proper way of translating the time. Fixes: 5e5a325
* vo: add frame vsync and vsync durationKacper Michajłow2023-11-111-2/+4
| | | | | | | | Relative to frame PTS timeline as oposed to display vblank. Those values are relative to unadjusted video timeline. They will be used by gpu-next where it expect virtual frame vsync, not display vblank time.
* console: fix crash for long suggestion stringsChristoph Heinrich2023-11-111-1/+2
| | | | | | | | | String formatting of Lua crashes with widths greater then 99, so limit the value to that. A nicer solution would be to create our own string padding function that can handle bigger widths, but such long suggestions aren't common enough to be worth the effort.
* player/command: make show-progress work regardless of osd prefixDudemanguy2023-11-091-0/+4
| | | | | | Having the show-progress command obey no-osd is nonsensical and unintuitive. The show-text command already ignores no-osd, so there's precedence for this. Fixes #5662.
* player/loadfile: remove blank line on exitKacper Michajłow2023-11-081-1/+0
|
* Revert "player: cut off status line on terminal width"Kacper Michajłow