- added skip/lock/crypt/fav flags for cmdb.bin lists

- added config for 4532KB dtv_cmdb_2.bin
- fixed some cmdb config issues (videoPid, channelTypeOld)
This commit is contained in:
Horst Beham
2021-09-04 22:24:56 +02:00
parent c2073534fc
commit ccf090ddfd
8 changed files with 267 additions and 36 deletions

View File

@@ -78,7 +78,7 @@ System requirements
**Hardware**:
- USB stick/SD-card to transfer the channel list between your TV and PC. A stick <= 32 GB with FAT32 file system
is STRONGLY recommended. (Some TVs write gargabe to NTFS and don't support exFAT at all)
is STRONGLY recommended. (Some TVs write garbage to NTFS and don't support exFAT at all)
Build from source
-----------------

View File

@@ -29,6 +29,12 @@ offName=2
lenName=16
[dvbsChannel:196]
offEncrypted=11
maskEncrypted=0x10
offSkip=11
maskSkip=0x20
offLocked=11
maskLocked=0x40
offChannelTypeOld=13
offServiceType=15
offTransponderIndex=16
@@ -99,12 +105,18 @@ offFreqInMhz=16
offSymbolRate=28
[dvbsChannel:200]
#offChannelType=-1
offEncrypted=13
maskEncrypted=0x10
offSkip=13
maskSkip=0x20
offLocked=13
maskLocked=0x40
offChannelTypeOld=15
offServiceType=17
offTransponderIndex=18
offPmtPid=22
offVideoPid=24
offPcrPid=26
offPcrPid=24
offVideoPid=26
offProgramNr=32
offServiceId=34
offAudioPid=52
@@ -141,11 +153,20 @@ offFreqInMhz=16
offSymbolRate=28
[dvbsChannel:256]
offEncrypted=13
maskEncrypted=0x10
offSkip=13
maskSkip=0x20
offLocked=13
maskLocked=0x40
offChannelType=15
offServiceType=16
offFav=18
maskFav=1
offTransponderIndex=20
offPmtPid=22
offPcrPid=26
offVideoPid=28
offProgramNr=32
offServiceId=34
offAudioPid=58
@@ -155,12 +176,66 @@ offProvider=200
lenProvider=52
# Philips format 100 lists - dtv_cmdb_2.bin with 3443 KB
# Philips ChannelMap_100 lists - dtv_cmdb_2.bin with 3443 KB
#[dtv_cmdb_2.bin:3525205]
# blackbox - 4532 KB
#[dtv_cmdb_2.bin:4640189]
[dtv_cmdb_2.bin:4640189]
offChannelBitmap=8
lenChannelBitmap=752
offChannelRecord=0x2f8
lenChannelRecord=608
numChannelRecord=6000
offTransponderBitmap=0x0037acf8
lenTransponderBitmap=376
offTransponderRecord=0x0037ae70
lenTransponderRecord=320
numTransponderRecord=3000
offSatelliteBitmap=0x00468a24
lenSatelliteBitmap=32
offSatelliteRecord=0x00468a44
lenSatelliteRecord=68
numSatelliteRecord=254
[dvbsSatellite:68]
offName=2
lenName=32
offLowFreq=36
offHighFreq=38
[dvbsTransponder:320]
offSatelliteIndex=0
offTransportStreamId=6
offOriginalNetworkId=8
offNetworkId=10
offTransponderIndex=14
offFreqInMhz=16
offSymbolRate=28
[dvbsChannel:608]
offEncrypted=13
maskEncrypted=0x10
offSkip=13
maskSkip=0x20
offLocked=13
maskLocked=0x40
offChannelType=15
offServiceType=16
offFav=18
maskFav=1
offTransponderIndex=20
offPmtPid=22
offPcrPid=26
offVideoPid=28
offProgramNr=32
offServiceId=34
offAudioPid=58
offName=246
lenName=66
offProvider=312
lenProvider=270
@@ -199,11 +274,20 @@ offFreqInMhz=16
offSymbolRate=28
[dvbsChannel:660]
offEncrypted=13
maskEncrypted=0x10
offSkip=13
maskSkip=0x20
offLocked=13
maskLocked=0x40
offChannelType=15
offServiceType=16
offFav=18
maskFav=1
offTransponderIndex=20
offPmtPid=22
offPcrPid=26
offVideoPid=28
offProgramNr=32
offServiceId=34
offAudioPid=58

View File

@@ -21,10 +21,22 @@ namespace ChanSort.Loader.CmdbBin
public CmdbFileSerializer(string inputFile) : base(inputFile)
{
this.Features.FavoritesMode = FavoritesMode.Flags;
this.Features.MaxFavoriteLists = 1;
this.DataRoot.AddChannelList(dvbsTv);
this.DataRoot.AddChannelList(dvbsRadio);
// this.DataRoot.AddChannelList(dvbsData); // there seem to be multiple data lists with Toshiba TVs which all have their own numbering starting at 1. Better don't show data channels at all than dupes
this.ReadConfigurationFromIniFile();
foreach (var list in this.DataRoot.ChannelLists)
{
//list.VisibleColumnFieldNames.Remove(nameof(ChannelInfo.Favorites));
//list.VisibleColumnFieldNames.Remove(nameof(ChannelInfo.Skip));
//list.VisibleColumnFieldNames.Remove(nameof(ChannelInfo.Lock));
list.VisibleColumnFieldNames.Remove(nameof(ChannelInfo.Hidden));
//list.VisibleColumnFieldNames.Remove(nameof(ChannelInfo.Encrypted));
}
}
#region ReadConfigurationFromIniFile()
@@ -109,13 +121,16 @@ namespace ChanSort.Loader.CmdbBin
}
#endregion
#region ReadSatellite()
private void ReadSatellite(DataMapping map, int index)
{
var sat = new Satellite(index);
sat.Name = map.GetString("offName", map.Settings.GetInt("lenName"));
this.DataRoot.AddSatellite(sat);
}
#endregion
#region ReadTransponder()
private void ReadTransponder(DataMapping map, int index)
{
//var idx = map.GetWord("offTransponderIndex"); // seems to be some logical number, skipping a new numbers here and there
@@ -129,6 +144,7 @@ namespace ChanSort.Loader.CmdbBin
tp.SymbolRate = map.GetWord("offSymbolRate");
this.DataRoot.AddTransponder(tp.Satellite, tp);
}
#endregion
#region ReadChannel()
private void ReadChannel(DataMapping chanMap, ChannelList tvList, ChannelList radioList, ChannelList dataList, int recordIndex)
@@ -137,8 +153,9 @@ namespace ChanSort.Loader.CmdbBin
if (channelType == 0) // some file format versions store the channel type in the upper nibble of a byte
channelType = chanMap.GetByte("offChannelTypeOld") >> 4;
var serviceType = chanMap.GetByte("offServiceType");
var apid = chanMap.GetWord("offAudioPid") & 0x1FFF;
var vpid = chanMap.GetWord("offVideoPid") & 0x1FFF;
if (chanMap.Settings.GetInt("offFav", -1) < 0)
this.Features.FavoritesMode = FavoritesMode.None;
ChannelList list;
if (channelType != 0)
@@ -149,10 +166,7 @@ namespace ChanSort.Loader.CmdbBin
list = type == SignalSource.Radio ? radioList : type == SignalSource.Tv ? tvList : dataList;
}
else
{
//list = vpid != 0 && vpid != 0x1FFF ? tvList : apid != 0 && apid != 0x1FFF ? radioList : dataList;
list = tvList;
}
var progNr = (int)chanMap.GetWord("offProgramNr");
if (progNr == 0xFFFE)
@@ -163,8 +177,12 @@ namespace ChanSort.Loader.CmdbBin
ch.ServiceTypeName = Api.LookupData.Instance.GetServiceTypeDescription(ch.ServiceType);
ch.PcrPid = chanMap.GetWord("offPcrPid") & 0x1FFF;
ch.ServiceId = chanMap.GetWord("offServiceId");
ch.AudioPid = apid;
ch.VideoPid = vpid;
ch.AudioPid = chanMap.GetWord("offAudioPid");
ch.Encrypted = chanMap.GetFlag("Encrypted");
ch.VideoPid = chanMap.GetWord("offVideoPid") & 0x1FFF;
ch.Skip = chanMap.GetFlag("Skip");
ch.Lock = chanMap.GetFlag("Locked");
ch.Favorites = chanMap.GetFlag("Fav") ? Favorites.A : 0;
var off = chanMap.BaseOffset + chanMap.GetOffsets("offName")[0];
this.dvbStringDecoder.GetChannelNames(chanMap.Data, off, chanMap.Settings.GetInt("lenName"), out var longName, out var shortName);

