mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-22 19:22:53 +01:00
Work on mcc
This commit is contained in:
parent
2a7f0522d6
commit
4aac94ddc3
@ -64,8 +64,8 @@ namespace Nikse.SubtitleEdit.Core.Cea708
|
||||
{
|
||||
Valid = true,
|
||||
Type = 0,
|
||||
Data1 = 0x97,
|
||||
Data2 = 0xa2,
|
||||
Data1 = 0x80,
|
||||
Data2 = 0x80,
|
||||
};
|
||||
}
|
||||
else if (i == 1)
|
||||
@ -82,13 +82,13 @@ namespace Nikse.SubtitleEdit.Core.Cea708
|
||||
{
|
||||
var rollingSequence = sequenceCount % 4; // rolling sequence 0-3
|
||||
var ccContentLength = bytes.Length / 2 + 2;
|
||||
var x = (byte)((rollingSequence << 6) + ccContentLength);
|
||||
var sequenceAndLength = (byte)((rollingSequence << 6) + ccContentLength);
|
||||
CcData[i] = new CcData
|
||||
{
|
||||
Valid = true,
|
||||
Type = 3,
|
||||
Data1 = (byte)x,
|
||||
Data2 = 0x33,
|
||||
Data1 = sequenceAndLength,
|
||||
Data2 = 0x33, // What is this?
|
||||
};
|
||||
}
|
||||
else
|
||||
|
@ -23,18 +23,13 @@ namespace Nikse.SubtitleEdit.Core.Cea708
|
||||
Start = true;
|
||||
Change = true;
|
||||
Complete = true;
|
||||
ServiceCount = 2;
|
||||
ServiceCount = 1;
|
||||
CcServiceInfoSectionElements = new[]
|
||||
{
|
||||
new CcServiceInfoSectionElement
|
||||
{
|
||||
CaptionServiceNumber = 0,
|
||||
ServiceDataByte = new byte[] { 32, 32, 32, 126, 127, 255},
|
||||
},
|
||||
new CcServiceInfoSectionElement
|
||||
{
|
||||
CaptionServiceNumber = 1,
|
||||
ServiceDataByte = new byte[] { 101, 110, 103, 193, 127, 255},
|
||||
ServiceDataByte = new byte[] { 0x65, 0x6e, 0x67, 0xc1, 0xff, 0xff },
|
||||
},
|
||||
};
|
||||
}
|
||||
|
@ -48,7 +48,6 @@ namespace Nikse.SubtitleEdit.Core.Cea708
|
||||
{
|
||||
DataId = 0x61;
|
||||
SecondaryDataId = 1;
|
||||
DataCount = 0x59;
|
||||
CaptionDistributionPacketId = 0x9669;
|
||||
CaptionDistributionPacketDataCount = 0x59;
|
||||
CaptionDistributionPacketFramingRate = 4; // 29.97
|
||||
@ -64,6 +63,8 @@ namespace Nikse.SubtitleEdit.Core.Cea708
|
||||
|
||||
CcDataSectionCcData = new CcDataSection(ccDataCount, bytes, sequenceCount);
|
||||
CcServiceInfoSection = new CcServiceInfoSection();
|
||||
|
||||
DataCount = 8 + CcDataSectionCcData.GetLength() + CcServiceInfoSection.GetLength();
|
||||
}
|
||||
|
||||
public Smpte291M(byte[] bytes)
|
||||
@ -138,9 +139,13 @@ namespace Nikse.SubtitleEdit.Core.Cea708
|
||||
0xbb
|
||||
}).ToArray();
|
||||
|
||||
// Data count
|
||||
result[2] = (byte)(result.Length - 4);
|
||||
result[5] = (byte)(result.Length - 4);
|
||||
|
||||
// Calculate number that will make the checksum zero
|
||||
long total = 0;
|
||||
for (var i = 3; i < result.Length - 3; i++)
|
||||
for (var i = 3; i < result.Length - 2; i++)
|
||||
{
|
||||
total += result[i];
|
||||
}
|
||||
|
@ -32,11 +32,11 @@ namespace Nikse.SubtitleEdit.Core.Cea708
|
||||
{
|
||||
var bytes = new List<byte>();
|
||||
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;
|
||||
smpte291M.CcDataSectionCcData.CcData[3].Valid = false;
|
||||
//smpte291M.CcDataSectionCcData.CcData[2].Valid = false;
|
||||
//smpte291M.CcDataSectionCcData.CcData[2].Type = 2;
|
||||
//smpte291M.CcDataSectionCcData.CcData[2].Data1 = 0;
|
||||
//smpte291M.CcDataSectionCcData.CcData[2].Data2 = 0;
|
||||
//smpte291M.CcDataSectionCcData.CcData[3].Valid = false;
|
||||
var resultBytes = smpte291M.GetBytes();
|
||||
var hex = ByteArrayToHexString(resultBytes);
|
||||
return hex;
|
||||
|
Loading…
Reference in New Issue
Block a user