视频无杜比视界时支持杜比全景声

pull/514/merge
leiurayer 2 years ago
parent 395f8df0ec
commit 7deee50280

@ -95,7 +95,7 @@ namespace DownKyi.Services
/// <param name="playUrl"></param>
/// <param name="defaultAudioQuality"></param>
/// <returns></returns>
private static ObservableCollection<string> GetAudioQualityFormatList(PlayUrl playUrl, int defaultAudioQuality)
private static ObservableCollection<string> GetAudioQualityFormatList_old(PlayUrl playUrl, int defaultAudioQuality)
{
List<string> audioQualityFormatList = new List<string>();
@ -122,6 +122,43 @@ namespace DownKyi.Services
return new ObservableCollection<string>(audioQualityFormatList);
}
/// <summary>
/// 设置音质
/// </summary>
/// <param name="playUrl"></param>
/// <param name="defaultAudioQuality"></param>
/// <returns></returns>
private static ObservableCollection<string> GetAudioQualityFormatList(PlayUrl playUrl, int defaultAudioQuality)
{
List<string> audioQualityFormatList = new List<string>();
if (playUrl.Dash.Audio != null && playUrl.Dash.Audio.Count > 0)
{
foreach (PlayUrlDashVideo audio in playUrl.Dash.Audio)
{
// 音质id大于设置画质时跳过
if (audio.Id > defaultAudioQuality) { continue; }
Quality audioQuality = Constant.GetAudioQualities().FirstOrDefault(t => { return t.Id == audio.Id; });
if (audioQuality != null)
{
ListHelper.AddUnique(audioQualityFormatList, audioQuality.Name);
}
}
}
if (playUrl.Dash.Dolby.Audio != null && playUrl.Dash.Dolby.Audio.Count > 0)
{
ListHelper.AddUnique(audioQualityFormatList, Constant.GetAudioQualities().Last().Name);
}
audioQualityFormatList.Sort(new StringLogicalComparer<string>());
audioQualityFormatList.Reverse();
return new ObservableCollection<string>(audioQualityFormatList);
}
/// <summary>
/// 设置画质 & 视频编码
/// </summary>
@ -191,7 +228,7 @@ namespace DownKyi.Services
// 设置选中的视频编码
VideoQuality selectedVideoQuality = videoQualityList.FirstOrDefault(t => t.Quality == video.Id);
if(selectedVideoQuality == null) { continue; }
if (selectedVideoQuality == null) { continue; }
if (videoQualityList[videoQualityList.IndexOf(selectedVideoQuality)].VideoCodecList.Count == 1)
{

@ -91,32 +91,32 @@ namespace DownKyi.ViewModels.PageViewModels
/// </summary>
private void ExecuteVideoQualitySelectedCommand()
{
// 杜比视界
string dolby = string.Empty;
try
{
var qualities = Constant.GetAudioQualities();
dolby = qualities[3].Name;
}
catch (Exception e)
{
Core.Utils.Debugging.Console.PrintLine("ExecuteVideoQualitySelectedCommand()发生异常: {0}", e);
LogManager.Error("ExecuteVideoQualitySelectedCommand", e);
}
if (VideoQuality != null && VideoQuality.Quality == 126 && PlayUrl != null && PlayUrl.Dash != null && PlayUrl.Dash.Dolby != null)
{
ListHelper.AddUnique(AudioQualityFormatList, dolby);
AudioQualityFormat = dolby;
}
else
{
if (AudioQualityFormatList.Contains(dolby))
{
AudioQualityFormatList.Remove(dolby);
AudioQualityFormat = AudioQualityFormatList[0];
}
}
//// 杜比视界
//string dolby = string.Empty;
//try
//{
// var qualities = Constant.GetAudioQualities();
// dolby = qualities[3].Name;
//}
//catch (Exception e)
//{
// Core.Utils.Debugging.Console.PrintLine("ExecuteVideoQualitySelectedCommand()发生异常: {0}", e);
// LogManager.Error("ExecuteVideoQualitySelectedCommand", e);
//}
//if (VideoQuality != null && VideoQuality.Quality == 126 && PlayUrl != null && PlayUrl.Dash != null && PlayUrl.Dash.Dolby != null)
//{
// ListHelper.AddUnique(AudioQualityFormatList, dolby);
// AudioQualityFormat = dolby;
//}
//else
//{
// if (AudioQualityFormatList.Contains(dolby))
// {
// AudioQualityFormatList.Remove(dolby);
// AudioQualityFormat = AudioQualityFormatList[0];
// }
//}
}
#endregion

Loading…
Cancel
Save