summaryrefslogtreecommitdiffstats
path: root/player/command.c
Commit message (Collapse)AuthorAgeFilesLines
* video/out/gpu/context: convert --gpu-context to use obj_settings_listnanahi6 days1-1/+1
| | | | | | | | | | | | | | | | Since the list of available GPU contexts is a compile time constant, use obj_settings_list instead of opt_string_validate for GPU contexts. This has several advantages: - Aligns with the existing usage of vo, ao, and filter lists. - Allows custom probing order. - Allows list option suffixes. (--gpu-context-append, etc.) - Allows autocomplete in console.lua. - Uses the standard obj_settings_list help printing, so the custom help printing function is no longer needed. This also deduplicates some context creation code for ra_ctx_create and ra_ctx_create_by_name.
* command: use property_time() for sub-start and sub-endrcombs6 days1-2/+2
| | | | This gives these properties the "time" type, which allows them to be pretty-printed as HH:MM:SS easily (but also still allows raw formatting using e.g. ${=sub-start}).
* player/command: add track-list/N/decoderKacper Michajłow7 days1-6/+4
|
* player/command: remove codec-info and use track-list directlyKacper Michajłow8 days1-41/+7
| | | | | | | | Turns out that adding more medatata like HDR10+ and Dolby Vision would produce a lot of duplication and it is better to centralize it around the track-list property. Fixes: e720159f72be2a816db849acb286f36a1ac4622b
* player/command: add video-codec-info and audio-codec-infoKacper Michajłow9 days1-41/+35
| | | | | | | | | | | Adds support for extracting codec profile. Old properties are redirected to new one and removed from docs. Likely will stay like that forever as there is no reason to remove them. As a effect of unification of properties between audio and video, video-codec will now print codec (format) descriptive name, not decoder long name as it were before. In practice this change fixes what docs says. If you really need decoder name, use the `track-list/N/decoder-desc`.
* command: don't use OSD_ASS_0 when converting lists to stringsnanahi14 days1-4/+7
| | | | | | | | | | | | | | | | When converting a list to string for show-text, since 05c398fb6c3a48c6a72b6b0706ea0156c46b146d the OSD_ASS_0 escape hatch is used. This usage is problematic because the same format string is used for print-text, which results in these ASS escape sequences being printed in the terminal. Also since d6610a5b2f34e398e2ceba2a4da2b79e556b1c9e, the print-text output to console.lua is no longer escaped if OSD_ASS_0 is present. This results in abnormally formated text in the console output. Fix this by not using ASS escape sequences for this. Instead, use the circle symbols used by the OSC, which also results in the same width for active and inactive items.
* vo: add win32 context menu supportShuanglei Tao2024-04-061-0/+51
|
* player/command: optimize duplicated property search in command_initKacper Michajłow2024-03-251-1/+12
| | | | | | | Would be better to search the other way around, because options list is bigger than property list, but with minimal changes this is good enough. Both are relatively small tho and the only reason for this micro optimization is to increase the fuzzing throughput.
* player/command: fix udata talloc parentShuanglei Tao2024-03-231-2/+2
|
* options: add --input-commands optionDudemanguy2024-03-211-0/+28
| | | | | | | Basically a simple way to perform any command/property action from the command line. This takes the exact same syntax as input.conf but not including the key naturally. Potentially useful for weird properties that don't map well to options (like ao-volume). Fixes #12353.
* m_property: add `>` for fixed precision floating-point expansionKacper Michajłow2024-03-211-13/+11
| | | | | | | | | | | | | | This enhancement makes it easier to create constant width property expansions, useful for the `--term-status-msg`. Additionally, it changes to `%f` printing with manual zero trimming, which is easier to control than `%g`. With this method, we can directly specify precision, not just significant numbers. This approach also avoids overly high precision for values less than 1, which is not necessary for a generic floating-point print function. A new print helper function is added, which can be used with adjusted precision for specific cases where a different default is needed. This also unifies the code slightly.
* command: add escape-assGuido Cella2024-03-211-0/+15
| | | | | | | | | | | | | | | | | This adds a command to escape ASS tags to remove code duplication between sub/osd_libass.c, console.lua, osc.lua, stats.lua and any user script that calls mp.create_osd_overlay(). A command is used instead of scripting functions so that all clients can use this and not just use Lua and JS ones. osd_mangle_ass() also interprets osd-sym-cc and osd-ass-cc/{0,1}, but since they use invalid UTF-8 characters there is no risk of escape-ass users using them by accident, like with any OSD message. Always replacing \n with \\N in mangle_ass() even when it is not called by escape-ass doesn't seem to cause any issue, but I made it conditional anyway to avoid changing how all OSD messages are treated unnecessarily.
* player/command: add term-size/[w,h] propertyChristoph Heinrich2024-03-211-0/+19
| | | | | | There was no way for scripts to know the current size of the terminal, which is essintial if they want to provide a good user experience even without a window.
* demux: add a format-name propertyDudemanguy2024-03-171-0/+1
| | | | | It can be useful to know the underlying format of any entry in the track list. Only applicable to the lavf demuxer.
* vo: add video-target-params propertyKacper Michajłow2024-03-071-1/+18
|
* player/command: fix video-params/[average-bpp, alpha] when hw decodingKacper Michajłow2024-03-071-2/+3
| | | | Need to check hw_subfmt for real values.
* mp_image: add imgfmt_name to mp_image_paramsKacper Michajłow2024-03-071-10/+14
| | | | | | | | Convenience to override name if imgfmt is not set. Allows to create mp_image_params without setting imgfmt. Will be useful for the next change where mp_imgfmt is not available. This is workaround that will be remved once all codebase switches to pl_fmt.
* Revert "player: reset av state on speed changes"Dudemanguy2024-03-031-1/+0
| | | | | | | | | Ended up being too flawed and caused trouble in other areas. There's other approaches to trying to solve the issue this meant to address in the works that should be better, so let's wait on that. Fixes #13613 and fixes #13622. This reverts commit e3af545421322e357eb9355395923710ea93f83b.
* command: add begin-vo-dragging commandnanahi2024-03-011-0/+12
| | | | | | This command initializes a vo dragging request for VOs that implement the new VOCTRL_BEGIN_DRAGGING voctrl. This allows scripts to begin vo dragging for any button press event.
* Revert "player: add ao-volume option, to set the system volume at startup"Dudemanguy2024-03-011-6/+9
| | | | | | | | Ended up being a bad idea. As a property, this inherently has more functionality and the tradeoff of being able to do --ao-volume wasn't worth it. This reverts commit 58ed620c064971535e60778612777750aa5e2f4d.
* player: reset av state on speed changesDudemanguy2024-02-261-0/+1
| | | | | | | | | | | | | | | Playback speed changes should be treated as a discontinuity just like seeking. Previously, this was being treated internally as just plain normal playback, but that can't really work. The frame timings from before the speed change and after the speed change are completely different and shouldn't be compared to each other. This lead to frames being adjusted to weird places and possibly even being skipped (as if mpv was seeking) on speed changes. What we should do is clear out and reset all av related fields like what happens when you seek, but it is not quite as aggressive. No need to do a full video state reset or such. We also wait an arbitrary amount of frames before adjusting for av sync again. compute_audio_drift already used a magic number of 10 which sounds reasonable enough so define that and use it here. Fixes #13513.
* input/player: add loadfile/loadlist insert-at commandDavid Vaughan2024-02-261-22/+78
|
* player: change insert_next to insert_atDavid Vaughan2024-02-261-5/+4
| | | | | | | | | | Change the `playlist_insert_next` function to `playlist_insert_at` (ie, insert at the location of an entry, rather than after it, and rename to be clearer that it doesn't have anything to do with the currently-playing entry). Also, replace calls to `playlist_add` with calls to `playlist_insert_at`, since the former has become redundant.
* player: add loadlist insert-next commandsDavid Vaughan2024-02-261-5/+15
| | | | | | | | Analogous changes to the previous commit ("add loadfile insert-next commands"), but for the `loadlist` command. This allows us to insert a new playlist next in the current playlist, rather than just appending it to the end.
* player: add loadfile insert-next commandsDavid Vaughan2024-02-261-5/+16
| | | | | | | | | | | | | This commit adds two new commands (`insert-next` and `insert-next-play`) which mirror the existing commands, `append` and `append-play` in functionality, with the difference that they insert directly after the current playlist entry, rather than at the end of the playlist. This change gives MPV a piece of functionality already found in (for example) Spotify's media player: "play next". Additionally, using the new `insert-next` command, users can trivially write a script to play a new piece of media immediately without otherwise clearing or altering the remainder of the playlist.
* player: add ao-volume option, to set the system volume at startupLeonardo Boss2024-02-251-9/+6
| | | | closes #12353
* player/command: handle runtime toggling of hidpi-window-scaleDudemanguy2024-02-241-0/+23
| | | | | | | Wayland was the only backend that attempted this, but it can be done in a centralized place for anything that supports this. hidpi-window-scale is just the same as a normal window scale but with the OS DPI as the factor.
* command: fix sub-seek while paused without a videoGuido Cella2024-02-231-0/+8
| | | | | | | When using sub-seek without a video track while paused, adding the 0.01 SUB_SEEK_OFFSET to the new timestamp is not enough to show the new subtitle line. Add 0.1 instead to fix it. 0.01 is already enough for sub-step.
* command: don't add SUB_SEEK_OFFSET twice with sub-seekGuido Cella2024-02-231-4/+0
| | | | | The name SD_CTRL_SUB_STEP is misleading, but it is also used for sub-seek, and sub/sd_ass.c already adds SUB_SEEK_OFFSET with it.
* vo: remove VOCTRL_SET_EQUALIZER and simplify into UPDATE_VIDEODudemanguy2024-02-171-1/+1
| | | | | | | | | | | | | | | Since 03cf150ff3516789d581214177f291d46310aaf4, the only purpose of this VOCTRL was to signal a redraw to the vo. It actualy could have been removed in 531868fe0d2a35fbbff78d9a9ff8f96df73e69fd, but this was missed. The UPDATE_VIDEO flag is better anyway because it allows us to handle a wide variety of options scattered around that require the VO to update itself and redraw. We can remove both of the custom callbacks in vo.c and only leave the VOCTRL_VO_OPTS_CHANGED one. Additionally, that commit also introduced vo_set_want_redraw, but this is redundant and not needed. The VOs that use VOCTRL_UPDATE_RENDER_OPTS already set vo->want_redraw, and those are the only VOs where these options are relevant in the first place. So we can remove this as well and just let the big callback in player/command do everything.
* command: add window-id to MPV_EVENT_VIDEO_RECONFIG property changeDudemanguy2024-02-171-2/+2
| | | | | | | | | 25b66256d7ff48254b2055a066e29f260414112f originally added this property, but it did not add it to the property notification. This is possibly because the window id doesn't appear to change on x11 even when toggling VOs at runtime. However, windows uses this property and apparently the id changes there so we should signal updates when appropriate. Fixes #13495.
* player/command: add deinterlace-active propertyDudemanguy2024-02-071-1/+15
|
* player: ensure runtime updates of certain rendering optionsDudemanguy2024-02-051-0/+7
| | | | | | | | | | When adding things like brightness or gamma, the video obviously needs a redraw if paused. This happened to work in the normal case because the OSD notification triggered a redraw, but if you use no-osd the picture won't change. Fix this by adding another option flag, UPDATE_VIDEO, and simply signalling we want a redraw. This gets handled along with the normal osd redrawing check in the playloop so something like "no-osd add gamma 1" actually works.
* command: add load-input-confGuido Cella2024-02-041-0/+11
| | | | | | | | | | | | | | | | This can be used to auto reload the input configuration file, e.g. in vim: autocmd BufWritePost ~/.config/mpv/input.conf silent !echo load-input-conf %:p | socat - /tmp/mpvsocket Partially fixes #6362. Additionally this can be used as a replacement for deprecated input sections if they are ever actually removed. For example, if you want to define different bindings for images, you can load-input-conf an input.conf for images, and load the original again when switching to a video. Though currently you would have to redefine builtin bindings that were overwritten with image ones in the default input.conf.
* command: add load-config-fileGuido Cella2024-02-041-0/+20
| | | | | | | | Unlike set include mpv.conf, this works after playback has started. It can be used to auto reload the configuration, e.g. in vim: autocmd BufWritePost ~/.config/mpv/mpv.conf silent !echo load-config-file %:p | socat - /tmp/mpvsocket Partially fixes #6362.
* player/command: don't reselect demux stream on only UPDATE_OSDDudemanguy2024-01-221-3/+4
| | | | | 700f72f8e424486633b1c8da9313182e63072592 should have put this inside the flag check.
* 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
|
* command: restore lang after track reloadGuido Cella2024-01-201-0/+4
| | | | | | | | | | 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
|
* 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.
* command: add osd display for volume-gainnanahi2024-01-201-0/+3
|
* audio: add --volume-gain options to control volume in decibelsnanahi2024-01-201-2/+25
| | | | | | 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.
* command: allow changing --gpu-api and --gpu-context at runtimeGuido Cella2024-01-011-1/+4
|
* msg: keep status line on the end of fileKacper Michajłow2023-12-271-1/+4
| | | | | | Apparently found useful by some users. Fixes: #13092
* options: add --secondary-sub-ass-overridedyphire2023-12-181-0/+1
| | | | Default: strip. preserve the old behavior
* 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
|
* player: refactor secondary subtitle options and propertiesDudemanguy2023-12-161-37/+18
| | | | | | | | | | | | 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.
* options: add --secondary-sub-poskarelrooted2023-12-131-0/+14
| | | | The default value is 0 (on the top of the screen)
* 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
|
* player/command: don't pass mp_image_params by valueKacper Michajłow2023-11-281-36/+36
|
* options: add secondary-sub-delayRipose2023-11-261-5/+12
| | | | | | | | | | | | | 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-221-28/+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
* command: notify media-title on force-media-title changeChristoph Heinrich2023-11-151-0/+2
| | | | Fixes #12887
* 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/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.
* vo: replace VOCTRL_HDR_METADATA with direct VO params readKacper Michajłow2023-11-081-7/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | Currently VOCTRL are completely unusable for frequent data query. Since the HDR parameter addition to video-params, the parameters can change each frame. In which case observe on those parameter would be triggered constantly. The problem is that quering those parameters involves VOCTRL which in turn involves whole render cycle of delay. Instead update VO params on each draw_frame. This requires changes to VO reconfiguration condition, but in practice it should only be triggered when image size or data layout changes. In other cases it will be handled internal by VO driver. I'm not quite happy with this solution, but don't see better one without changing observe/notify logic significantly. There is no good way currently to handle VOCTRL that are constantly queried. This adds unfortunate synchronization of player command with VO thread, but there is not way around that and if too frequent queries of this param becomes a problem we ca