MPD默认选择第一个音轨、字幕
This commit is contained in:
parent
e07510e36d
commit
dd3f4fc81d
|
@ -60,7 +60,7 @@ namespace N_m3u8DL_RE.Common.Entity
|
|||
else
|
||||
{
|
||||
prefixStr = $"[aqua]Vid[/] {encStr}";
|
||||
var d = $"{Resolution} | {Bandwidth / 1000} Kbps | {Name} | {FrameRate} | {Codecs} | {(Playlist != null ? Playlist.MediaParts.Sum(x => x.MediaSegments.Count) + " Segments" : "")}";
|
||||
var d = $"{Resolution} | {Bandwidth / 1000} Kbps | {GroupId} | {FrameRate} | {Codecs} | {(Playlist != null ? Playlist.MediaParts.Sum(x => x.MediaSegments.Count) + " Segments" : "")}";
|
||||
returnStr = d.EscapeMarkup();
|
||||
}
|
||||
|
||||
|
|
|
@ -445,7 +445,7 @@ namespace N_m3u8DL_RE.Parser.Extractor
|
|||
{
|
||||
//基本信息
|
||||
StreamSpec streamSpec = new();
|
||||
streamSpec.Name = item["FormatId"].GetValue<string>();
|
||||
streamSpec.GroupId = item["FormatId"].GetValue<string>();
|
||||
streamSpec.Bandwidth = item["Tbr"].GetValue<int>();
|
||||
streamSpec.Codecs = item["Codecs"].GetValue<string>();
|
||||
streamSpec.Language = item["Language"].GetValue<string>();
|
||||
|
@ -543,14 +543,40 @@ namespace N_m3u8DL_RE.Parser.Extractor
|
|||
streamSpec.Playlist = playlist;
|
||||
streamList.Add(streamSpec);
|
||||
}
|
||||
|
||||
//为视频设置默认轨道
|
||||
var aL = streamList.Where(s => s.MediaType == MediaType.AUDIO);
|
||||
var sL = streamList.Where(s => s.MediaType == MediaType.SUBTITLES);
|
||||
foreach (var item in streamList)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(item.Resolution))
|
||||
{
|
||||
if (aL.Any())
|
||||
{
|
||||
item.AudioId = aL.First().GroupId;
|
||||
}
|
||||
if (sL.Any())
|
||||
{
|
||||
item.SubtitleId = sL.First().GroupId;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return streamList;
|
||||
}
|
||||
|
||||
static bool CheckValid(string url)
|
||||
bool CheckValid(string url)
|
||||
{
|
||||
try
|
||||
{
|
||||
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(new Uri(url));
|
||||
if (ParserConfig.Headers != null)
|
||||
{
|
||||
foreach (var item in ParserConfig.Headers)
|
||||
{
|
||||
request.Headers.Add(item.Key, item.Value);
|
||||
}
|
||||
}
|
||||
request.Timeout = 120000;
|
||||
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
|
||||
if (((int)response.StatusCode).ToString().StartsWith("2")) return true;
|
||||
|
|
|
@ -32,8 +32,8 @@ namespace N_m3u8DL_RE
|
|||
//Logger.LogLevel = LogLevel.DEBUG;
|
||||
var config = new ParserConfig();
|
||||
var url = string.Empty;
|
||||
url = "http://playertest.longtailvideo.com/adaptive/oceans_aes/oceans_aes.m3u8";
|
||||
//url = "https://bitmovin-a.akamaihd.net/content/MI201109210084_1/mpds/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.mpd";
|
||||
//url = "http://playertest.longtailvideo.com/adaptive/oceans_aes/oceans_aes.m3u8";
|
||||
url = "https://bitmovin-a.akamaihd.net/content/MI201109210084_1/mpds/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.mpd";
|
||||
|
||||
if (string.IsNullOrEmpty(url))
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue