- March 24, 2007
- 12,073
- 7,459
- Home Country
-
Germany
- Moderator
- #41
this is the code for patching the PMT for AstonCrypt2. I think that this does only work partitially, maybe more streams/pid need patching too.
missing some PIDs might result in a message from CAM, that it was not able to descramble something...
Question: Do the CAM messages also occur, if you set the CAM type to default (means no patching)?
missing some PIDs might result in a message from CAM, that it was not able to descramble something...
Code:
/// <summary>
/// Patches the PMT to force standard AC3 header.
/// </summary>
/// <param name="PMT">byte array containing the PMT</param>
/// <param name="pmtLength">length of the pmt array</param>
/// <param name="newPmtLength">The new PMT length</param>
/// <returns></returns>
private static byte[] PatchPMT_AstonCrypt2(byte[] PMT, int pmtLength, out int newPmtLength)
{
byte[] newPMT = new byte[1024]; // create a new array.
int ps = 0;
int pd = 0;
for (int i = 0; i < 12; ++i)
newPMT[pd++] = PMT[ps++];
for (int i = 0; i < PMT[11]; ++i)
newPMT[pd++] = PMT[ps++];
// Need to patch audio AC3 channels 0x06, , , , ,0x6A in real AC3 descriptor 0x81, .... for ( at least !) ASTONCRYPT CAM module
while ((ps + 5 < pmtLength) && (pd < 1024))
{
int len = PMT[ps + 4] + 5;
for (int i = 0; i < len; ++i)
{
if (pd >= 1024)
break;
if ((i == 0) && (PMT[ps] == 0x06) && (PMT[ps + 5] == 0x6A)) { newPMT[pd++] = 0x81; ps++; }
else
newPMT[pd++] = PMT[ps++];
}
}
newPmtLength = pd;
return newPMT;
}
Question: Do the CAM messages also occur, if you set the CAM type to default (means no patching)?