mirror of
https://github.com/jellyfin/BDInfo.git
synced 2024-11-23 14:19:41 +00:00
parent
918e7166b0
commit
5f26cd78bd
@ -57,6 +57,7 @@ namespace BDInfo
|
||||
public bool IsPSP = false;
|
||||
public bool Is3D = false;
|
||||
public bool Is50Hz = false;
|
||||
public bool IsUHD = false;
|
||||
|
||||
public bool IsImage = false;
|
||||
public FileStream IoStream = null;
|
||||
@ -147,6 +148,26 @@ namespace BDInfo
|
||||
VolumeLabel = CdReader.VolumeLabel;
|
||||
Size = (ulong)GetDiscDirectorySize(DiscDirectoryRoot);
|
||||
|
||||
var indexFiles = DiscDirectoryBDMV?.GetFiles();
|
||||
DiscFileInfo indexFile = null;
|
||||
|
||||
for (int i = 0; i < indexFiles?.Length; i++)
|
||||
{
|
||||
if (indexFiles[i].Name.ToLower() == "index.bdmv")
|
||||
{
|
||||
indexFile = indexFiles[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (indexFile != null)
|
||||
{
|
||||
using (var indexStream = indexFile.OpenRead())
|
||||
{
|
||||
ReadIndexVersion(indexStream);
|
||||
}
|
||||
}
|
||||
|
||||
if (null != GetDiscDirectory("BDSVM", DiscDirectoryRoot, 0))
|
||||
{
|
||||
IsBDPlus = true;
|
||||
@ -244,7 +265,27 @@ namespace BDInfo
|
||||
{
|
||||
VolumeLabel = GetVolumeLabel(DirectoryRoot);
|
||||
Size = (ulong)GetDirectorySize(DirectoryRoot);
|
||||
|
||||
|
||||
var indexFiles = DirectoryBDMV.GetFiles();
|
||||
FileInfo indexFile = null;
|
||||
|
||||
for (int i = 0; i < indexFiles.Length; i++)
|
||||
{
|
||||
if (indexFiles[i].Name.ToLower() == "index.bdmv")
|
||||
{
|
||||
indexFile = indexFiles[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (indexFile != null)
|
||||
{
|
||||
using (var indexStream = indexFile.OpenRead())
|
||||
{
|
||||
ReadIndexVersion(indexStream);
|
||||
}
|
||||
}
|
||||
|
||||
if (null != GetDirectory("BDSVM", DirectoryRoot, 0))
|
||||
{
|
||||
IsBDPlus = true;
|
||||
@ -662,6 +703,18 @@ namespace BDInfo
|
||||
}
|
||||
}
|
||||
|
||||
private void ReadIndexVersion(Stream indexStream)
|
||||
{
|
||||
var buffer = new byte[8];
|
||||
int count = indexStream.Read(buffer, 0, 8);
|
||||
int pos = 0;
|
||||
if (count > 0)
|
||||
{
|
||||
var indexVer = ToolBox.ReadString(buffer, count, ref pos);
|
||||
IsUHD = indexVer == "INDX0300";
|
||||
}
|
||||
}
|
||||
|
||||
public void CloseDiscImage()
|
||||
{
|
||||
if (IsImage && CdReader != null)
|
||||
|
@ -272,7 +272,7 @@ namespace BDInfo
|
||||
|
||||
int pos = 0;
|
||||
|
||||
FileType = ReadString(data, 8, ref pos);
|
||||
FileType = ToolBox.ReadString(data, 8, ref pos);
|
||||
if (FileType != "MPLS0100" && FileType != "MPLS0200" && FileType != "MPLS0300")
|
||||
{
|
||||
throw new Exception(string.Format(
|
||||
@ -303,8 +303,8 @@ namespace BDInfo
|
||||
{
|
||||
int itemStart = pos;
|
||||
int itemLength = ReadInt16(data, ref pos);
|
||||
string itemName = ReadString(data, 5, ref pos);
|
||||
string itemType = ReadString(data, 4, ref pos);
|
||||
string itemName = ToolBox.ReadString(data, 5, ref pos);
|
||||
string itemType = ToolBox.ReadString(data, 4, ref pos);
|
||||
|
||||
TSStreamFile streamFile = null;
|
||||
string streamFileName = string.Format(
|
||||
@ -366,8 +366,8 @@ namespace BDInfo
|
||||
pos += 2;
|
||||
for (int angle = 0; angle < angles - 1; angle++)
|
||||
{
|
||||
string angleName = ReadString(data, 5, ref pos);
|
||||
string angleType = ReadString(data, 4, ref pos);
|
||||
string angleName = ToolBox.ReadString(data, 5, ref pos);
|
||||
string angleType = ToolBox.ReadString(data, 4, ref pos);
|
||||
pos += 1;
|
||||
|
||||
TSStreamFile angleFile = null;
|
||||
@ -664,7 +664,7 @@ namespace BDInfo
|
||||
TSSampleRate sampleRate = (TSSampleRate)
|
||||
(audioFormat & 0xF);
|
||||
|
||||
string audioLanguage = ReadString(data, 3, ref pos);
|
||||
string audioLanguage = ToolBox.ReadString(data, 3, ref pos);
|
||||
|
||||
stream = new TSAudioStream();
|
||||
((TSAudioStream)stream).ChannelLayout = channelLayout;
|
||||
@ -686,7 +686,7 @@ namespace BDInfo
|
||||
case TSStreamType.INTERACTIVE_GRAPHICS:
|
||||
case TSStreamType.PRESENTATION_GRAPHICS:
|
||||
|
||||
string graphicsLanguage = ReadString(data, 3, ref pos);
|
||||
string graphicsLanguage = ToolBox.ReadString(data, 3, ref pos);
|
||||
|
||||
stream = new TSGraphicsStream();
|
||||
((TSGraphicsStream)stream).LanguageCode = graphicsLanguage;
|
||||
@ -708,7 +708,7 @@ namespace BDInfo
|
||||
case TSStreamType.SUBTITLE:
|
||||
|
||||
int code = ReadByte(data, ref pos); // TODO
|
||||
string textLanguage = ReadString(data, 3, ref pos);
|
||||
string textLanguage = ToolBox.ReadString(data, 3, ref pos);
|
||||
|
||||
stream = new TSTextStream();
|
||||
((TSTextStream)stream).LanguageCode = textLanguage;
|
||||
@ -1288,19 +1288,6 @@ namespace BDInfo
|
||||
}
|
||||
}
|
||||
|
||||
protected string ReadString(
|
||||
byte[] data,
|
||||
int count,
|
||||
ref int pos)
|
||||
{
|
||||
string val =
|
||||
ASCIIEncoding.ASCII.GetString(data, pos, count);
|
||||
|
||||
pos += count;
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
protected int ReadInt32(
|
||||
byte[] data,
|
||||
ref int pos)
|
||||
|
@ -274,13 +274,13 @@ namespace BDInfo
|
||||
(int)(listViewStreamFiles.ClientSize.Width * 0.23);
|
||||
|
||||
listViewStreams.Columns[0].Width =
|
||||
(int)(listViewStreams.ClientSize.Width * 0.20);
|
||||
(int)(listViewStreams.ClientSize.Width * 0.22);
|
||||
listViewStreams.Columns[1].Width =
|
||||
(int)(listViewStreams.ClientSize.Width * 0.10);
|
||||
listViewStreams.Columns[2].Width =
|
||||
(int)(listViewStreams.ClientSize.Width * 0.10);
|
||||
listViewStreams.Columns[3].Width =
|
||||
(int)(listViewStreams.ClientSize.Width * 0.60);
|
||||
(int)(listViewStreams.ClientSize.Width * 0.58);
|
||||
}
|
||||
|
||||
private void FormMain_FormClosing(
|
||||
@ -458,6 +458,10 @@ namespace BDInfo
|
||||
}
|
||||
|
||||
List<string> features = new List<string>();
|
||||
if (BDROM.IsUHD)
|
||||
{
|
||||
features.Add("Ultra HD");
|
||||
}
|
||||
if (BDROM.Is50Hz)
|
||||
{
|
||||
features.Add("50Hz Content");
|
||||
|
@ -56,8 +56,7 @@ namespace BDInfo
|
||||
textBoxReport.Text = "";
|
||||
|
||||
string report = "";
|
||||
string protection = (BDROM.IsBDPlus ? "BD+" : "AACS");
|
||||
string bdjava = (BDROM.IsBDJava ? "Yes" : "No");
|
||||
string protection = (BDROM.IsBDPlus ? "BD+" : BDROM.IsUHD ? "AACS2" : "AACS");
|
||||
|
||||
report += string.Format(
|
||||
"{0,-16}{1}\r\n", "Disc Title:", BDROM.VolumeLabel);
|
||||
@ -65,10 +64,16 @@ namespace BDInfo
|
||||
"{0,-16}{1:N0} bytes\r\n", "Disc Size:", BDROM.Size);
|
||||
report += string.Format(
|
||||
"{0,-16}{1}\r\n", "Protection:", protection);
|
||||
report += string.Format(
|
||||
"{0,-16}{1}\r\n", "BD-Java:", bdjava);
|
||||
|
||||
List<string> extraFeatures = new List<string>();
|
||||
if (BDROM.IsUHD)
|
||||
{
|
||||
extraFeatures.Add("Ultra HD");
|
||||
}
|
||||
if (BDROM.IsBDJava)
|
||||
{
|
||||
extraFeatures.Add("BD-Java");
|
||||
}
|
||||
if (BDROM.Is50Hz)
|
||||
{
|
||||
extraFeatures.Add("50Hz Content");
|
||||
@ -377,8 +382,7 @@ namespace BDInfo
|
||||
"{0,-16}{1:N0} bytes\r\n", "Disc Size:", BDROM.Size);
|
||||
report += string.Format(
|
||||
"{0,-16}{1}\r\n", "Protection:", protection);
|
||||
report += string.Format(
|
||||
"{0,-16}{1}\r\n", "BD-Java:", bdjava);
|
||||
|
||||
if (extraFeatures.Count > 0)
|
||||
{
|
||||
report += string.Format(
|
||||
@ -432,8 +436,7 @@ namespace BDInfo
|
||||
"Disc Size: {0:N0} bytes\r\n", BDROM.Size);
|
||||
summary += string.Format(
|
||||
"Protection: {0}\r\n", protection);
|
||||
summary += string.Format(
|
||||
"BD-Java: {0}\r\n", bdjava);
|
||||
|
||||
summary += string.Format(
|
||||
"Playlist: {0}\r\n", title);
|
||||
summary += string.Format(
|
||||
|
@ -18,6 +18,7 @@
|
||||
//=============================================================================
|
||||
|
||||
using System;
|
||||
using System.Text;
|
||||
|
||||
namespace BDInfo
|
||||
{
|
||||
@ -31,5 +32,18 @@ namespace BDInfo
|
||||
var digitGroups = (int)(Math.Log10(fSize) / Math.Log10(1024));
|
||||
return $"{fSize/Math.Pow(1024, digitGroups):#,##0.#}" + " " + units[digitGroups];
|
||||
}
|
||||
|
||||
public static string ReadString(
|
||||
byte[] data,
|
||||
int count,
|
||||
ref int pos)
|
||||
{
|
||||
string val =
|
||||
Encoding.ASCII.GetString(data, pos, count);
|
||||
|
||||
pos += count;
|
||||
|
||||
return val;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user