mpv-player / mpv

🎥 Command line video player
https://mpv.io
Other
26.71k stars 2.84k forks source link

video/out/gpu/context: convert --gpu-api to object settings list #14261

Closed guidocella closed 1 day ago

guidocella commented 1 month ago

This follows up 96e1f1dfa5 which converted --gpu-context, and has the same advantages as listed there.

Unlike with --gpu-context auto can be used anywhere in the list, e.g. --gpu-api=d3d11,auto works.

I wanted to use the list of GPU contexts as the description in get_type_desc(), but there is no talloc context to allocate it to, so I set a print_help_list to print them. The printed lines don't being with spaces because otherwise they are added to the completions by etc/_mpv.zsh.

github-actions[bot] commented 1 month ago

Download the artifacts for this pull request:

Windows * [mpv-i686-w64-mingw32](https://nightly.link/mpv-player/mpv/actions/artifacts/1668988979.zip) * [mpv-x86_64-w64-mingw32](https://nightly.link/mpv-player/mpv/actions/artifacts/1668991400.zip) * [mpv-x86_64-windows-msvc](https://nightly.link/mpv-player/mpv/actions/artifacts/1669042708.zip)
macOS * [mpv-macos-12-intel](https://nightly.link/mpv-player/mpv/actions/artifacts/1668984504.zip) * [mpv-macos-13-intel](https://nightly.link/mpv-player/mpv/actions/artifacts/1668983705.zip) * [mpv-macos-14-arm](https://nightly.link/mpv-player/mpv/actions/artifacts/1668981478.zip)
na-na-hi commented 1 day ago

The printed lines don't being with spaces because otherwise they are added to the completions by etc/_mpv.zsh.

This can be fixed by printing the GPU API names first instead of context names, right? This is the current behavior of --gpu-api=help. I think this is a bad reason to remove spaces just because some outside scripts can't handle it.

guidocella commented 1 day ago

With the APIs first they get completed twice and the last contexts are interpreted as descriptions:

mpv --gpu-api=<Tab>
auto    -- auto
opengl  -- drm
vulkan  -- displayvk
auto    opengl  vulkan

Actually completing them works though so it's acceptable.

Dudemanguy commented 1 day ago

It's a bit less nice than --gpu-context since using completing --gpu-api here automatically adds a space after the completion. But this is better than the current status quo of "doesn't complete at all" so I'm fine with it if you don't want to investigate further.

guidocella commented 1 day ago

A space is added after completions with only 1 result, --gpu-api doesn't do anything different.

Dudemanguy commented 1 day ago

Ah my bad. I was typing wayland and foolishly thought that was a full completion.