View File

@@ -1,4 +1,5 @@
using ChanSort.Api;
using System.IO;
using ChanSort.Api;
namespace ChanSort.Loader.CmdbBin
{
@@ -10,7 +11,15 @@ namespace ChanSort.Loader.CmdbBin
public SerializerBase CreateSerializer(string inputFile)
{
return new CmdbFileSerializer(inputFile);
var dir = Path.GetDirectoryName(inputFile);
// ignore Philips ChannelMap_100 channel lists which don't have atv_cmdb.bin and dtv_cmdb_2.bin in the same folder
var anchorFile = Path.Combine(dir, "dtv_cmdb_2.bin");
if (File.Exists(anchorFile) && File.Exists(Path.Combine(dir, "atv_cmdb.bin")))
return new CmdbFileSerializer(anchorFile);
return null;
}
}
}

View File

@@ -7,7 +7,25 @@
enum ChannelType : byte
{
Tv = 1,
Radio = 2
Radio = 2,
Data = 3,
Data5 = 5
};
struct Flags
{
byte u1 : 3;
byte protected : 1;
byte u2 : 1;
byte skip : 1;
byte locked : 1;
byte u3 : 1;
};
struct ChannelTypeNibble
{
byte unk : 4;
ChannelType type : 4;
};
struct DvbId
@@ -20,7 +38,9 @@ struct Channel_5048
{
var off0 = current_offset;
word channelIndex;
byte u1[13];
byte u1[11];
Flags flags;
byte u1b;
ChannelType channelType;
word serviceType;
byte u2[2];
@@ -36,7 +56,8 @@ struct Channel_5048
byte u6[186];
char name[66];
char provider[270];
byte unk[channelSize - (current_offset - off0)];
byte unk[channelSize - 4 - (current_offset - off0)];
dword bytesum;
};
struct Transponder_5048
@@ -91,6 +112,94 @@ public struct dtv_cmdb_2_5048
};
#undef channelSize
#define channelSize 608
#undef transponderSize
#define transponderSize 320
#undef satelliteSize
#define satelliteSize 68
struct Channel_4532
{
var off0 = current_offset;
word channelIndex;
byte u1[11];
Flags flags;
byte u1b;
ChannelType channelType;
word serviceType;
byte u2[2];
word transponderIndex;
word pmtPid;
word u3;
word pcrPid;
word videoPid;
word u4;
word programNr;
word serviceId;
byte u5[22];
word audioPid;
byte u6[186];
char name[66];
char provider[270];
byte unk[channelSize - 4 - (current_offset - off0)];
dword bytesum;
};
struct Transponder_4532
{
var off0 = current_offset;
word satelliteIndex;
word u1[2];
word tsid;
word onid;
word nid_maybe;
word u2;
word transpoderNumber;
word freqInMhz;
byte u3[10];
word symrate;
byte unk[transponderSize - (current_offset - off0)];
};
struct Satellite_4532
{
var off0 = current_offset;
byte u1[2];
char name[32];
byte u2[2];
word lowFreq;
word highFreq;
byte unk[satelliteSize - (current_offset - off0)];
};
public struct dtv_cmdb_2_4532
{
char magic[4];
word u1;
word u2;
byte channelBitmap[752];
Channel_4532 channels[6000];
byte transponderBitmap[376];
Transponder_4532 transponder[3000];
byte unknownBitmap[32];
struct {
word u1;
word onid;
byte unknownData[50];
} unknown[254];
byte satelliteBitmap[32];
Satellite_4532 satellites[254];
byte _0x30;
};
#undef channelSize
#define channelSize 256
#undef transponderSize
@@ -102,7 +211,9 @@ struct Channel_1684
{
var off0 = current_offset;
word channelIndex;
byte u1[13];
byte u1[11];
Flags flags;
byte u1b;
ChannelType channelType;
word serviceType;
byte u2[2];
@@ -119,7 +230,8 @@ struct Channel_1684
byte u6[90];
char name[50];
char provider[52];
byte unk[channelSize - (current_offset - off0)];
byte unk[channelSize - 4 - (current_offset - off0)];
dword bytesum;
};
struct Transponder_1684
@@ -185,8 +297,10 @@ struct Channel_1322
{
var off0 = current_offset;
word channelIndex;
byte u1[14];
//ChannelType channelType;
byte u1[11];
Flags flags;
byte u1b;
ChannelTypeNibble channelType;
byte u1b;
byte serviceType;
word transponderIndex;
@@ -201,7 +315,8 @@ struct Channel_1322
DvbId audioPid;
byte u6[90];
char name[50];
byte unk[channelSize - (current_offset - off0)];
byte unk[channelSize - 4 - (current_offset - off0)];
dword bytesum;
};
struct Transponder_1322
@@ -265,7 +380,11 @@ struct Channel_1296
{
var off0 = current_offset;
word channelIndex;
byte u1[13];
byte u1[9];
Flags flags_maybe;
byte u1a;
ChannelTypeNibble type;
byte u1b;
byte serviceType;
word transponderIndex;
DvbId pmtPid;
@@ -280,7 +399,8 @@ struct Channel_1296
DvbId audioPid;
byte u6[90];
char name[50];
byte unk[channelSize - (current_offset - off0)];
byte unk[channelSize - 4 -(current_offset - off0)];
dword bytesum;
};
struct Transponder_1296

