-
-
Notifications
You must be signed in to change notification settings - Fork 490
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,18 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
namespace N_m3u8DL_RE.Common.Entity; | ||
|
||
namespace N_m3u8DL_RE.Common.Entity | ||
public class MSSData | ||
{ | ||
public class MSSData | ||
{ | ||
public string FourCC { get; set; } = ""; | ||
public string CodecPrivateData { get; set; } = ""; | ||
public string Type { get; set; } = ""; | ||
public int Timesacle { get; set; } | ||
public int SamplingRate { get; set; } | ||
public int Channels { get; set; } | ||
public int BitsPerSample { get; set; } | ||
public int NalUnitLengthField { get; set; } | ||
public long Duration { get; set; } | ||
public string FourCC { get; set; } = ""; | ||
public string CodecPrivateData { get; set; } = ""; | ||
public string Type { get; set; } = ""; | ||
public int Timesacle { get; set; } | ||
public int SamplingRate { get; set; } | ||
public int Channels { get; set; } | ||
public int BitsPerSample { get; set; } | ||
public int NalUnitLengthField { get; set; } | ||
public long Duration { get; set; } | ||
|
||
public bool IsProtection { get; set; } = false; | ||
public string ProtectionSystemID { get; set; } = ""; | ||
public string ProtectionData { get; set; } = ""; | ||
} | ||
} | ||
public bool IsProtection { get; set; } = false; | ||
public string ProtectionSystemID { get; set; } = ""; | ||
public string ProtectionData { get; set; } = ""; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,7 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
namespace N_m3u8DL_RE.Common.Entity; | ||
|
||
namespace N_m3u8DL_RE.Common.Entity | ||
// 主要处理 EXT-X-DISCONTINUITY | ||
public class MediaPart | ||
{ | ||
//主要处理 EXT-X-DISCONTINUITY | ||
public class MediaPart | ||
{ | ||
public List<MediaSegment> MediaSegments { get; set; } = new List<MediaSegment>(); | ||
} | ||
} | ||
public List<MediaSegment> MediaSegments { get; set; } = new List<MediaSegment>(); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,36 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
namespace N_m3u8DL_RE.Common.Entity; | ||
|
||
namespace N_m3u8DL_RE.Common.Entity | ||
public class MediaSegment | ||
{ | ||
public class MediaSegment | ||
{ | ||
public long Index { get; set; } | ||
public double Duration { get; set; } | ||
public string? Title { get; set; } | ||
public DateTime? DateTime { get; set; } | ||
public long Index { get; set; } | ||
public double Duration { get; set; } | ||
public string? Title { get; set; } | ||
public DateTime? DateTime { get; set; } | ||
|
||
public long? StartRange { get; set; } | ||
public long? StopRange { get => (StartRange != null && ExpectLength != null) ? StartRange + ExpectLength - 1 : null; } | ||
public long? ExpectLength { get; set; } | ||
public long? StartRange { get; set; } | ||
public long? StopRange => (StartRange != null && ExpectLength != null) ? StartRange + ExpectLength - 1 : null; | ||
public long? ExpectLength { get; set; } | ||
|
||
public EncryptInfo EncryptInfo { get; set; } = new EncryptInfo(); | ||
public EncryptInfo EncryptInfo { get; set; } = new EncryptInfo(); | ||
|
||
public string Url { get; set; } | ||
public string Url { get; set; } | ||
Check warning on line 16 in src/N_m3u8DL-RE.Common/Entity/MediaSegment.cs GitHub Actions / build-linux-x64
Check warning on line 16 in src/N_m3u8DL-RE.Common/Entity/MediaSegment.cs GitHub Actions / build-linux-arm64
Check warning on line 16 in src/N_m3u8DL-RE.Common/Entity/MediaSegment.cs GitHub Actions / build-win-x64-arm64
Check warning on line 16 in src/N_m3u8DL-RE.Common/Entity/MediaSegment.cs GitHub Actions / build-mac-x64-arm64
|
||
|
||
public string? NameFromVar { get; set; } //MPD分段文件名 | ||
public string? NameFromVar { get; set; } // MPD分段文件名 | ||
|
||
public override bool Equals(object? obj) | ||
{ | ||
return obj is MediaSegment segment && | ||
Index == segment.Index && | ||
Duration == segment.Duration && | ||
Title == segment.Title && | ||
StartRange == segment.StartRange && | ||
StopRange == segment.StopRange && | ||
ExpectLength == segment.ExpectLength && | ||
Url == segment.Url; | ||
} | ||
public override bool Equals(object? obj) | ||
{ | ||
return obj is MediaSegment segment && | ||
Index == segment.Index && | ||
Math.Abs(Duration - segment.Duration) < 0.001 && | ||
Title == segment.Title && | ||
StartRange == segment.StartRange && | ||
StopRange == segment.StopRange && | ||
ExpectLength == segment.ExpectLength && | ||
Url == segment.Url; | ||
} | ||
|
||
public override int GetHashCode() | ||
{ | ||
return HashCode.Combine(Index, Duration, Title, StartRange, StopRange, ExpectLength, Url); | ||
} | ||
public override int GetHashCode() | ||
{ | ||
return HashCode.Combine(Index, Duration, Title, StartRange, StopRange, ExpectLength, Url); | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,19 @@ | ||
using N_m3u8DL_RE.Common.Enum; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
namespace N_m3u8DL_RE.Common.Entity; | ||
|
||
namespace N_m3u8DL_RE.Common.Entity | ||
public class Playlist | ||
{ | ||
public class Playlist | ||
{ | ||
//对应Url信息 | ||
public string Url { get; set; } | ||
//是否直播 | ||
public bool IsLive { get; set; } = false; | ||
//直播刷新间隔毫秒(默认15秒) | ||
public double RefreshIntervalMs { get; set; } = 15000; | ||
//所有分片时长总和 | ||
public double TotalDuration { get => MediaParts.Sum(x => x.MediaSegments.Sum(m => m.Duration)); } | ||
//所有分片中最长时长 | ||
public double? TargetDuration { get; set; } | ||
//INIT信息 | ||
public MediaSegment? MediaInit { get; set; } | ||
//分片信息 | ||
public List<MediaPart> MediaParts { get; set; } = new List<MediaPart>(); | ||
} | ||
} | ||
// 对应Url信息 | ||
public string Url { get; set; } | ||
Check warning on line 6 in src/N_m3u8DL-RE.Common/Entity/Playlist.cs GitHub Actions / build-linux-x64
Check warning on line 6 in src/N_m3u8DL-RE.Common/Entity/Playlist.cs GitHub Actions / build-linux-arm64
Check warning on line 6 in src/N_m3u8DL-RE.Common/Entity/Playlist.cs GitHub Actions / build-win-x64-arm64
Check warning on line 6 in src/N_m3u8DL-RE.Common/Entity/Playlist.cs GitHub Actions / build-mac-x64-arm64
|
||
// 是否直播 | ||
public bool IsLive { get; set; } = false; | ||
// 直播刷新间隔毫秒(默认15秒) | ||
public double RefreshIntervalMs { get; set; } = 15000; | ||
// 所有分片时长总和 | ||
public double TotalDuration { get => MediaParts.Sum(x => x.MediaSegments.Sum(m => m.Duration)); } | ||
// 所有分片中最长时长 | ||
public double? TargetDuration { get; set; } | ||
// INIT信息 | ||
public MediaSegment? MediaInit { get; set; } | ||
// 分片信息 | ||
public List<MediaPart> MediaParts { get; set; } = new List<MediaPart>(); | ||
} |