Work on mcc

This commit is contained in:
Nikolaj Olsson 2021-03-27 19:09:05 +01:00
parent 36ff0bc959
commit 97e5a93d2d
3 changed files with 8 additions and 9 deletions

View File

@ -41,12 +41,12 @@ namespace Nikse.SubtitleEdit.Core.Cea708
} }
} }
public CcDataSection(int ccDataCount, byte[] bytes) public CcDataSection(int ccDataCount, byte[] bytes, int sequenceCount)
{ {
DataSection = 0x72; DataSection = 0x72;
ProcessEmData = true; ProcessEmData = true;
ProcessEmData = true; ProcessCcData = true;
ProcessEmData = true; AdditionalData = true;
if (bytes.Length / 2 > 16) if (bytes.Length / 2 > 16)
{ {
@ -80,11 +80,14 @@ namespace Nikse.SubtitleEdit.Core.Cea708
} }
else if (i == 2) else if (i == 2)
{ {
var rollingSequence = sequenceCount % 4; // rolling sequence 0-3
var ccContentLength = bytes.Length / 2 + 2;
var x = (byte)((rollingSequence << 6) + ccContentLength);
CcData[i] = new CcData CcData[i] = new CcData
{ {
Valid = true, Valid = true,
Type = 3, Type = 3,
Data1 = 0x0b, Data1 = (byte)x,
Data2 = 0x33, Data2 = 0x33,
}; };
} }

View File

@ -62,7 +62,7 @@ namespace Nikse.SubtitleEdit.Core.Cea708
CaptionDistributionPacketHeaderSequenceCounter = sequenceCount; CaptionDistributionPacketHeaderSequenceCounter = sequenceCount;
CaptionDistributionPacketHeaderSequenceCounter2 = sequenceCount; CaptionDistributionPacketHeaderSequenceCounter2 = sequenceCount;
CcDataSectionCcData = new CcDataSection(ccDataCount, bytes); CcDataSectionCcData = new CcDataSection(ccDataCount, bytes, sequenceCount);
CcServiceInfoSection = new CcServiceInfoSection(); CcServiceInfoSection = new CcServiceInfoSection();
} }

View File

@ -32,10 +32,6 @@ namespace Nikse.SubtitleEdit.Core.Cea708
{ {
var bytes = new List<byte>(); var bytes = new List<byte>();
var smpte291M = new Smpte291M(counter, 20, bytes.ToArray()); var smpte291M = new Smpte291M(counter, 20, bytes.ToArray());
smpte291M.CcDataSectionCcData.CcData[2].Valid = false;
smpte291M.CcDataSectionCcData.CcData[2].Type = 2;
smpte291M.CcDataSectionCcData.CcData[2].Data1 = 0;
smpte291M.CcDataSectionCcData.CcData[2].Data2 = 0;
var resultBytes = smpte291M.GetBytes(); var resultBytes = smpte291M.GetBytes();
var hex = ByteArrayToHexString(resultBytes); var hex = ByteArrayToHexString(resultBytes);
return hex; return hex;