New command Video > Stream Quality (Alt+q)

This commit is contained in:
stax76
2024-10-14 15:18:11 +02:00
parent a0d2fb6a4e
commit 0b646cedb5
4 changed files with 27 additions and 4 deletions

View File

@@ -33,6 +33,7 @@ public class GuiCommand
{
["add-to-path"] = args => AddToPath(),
["edit-conf-file"] = EditCongFile,
["install-command-palette"] = args => InstallCommandPalette(),
["load-audio"] = LoadAudio,
["load-sub"] = LoadSubtitle,
["move-window"] = args => MoveWindow?.Invoke(args[0]),
@@ -56,9 +57,9 @@ public class GuiCommand
["show-profiles"] = args => Msg.ShowInfo(Player.GetProfiles()),
["show-properties"] = args => Player.Command("script-binding select/show-properties"),
["show-protocols"] = args => ShowProtocols(),
["window-scale"] = args => WindowScaleNet?.Invoke(float.Parse(args[0], CultureInfo.InvariantCulture)),
["install-command-palette"] = args => InstallCommandPalette(),
["show-recent-in-command-palette"] = args => ShowRecentFilesInCommandPalette(),
["stream-quality"] = args => StreamQuality(),
["window-scale"] = args => WindowScaleNet?.Invoke(float.Parse(args[0], CultureInfo.InvariantCulture)),
// deprecated
@@ -288,6 +289,22 @@ public class GuiCommand
}
}
void StreamQuality()
{
int version = Player.GetPropertyInt("user-data/command-palette/version");
if (version >= 1)
Player.Command("script-message-to command_palette show-command-palette \"Stream Quality\"");
else
{
var r = Msg.ShowQuestion("The Stream Quality feature requires the command palette to be installed." + BR2 +
"Would you like to install the command palette now?");
if (r == MessageBoxResult.OK)
Player.Command("script-message-to mpvnet install-command-palette");
}
}
void ShowRecentFilesInCommandPalette()
{
Obj o = new();

View File

@@ -81,6 +81,7 @@ public static class InputHelp
Add(b, new (_("Video"), _("Toggle Deinterlace"), "cycle deinterlace", "d"));
Add(b, new (_("Video"), _("Change Aspect Ratio"), "cycle-values video-aspect-override 16:9 4:3 2.35:1 0 -1", "a"));
Add(b, new (_("Video"), _("Rotate Video"), "cycle-values video-rotate 90 180 270 0", "Ctrl+r"));
Add(b, new (_("Video"), _("Stream Quality"), "script-message-to mpvnet stream-quality", "Alt+q"));
Add(b, new (_("Audio"), _("Audio Device")));
Add(b, new (_("Audio"), _("Next Track"), "script-message-to mpvnet cycle-audio", "KP7"));