remove basic view and enhance advanced view of show-info command
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
|
||||
# 6.0.3.1 (202?-??-??)
|
||||
|
||||
- Creating a playlist from a folder uses absolute normalized paths, non media files are ignored.
|
||||
- The basic view of the show-info command was removed, the advanced view was enhanced with a General section and the filename.
|
||||
- Fix OSC hide behavior on mouse move.
|
||||
- MediaInfo v22.06
|
||||
- libmpv shinchiro 2022-07-02
|
||||
|
||||
@@ -321,7 +321,7 @@ Shows available demuxers.
|
||||
Shows the history file when existing.
|
||||
|
||||
### show-info
|
||||
Shows media info on screen, a second key press shows more detailed media info.
|
||||
Shows media info on screen.
|
||||
|
||||
### show-input-editor
|
||||
Shows the input editor.
|
||||
|
||||
@@ -155,30 +155,17 @@ namespace mpvnet
|
||||
}
|
||||
}
|
||||
|
||||
static int LastShowInfo;
|
||||
|
||||
public static void ShowInfo()
|
||||
{
|
||||
if (Core.PlaylistPos == -1)
|
||||
return;
|
||||
|
||||
if (Environment.TickCount - LastShowInfo < 5000)
|
||||
{
|
||||
Core.Command("script-message-to mpvnet show-media-info osd");
|
||||
LastShowInfo = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
LastShowInfo = Environment.TickCount;
|
||||
|
||||
string text;
|
||||
long fileSize = 0;
|
||||
string path = Core.GetPropertyString("path");
|
||||
|
||||
if (File.Exists(path))
|
||||
{
|
||||
fileSize = new FileInfo(path).Length;
|
||||
|
||||
if (CorePlayer.AudioTypes.Contains(path.Ext()))
|
||||
{
|
||||
text = Core.GetPropertyOsdString("filtered-metadata");
|
||||
@@ -187,6 +174,7 @@ namespace mpvnet
|
||||
}
|
||||
else if (CorePlayer.ImageTypes.Contains(path.Ext()))
|
||||
{
|
||||
fileSize = new FileInfo(path).Length;
|
||||
text = "Width: " + Core.GetPropertyInt("width") + "\n" +
|
||||
"Height: " + Core.GetPropertyInt("height") + "\n" +
|
||||
"Size: " + Convert.ToInt32(fileSize / 1024.0) + " KB\n" +
|
||||
@@ -195,6 +183,11 @@ namespace mpvnet
|
||||
Core.CommandV("show-text", text, "5000");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
Core.Command("script-message-to mpvnet show-media-info osd");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (path.Contains("://")) path = Core.GetPropertyString("media-title");
|
||||
@@ -391,6 +384,7 @@ namespace mpvnet
|
||||
else
|
||||
{
|
||||
Core.UpdateExternalTracks();
|
||||
text = "N: " + Core.GetPropertyString("filename") + BR;
|
||||
lock (Core.MediaTracksLock)
|
||||
foreach (MediaTrack track in Core.MediaTracks)
|
||||
text += track.Text + BR;
|
||||
|
||||
@@ -1620,6 +1620,15 @@ namespace mpvnet
|
||||
|
||||
using (MediaInfo mi = new MediaInfo(path))
|
||||
{
|
||||
MediaTrack track = new MediaTrack();
|
||||
Add(track, mi.GetGeneral("Format"));
|
||||
Add(track, mi.GetGeneral("FileSize/String"));
|
||||
Add(track, mi.GetGeneral("Duration/String"));
|
||||
Add(track, mi.GetGeneral("OverallBitRate/String"));
|
||||
track.Text = "G: " + track.Text.Trim(' ', ',');
|
||||
track.Type = "g";
|
||||
tracks.Add(track);
|
||||
|
||||
int videoCount = mi.GetCount(MediaInfoStreamKind.Video);
|
||||
|
||||
for (int i = 0; i < videoCount; i++)
|
||||
@@ -1629,7 +1638,7 @@ namespace mpvnet
|
||||
if (float.TryParse(fps, NumberStyles.Float, CultureInfo.InvariantCulture, out float result))
|
||||
fps = result.ToString(CultureInfo.InvariantCulture);
|
||||
|
||||
MediaTrack track = new MediaTrack();
|
||||
track = new MediaTrack();
|
||||
Add(track, mi.GetVideo(i, "Format"));
|
||||
Add(track, mi.GetVideo(i, "Format_Profile"));
|
||||
Add(track, mi.GetVideo(i, "Width") + "x" + mi.GetVideo(i, "Height"));
|
||||
@@ -1649,7 +1658,7 @@ namespace mpvnet
|
||||
|
||||
for (int i = 0; i < audioCount; i++)
|
||||
{
|
||||
MediaTrack track = new MediaTrack();
|
||||
track = new MediaTrack();
|
||||
Add(track, mi.GetAudio(i, "Language/String"));
|
||||
Add(track, mi.GetAudio(i, "Format"));
|
||||
Add(track, mi.GetAudio(i, "Format_Profile"));
|
||||
@@ -1677,7 +1686,7 @@ namespace mpvnet
|
||||
else if (codec == "VOBSUB")
|
||||
codec = "VOB";
|
||||
|
||||
MediaTrack track = new MediaTrack();
|
||||
track = new MediaTrack();
|
||||
Add(track, mi.GetText(i, "Language/String"));
|
||||
Add(track, codec);
|
||||
Add(track, mi.GetText(i, "Format_Profile"));
|
||||
|
||||
@@ -23,6 +23,12 @@ public class MediaInfo : IDisposable
|
||||
|
||||
public int GetCount(MediaInfoStreamKind kind) => MediaInfo_Count_Get(Handle, kind, -1);
|
||||
|
||||
public string GetGeneral(string parameter)
|
||||
{
|
||||
return Marshal.PtrToStringUni(MediaInfo_Get(Handle, MediaInfoStreamKind.General,
|
||||
0, parameter, MediaInfoKind.Text, MediaInfoKind.Name));
|
||||
}
|
||||
|
||||
public string GetVideo(int stream, string parameter)
|
||||
{
|
||||
return Marshal.PtrToStringUni(MediaInfo_Get(Handle, MediaInfoStreamKind.Video,
|
||||
|
||||
Reference in New Issue
Block a user