Skip to content

Commit

Permalink
New command Video > Stream Quality (Alt+q)
Browse files Browse the repository at this point in the history
  • Loading branch information
stax76 committed Oct 14, 2024
1 parent a0d2fb6 commit 0b646ce
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 4 deletions.
6 changes: 4 additions & 2 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
3 changes: 3 additions & 0 deletions docs/manual.md
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,9 @@ Shows available profiles with a message box.
### show-text \<text\> \<duration\> \<font-size\>
Shows a OSD message with given text, duration and font size.

### stream-quality
Shows a menu to select the stream quality.

### window-scale \<factor\>
Works similar as the [window-scale](https://mpv.io/manual/master/#command-interface-window-scale) mpv property.

Expand Down
21 changes: 19 additions & 2 deletions src/MpvNet.Windows/GuiCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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]),
Expand All @@ -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
Expand Down Expand Up @@ -288,6 +289,22 @@ void InstallCommandPalette()
}
}

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();
Expand Down
1 change: 1 addition & 0 deletions src/MpvNet/InputHelp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ public static List<Binding> GetDefaults()
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"));
Expand Down

0 comments on commit 0b646ce

Please sign in to comment.