This commit is contained in:
Frank Skare
2020-04-27 15:41:16 +02:00
parent c67d5f10f8
commit 27d6026213
4 changed files with 10 additions and 8 deletions

View File

@@ -3,7 +3,7 @@
![GitHub closed pull requests](https://img.shields.io/github/issues-pr-closed/stax76/mpv.net) ![GitHub closed issues](https://img.shields.io/github/issues-closed/stax76/mpv.net) ![GitHub All Releases](https://img.shields.io/github/downloads/stax76/mpv.net/total) ![GitHub tag (latest by date)](https://img.shields.io/github/tag-date/stax76/mpv.net) ![GitHub stars](https://img.shields.io/github/stars/stax76/mpv.net) ![GitHub closed pull requests](https://img.shields.io/github/issues-pr-closed/stax76/mpv.net) ![GitHub closed issues](https://img.shields.io/github/issues-closed/stax76/mpv.net) ![GitHub All Releases](https://img.shields.io/github/downloads/stax76/mpv.net/total) ![GitHub tag (latest by date)](https://img.shields.io/github/tag-date/stax76/mpv.net) ![GitHub stars](https://img.shields.io/github/stars/stax76/mpv.net)
?? mpv.net 🎞 mpv.net
========== ==========
mpv.net is a modern media player for Windows based on the popular [mpv](https://mpv.io) player. mpv.net is a modern media player for Windows based on the popular [mpv](https://mpv.io) player.

View File

@@ -286,10 +286,16 @@ namespace mpvnet
using (MediaInfo mi = new MediaInfo(path)) using (MediaInfo mi = new MediaInfo(path))
{ {
MediaTrack[] audTracks = mp.MediaTracks.Where(track => track.Type == "a").ToArray(); MediaTrack[] audTracks = mp.MediaTracks.Where(track => track.Type == "a").ToArray();
if (audTracks.Length < 2) return;
if (audTracks.Length < 2)
return;
int aid = mp.get_property_int("aid"); int aid = mp.get_property_int("aid");
aid += 1; aid += 1;
if (aid > audTracks.Length) aid = 1;
if (aid > audTracks.Length)
aid = 1;
mp.commandv("set", "aid", aid.ToString()); mp.commandv("set", "aid", aid.ToString());
mp.commandv("show-text", audTracks[aid - 1].Text.Substring(3), "5000"); mp.commandv("show-text", audTracks[aid - 1].Text.Substring(3), "5000");
} }

View File

@@ -8,7 +8,7 @@ public static class ConsoleHelp
public static void WriteError(object obj, string module = null) => Write(obj, module, ConsoleColor.Red, false); public static void WriteError(object obj, string module = null) => Write(obj, module, ConsoleColor.Red, false);
public static void Write(object obj, string module) public static void Write(object obj, string module = "mpv.net")
{ {
Write(obj, module, ConsoleColor.Black, true); Write(obj, module, ConsoleColor.Black, true);
} }

View File

@@ -44,7 +44,6 @@ namespace mpvnet
public static event Action Idle; // idle MPV_EVENT_IDLE public static event Action Idle; // idle MPV_EVENT_IDLE
public static event Action Pause; // MPV_EVENT_PAUSE public static event Action Pause; // MPV_EVENT_PAUSE
public static event Action Unpause; // MPV_EVENT_UNPAUSE public static event Action Unpause; // MPV_EVENT_UNPAUSE
public static event Action Tick; // tick MPV_EVENT_TICK
public static event Action ScriptInputDispatch; // MPV_EVENT_SCRIPT_INPUT_DISPATCH public static event Action ScriptInputDispatch; // MPV_EVENT_SCRIPT_INPUT_DISPATCH
public static event Action<string[]> ClientMessage; // client-message MPV_EVENT_CLIENT_MESSAGE public static event Action<string[]> ClientMessage; // client-message MPV_EVENT_CLIENT_MESSAGE
public static event Action VideoReconfig; // video-reconfig MPV_EVENT_VIDEO_RECONFIG public static event Action VideoReconfig; // video-reconfig MPV_EVENT_VIDEO_RECONFIG
@@ -413,9 +412,6 @@ namespace mpvnet
case mpv_event_id.MPV_EVENT_UNPAUSE: case mpv_event_id.MPV_EVENT_UNPAUSE:
Unpause?.Invoke(); Unpause?.Invoke();
break; break;
case mpv_event_id.MPV_EVENT_TICK:
Tick?.Invoke();
break;
case mpv_event_id.MPV_EVENT_SCRIPT_INPUT_DISPATCH: case mpv_event_id.MPV_EVENT_SCRIPT_INPUT_DISPATCH:
ScriptInputDispatch?.Invoke(); ScriptInputDispatch?.Invoke();
break; break;