View File

@@ -6,8 +6,8 @@ ChanSort Change Log
- Philips: added ChanSort.Loader.Philips.ini file to try out different configurations until working ones get confirmed.
- Philips: disabled deleting channels for most file formats (they require files for menu and tuner to be kept in-sync).
- Philips: identified several variants of ChannelMap_100 format which now have special handling.
one that exports \*cmdb\*.bin files is now fully tested and working.
ones that export only .xml files inside the channellib and s2channellib folders should work too, but not confirmed.
- one that exports \*cmdb\*.bin files is now fully tested and working.
- ones that export only .xml files inside the channellib and s2channellib folders should work too, but not confirmed.
- Philips: ChannelFormat_105 and 110 specific settings in .ini, currently best-effort without user confirmation.
- Philips: added support for Repair\\Mgr_chan_s_fta.db lists. Can be read as a reference list, but editing is
currently disabled in the .ini file (enabling it is experimental)

View File

@@ -23,7 +23,7 @@ https://github.com/PredatH0r/ChanSort/wiki/Samsung
- Series based on webOS 2-5 exporting a GlobalClone00001.TLL file
\*: Some devices behave erroneously due to firmware issues.
+: See system requirements for LM-series. xxLM640T is not supported due to its firmware limitations.
+: xxLM640T is not supported due to its firmware limitations.
\#: Only satellite channels supported.
Models with the NetCast operating system don't have the export/import function in the menu. Instead you need to press+hold the
@@ -36,8 +36,8 @@ Always select "none / other / all" and never your cable TV provider or something
<a name="sony"/>Sony
---
- Android-TVs "sdb.xml" files using format "FormateVer" 1.1.0
- KDL 2012/2014 "sdb.xml" files using "FormatVer" 1.0.0, 1.1.0 and 1.2.0
- Android-TVs: "sdb.xml" files using format "FormateVer" 1.1.0
- KDL 2012/2014: "sdb.xml" files using "FormatVer" 1.0.0, 1.1.0 and 1.2.0
<a name="hisense"/>Hisense
---
@@ -49,7 +49,7 @@ Special thanks to Hisense for supporting ChanSort with technical information and
<a name="panasonic"/>Panasonic
---
Most Viera models since 2011 with a channel list formats
Most Viera models since 2011 with channel list formats
- svl.bin
- svl.db
@@ -63,7 +63,7 @@ ChanSort currently supports the formats:
<a name="sharp"/>Sharp (and some models from Dyon, Blaupunkt, Hisense, Changhong, Grundig, alphatronics, JTC Genesis)
---
Some of these TV share similar hardware and can export/import a .csv file allowing to change the channel order:
Some of these TVs share similar hardware and can export/import a .csv file allowing to change the channel order:
- DVBS_Program.csv (alongside cvt_database.dat)
- DVBS_CHANNEL_TABLE.csv (alongside dtv_cmdb\*.bin)
- MS\*_DVBS_CHANNEL_TABLE.csv (alongside MS\*_HOTELMODE_TABLE.json)

