mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-26 05:02:36 +01:00
A few fixes for language info from ts files
This commit is contained in:
parent
06bf912e29
commit
7d863c1dca
@ -72,6 +72,7 @@ namespace Nikse.SubtitleEdit.Core
|
||||
{ "DOM", "DO" },
|
||||
{ "ECU", "EC" },
|
||||
{ "EGY", "EG" },
|
||||
{ "ENG", "EN" },
|
||||
{ "SLV", "SV" },
|
||||
{ "GNQ", "GQ" },
|
||||
{ "ERI", "ER" },
|
||||
|
@ -14,11 +14,13 @@ namespace Nikse.SubtitleEdit.Core.TransportStream
|
||||
public byte[] PrivateDataBytes { get; set; }
|
||||
public byte[] Content { get; set; }
|
||||
public string ContentAsString { get; set; }
|
||||
public int Size { get; set; }
|
||||
|
||||
public ProgramMapTableDescriptor(byte[] data, int index)
|
||||
{
|
||||
Tag = data[index];
|
||||
var length = data[index + 1];
|
||||
Size = length + 2;
|
||||
if (Tag == TagCaDescriptor)
|
||||
{
|
||||
Buffer.BlockCopy(data, index + 2, CaSystemId, 0, 2);
|
||||
@ -41,21 +43,6 @@ namespace Nikse.SubtitleEdit.Core.TransportStream
|
||||
}
|
||||
}
|
||||
|
||||
public int Length
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Tag == TagCaDescriptor)
|
||||
{
|
||||
return PrivateDataBytes.Length + 4;
|
||||
}
|
||||
|
||||
return Content.Length;
|
||||
}
|
||||
}
|
||||
|
||||
public int Size => Length + 2;
|
||||
|
||||
public static List<ProgramMapTableDescriptor> ReadDescriptors(byte[] data, int size, int index)
|
||||
{
|
||||
var total = 0;
|
||||
@ -65,10 +52,6 @@ namespace Nikse.SubtitleEdit.Core.TransportStream
|
||||
var descriptor = new ProgramMapTableDescriptor(data, total + index);
|
||||
descriptors.Add(descriptor);
|
||||
total += descriptor.Size;
|
||||
if (total != size)
|
||||
{
|
||||
break; // Excepted {size} bytes of descriptors, but got {total} bytes of descriptors.
|
||||
}
|
||||
}
|
||||
return descriptors;
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
var language = _programMapTableParser.GetSubtitleLanguage(id);
|
||||
if (!string.IsNullOrEmpty(language))
|
||||
{
|
||||
listBoxTracks.Items.Add(string.Format(Configuration.Settings.Language.TransportStreamSubtitleChooser.PidLine, id + "=" + language, tsParser.GetDvbSubtitles(id).Count));
|
||||
listBoxTracks.Items.Add(string.Format(Configuration.Settings.Language.TransportStreamSubtitleChooser.PidLine, id + ", " + language, tsParser.GetDvbSubtitles(id).Count));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user