From f2976d3f92b03ee5759375394239e6d423198ce1 Mon Sep 17 00:00:00 2001 From: nilaoda Date: Sun, 13 Nov 2022 12:51:48 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=9D=9E`cenc`=E7=9A=84?= =?UTF-8?q?=E5=9C=BA=E6=99=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/N_m3u8DL-RE.Parser/Mp4/MP4InitUtil.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/N_m3u8DL-RE.Parser/Mp4/MP4InitUtil.cs b/src/N_m3u8DL-RE.Parser/Mp4/MP4InitUtil.cs index 148f850..89191b2 100644 --- a/src/N_m3u8DL-RE.Parser/Mp4/MP4InitUtil.cs +++ b/src/N_m3u8DL-RE.Parser/Mp4/MP4InitUtil.cs @@ -66,11 +66,11 @@ namespace Mp4SubtitleParser info.Scheme = System.Text.Encoding.UTF8.GetString(data[schmIndex..][8..12]); } - if (info.Scheme != "cenc") return; + //if (info.Scheme != "cenc") return; //find KID var tencBytes = new byte[4] { 0x74, 0x65, 0x6E, 0x63 }; - var tencIndex = 0; + var tencIndex = -1; for (int i = 0; i < data.Length - 4; i++) { if (new byte[4] { data[i], data[i + 1], data[i + 2], data[i + 3] }.SequenceEqual(tencBytes)) @@ -79,7 +79,7 @@ namespace Mp4SubtitleParser break; } } - if (tencIndex + 12 < data.Length) + if (tencIndex != -1 && tencIndex + 12 < data.Length) { info.KID = HexUtil.BytesToHex(data[tencIndex..][12..28]).ToLower(); }