mirror of
https://github.com/NohamR/N_m3u8DL-RE.git
synced 2025-05-24 00:48:58 +00:00
Update MSSMoovProcessor.cs
This commit is contained in:
parent
cd4dfb5e75
commit
948f7aa75a
@ -36,8 +36,8 @@ public partial class MSSMoovProcessor
|
||||
private bool IsProtection;
|
||||
private string ProtectionSystemId;
|
||||
private string ProtectionData;
|
||||
private string? ProtecitonKID;
|
||||
private string? ProtecitonKID_PR;
|
||||
private string? ProtectionKID;
|
||||
private string? ProtectionKID_PR;
|
||||
private byte[] UnityMatrix
|
||||
{
|
||||
get
|
||||
@ -166,13 +166,13 @@ public partial class MSSMoovProcessor
|
||||
var text = Encoding.ASCII.GetString(bytes);
|
||||
var kidBytes = Convert.FromBase64String(KIDRegex().Match(text).Groups[1].Value);
|
||||
// save kid for playready
|
||||
this.ProtecitonKID_PR = HexUtil.BytesToHex(kidBytes);
|
||||
this.ProtectionKID_PR = HexUtil.BytesToHex(kidBytes);
|
||||
// fix byte order
|
||||
var reverse1 = new[] { kidBytes[3], kidBytes[2], kidBytes[1], kidBytes[0] };
|
||||
var reverse2 = new[] { kidBytes[5], kidBytes[4], kidBytes[7], kidBytes[6] };
|
||||
Array.Copy(reverse1, 0, kidBytes, 0, reverse1.Length);
|
||||
Array.Copy(reverse2, 0, kidBytes, 4, reverse1.Length);
|
||||
this.ProtecitonKID = HexUtil.BytesToHex(kidBytes);
|
||||
this.ProtectionKID = HexUtil.BytesToHex(kidBytes);
|
||||
}
|
||||
// widevine
|
||||
else if (ProtectionSystemId.ToUpper() == "EDEF8BA9-79D6-4ACE-A3C8-27DCD51D21ED")
|
||||
@ -225,7 +225,7 @@ public partial class MSSMoovProcessor
|
||||
tencPayload.AddRange([0, 0]);
|
||||
tencPayload.Add(0x1); // default_IsProtected
|
||||
tencPayload.Add(0x8); // default_Per_Sample_IV_size
|
||||
tencPayload.AddRange(HexUtil.HexToBytes(ProtecitonKID)); // default_KID
|
||||
tencPayload.AddRange(HexUtil.HexToBytes(ProtectionKID)); // default_KID
|
||||
// tencPayload.Add(0x8);// default_constant_IV_size
|
||||
// tencPayload.AddRange(new byte[8]);// default_constant_IV
|
||||
var tencBox = FullBox("tenc", 0, 0, tencPayload.ToArray());
|
||||
@ -753,10 +753,10 @@ public partial class MSSMoovProcessor
|
||||
using var _stream = new MemoryStream();
|
||||
using var _writer = new BinaryWriter2(_stream);
|
||||
var sysIdData = HexUtil.HexToBytes("edef8ba9-79d6-4ace-a3c8-27dcd51d21ed".Replace("-", ""));
|
||||
// var kid = HexUtil.HexToBytes(ProtecitonKID);
|
||||
// var kid = HexUtil.HexToBytes(ProtectionKID);
|
||||
|
||||
_writer.Write(sysIdData); // SystemID 16 bytes
|
||||
var psshData = HexUtil.HexToBytes($"08011210{ProtecitonKID}1A046E647265220400000000");
|
||||
var psshData = HexUtil.HexToBytes($"08011210{ProtectionKID}1A046E647265220400000000");
|
||||
_writer.WriteUInt(psshData.Length); // Size of Data 4 bytes
|
||||
_writer.Write(psshData); // Data
|
||||
var psshBox = FullBox("pssh", 0, 0, _stream.ToArray());
|
||||
|
Loading…
x
Reference in New Issue
Block a user