From 0b646cedb5ab928d9b0e9d5c7632b7810ce54464 Mon Sep 17 00:00:00 2001 From: stax76 Date: Mon, 14 Oct 2024 15:18:11 +0200 Subject: [PATCH] New command `Video > Stream Quality (Alt+q)` --- docs/changelog.md | 6 ++++-- docs/manual.md | 3 +++ src/MpvNet.Windows/GuiCommand.cs | 21 +++++++++++++++++++-- src/MpvNet/InputHelp.cs | 1 + 4 files changed, 27 insertions(+), 4 deletions(-) diff --git a/docs/changelog.md b/docs/changelog.md index d805241..79b46bd 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -2,11 +2,13 @@ # v7.1.1.3 Beta (????-??-??) - Support for autocreate-playlist, video-exts, audio-exts, image-exts. - Windows 7 support should still work, but needs auto-load-folder to be enabled. + Windows 7 support should still work, but needs auto-load-folder to be enabled + or autoload.lua. - The command palette user script is installable from the context menu under `Settings > Setup > Install Command Palette`. The command palette features are shown in the menu under 'View > Command Palette'. - +- New command to select the stream quality `Video > Stream Quality (Alt+q)`, + this calls the Stream Quality feature of the command palette. # v7.1.1.2 Beta (2024-10-10) diff --git a/docs/manual.md b/docs/manual.md index c5a921b..1d321b2 100644 --- a/docs/manual.md +++ b/docs/manual.md @@ -319,6 +319,9 @@ Shows available profiles with a message box. ### show-text \ \ \ Shows a OSD message with given text, duration and font size. +### stream-quality +Shows a menu to select the stream quality. + ### window-scale \ Works similar as the [window-scale](https://mpv.io/manual/master/#command-interface-window-scale) mpv property. diff --git a/src/MpvNet.Windows/GuiCommand.cs b/src/MpvNet.Windows/GuiCommand.cs index 9653459..2c8d9b4 100644 --- a/src/MpvNet.Windows/GuiCommand.cs +++ b/src/MpvNet.Windows/GuiCommand.cs @@ -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(); diff --git a/src/MpvNet/InputHelp.cs b/src/MpvNet/InputHelp.cs index 311de0a..fb5003e 100644 --- a/src/MpvNet/InputHelp.cs +++ b/src/MpvNet/InputHelp.cs @@ -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"));