From b3cf21df5d10f6635dd41b1e5eb94f0a6a4155e4 Mon Sep 17 00:00:00 2001 From: nilaoda Date: Tue, 29 Nov 2022 15:46:47 +0800 Subject: [PATCH] =?UTF-8?q?major=20brand=E4=BF=AE=E6=94=B9=E4=B8=BA`isml`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Mp4/MSSMoovProcessor.cs | 25 ++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/src/N_m3u8DL-RE.Parser/Mp4/MSSMoovProcessor.cs b/src/N_m3u8DL-RE.Parser/Mp4/MSSMoovProcessor.cs index b57045c..26b9a00 100644 --- a/src/N_m3u8DL-RE.Parser/Mp4/MSSMoovProcessor.cs +++ b/src/N_m3u8DL-RE.Parser/Mp4/MSSMoovProcessor.cs @@ -244,10 +244,11 @@ namespace N_m3u8DL_RE.Parser.Mp4 using var stream = new MemoryStream(); using var writer = new BinaryWriter2(stream); - writer.Write("iso6"); //major brand + writer.Write("isml"); //major brand writer.WriteUInt(1); //minor version - writer.Write("isom"); //compatible brand writer.Write("iso5"); //compatible brand + writer.Write("iso6"); //compatible brand + writer.Write("piff"); //compatible brand writer.Write("msdh"); //compatible brand return Box("ftyp", stream.ToArray()); @@ -762,6 +763,22 @@ namespace N_m3u8DL_RE.Parser.Mp4 return psshBox; } + private byte[] GenMoof() + { + using var stream = new MemoryStream(); + using var writer = new BinaryWriter2(stream); + + //make senc + writer.WriteUInt(1); //sample_count + writer.Write(new byte[8]); //8 bytes IV + + var sencBox = FullBox("senc", 1, 0, stream.ToArray()); + + var moofBox = Box("moof", sencBox); //Movie Extends Box + + return moofBox; + } + public byte[] GenHeader(byte[] firstSegment) { new MP4Parser() @@ -842,9 +859,11 @@ namespace N_m3u8DL_RE.Parser.Mp4 var moovBox = Box("moov", moovPayload); //Movie Box - stream.Write(moovBox); + //var moofBox = GenMoof(); //Movie Extends Box + //stream.Write(moofBox); + return stream.ToArray(); } }