View File

@@ -23,7 +23,7 @@ https://github.com/PredatH0r/ChanSort/wiki/Samsung
- Serien basierend auf webOS 2-5, die eine GlobalClone00001.TLL-Datei exportieren
\*: Einige Ger<65>te verhalten sich fehlerhaft aufgrund Probleme in deren Firmware.
+: Siehe Systemanforderungen f<>r die LM-Serie. xxLM640T kann aufgrund von Firmwarem<65>ngeln nicht unterst<73>tzt werden.
+: xxLM640T kann aufgrund von Firmwarem<65>ngeln nicht unterst<73>tzt werden.
\#: Nur Satellitensender werden unterst<73>tzt.
Modelle mit NetCast Betriebssytem beinhalten keine Import/Export Funktion im normalen Men<65>. Um das Geheimmen<65> aufzurufen,
@@ -36,8 +36,8 @@ W
<a name="sony"/>Sony
---
- Android-TV "sdb.xml" Dateien mit Version "FormateVer" 1.1.0
- KDL 2012/2014 "sdb.xml" mit "FormatVer" 1.0.0, 1.1.0 and 1.2.0
- Android-TVs: "sdb.xml" Dateien mit Version "FormateVer" 1.1.0
- KDL 2012/2014: "sdb.xml" mit "FormatVer" 1.0.0, 1.1.0 and 1.2.0
<a name="hisense"/>Hisense
---