Improved cycle-audio OSD info

This commit is contained in:
Frank Skare
2021-05-13 23:10:45 +02:00
parent 8df330b7aa
commit 45d3386a88
2 changed files with 15 additions and 6 deletions

View File

@@ -13,6 +13,7 @@
position instead of remembering the window center position.
- High DPI multi monitor fix.
- `start-size` option has new options, see in config editor and manual.
- Improved `cycle-audio` OSD info.
5.4.8.8 Beta (2021-05-09)

View File

@@ -298,18 +298,26 @@ namespace mpvnet
public static void CycleAudio()
{
MediaTrack[] tracks = core.MediaTracks.Where(track => track.Type == "a").ToArray();
MediaTrack[] audioTracks = core.MediaTracks.Where(track => track.Type == "a").ToArray();
int len = audioTracks.Length;
if (tracks.Length < 2)
if (len < 1)
{
core.commandv("show-text", "No audio tracks");
return;
}
int aid = core.get_property_int("aid");
if (++aid > tracks.Length)
aid = 1;
if (len > 1)
{
if (++aid > len)
aid = 1;
core.commandv("set", "aid", aid.ToString());
core.commandv("show-text", aid + ": " + tracks[aid - 1].Text.Substring(3), "5000");
core.commandv("set", "aid", aid.ToString());
}
core.commandv("show-text", aid + "/" + len + ": " + audioTracks[aid - 1].Text.Substring(3), "5000");
}
public static void ShowCommands()