- added support for a Hisense HIS_SVL.BIN variant with different data layout (LTDN50K220)

- upgrade to  DevExpress 23.1
- incomplete TechniSat support
This commit is contained in:
Horst Beham
2023-08-13 10:11:22 +02:00
parent 3139f3d9f4
commit e561f71441
31 changed files with 1018 additions and 498 deletions

View File

@@ -6,10 +6,83 @@
RecordSize=40
ID=0
Name=2
NameLength=34
NameSize=34
BlockSize=36
[TSL_Record]
[Version1]
TSL_Record=304
SVL_Record=264
ReadDvb=false
[Version2]
TSL_Record=328
SVL_Record=304
ReadDvb=true
;=== variant with 304 byte TSL record and 264 bytes SVL record (LTDN55K390XWSEU3D V00.01.00a.E0430)
[TSL_Record:304]
RecordSize=304
ID=0
BroadcastType=2
ServiceType=3
Nid=4
Onid=6
Tsid=8
Frequency=16
DvbsSymbolRate=28
Name=188
NameSize=28
[SVL_Record:264]
RecordSize=264
RecordId=0
ChannelId=6
Hashcode=8
Hashcode_Name=0x01
Hashcode_ServiceId=0x02
Hashcode_BroadcastType=0x04
;Hashcode_TslRecId=0x08
;Hashcode_PrgNum=0x10
;Hashcode_ShortName=0x20
NwMask=8
NwMask_Skip = 0x08
NwMask_Fav1 = 0x10
NwMask_Fav2 = 0x20
NwMask_Fav3 = 0x40
NwMask_Fav4 = 0x80
NwMask_Lock = 0x100
NwMask_Radio = 0x0400
NwMask_Encrypted = 0x0800
NwMask_Tv = 0x2000
OptionMask=12
MaskRename = 0x08
MaskMoved = 0x400
;OptionMask2=16
ServiceId=16
TslTableId=18
TslRecordId=20
NwlTableId=22
NwlRecordId=24
SatlTableId=26
SatlRecordId=28
BroadcastType=30
ServiceType=31
Name=32
NameSize=16
BroadcastSystemData=48
;=== variant with 328 byte TSL record and 304 bytes SVL record
[TSL_Record:328]
RecordSize=328
ID=0
BroadcastType=2
@@ -21,10 +94,9 @@ Frequency=16
SymbolRate=20
DvbsSymbolRate=28
Name=216
NameLength=32
NameSize=32
[SVL_Record]
[SVL_Record:304]
RecordSize=304
RecordId=0
@@ -65,13 +137,13 @@ SatlRecordId=36
BroadcastType=38
ServiceType=39
Name=40
NameLength=96
NameSize=96
BroadcastSystemData=136
[DVB_Data]
ShortName=4
ShortNameLength=16
ShortNameSize=16
LinkageMask=28
LinkageMask_Ts=0x04
@@ -89,11 +161,11 @@ SvlRecordId=2
DisplayNumber=4
DisplayNumberLength=10
ChannelName=15
ChannelNameLength=64
ChannelNameSize=64
; ========================================
; HIS_DVB.BIN
; HIS_DVB.BIN with 16 byte header and separate DVB-T, DVB-C, DVB-S data
; ========================================
[HIS_DVB.BIN]
HeaderSize=16
@@ -119,13 +191,44 @@ ServiceId=48
;@62: languages[3]
AudioPid=68
Name=286
NameLength=50
NameSize=50
Provider=336
ProviderLength=50
ProviderSize=50
Tsid=398
Onid=400
Frequency=408
SymbolRate=420
SatName=500
SatNameLength=32
SatOrbitalPos=548
SatNameSize=32
SatOrbitalPos=548
; ========================================
; HIS_DVB.BIN with 8 byte header and shared DVB-C/T, DVB-C data
; ========================================
[HIS_DVB.BIN_shared]
HeaderSize=8
NumChannelsDvbT=0
NumChannelsDvbS=4
[HIS_DVB.BIN_shared_Record]
RecordSizeDvbT=0 ; unknown
RecordSizeDvbS=428
PcrPid=40
VideoPid=42
ProgNum=44
PmtPid=50
ServiceId=52
;@64: languages[3]
AudioPid=70
Name=288
NameSize=50
Provider=
ProviderLength=
Tsid=346
Onid=348
Frequency=
SymbolRate=
SatName=
SatNameSize=
SatOrbitalPos=

View File

