From f064d75e5d35aa5b96b593a02e93f87a15a9c916 Mon Sep 17 00:00:00 2001 From: nilaoda Date: Fri, 26 Aug 2022 22:37:20 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=89=B2=E5=9F=9F=E8=AF=86?= =?UTF-8?q?=E5=88=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/N_m3u8DL-RE.Common/Entity/StreamSpec.cs | 6 ++++-- src/N_m3u8DL-RE.Parser/Extractor/HLSExtractor.cs | 10 ++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/N_m3u8DL-RE.Common/Entity/StreamSpec.cs b/src/N_m3u8DL-RE.Common/Entity/StreamSpec.cs index b83d7fb..9ccf4dc 100644 --- a/src/N_m3u8DL-RE.Common/Entity/StreamSpec.cs +++ b/src/N_m3u8DL-RE.Common/Entity/StreamSpec.cs @@ -25,6 +25,8 @@ namespace N_m3u8DL_RE.Common.Entity public string? Channels { get; set; } public string? Extension { get; set; } + //补充信息-色域 + public string? VideoRange { get; set; } //外部轨道GroupId (后续寻找对应轨道信息) public string? AudioId { get; set; } @@ -58,7 +60,7 @@ namespace N_m3u8DL_RE.Common.Entity else { prefixStr = $"[aqua]Vid[/] {encStr}"; - var d = $"{Resolution} | {Bandwidth / 1000} Kbps | {GroupId} | {FrameRate} | {Codecs}"; + var d = $"{Resolution} | {Bandwidth / 1000} Kbps | {GroupId} | {FrameRate} | {Codecs} | {VideoRange}"; returnStr = d.EscapeMarkup(); } @@ -101,7 +103,7 @@ namespace N_m3u8DL_RE.Common.Entity else { prefixStr = $"[aqua]Vid[/] {encStr}"; - var d = $"{Resolution} | {Bandwidth / 1000} Kbps | {GroupId} | {FrameRate} | {Codecs} | {segmentsCountStr}"; + var d = $"{Resolution} | {Bandwidth / 1000} Kbps | {GroupId} | {FrameRate} | {Codecs} | {VideoRange} | {segmentsCountStr}"; returnStr = d.EscapeMarkup(); } diff --git a/src/N_m3u8DL-RE.Parser/Extractor/HLSExtractor.cs b/src/N_m3u8DL-RE.Parser/Extractor/HLSExtractor.cs index 3655d00..ef4c806 100644 --- a/src/N_m3u8DL-RE.Parser/Extractor/HLSExtractor.cs +++ b/src/N_m3u8DL-RE.Parser/Extractor/HLSExtractor.cs @@ -125,6 +125,16 @@ namespace N_m3u8DL_RE.Parser.Extractor if (!string.IsNullOrEmpty(subtitleId)) streamSpec.SubtitleId = subtitleId; + var videoRange = ParserUtil.GetAttribute(line, "VIDEO-RANGE"); + if (!string.IsNullOrEmpty(videoRange)) + streamSpec.VideoRange = videoRange; + + //清除多余的编码信息 dvh1.05.06,ec-3 => dvh1.05.06 + if (!string.IsNullOrEmpty(streamSpec.Codecs) && !string.IsNullOrEmpty(streamSpec.AudioId)) + { + streamSpec.Codecs = streamSpec.Codecs.Split(',')[0]; + } + expectPlaylist = true; } else if (line.StartsWith(HLSTags.ext_x_media))