This commit is contained in:
nilaoda 2022-06-26 20:17:14 +08:00
parent 9938214310
commit 9722079c65
1 changed files with 4 additions and 4 deletions

View File

@ -253,10 +253,10 @@ namespace N_m3u8DL_RE.Parser.Extractor
if (!representationMsInfo.ContainsKey("TotalNumber") && representationMsInfo.ContainsKey("SegmentDuration")) if (!representationMsInfo.ContainsKey("TotalNumber") && representationMsInfo.ContainsKey("SegmentDuration"))
{ {
segmentDuration = DoubleOrNull(representationMsInfo["SegmentDuration"].GetValue<double>(), representationMsInfo["Timescale"].GetValue<int>()); segmentDuration = DoubleOrNull(representationMsInfo["SegmentDuration"].GetValue<double>(), representationMsInfo["Timescale"].GetValue<int>());
representationMsInfo["TotalNumber"] = (int)Math.Ceiling(periodDuration.TotalSeconds / segmentDuration); representationMsInfo["TotalNumber"] = (long)Math.Ceiling(periodDuration.TotalSeconds / segmentDuration);
} }
var fragments = new JsonArray(); var fragments = new JsonArray();
for (int i = representationMsInfo["StartNumber"].GetValue<int>(); i < representationMsInfo["StartNumber"].GetValue<int>() + representationMsInfo["TotalNumber"].GetValue<int>(); i++) for (int i = representationMsInfo["StartNumber"].GetValue<int>(); i < representationMsInfo["StartNumber"].GetValue<int>() + representationMsInfo["TotalNumber"].GetValue<long>(); i++)
{ {
var segUrl = ""; var segUrl = "";
if (mediaTemplate.Contains("{0:D")) if (mediaTemplate.Contains("{0:D"))
@ -626,12 +626,12 @@ namespace N_m3u8DL_RE.Parser.Extractor
var sE = segmentTimeline.SelectNodes("ns:S", nsMgr); var sE = segmentTimeline.SelectNodes("ns:S", nsMgr);
if (sE?.Count > 0) if (sE?.Count > 0)
{ {
MultisegmentInfo["TotalNumber"] = 0; MultisegmentInfo["TotalNumber"] = 0L;
var SList = new JsonArray(); var SList = new JsonArray();
foreach (XmlElement s in sE) foreach (XmlElement s in sE)
{ {
var r = string.IsNullOrEmpty(s.GetAttribute("r")) ? 0 : Convert.ToInt64(s.GetAttribute("r")); var r = string.IsNullOrEmpty(s.GetAttribute("r")) ? 0 : Convert.ToInt64(s.GetAttribute("r"));
MultisegmentInfo["TotalNumber"] = MultisegmentInfo["TotalNumber"]?.GetValue<int>() + 1 + r; MultisegmentInfo["TotalNumber"] = MultisegmentInfo["TotalNumber"]?.GetValue<long>() + 1 + r;
SList.Add(new JsonObject() SList.Add(new JsonObject()
{ {
["t"] = string.IsNullOrEmpty(s.GetAttribute("t")) ? 0 : Convert.ToInt64(s.GetAttribute("t")), ["t"] = string.IsNullOrEmpty(s.GetAttribute("t")) ? 0 : Convert.ToInt64(s.GetAttribute("t")),