@@ -12,7 +12,7 @@ namespace ChanSort.Loader.Hisense.HisBin;
*
* This binary format is based on a customized MediaTek format, which means that there may be many incompatible
* variants that can't be identified and distinguished easily.
* This loader only supports the known Hisense variant with 304 bytes per channel in HIS_SVL.BIN.
* This loader only supports the known HiSense variants with 264 and 304 bytes per channel in HIS_SVL.BIN.
*
* See also the his-svl.h file in Information/FileStructures_for_HHD_Hex_Editor_Neo
*
@@ -34,6 +34,7 @@ public class HisSvlBinSerializer : SerializerBase
private byte[] tslFileContent;
private const int MaxFileSize = 4 << 20; // 4 MB
private bool readDvbData;
private int headerRecordSize, svlRecordSize;
private int tSize, cSize, sSize;
@@ -82,15 +83,9 @@ public class HisSvlBinSerializer : SerializerBase
this.headerMapping = new DataMapping(ini.GetSection("Header"));
this.headerRecordSize = headerMapping.Settings.GetInt("RecordSize");
this.svlMapping = new DataMapping(ini.GetSection("SVL_Record"));
this.svlMapping.DefaultEncoding = this.DefaultEncoding;
this.tslMapping = new DataMapping(ini.GetSection("TSL_Record"));
this.tslMapping.DefaultEncoding = this.DefaultEncoding;
this.dvbMapping = new DataMapping(ini.GetSection("DVB_Data"));
this.dvbMapping.DefaultEncoding = this.DefaultEncoding;
this.favMapping = new DataMapping(ini.GetSection("FAV_Record"));
this.svlRecordSize = this.svlMapping.Settings.GetInt("RecordSize");
}
#endregion
@@ -104,12 +99,48 @@ public class HisSvlBinSerializer : SerializerBase
var i = name.LastIndexOf('_');
var basename = i < 0 ? name : name.Substring(0, i);
this.FileName = Path.Combine(dir, basename + "_SVL.BIN");
this.LoadTslFile(Path.Combine(dir, basename + "_TSL.BIN"));
this.LoadSvlFile(this.FileName);
var tslName = Path.Combine(dir, basename + "_TSL.BIN");
this.favFileName = Path.Combine(dir, basename + "_FAV.BIN");
DetectFormatVersionFromContent(tslName);
this.LoadTslFile(tslName);
this.LoadSvlFile(this.FileName);
this.LoadFavFile(this.favFileName);
}
#endregion
#region DetectFormatVersionFromContent()
private void DetectFormatVersionFromContent(string tslName)
{
var svlLen = new FileInfo(this.FileName).Length;
var tslLen = new FileInfo(tslName).Length;
IniFile.Section candidate = null;
foreach (var section in this.ini.Sections)
{
if (!section.Name.StartsWith("Version"))
continue;
if ((tslLen - this.headerRecordSize * 3) % section.GetInt("TSL_Record") != 0)
continue;
if ((svlLen - this.headerRecordSize * 3) % section.GetInt("SVL_Record") != 0)
continue;
if (candidate != null)
throw LoaderException.Fail("Unable to uniquely infer file format from its content");
candidate = section;
}
if (candidate == null)
throw LoaderException.Fail("File content doesn't match any known SVL/TSL/FAV.bin data format versions");
var tslRecordSize = candidate.GetInt("TSL_Record");
this.svlRecordSize = candidate.GetInt("SVL_Record");
this.readDvbData = candidate.GetBool("ReadDvb");
this.svlMapping = new DataMapping(ini.GetSection("SVL_Record:" + this.svlRecordSize));
this.svlMapping.DefaultEncoding = this.DefaultEncoding;
this.tslMapping = new DataMapping(ini.GetSection("TSL_Record:" + tslRecordSize));
this.tslMapping.DefaultEncoding = this.DefaultEncoding;
}
#endregion
#region LoadTslFile()
@@ -154,7 +185,7 @@ public class HisSvlBinSerializer : SerializerBase
if (trans.OriginalNetworkId == 0) // some files have Onid=0 but provide a Nid, which seems to be the Onid
trans.OriginalNetworkId = tslMapping.GetWord("Nid");
trans.TransportStreamId = tslMapping.GetWord("Tsid");
trans.Name = tslMapping.GetString("Name", tslMapping.Settings.GetInt("NameLength"));
trans.Name = tslMapping.GetString("Name", tslMapping.Settings.GetInt("NameSize"));
var z = trans.Name.IndexOf('\0');
if (z >= 0)
trans.Name = trans.Name.Substring(0, z);
@@ -209,7 +240,7 @@ public class HisSvlBinSerializer : SerializerBase
return;
var broadcastDataOffset = svlMapping.Settings.GetInt("BroadcastSystemData");
var nameLength = svlMapping.Settings.GetInt("NameLength");
var nameLength = svlMapping.Settings.GetInt("NameSize");
var source = channels.SignalSource & (SignalSource.MaskBcastSystem | SignalSource.MaskBcastMedium);
for (int i = 0; i < channelCount; i++)
{
@@ -250,6 +281,7 @@ public class HisSvlBinSerializer : SerializerBase
ci.Name = ReadString(svlMapping, "Name", nameLength);
var serviceType = svlMapping.GetByte("ServiceType");
ci.ServiceType = serviceType;
if (serviceType == 1)
{
ci.SignalSource |= SignalSource.Tv;
@@ -307,6 +339,8 @@ public class HisSvlBinSerializer : SerializerBase
#region ReadDvbData()
private void ReadDvbData(ChannelInfo ci)
{
if (!this.readDvbData)
return;
var mask = dvbMapping.GetDword("LinkageMask");
var tsFlag = dvbMapping.Settings.GetInt("LinkageMask_Ts");
@@ -328,11 +362,14 @@ public class HisSvlBinSerializer : SerializerBase
else if ((ci.SignalSource & SignalSource.DvbC) == SignalSource.DvbC)
ci.ChannelOrTransponder = LookupData.Instance.GetDvbcChannelName(ci.FreqInMhz).ToString();
ci.ServiceType = dvbMapping.GetByte("ServiceType");
if (ci.ServiceType != 0)
var serviceType = dvbMapping.GetByte("ServiceType");
if (serviceType != 0)
{
ci.ServiceType = serviceType;
ci.ServiceTypeName = LookupData.Instance.GetServiceTypeDescription(ci.ServiceType);
}
ci.ShortName = dvbMapping.GetString("ShortName", dvbMapping.Settings.GetInt("ShortNameLength"));
ci.ShortName = dvbMapping.GetString("ShortName", dvbMapping.Settings.GetInt("ShortNameSize"));
}
#endregion
@@ -358,7 +395,7 @@ public class HisSvlBinSerializer : SerializerBase
favListSizes[i] = BitConverter.ToInt32(content, i * 4);
var recSize = favMapping.Settings.GetInt("RecordSize");
var dispNumLen = favMapping.Settings.GetInt("DisplayNumberLength");
var dispNumLen = favMapping.Settings.GetInt("DisplayNumberSize");
favMapping.SetDataPtr(content, 16 - recSize);
for (int i = 0; i < 4; i++)
{
@@ -495,8 +532,8 @@ public class HisSvlBinSerializer : SerializerBase
var tmp = new byte[favRecordSize];
favMapping.SetDataPtr(tmp, 0);
var nameLength = favMapping.Settings.GetInt("ChannelNameLength");
var dispNumLength = favMapping.Settings.GetInt("DisplayNumberLength");
var nameLength = favMapping.Settings.GetInt("ChannelNameSize");
var dispNumLength = favMapping.Settings.GetInt("DisplayNumberSize");
for (int i = 1; i <= 4; i++)
{
@@ -551,10 +588,14 @@ public class HisSvlBinSerializer : SerializerBase
if (value == this.DefaultEncoding)
return;
base.DefaultEncoding = value;
this.svlMapping.DefaultEncoding = value;
this.tslMapping.DefaultEncoding = value;
this.dvbMapping.DefaultEncoding = value;
this.ReparseNames();
if (this.svlMapping != null)
{
this.svlMapping.DefaultEncoding = value;
this.tslMapping.DefaultEncoding = value;
this.ReparseNames();
}
}
}
#endregion
@@ -562,8 +603,8 @@ public class HisSvlBinSerializer : SerializerBase
#region ReparseNames()
private void ReparseNames()
{
var nameLength = svlMapping.Settings.GetInt("NameLength");
var shortNameLength = dvbMapping.Settings.GetInt("ShortNameLength");
var nameLength = svlMapping.Settings.GetInt("NameSize");
var shortNameLength = dvbMapping.Settings.GetInt("ShortNameSize");
var dvbOffset = svlMapping.Settings.GetInt("BroadcastSystemData");
foreach (var list in this.DataRoot.ChannelLists)

View File

@@ -6,7 +6,7 @@ namespace ChanSort.Loader.Hisense
public class HisensePlugin : ISerializerPlugin
{
public string DllName { get; set; }
public string PluginName => "Hisense (channel.db, servicelist.db)";
public string PluginName => "Hisense (channel.db, servicelist.db, his_*.bin)";
public string FileFilter => "*.db;*.bin";
public SerializerBase CreateSerializer(string inputFile)